Re: [PATCH RFC v3 for-6.8/block 04/17] mtd: block2mtd: use bdev apis

2024-01-05 Thread Yu Kuai
Hi, 在 2024/01/05 14:10, Christoph Hellwig 写道: On Thu, Jan 04, 2024 at 12:28:55PM +0100, Jan Kara wrote: What do you think? Because when we are working with the folios it is rather natural to use their mapping for dirty balancing? The real problem is that block2mtd pokes way to deep into

Re: [PATCH RFC v3 for-6.8/block 11/17] erofs: use bdev api

2024-01-04 Thread Yu Kuai
Hi, Jan! 在 2024/01/04 20:02, Jan Kara 写道: On Thu 21-12-23 16:58:26, Yu Kuai wrote: From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_device. Signed-off-by: Yu Kuai I'm not erofs maintainer but IMO this is quite ugly and grows erofs_buf unnecessarily

Re: [PATCH RFC v3 for-6.8/block 04/17] mtd: block2mtd: use bdev apis

2024-01-04 Thread Yu Kuai
Hi, 在 2024/01/04 19:28, Jan Kara 写道: On Thu 21-12-23 16:56:59, Yu Kuai wrote: From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai ... + for (p = folio_address(folio); p

Re: [PATCH RFC v3 for-6.8/block 02/17] xen/blkback: use bdev api in xen_update_blkif_status()

2024-01-04 Thread Yu Kuai
Hi, Jan! 在 2024/01/04 19:06, Jan Kara 写道: On Thu 21-12-23 16:56:57, Yu Kuai wrote: From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/block/xen-blkback/xenbus.c | 3 +-- 1 file changed, 1 insertion(+), 2

[PATCH RFC v3 for-6.8/block 17/17] ext4: use bdev apis

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_device. Signed-off-by: Yu Kuai Reviewed-by: Jan Kara --- fs/ext4/dir.c | 6 ++ fs/ext4/ext4_jbd2.c | 6 +++--- fs/ext4/super.c | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff

[PATCH RFC v3 for-6.8/block 16/17] ext4: remove block_device_ejected()

2023-12-21 Thread Yu Kuai
From: Yu Kuai block_device_ejected() is added by commit bdfe0cbd746a ("Revert "ext4: remove block_device_ejected"") in 2015. At that time 'bdi->wb' is destroyed synchronized from del_gendisk(), hence if ext4 is still mounted, and then mark_buffer_dirty() will reference

[PATCH RFC v3 for-6.8/block 14/17] buffer: add a new helper to read sb block

2023-12-21 Thread Yu Kuai
From: Yu Kuai Unlike __bread_gfp(), ext4 has special handing while reading sb block: 1) __GFP_NOFAIL is not set, and memory allocation can fail; 2) If buffer write failed before, set buffer uptodate and don't read block from disk; 3) REQ_META is set for all IO, and REQ_PRIO is set

[PATCH RFC v3 for-6.8/block 15/17] ext4: use new helper to read sb block

2023-12-21 Thread Yu Kuai
From: Yu Kuai Remove __ext4_sb_bread_gfp() and ext4_buffer_uptodate() that is defined by ext4, and convert to use common helper __bread_gfp2() and buffer_uptodate_or_error(). Signed-off-by: Yu Kuai Reviewed-by: Jan Kara --- fs/ext4/ext4.h| 13 - fs/ext4/inode.c | 8

[PATCH RFC v3 for-6.8/block 13/17] jbd2: use bdev apis

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_device. Signed-off-by: Yu Kuai --- fs/jbd2/journal.c | 3 +-- fs/jbd2/recovery.c | 6 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index

[PATCH RFC v3 for-6.8/block 12/17] nilfs2: use bdev api in nilfs_attach_log_writer()

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_device. Signed-off-by: Yu Kuai --- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 55e31cc903d1..a1130e384937 100644

[PATCH RFC v3 for-6.8/block 11/17] erofs: use bdev api

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_device. Signed-off-by: Yu Kuai --- fs/erofs/data.c | 18 -- fs/erofs/internal.h | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c

[PATCH RFC v3 for-6.8/block 09/17] btrfs: use bdev apis

