[Top] [All Lists]

[PATCH 1/2] xfs: hole-punch use truncate_pagecache_range

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: [PATCH 1/2] xfs: hole-punch use truncate_pagecache_range
From: Hugh Dickins <hughd@xxxxxxxxxx>
Date: Sun, 13 May 2012 13:50:06 -0700 (PDT)
Cc: Dave Chinner <david@xxxxxxxxxxxxx>, Ben Myers <bpm@xxxxxxx>, xfs@xxxxxxxxxxx, linux-fsdevel@xxxxxxxxxxxxxxx, linux-mm@xxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:x-x-sender:to:cc:subject:message-id:user-agent :mime-version:content-type; bh=kvWwgG6ufTn/MRr+Gvl1e6QhGo4mJAvTHDwH0HR+v74=; b=hLAMh41yVu70JbRz73g2cGS2Ciy6pW4cob6PiopoA5hiEm7IfsQWMi6SneXVYBBO6k z3lHzpUIe8zqeRk4OZK4MRLaYBRjqa+ZYWxs6Z4X1a5jHY0RqMIruZNLo9H8lhLlbCMR RKOsi1GbjbFR8++BdfK6Vu4EcJRo4Rh5tRGKXqPwpZ9p/ZE6CThNiXAw30u/XhApLf8y qv3iC0QFO/IXQ+1orvgToDQR+7rPkRNrcayjggOMu+CuX+ezcXLwA7V3pQXIz8EbsyJH kV6wXQRJXVc94eJl9fvVtjPFXD8eym/wRJTbPiIGvtSHbM3uBFa3ZRHNDATTMjTQKJ3P VXng==
User-agent: Alpine 2.00 (LSU 1167 2008-08-23)
When truncating a file, we unmap pages from userspace first, as that's
usually more efficient than relying, page by page, on the fallback in
truncate_inode_page() - particularly if the file is mapped many times.

Do the same when punching a hole: 3.4 added truncate_pagecache_range()
to do the unmap and trunc, so use it in xfs_flushinval_pages(), instead
of calling truncate_inode_pages_range() directly.

Should xfs_tosspages() be using it too?  I don't know: left unchanged.

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>

 fs/xfs/xfs_fs_subr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- next-20120511/fs/xfs/xfs_fs_subr.c  2012-01-17 20:42:07.879627688 -0800
+++ linux/fs/xfs/xfs_fs_subr.c  2012-05-12 18:01:14.988654723 -0700
@@ -53,7 +53,7 @@ xfs_flushinval_pages(
        ret = filemap_write_and_wait_range(mapping, first,
                                last == -1 ? LLONG_MAX : last);
        if (!ret)
-               truncate_inode_pages_range(mapping, first, last);
+               truncate_pagecache_range(VFS_I(ip), first, last);
        return -ret;

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