]> www.infradead.org Git - users/hch/xfsprogs.git/commit
xfs: pack icreate initialization parameters into a separate structure
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:10:11 +0000 (18:10 -0700)
committerAndrey Albershteyn <aalbersh@redhat.com>
Fri, 4 Oct 2024 10:42:07 +0000 (12:42 +0200)
commit7ff05ce00ebb0af67fd971ffedcb2ec46b51850a
tree12aa8e212b47850aa3aba0fcf4c8afa8b7011c9c
parent4c300905db8d424996ec5f9890fa93e67ef40112
xfs: pack icreate initialization parameters into a separate structure

Source kernel commit: ba4b39fe4c011078469dcd28f51447d75852d21c

Callers that want to create an inode currently pass all possible file
attribute values for the new inode into xfs_init_new_inode as ten
separate parameters.  This causes two code maintenance issues: first, we
have large multi-line call sites which programmers must read carefully
to make sure they did not accidentally invert a value.  Second, all
three file id parameters must be passed separately to the quota
functions; any discrepancy results in quota count errors.

Clean this up by creating a new icreate_args structure to hold all this
information, some helpers to initialize them properly, and make the
callers pass this structure through to the creation function, whose name
we shorten to xfs_icreate.  This eliminates the issues, enables us to
keep the inode init code in sync with userspace via libxfs, and is
needed for future metadata directory tree management.

(A subsequent cleanup will also fix the quota alloc calls.)

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfs_inode_util.h