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@ml01.01.org, xfs@oss.sgi.com,
Jan Kara <jack@suse.cz>
Subject: Re: [PATCH v2 2/2] dax: move writeback calls into the filesystems
Date: Wed, 10 Feb 2016 15:43:40 -0700 [thread overview]
Message-ID: <20160210224340.GA30938@linux.intel.com> (raw)
In-Reply-To: <20160210220312.GP14668@dastard>
On Thu, Feb 11, 2016 at 09:03:12AM +1100, Dave Chinner wrote:
> On Wed, Feb 10, 2016 at 01:48:56PM -0700, Ross Zwisler wrote:
> > Previously calls to dax_writeback_mapping_range() for all DAX filesystems
> > (ext2, ext4 & xfs) were centralized in filemap_write_and_wait_range().
> > dax_writeback_mapping_range() needs a struct block_device, and it used to
> > get that from inode->i_sb->s_bdev. This is correct for normal inodes
> > mounted on ext2, ext4 and XFS filesystems, but is incorrect for DAX raw
> > block devices and for XFS real-time files.
> >
> > Instead, call dax_writeback_mapping_range() directly from the filesystem
> > ->writepages function so that it can supply us with a valid block
> > device. This also fixes DAX code to properly flush caches in response to
> > sync(2).
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
> > Signed-off-by: Jan Kara <jack@suse.cz>
> > ---
> > fs/block_dev.c | 16 +++++++++++++++-
> > fs/dax.c | 13 ++++++++-----
> > fs/ext2/inode.c | 11 +++++++++++
> > fs/ext4/inode.c | 7 +++++++
> > fs/xfs/xfs_aops.c | 9 +++++++++
> > include/linux/dax.h | 6 ++++--
> > mm/filemap.c | 12 ++++--------
> > 7 files changed, 58 insertions(+), 16 deletions(-)
> >
> > diff --git a/fs/block_dev.c b/fs/block_dev.c
> > index 39b3a17..fc01e43 100644
> > --- a/fs/block_dev.c
> > +++ b/fs/block_dev.c
> > @@ -1693,13 +1693,27 @@ static int blkdev_releasepage(struct page *page, gfp_t wait)
> > return try_to_free_buffers(page);
> > }
> >
> > +static int blkdev_writepages(struct address_space *mapping,
> > + struct writeback_control *wbc)
> > +{
> > + if (dax_mapping(mapping)) {
> > + struct block_device *bdev = I_BDEV(mapping->host);
> > + int error;
> > +
> > + error = dax_writeback_mapping_range(mapping, bdev, wbc);
> > + if (error)
> > + return error;
> > + }
> > + return generic_writepages(mapping, wbc);
> > +}
>
> Can you remind of the reason for calling generic_writepages() on DAX
> enabled address spaces?
Sure. The initial version of this patch didn't do this, and during testing I
hit a bunch of xfstests failures. In ext2 at least I believe these were
happening because we were skipping the call into generic_writepages() for DAX
inodes. Without a lot of data to back this up, my guess is that this is due
to metadata inodes or something being marked as DAX (so dax_mapping(mapping)
returns true), but having dirty page cache pages that need to be written back
as part of the writeback.
Changing this so we always call generic_writepages() even in the DAX case
solved the xfstest failures.
If this sounds incorrect, please let me know and I'll go and gather more data.
- Ross
next prev parent reply other threads:[~2016-02-10 22:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-10 20:48 [PATCH v2 0/2] DAX bdev fixes - move flushing calls to FS Ross Zwisler
2016-02-10 20:48 ` [PATCH v2 1/2] dax: supply DAX clearing code with correct bdev Ross Zwisler
2016-02-10 20:48 ` [PATCH v2 2/2] dax: move writeback calls into the filesystems Ross Zwisler
2016-02-10 22:03 ` Dave Chinner
2016-02-10 22:43 ` Ross Zwisler [this message]
2016-02-10 23:44 ` Dave Chinner
2016-02-11 12:50 ` Jan Kara
2016-02-11 15:22 ` Dan Williams
2016-02-11 16:22 ` Jan Kara
2016-02-11 20:46 ` Dave Chinner
2016-02-11 20:58 ` Dan Williams
2016-02-11 22:46 ` Dave Chinner
2016-02-11 22:59 ` Dan Williams
2016-02-11 23:44 ` Dave Chinner
2016-02-11 12:43 ` [PATCH v2 0/2] DAX bdev fixes - move flushing calls to FS Jan Kara
2016-02-11 19:49 ` Ross Zwisler
2016-02-11 20:50 ` Dave Chinner
2016-02-12 19:03 ` Ross Zwisler
2016-02-13 2:38 ` Dave Chinner
2016-02-13 4:59 ` 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=20160210224340.GA30938@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=jack@suse.cz \
--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@ml01.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).