linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Gruenbacher <agruenba@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
	linux-xfs@vger.kernel.org, cluster-devel@redhat.com,
	Jan Kara <jack@suse.cz>
Subject: [PATCH v2 2/6] xfs: Switch to iomap for SEEK_HOLE / SEEK_DATA
Date: Fri, 23 Jun 2017 15:34:40 +0200	[thread overview]
Message-ID: <1498224884-346-3-git-send-email-agruenba@redhat.com> (raw)
In-Reply-To: <1498224884-346-1-git-send-email-agruenba@redhat.com>

Switch to the iomap_seek_hole_data vfs helper for implementing lseek
SEEK_HOLE / SEEK_DATA.  __xfs_seek_hole_data can go away once it's no
longer used by the quota code.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
 fs/xfs/xfs_file.c | 21 +++++----------------
 1 file changed, 5 insertions(+), 16 deletions(-)

diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index fff9aba..5e48201 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -1104,29 +1104,18 @@ xfs_seek_hole_data(
 	struct xfs_inode	*ip = XFS_I(inode);
 	struct xfs_mount	*mp = ip->i_mount;
 	uint			lock;
-	loff_t			offset, end;
-	int			error = 0;
+	loff_t			offset;
 
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return -EIO;
 
 	lock = xfs_ilock_data_map_shared(ip);
-
-	end = i_size_read(inode);
-	offset = __xfs_seek_hole_data(inode, start, end, whence);
-	if (offset < 0) {
-		error = offset;
-		goto out_unlock;
-	}
-
-	offset = vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
-
-out_unlock:
+	offset = iomap_seek_hole_data(inode, start, whence, &xfs_iomap_ops);
 	xfs_iunlock(ip, lock);
 
-	if (error)
-		return error;
-	return offset;
+	if (offset < 0)
+		return offset;
+	return vfs_setpos(file, offset, inode->i_sb->s_maxbytes);
 }
 
 STATIC loff_t
-- 
2.7.5

  parent reply	other threads:[~2017-06-23 13:34 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23 13:34 [PATCH v2 0/6] SEEK_HOLE / SEEK_DATA via iomap Andreas Gruenbacher
2017-06-23 13:34 ` [PATCH v2 1/6] vfs: Add iomap_seek_hole_data helper Andreas Gruenbacher
2017-06-25  5:00   ` kbuild test robot
2017-06-26 10:47   ` Christoph Hellwig
2017-06-26 14:11     ` Andreas Gruenbacher
2017-06-23 13:34 ` Andreas Gruenbacher [this message]
2017-06-23 13:34 ` [PATCH v2 3/6] GFS2: Make height info part of metapath Andreas Gruenbacher
2017-06-23 13:34 ` [PATCH v2 4/6] GFS2: Implement iomap for block_map Andreas Gruenbacher
2017-06-23 13:34 ` [PATCH v2 5/6] GFS2: Switch fiemap implementation to use iomap Andreas Gruenbacher
2017-06-23 13:34 ` [PATCH v2 6/6] gfs2: Implement SEEK_HOLE / SEEK_DATA via iomap Andreas Gruenbacher
2017-06-26  9:50 ` [PATCH v2 0/6] " Christoph Hellwig
2017-06-26 14:21   ` Andreas Gruenbacher

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=1498224884-346-3-git-send-email-agruenba@redhat.com \
    --to=agruenba@redhat.com \
    --cc=cluster-devel@redhat.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /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).