fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / ext3_fs.h
index 27449a4..ebbe50a 100644 (file)
 #define _LINUX_EXT3_FS_H
 
 #include <linux/types.h>
-#include <linux/ext3_fs_i.h>
-#include <linux/ext3_fs_sb.h>
-
-
-struct statfs;
+#include <linux/magic.h>
 
 /*
  * The second extended filesystem constants/structures
@@ -33,11 +29,12 @@ struct statfs;
 #undef EXT3FS_DEBUG
 
 /*
- * Define EXT3_PREALLOCATE to preallocate data blocks for expanding files
+ * Define EXT3_RESERVATION to reserve data blocks for expanding files
  */
-#undef  EXT3_PREALLOCATE /* @@@ Fix this! */
-#define EXT3_DEFAULT_PREALLOC_BLOCKS   8
-
+#define EXT3_DEFAULT_RESERVE_BLOCKS     8
+/*max window size: 1024(direct blocks) + 3([t,d]indirect blocks) */
+#define EXT3_MAX_RESERVE_BLOCKS         1027
+#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
 /*
  * Always enable hashed directories
  */
@@ -70,11 +67,6 @@ struct statfs;
 /* First non-reserved inode for old ext3 filesystems */
 #define EXT3_GOOD_OLD_FIRST_INO        11
 
-/*
- * The second extended file system magic number
- */
-#define EXT3_SUPER_MAGIC       0xEF53
-
 /*
  * Maximal count of links to a file
  */
@@ -129,14 +121,14 @@ struct statfs;
  */
 struct ext3_group_desc
 {
-       __u32   bg_block_bitmap;                /* Blocks bitmap block */
-       __u32   bg_inode_bitmap;                /* Inodes bitmap block */
-       __u32   bg_inode_table;         /* Inodes table block */
-       __u16   bg_free_blocks_count;   /* Free blocks count */
-       __u16   bg_free_inodes_count;   /* Free inodes count */
-       __u16   bg_used_dirs_count;     /* Directories count */
+       __le32  bg_block_bitmap;                /* Blocks bitmap block */
+       __le32  bg_inode_bitmap;                /* Inodes bitmap block */
+       __le32  bg_inode_table;         /* Inodes table block */
+       __le16  bg_free_blocks_count;   /* Free blocks count */
+       __le16  bg_free_inodes_count;   /* Free inodes count */
+       __le16  bg_used_dirs_count;     /* Directories count */
        __u16   bg_pad;
-       __u32   bg_reserved[3];
+       __le32  bg_reserved[3];
 };
 
 /*
@@ -189,46 +181,111 @@ struct ext3_group_desc
 #define EXT3_IUNLINK_FL                        0x08000000 /* Immutable unlink */
 #define EXT3_RESERVED_FL               0x80000000 /* reserved for ext3 lib */
 
+#ifdef CONFIG_VSERVER_LEGACY
+#define EXT3_FL_USER_VISIBLE           0x0803DFFF /* User visible flags */
+#define EXT3_FL_USER_MODIFIABLE                0x080380FF /* User modifiable flags */
+#else
 #define EXT3_FL_USER_VISIBLE           0x0003DFFF /* User visible flags */
 #define EXT3_FL_USER_MODIFIABLE                0x000380FF /* User modifiable flags */
+#endif
+#ifdef CONFIG_VSERVER_LEGACY
+#define EXT3_IOC_SETTAG                        FIOC_SETTAGJ
+#endif
 
 /*
  * Inode dynamic state flags
  */
 #define EXT3_STATE_JDATA               0x00000001 /* journaled data exists */
 #define EXT3_STATE_NEW                 0x00000002 /* inode is newly created */
