Re: [PATCH RFC 07/34] xfs: port block device access to files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 08, 2024 at 04:34:10PM +1100, Dave Chinner wrote:
> On Wed, Jan 03, 2024 at 01:55:05PM +0100, Christian Brauner wrote:
> > Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> > ---
> >  fs/xfs/xfs_buf.c   | 10 +++++-----
> >  fs/xfs/xfs_buf.h   |  4 ++--
> >  fs/xfs/xfs_super.c | 43 +++++++++++++++++++++----------------------
> >  3 files changed, 28 insertions(+), 29 deletions(-)
> > 
> > diff --git a/fs/xfs/xfs_buf.c b/fs/xfs/xfs_buf.c
> > index 545c7991b9b5..685eb2a9f9d2 100644
> > --- a/fs/xfs/xfs_buf.c
> > +++ b/fs/xfs/xfs_buf.c
> > @@ -1951,7 +1951,7 @@ xfs_free_buftarg(
> >  	fs_put_dax(btp->bt_daxdev, btp->bt_mount);
> >  	/* the main block device is closed by kill_block_super */
> >  	if (btp->bt_bdev != btp->bt_mount->m_super->s_bdev)
> > -		bdev_release(btp->bt_bdev_handle);
> > +		fput(btp->bt_f_bdev);
> 
> bt_bdev_file, please.
> 
> "_f_" is not a meaningful prefix, and if we fill the code up with
> single letter prefixes is becomes completely unreadable. 

Ack to all suggestions.

> 
> >  
> >  	kmem_free(btp);
> >  }
> > @@ -1994,7 +1994,7 @@ xfs_setsize_buftarg_early(
> >  struct xfs_buftarg *
> >  xfs_alloc_buftarg(
> >  	struct xfs_mount	*mp,
> > -	struct bdev_handle	*bdev_handle)
> > +	struct file		*f_bdev)
> 
> 	struct file		*bdev_file)
> >  {
> >  	xfs_buftarg_t		*btp;
> >  	const struct dax_holder_operations *ops = NULL;
> > @@ -2005,9 +2005,9 @@ xfs_alloc_buftarg(
> >  	btp = kmem_zalloc(sizeof(*btp), KM_NOFS);
> >  
> >  	btp->bt_mount = mp;
> > -	btp->bt_bdev_handle = bdev_handle;
> > -	btp->bt_dev = bdev_handle->bdev->bd_dev;
> > -	btp->bt_bdev = bdev_handle->bdev;
> > +	btp->bt_f_bdev = f_bdev;
> > +	btp->bt_bdev = F_BDEV(f_bdev);
> 
> file_bdev(), please. i.e. similar to file_inode().
> 
> 
> > diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> > index 0e64220bffdc..01ef0ef83c41 100644
> > --- a/fs/xfs/xfs_super.c
> > +++ b/fs/xfs/xfs_super.c
> > @@ -362,16 +362,16 @@ STATIC int
> >  xfs_blkdev_get(
> >  	xfs_mount_t		*mp,
> >  	const char		*name,
> > -	struct bdev_handle	**handlep)
> > +	struct file		**f_bdevp)
> 
> 	struct file		**filep
> 
> >  {
> >  	int			error = 0;
> >  
> > -	*handlep = bdev_open_by_path(name,
> > +	*f_bdevp = bdev_file_open_by_path(name,
> >  		BLK_OPEN_READ | BLK_OPEN_WRITE | BLK_OPEN_RESTRICT_WRITES,
> >  		mp->m_super, &fs_holder_ops);
> > -	if (IS_ERR(*handlep)) {
> > -		error = PTR_ERR(*handlep);
> > -		*handlep = NULL;
> > +	if (IS_ERR(*f_bdevp)) {
> > +		error = PTR_ERR(*f_bdevp);
> > +		*f_bdevp = NULL;
> >  		xfs_warn(mp, "Invalid device [%s], error=%d", name, error);
> >  	}
> >  
> > @@ -436,26 +436,25 @@ xfs_open_devices(
> >  {
> >  	struct super_block	*sb = mp->m_super;
> >  	struct block_device	*ddev = sb->s_bdev;
> > -	struct bdev_handle	*logdev_handle = NULL, *rtdev_handle = NULL;
> > +	struct file		*f_logdev = NULL, *f_rtdev = NULL;
> 
> 	struct file		*logdev_file = NULL;
> 	struct file		*rtdev_file = NULL;
> ...
> 
> -Dave.
> -- 
> Dave Chinner
> david@xxxxxxxxxxxxx




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux