Re: [PATCH DRAFT RFC 34/34] buffer: port block device access to files and get rid of bd_inode access

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

 



On Wed, Jan 03, 2024 at 01:55:32PM +0100, Christian Brauner wrote:
> Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx>
> ---
>  block/fops.c                  |  1 +
>  drivers/md/md-bitmap.c        |  1 +
>  fs/affs/file.c                |  1 +
>  fs/btrfs/inode.c              |  1 +
>  fs/buffer.c                   | 69 ++++++++++++++++++++++---------------------
>  fs/direct-io.c                |  2 +-
>  fs/erofs/data.c               |  7 +++--
>  fs/erofs/internal.h           |  1 +
>  fs/erofs/zmap.c               |  1 +
>  fs/ext2/inode.c               |  8 +++--
>  fs/ext4/inode.c               |  6 ++--
>  fs/ext4/super.c               |  6 ++--
>  fs/f2fs/data.c                |  6 +++-
>  fs/f2fs/f2fs.h                |  1 +
>  fs/fuse/dax.c                 |  1 +
>  fs/gfs2/aops.c                |  1 +
>  fs/gfs2/bmap.c                |  1 +
>  fs/hpfs/file.c                |  1 +
>  fs/jbd2/commit.c              |  1 +
>  fs/jbd2/journal.c             | 26 +++++++++-------
>  fs/jbd2/recovery.c            |  6 ++--
>  fs/jbd2/revoke.c              | 10 +++----
>  fs/jbd2/transaction.c         |  1 +
>  fs/mpage.c                    |  5 +++-
>  fs/nilfs2/btnode.c            |  2 ++
>  fs/nilfs2/gcinode.c           |  1 +
>  fs/nilfs2/mdt.c               |  1 +
>  fs/nilfs2/page.c              |  2 ++
>  fs/nilfs2/recovery.c          | 20 ++++++-------
>  fs/nilfs2/the_nilfs.c         |  1 +
>  fs/ntfs/aops.c                |  3 ++
>  fs/ntfs/file.c                |  1 +
>  fs/ntfs/mft.c                 |  2 ++
>  fs/ntfs3/fsntfs.c             |  8 ++---
>  fs/ntfs3/inode.c              |  1 +
>  fs/ntfs3/super.c              |  2 +-
>  fs/ocfs2/journal.c            |  2 +-
>  fs/reiserfs/journal.c         |  8 ++---
>  fs/reiserfs/reiserfs.h        |  6 ++--
>  fs/reiserfs/tail_conversion.c |  1 +
>  fs/xfs/xfs_iomap.c            |  7 +++--
>  fs/zonefs/file.c              |  2 ++
>  include/linux/buffer_head.h   | 45 +++++++++++++++-------------
>  include/linux/iomap.h         |  1 +
>  include/linux/jbd2.h          |  6 ++--
>  45 files changed, 172 insertions(+), 114 deletions(-)
> 
> diff --git a/block/fops.c b/block/fops.c
> index e831196dafac..6557b71c7657 100644
> --- a/block/fops.c
> +++ b/block/fops.c
> @@ -381,6 +381,7 @@ static int blkdev_iomap_begin(struct inode *inode, loff_t offset, loff_t length,
>  	loff_t isize = i_size_read(inode);
>  
>  	iomap->bdev = bdev;
> +	BUG_ON(true /* TODO(brauner): This is the only place where we don't go from inode->i_sb->s_f_bdev for obvious reasons. Thoughts? */);

Maybe block devices should have their own struct file created when the
block device is instantiated and torn down when the block device is
trashed?

> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 18c8f168b153..e0f38fafc5df 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -122,10 +122,12 @@ xfs_bmbt_to_iomap(
>  	}
>  	iomap->offset = XFS_FSB_TO_B(mp, imap->br_startoff);
>  	iomap->length = XFS_FSB_TO_B(mp, imap->br_blockcount);
> -	if (mapping_flags & IOMAP_DAX)
> +	if (mapping_flags & IOMAP_DAX) {
>  		iomap->dax_dev = target->bt_daxdev;
> -	else
> +	} else {
>  		iomap->bdev = target->bt_bdev;
> +		iomap->f_bdev = target->bt_f_bdev;
> +	}
>  	iomap->flags = iomap_flags;
>  
>  	if (xfs_ipincount(ip) &&
> @@ -151,6 +153,7 @@ xfs_hole_to_iomap(
>  	iomap->offset = XFS_FSB_TO_B(ip->i_mount, offset_fsb);
>  	iomap->length = XFS_FSB_TO_B(ip->i_mount, end_fsb - offset_fsb);
>  	iomap->bdev = target->bt_bdev;
> +	iomap->f_bdev = target->bt_f_bdev;
>  	iomap->dax_dev = target->bt_daxdev;

Why are we passing both iomap->bdev and the bdev file pointer? I
didn't see anything that uses the bdev file pointer, so I'm not sure
why this is being added if iomap->bdev is not getting removed....

> diff --git a/include/linux/iomap.h b/include/linux/iomap.h
> index 96dd0acbba44..91f1e434cab3 100644
> --- a/include/linux/iomap.h
> +++ b/include/linux/iomap.h
> @@ -97,6 +97,7 @@ struct iomap {
>  	u64			length;	/* length of mapping, bytes */
>  	u16			type;	/* type of mapping */
>  	u16			flags;	/* flags for mapping */
> +	struct file		*f_bdev;

	struct file		*bdev_file; /* block device for I/O */

>  	struct block_device	*bdev;	/* block device for I/O */
>  	struct dax_device	*dax_dev; /* dax_dev for dax operations */
>  	void			*inline_data;

-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