From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f43.google.com (mail-pa0-f43.google.com [209.85.220.43]) by kanga.kvack.org (Postfix) with ESMTP id 268056B0009 for ; Wed, 10 Feb 2016 17:03:17 -0500 (EST) Received: by mail-pa0-f43.google.com with SMTP id yy13so18207137pab.3 for ; Wed, 10 Feb 2016 14:03:17 -0800 (PST) Received: from ipmail06.adl2.internode.on.net (ipmail06.adl2.internode.on.net. [150.101.137.129]) by mx.google.com with ESMTP id n79si7632263pfj.101.2016.02.10.14.03.15 for ; Wed, 10 Feb 2016 14:03:16 -0800 (PST) Date: Thu, 11 Feb 2016 09:03:12 +1100 From: Dave Chinner Subject: Re: [PATCH v2 2/2] dax: move writeback calls into the filesystems Message-ID: <20160210220312.GP14668@dastard> References: <1455137336-28720-1-git-send-email-ross.zwisler@linux.intel.com> <1455137336-28720-3-git-send-email-ross.zwisler@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1455137336-28720-3-git-send-email-ross.zwisler@linux.intel.com> Sender: owner-linux-mm@kvack.org List-ID: To: Ross Zwisler Cc: linux-kernel@vger.kernel.org, Theodore Ts'o , Alexander Viro , Andreas Dilger , Andrew Morton , Dan Williams , Jan Kara , Matthew Wilcox , linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org, xfs@oss.sgi.com, Jan Kara 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 > Signed-off-by: Jan Kara > --- > 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? Cheers, Dave. -- Dave Chinner david@fromorbit.com -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org