summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/disk-io.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2017-06-15 19:48:05 -0400
committerDavid Sterba <dsterba@suse.com>2017-08-16 10:12:04 -0400
commit9f6d251033bc5bd0115c23fae8b6aac5f6263c2c (patch)
treeae3c17550189c0f83634bd65d2586030a5c90d2d /fs/btrfs/disk-io.c
parentabbb3b8ebfec577390873d33076d56bc6e758939 (diff)
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/disk-io.c')
-rw-r--r--fs/btrfs/disk-io.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index b72711ad7121..9b1f4ef54438 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -2694,8 +2694,8 @@ int open_ctree(struct super_block *sb,
2694 btrfs_init_balance(fs_info); 2694 btrfs_init_balance(fs_info);
2695 btrfs_init_async_reclaim_work(&fs_info->async_reclaim_work); 2695 btrfs_init_async_reclaim_work(&fs_info->async_reclaim_work);
2696 2696
2697 sb->s_blocksize = 4096; 2697 sb->s_blocksize = BTRFS_BDEV_BLOCKSIZE;
2698 sb->s_blocksize_bits = blksize_bits(4096); 2698 sb->s_blocksize_bits = blksize_bits(BTRFS_BDEV_BLOCKSIZE);
2699 2699
2700 btrfs_init_btree_inode(fs_info); 2700 btrfs_init_btree_inode(fs_info);
2701 2701
@@ -3316,7 +3316,7 @@ int btrfs_read_dev_one_super(struct block_device *bdev, int copy_num,
3316 if (bytenr + BTRFS_SUPER_INFO_SIZE >= i_size_read(bdev->bd_inode)) 3316 if (bytenr + BTRFS_SUPER_INFO_SIZE >= i_size_read(bdev->bd_inode))
3317 return -EINVAL; 3317 return -EINVAL;
3318 3318
3319 bh = __bread(bdev, bytenr / 4096, BTRFS_SUPER_INFO_SIZE); 3319 bh = __bread(bdev, bytenr / BTRFS_BDEV_BLOCKSIZE, BTRFS_SUPER_INFO_SIZE);
3320 /* 3320 /*
3321 * If we fail to read from the underlying devices, as of now 3321 * If we fail to read from the underlying devices, as of now
3322 * the best option we have is to mark it EIO. 3322 * the best option we have is to mark it EIO.
@@ -3409,7 +3409,7 @@ static int write_dev_supers(struct btrfs_device *device,
3409 btrfs_csum_final(crc, sb->csum); 3409 btrfs_csum_final(crc, sb->csum);
3410 3410
3411 /* One reference for us, and we leave it for the caller */ 3411 /* One reference for us, and we leave it for the caller */
3412 bh = __getblk(device->bdev, bytenr / 4096, 3412 bh = __getblk(device->bdev, bytenr / BTRFS_BDEV_BLOCKSIZE,
3413 BTRFS_SUPER_INFO_SIZE); 3413 BTRFS_SUPER_INFO_SIZE);
3414 if (!bh) { 3414 if (!bh) {
3415 btrfs_err(device->fs_info, 3415 btrfs_err(device->fs_info,
@@ -3468,7 +3468,8 @@ static int wait_dev_supers(struct btrfs_device *device, int max_mirrors)
3468 device->commit_total_bytes) 3468 device->commit_total_bytes)
3469 break; 3469 break;
3470 3470
3471 bh = __find_get_block(device->bdev, bytenr / 4096, 3471 bh = __find_get_block(device->bdev,
3472 bytenr / BTRFS_BDEV_BLOCKSIZE,
3472 BTRFS_SUPER_INFO_SIZE); 3473 BTRFS_SUPER_INFO_SIZE);
3473 if (!bh) { 3474 if (!bh) {
3474 errors++; 3475 errors++;