2023-12-21 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- fs/btrfs/disk-io.c | 71 +- fs/btrfs/volumes.c | 17 ++- fs/btrfs/zoned.c | 15

[PATCH RFC v3 for-6.8/block 08/17] bio: export bio_add_folio_nofail()

2023-12-21 Thread Yu Kuai
From: Yu Kuai Currently btrfs is using __bio_add_page() in write_dev_supers(). In order to convert to use folio for bdev in btrfs, export bio_add_folio_nofail() so that it can replace __bio_add_page(). Signed-off-by: Yu Kuai --- block/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH RFC v3 for-6.8/block 06/17] scsicam: use bdev api in scsi_bios_ptable()

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/scsi/scsicam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c index e2c7d8ef205f

[PATCH RFC v3 for-6.8/block 03/17] bcache: use bdev api in read_super()

2023-12-21 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/md/bcache/super.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/super.c b

[PATCH RFC v3 for-6.8/block 01/17] block: add some bdev apis

2023-12-21 Thread Yu Kuai
From: Yu Kuai Those apis will be used for other modules, so that bd_inode won't be accessed directly from other modules. Signed-off-by: Yu Kuai --- block/bdev.c | 148 + block/blk.h| 2 - include/linux/blkdev.h | 17 + 3

[PATCH RFC v3 for-6.8/block 10/17] cramfs: use bdev apis in cramfs_blkdev_read()

2023-12-21 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Also do some cleanup that there is no need for two for loop, and remove local array pages. Signed-off-by: Yu Kuai --- fs/cramfs/inode.c | 36

[PATCH RFC v3 for-6.8/block 05/17] s390/dasd: use bdev api in dasd_format()

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/s390/block/dasd_ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c

[PATCH RFC v3 for-6.8/block 07/17] bcachefs: remove dead function bdev_sectors()

2023-12-21 Thread Yu Kuai
From: Yu Kuai bdev_sectors() is not used hence remove it. Signed-off-by: Yu Kuai --- fs/bcachefs/util.h | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 2984b57b2958..22a0acc1704f 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h

[PATCH RFC v3 for-6.8/block 00/17] block: don't access bd_inode directly from other modules

2023-12-21 Thread Yu Kuai
From: Yu Kuai Changes in v3: - remove bdev_associated_mapping() and patch 12 from v1; - add kerneldoc comments for new bdev apis; - rename __bdev_get_folio() to bdev_get_folio; - fix a problem in erofs that erofs_init_metabuf() is not always called. - add reviewed-by tag for patch 15-17

[PATCH RFC v3 for-6.8/block 04/17] mtd: block2mtd: use bdev apis

2023-12-21 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/mtd/devices/block2mtd.c | 81 +++-- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git

[PATCH RFC v3 for-6.8/block 02/17] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-21 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/block/xen-blkback/xenbus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback

Re: [PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-12 Thread Yu Kuai
Hi, 在 2023/12/12 21:14, Christoph Hellwig 写道: On Mon, Dec 11, 2023 at 05:52:17PM +0100, Jan Kara wrote: +void bdev_associated_mapping(struct block_device *bdev, +struct address_space *mapping) +{ + mapping->host = bdev->bd_inode; +} Here I'm not sure - is

Re: [PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-12 Thread Yu Kuai
Hi, 在 2023/12/12 21:16, Christoph Hellwig 写道: +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, + pgoff_t end) +{ + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); +} +EXPORT_SYMBOL_GPL(invalidate_bdev_range); Can we have

Re: [PATCH RFC v2 for-6.8/block 11/18] erofs: use bdev api

2023-12-11 Thread Yu Kuai
Hi, 在 2023/12/12 14:35, Gao Xiang 写道: On 2023/12/11 22:07, Yu Kuai wrote: From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai ---   fs/erofs/data.c | 18 --   fs/erofs/internal.h |  2 ++   2 files

Re: [PATCH RFC v2 for-6.8/block 15/18] buffer: add a new helper to read sb block

