linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Ted Tso <tytso@mit.edu>
Cc: <linux-ext4@vger.kernel.org>,
	Ross Zwisler <ross.zwisler@linux.intel.com>,
	Jan Kara <jack@suse.cz>
Subject: [PATCH 09/10] ext2: Use iomap_zero_range() for zeroing truncated page in DAX path
Date: Fri, 18 Nov 2016 09:47:09 +0100	[thread overview]
Message-ID: <1479458830-22955-10-git-send-email-jack@suse.cz> (raw)
In-Reply-To: <1479458830-22955-1-git-send-email-jack@suse.cz>

Currently the last user of ext2_get_blocks() for DAX inodes was
dax_truncate_page(). Convert that to iomap_zero_range() so that all DAX
IO uses the iomap path.

Reviewed-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/ext2/inode.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
index 41b8b44a391c..046b642f3585 100644
--- a/fs/ext2/inode.c
+++ b/fs/ext2/inode.c
@@ -850,6 +850,9 @@ struct iomap_ops ext2_iomap_ops = {
 	.iomap_begin		= ext2_iomap_begin,
 	.iomap_end		= ext2_iomap_end,
 };
+#else
+/* Define empty ops for !CONFIG_FS_DAX case to avoid ugly ifdefs */
+struct iomap_ops ext2_iomap_ops;
 #endif /* CONFIG_FS_DAX */
 
 int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
@@ -1293,9 +1296,11 @@ static int ext2_setsize(struct inode *inode, loff_t newsize)
 
 	inode_dio_wait(inode);
 
-	if (IS_DAX(inode))
-		error = dax_truncate_page(inode, newsize, ext2_get_block);
-	else if (test_opt(inode->i_sb, NOBH))
+	if (IS_DAX(inode)) {
+		error = iomap_zero_range(inode, newsize,
+					 PAGE_ALIGN(newsize) - newsize, NULL,
+					 &ext2_iomap_ops);
+	} else if (test_opt(inode->i_sb, NOBH))
 		error = nobh_truncate_page(inode->i_mapping,
 				newsize, ext2_get_block);
 	else
-- 
2.6.6


  parent reply	other threads:[~2016-11-18  8:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-18  8:47 [PATCH 0/10 v3] ext4: Convert ext4 DAX IO to iomap framework Jan Kara
2016-11-18  8:47 ` [PATCH 01/10] ext4: Factor out checks from ext4_file_write_iter() Jan Kara
2016-11-18  8:47 ` [PATCH 02/10] ext4: Let S_DAX set only if DAX is really supported Jan Kara
2016-11-18  8:47 ` [PATCH 03/10] ext4: Convert DAX reads to iomap infrastructure Jan Kara
2016-11-18  8:47 ` [PATCH 04/10] ext4: Use iomap for zeroing blocks in DAX mode Jan Kara
2016-11-18  8:47 ` [PATCH 05/10] ext4: DAX iomap write support Jan Kara
2016-11-18  8:47 ` [PATCH 06/10] ext4: Avoid split extents for DAX writes Jan Kara
2016-11-18  8:47 ` [PATCH 07/10] ext4: Convert DAX faults to iomap infrastructure Jan Kara
2016-11-18  8:47 ` [PATCH 08/10] ext4: Rip out DAX handling from direct IO path Jan Kara
2016-11-21  5:02   ` [PATCH] ext4: remove unused function ext4_aligned_io() Ross Zwisler
2016-11-21 16:54     ` Theodore Ts'o
2016-11-18  8:47 ` Jan Kara [this message]
2016-11-18  8:47 ` [PATCH 10/10] dax: Rip out get_block based IO support Jan Kara
2016-11-21 16:53 ` [PATCH 0/10 v3] ext4: Convert ext4 DAX IO to iomap framework Theodore Ts'o

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=1479458830-22955-10-git-send-email-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-ext4@vger.kernel.org \
    --cc=ross.zwisler@linux.intel.com \
    --cc=tytso@mit.edu \
    /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).