btrfs: switch mount option bits to enums and use wider type
authorDavid Sterba <dsterba@suse.com>
Fri, 18 Jun 2021 12:57:05 +0000 (14:57 +0200)
committerDavid Sterba <dsterba@suse.com>
Tue, 22 Jun 2021 12:11:58 +0000 (14:11 +0200)
commitccd9395b5241310f1ef518ad371f8de779f0b681
tree1a5b73154ad814e5c871122a881ce7dd93fc53ce
parent5548c8c6f55bf0097075b3720e14857e3272429f
btrfs: switch mount option bits to enums and use wider type

Switch defines of BTRFS_MOUNT_* to an enum (the symbolic names are
recorded in the debugging information for convenience).

There are two more things done but separating them would not make much
sense as it's touching the same lines:

- Renumber shifts 18..31 to 17..30 to get rid of the hole in the
  sequence.

- Use 1UL as the value that gets shifted because we're approaching the
  32bit limit and due to integer promotions the value of (1 << 31)
  becomes 0xffffffff80000000 when cast to unsigned long (eg. the option
  manipulating helpers).

  This is not causing any problems yet as the operations are in-memory
  and masking the 31st bit works, we don't have more than 31 bits so the
  ill effects of not masking higher bits don't happen. But once we have
  more, the problems will emerge.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ctree.h