From: Ross Zwisler <ross.zwisler@linux.intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-kernel@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Andreas Dilger <adilger.kernel@dilger.ca>,
Andrew Morton <akpm@linux-foundation.org>,
Dan Williams <dan.j.williams@intel.com>, Jan Kara <jack@suse.com>,
Matthew Wilcox <willy@linux.intel.com>,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, linux-nvdimm@lists.01.org, xfs@oss.sgi.com
Subject: Re: [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks()
Date: Mon, 8 Feb 2016 08:34:43 -0700 [thread overview]
Message-ID: <20160208153443.GC2343@linux.intel.com> (raw)
In-Reply-To: <20160208051725.GM31407@dastard>
On Mon, Feb 08, 2016 at 04:17:25PM +1100, Dave Chinner wrote:
> On Sun, Feb 07, 2016 at 06:44:09PM -0700, Ross Zwisler wrote:
> > On Mon, Feb 08, 2016 at 09:03:29AM +1100, Dave Chinner wrote:
> > > On Sun, Feb 07, 2016 at 12:19:12AM -0700, Ross Zwisler wrote:
> > > > dax_clear_blocks() needs a valid struct block_device and previously it was
> > > > using inode->i_sb->s_bdev in all cases. This is correct for normal inodes
> > > > on mounted ext2, ext4 and XFS filesystems, but is incorrect for DAX raw
> > > > block devices and for XFS real-time devices.
> > > >
> > > > Instead, have the caller pass in a struct block_device pointer which it
> > > > knows to be correct.
> > > ....
> > > > diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
> > > > index 07ef29b..f722ba2 100644
> > > > --- a/fs/xfs/xfs_bmap_util.c
> > > > +++ b/fs/xfs/xfs_bmap_util.c
> > > > @@ -73,9 +73,11 @@ xfs_zero_extent(
> > > > xfs_daddr_t sector = xfs_fsb_to_db(ip, start_fsb);
> > > > sector_t block = XFS_BB_TO_FSBT(mp, sector);
> > > > ssize_t size = XFS_FSB_TO_B(mp, count_fsb);
> > > > + struct inode *inode = VFS_I(ip);
> > > >
> > > > if (IS_DAX(VFS_I(ip)))
> > > > - return dax_clear_blocks(VFS_I(ip), block, size);
> > > > + return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode),
> > > > + block, size);
> > >
> > > Get rid of the local inode variable and use VFS_I(ip) like the code
> > > originally did. Do not change code that is unrelated to the
> > > modifcation being made, especially when it results in making
> > > the code an inconsistent mess of mixed pointer constructs....
> >
> > The local 'inode' variable was added to avoid multiple calls for VFS_I() for
> > the same 'ip'.
>
> My point is you didn't achieve that. The end result of your patch
> is:
>
> struct inode *inode = VFS_I(ip);
>
> if (IS_DAX(VFS_I(ip)))
> return dax_clear_blocks(inode, xfs_find_bdev_for_inode(inode),
> block, size);
>
> So now we have a local variable, but we still have 2 calls to
> VFS_I(ip). i.e. this makes the code harder to read and understand
> than before for no benefit.
*facepalm* Yep, thanks for the correction.
next prev parent reply other threads:[~2016-02-08 15:34 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-07 7:19 [PATCH 0/2] DAX bdev fixes - move flushing calls to FS Ross Zwisler
2016-02-07 7:19 ` [PATCH 1/2] dax: pass bdev argument to dax_clear_blocks() Ross Zwisler
2016-02-07 18:19 ` Dan Williams
2016-02-08 1:46 ` Ross Zwisler
2016-02-08 4:29 ` Ross Zwisler
2016-02-07 22:03 ` Dave Chinner
2016-02-08 1:44 ` Ross Zwisler
2016-02-08 5:17 ` Dave Chinner
2016-02-08 15:34 ` Ross Zwisler [this message]
2016-02-07 7:19 ` [PATCH 2/2] dax: move writeback calls into the filesystems Ross Zwisler
2016-02-07 19:13 ` Dan Williams
2016-02-07 21:50 ` Dave Chinner
2016-02-08 8:18 ` Dan Williams
2016-02-08 20:18 ` Dave Chinner
2016-02-08 20:55 ` Dan Williams
2016-02-08 20:58 ` Jeff Moyer
2016-02-08 22:05 ` Dan Williams
2016-02-09 9:43 ` Jan Kara
2016-02-09 16:01 ` Jan Kara
2016-02-09 18:06 ` Ross Zwisler
2016-02-08 18:31 ` Ross Zwisler
2016-02-08 19:23 ` Dan Williams
2016-02-08 10:48 ` Jan Kara
2016-02-08 16:12 ` Ross Zwisler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160208153443.GC2343@linux.intel.com \
--to=ross.zwisler@linux.intel.com \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=david@fromorbit.com \
--cc=jack@suse.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=tytso@mit.edu \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@linux.intel.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).