+#define EXT3_STATE_XATTR               0x00000004 /* has in-inode xattrs */
+
+/* Used to pass group descriptor data when online resize is done */
+struct ext3_new_group_input {
+       __u32 group;            /* Group number for this data */
+       __u32 block_bitmap;     /* Absolute block number of block bitmap */
+       __u32 inode_bitmap;     /* Absolute block number of inode bitmap */
+       __u32 inode_table;      /* Absolute block number of inode table start */
+       __u32 blocks_count;     /* Total number of blocks in this group */
+       __u16 reserved_blocks;  /* Number of reserved blocks in this group */
+       __u16 unused;
+};
+
+/* The struct ext3_new_group_input in kernel space, with free_blocks_count */
+struct ext3_new_group_data {
+       __u32 group;
+       __u32 block_bitmap;
+       __u32 inode_bitmap;
+       __u32 inode_table;
+       __u32 blocks_count;
+       __u16 reserved_blocks;
+       __u16 unused;
+       __u32 free_blocks_count;
+};
+
 
 /*
  * ioctl commands
  */
-#define        EXT3_IOC_GETFLAGS               _IOR('f', 1, long)
-#define        EXT3_IOC_SETFLAGS               _IOW('f', 2, long)
+#define        EXT3_IOC_GETFLAGS               FS_IOC_GETFLAGS
+#define        EXT3_IOC_SETFLAGS               FS_IOC_SETFLAGS
 #define        EXT3_IOC_GETVERSION             _IOR('f', 3, long)
 #define        EXT3_IOC_SETVERSION             _IOW('f', 4, long)
-#define        EXT3_IOC_GETVERSION_OLD         _IOR('v', 1, long)
-#define        EXT3_IOC_SETVERSION_OLD         _IOW('v', 2, long)
+#define EXT3_IOC_GROUP_EXTEND          _IOW('f', 7, unsigned long)
+#define EXT3_IOC_GROUP_ADD             _IOW('f', 8,struct ext3_new_group_input)
+#define        EXT3_IOC_GETVERSION_OLD         FS_IOC_GETVERSION
+#define        EXT3_IOC_SETVERSION_OLD         FS_IOC_SETVERSION
 #ifdef CONFIG_JBD_DEBUG
 #define EXT3_IOC_WAIT_FOR_READONLY     _IOR('f', 99, long)
 #endif
-#ifdef CONFIG_VSERVER_LEGACY           
-#define EXT3_IOC_SETXID                        FIOC_SETXIDJ
+#define EXT3_IOC_GETRSVSZ              _IOR('f', 5, long)
+#define EXT3_IOC_SETRSVSZ              _IOW('f', 6, long)
+
+/*
+ * ioctl commands in 32 bit emulation
+ */
+#define EXT3_IOC32_GETFLAGS            FS_IOC32_GETFLAGS
+#define EXT3_IOC32_SETFLAGS            FS_IOC32_SETFLAGS
+#define EXT3_IOC32_GETVERSION          _IOR('f', 3, int)
+#define EXT3_IOC32_SETVERSION          _IOW('f', 4, int)
+#define EXT3_IOC32_GETRSVSZ            _IOR('f', 5, int)
+#define EXT3_IOC32_SETRSVSZ            _IOW('f', 6, int)
+#define EXT3_IOC32_GROUP_EXTEND                _IOW('f', 7, unsigned int)
+#ifdef CONFIG_JBD_DEBUG
+#define EXT3_IOC32_WAIT_FOR_READONLY   _IOR('f', 99, int)
 #endif
