diff options
author | Aleksa Sarai <[email protected]> | 2019-06-22 10:35:11 +1000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2022-10-28 09:49:20 -0700 |
commit | dbf6108b4df92341eea40d0b41792ac16eabc514 (patch) | |
tree | 80091802c43eae2db003b4ed2fa79392fd53efe7 /include/os/linux/spl/sys/sysmacros.h | |
parent | e015d6cc0b60d4675c9b6d2433eed2c8ef0863e8 (diff) |
zfs_rename: support RENAME_* flags
Implement support for Linux's RENAME_* flags (for renameat2). Aside from
being quite useful for userspace (providing race-free ways to exchange
paths and implement mv --no-clobber), they are used by overlayfs and are
thus required in order to use overlayfs-on-ZFS.
In order for us to represent the new renameat2(2) flags in the ZIL, we
create two new transaction types for the two flags which need
transactional-level support (RENAME_EXCHANGE and RENAME_WHITEOUT).
RENAME_NOREPLACE does not need any ZIL support because we know that if
the operation succeeded before creating the ZIL entry, there was no file
to be clobbered and thus it can be treated as a regular TX_RENAME.
Reviewed-by: Ryan Moeller <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Pavel Snajdr <[email protected]>
Signed-off-by: Aleksa Sarai <[email protected]>
Closes #12209
Closes #14070
Diffstat (limited to 'include/os/linux/spl/sys/sysmacros.h')
-rw-r--r-- | include/os/linux/spl/sys/sysmacros.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/os/linux/spl/sys/sysmacros.h b/include/os/linux/spl/sys/sysmacros.h index be1f77e43..99e3a6fb4 100644 --- a/include/os/linux/spl/sys/sysmacros.h +++ b/include/os/linux/spl/sys/sysmacros.h @@ -120,6 +120,16 @@ extern uint32_t zone_get_hostid(void *zone); extern void spl_setup(void); extern void spl_cleanup(void); +/* + * Only handles the first 4096 majors and first 256 minors. We don't have a + * libc for the kernel module so we define this inline. + */ +static inline dev_t +makedev(unsigned int major, unsigned int minor) +{ + return ((major & 0xFFF) << 8) | (minor & 0xFF); +} + #define highbit(x) __fls(x) #define lowbit(x) __ffs(x) |