]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs: eliminate duplicate icreate tx reservation functions
authorBrian Foster <bfoster@redhat.com>
Tue, 27 Feb 2018 04:43:16 +0000 (22:43 -0600)
committerEric Sandeen <sandeen@redhat.com>
Tue, 27 Feb 2018 04:43:16 +0000 (22:43 -0600)
commit0197075701aad6da240187b7e8dc5cfe0205eb87
tree1fc1bd7d53031bae4ef8b35fe3cedba39857cab7
parent0b98035f00359582d6d4110d41a457ad2a82d6eb
xfs: eliminate duplicate icreate tx reservation functions

Source kernel commit: c017cb5ddfd6326032570d5eba83308c8a9c13a9

The create transaction reservation calculation has two different
branches of code depending on whether the filesystem is a v5 format
fs or older. Each branch considers the max reservation between the
allocation case (new chunk allocation + record insert) and the
modify case (chunk exists, record modification) of inode allocation.

The modify case is the same for both superblock versions with the
exception of the finobt. The finobt helper checks the feature bit,
however, and so the modify case already shares the same code.

Now that inode chunk allocation has been refactored into a helper
that checks the superblock version to calculate the appropriate
reservation for the create transaction, the only remaining
difference between the create and icreate branches is the call to
the finobt helper. As noted above, the finobt helper is a no-op when
the feature is not enabled. Therefore, these branches are
effectively duplicate and can be condensed.

Remove the xfs_calc_create_*() branch of functions and update the
various callers to use the xfs_calc_icreate_*() variant. The latter
creates the same reservation size for v4 create transactions as the
removed branch. As such, this patch does not result in transaction
reservation changes.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_trans_resv.c