All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/10] xfs: feature flag rework
@ 2018-08-20  4:48 Dave Chinner
  2018-08-20  4:48 ` [PATCH 01/10] xfs: reflect sb features in xfs_mount Dave Chinner
                   ` (10 more replies)
  0 siblings, 11 replies; 27+ messages in thread
From: Dave Chinner @ 2018-08-20  4:48 UTC (permalink / raw)
  To: linux-xfs

Hi folks,

This series reworks how the kernel code handles feature bits. It
seemed to me to be a bit crazy to repeatedly have to check multiple
values in the superblock to check whether a feature is supported.
e.g. to check if reflink is available, we first mask the version
number to extract it from the superblock field, then we check it
against the v5 value, then we load and check the feature bit from
the superblock.

This could all just be a single flag check - a flag that is set at
mount time after doing all of the above, and so it's just a single
operation to check.

I'm also tired of typing "xfs_sb_version_hasfoo" everytime a check
needs to be done. Not to mention having a different mechanism to
check mount option based features.

And then there's the conflation of mount option feature flags and
runtime state in the one set of flags. The flags field is not
updated atomically, so there no guarantee that a change of a state
flag does race with anything else and we lose it.

So this patch set moves all the feature flags into a new m_features
field in the struct xfs_mount. It doesn't matter if they are mount
options or superblock feature bits - they all end up in the one
place whether they are [almost entirely] read only. These are now
checked by "xfs_has_foo(mp)" functions (following the ext4 feature
check syntax), and for the very few features that can be dynamically
added or removed there are also xfs_feat_add/remove_foo(mp) helpers.
IOWs, both superblock and mount option features are checked the same
way.

The state flags (clean mount, unmounting, shutdown, etc) are all
moved to a new m_state field, which is manipulated entirely by
atomic bitops to avoid update races. THere are a couple of wrappers
for the common checks - xfs_is_read_only(mp) and
xfs_is_shut_down(mp). The latter replaces the XFS_FORCED_SHUTDOWN()
macro.

There's a bit of extra work around the attr2 feature bit - we've got
the superblock bit, and then "attr2" and "noattr2" mount options and
somewhat convoluted interactions. This patchset changes the
behaviour of all these now - the attr2 bit on disk and mount option
now mean the same thing, and noattr2 will turn off the superblock
bit if it is set and prevent attr2 inodes from being created. This
simplifies the mount time checking and clearing of these features.

Also, it gives us a clean separation of "inode32 mount option" and
"inode32 allocation is active". The former is a feature bit (i.e.
SMALL_INUMS), and the latter is a state bit (32BITINODES) that is
set if the filesystem size requires the allocator to limit
allocation to 32 bit inode space.

This also allows us to get rid of all the xfs_sb_version_hasfoo()
inline functions. THere is a single function to populate m_features
from the superblock bits, and the low level checks that are purely
superblock based (i.e. on disk conversion and verifiers) directly
check the superblock fields rather than use wrappers.

Overall, this doesn't change the amount of code. If does reduce the
built binary size by about 3.2kB, mainly through replacing the
xfs_sb_version...() checks with a single m_features flag check. It
makes the code a bit simpler, easier to read, and less shouty and
separates runtime state from filesystem features.

-Dave.

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2018-08-23 17:08 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-20  4:48 [PATCH 0/10] xfs: feature flag rework Dave Chinner
2018-08-20  4:48 ` [PATCH 01/10] xfs: reflect sb features in xfs_mount Dave Chinner
2018-08-21 13:21   ` Brian Foster
2018-08-21 23:31     ` Dave Chinner
2018-08-22 12:17       ` Brian Foster
2018-08-22 23:59         ` Dave Chinner
2018-08-23 13:39           ` Brian Foster
2018-08-20  4:48 ` [PATCH 02/10] xfs: replace xfs_sb_version checks with feature flag checks Dave Chinner
2018-08-20  4:48 ` [PATCH 03/10] xfs: consolidate mount option features in m_features Dave Chinner
2018-08-21 13:21   ` Brian Foster
2018-08-21 23:32     ` Dave Chinner
2018-08-20  4:48 ` [PATCH 04/10] xfs: convert mount flags to features Dave Chinner
2018-08-21 13:22   ` Brian Foster
2018-08-21 23:36     ` Dave Chinner
2018-08-20  4:48 ` [PATCH 05/10] xfs: convert remaining mount flags to state flags Dave Chinner
2018-08-21 13:23   ` Brian Foster
2018-08-20  4:48 ` [PATCH 06/10] xfs: replace XFS_FORCED_SHUTDOWN with xfs_is_shut_down Dave Chinner
2018-08-21 13:23   ` Brian Foster
2018-08-20  4:48 ` [PATCH 07/10] xfs: convert xfs_fs_geometry to use mount feature checks Dave Chinner
2018-08-20  4:48 ` [PATCH 08/10] xfs: open code sb verifier " Dave Chinner
2018-08-21 13:01   ` Jan Tulak
2018-08-21 23:43     ` Dave Chinner
2018-08-21 13:25   ` Brian Foster
2018-08-21 23:43     ` Dave Chinner
2018-08-20  4:48 ` [PATCH 09/10] xfs: convert scrub to use mount-based " Dave Chinner
2018-08-20  4:48 ` [PATCH 10/10] xfs: remove unused xfs_sb_version_has... wrappers Dave Chinner
2018-08-21 13:54 ` [PATCH 0/10] xfs: feature flag rework Jan Tulak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.