Message ID | 20230823104857.11437-23-jack@suse.cz (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | block: Make blkdev_get_by_*() return handle | expand |
On Wed, Aug 23, 2023 at 12:48:34PM +0200, Jan Kara wrote: > Convert f2fs to use bdev_open_by_dev/path() and pass the handle around. > > CC: Jaegeuk Kim <jaegeuk@kernel.org> > CC: Chao Yu <chao@kernel.org> > CC: linux-f2fs-devel@lists.sourceforge.net > Acked-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Jan Kara <jack@suse.cz> > --- Looks good to me, Reviewed-by: Christian Brauner <brauner@kernel.org>
On 2023/8/23 18:48, Jan Kara wrote: > Convert f2fs to use bdev_open_by_dev/path() and pass the handle around. Hi Jan, Seems it will confilct w/ below commit, could you please take a look? https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=51bf8d3c81992ae57beeaf22df78ed7c2782af9d Thanks, > > CC: Jaegeuk Kim <jaegeuk@kernel.org> > CC: Chao Yu <chao@kernel.org> > CC: linux-f2fs-devel@lists.sourceforge.net > Acked-by: Christoph Hellwig <hch@lst.de> > Signed-off-by: Jan Kara <jack@suse.cz> > --- > fs/f2fs/f2fs.h | 1 + > fs/f2fs/super.c | 17 +++++++++-------- > 2 files changed, 10 insertions(+), 8 deletions(-) > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > index e18272ae3119..2ec6c10df636 100644 > --- a/fs/f2fs/f2fs.h > +++ b/fs/f2fs/f2fs.h > @@ -1234,6 +1234,7 @@ struct f2fs_bio_info { > #define FDEV(i) (sbi->devs[i]) > #define RDEV(i) (raw_super->devs[i]) > struct f2fs_dev_info { > + struct bdev_handle *bdev_handle; > struct block_device *bdev; > char path[MAX_PATH_LEN]; > unsigned int total_segments; > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index aa1f9a3a8037..885dcbd81859 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -1561,7 +1561,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi) > int i; > > for (i = 0; i < sbi->s_ndevs; i++) { > - blkdev_put(FDEV(i).bdev, sbi->sb); > + bdev_release(FDEV(i).bdev_handle); > #ifdef CONFIG_BLK_DEV_ZONED > kvfree(FDEV(i).blkz_seq); > #endif > @@ -4196,9 +4196,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) > > if (max_devices == 1) { > /* Single zoned block device mount */ > - FDEV(0).bdev = > - blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode, > - sbi->sb, NULL); > + FDEV(0).bdev_handle = bdev_open_by_dev( > + sbi->sb->s_bdev->bd_dev, mode, sbi->sb, > + NULL); > } else { > /* Multi-device mount */ > memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); > @@ -4216,12 +4216,13 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) > (FDEV(i).total_segments << > sbi->log_blocks_per_seg) - 1; > } > - FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode, > - sbi->sb, NULL); > + FDEV(i).bdev_handle = bdev_open_by_path(FDEV(i).path, > + mode, sbi->sb, NULL); > } > - if (IS_ERR(FDEV(i).bdev)) > - return PTR_ERR(FDEV(i).bdev); > + if (IS_ERR(FDEV(i).bdev_handle)) > + return PTR_ERR(FDEV(i).bdev_handle); > > + FDEV(i).bdev = FDEV(i).bdev_handle->bdev; > /* to release errored devices */ > sbi->s_ndevs = i + 1; >
On Mon 28-08-23 20:57:53, Chao Yu wrote: > On 2023/8/23 18:48, Jan Kara wrote: > > Convert f2fs to use bdev_open_by_dev/path() and pass the handle around. > > Hi Jan, > > Seems it will confilct w/ below commit, could you please take a look? > > https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev&id=51bf8d3c81992ae57beeaf22df78ed7c2782af9d Yes, it will conflict. But I don't plan to rush these patches into the currently running merge window so I can just rebase after the f2fs patch gets upstream. Thanks for the heads up. Honza > > CC: Jaegeuk Kim <jaegeuk@kernel.org> > > CC: Chao Yu <chao@kernel.org> > > CC: linux-f2fs-devel@lists.sourceforge.net > > Acked-by: Christoph Hellwig <hch@lst.de> > > Signed-off-by: Jan Kara <jack@suse.cz> > > --- > > fs/f2fs/f2fs.h | 1 + > > fs/f2fs/super.c | 17 +++++++++-------- > > 2 files changed, 10 insertions(+), 8 deletions(-) > > > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > index e18272ae3119..2ec6c10df636 100644 > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > @@ -1234,6 +1234,7 @@ struct f2fs_bio_info { > > #define FDEV(i) (sbi->devs[i]) > > #define RDEV(i) (raw_super->devs[i]) > > struct f2fs_dev_info { > > + struct bdev_handle *bdev_handle; > > struct block_device *bdev; > > char path[MAX_PATH_LEN]; > > unsigned int total_segments; > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > > index aa1f9a3a8037..885dcbd81859 100644 > > --- a/fs/f2fs/super.c > > +++ b/fs/f2fs/super.c > > @@ -1561,7 +1561,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi) > > int i; > > for (i = 0; i < sbi->s_ndevs; i++) { > > - blkdev_put(FDEV(i).bdev, sbi->sb); > > + bdev_release(FDEV(i).bdev_handle); > > #ifdef CONFIG_BLK_DEV_ZONED > > kvfree(FDEV(i).blkz_seq); > > #endif > > @@ -4196,9 +4196,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) > > if (max_devices == 1) { > > /* Single zoned block device mount */ > > - FDEV(0).bdev = > > - blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode, > > - sbi->sb, NULL); > > + FDEV(0).bdev_handle = bdev_open_by_dev( > > + sbi->sb->s_bdev->bd_dev, mode, sbi->sb, > > + NULL); > > } else { > > /* Multi-device mount */ > > memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); > > @@ -4216,12 +4216,13 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) > > (FDEV(i).total_segments << > > sbi->log_blocks_per_seg) - 1; > > } > > - FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode, > > - sbi->sb, NULL); > > + FDEV(i).bdev_handle = bdev_open_by_path(FDEV(i).path, > > + mode, sbi->sb, NULL); > > } > > - if (IS_ERR(FDEV(i).bdev)) > > - return PTR_ERR(FDEV(i).bdev); > > + if (IS_ERR(FDEV(i).bdev_handle)) > > + return PTR_ERR(FDEV(i).bdev_handle); > > + FDEV(i).bdev = FDEV(i).bdev_handle->bdev; > > /* to release errored devices */ > > sbi->s_ndevs = i + 1;
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index e18272ae3119..2ec6c10df636 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1234,6 +1234,7 @@ struct f2fs_bio_info { #define FDEV(i) (sbi->devs[i]) #define RDEV(i) (raw_super->devs[i]) struct f2fs_dev_info { + struct bdev_handle *bdev_handle; struct block_device *bdev; char path[MAX_PATH_LEN]; unsigned int total_segments; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index aa1f9a3a8037..885dcbd81859 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1561,7 +1561,7 @@ static void destroy_device_list(struct f2fs_sb_info *sbi) int i; for (i = 0; i < sbi->s_ndevs; i++) { - blkdev_put(FDEV(i).bdev, sbi->sb); + bdev_release(FDEV(i).bdev_handle); #ifdef CONFIG_BLK_DEV_ZONED kvfree(FDEV(i).blkz_seq); #endif @@ -4196,9 +4196,9 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) if (max_devices == 1) { /* Single zoned block device mount */ - FDEV(0).bdev = - blkdev_get_by_dev(sbi->sb->s_bdev->bd_dev, mode, - sbi->sb, NULL); + FDEV(0).bdev_handle = bdev_open_by_dev( + sbi->sb->s_bdev->bd_dev, mode, sbi->sb, + NULL); } else { /* Multi-device mount */ memcpy(FDEV(i).path, RDEV(i).path, MAX_PATH_LEN); @@ -4216,12 +4216,13 @@ static int f2fs_scan_devices(struct f2fs_sb_info *sbi) (FDEV(i).total_segments << sbi->log_blocks_per_seg) - 1; } - FDEV(i).bdev = blkdev_get_by_path(FDEV(i).path, mode, - sbi->sb, NULL); + FDEV(i).bdev_handle = bdev_open_by_path(FDEV(i).path, + mode, sbi->sb, NULL); } - if (IS_ERR(FDEV(i).bdev)) - return PTR_ERR(FDEV(i).bdev); + if (IS_ERR(FDEV(i).bdev_handle)) + return PTR_ERR(FDEV(i).bdev_handle); + FDEV(i).bdev = FDEV(i).bdev_handle->bdev; /* to release errored devices */ sbi->s_ndevs = i + 1;