Re: [PATCH 1/9] btrfs: get rid of trivial __btrfs_lookup_bio_sums() wrappers

David Sterba
2019-12-10T18:26:07Z

On Tue, Dec 10, 2019 at 10:24:30AM -0800, Omar Sandoval wrote:
> On Tue, Dec 10, 2019 at 06:12:10PM +0100, David Sterba wrote:
> > On Mon, Dec 02, 2019 at 05:34:17PM -0800, Omar Sandoval wrote:
> > > From: Omar Sandoval <osandov@fb.com>
> > >
> > > Currently, we have two wrappers for __btrfs_lookup_bio_sums():
> > > btrfs_lookup_bio_sums_dio(), which is used for direct I/O, and
> > > btrfs_lookup_bio_sums(), which is used everywhere else. The only
> > > difference is that the _dio variant looks up csums starting at the given
> > > offset instead of using the page index, which isn't actually direct
> > > I/O-specific. Let's clean up the signature and return value of
> > > __btrfs_lookup_bio_sums(), rename it to btrfs_lookup_bio_sums(), and get
> > > rid of the trivial helpers.
> > >
> > > ret = btrfs_lookup_bio_sums(inode, comp_bio,
> > > - sums);
> > > + false, 0, sums);
> >
> > > - ret = btrfs_lookup_bio_sums(inode, comp_bio, sums);
> > > + ret = btrfs_lookup_bio_sums(inode, comp_bio, false, 0, sums);
> >
> > > - ret = btrfs_lookup_bio_sums(inode, bio, NULL);
> > > + ret = btrfs_lookup_bio_sums(inode, bio, false, 0, NULL);
> >
> > > - ret = btrfs_lookup_bio_sums_dio(inode, dip->orig_bio,
> > > - file_offset);
> > > + ret = btrfs_lookup_bio_sums(inode, dip->orig_bio, true,
> > > + file_offset, NULL);
> >
> > Can't we also get rid of the at_offset parameter? Encoding that into
> > file_offset itself where at_offset=true would be some special
> > placeholder like (u64)-1 that can never be a valid file offset.
>
> Yeah Nikolay mentioned this as well but I was on the fence about whether
> it would look any nicer. I'll go ahead and make that change.

Ok, let's do that as another patch so it's not mixed to the helper
removal. Thanks.