vserver 1.9.5.x5
[linux-2.6.git] / include / linux / ext3_fs.h
index ab9c037..fe4f0a1 100644 (file)
@@ -33,11 +33,11 @@ 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
+#define EXT3_MAX_RESERVE_BLOCKS         1024
+#define EXT3_RESERVE_WINDOW_NOT_ALLOCATED 0
 /*
  * Always enable hashed directories
  */
@@ -196,12 +196,40 @@ struct ext3_group_desc
 #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_SETXID                        FIOC_SETXIDJ
+#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
@@ -210,14 +238,15 @@ struct ext3_group_desc
 #define        EXT3_IOC_SETFLAGS               _IOW('f', 2, long)
 #define        EXT3_IOC_GETVERSION             _IOR('f', 3, long)
 #define        EXT3_IOC_SETVERSION             _IOW('f', 4, 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         _IOR('v', 1, long)
 #define        EXT3_IOC_SETVERSION_OLD         _IOW('v', 2, long)
 #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
-#endif
+#define EXT3_IOC_GETRSVSZ              _IOR('f', 5, long)
+#define EXT3_IOC_SETRSVSZ              _IOW('f', 6, long)
 
 /*
  * Structure of an inode on the disk
@@ -274,6 +303,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
@@ -317,26 +348,27 @@ 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_BARRIER             0x10000 /* Use block barriers */
-#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_TAG_XID             (1<<24) /* Enable Context Tags */
 
 /* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
 #ifndef _LINUX_EXT2_FS_H
@@ -430,7 +462,7 @@ struct ext3_super_block {
         */
        __u8    s_prealloc_blocks;      /* Nr of blocks to try to preallocate*/
        __u8    s_prealloc_dir_blocks;  /* Nr to preallocate for dirs */
-       __u16   s_padding1;
+       __u16   s_reserved_gdt_blocks;  /* Per group desc for online growth */
        /*
         * Journaling support valid if EXT3_FEATURE_COMPAT_HAS_JOURNAL set.
         */
@@ -693,16 +725,18 @@ 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 int ext3_new_block (handle_t *, struct inode *, unsigned long, int *);
 extern void ext3_free_blocks (handle_t *, struct inode *, unsigned long,
                              unsigned long);
+extern void ext3_free_blocks_sb (handle_t *, struct super_block *,
+                                unsigned long, unsigned long, int *);
 extern unsigned long 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_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 *,
@@ -738,12 +772,12 @@ extern struct buffer_head * ext3_bread (handle_t *, struct inode *, int, int, in
 extern void ext3_read_inode (struct inode *);
 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);
@@ -758,31 +792,28 @@ 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,
+                               unsigned long 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