mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
Btrfs: free space cache: make sure there is always room for generation number
io_ctl_set_generation() assumes that the generation number shares the same page with inline CRCs. Let's make sure this is always true. Signed-off-by: Zhihui Zhang <zzhsuny@gmail.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
694c51fb2e
commit
8f6c72a9e0
1 changed files with 2 additions and 2 deletions
|
@ -300,9 +300,9 @@ static int io_ctl_init(struct btrfs_io_ctl *io_ctl, struct inode *inode,
|
||||||
if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FREE_INO_OBJECTID)
|
if (btrfs_ino(BTRFS_I(inode)) != BTRFS_FREE_INO_OBJECTID)
|
||||||
check_crcs = 1;
|
check_crcs = 1;
|
||||||
|
|
||||||
/* Make sure we can fit our crcs into the first page */
|
/* Make sure we can fit our crcs and generation into the first page */
|
||||||
if (write && check_crcs &&
|
if (write && check_crcs &&
|
||||||
(num_pages * sizeof(u32)) >= PAGE_SIZE)
|
(num_pages * sizeof(u32) + sizeof(u64)) > PAGE_SIZE)
|
||||||
return -ENOSPC;
|
return -ENOSPC;
|
||||||
|
|
||||||
memset(io_ctl, 0, sizeof(struct btrfs_io_ctl));
|
memset(io_ctl, 0, sizeof(struct btrfs_io_ctl));
|
||||||
|
|
Loading…
Reference in a new issue