From: Christoph Hellwig <hch@lst.de> To: linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-block@vger.kernel.org Subject: [PATCH 06/12] xfs: cleanup is_reflink checks Date: Tue, 28 Feb 2017 06:57:31 -0800 [thread overview] Message-ID: <20170228145737.19016-7-hch@lst.de> (raw) In-Reply-To: <20170228145737.19016-1-hch@lst.de> We'll soon need to distinguish between inodes that actually are reflinked, and those that just use the COW fork for atomic write operations. Switch a few places to check for the existance of a COW for instead of the reflink to prepare for that. Signed-off-by: Christoph Hellwig <hch@lst.de> --- fs/xfs/xfs_aops.c | 2 +- fs/xfs/xfs_icache.c | 2 +- fs/xfs/xfs_reflink.c | 7 +++---- fs/xfs/xfs_super.c | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index fe244648fff0..c78b585b3d84 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -885,7 +885,7 @@ xfs_writepage_map( continue; } - if (xfs_is_reflink_inode(XFS_I(inode))) { + if (XFS_I(inode)->i_cowfp) { error = xfs_map_cow(wpc, inode, offset, &new_type); if (error) goto out; diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 1f7d158266c1..1673a41db731 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -1574,7 +1574,7 @@ xfs_inode_free_cowblocks( * Just clear the tag if we have an empty cow fork or none at all. It's * possible the inode was fully unshared since it was originally tagged. */ - if (!xfs_is_reflink_inode(ip) || !ifp->if_bytes) { + if (!ifp || !ifp->if_bytes) { trace_xfs_inode_free_cowblocks_invalid(ip); xfs_inode_clear_cowblocks_tag(ip); return 0; diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 83605af3b135..4225b5e67b17 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -496,7 +496,6 @@ xfs_reflink_find_cow_mapping( xfs_extnum_t idx; ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL | XFS_ILOCK_SHARED)); - ASSERT(xfs_is_reflink_inode(ip)); offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset); if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got)) @@ -523,7 +522,7 @@ xfs_reflink_trim_irec_to_next_cow( struct xfs_bmbt_irec got; xfs_extnum_t idx; - if (!xfs_is_reflink_inode(ip)) + if (!ifp) return; /* Find the extent in the CoW fork. */ @@ -561,7 +560,7 @@ xfs_reflink_cancel_cow_blocks( struct xfs_defer_ops dfops; int error = 0; - if (!xfs_is_reflink_inode(ip)) + if (!ifp) return 0; if (!xfs_iext_lookup_extent(ip, ifp, offset_fsb, &idx, &got)) return 0; @@ -634,7 +633,7 @@ xfs_reflink_cancel_cow_range( int error; trace_xfs_reflink_cancel_cow_range(ip, offset, count); - ASSERT(xfs_is_reflink_inode(ip)); + ASSERT(ip->i_cowfp); offset_fsb = XFS_B_TO_FSBT(ip->i_mount, offset); if (count == NULLFILEOFF) diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 9136854030d5..868860354f09 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -952,7 +952,7 @@ xfs_fs_destroy_inode( XFS_STATS_INC(ip->i_mount, vn_rele); XFS_STATS_INC(ip->i_mount, vn_remove); - if (xfs_is_reflink_inode(ip)) { + if (ip->i_cowfp) { error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, 0); if (error && !XFS_FORCED_SHUTDOWN(ip->i_mount)) xfs_warn(ip->i_mount, -- 2.11.0
next prev parent reply other threads:[~2017-02-28 14:57 UTC|newest] Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-02-28 14:57 [RFC] failure atomic writes for file systems and block devices Christoph Hellwig 2017-02-28 14:57 ` [PATCH 01/12] uapi/fs: add O_ATOMIC to the open flags Christoph Hellwig 2017-02-28 14:57 ` [PATCH 02/12] iomap: pass IOMAP_* flags to actors Christoph Hellwig 2017-02-28 14:57 ` [PATCH 03/12] iomap: add a IOMAP_ATOMIC flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 04/12] fs: add a BH_Atomic flag Christoph Hellwig 2017-02-28 14:57 ` [PATCH 05/12] fs: add a F_IOINFO fcntl Christoph Hellwig 2017-02-28 16:51 ` Darrick J. Wong 2017-03-01 15:11 ` Christoph Hellwig 2017-02-28 14:57 ` Christoph Hellwig [this message] 2017-02-28 14:57 ` [PATCH 07/12] xfs: implement failure-atomic writes Christoph Hellwig 2017-02-28 23:09 ` Darrick J. Wong 2017-03-01 15:17 ` Christoph Hellwig 2017-02-28 14:57 ` [PATCH 08/12] xfs: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` [PATCH 09/12] block: advertize max atomic write limit Christoph Hellwig 2017-02-28 14:57 ` [PATCH 10/12] block_dev: set REQ_NOMERGE for O_ATOMIC writes Christoph Hellwig 2017-02-28 14:57 ` [PATCH 11/12] block_dev: implement the F_IOINFO fcntl Christoph Hellwig 2017-02-28 14:57 ` [PATCH 12/12] nvme: export the atomic write limit Christoph Hellwig 2017-02-28 20:48 ` [RFC] failure atomic writes for file systems and block devices Chris Mason 2017-02-28 20:48 ` Chris Mason 2017-03-01 15:07 ` Christoph Hellwig 2017-02-28 23:22 ` Darrick J. Wong 2017-03-01 15:09 ` Christoph Hellwig 2017-03-01 11:21 ` Amir Goldstein 2017-03-01 15:07 ` Christoph Hellwig 2017-03-01 15:07 ` Christoph Hellwig
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=20170228145737.19016-7-hch@lst.de \ --to=hch@lst.de \ --cc=linux-block@vger.kernel.org \ --cc=linux-fsdevel@vger.kernel.org \ --cc=linux-xfs@vger.kernel.org \ --subject='Re: [PATCH 06/12] xfs: cleanup is_reflink checks' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.