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@xxxxxx> > > > > 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.
