]> www.infradead.org Git - users/hch/xfsprogs.git/commit
libxfs: pack icreate initialization parameters into a separate structure
authorDarrick J. Wong <djwong@kernel.org>
Wed, 2 Oct 2024 01:10:26 +0000 (18:10 -0700)
committerAndrey Albershteyn <aalbersh@redhat.com>
Fri, 4 Oct 2024 10:42:07 +0000 (12:42 +0200)
commit04fd15692ac8ffc066c0a8536a8926d75fed8f67
treee8af0afd5006f4b4b7d7d18e858b004e49f22c5a
parent7ff05ce00ebb0af67fd971ffedcb2ec46b51850a
libxfs: 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>
include/xfs_inode.h
libxfs/inode.c