Re: [PATCH 1/6] iomap: convert iomap_dio_rw() to an args structure

Dave Chinner
2021-01-12T01:54:08Z

On Mon, Jan 11, 2021 at 05:40:23PM -0800, Darrick J. Wong wrote:
> On Tue, Jan 12, 2021 at 12:07:41PM +1100, Dave Chinner wrote:
> > From: Dave Chinner <dchinner@redhat.com>
> >
> > Adding yet another parameter to the iomap_dio_rw() interface means
> > changing lots of filesystems to add the parameter. Convert this
> > interface to an args structure so in future we don't need to modify
> > every caller to add a new parameter.
> >
> > Signed-off-by: Dave Chinner <dchinner@redhat.com>
> > ---
> > fs/btrfs/file.c | 21 ++++++++++++++++-----
> > fs/ext4/file.c | 24 ++++++++++++++++++------
> > fs/gfs2/file.c | 19 ++++++++++++++-----
> > fs/iomap/direct-io.c | 30 ++++++++++++++----------------
> > fs/xfs/xfs_file.c | 30 +++++++++++++++++++++---------
> > fs/zonefs/super.c | 21 +++++++++++++++++----
> > include/linux/iomap.h | 16 ++++++++++------
> > 7 files changed, 110 insertions(+), 51 deletions(-)
> >
> > diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
> > index 0e41459b8de6..a49d9fa918d1 100644
> > --- a/fs/btrfs/file.c
> > +++ b/fs/btrfs/file.c
> > @@ -1907,6 +1907,13 @@ static ssize_t btrfs_direct_write(struct kiocb *iocb, struct iov_iter *from)
> > ssize_t err;
> > unsigned int ilock_flags = 0;
> > struct iomap_dio *dio = NULL;
> > + struct iomap_dio_rw_args args = {
> > + .iocb = iocb,
> > + .iter = from,
> > + .ops = &btrfs_dio_iomap_ops,
> > + .dops = &btrfs_dio_ops,
>
> /me wonders if it would make sense to move all the iomap_dio_ops fields
> into iomap_dio_rw_args to reduce pointer dereferencing when making the
> indirect call?

Perhaps so - there are only two ops defined in that structure so
there's not a whole lot of gain/loss there either way. Trivial to
do, though, with them encapsulated in this structure...

Cheers,

Dave.
--
Dave Chinner
david@fromorbit.com