static inline void *inline_xattr_addr(struct f2fs_inode *inode)
{
- return (void *)&(inode->i_addr[DEF_ADDRS_PER_INODE_INLINE_XATTR]);
+ return (void *)&(inode->i_addr[DEF_ADDRS_PER_INODE -
+ get_inline_xattr_addrs(inode)]);
}
static inline int inline_xattr_size(struct f2fs_inode *inode)
{
- if (inode->i_inline & F2FS_INLINE_XATTR)
- return F2FS_INLINE_XATTR_ADDRS << 2;
- return 0;
+ return get_inline_xattr_addrs(inode) * sizeof(__le32);
}
extern int lookup_nat_in_journal(struct f2fs_sb_info *sbi, u32 nid, struct f2fs_nat_entry *ne);
le32_to_cpu(inode->i_ext.len));
DISP_u16(inode, i_extra_isize);
- DISP_u16(inode, i_padding);
+ DISP_u16(inode, i_inline_xattr_size);
DISP_u32(inode, i_projid);
DISP_u32(inode, i_inode_checksum);
if (f & cpu_to_le32(F2FS_FEATURE_INODE_CHKSUM)) {
MSG(0, "%s", " inode checksum");
}
+ if (f & cpu_to_le32(F2FS_FEATURE_FLEXIBLE_INLINE_XATTR)) {
+ MSG(0, "%s", " flexible inline xattr");
+ }
MSG(0, "\n");
MSG(0, "Info: superblock encrypt level = %d, salt = ",
sb->encryption_level);
#define F2FS_FEATURE_EXTRA_ATTR 0x0008
#define F2FS_FEATURE_PRJQUOTA 0x0010
#define F2FS_FEATURE_INODE_CHKSUM 0x0020
+#define F2FS_FEATURE_FLEXIBLE_INLINE_XATTR 0x0040
#define MAX_VOLUME_NAME 512
} __attribute__((packed));
#define F2FS_NAME_LEN 255
-#define F2FS_INLINE_XATTR_ADDRS 50 /* 200 bytes for inline xattrs */
+/* 200 bytes for inline xattrs by default */
+#define DEFAULT_INLINE_XATTR_ADDRS 50
#define DEF_ADDRS_PER_INODE 923 /* Address Pointers in an Inode */
#define CUR_ADDRS_PER_INODE(inode) (DEF_ADDRS_PER_INODE - \
__get_extra_isize(inode))
#define ADDRS_PER_INODE(i) addrs_per_inode(i)
-#define DEF_ADDRS_PER_INODE_INLINE_XATTR \
- (DEF_ADDRS_PER_INODE - F2FS_INLINE_XATTR_ADDRS)
#define ADDRS_PER_BLOCK 1018 /* Address Pointers in a Direct Block */
#define NIDS_PER_BLOCK 1018 /* Node IDs in an Indirect Block */
#define F2FS_DEF_PROJID 0 /* default project ID */
#define MAX_INLINE_DATA(node) (sizeof(__le32) * \
- (DEF_ADDRS_PER_INODE_INLINE_XATTR - \
+ (DEF_ADDRS_PER_INODE - \
+ get_inline_xattr_addrs(&node->i) - \
get_extra_isize(node) - \
DEF_INLINE_RESERVED_SIZE))
#define DEF_MAX_INLINE_DATA (sizeof(__le32) * \
- (DEF_ADDRS_PER_INODE_INLINE_XATTR - \
+ (DEF_ADDRS_PER_INODE - \
+ DEFAULT_INLINE_XATTR_ADDRS - \
F2FS_TOTAL_EXTRA_ATTR_SIZE - \
DEF_INLINE_RESERVED_SIZE))
#define INLINE_DATA_OFFSET (PAGE_CACHE_SIZE - sizeof(struct node_footer) \
union {
struct {
__le16 i_extra_isize; /* extra inode attribute size */
- __le16 i_padding; /* padding */
+ __le16 i_inline_xattr_size; /* inline xattr size, unit: 4 bytes */
__le32 i_projid; /* project id */
__le32 i_inode_checksum;/* inode meta checksum */
__le32 i_extra_end[0]; /* for attribute size calculation */
return 0;
}
+extern struct f2fs_configuration c;
+static inline int get_inline_xattr_addrs(struct f2fs_inode *inode)
+{
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_FLEXIBLE_INLINE_XATTR))
+ return le16_to_cpu(inode->i_inline_xattr_size);
+ else if (inode->i_inline & F2FS_INLINE_XATTR ||
+ inode->i_inline & F2FS_INLINE_DENTRY)
+ return DEFAULT_INLINE_XATTR_ADDRS;
+ else
+ return 0;
+}
+
#define get_extra_isize(node) __get_extra_isize(&node->i)
#define F2FS_ZONED_NONE 0
c.feature |= cpu_to_le32(F2FS_FEATURE_PRJQUOTA);
} else if (!strcmp(features, "inode_checksum")) {
c.feature |= cpu_to_le32(F2FS_FEATURE_INODE_CHKSUM);
+ } else if (!strcmp(features, "flexible_inline_xattr")) {
+ c.feature |= cpu_to_le32(F2FS_FEATURE_FLEXIBLE_INLINE_XATTR);
} else {
MSG(0, "Error: Wrong features\n");
mkfs_usage();
"enabled with extra attr feature\n");
exit(1);
}
+ if (c.feature & cpu_to_le32(F2FS_FEATURE_FLEXIBLE_INLINE_XATTR)) {
+ MSG(0, "\tInfo: flexible inline xattr feature should always been"
+ "enabled with extra attr feature\n");
+ exit(1);
+ }
}
if (optind >= argc) {