loop: get rid of lo_blocksize
authorOmar Sandoval <osandov@fb.com>
Thu, 24 Aug 2017 07:03:41 +0000 (00:03 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 31 Aug 2017 19:51:10 +0000 (13:51 -0600)
This is only used for setting the soft block size on the struct
block_device once and then never used again.

Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/loop.c
drivers/block/loop.h

index 407cb172d6e35d090888dae3d0b85fdc35583107..efad2d46a0189ed7cdd34ca93ecbe30672b7261d 100644 (file)
@@ -573,8 +573,6 @@ static void do_loop_switch(struct loop_device *lo, struct switch_request *p)
        mapping = file->f_mapping;
        mapping_set_gfp_mask(old_file->f_mapping, lo->old_gfp_mask);
        lo->lo_backing_file = file;
-       lo->lo_blocksize = S_ISBLK(mapping->host->i_mode) ?
-               mapping->host->i_bdev->bd_block_size : PAGE_SIZE;
        lo->old_gfp_mask = mapping_gfp_mask(mapping);
        mapping_set_gfp_mask(mapping, lo->old_gfp_mask & ~(__GFP_IO|__GFP_FS));
        loop_update_dio(lo);
@@ -867,7 +865,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
        struct file     *file, *f;
        struct inode    *inode;
        struct address_space *mapping;
-       unsigned lo_blocksize;
        int             lo_flags = 0;
        int             error;
        loff_t          size;
@@ -911,9 +908,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
            !file->f_op->write_iter)
                lo_flags |= LO_FLAGS_READ_ONLY;
 
-       lo_blocksize = S_ISBLK(inode->i_mode) ?
-               inode->i_bdev->bd_block_size : PAGE_SIZE;
-
        error = -EFBIG;
        size = get_loop_size(lo, file);
        if ((loff_t)(sector_t)size != size)
@@ -927,7 +921,6 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
        set_device_ro(bdev, (lo_flags & LO_FLAGS_READ_ONLY) != 0);
 
        lo->use_dio = false;
-       lo->lo_blocksize = lo_blocksize;
        lo->lo_device = bdev;
        lo->lo_flags = lo_flags;
        lo->lo_backing_file = file;
@@ -947,7 +940,8 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
        /* let user-space know about the new size */
        kobject_uevent(&disk_to_dev(bdev->bd_disk)->kobj, KOBJ_CHANGE);
 
-       set_blocksize(bdev, lo_blocksize);
+       set_blocksize(bdev, S_ISBLK(inode->i_mode) ?
+                     block_size(inode->i_bdev) : PAGE_SIZE);
 
        lo->lo_state = Lo_bound;
        if (part_shift)
index fecd3f97ef8c7cd9f825e6c58777a1a2bc6f3461..efe57189d01ea0c0b20e40b6b3e74339191c4325 100644 (file)
@@ -48,7 +48,6 @@ struct loop_device {
 
        struct file *   lo_backing_file;
        struct block_device *lo_device;
-       unsigned        lo_blocksize;
        void            *key_data; 
 
        gfp_t           old_gfp_mask;