From patchwork Mon Jun 26 14:25:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Gruenbacher X-Patchwork-Id: 9809779 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D20A460329 for ; Mon, 26 Jun 2017 14:25:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6FAC285D1 for ; Mon, 26 Jun 2017 14:25:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB7DB285D9; Mon, 26 Jun 2017 14:25:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 82D5E285D1 for ; Mon, 26 Jun 2017 14:25:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751473AbdFZOZm (ORCPT ); Mon, 26 Jun 2017 10:25:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34618 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbdFZOZf (ORCPT ); Mon, 26 Jun 2017 10:25:35 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7E97D3B74C; Mon, 26 Jun 2017 14:25:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7E97D3B74C Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=agruenba@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7E97D3B74C Received: from nux.redhat.com (ovpn-116-233.ams2.redhat.com [10.36.116.233]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69BB860BE1; Mon, 26 Jun 2017 14:25:31 +0000 (UTC) From: Andreas Gruenbacher To: linux-fsdevel@vger.kernel.org Cc: Andreas Gruenbacher , linux-xfs@vger.kernel.org, linux-ext4@vger.kernel.org Subject: [PATCH v3 5/5] xfs: Switch to iomap for SEEK_HOLE / SEEK_DATA Date: Mon, 26 Jun 2017 16:25:18 +0200 Message-Id: <1498487118-6564-6-git-send-email-agruenba@redhat.com> In-Reply-To: <1498487118-6564-1-git-send-email-agruenba@redhat.com> References: <1498487118-6564-1-git-send-email-agruenba@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 26 Jun 2017 14:25:34 +0000 (UTC) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 962dafd..94fe89a 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -1131,29 +1131,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