From patchwork Sun Feb 24 20:30:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 10828047 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EC1F91575 for ; Sun, 24 Feb 2019 20:31:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D6A7C2AB25 for ; Sun, 24 Feb 2019 20:31:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C9B882AB38; Sun, 24 Feb 2019 20:31:11 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 6648A2AB25 for ; Sun, 24 Feb 2019 20:31:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728210AbfBXUbK (ORCPT ); Sun, 24 Feb 2019 15:31:10 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:57024 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726458AbfBXUbK (ORCPT ); Sun, 24 Feb 2019 15:31:10 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x1OKQQA4139029; Sun, 24 Feb 2019 20:31:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : from : to : cc : date : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=rpNpGzICWPnmIsP5rVmRlIpwBrO93NV28hn4f0du0mk=; b=rtQ9Frf5mJeCBhWbhDH2lHKVsN+3ImCGVY3qVoeY58GrWEV6SMdv44uOQPmLk/dAZKmH MGZdmSElxSypjthnVomwTO+puesKPh6Zf3Ms28uPhGxkf+MJScDLwIaCmvWagoLIPSeC s0CAoVLpoGOh/m1AQ6FwNJ/JrKyKI1xThVg0UB3eVVfHaWz/fLoQnuihCn1ybgxGLP1r SvwFT/0IcK8CcGMN93BEF6/j/meiB7xO/LaU0MpyvHywDNnVLfZQz1vfbubk6NJhFbkp NWFUtQAJ4v1Tv0Fa/NIClDdD3Jkh1Apye4LFcVwJULGSM0awlq+M5aIX8JtWJU95fu8u Nw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2qtupdu85d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 24 Feb 2019 20:31:06 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x1OKV0Yg023486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 24 Feb 2019 20:31:01 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x1OKV0vD013336; Sun, 24 Feb 2019 20:31:00 GMT Received: from localhost (/67.169.218.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 24 Feb 2019 12:30:59 -0800 Subject: [PATCH 1/2] xfs: don't pass iomap flags to xfs_reflink_allocate_cow From: "Darrick J. Wong" To: darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org, bfoster@redhat.com Date: Sun, 24 Feb 2019 12:30:58 -0800 Message-ID: <155104025871.24373.7462613353398620970.stgit@magnolia> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9177 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1902240161 Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Darrick J. Wong Don't pass raw iomap flags to xfs_reflink_allocate_cow; signal our intention with a boolean argument. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster --- fs/xfs/xfs_iomap.c | 6 +++--- fs/xfs/xfs_reflink.c | 4 ++-- fs/xfs/xfs_reflink.h | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 01210eae8bf3..a376fb2d4b94 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c @@ -983,6 +983,7 @@ xfs_file_iomap_begin( */ if (xfs_is_cow_inode(ip)) { struct xfs_bmbt_irec orig = imap; + bool convert_now = (flags & IOMAP_DIRECT); /* if zeroing doesn't need COW allocation, then we are done. */ if ((flags & IOMAP_ZERO) && @@ -991,7 +992,7 @@ xfs_file_iomap_begin( /* may drop and re-acquire the ilock */ error = xfs_reflink_allocate_cow(ip, &imap, &shared, &lockmode, - flags); + convert_now); if (error) goto out_unlock; @@ -1002,8 +1003,7 @@ xfs_file_iomap_begin( * direct I/O code, which must be block aligned we need to * report the newly allocated address. */ - if (!(flags & IOMAP_DIRECT) && - orig.br_startblock != HOLESTARTBLOCK) + if (!convert_now && orig.br_startblock != HOLESTARTBLOCK) imap = orig; end_fsb = imap.br_startoff + imap.br_blockcount; diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index e2d9179bd50d..d42e3ef9050e 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -361,7 +361,7 @@ xfs_reflink_allocate_cow( struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode, - unsigned iomap_flags) + bool convert_now) { struct xfs_mount *mp = ip->i_mount; xfs_fileoff_t offset_fsb = imap->br_startoff; @@ -444,7 +444,7 @@ xfs_reflink_allocate_cow( * to initiate a disk write. For direct I/O we are going to write the * data and need the conversion, but for buffered writes we're done. */ - if (!(iomap_flags & IOMAP_DIRECT) || imap->br_state == XFS_EXT_NORM) + if (!convert_now || imap->br_state == XFS_EXT_NORM) return 0; trace_xfs_reflink_convert_cow(ip, imap); return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); diff --git a/fs/xfs/xfs_reflink.h b/fs/xfs/xfs_reflink.h index 2a3052fbe23e..28a43b7f581d 100644 --- a/fs/xfs/xfs_reflink.h +++ b/fs/xfs/xfs_reflink.h @@ -27,7 +27,7 @@ bool xfs_inode_need_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, extern int xfs_reflink_allocate_cow(struct xfs_inode *ip, struct xfs_bmbt_irec *imap, bool *shared, uint *lockmode, - unsigned iomap_flags); + bool convert_now); extern int xfs_reflink_convert_cow(struct xfs_inode *ip, xfs_off_t offset, xfs_off_t count);