2023-12-11 Thread Yu Kuai
Hi, 在 2023/12/12 1:27, Jan Kara 写道: On Mon 11-12-23 22:07:53, Yu Kuai wrote: From: Yu Kuai Unlike __bread_gfp(), ext4 has special handing while reading sb block: 1) __GFP_NOFAIL is not set, and memory allocation can fail; 2) If buffer write failed before, set buffer uptodate and don't read

Re: [PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-11 Thread Yu Kuai
Hi, 在 2023/12/12 0:52, Jan Kara 写道: On Mon 11-12-23 22:05:35, Yu Kuai wrote: From: Yu Kuai Those apis will be used for other modules, so that bd_inode won't be accessed directly from other modules. Signed-off-by: Yu Kuai ... +void bdev_associated_mapping(struct block_device *bdev

[PATCH RFC v2 for-6.8/block 18/18] ext4: use bdev apis

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/ext4/dir.c | 6 ++ fs/ext4/ext4_jbd2.c | 6 +++--- fs/ext4/super.c | 3 +-- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/fs/ext4/dir.c b

[PATCH RFC v2 for-6.8/block 17/18] ext4: remove block_device_ejected()

2023-12-11 Thread Yu Kuai
From: Yu Kuai block_device_ejected() is added by commit bdfe0cbd746a ("Revert "ext4: remove block_device_ejected"") in 2015. At that time 'bdi->wb' is destroyed synchronized from del_gendisk(), hence if ext4 is still mounted, and then mark_buffer_dirty() will reference

[PATCH RFC v2 for-6.8/block 16/18] ext4: use new helper to read sb block

2023-12-11 Thread Yu Kuai
From: Yu Kuai Remove __ext4_sb_bread_gfp() and ext4_buffer_uptodate() that is defined by ext4, and convert to use common helper __bread_gfp2() and buffer_uptodate_or_error(). Signed-off-by: Yu Kuai --- fs/ext4/ext4.h| 13 - fs/ext4/inode.c | 8 fs/ext4/super.c

[PATCH RFC v2 for-6.8/block 15/18] buffer: add a new helper to read sb block

2023-12-11 Thread Yu Kuai
From: Yu Kuai Unlike __bread_gfp(), ext4 has special handing while reading sb block: 1) __GFP_NOFAIL is not set, and memory allocation can fail; 2) If buffer write failed before, set buffer uptodate and don't read block from disk; 3) REQ_META is set for all IO, and REQ_PRIO is set

[PATCH RFC v2 for-6.8/block 14/18] jbd2: use bdev apis

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/jbd2/journal.c | 3 +-- fs/jbd2/recovery.c | 6 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index

[PATCH RFC v2 for-6.8/block 12/18] gfs2: use bdev api

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/gfs2/glock.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index

[PATCH RFC v2 for-6.8/block 13/18] nilfs2: use bdev api in nilfs_attach_log_writer()

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 55e31cc903d1..a1130e384937 100644

[PATCH RFC v2 for-6.8/block 11/18] erofs: use bdev api

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/erofs/data.c | 18 -- fs/erofs/internal.h | 2 ++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c

[PATCH RFC v2 for-6.8/block 09/18] btrfs: use bdev apis

2023-12-11 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- fs/btrfs/disk-io.c | 71 +- fs/btrfs/volumes.c | 17 ++- fs/btrfs/zoned.c | 15

[PATCH RFC v2 for-6.8/block 03/18] bcache: use bdev api in read_super()

2023-12-11 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/md/bcache/super.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/super.c b

[PATCH RFC v2 for-6.8/block 05/18] s390/dasd: use bdev api in dasd_format()

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/s390/block/dasd_ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c

[PATCH RFC v2 for-6.8/block 10/18] cramfs: use bdev apis in cramfs_blkdev_read()

2023-12-11 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Also do some cleanup that there is no need for two for loop, and remove local array pages. Signed-off-by: Yu Kuai --- fs/cramfs/inode.c | 36

[PATCH RFC v2 for-6.8/block 02/18] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/block/xen-blkback/xenbus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback

[PATCH RFC v2 for-6.8/block 06/18] scsicam: use bdev api in scsi_bios_ptable()

2023-12-11 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/scsi/scsicam.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c index e2c7d8ef205f

