mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-24 03:08:51 +03:00
Support for longnames for files/directories (Linux part)
This patch adds the ability for zfs to support file/dir name up to 1023 bytes. This number is chosen so we can support up to 255 4-byte characters. This new feature is represented by the new feature flag feature@longname. A new dataset property "longname" is also introduced to toggle longname support for each dataset individually. This property can be disabled, even if it contains longname files. In such case, new file cannot be created with longname but existing longname files can still be looked up. Note that, to my knowledge native Linux filesystems don't support name longer than 255 bytes. So there might be programs not able to work with longname. Note that NFS server may needs to use exportfs_get_name to reconnect dentries, and the buffer being passed is limit to NAME_MAX+1 (256). So NFS may not work when longname is enabled. Note, FreeBSD vfs layer imposes a limit of 255 name lengh, so even though we add code to support it here, it won't actually work. Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #15921
This commit is contained in:
committed by
Brian Behlendorf
parent
3cf2bfa570
commit
20232ecfaa
@@ -81,6 +81,7 @@ typedef enum dmu_objset_type {
|
||||
* All of these include the terminating NUL byte.
|
||||
*/
|
||||
#define ZAP_MAXNAMELEN 256
|
||||
#define ZAP_MAXNAMELEN_NEW 1024
|
||||
#define ZAP_MAXVALUELEN (1024 * 8)
|
||||
#define ZAP_OLDMAXVALUELEN 1024
|
||||
#define ZFS_MAX_DATASET_NAME_LEN 256
|
||||
@@ -194,6 +195,7 @@ typedef enum {
|
||||
ZFS_PROP_PREFETCH,
|
||||
ZFS_PROP_VOLTHREADING,
|
||||
ZFS_PROP_DIRECT,
|
||||
ZFS_PROP_LONGNAME,
|
||||
ZFS_NUM_PROPS
|
||||
} zfs_prop_t;
|
||||
|
||||
|
||||
+2
-1
@@ -315,7 +315,7 @@ int zap_count(objset_t *ds, uint64_t zapobj, uint64_t *count);
|
||||
* match must be exact (ie, same as mask=-1ULL).
|
||||
*/
|
||||
int zap_value_search(objset_t *os, uint64_t zapobj,
|
||||
uint64_t value, uint64_t mask, char *name);
|
||||
uint64_t value, uint64_t mask, char *name, uint64_t namelen);
|
||||
|
||||
/*
|
||||
* Transfer all the entries from fromobj into intoobj. Only works on
|
||||
@@ -387,6 +387,7 @@ void zap_fini(void);
|
||||
* Alloc and free zap_attribute_t.
|
||||
*/
|
||||
zap_attribute_t *zap_attribute_alloc(void);
|
||||
zap_attribute_t *zap_attribute_long_alloc(void);
|
||||
void zap_attribute_free(zap_attribute_t *attrp);
|
||||
|
||||
/*
|
||||
|
||||
@@ -143,7 +143,7 @@ typedef enum drr_headertype {
|
||||
* default use of "zfs send" won't encounter the bug mentioned above.
|
||||
*/
|
||||
#define DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS (1 << 27)
|
||||
/* flag #28 is reserved for a Nutanix feature */
|
||||
#define DMU_BACKUP_FEATURE_LONGNAME (1 << 28)
|
||||
|
||||
/*
|
||||
* Mask of all supported backup features
|
||||
@@ -154,7 +154,7 @@ typedef enum drr_headertype {
|
||||
DMU_BACKUP_FEATURE_COMPRESSED | DMU_BACKUP_FEATURE_LARGE_DNODE | \
|
||||
DMU_BACKUP_FEATURE_RAW | DMU_BACKUP_FEATURE_HOLDS | \
|
||||
DMU_BACKUP_FEATURE_REDACTED | DMU_BACKUP_FEATURE_SWITCH_TO_LARGE_BLOCKS | \
|
||||
DMU_BACKUP_FEATURE_ZSTD)
|
||||
DMU_BACKUP_FEATURE_ZSTD | DMU_BACKUP_FEATURE_LONGNAME)
|
||||
|
||||
/* Are all features in the given flag word currently supported? */
|
||||
#define DMU_STREAM_SUPPORTED(x) (!((x) & ~DMU_BACKUP_FEATURE_MASK))
|
||||
|
||||
Reference in New Issue
Block a user