+#define EXT3_IOC32_GETVERSION_OLD      FS_IOC32_GETVERSION
+#define EXT3_IOC32_SETVERSION_OLD      FS_IOC32_SETVERSION
+
+
+/*
+ *  Mount options
+ */
+struct ext3_mount_options {
+       unsigned long s_mount_opt;
+       uid_t s_resuid;
+       gid_t s_resgid;
+       unsigned long s_commit_interval;
+#ifdef CONFIG_QUOTA
+       int s_jquota_fmt;
+       char *s_qf_names[MAXQUOTAS];
+#endif
+};
 
 /*
  * Structure of an inode on the disk
  */
 struct ext3_inode {
-       __u16   i_mode;         /* File mode */
-       __u16   i_uid;          /* Low 16 bits of Owner Uid */
-       __u32   i_size;         /* Size in bytes */
-       __u32   i_atime;        /* Access time */
-       __u32   i_ctime;        /* Creation time */
-       __u32   i_mtime;        /* Modification time */
-       __u32   i_dtime;        /* Deletion Time */
-       __u16   i_gid;          /* Low 16 bits of Group Id */
-       __u16   i_links_count;  /* Links count */
-       __u32   i_blocks;       /* Blocks count */
-       __u32   i_flags;        /* File flags */
+       __le16  i_mode;         /* File mode */
+       __le16  i_uid;          /* Low 16 bits of Owner Uid */
+       __le32  i_size;         /* Size in bytes */
+       __le32  i_atime;        /* Access time */
+       __le32  i_ctime;        /* Creation time */
+       __le32  i_mtime;        /* Modification time */
+       __le32  i_dtime;        /* Deletion Time */
+       __le16  i_gid;          /* Low 16 bits of Group Id */
+       __le16  i_links_count;  /* Links count */
+       __le32  i_blocks;       /* Blocks count */
+       __le32  i_flags;        /* File flags */
        union {
                struct {
                        __u32  l_i_reserved1;
@@ -240,18 +297,18 @@ struct ext3_inode {
                        __u32  m_i_reserved1;
                } masix1;
        } osd1;                         /* OS dependent 1 */
-       __u32   i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
-       __u32   i_generation;   /* File version (for NFS) */
-       __u32   i_file_acl;     /* File ACL */
-       __u32   i_dir_acl;      /* Directory ACL */
-       __u32   i_faddr;        /* Fragment address */
+       __le32  i_block[EXT3_N_BLOCKS];/* Pointers to blocks */
+       __le32  i_generation;   /* File version (for NFS) */
+       __le32  i_file_acl;     /* File ACL */
+       __le32  i_dir_acl;      /* Directory ACL */
+       __le32  i_faddr;        /* Fragment address */
        union {
                struct {
                        __u8    l_i_frag;       /* Fragment number */
                        __u8    l_i_fsize;      /* Fragment size */
-                       __u16   l_i_xid;        /* LRU Context */
-                       __u16   l_i_uid_high;   /* these 2 fields    */
-                       __u16   l_i_gid_high;   /* were reserved2[0] */
+                       __u16   l_i_tag;        /* Context Tag */
+                       __le16  l_i_uid_high;   /* these 2 fields    */
+                       __le16  l_i_gid_high;   /* were reserved2[0] */
                        __u32   l_i_reserved2;
                } linux2;
                struct {
@@ -269,6 +326,8 @@ struct ext3_inode {
                        __u32   m_i_reserved2[2];
                } masix2;
        } osd2;                         /* OS dependent 2 */
+       __le16  i_extra_isize;
+       __le16  i_pad1;
 };
 
 #define i_size_high    i_dir_acl
@@ -281,7 +340,7 @@ struct ext3_inode {
 #define i_gid_low      i_gid
 #define i_uid_high     osd2.linux2.l_i_uid_high
 #define i_gid_high     osd2.linux2.l_i_gid_high
-#define i_raw_xid      osd2.linux2.l_i_xid
+#define i_raw_tag      osd2.linux2.l_i_tag
 #define i_reserved2    osd2.linux2.l_i_reserved2
 
 #elif defined(__GNU__)
@@ -312,25 +371,31 @@ struct ext3_inode {
 /*
  * Mount flags
  */
-#define EXT3_MOUNT_CHECK               0x0001  /* Do mount-time checks */
-#define EXT3_MOUNT_OLDALLOC            0x0002  /* Don't use the new Orlov allocator */
-#define EXT3_MOUNT_GRPID               0x0004  /* Create files with directory's group */
-#define EXT3_MOUNT_DEBUG               0x0008  /* Some debugging messages */
-#define EXT3_MOUNT_ERRORS_CONT         0x0010  /* Continue on errors */
-#define EXT3_MOUNT_ERRORS_RO           0x0020  /* Remount fs ro on errors */
-#define EXT3_MOUNT_ERRORS_PANIC                0x0040  /* Panic on errors */
-#define EXT3_MOUNT_MINIX_DF            0x0080  /* Mimics the Minix statfs */
-#define EXT3_MOUNT_NOLOAD              0x0100  /* Don't use existing journal*/
-#define EXT3_MOUNT_ABORT               0x0200  /* Fatal error detected */
-#define EXT3_MOUNT_DATA_FLAGS          0x0C00  /* Mode for data writes: */
-  #define EXT3_MOUNT_JOURNAL_DATA      0x0400  /* Write data to journal */
-  #define EXT3_MOUNT_ORDERED_DATA      0x0800  /* Flush data before commit */
-  #define EXT3_MOUNT_WRITEBACK_DATA    0x0C00  /* No data ordering */
-#define EXT3_MOUNT_UPDATE_JOURNAL      0x1000  /* Update the journal format */
-#define EXT3_MOUNT_NO_UID32            0x2000  /* Disable 32-bit UIDs */
-#define EXT3_MOUNT_XATTR_USER          0x4000  /* Extended user attributes */
-#define EXT3_MOUNT_POSIX_ACL           0x8000  /* POSIX Access Control Lists */
-#define EXT3_MOUNT_TAG_XID             (1<<16) /* Enable Context Tags */
+#define EXT3_MOUNT_CHECK               0x00001 /* Do mount-time checks */
+#define EXT3_MOUNT_OLDALLOC            0x00002  /* Don't use the new Orlov allocator */
+#define EXT3_MOUNT_GRPID               0x00004 /* Create files with directory's group */
+#define EXT3_MOUNT_DEBUG               0x00008 /* Some debugging messages */
+#define EXT3_MOUNT_ERRORS_CONT         0x00010 /* Continue on errors */
+#define EXT3_MOUNT_ERRORS_RO           0x00020 /* Remount fs ro on errors */
+#define EXT3_MOUNT_ERRORS_PANIC                0x00040 /* Panic on errors */
+#define EXT3_MOUNT_MINIX_DF            0x00080 /* Mimics the Minix statfs */
+#define EXT3_MOUNT_NOLOAD              0x00100 /* Don't use existing journal*/
+#define EXT3_MOUNT_ABORT               0x00200 /* Fatal error detected */
+#define EXT3_MOUNT_DATA_FLAGS          0x00C00 /* Mode for data writes: */
+#define EXT3_MOUNT_JOURNAL_DATA                0x00400 /* Write data to journal */
+#define EXT3_MOUNT_ORDERED_DATA                0x00800 /* Flush data before commit */
+#define EXT3_MOUNT_WRITEBACK_DATA      0x00C00 /* No data ordering */
+#define EXT3_MOUNT_UPDATE_JOURNAL      0x01000 /* Update the journal format */
+#define EXT3_MOUNT_NO_UID32            0x02000  /* Disable 32-bit UIDs */
+#define EXT3_MOUNT_XATTR_USER          0x04000 /* Extended user attributes */
+#define EXT3_MOUNT_POSIX_ACL           0x08000 /* POSIX Access Control Lists */
+#define EXT3_MOUNT_RESERVATION         0x10000 /* Preallocation */
+#define EXT3_MOUNT_BARRIER             0x20000 /* Use block barriers */
+#define EXT3_MOUNT_NOBH                        0x40000 /* No bufferheads */
+#define EXT3_MOUNT_QUOTA               0x80000 /* Some quota option set */
+#define EXT3_MOUNT_USRQUOTA            0x100000 /* "old" user quota */
+#define EXT3_MOUNT_GRPQUOTA            0x200000 /* "old" group quota */
+#define EXT3_MOUNT_TAGGED              (1<<24) /* Enable Context Tags */
 
 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
 #ifndef _LINUX_EXT2_FS_H
@@ -370,31 +435,31 @@ struct ext3_inode {
  * Structure of the super block
  */
 struct ext3_super_block {
-/*00*/ __u32   s_inodes_count;         /* Inodes count */
-       __u32   s_blocks_count;         /* Blocks count */
-       __u32   s_r_blocks_count;       /* Reserved blocks count */
-       __u32   s_free_blocks_count;    /* Free blocks count */
-/*10*/ __u32   s_free_inodes_count;    /* Free inodes count */
-       __u32   s_first_data_block;     /* First Data Block */
-       __u32   s_log_block_size;       /* Block size */
-       __s32   s_log_frag_size;        /* Fragment size */
-/*20*/ __u32   s_blocks_per_group;     /* # Blocks per group */
-       __u32   s_frags_per_group;      /* # Fragments per group */
-       __u32   s_inodes_per_group;     /* # Inodes per group */
-       __u32   s_mtime;                /* Mount time */
-/*30*/ __u32   s_wtime;                /* Write time */
-       __u16   s_mnt_count;            /* Mount count */
-       __s16   s_max_mnt_count;        /* Maximal mount count */
-       __u16   s_magic;                /* Magic signature */
-       __u16   s_state;                /* File system state */
-       __u16   s_errors;               /* Behaviour when detecting errors */
-       __u16   s_minor_rev_level;      /* minor revision level */
-/*40*/ __u32   s_lastcheck;            /* time of last check */
-       __u32   s_checkinterval;        /* max. time between checks */
-       __u32   s_creator_os;           /* OS */
-       __u32   s_rev_level;            /* Revision level */
-/*50*/ __u16   s_def_resuid;           /* Default uid for reserved blocks */
-       __u16   s_def_resgid;           /* Default gid for reserved blocks */
+/*00*/ __le32  s_inodes_count;         /* Inodes count */
+       __le32  s_blocks_count;         /* Blocks count */
+       __le32  s_r_blocks_count;       /* Reserved blocks count */
+       __le32  s_free_blocks_count;    /* Free blocks count */
+/*10*/ __le32  s_free_inodes_count;    /* Free inodes count */
+       __le32  s_first_data_block;     /* First Data Block */
+       __le32  s_log_block_size;       /* Block size */
+       __le32  s_log_frag_size;        /* Fragment size */
+/*20*/ __le32  s_blocks_per_group;     /* # Blocks per group */
+       __le32  s_frags_per_group;      /* # Fragments per group */
+       __le32  s_inodes_per_group;     /* # Inodes per group */
+       __le32  s_mtime;                /* Mount time */
+/*30*/ __le32  s_wtime;                /* Write time */
+       __le16  s_mnt_count;            /* Mount count */
+       __le16  s_max_mnt_count;        /* Maximal mount count */
+       __le16  s_magic;                /* Magic signature */
+       __le16  s_state;                /* File system state */
+       __le16  s_errors;               /* Behaviour when detecting errors */
+       __le16  s_minor_rev_level;      /* minor revision level */
+/*40*/ __le32  s_lastcheck;            /* time of last check */
+       __le32  s_checkinterval;        /* max. time between checks */
+       __le32  s_creator_os;           /* OS */
+       __le32  s_rev_level;            /* Revision level */
+/*50*/ __le16  s_def_resuid;           /* Default uid for reserved blocks */
+       __le16  s_def_resgid;           /* Default gid for reserved blocks */
        /*
         * These fields are for EXT3_DYNAMIC_REV superblocks only.
         *
@@ -408,40 +473,42 @@ struct ext3_super_block {
         * feature set, it must abort and not try to meddle with
         * things it doesn't understand...
         */
-       __u32   s_first_ino;            /* First non-reserved inode */
-       __u16   s_inode_size;           /* size of inode structure */
-       __u16   s_block_group_nr;       /* block group # of this superblock */
-       __u32   s_feature_compat;       /* compatible feature set */
-/*60*/ __u32   s_feature_incompat;     /* incompatible feature set */
-       __u32   s_feature_ro_compat;    /* readonly-compatible feature set */
+       __le32  s_first_ino;            /* First non-reserved inode */
+       __le16   s_inode_size;          /* size of inode structure */
+       __le16  s_block_group_nr;       /* block group # of this superblock */
+       __le32  s_feature_compat;       /* compatible feature set */
+/*60*/ __le32  s_feature_incompat;     /* incompatible feature set */
+       __le32  s_feature_ro_compat;    /* readonly-compatible feature set */
 /*68*/ __u8    s_uuid[16];             /* 128-bit uuid for volume */
 /*78*/ char    s_volume_name[16];      /* volume name */
 /*88*/ char    s_last_mounted[64];     /* directory where last mounted */
-/*C8*/ __u32   s_algorithm_usage_bitmap; /* For compression */
+/*C8*/ __le32  s_algorithm_usage_bitmap; /* For compression */
        /*
         * Performance hints.  Directory preallocation should only
         * happen if the EXT3_FEATURE_COMPAT_DIR_PREALLOC flag is on.
         */
        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
-       __u16   s_padding1;
+       __le16  s_reserved_gdt_blocks;  /* Per group desc for online growth */
        /*
         * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
         */
 /*D0*/ __u8    s_journal_uuid[16];     /* uuid of journal superblock */
-/*E0*/ __u32   s_journal_inum;         /* inode number of journal file */
-       __u32   s_journal_dev;          /* device number of journal file */
-       __u32   s_last_orphan;          /* start of list of inodes to delete */
-       __u32   s_hash_seed[4];         /* HTREE hash seed */
+/*E0*/ __le32  s_journal_inum;         /* inode number of journal file */
+       __le32  s_journal_dev;          /* device number of journal file */
+       __le32  s_last_orphan;          /* start of list of inodes to delete */
+       __le32  s_hash_seed[4];         /* HTREE hash seed */
        __u8    s_def_hash_version;     /* Default hash version to use */
        __u8    s_reserved_char_pad;
        __u16   s_reserved_word_pad;
-       __u32   s_default_mount_opts;
-       __u32   s_first_meta_bg;        /* First metablock block group */
+       __le32  s_default_mount_opts;
+       __le32  s_first_meta_bg;        /* First metablock block group */
        __u32   s_reserved[190];        /* Padding to the end of the block */
 };
 
 #ifdef __KERNEL__
+#include <linux/ext3_fs_i.h>
+#include <linux/ext3_fs_sb.h>
 static inline struct ext3_sb_info * EXT3_SB(struct super_block *sb)
 {
        return sb->s_fs_info;
@@ -450,6 +517,15 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
 {
        return container_of(inode, struct ext3_inode_info, vfs_inode);
 }
+
+static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
+{
+       return ino == EXT3_ROOT_INO ||
+               ino == EXT3_JOURNAL_INO ||
+               ino == EXT3_RESIZE_INO ||
+               (ino >= EXT3_FIRST_INO(sb) &&
+                ino <= le32_to_cpu(EXT3_SB(sb)->s_es->s_inodes_count));
+}
 #else
 /* Assume that user mode programs are passing in an ext3fs superblock, not
  * a kernel struct super_block.  This will allow us to call the feature-test
@@ -552,9 +628,9 @@ static inline struct ext3_inode_info *EXT3_I(struct inode *inode)
 #define EXT3_NAME_LEN 255
 
 struct ext3_dir_entry {
-       __u32   inode;                  /* Inode number */
-       __u16   rec_len;                /* Directory entry length */
-       __u16   name_len;               /* Name length */
+       __le32  inode;                  /* Inode number */
+       __le16  rec_len;                /* Directory entry length */
+       __le16  name_len;               /* Name length */
        char    name[EXT3_NAME_LEN];    /* File name */
 };
 
@@ -565,8 +641,8 @@ struct ext3_dir_entry {
  * file_type field.
  */
 struct ext3_dir_entry_2 {
-       __u32   inode;                  /* Inode number */
-       __u16   rec_len;                /* Directory entry length */
+       __le32  inode;                  /* Inode number */
+       __le16  rec_len;                /* Directory entry length */
        __u8    name_len;               /* Name length */
        __u8    file_type;
        char    name[EXT3_NAME_LEN];    /* File name */
@@ -619,6 +695,8 @@ struct ext3_dir_entry_2 {
 #define DX_HASH_HALF_MD4       1
 #define DX_HASH_TEA            2
 
+#ifdef __KERNEL__
+
 /* hash info structure used by the directory hash */
 struct dx_hash_info
 {
@@ -630,7 +708,6 @@ struct dx_hash_info
 
 #define EXT3_HTREE_EOF 0x7fffffff
 
-#ifdef __KERNEL__
 /*
  * Control parameters used by ext3_htree_next_block
  */
@@ -667,6 +744,14 @@ struct dir_private_info {
        __u32           next_hash;
 };
 
+/* calculate the first block number of the group */
+static inline ext3_fsblk_t
+ext3_group_first_block_no(struct super_block *sb, unsigned long group_no)
+{
+       return group_no * (ext3_fsblk_t)EXT3_BLOCKS_PER_GROUP(sb) +
+               le32_to_cpu(EXT3_SB(sb)->s_es->s_first_data_block);
+}
+
 /*
  * Special error return code only used by dx_probe() and its callers.
  */
@@ -687,15 +772,23 @@ struct dir_private_info {
 /* balloc.c */
 extern int ext3_bg_has_super(struct super_block *sb, int group);
 extern unsigned long ext3_bg_num_gdb(struct super_block *sb, int group);
-extern int ext3_new_block (handle_t *, struct inode *, unsigned long,
-                                           __u32 *, __u32 *, int *);
-extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long,
-                             unsigned long);
-extern unsigned long ext3_count_free_blocks (struct super_block *);
+extern ext3_fsblk_t ext3_new_block (handle_t *handle, struct inode *inode,
+                       ext3_fsblk_t goal, int *errp);
+extern ext3_fsblk_t ext3_new_blocks (handle_t *handle, struct inode *inode,
+                       ext3_fsblk_t goal, unsigned long *count, int *errp);
+extern void ext3_free_blocks (handle_t *handle, struct inode *inode,
+                       ext3_fsblk_t block, unsigned long count);
+extern void ext3_free_blocks_sb (handle_t *handle, struct super_block *sb,
+                                ext3_fsblk_t block, unsigned long count,
+                               unsigned long *pdquot_freed_blocks);
+extern ext3_fsblk_t ext3_count_free_blocks (struct super_block *);
 extern void ext3_check_blocks_bitmap (struct super_block *);
 extern struct ext3_group_desc * ext3_get_group_desc(struct super_block * sb,
                                                    unsigned int block_group,
                                                    struct buffer_head ** bh);
+extern int ext3_should_retry_alloc(struct super_block *sb, int *retries);
+extern void ext3_init_block_alloc_info(struct inode *);
+extern void ext3_rsv_window_add(struct super_block *sb, struct ext3_reserve_window_node *rsv);
 
 /* dir.c */
 extern int ext3_check_dir_entry(const char *, struct inode *,
@@ -724,19 +817,24 @@ extern unsigned long ext3_count_free (struct buffer_head *, unsigned);
 
 
 /* inode.c */
-extern int ext3_forget(handle_t *, int, struct inode *, struct buffer_head *, int);
-extern struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
-extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
+int ext3_forget(handle_t *handle, int is_metadata, struct inode *inode,
+               struct buffer_head *bh, ext3_fsblk_t blocknr);
+struct buffer_head * ext3_getblk (handle_t *, struct inode *, long, int, int *);
+struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, int *);
+int ext3_get_blocks_handle(handle_t *handle, struct inode *inode,
+       sector_t iblock, unsigned long maxblocks, struct buffer_head *bh_result,
+       int create, int extend_disksize);
+extern int ext3_sync_flags(struct inode *inode);
 
 extern void ext3_read_inode (struct inode *);
-extern void ext3_write_inode (struct inode *, int);
+extern int  ext3_write_inode (struct inode *, int);
 extern int  ext3_setattr (struct dentry *, struct iattr *);
-extern void ext3_put_inode (struct inode *);
 extern void ext3_delete_inode (struct inode *);
 extern int  ext3_sync_inode (handle_t *, struct inode *);
-extern void ext3_discard_prealloc (struct inode *);
+extern void ext3_discard_reservation (struct inode *);
 extern void ext3_dirty_inode(struct inode *);
 extern int ext3_change_inode_journal_flag(struct inode *, int);
+extern int ext3_get_inode_loc(struct inode *, struct ext3_iloc *);
 extern void ext3_truncate (struct inode *);
 extern void ext3_set_inode_flags(struct inode *);
 extern void ext3_set_aops(struct inode *inode);
@@ -744,6 +842,7 @@ extern void ext3_set_aops(struct inode *inode);
 /* ioctl.c */
 extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
                       unsigned long);
+extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
 
 /* namei.c */
 extern int ext3_orphan_add(handle_t *, struct inode *);
@@ -751,42 +850,39 @@ extern int ext3_orphan_del(handle_t *, struct inode *);
 extern int ext3_htree_fill_tree(struct file *dir_file, __u32 start_hash,
                                __u32 start_minor_hash, __u32 *next_hash);
 
+/* resize.c */
+extern int ext3_group_add(struct super_block *sb,
+                               struct ext3_new_group_data *input);
+extern int ext3_group_extend(struct super_block *sb,
+                               struct ext3_super_block *es,
+                               ext3_fsblk_t n_blocks_count);
+
 /* super.c */
 extern void ext3_error (struct super_block *, const char *, const char *, ...)
        __attribute__ ((format (printf, 3, 4)));
 extern void __ext3_std_error (struct super_block *, const char *, int);
 extern void ext3_abort (struct super_block *, const char *, const char *, ...)
        __attribute__ ((format (printf, 3, 4)));
-extern NORET_TYPE void ext3_panic (struct super_block *, const char *,
-                                  const char *, ...)
-       __attribute__ ((NORET_AND format (printf, 3, 4)));
 extern void ext3_warning (struct super_block *, const char *, const char *, ...)
        __attribute__ ((format (printf, 3, 4)));
 extern void ext3_update_dynamic_rev (struct super_block *sb);
-extern void ext3_put_super (struct super_block *);
-extern void ext3_write_super (struct super_block *);
-extern void ext3_write_super_lockfs (struct super_block *);
-extern void ext3_unlockfs (struct super_block *);
-extern int ext3_remount (struct super_block *, int *, char *);
-extern int ext3_statfs (struct super_block *, struct kstatfs *);
 
 #define ext3_std_error(sb, errno)                              \
 do {                                                           \
        if ((errno))                                            \
                __ext3_std_error((sb), __FUNCTION__, (errno));  \
 } while (0)
-extern const char *ext3_decode_error(struct super_block *sb, int errno, char nbuf[16]);
 
 /*
  * Inodes and files operations
  */
 
 /* dir.c */
-extern struct file_operations ext3_dir_operations;
+extern const struct file_operations ext3_dir_operations;
 
 /* file.c */
 extern struct inode_operations ext3_file_inode_operations;
-extern struct file_operations ext3_file_operations;
+extern const struct file_operations ext3_file_operations;
 
 /* namei.c */
 extern struct inode_operations ext3_dir_inode_operations;