summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/check-integrity.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-06-16 01:48:05 +0200
committerDavid Sterba <dsterba@suse.com>2017-08-16 16:12:04 +0200
commit9f6d251033bc5bd0115c23fae8b6aac5f6263c2c (patch)
treeae3c17550189c0f83634bd65d2586030a5c90d2d /fs/btrfs/check-integrity.c
parentabbb3b8ebfec577390873d33076d56bc6e758939 (diff)
downloadlinux-9f6d251033bc5bd0115c23fae8b6aac5f6263c2c.tar.gz
linux-9f6d251033bc5bd0115c23fae8b6aac5f6263c2c.tar.bz2
linux-9f6d251033bc5bd0115c23fae8b6aac5f6263c2c.zip
btrfs: use named constant for bdev blocksize
Superblock is read and written using buffer heads, we need to set the bdev blocksize. The magic constant has been hardcoded in several places, so replace it with a named constant. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/check-integrity.c')
-rw-r--r--fs/btrfs/check-integrity.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
index 11d37c94ce05..7d65d98d2790 100644
--- a/fs/btrfs/check-integrity.c
+++ b/fs/btrfs/check-integrity.c
@@ -795,12 +795,12 @@ static int btrfsic_process_superblock_dev_mirror(
dev_bytenr = btrfs_sb_offset(superblock_mirror_num);
if (dev_bytenr + BTRFS_SUPER_INFO_SIZE > device->commit_total_bytes)
return -1;
- bh = __bread(superblock_bdev, dev_bytenr / 4096,
+ bh = __bread(superblock_bdev, dev_bytenr / BTRFS_BDEV_BLOCKSIZE,
BTRFS_SUPER_INFO_SIZE);
if (NULL == bh)
return -1;
super_tmp = (struct btrfs_super_block *)
- (bh->b_data + (dev_bytenr & 4095));
+ (bh->b_data + (dev_bytenr & (BTRFS_BDEV_BLOCKSIZE - 1)));
if (btrfs_super_bytenr(super_tmp) != dev_bytenr ||
btrfs_super_magic(super_tmp) != BTRFS_MAGIC ||
@@ -2758,7 +2758,7 @@ int btrfsic_submit_bh(int op, int op_flags, struct buffer_head *bh)
(op == REQ_OP_WRITE) && bh->b_size > 0) {
u64 dev_bytenr;
- dev_bytenr = 4096 * bh->b_blocknr;
+ dev_bytenr = BTRFS_BDEV_BLOCKSIZE * bh->b_blocknr;
if (dev_state->state->print_mask &
BTRFSIC_PRINT_MASK_SUBMIT_BIO_BH)
pr_info("submit_bh(op=0x%x,0x%x, blocknr=%llu (bytenr %llu), size=%zu, data=%p, bdev=%p)\n",