| Submitter | Dmitri Monakho |
|---|---|
| Date | Nov. 18, 2009, 5:43 p.m. |
| Message ID | <87skcb20ge.fsf@openvz.org> |
| Download | mbox | patch |
| Permalink | /patch/38766/ |
| State | New |
| Headers | show |
Comments
On 2009-11-18, at 09:43, Dmitry Monakhov wrote: > In other point of view it may be too expensive reserve the last 4 > bytes in EXT4_GOOD_OLD_INODE. At the same time store tree_id as xattr. > result in space wasting. Since the xattr is stored inside the inode, and you are accessing this from the kernel, it is using only 24 bytes of space used for your tree ID (20 bytes ext4_xattr_entry, including 3-byte name, 4 bytes data). It also has virtually no performance overhead because it is kept in the inode itself. If you consider that the use of tree_id is not likely to be commonly used, then it would be "wasting" 4 bytes of space in everyone else's inodes to reserve this field in the inode (whether in the old inode or the larger ext4 inode). > But in fact new inode has room for space > reservation. We may store it like it is done for i_version_hi field > --- a/fs/ext4/ext4.h > +++ b/fs/ext4/ext4.h > @@ -494,6 +494,7 @@ struct ext4_inode { > __le32 i_crtime; /* File Creation time */ > __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | > epoch) */ > __le32 i_version_hi; /* high 32 bits for 64-bit version */ > + __le32 i_disk_tree_id; /* directory tree quota id */ > }; Cheers, Andreas -- Andreas Dilger Sr. Staff Engineer, Lustre Group Sun Microsystems of Canada, Inc. -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Patch
--- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -494,6 +494,7 @@ struct ext4_inode { __le32 i_crtime; /* File Creation time */ __le32 i_crtime_extra; /* extra FileCreationtime (nsec << 2 | epoch) */ __le32 i_version_hi; /* high 32 bits for 64-bit version */ + __le32 i_disk_tree_id; /* directory tree quota id */ }; struct move_extent { @@ -1112,6 +1113,7 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) #define EXT4_FEATURE_INCOMPAT_64BIT 0x0080 #define EXT4_FEATURE_INCOMPAT_MMP 0x0100 #define EXT4_FEATURE_INCOMPAT_FLEX_BG 0x0200 +#define EXT4_FEATURE_INCOMPAT_TREE_ID 0x0400 /* directory tree id */ #define EXT4_FEATURE_COMPAT_SUPP EXT2_FEATURE_COMPAT_EXT_ATTR #define EXT4_FEATURE_INCOMPAT_SUPP (EXT4_FEATURE_INCOMPAT_FILETYPE| \ @@ -1119,7 +1121,8 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino) EXT4_FEATURE_INCOMPAT_META_BG| \ EXT4_FEATURE_INCOMPAT_EXTENTS| \ EXT4_FEATURE_INCOMPAT_64BIT| \ - EXT4_FEATURE_INCOMPAT_FLEX_BG) + EXT4_FEATURE_INCOMPAT_FLEX_BG| \ + EXT4_FEATURE_INCOMPAT_TREE_ID) #define EXT4_FEATURE_RO_COMPAT_SUPP (EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \ EXT4_FEATURE_RO_COMPAT_LARGE_FILE| \ EXT4_FEATURE_RO_COMPAT_GDT_CSUM| \ --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1534,6 +1534,15 @@ set_qf_format: set_opt(sbi->s_mount_opt, I_VERSION); sb->s_flags |= MS_I_VERSION; break; + case Opt_tree_id: + if (!(EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_TREE_ID) && + EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && + EXT4_FITS_IN_INODE(raw_inode, ei, i_disk_tree_id))) { + ext4_msg(sb, KERN_ERR, "tree_id is not supported"); + return 0; + } + set_opt(sbi->s_mount_opt, TREE_ID); + break; case Opt_nodelalloc: clear_opt(sbi->s_mount_opt, DELALLOC); break;