OSDN Git Service

e2fsprogs: reserving code points for new ext4 quota feature
authorAditya Kali <adityakali@google.com>
Tue, 15 Feb 2011 22:27:27 +0000 (14:27 -0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 25 Feb 2011 23:31:52 +0000 (18:31 -0500)
This patch adds support for detecting the new 'quota' feature in ext4.
The patch reserves code points for usr and group quota inodes and also
for the feature flag EXT4_FEATURE_RO_COMPAT_QUOTA.

Signed-off-by: Aditya Kali <adityakali@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/set_fields.c
e2fsck/message.c
ext2ed/inode_com.c
lib/blkid/probe.h
lib/e2p/feature.c
lib/e2p/ls.c
lib/ext2fs/ext2_fs.h
lib/ext2fs/swapfs.c
lib/ext2fs/tst_super_size.c

index db1a99b..3b40117 100644 (file)
@@ -140,6 +140,8 @@ static struct field_set_info super_fields[] = {
          parse_uint },
        { "snapshot_list", &set_sb.s_snapshot_list, 4, parse_uint },
        { "mount_opts",  &set_sb.s_mount_opts, 64, parse_string },
+       { "usr_quota_inum", &set_sb.s_usr_quota_inum, 4, parse_uint },
+       { "grp_quota_inum", &set_sb.s_grp_quota_inum, 4, parse_uint },
        { 0, 0, 0, 0 }
 };
 
index 9aaedc5..74ab155 100644 (file)
@@ -151,8 +151,8 @@ static const char *special_inode_name[] =
        N_("<The NULL inode>"),                 /* 0 */
        N_("<The bad blocks inode>"),           /* 1 */
        "/",                                    /* 2 */
-       N_("<The ACL index inode>"),            /* 3 */
-       N_("<The ACL data inode>"),             /* 4 */
+       N_("<The user quota inode>"),           /* 3 */
+       N_("<The group quota inode>"),          /* 4 */
        N_("<The boot loader inode>"),          /* 5 */
        N_("<The undelete directory inode>"),   /* 6 */
        N_("<The group descriptor inode>"),     /* 7 */
index 843286c..8d4b9f3 100644 (file)
@@ -222,11 +222,11 @@ void type_ext2_inode___show (char *command_line)
                        case EXT2_ROOT_INO:
                                wprintw (show_win,"Root inode - ");
                                break;
-                       case EXT2_ACL_IDX_INO:
-                               wprintw (show_win,"ACL index inode - ");
+                       case EXT4_USR_QUOTA_INO:
+                               wprintw (show_win,"User quota inode - ");
                                break;
-                       case EXT2_ACL_DATA_INO:
-                               wprintw (show_win,"ACL data inode - ");
+                       case EXT4_GRP_QUOTA_INO:
+                               wprintw (show_win,"Group quota inode - ");
                                break;
                        case EXT2_BOOT_LOADER_INO:
                                wprintw (show_win,"Boot loader inode - ");
index 37fc9c0..37e80ef 100644 (file)
@@ -109,6 +109,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_RO_COMPAT_GDT_CSUM                0x0010
 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK       0x0020
 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE     0x0040
+#define EXT4_FEATURE_RO_COMPAT_QUOTA           0x0100
 
 /* for s_feature_incompat */
 #define EXT2_FEATURE_INCOMPAT_FILETYPE         0x0002
index c7f8a35..9324199 100644 (file)
@@ -55,6 +55,8 @@ static struct feature feature_list[] = {
                        "dir_nlink" },
        {       E2P_FEATURE_RO_INCOMPAT, EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE,
                        "extra_isize" },
+       {       E2P_FEATURE_RO_INCOMPAT, EXT4_FEATURE_RO_COMPAT_QUOTA,
+                       "quota" },
 
        {       E2P_FEATURE_INCOMPAT, EXT2_FEATURE_INCOMPAT_COMPRESSION,
                        "compression" },
index 5ef8098..8b8360a 100644 (file)
@@ -374,6 +374,12 @@ void list_super2(struct ext2_super_block * sb, FILE *f)
                fprintf(f, "Last error block #:       %llu\n",
                        sb->s_last_error_block);
        }
+       if (sb->s_usr_quota_inum)
+               fprintf(f, "User quota inode:         %u\n",
+                       sb->s_usr_quota_inum);
+       if (sb->s_grp_quota_inum)
+               fprintf(f, "Group quota inode:        %u\n",
+                       sb->s_grp_quota_inum);
 }
 
 void list_super (struct ext2_super_block * s)
index afd33a9..f396a10 100644 (file)
@@ -44,8 +44,8 @@
  */
 #define EXT2_BAD_INO            1      /* Bad blocks inode */
 #define EXT2_ROOT_INO           2      /* Root inode */
-#define EXT2_ACL_IDX_INO        3      /* ACL inode */
-#define EXT2_ACL_DATA_INO       4      /* ACL inode */
+#define EXT4_USR_QUOTA_INO      3      /* User quota inode */
+#define EXT4_GRP_QUOTA_INO      4      /* Group quota inode */
 #define EXT2_BOOT_LOADER_INO    5      /* Boot loader inode */
 #define EXT2_UNDEL_DIR_INO      6      /* Undelete directory inode */
 #define EXT2_RESIZE_INO                 7      /* Reserved group descriptors inode */
@@ -614,7 +614,9 @@ struct ext2_super_block {
        __u8    s_last_error_func[32];  /* function where the error happened */
 #define EXT4_S_ERR_END ext4_offsetof(struct ext2_super_block, s_mount_opts)
        __u8    s_mount_opts[64];
-       __u32   s_reserved[112];        /* Padding to the end of the block */
+       __u32   s_usr_quota_inum;       /* inode number of user quota file */
+       __u32   s_grp_quota_inum;       /* inode number of group quota file */
+       __u32   s_reserved[110];        /* Padding to the end of the block */
 };
 
 #define EXT4_S_ERR_LEN (EXT4_S_ERR_END - EXT4_S_ERR_START)
@@ -672,6 +674,7 @@ struct ext2_super_block {
 #define EXT4_FEATURE_RO_COMPAT_DIR_NLINK       0x0020
 #define EXT4_FEATURE_RO_COMPAT_EXTRA_ISIZE     0x0040
 #define EXT4_FEATURE_RO_COMPAT_HAS_SNAPSHOT    0x0080
+#define EXT4_FEATURE_RO_COMPAT_QUOTA           0x0100
 
 #define EXT2_FEATURE_INCOMPAT_COMPRESSION      0x0001
 #define EXT2_FEATURE_INCOMPAT_FILETYPE         0x0002
index 12427e0..15ff6fc 100644 (file)
@@ -76,6 +76,8 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
        sb->s_snapshot_r_blocks_count =
                ext2fs_swab64(sb->s_snapshot_r_blocks_count);
        sb->s_snapshot_list = ext2fs_swab32(sb->s_snapshot_list);
+       sb->s_usr_quota_inum = ext2fs_swab32(sb->s_usr_quota_inum);
+       sb->s_grp_quota_inum = ext2fs_swab32(sb->s_grp_quota_inum);
 
        for (i=0; i < 4; i++)
                sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
index eb9114f..a3a5b44 100644 (file)
@@ -123,6 +123,8 @@ void check_superblock_fields()
        check_field(s_last_error_block);
        check_field(s_last_error_func);
        check_field(s_mount_opts);
+       check_field(s_usr_quota_inum);
+       check_field(s_grp_quota_inum);
        check_field(s_reserved);
        printf("Ending offset is %d\n\n", cur_offset);
 #endif