xfs
[Top] [All Lists]

[PATCH 10/14] xfs: use iomap infrastructure for DAX zeroing

To: xfs@xxxxxxxxxxx
Subject: [PATCH 10/14] xfs: use iomap infrastructure for DAX zeroing
From: Christoph Hellwig <hch@xxxxxx>
Date: Tue, 3 May 2016 23:29:03 +0200
Cc: rpeterso@xxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1462310947-16132-1-git-send-email-hch@xxxxxx>
References: <1462310947-16132-1-git-send-email-hch@xxxxxx>
Signed-off-by: Christoph Hellwig <hch@xxxxxx>
---
 fs/xfs/xfs_file.c | 35 +----------------------------------
 fs/xfs/xfs_iops.c |  9 ++-------
 2 files changed, 3 insertions(+), 41 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index bcedd80..bd07913 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -80,34 +80,6 @@ xfs_rw_ilock_demote(
                inode_unlock(VFS_I(ip));
 }
 
-static int
-xfs_dax_zero_range(
-       struct inode            *inode,
-       loff_t                  pos,
-       size_t                  count)
-{
-       int                     status = 0;
-
-       do {
-               unsigned offset, bytes;
-
-               offset = (pos & (PAGE_CACHE_SIZE -1)); /* Within page */
-               bytes = PAGE_CACHE_SIZE - offset;
-               if (bytes > count)
-                       bytes = count;
-
-               status = dax_zero_page_range(inode, pos, bytes,
-                                            xfs_get_blocks_direct);
-               if (status)
-                       break;
-
-               pos += bytes;
-               count -= bytes;
-       } while (count);
-
-       return status;
-}
-
 /*
  * Clear the specified ranges to zero through either the pagecache or DAX.
  * Holes and unwritten extents will be left as-is as they already are zeroed.
@@ -118,12 +90,7 @@ xfs_iozero(
        loff_t                  pos,
        size_t                  count)
 {
-       struct inode            *inode = VFS_I(ip);
-
-       if (IS_DAX(VFS_I(ip)))
-               return xfs_dax_zero_range(inode, pos, count);
-       else
-               return iomap_zero_range(inode, pos, count, NULL, 
&xfs_iomap_ops);
+       return iomap_zero_range(VFS_I(ip), pos, count, NULL, &xfs_iomap_ops);
 }
 
 int
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 6e3614a..0c744fc 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -819,13 +819,8 @@ xfs_setattr_size(
        if (newsize > oldsize) {
                error = xfs_zero_eof(ip, newsize, oldsize, &did_zeroing);
        } else {
-               if (IS_DAX(inode)) {
-                       error = dax_truncate_page(inode, newsize,
-                                       xfs_get_blocks_direct);
-               } else {
-                       error = iomap_truncate_page(inode, newsize,
-                                       &did_zeroing, &xfs_iomap_ops);
-               }
+               error = iomap_truncate_page(inode, newsize, &did_zeroing,
+                               &xfs_iomap_ops);
        }
 
        if (error)
-- 
2.1.4

<Prev in Thread] Current Thread [Next in Thread>