[PATCH RFC v2 for-6.8/block 08/18] bio: export bio_add_folio_nofail()

2023-12-11 Thread Yu Kuai
From: Yu Kuai Currently btrfs is using __bio_add_page() in write_dev_supers(). In order to convert to use folio for bdev in btrfs, export bio_add_folio_nofail() so that it can replace __bio_add_page(). Signed-off-by: Yu Kuai --- block/bio.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH RFC v2 for-6.8/block 01/18] block: add some bdev apis

2023-12-11 Thread Yu Kuai
From: Yu Kuai Those apis will be used for other modules, so that bd_inode won't be accessed directly from other modules. Signed-off-by: Yu Kuai --- block/bdev.c | 70 ++ block/blk.h| 2 -- include/linux/blkdev.h | 17 ++ 3

[PATCH RFC v2 for-6.8/block 07/18] bcachefs: remove dead function bdev_sectors()

2023-12-11 Thread Yu Kuai
From: Yu Kuai bdev_sectors() is not used hence remove it. Signed-off-by: Yu Kuai --- fs/bcachefs/util.h | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 2984b57b2958..22a0acc1704f 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h

[PATCH RFC v2 for-6.8/block 00/18] block: don't access bd_inode directly from other modules

2023-12-11 Thread Yu Kuai
From: Yu Kuai Changes in v2: - remove some bdev apis that is not necessary; - pass in offset for bdev_read_folio() and __bdev_get_folio(); - remove bdev_gfp_constraint() and add a new helper in fs/buffer.c to prevent access bd_indoe() directly from mapping_gfp_constraint() in ext4.(patch 15

[PATCH RFC v2 for-6.8/block 04/18] mtd: block2mtd: use bdev apis

2023-12-11 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/mtd/devices/block2mtd.c | 81 +++-- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-06 Thread Yu Kuai
Hi, 在 2023/12/06 22:58, Matthew Wilcox 写道: On Tue, Dec 05, 2023 at 08:37:15PM +0800, Yu Kuai wrote: +struct folio *bdev_read_folio(struct block_device *bdev, pgoff_t index) +{ + return read_mapping_folio(bdev->bd_inode->i_mapping, index, NULL); +} +EXPORT_SYMBOL_GPL(bdev_read

Re: [PATCH -next RFC 02/14] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-05 Thread Yu Kuai
Hi, 在 2023/12/06 13:55, Christoph Hellwig 写道: On Tue, Dec 05, 2023 at 08:37:16PM +0800, Yu Kuai wrote: diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c index e34219ea2b05..e645afa4af57 100644 --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen

Re: [PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Yu Kuai
Hi, 在 2023/12/06 14:14, Christoph Hellwig 写道: +void invalidate_bdev_range(struct block_device *bdev, pgoff_t start, + pgoff_t end) +{ + invalidate_mapping_pages(bdev->bd_inode->i_mapping, start, end); +} +EXPORT_SYMBOL_GPL(invalidate_bdev_range); All these could

Re: [PATCH -next RFC 00/14] block: don't access bd_inode directly from other modules

2023-12-05 Thread Yu Kuai
Hi, 在 2023/12/06 13:54, Christoph Hellwig 写道: On Tue, Dec 05, 2023 at 08:37:14PM +0800, Yu Kuai wrote: From: Yu Kuai Patch 1 add some bdev apis, then follow up patches will use these apis to avoid access bd_inode directly, and hopefully the field bd_inode can be removed eventually(after

[PATCH -next RFC 12/14] jbd2: use bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/jbd2/journal.c | 3 +-- fs/jbd2/recovery.c | 6 ++ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index

[PATCH -next RFC 14/14] nilfs2: use bdev api in nilfs_attach_log_writer()

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 52995838f2de..be47a1d21889 100644

[PATCH -next RFC 13/14] gfs2: use bdev api

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/gfs2/glock.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c index

[PATCH -next RFC 08/14] btrfs: use bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- fs/btrfs/disk-io.c | 68 -- fs/btrfs/volumes.c | 17 ++-- fs/btrfs/zoned.c | 12

[PATCH -next RFC 06/14] scsicam: use bdev api in scsi_bios_ptable()

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/scsi/scsicam.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c index e2c7d8ef205f

[PATCH -next RFC 00/14] block: don't access bd_inode directly from other modules

2023-12-05 Thread Yu Kuai
From: Yu Kuai Patch 1 add some bdev apis, then follow up patches will use these apis to avoid access bd_inode directly, and hopefully the field bd_inode can be removed eventually(after figure out a way for fs/buffer.c). Yu Kuai (14): block: add some bdev apis xen/blkback: use bdev api

[PATCH -next RFC 04/14] mtd: block2mtd: use bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/mtd/devices/block2mtd.c | 80 +++-- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git

[PATCH -next RFC 11/14] ext4: use bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/ext4/dir.c | 6 ++ fs/ext4/ext4_jbd2.c | 6 +++--- fs/ext4/super.c | 27 --- include/linux/buffer_head.h

[PATCH -next RFC 03/14] bcache: use bdev api in read_super()

2023-12-05 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Signed-off-by: Yu Kuai --- drivers/md/bcache/super.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/md/bcache/super.c b

[PATCH -next RFC 09/14] cramfs: use bdev apis in cramfs_blkdev_read()

2023-12-05 Thread Yu Kuai
From: Yu Kuai On the one hand covert to use folio while reading bdev inode, on the other hand prevent to access bd_inode directly. Also do some cleanup that there is no need for two for loop, and remove local array pages. Signed-off-by: Yu Kuai --- fs/cramfs/inode.c | 35

[PATCH -next RFC 07/14] bcachefs: remove dead function bdev_sectors()

2023-12-05 Thread Yu Kuai
From: Yu Kuai bdev_sectors() is not used hence remove it. Signed-off-by: Yu Kuai --- fs/bcachefs/util.h | 5 - 1 file changed, 5 deletions(-) diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index b93d5f481c7e..932ca6f7a37b 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h

[PATCH -next RFC 10/14] erofs: use bdev api

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- fs/erofs/data.c | 17 +++-- fs/erofs/internal.h | 1 + 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c

[PATCH -next RFC 05/14] s390/dasd: use bdev api in dasd_format()

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/s390/block/dasd_ioctl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c

[PATCH -next RFC 01/14] block: add some bdev apis

2023-12-05 Thread Yu Kuai
From: Yu Kuai Those apis will be used for other modules, so that bd_inode won't be accessed directly from other modules. Signed-off-by: Yu Kuai --- block/bdev.c | 116 + block/bio.c| 1 + block/blk.h| 2 - include

[PATCH -next RFC 02/14] xen/blkback: use bdev api in xen_update_blkif_status()

2023-12-05 Thread Yu Kuai
From: Yu Kuai Avoid to access bd_inode directly, prepare to remove bd_inode from block_devcie. Signed-off-by: Yu Kuai --- drivers/block/xen-blkback/xenbus.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback

Re: [PATCH block/for-next v2 01/16] block: add a new helper to get inode from block_device

2023-11-27 Thread Yu Kuai
Hi, 在 2023/11/28 0:32, Christoph Hellwig 写道: On Mon, Nov 27, 2023 at 09:07:22PM +0800, Yu Kuai wrote: 1) Is't okay to add a new helper to pass in bdev for following apis? For some we already have them (e.g. bdev_nr_bytes to read the bdev) size, for some we need to add them. The big thing

Re: [PATCH block/for-next v2 01/16] block: add a new helper to get inode from block_device

2023-11-27 Thread Yu Kuai
Hi, 在 2023/11/27 15:21, Christoph Hellwig 写道: On Mon, Nov 27, 2023 at 02:21:01PM +0800, Yu Kuai wrote: From: Yu Kuai block_devcie is allocated from bdev_alloc() by bdev_alloc_inode(), and currently block_device contains a pointer that point to the address of inode, while such inode

Re: [PATCH block/for-next v2 07/16] bcachefs: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
Hi, 在 2023/11/27 15:24, Kent Overstreet 写道: On Mon, Nov 27, 2023 at 04:09:47PM +0900, Damien Le Moal wrote: On 11/27/23 15:21, Yu Kuai wrote: From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/bcachefs

[PATCH block/for-next v2 12/16] gfs2: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/gfs2/glock.c | 2 +- fs/gfs2/ops_fstype.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c

[PATCH block/for-next v2 14/16] nilfs2: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/nilfs2/segment.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index 55e31cc903d1

[PATCH block/for-next v2 10/16] erofs: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/erofs/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/data.c b/fs/erofs/data.c index 029c761670bf..85d490b3b53d 100644

[PATCH block/for-next v2 16/16] block: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also remove the field 'bd_inode' since it's not used anymore. Signed-off-by: Yu Kuai --- block/bdev.c | 39 ++- block/blk-zoned.c | 4 ++-- block/fops.c | 4 ++-- block/genhd.c

[PATCH block/for-next v2 13/16] jbd2: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/jbd2/journal.c | 3 ++- fs/jbd2/recovery.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c

[PATCH block/for-next v2 05/16] s390/dasd: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- drivers/s390/block/dasd_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block

[PATCH block/for-next v2 15/16] buffer: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/buffer.c | 8 include/linux/buffer_head.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/buffer.c b/fs

[PATCH block/for-next v2 11/16] ext4: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/ext4/dir.c | 2 +- fs/ext4/ext4_jbd2.c | 2 +- fs/ext4/super.c | 8 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs

[PATCH block/for-next v2 02/16] xen/blkback: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- drivers/block/xen-blkback/xenbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen

[PATCH block/for-next v2 07/16] bcachefs: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/bcachefs/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index 2984b57b2958..fe7ccb3a3517

[PATCH block/for-next v2 09/16] cramfs: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/cramfs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c index 60dbfa0f8805..e9ed1e24c9e4

[PATCH block/for-next v2 03/16] bcache: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- drivers/md/bcache/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c index

[PATCH block/for-next v2 08/16] btrfs: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- fs/btrfs/disk-io.c | 6 +++--- fs/btrfs/volumes.c | 4 ++-- fs/btrfs/zoned.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/btrfs

[PATCH block/for-next v2 04/16] mtd: block2mtd: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- drivers/mtd/devices/block2mtd.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/devices/block2mtd.c b/drivers/mtd

[PATCH block/for-next v2 06/16] scsicam: use new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Which is more efficiency, and also prepare to remove the field 'bd_inode' from block_device. Signed-off-by: Yu Kuai --- drivers/scsi/scsicam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsicam.c b/drivers/scsi/scsicam.c index e2c7d8ef205f

[PATCH block/for-next v2 00/16] block: remove field 'bd_inode' from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai Changes in v2: - split different portions into different patches, as greg k-h suggested. - use container_of() instead of "bdev + 1" to get the address of bd_inode in the new helper, as grep k-h suggested. Yu Kuai (16): block: add a new helper to get inode from bl

[PATCH block/for-next v2 01/16] block: add a new helper to get inode from block_device

2023-11-26 Thread Yu Kuai
From: Yu Kuai block_devcie is allocated from bdev_alloc() by bdev_alloc_inode(), and currently block_device contains a pointer that point to the address of inode, while such inode is allocated together: bdev_alloc inode = new_inode() // inode is _inode->vfs_inode bdev = I_BDEV(in

Re: [PATCH -next] block: remove field 'bd_inode' from block_device

2023-11-26 Thread Yu Kuai
Hi, 在 2023/11/25 22:32, Greg KH 写道: On Sat, Nov 25, 2023 at 05:39:12PM +0800, Yu Kuai wrote: From: Yu Kuai block_devcie is allocated from bdev_alloc() by bdev_alloc_inode(), and currently block_device contains a pointer that point to the address of inode, while such inode is allocated

[PATCH -next] block: remove field 'bd_inode' from block_device

2023-11-25 Thread Yu Kuai
From: Yu Kuai block_devcie is allocated from bdev_alloc() by bdev_alloc_inode(), and currently block_device contains a pointer that point to the address of inode, while such inode is allocated together: bdev_alloc inode = new_inode() // inode is _inode->vfs_inode bdev = I_BDEV(in