Message ID | 20201116145809.410558-62-hch@lst.de |
---|---|
State | New |
Headers | show |
Series | [01/78] block: remove the call to __invalidate_device in check_disk_size_change | expand |
On 11/16/20 3:57 PM, Christoph Hellwig wrote: > set_blocksize is used by file systems to use their preferred buffer cache > block size. Block drivers should not set it. > > Signed-off-by: Christoph Hellwig <hch@lst.de> > --- > drivers/block/zram/zram_drv.c | 11 +---------- > drivers/block/zram/zram_drv.h | 1 - > 2 files changed, 1 insertion(+), 11 deletions(-) > Reviewed-by: Hannes Reinecke <hare@suse.de> Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer
On Mon, Nov 16, 2020 at 03:57:52PM +0100, Christoph Hellwig wrote: > set_blocksize is used by file systems to use their preferred buffer cache > block size. Block drivers should not set it. > > Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Minchan Kim <minchan@kernel.org> Thanks. > --- > drivers/block/zram/zram_drv.c | 11 +---------- > drivers/block/zram/zram_drv.h | 1 - > 2 files changed, 1 insertion(+), 11 deletions(-) > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index 3641434a9b154d..d00b5761ec0b21 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -403,13 +403,10 @@ static void reset_bdev(struct zram *zram) > return; > > bdev = zram->bdev; > - if (zram->old_block_size) > - set_blocksize(bdev, zram->old_block_size); > blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); > /* hope filp_close flush all of IO */ > filp_close(zram->backing_dev, NULL); > zram->backing_dev = NULL; > - zram->old_block_size = 0; > zram->bdev = NULL; > zram->disk->fops = &zram_devops; > kvfree(zram->bitmap); > @@ -454,7 +451,7 @@ static ssize_t backing_dev_store(struct device *dev, > struct file *backing_dev = NULL; > struct inode *inode; > struct address_space *mapping; > - unsigned int bitmap_sz, old_block_size = 0; > + unsigned int bitmap_sz; > unsigned long nr_pages, *bitmap = NULL; > struct block_device *bdev = NULL; > int err; > @@ -509,14 +506,8 @@ static ssize_t backing_dev_store(struct device *dev, > goto out; > } > > - old_block_size = block_size(bdev); > - err = set_blocksize(bdev, PAGE_SIZE); > - if (err) > - goto out; > - > reset_bdev(zram); > > - zram->old_block_size = old_block_size; > zram->bdev = bdev; > zram->backing_dev = backing_dev; > zram->bitmap = bitmap; > diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h > index f2fd46daa76045..712354a4207c77 100644 > --- a/drivers/block/zram/zram_drv.h > +++ b/drivers/block/zram/zram_drv.h > @@ -118,7 +118,6 @@ struct zram { > bool wb_limit_enable; > u64 bd_wb_limit; > struct block_device *bdev; > - unsigned int old_block_size; > unsigned long *bitmap; > unsigned long nr_pages; > #endif > -- > 2.29.2 >
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 3641434a9b154d..d00b5761ec0b21 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -403,13 +403,10 @@ static void reset_bdev(struct zram *zram) return; bdev = zram->bdev; - if (zram->old_block_size) - set_blocksize(bdev, zram->old_block_size); blkdev_put(bdev, FMODE_READ|FMODE_WRITE|FMODE_EXCL); /* hope filp_close flush all of IO */ filp_close(zram->backing_dev, NULL); zram->backing_dev = NULL; - zram->old_block_size = 0; zram->bdev = NULL; zram->disk->fops = &zram_devops; kvfree(zram->bitmap); @@ -454,7 +451,7 @@ static ssize_t backing_dev_store(struct device *dev, struct file *backing_dev = NULL; struct inode *inode; struct address_space *mapping; - unsigned int bitmap_sz, old_block_size = 0; + unsigned int bitmap_sz; unsigned long nr_pages, *bitmap = NULL; struct block_device *bdev = NULL; int err; @@ -509,14 +506,8 @@ static ssize_t backing_dev_store(struct device *dev, goto out; } - old_block_size = block_size(bdev); - err = set_blocksize(bdev, PAGE_SIZE); - if (err) - goto out; - reset_bdev(zram); - zram->old_block_size = old_block_size; zram->bdev = bdev; zram->backing_dev = backing_dev; zram->bitmap = bitmap; diff --git a/drivers/block/zram/zram_drv.h b/drivers/block/zram/zram_drv.h index f2fd46daa76045..712354a4207c77 100644 --- a/drivers/block/zram/zram_drv.h +++ b/drivers/block/zram/zram_drv.h @@ -118,7 +118,6 @@ struct zram { bool wb_limit_enable; u64 bd_wb_limit; struct block_device *bdev; - unsigned int old_block_size; unsigned long *bitmap; unsigned long nr_pages; #endif
set_blocksize is used by file systems to use their preferred buffer cache block size. Block drivers should not set it. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/block/zram/zram_drv.c | 11 +---------- drivers/block/zram/zram_drv.h | 1 - 2 files changed, 1 insertion(+), 11 deletions(-)