From patchwork Mon Apr 15 23:39:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630796 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 57C1E1DA21; Mon, 15 Apr 2024 23:39:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224355; cv=none; b=VgxYnqdavGgef+pH0XHIfXUGc6qqIVuEc0Z6rxWU0Hve6oHLnGLgPoGsl9BBoOBS7NSvoQhMzwGt9g0Ptm2VaSKlHPiNbKAKisHjU9L/Z2wYblUAoZ13bLqwnHy9lr1jWkw1xDROYS0xMs+ErerYB9oc7StJnaqFjMerbZyblcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224355; c=relaxed/simple; bh=BIAj79a6xW7Qur5Uav4bzKyvXSxdBthYED2HE78nZFo=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jCqRs07lGZDPENdcHFup39H2SM6L6mOyU0t/HjQLwC3ALh/tDdhMb23XOp5twl90OpHHdUzFTu/43phGVtM1eIry5kIIMYLc/+f0XD64EPLmTmx51XLzmEFvEcd/9imezSB0einphdLcXArRKGEQVPx7PxNGtIPrvB0DkCQycQQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MZDZTWHB; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MZDZTWHB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB3BDC113CC; Mon, 15 Apr 2024 23:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224355; bh=BIAj79a6xW7Qur5Uav4bzKyvXSxdBthYED2HE78nZFo=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=MZDZTWHBuamQag1ZIVBftaeqYXPIJoTOnAA2OsvkoOtbNfPhRFBWazz3tfRsXeNDV r3Ou3g8fSP1eUAINY6FNOfmaA4J20shCbUd7wH7IfndhipjqFgYW+/pirpqcrjpDNi DQmFg0rKgiqRXw6FHQMsKmZJrkcbTBKTG5AHQFS3xsIb8swPEua+cPX+zql+nfT0t7 VM3ZlAyE+vMCpWNg5VIiroJjv4faQddXmj7hd7x3nBxXgENpErdaJNSdZpRCJnpNQr PFGtzYfyOa34BmxXD1tl7bXlJuGxgFcGkxh8hTNCInA3z6jiwu4KqrziiN+U9hjhbC kkpm7OpNKpEBA== Date: Mon, 15 Apr 2024 16:39:14 -0700 Subject: [PATCH 1/7] xfs: move inode lease breaking functions to xfs_inode.c From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380744.87068.6708439075828080621.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong The lease breaking functions operate at the scope of the entire VFS inode, not subranges of a file. Move them to xfs_inode.c since they're already declared in xfs_inode.h. This cleanup moves us closer to having xfs_FOO.h declare only the symbols in xfs_FOO.c. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 61 --------------------------------------------------- fs/xfs/xfs_inode.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ fs/xfs/xfs_inode.h | 1 - 3 files changed, 62 insertions(+), 62 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 632653e00906..40b778415f5f 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -861,67 +861,6 @@ xfs_file_write_iter( return xfs_file_buffered_write(iocb, from); } -static void -xfs_wait_dax_page( - struct inode *inode) -{ - struct xfs_inode *ip = XFS_I(inode); - - xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); - schedule(); - xfs_ilock(ip, XFS_MMAPLOCK_EXCL); -} - -int -xfs_break_dax_layouts( - struct inode *inode, - bool *retry) -{ - struct page *page; - - xfs_assert_ilocked(XFS_I(inode), XFS_MMAPLOCK_EXCL); - - page = dax_layout_busy_page(inode->i_mapping); - if (!page) - return 0; - - *retry = true; - return ___wait_var_event(&page->_refcount, - atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE, - 0, 0, xfs_wait_dax_page(inode)); -} - -int -xfs_break_layouts( - struct inode *inode, - uint *iolock, - enum layout_break_reason reason) -{ - bool retry; - int error; - - xfs_assert_ilocked(XFS_I(inode), XFS_IOLOCK_SHARED | XFS_IOLOCK_EXCL); - - do { - retry = false; - switch (reason) { - case BREAK_UNMAP: - error = xfs_break_dax_layouts(inode, &retry); - if (error || retry) - break; - fallthrough; - case BREAK_WRITE: - error = xfs_break_leased_layouts(inode, iolock, &retry); - break; - default: - WARN_ON_ONCE(1); - error = -EINVAL; - } - } while (error == 0 && retry); - - return error; -} - /* Does this file, inode, or mount want synchronous writes? */ static inline bool xfs_file_sync_writes(struct file *filp) { diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 3e667a19b80b..39e6f88e9691 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -38,6 +38,7 @@ #include "xfs_ag.h" #include "xfs_log_priv.h" #include "xfs_health.h" +#include "xfs_pnfs.h" struct kmem_cache *xfs_inode_cache; @@ -3946,3 +3947,64 @@ xfs_inode_count_blocks( xfs_bmap_count_leaves(ifp, rblocks); *dblocks = ip->i_nblocks - *rblocks; } + +static void +xfs_wait_dax_page( + struct inode *inode) +{ + struct xfs_inode *ip = XFS_I(inode); + + xfs_iunlock(ip, XFS_MMAPLOCK_EXCL); + schedule(); + xfs_ilock(ip, XFS_MMAPLOCK_EXCL); +} + +int +xfs_break_dax_layouts( + struct inode *inode, + bool *retry) +{ + struct page *page; + + xfs_assert_ilocked(XFS_I(inode), XFS_MMAPLOCK_EXCL); + + page = dax_layout_busy_page(inode->i_mapping); + if (!page) + return 0; + + *retry = true; + return ___wait_var_event(&page->_refcount, + atomic_read(&page->_refcount) == 1, TASK_INTERRUPTIBLE, + 0, 0, xfs_wait_dax_page(inode)); +} + +int +xfs_break_layouts( + struct inode *inode, + uint *iolock, + enum layout_break_reason reason) +{ + bool retry; + int error; + + xfs_assert_ilocked(XFS_I(inode), XFS_IOLOCK_SHARED | XFS_IOLOCK_EXCL); + + do { + retry = false; + switch (reason) { + case BREAK_UNMAP: + error = xfs_break_dax_layouts(inode, &retry); + if (error || retry) + break; + fallthrough; + case BREAK_WRITE: + error = xfs_break_leased_layouts(inode, iolock, &retry); + break; + default: + WARN_ON_ONCE(1); + error = -EINVAL; + } + } while (error == 0 && retry); + + return error; +} diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index ab46ffb3ac19..5164c5d3e549 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -565,7 +565,6 @@ xfs_itruncate_extents( return xfs_itruncate_extents_flags(tpp, ip, whichfork, new_size, 0); } -/* from xfs_file.c */ int xfs_break_dax_layouts(struct inode *inode, bool *retry); int xfs_break_layouts(struct inode *inode, uint *iolock, enum layout_break_reason reason); From patchwork Mon Apr 15 23:39:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630797 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B991D1DA21; Mon, 15 Apr 2024 23:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224370; cv=none; b=IS0rWM/MG5P+Tkk3ROZLOHxlN5LB/dvsRCsCVGPVeG3KoluTpYYBTkaFWsqChJAW0XbnR/sK+Xj1bErdMM1KoKnQ60bXq9B/DKCqnC9MflNEfnWseTT45f0sn6vBqQ3s6xnYRysUrddAw8oVn0kGccAJc9uA1fK9hXCN+Ly9Le0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224370; c=relaxed/simple; bh=Y6f9XXbuASfk5okp7bMYS8EWOHBRzxH5IrJwh40v+08=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oytOZSBBQxEm0srZPNBU0odkv2yb0ylVCECEuEFMtBOL1ll2SO9Sg4CI1AhPwapvH6C0Bvjwd6hpv9nGoG8lFsqqGA+AXs4IS7GYEQiMO8wXCFEsAPiovT3OpPd2XVyWf6cYa2J7NRGaESZqa8wTKxOBwuPcEsno5wcODMOS7/s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VZkV558E; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VZkV558E" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9013AC113CC; Mon, 15 Apr 2024 23:39:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224370; bh=Y6f9XXbuASfk5okp7bMYS8EWOHBRzxH5IrJwh40v+08=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=VZkV558E+32r4xuD6JUIyjxj/jBOkPVuPP3TQUtqcVYkWSoQeopXpwHyWLJcPrI18 +h4s92kwk7kZh+APFyoMpmlL8B/IcA9Y9vn0tncLDlfor12e3xWdFyma59WMjNJNrt MIxCysE4+TVa1eazt1iv1vavCfi0aVQ5F3GWtjvSK3eKSztsuo/ZjBnipWeBtRf2+F QWBfMIXg7DUrAcmzMyOdsayge9ucrm/QIXBTvsusHvLBZYxmx8MVmomzuCczu0vFZM YKW/Akh1DspKR61WbzVE47XPAKyNGG71+GPe0XvGSc9ZAcUkYQrURzhyXmRzV9rgpa L269tthCWT1+w== Date: Mon, 15 Apr 2024 16:39:30 -0700 Subject: [PATCH 2/7] xfs: move xfs_iops.c declarations out of xfs_inode.h From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380761.87068.18235427530614561380.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Similarly, move declarations of public symbols of xfs_iops.c from xfs_inode.h to xfs_iops.h. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_inode.h | 5 ----- fs/xfs/xfs_iops.h | 4 ++++ 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index 5164c5d3e549..b2dde0e0f265 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -569,11 +569,6 @@ int xfs_break_dax_layouts(struct inode *inode, bool *retry); int xfs_break_layouts(struct inode *inode, uint *iolock, enum layout_break_reason reason); -/* from xfs_iops.c */ -extern void xfs_setup_inode(struct xfs_inode *ip); -extern void xfs_setup_iops(struct xfs_inode *ip); -extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init); - static inline void xfs_update_stable_writes(struct xfs_inode *ip) { if (bdev_stable_writes(xfs_inode_buftarg(ip)->bt_bdev)) diff --git a/fs/xfs/xfs_iops.h b/fs/xfs/xfs_iops.h index 7f84a0843b24..8a38c3e2ed0e 100644 --- a/fs/xfs/xfs_iops.h +++ b/fs/xfs/xfs_iops.h @@ -19,4 +19,8 @@ int xfs_vn_setattr_size(struct mnt_idmap *idmap, int xfs_inode_init_security(struct inode *inode, struct inode *dir, const struct qstr *qstr); +extern void xfs_setup_inode(struct xfs_inode *ip); +extern void xfs_setup_iops(struct xfs_inode *ip); +extern void xfs_diflags_to_iflags(struct xfs_inode *ip, bool init); + #endif /* __XFS_IOPS_H__ */ From patchwork Mon Apr 15 23:39:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630798 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 66C221591F9; Mon, 15 Apr 2024 23:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224386; cv=none; b=jgEpliiAZyUS0A9rhAEbVpVEevikg7pZ01U4cShI1lLPsSONRE1gm+gSq6qLWtYrMv2u8GBmUXpSmsqjq2LIsYZU5KVVzLc9BnbQg5MfEVWY6aO7kaQk6TlSqPAr0QUGfY0E7QKdI6RwsXjCXYQJT3vKfLLCWs9KB4gmItfzgMc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224386; c=relaxed/simple; bh=HwhKuSfEnBb2nKmPWFNwOlZVyDXCDh7JlKVoRY7oNfc=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s4O9As75O1zXdtZzaKpc/DFCPjfMhRM8g7r+R3Kc1ySxiCG0J775fqoAD2f77MlqphwqXMQGxRNDlwHZngWrX/f5iLW2z3pf6yKmwNkQMLIwoN+W8WPHHqs8STnQXXgQvYN2qZdhYPP7wgFyyQfUSxLqgju+boJQ+iUqWb0ha8A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LsBVMpIp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LsBVMpIp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 347E8C2BD11; Mon, 15 Apr 2024 23:39:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224386; bh=HwhKuSfEnBb2nKmPWFNwOlZVyDXCDh7JlKVoRY7oNfc=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=LsBVMpIpJDm2wLut0YPnIFpzRt3dKat+pT54exNYMwmlbOotqIwsuK0Cb73l1zsQH itKNHODB0/5mik+p3LQefmPC6sgLjOOa5VMXW59hjuanNLAENmn6ZFatsodfaUw+XX q8qBBrbhReUTxGz7zd3BqTYXeGGAt4onC4YdkzjFt+A+MVMOPzkARibomJgSL8KEWe ZRhPhG7gxb9YDuF50zN242P9c0YGe+RKjrHZQgqvYZeahjzVWJhKXZTwJRqNU6Ap7o mwEYVN/GoWgu/45qTV+ZluBxWsCafBlrMixx2gPKaWqM88INg67YxlZu6HlThu4mf9 ILguwVnceFihQ== Date: Mon, 15 Apr 2024 16:39:45 -0700 Subject: [PATCH 3/7] xfs: declare xfs_file.c symbols in xfs_file.h From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380778.87068.12250779360411108918.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Move the two public symbols in xfs_file.c to xfs_file.h. We're about to add more public symbols in that source file, so let's finally create the header file. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 1 + fs/xfs/xfs_file.h | 12 ++++++++++++ fs/xfs/xfs_ioctl.c | 1 + fs/xfs/xfs_iops.c | 1 + fs/xfs/xfs_iops.h | 3 --- 5 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 fs/xfs/xfs_file.h diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 40b778415f5f..9961d4b5efbe 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -24,6 +24,7 @@ #include "xfs_pnfs.h" #include "xfs_iomap.h" #include "xfs_reflink.h" +#include "xfs_file.h" #include #include diff --git a/fs/xfs/xfs_file.h b/fs/xfs/xfs_file.h new file mode 100644 index 000000000000..7d39e3eca56d --- /dev/null +++ b/fs/xfs/xfs_file.h @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2000-2005 Silicon Graphics, Inc. + * All Rights Reserved. + */ +#ifndef __XFS_FILE_H__ +#define __XFS_FILE_H__ + +extern const struct file_operations xfs_file_operations; +extern const struct file_operations xfs_dir_file_operations; + +#endif /* __XFS_FILE_H__ */ diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index d0e2cec6210d..1397edea20f1 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -39,6 +39,7 @@ #include "xfs_ioctl.h" #include "xfs_xattr.h" #include "xfs_rtbitmap.h" +#include "xfs_file.h" #include #include diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index 66f8c47642e8..55ed2d1023d6 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -25,6 +25,7 @@ #include "xfs_error.h" #include "xfs_ioctl.h" #include "xfs_xattr.h" +#include "xfs_file.h" #include #include diff --git a/fs/xfs/xfs_iops.h b/fs/xfs/xfs_iops.h index 8a38c3e2ed0e..3c1a2605ffd2 100644 --- a/fs/xfs/xfs_iops.h +++ b/fs/xfs/xfs_iops.h @@ -8,9 +8,6 @@ struct xfs_inode; -extern const struct file_operations xfs_file_operations; -extern const struct file_operations xfs_dir_file_operations; - extern ssize_t xfs_vn_listxattr(struct dentry *, char *data, size_t size); int xfs_vn_setattr_size(struct mnt_idmap *idmap, From patchwork Mon Apr 15 23:40:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630799 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0370B156974; Mon, 15 Apr 2024 23:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224402; cv=none; b=TQvruipoRbDP0aY+C/Aax9wYfs9RkZJGxpiPynGpWZ9Gj6kw5ya4+xBXdmrTSgAZ+ELrmsVI0zpZSIQmHu9i7iUE7Yj4y88UWXhB4KgfdsLCfFpbelpVq7UXDwqvsFodQ5VhkyDCdwUMez+liydOOcF4kzyiH0xp4fKy4j+5axY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224402; c=relaxed/simple; bh=4LAZNsV9CryhHV6r3RxmOqt9wS/YdVLz9e9t+G3PUA4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ofx9610wFrpe9LcmCVk19Y3EfMkrF8pMN/sflZRVKKViCbYXU6oGx1BCOFTabwTPjfd/IUMxbkWHkJDw5WuOXEJo3RFs+2/MkYUi7HQ8+CNlkNF1JIqLOdhv9TGoiC5VMNpNC286tz13+c43iQyNu38IW6qh4ZtGAdTiqN1UUP0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JjYAdNcc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JjYAdNcc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0C1BC113CC; Mon, 15 Apr 2024 23:40:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224401; bh=4LAZNsV9CryhHV6r3RxmOqt9wS/YdVLz9e9t+G3PUA4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=JjYAdNcciLMgE5FhjqVVmYRgvGYAQUWO1JlbOUzrTOnKbjyqyl5AoqCBvhijzwEuv yxYKEhKiWvbNpbqJ8l1c6ceLdkIOpE8/MrBtsqjOERgCiItWSUpnlK2B6rRHDDp6+r TSr/bLmdWjWvARnRlnTD+FseaQY/23HYDvJ+ysp8GeCNhVdRn34L8ZvD3xMGeZBej+ xJg/VIumuEgAqTqm86xExZHN6zDNcVJqMIfKkWUvwb/Nd1BlcjazoF1DPJdds6Y9DP C3TnxSZK9lUIfIWOyEI+w1l2jEKXzRfVpcx08sBDngU1tmSqPHVN58wIb+Uz5C9xCx WUQ5k3duuZWPg== Date: Mon, 15 Apr 2024 16:40:01 -0700 Subject: [PATCH 4/7] xfs: create a new helper to return a file's allocation unit From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380795.87068.1519661303032649001.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Create a new helper function to calculate the fundamental allocation unit (i.e. the smallest unit of space we can allocate) of a file. Things are going to get hairy with range-exchange on the realtime device, so prepare for this now. Remove the static attribute from xfs_is_falloc_aligned since the next patch will need it. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 28 ++++++++++------------------ fs/xfs/xfs_file.h | 3 +++ fs/xfs/xfs_inode.c | 13 +++++++++++++ fs/xfs/xfs_inode.h | 1 + 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 9961d4b5efbe..64278f8acaee 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -39,33 +39,25 @@ static const struct vm_operations_struct xfs_file_vm_ops; * Decide if the given file range is aligned to the size of the fundamental * allocation unit for the file. */ -static bool +bool xfs_is_falloc_aligned( struct xfs_inode *ip, loff_t pos, long long int len) { - struct xfs_mount *mp = ip->i_mount; - uint64_t mask; + unsigned int alloc_unit = xfs_inode_alloc_unitsize(ip); - if (XFS_IS_REALTIME_INODE(ip)) { - if (!is_power_of_2(mp->m_sb.sb_rextsize)) { - u64 rextbytes; - u32 mod; + if (!is_power_of_2(alloc_unit)) { + u32 mod; - rextbytes = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize); - div_u64_rem(pos, rextbytes, &mod); - if (mod) - return false; - div_u64_rem(len, rextbytes, &mod); - return mod == 0; - } - mask = XFS_FSB_TO_B(mp, mp->m_sb.sb_rextsize) - 1; - } else { - mask = mp->m_sb.sb_blocksize - 1; + div_u64_rem(pos, alloc_unit, &mod); + if (mod) + return false; + div_u64_rem(len, alloc_unit, &mod); + return mod == 0; } - return !((pos | len) & mask); + return !((pos | len) & (alloc_unit - 1)); } /* diff --git a/fs/xfs/xfs_file.h b/fs/xfs/xfs_file.h index 7d39e3eca56d..2ad91f755caf 100644 --- a/fs/xfs/xfs_file.h +++ b/fs/xfs/xfs_file.h @@ -9,4 +9,7 @@ extern const struct file_operations xfs_file_operations; extern const struct file_operations xfs_dir_file_operations; +bool xfs_is_falloc_aligned(struct xfs_inode *ip, loff_t pos, + long long int len); + #endif /* __XFS_FILE_H__ */ diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 39e6f88e9691..492dae0efad2 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -4008,3 +4008,16 @@ xfs_break_layouts( return error; } + +/* Returns the size of fundamental allocation unit for a file, in bytes. */ +unsigned int +xfs_inode_alloc_unitsize( + struct xfs_inode *ip) +{ + unsigned int blocks = 1; + + if (XFS_IS_REALTIME_INODE(ip)) + blocks = ip->i_mount->m_sb.sb_rextsize; + + return XFS_FSB_TO_B(ip->i_mount, blocks); +} diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index b2dde0e0f265..fa3e605901e2 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -625,6 +625,7 @@ int xfs_inode_reload_unlinked(struct xfs_inode *ip); bool xfs_ifork_zapped(const struct xfs_inode *ip, int whichfork); void xfs_inode_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, xfs_filblks_t *dblocks, xfs_filblks_t *rblocks); +unsigned int xfs_inode_alloc_unitsize(struct xfs_inode *ip); struct xfs_dir_update_params { const struct xfs_inode *dp; From patchwork Mon Apr 15 23:40:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630800 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2880156974; Mon, 15 Apr 2024 23:40:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224418; cv=none; b=bMO3olgyzjnsf5Zqa5YMua8vnnJ1IcK76kgNvDj80pcm3vSs1eEnlh3tX1qsb356M4chNji8nZqCjenyw4DYb7rCYDaTpJMsmvbwSb/WIXWRgeAEXzCJ3UrLpr6YvUi8OExmEQREsWarjvVAumKabEJUEPDN5aO1vHFgL4TLf5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224418; c=relaxed/simple; bh=39b/mRHBfdN1qyETumT0bb7YGgmE9DVDH2yfT1PAbK4=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=psJTujdTSs5XtWohw72P/nOuxKsp/R67E4lXFVYGOYuQUaUlIxhoYudqS8ueaQb5q7yy9oRD+yiJeJBffy5h9L2eIGE4nJWX9LZ9W4vzuB6CE6q4xambdndoNTp6uEhhY26ISgbROC6UQZkFeD3CmaZrBOkLt8jVGHjILVRWgQY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UVQH8JUc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UVQH8JUc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78167C113CC; Mon, 15 Apr 2024 23:40:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224417; bh=39b/mRHBfdN1qyETumT0bb7YGgmE9DVDH2yfT1PAbK4=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=UVQH8JUclD+v7PTK7tv6Z2Dw3emJYDfH76unm0LDwmi2Wc3L2FYNsUChTzvttSB1J xUrbJrM8Pm58EIZxy8I/6/57cYxB+GlK3qxsZ7HHkgVuzFFz+ujdRJcqNzgbmaL6UX 0oZZG8se1pYmozrVAY4pvq4+0SRv1K0PA2PiNTDxcTB81TKj7zXAuQt+bowHg7VnLx U4PcBQ5js05hW/EfxwGFRfzHBS58fU9SzN6uSIqj9O9fN40oVFfhwecHzDsAjFG3oa 8lTpZbHNyn4anQDnyLAElJ5k8w8ttCdKAMVfHQvWIlbRiVIz7B/zQnY4CCxgzLsyEm qr+fs59vsRC5Q== Date: Mon, 15 Apr 2024 16:40:17 -0700 Subject: [PATCH 5/7] xfs: hoist multi-fsb allocation unit detection to a helper From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380812.87068.12260366227745061736.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Replace the open-coded logic to decide if a file has a multi-fsb allocation unit to a helper to make the code easier to read. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_bmap_util.c | 4 ++-- fs/xfs/xfs_inode.h | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 19e11d1da660..53aa90a0ee3a 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -542,7 +542,7 @@ xfs_can_free_eofblocks( * forever. */ end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)XFS_ISIZE(ip)); - if (XFS_IS_REALTIME_INODE(ip) && mp->m_sb.sb_rextsize > 1) + if (xfs_inode_has_bigrtalloc(ip)) end_fsb = xfs_rtb_roundup_rtx(mp, end_fsb); last_fsb = XFS_B_TO_FSB(mp, mp->m_super->s_maxbytes); if (last_fsb <= end_fsb) @@ -843,7 +843,7 @@ xfs_free_file_space( endoffset_fsb = XFS_B_TO_FSBT(mp, offset + len); /* We can only free complete realtime extents. */ - if (XFS_IS_REALTIME_INODE(ip) && mp->m_sb.sb_rextsize > 1) { + if (xfs_inode_has_bigrtalloc(ip)) { startoffset_fsb = xfs_rtb_roundup_rtx(mp, startoffset_fsb); endoffset_fsb = xfs_rtb_rounddown_rtx(mp, endoffset_fsb); } diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index fa3e605901e2..f559e68ee707 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -311,6 +311,15 @@ static inline bool xfs_inode_has_large_extent_counts(struct xfs_inode *ip) return ip->i_diflags2 & XFS_DIFLAG2_NREXT64; } +/* + * Decide if this file is a realtime file whose data allocation unit is larger + * than a single filesystem block. + */ +static inline bool xfs_inode_has_bigrtalloc(struct xfs_inode *ip) +{ + return XFS_IS_REALTIME_INODE(ip) && ip->i_mount->m_sb.sb_rextsize > 1; +} + /* * Return the buftarg used for data allocations on a given inode. */ From patchwork Mon Apr 15 23:40:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630801 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7DD7156967; Mon, 15 Apr 2024 23:40:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224433; cv=none; b=VMmcVoT7+7+Fef2oN8+o2HjlU05Ua/wQJRwYp+ODFP3ME+LrS+HTXYM5K7riq/aO7monNeo0By50qa2BTof7ET9fDfbNUOcHzKm1ppfro5Y9ZN1rLRcFEBVMXG1mmEwm9kdXM4VYf6ZLAuDxqmW+6H6s+N81d2Cg1fejOlGtHyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224433; c=relaxed/simple; bh=s9Lrin2PDZHmLMJblPo0jKJyeb8hr7q2u4ke3Gax8cE=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=nwSB6KkA89Kz8zLCopntKCyinZtuLrHjVjX9neLvg44k7nWMqLxhpALlDYag6ebdUUn5wIN2E1JYfpy6T/PLA/CQwrJJfUFayWr00dKbeWGqO3ThEubgPyIE6Jac4eCQONh91wbiWUOhTUHL7AsbaFjNr1anoA60tVYS8MOb5K4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ig08t2Lf; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ig08t2Lf" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A77DC113CC; Mon, 15 Apr 2024 23:40:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224433; bh=s9Lrin2PDZHmLMJblPo0jKJyeb8hr7q2u4ke3Gax8cE=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=ig08t2LfgC5rprFLDBIu7wwuU7OM8JJHtqXviaKGbYfpYXU9qPLDuiPudTk+g+BHp ywKXSMJ7pVzCy+TdI6Oh81RilP3Fq9Sf2ftOiDnSRyz2h28x+QgFT25YemZZ4STxyo nWrEX/r24QTwS9v4TnddLJ/BQ/wBO5NH31P+Su00cHBLu9IBgk1MeI5JVMsgNGKURZ emoU+/IbW6c3NL877vmZbtQFU76eEwFrecFFMqyLrJTOKouZLSDk4NArGW7E5b7wBR XAP0J9XrYjze61G6Ty5t6BgvsJ2FCDdAOzTPNkfVweiptwxMKIlrLpL96UjwHKFOee Dl/UtLQaw3pWg== Date: Mon, 15 Apr 2024 16:40:32 -0700 Subject: [PATCH 6/7] xfs: refactor non-power-of-two alignment checks From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380829.87068.17230248734549992834.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong Create a helper function that can compute if a 64-bit number is an integer multiple of a 32-bit number, where the 32-bit number is not required to be an even power of two. This is needed for some new code for the realtime device, where we can set 37k allocation units and then have to remap them. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/xfs_file.c | 12 +++--------- fs/xfs/xfs_linux.h | 5 +++++ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 64278f8acaee..d1d4158441bd 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c @@ -47,15 +47,9 @@ xfs_is_falloc_aligned( { unsigned int alloc_unit = xfs_inode_alloc_unitsize(ip); - if (!is_power_of_2(alloc_unit)) { - u32 mod; - - div_u64_rem(pos, alloc_unit, &mod); - if (mod) - return false; - div_u64_rem(len, alloc_unit, &mod); - return mod == 0; - } + if (!is_power_of_2(alloc_unit)) + return isaligned_64(pos, alloc_unit) && + isaligned_64(len, alloc_unit); return !((pos | len) & (alloc_unit - 1)); } diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h index 8f07c9f6157f..ac355328121a 100644 --- a/fs/xfs/xfs_linux.h +++ b/fs/xfs/xfs_linux.h @@ -198,6 +198,11 @@ static inline uint64_t howmany_64(uint64_t x, uint32_t y) return x; } +static inline bool isaligned_64(uint64_t x, uint32_t y) +{ + return do_div(x, y) == 0; +} + /* If @b is a power of 2, return log2(b). Else return -1. */ static inline int8_t log2_if_power2(unsigned long b) { From patchwork Mon Apr 15 23:40:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 13630819 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E60FF156974; Mon, 15 Apr 2024 23:40:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224449; cv=none; b=R9r1QJWkUQ6wdA29CscwIMkFfdBXTErVZpBuXQ52jq+1IEHkqKPmTYGPzBbEfpPZLrYlY7IIXg4KvbBtiuCsSlVTJwkuW+XTtsv0r4P08jysNf4fjOJEEY6WGQhV38KlcvvOxh5Xm72sFOUmKdn5SSPw4T31g52iZejq86i1TH4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713224449; c=relaxed/simple; bh=HZkXKS0k4m9TwOFEmNgVrgvvVnPZFP1r1oDEwMc9+pk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KrZlcZ/Wf6NDHIuSGUogc6j7NsJE+nAmA3J6JiGxMUns4Xge7j86GqjynvUb1WRYXSqwVjtU4h+kT///vQ6eRriANPjQFier9ppl3cdA7HK/xOqeJqyPQ0sRm1o1cfuRHVycP985ZrN20/iIl8ZcdTLzZ8gNdNKAVL+NK2CpFVA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=f4ZphCCs; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="f4ZphCCs" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7E96C113CC; Mon, 15 Apr 2024 23:40:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1713224448; bh=HZkXKS0k4m9TwOFEmNgVrgvvVnPZFP1r1oDEwMc9+pk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=f4ZphCCsY89UWLPJ6gBCEjq/3w1ZOQxo/KhTDd91R/wSru+ZShJLnJZgUL2i09ci+ 7e2JFaFleLCfsG6J1DVMUzWKb9+V7XoRKz7sMckC2eiI2MjzkyITMFmIWCRtlMqjcm 5S3TMICyXPw51gM9fRF9QAWSUcxwPjDrM8UaueIBS+9kD4TqwaOvTCLL3f8B2q5MWS K/y3zSZxMYKf7jl8Df6Qek1RkiOrMrYUScrgs5qUKf7dnCKwT3wM9xyIJybGGG5Cb9 3u7WbIekR65c5f/qF5mj15N0SKUmn5QYM/iI9JNVq++ejIwzRygAb491lkeSJHExhw DQscIVbdz5Epw== Date: Mon, 15 Apr 2024 16:40:48 -0700 Subject: [PATCH 7/7] xfs: constify xfs_bmap_is_written_extent From: "Darrick J. Wong" To: chandanbabu@kernel.org, djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org Message-ID: <171322380846.87068.9673983859392153004.stgit@frogsfrogsfrogs> In-Reply-To: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> References: <171322380710.87068.4499164955656161226.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Darrick J. Wong This predicate doesn't modify the structure that's being passed in, so we can mark it const. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- fs/xfs/libxfs/xfs_bmap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h index f7662595309d..b8bdbf1560e6 100644 --- a/fs/xfs/libxfs/xfs_bmap.h +++ b/fs/xfs/libxfs/xfs_bmap.h @@ -158,7 +158,7 @@ static inline bool xfs_bmap_is_real_extent(const struct xfs_bmbt_irec *irec) * Return true if the extent is a real, allocated extent, or false if it is a * delayed allocation, and unwritten extent or a hole. */ -static inline bool xfs_bmap_is_written_extent(struct xfs_bmbt_irec *irec) +static inline bool xfs_bmap_is_written_extent(const struct xfs_bmbt_irec *irec) { return xfs_bmap_is_real_extent(irec) && irec->br_state != XFS_EXT_UNWRITTEN;