From patchwork Wed Mar 27 01:51:16 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: 13605394 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 D0C5218C36 for ; Wed, 27 Mar 2024 01:51:16 +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=1711504276; cv=none; b=o/HjSBDn9SOryKSf5dSYAqUE5YaIU7wi/llAV0r/8imoeGWfmCwYZCjrm8IHzQtN+v09APvY7o5J2lThDFUFV8S5h+Qo+Q94D0Ce4pHx++KT4hqV5ZqlS603jfIy0uNwpy6eTreDA/BPDvvfIrQv4DBJnkogzcxf8eWm2LNeTj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504276; c=relaxed/simple; bh=5AP/RW7cDuQokxjQW9HN8Hg9qZjcEmOqpXkSPNwa4Ik=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HiJeppMe1RWk/9ORS4U66rITL8Cocw1lJ8GFWi3tqUqZm405Z6Bxp0Up2l0M6fb3YhxzTcyWkoZRQ5roefUxtyZUVxP8/z389DtwyubHS3VOEUVdVgvsMwP6iQHV5kecJvCGOxmdpE7amAYTLzudzMVUdIP3lpjVk+qsEuyw94A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mkYByNnq; 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="mkYByNnq" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A498DC43394; Wed, 27 Mar 2024 01:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504276; bh=5AP/RW7cDuQokxjQW9HN8Hg9qZjcEmOqpXkSPNwa4Ik=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=mkYByNnqVeXSjkTd3WrVFeEdYmJaEiHtNlrnr6xRJMIvU0xoO/c+bjp/9ei4Ebnrz 0VW6uVBNWTBJSehdpyO5au8hLOkvILZDNS2BAhROxKAfvrRAORSHYY/tapkZyJsfxB a12IIxRJKL29+Zbfv0lpGoE2ntnHj+SbT1Zfib5e1E/tV4CcUkYJ4qsoiw/UYAKfWY AkWcwR6RVu++9sXKt0YYjVkMFdkAd3H4GfNfXld/7VUxLUA7qTZflhHL+9/lYnG4yU wYEEMWnvhbVPWu3a8RTsp/51M/V8GNhenuQpL2/jjB8WNDCcoGDg+fgWKiABdZYdul kOTnPrBJNdHaQ== Date: Tue, 26 Mar 2024 18:51:16 -0700 Subject: [PATCH 1/7] xfs: move inode lease breaking functions to xfs_inode.c From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380149.3216450.1216133477002365216.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 632653e00906f..40b778415f5fc 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 ea48774f6b76d..b95e249cc46a5 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; @@ -3935,3 +3936,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 ab46ffb3ac19e..5164c5d3e549c 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 Wed Mar 27 01:51:31 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: 13605395 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 BF9831CA89 for ; Wed, 27 Mar 2024 01:51:32 +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=1711504292; cv=none; b=lPr06Plvo5lo1NofhqgKpTHzORp7Wg7flp2y6PIA/iPVmKqBMBFjLXAtFrS8NHaQnyGoWwUbFbBFy3jnNGysy9+u9Xto6LGO6OEE0rtDaZ0fTkTEro1mdP5bK7Q1qecz7pC0CLP3lvNE9KoSdlV0ykV+KcKtz/mJV434Q1X3rro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504292; c=relaxed/simple; bh=AQL3lUw6lFnUZYcJHEvzUgA0Z9rGPa4M4W2a1hNo1Nk=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=uPl87hmhs0Zylar2S+v2L3nhrUsJ1Ay+4Jk7v27wMM34v8Zny7dczl/pFB3AWs4wuuSqtFFQb6DRDLluNet4E+KpHk0TdRoSmYgPZjTsWEDi31zjE6mZ84EdzwSDIdWVzUkxCdO7F6MtZAYDRSlcU/epTL1r4UjYLFA0Zru1QcY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KuR8UhvZ; 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="KuR8UhvZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46E4DC433B2; Wed, 27 Mar 2024 01:51:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504292; bh=AQL3lUw6lFnUZYcJHEvzUgA0Z9rGPa4M4W2a1hNo1Nk=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=KuR8UhvZjwvJo5RrRWnM6NNWq4f/PX/dzXp6rK4gqF8gNUODuknBpUqWwXARSfyfe ZHzzFRR051k5j12likdDMbW7qk5/0kNrAVJyAtZjbzt90RbGDDlG1CvNz/PlLMIzp6 Y4pLo97uylxDNriDIl5sVTDqb6M3fLtSFEU22KqDFFDp9sW3KsXUHmg6IkZ3aPOnXH 3UjllkFHsnc+lCAL6hOftqlP5nG0hMouWTwSxiP0kM0EcoFZfrhG1BkyV+4OAQuvXx cZX2eEVXfD/o0D0X0loHLCIIZckz1Mngg+5cWsZEIfordvQy1QcNzM74mM6Sw4gohl PGrG8PDzhtxvA== Date: Tue, 26 Mar 2024 18:51:31 -0700 Subject: [PATCH 2/7] xfs: move xfs_iops.c declarations out of xfs_inode.h From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380166.3216450.9163025145750676383.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 5164c5d3e549c..b2dde0e0f265a 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 7f84a0843b243..8a38c3e2ed0e8 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 Wed Mar 27 01:51:47 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: 13605396 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 1056A18C36 for ; Wed, 27 Mar 2024 01:51: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=1711504308; cv=none; b=tT/YwGmHTTjzRgPkZHb8LWNZo75FLQZqWVCSs3+xX+diQ41Z1zV2zbyuyE1zylazwu+H7t/YQPBRHuchIq1eON2C+HiHZgVQWE9J2zgx3mu7Si4FIuOWDLsqZTs4557jbufNKtAIPdg0w3XROaFrgl0+v7d2lwj+HJIE+9LQgew= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504308; c=relaxed/simple; bh=eG1Q8QS3S1TB5dpArHtZam2wkNvVObLZdH4yEspSIts=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qTmNY+ZfJp1fzHw6Oy0sLTLjWK/9+vAMA6UNjp6u6nV86BJ3fGnTHrWmIFn7mDo+FBEEK6A9j6PwsIK5duqWEri2E5sIPWwFhQt2OykK+SoXWIeQWid3/5DULQRU3jT9SWvc17YlPK9CJ0fSKNdbOmGVcP7FqUrmOjaEYj3MD88= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=upk11ede; 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="upk11ede" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9289C433B2; Wed, 27 Mar 2024 01:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504307; bh=eG1Q8QS3S1TB5dpArHtZam2wkNvVObLZdH4yEspSIts=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=upk11ede0R7t8kVeoHAV8z9+TrZKrEHdyHvDG1+2GUHTqYb5U9ntoF3MNdCowI7LW jdkLc2Q4GN03ujbSFo0sdqIWSvZpYvIbxISiWZgxtBdrqqYW2jVgWYE/0dTPgxtRby PatjCFAD2nXIkKqdTQM+pZ14j9Kd9kg7nz5K2lmVEHUE4P+GSjamPJ3+EQZOP2phC7 eY5Tr7qhI+P8z/zmR4iukQkr2+dI0f8cgWqN54eWP53oe2PZxlN03DNcm/wdg5gVA4 SIVel6nPjBmtTZ8JuskASh1S5X30R+PL6ueP3bxTpnGiY1UYJ+R8SUosWLY3+uuqYX NN6va/d+A35ZA== Date: Tue, 26 Mar 2024 18:51:47 -0700 Subject: [PATCH 3/7] xfs: declare xfs_file.c symbols in xfs_file.h From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380182.3216450.14385635879347198116.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 40b778415f5fc..9961d4b5efbe6 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 0000000000000..7d39e3eca56dc --- /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 d0e2cec6210dd..1397edea20f19 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 66f8c47642e88..55ed2d1023d67 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 8a38c3e2ed0e8..3c1a2605ffd2b 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 Wed Mar 27 01:52:03 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: 13605398 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 E85C51CFA9 for ; Wed, 27 Mar 2024 01:52:03 +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=1711504324; cv=none; b=LeQSX4e6E+CmnruAVLfvi1g/iZrGpRVTaNpfQYOBQ/3rs2RSYtVjp/45Xg+XW4jUGyT9lsbZBrIIDbUENp2pkGdD9kkxBpJbKir36sDVm1Bv+UcKlESf/e/gMj/dU5alv8h20AQAd6ZYDSTVSsMWTBGcYPPCs7gskKHU4dKEGVY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504324; c=relaxed/simple; bh=q1HJvQu/GIDUAWonryaObirosihQ149FhduDyHcK9no=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=jSV9kXgx8a6EYooOKH8rIRSpMfnZq0Qu9uYQDty+s7hqSRah8W8BG4yHv/zuBGmBaqFiWP8mRHGK4SMp4zr3JKWyUKWvQL501Lph1KldrXrwC0uxidHdCrTuxkIhHBfBfwW7/vaoTk59GPQMbLdXa7M7axSWwTH/4pkVSYL4DRI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eHOvRLPW; 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="eHOvRLPW" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A591C433B1; Wed, 27 Mar 2024 01:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504323; bh=q1HJvQu/GIDUAWonryaObirosihQ149FhduDyHcK9no=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=eHOvRLPWbCaFmWTTgLmgRdgebykc4ibdjn1yBGqCC/3hOUR85qZn2rhjtbPlFqBu1 kQ4DhVNR2Y2I396LQAL5sveN6XqjDJ95hWNOodbTuERHshu8nEJPilFM5EKGkfgNBK qTbT6xktL4O6qI2ssOTyTR90S+5Jhb74s/54FqtPN8dX+szzm5Ld200oPy7FlVCyRV hz8OnLM/cQYIuJ45AovTsEXY6dxo6d2dxW7fki8OGkwgNUnJ1xOBw4LOc7Djs3mbtc kW4UK7G43Y+p9UGe2UJTeltSGS4keOBpiNqVPU943hRCASutUZMn4B03M7OBWd9Cm9 Nioy2FirNmcdw== Date: Tue, 26 Mar 2024 18:52:03 -0700 Subject: [PATCH 4/7] xfs: create a new helper to return a file's allocation unit From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380199.3216450.7509540918465429427.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 9961d4b5efbe6..64278f8acaeee 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 7d39e3eca56dc..2ad91f755caf3 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 b95e249cc46a5..1cf061a7324ae 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -3997,3 +3997,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 b2dde0e0f265a..fa3e605901e24 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 Wed Mar 27 01:52:18 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: 13605399 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 45DB22901 for ; Wed, 27 Mar 2024 01:52:19 +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=1711504339; cv=none; b=PKkazwP5lh7DxVCg+LdrQKAlEoil6ZGeTiPBOb3+QCZNQTda4YZn0DkaS9uR8V03VstzFBFb1VA5zU6EqPzQU4lwdPZPY+0ygLZ3Th4Wat1EYhpkt2nUMM2qoWJnaLVzvkA5BiMF02sDGozEf7IfYDxiF55Rlj5egKCf0UbOTUM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504339; c=relaxed/simple; bh=aDWyu6HQsmq2qfb6seRD/ENjwj2NHDaXGyQ95r+PACQ=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Ubfq5iaLYKxvUMc3PIjbPse5FevLAcAdeJImKUAjzIWsw1vxQqwWBzgdeyEIfxseQty2MQJCG7W/IHksh2R79CM3K5zsfGyaZP88HBX2/9n4LBejMpn3KxvU+m7PWbahWjoId5CjV1jv0gLa2hf4yUBWcdINhurW86O1dYUeWaE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=kN2pCEmR; 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="kN2pCEmR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24021C433B1; Wed, 27 Mar 2024 01:52:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504339; bh=aDWyu6HQsmq2qfb6seRD/ENjwj2NHDaXGyQ95r+PACQ=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=kN2pCEmR4FeClBfQ8OBPUzyd3xwgc2lkf0lrKNBj51gUn1EvH8IqIP3zBZJ4Nafnu qQial4bHemtPdIu8p1K3PMaEsS36diwhXagd/Esx9RGJVm+FSpvzDUjvJfj3Uq4x9B 8Qfekg83vZ4xZkqXoK+Nrc3pcJ4qvhDTGSN4KWkWSfA9FWM8aALSAggtA0wGy3MXiH sM5iL8z24aYjagZLPpI83TBOhYJEgOAHXiIrHC6jJxljPsiiZKFDI9WOS8D1BiRZwB 2dRSBoAOZYlE/MVzZ/+oRg9DZUyUzfhVfS6kisLwG/eqaXt3VLP/lqF6UPjCGo0YpQ +mFdUia/SMb+w== Date: Tue, 26 Mar 2024 18:52:18 -0700 Subject: [PATCH 5/7] xfs: hoist multi-fsb allocation unit detection to a helper From: "Darrick J. Wong" To: djwong@kernel.org Cc: hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380216.3216450.3675851752965499332.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 19e11d1da6607..c17b5858fed62 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_bigallocunit(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_bigallocunit(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 fa3e605901e24..89ba114fdb468 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 the file data allocation unit for this file is larger than + * a single filesystem block. + */ +static inline bool xfs_inode_has_bigallocunit(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 Wed Mar 27 01:52:34 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: 13605400 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 641342901 for ; Wed, 27 Mar 2024 01:52:34 +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=1711504355; cv=none; b=L60h2x4jpxEPFgr+AMv/zCvK4Jsi8tdqvlJWlfau9roW3mXQ3q/I9dmxIaJP6Ri5dSqDk0glzqMe7hMOtJn7xugTWKQZt+yEes6NPgjaP9oaK2BCDZxfCCCEU71MJClDxNSTiOxVqEcG8XCUyYcuD9bEnmR3Fr71Hs2nh+zjz78= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504355; c=relaxed/simple; bh=9T8a/EweUpF+ytJCx3CxVe5rfLBOD0M4ev4ZOFGUuFU=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ebKYylajNxpi4gSD4gyAxUHkoEXIBvQjd6a0dPeZbEveeJYpUaK0JF6Ms8sg29MgWeg+hPhuH/br1nJgnZkZwY1bAJN6M/ZyplE/Wtch6FSTi111HUW3n45Sbsn3V/+LUSnU46rH3gbDFO9DmbccTHwehmHHmPX96IGCumYVRcA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FfGdSMOp; 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="FfGdSMOp" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBA1BC433B1; Wed, 27 Mar 2024 01:52:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504354; bh=9T8a/EweUpF+ytJCx3CxVe5rfLBOD0M4ev4ZOFGUuFU=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=FfGdSMOpsZnbsBm08OOFu49Fs76gphGK4rIijjiPS7tmOmWslobhcDUkwv7KxdeUH cYMugIw18itL32F8dDrXWmBjdpdGl+3qGyNlbZ0F2FKIJHE1C25r6Qqs0ToGMMZlV9 IZDaDxC416u3KJ0QsdMbsvyGdahM1yNF39kicU9KC1bPymCKEO5NaIjeZ4MYRNW4My 5QYfyVTplm6ryMSrpMrJIa6/elZHUy1x5PMduAsohSyAAxBNIhHapqVGszRv1btGp7 r+1nxYywlbD0e99eSPcefpQmOJNRGSGVxVSDmsdr5QPgDaihCJbs2PaUShrjkw00hx bu9jMAv7lYsiw== Date: Tue, 26 Mar 2024 18:52:34 -0700 Subject: [PATCH 6/7] xfs: refactor non-power-of-two alignment checks From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380232.3216450.15831256989489004254.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 64278f8acaeee..d1d4158441bd9 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 8f07c9f6157fb..ac355328121ac 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 Wed Mar 27 01:52:49 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: 13605401 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 E578B1AAD7 for ; Wed, 27 Mar 2024 01:52:50 +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=1711504371; cv=none; b=QlO1jbVihY3unzquaKN3I15ecvoIAbjiClgtzKX0kjlNLK/kOWcNEsALA314l98EMOvHhghwqAFB7QloTafGU8Gm13456MxPtz7uf+IJDlJBPTUBAzps9aOMwzX1btlsdodnnaBqRQUgk7gsoKlG9dlTTgWAufVI2FrNkkJFJT8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711504371; c=relaxed/simple; bh=asAVb7j3JmeTxy2+02GkeUqLdIOPTTSBmVKAUFf0P1I=; h=Date:Subject:From:To:Cc:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=MFyuKQAYXJR4EdyVbyVC4euT/nuVp7kzvvttBizjVzLKq9Cf3fk4ZbZ6VYsgo0yDaaq96fcDJ8Bc12hpSOE0AjcPWgiTR7CZTWtV6yxD5llgKPVUdVo9Ib4fhgc8ptKOkQt5yCGoxsIhAm4Sn/a1Zflgqkzc7PKMOHsjStO+D5M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Ue/GUpcA; 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="Ue/GUpcA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AE25C433B1; Wed, 27 Mar 2024 01:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711504370; bh=asAVb7j3JmeTxy2+02GkeUqLdIOPTTSBmVKAUFf0P1I=; h=Date:Subject:From:To:Cc:In-Reply-To:References:From; b=Ue/GUpcA1m6vNxd9mufrKgJvAZSjO/gtUbfPhsSPAuoeYx4ZETO9CijeXgi8zj+cN 1i1DqZbSCCMzqIwXi5+sE7+b8gFDepllAfWf+6F8nTQ7WVeA8rwOeORC3OQllX+lzk PvgBXNitNJsxPWqemNawF81uFafsWin7PJwJxxTeWEan3KqqvV5HvI+zb97KDWpC84 6LLWT9UGe0rrjctXVgRIxP88IJJkeLVBa1gPVFi8FEweSH4axaUE2I9jPIW32SQ6Xt OKhT8dtPT3vBls1dGgsYI2UF5whFIYUJF8Ub6UwVq7OaFIokx0za1UIe2FqMYOyf7x xszYMLdba5/kw== Date: Tue, 26 Mar 2024 18:52:49 -0700 Subject: [PATCH 7/7] xfs: constify xfs_bmap_is_written_extent From: "Darrick J. Wong" To: djwong@kernel.org Cc: Christoph Hellwig , hch@lst.de, linux-xfs@vger.kernel.org Message-ID: <171150380248.3216450.7091928042805546982.stgit@frogsfrogsfrogs> In-Reply-To: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> References: <171150380117.3216450.660937377362010507.stgit@frogsfrogsfrogs> User-Agent: StGit/0.19 Precedence: bulk X-Mailing-List: linux-xfs@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 f7662595309d8..b8bdbf1560e65 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;