%patch
-Index: linux-2.6.5-sles9/fs/ext3/extents.c
+Index: linux-2.6.5-7.311/fs/ext3/extents.c
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/extents.c 2005-02-17 22:07:57.023609040 +0300
-+++ linux-2.6.5-sles9/fs/ext3/extents.c 2005-02-23 01:02:37.396435640 +0300
-@@ -0,0 +1,2361 @@
+--- /dev/null
++++ linux-2.6.5-7.311/fs/ext3/extents.c
+@@ -0,0 +1,2266 @@
+/*
+ * Copyright(c) 2003, 2004, 2005, Cluster File Systems, Inc, info@clusterfs.com
+ * Written by Alex Tomas <alex@clusterfs.com>
+ return ext3_ext_calc_metadata_amount(&tree, blocks);
+}
+
-+static int
-+ext3_ext_store_extent_cb(struct ext3_extents_tree *tree,
-+ struct ext3_ext_path *path,
-+ struct ext3_ext_cache *newex)
-+{
-+ struct ext3_extent_buf *buf = (struct ext3_extent_buf *) tree->private;
-+
-+ if (newex->ec_type != EXT3_EXT_CACHE_EXTENT)
-+ return EXT_CONTINUE;
-+
-+ if (buf->err < 0)
-+ return EXT_BREAK;
-+ if (buf->cur - buf->buffer + sizeof(*newex) > buf->buflen)
-+ return EXT_BREAK;
-+
-+ if (!copy_to_user(buf->cur, newex, sizeof(*newex))) {
-+ buf->err++;
-+ buf->cur += sizeof(*newex);
-+ } else {
-+ buf->err = -EFAULT;
-+ return EXT_BREAK;
-+ }
-+ return EXT_CONTINUE;
-+}
-+
-+static int
-+ext3_ext_collect_stats_cb(struct ext3_extents_tree *tree,
-+ struct ext3_ext_path *path,
-+ struct ext3_ext_cache *ex)
-+{
-+ struct ext3_extent_tree_stats *buf =
-+ (struct ext3_extent_tree_stats *) tree->private;
-+ int depth;
-+
-+ if (ex->ec_type != EXT3_EXT_CACHE_EXTENT)
-+ return EXT_CONTINUE;
-+
-+ depth = EXT_DEPTH(tree);
-+ buf->extents_num++;
-+ if (path[depth].p_ext == EXT_FIRST_EXTENT(path[depth].p_hdr))
-+ buf->leaf_num++;
-+ return EXT_CONTINUE;
-+}
-+
-+int ext3_ext_ioctl(struct inode *inode, struct file *filp, unsigned int cmd,
-+ unsigned long arg)
-+{
-+ int err = 0;
-+
-+ if (!(EXT3_I(inode)->i_flags & EXT3_EXTENTS_FL))
-+ return -EINVAL;
-+
-+ if (cmd == EXT3_IOC_GET_EXTENTS) {
-+ struct ext3_extent_buf buf;
-+ struct ext3_extents_tree tree;
-+
-+ if (copy_from_user(&buf, (void *) arg, sizeof(buf)))
-+ return -EFAULT;
-+
-+ ext3_init_tree_desc(&tree, inode);
-+ buf.cur = buf.buffer;
-+ buf.err = 0;
-+ tree.private = &buf;
-+ down(&EXT3_I(inode)->truncate_sem);
-+ err = ext3_ext_walk_space(&tree, buf.start, EXT_MAX_BLOCK,
-+ ext3_ext_store_extent_cb);
-+ up(&EXT3_I(inode)->truncate_sem);
-+ if (err == 0)
-+ err = buf.err;
-+ } else if (cmd == EXT3_IOC_GET_TREE_STATS) {
-+ struct ext3_extent_tree_stats buf;
-+ struct ext3_extents_tree tree;
-+
-+ ext3_init_tree_desc(&tree, inode);
-+ down(&EXT3_I(inode)->truncate_sem);
-+ buf.depth = EXT_DEPTH(&tree);
-+ buf.extents_num = 0;
-+ buf.leaf_num = 0;
-+ tree.private = &buf;
-+ err = ext3_ext_walk_space(&tree, 0, EXT_MAX_BLOCK,
-+ ext3_ext_collect_stats_cb);
-+ up(&EXT3_I(inode)->truncate_sem);
-+ if (!err)
-+ err = copy_to_user((void *) arg, &buf, sizeof(buf));
-+ } else if (cmd == EXT3_IOC_GET_TREE_DEPTH) {
-+ struct ext3_extents_tree tree;
-+ ext3_init_tree_desc(&tree, inode);
-+ down(&EXT3_I(inode)->truncate_sem);
-+ err = EXT_DEPTH(&tree);
-+ up(&EXT3_I(inode)->truncate_sem);
-+ }
-+
-+ return err;
-+}
-+
+EXPORT_SYMBOL(ext3_init_tree_desc);
+EXPORT_SYMBOL(ext3_mark_inode_dirty);
+EXPORT_SYMBOL(ext3_ext_invalidate_cache);
+EXPORT_SYMBOL(ext3_ext_walk_space);
+EXPORT_SYMBOL(ext3_ext_find_goal);
+EXPORT_SYMBOL(ext3_ext_calc_credits_for_insert);
-Index: linux-2.6.5-sles9/fs/ext3/ialloc.c
+Index: linux-2.6.5-7.311/fs/ext3/ialloc.c
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/ialloc.c 2005-02-23 01:01:52.366281264 +0300
-+++ linux-2.6.5-sles9/fs/ext3/ialloc.c 2005-02-23 01:02:37.398435336 +0300
-@@ -566,7 +566,7 @@ repeat:
+--- linux-2.6.5-7.311.orig/fs/ext3/ialloc.c
++++ linux-2.6.5-7.311/fs/ext3/ialloc.c
+@@ -603,7 +603,7 @@ got:
ei->i_dir_start_lookup = 0;
ei->i_disksize = 0;
if (S_ISLNK(mode))
ei->i_flags &= ~(EXT3_IMMUTABLE_FL|EXT3_APPEND_FL);
/* dirsync only applies to directories */
-@@ -647,6 +647,18 @@
+@@ -648,6 +648,18 @@ got:
DQUOT_FREE_INODE(inode);
goto fail2;
}
err = ext3_mark_inode_dirty(handle, inode);
if (err) {
ext3_std_error(sb, err);
-Index: linux-2.6.5-sles9/fs/ext3/inode.c
+Index: linux-2.6.5-7.311/fs/ext3/inode.c
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/inode.c 2005-02-23 01:01:52.373280200 +0300
-+++ linux-2.6.5-sles9/fs/ext3/inode.c 2005-02-23 01:02:37.404434424 +0300
-@@ -796,6 +796,17 @@
+--- linux-2.6.5-7.311.orig/fs/ext3/inode.c
++++ linux-2.6.5-7.311/fs/ext3/inode.c
+@@ -798,6 +798,17 @@ changed:
goto reread;
}
static int ext3_get_block(struct inode *inode, sector_t iblock,
struct buffer_head *bh_result, int create)
{
-@@ -806,8 +817,8 @@
+@@ -808,8 +819,8 @@ static int ext3_get_block(struct inode *
handle = ext3_journal_current_handle();
J_ASSERT(handle != 0);
}
return ret;
}
-@@ -833,8 +844,8 @@
+@@ -836,8 +847,8 @@ ext3_direct_io_get_blocks(struct inode *
}
}
if (ret == 0)
if (ret == 0)
bh_result->b_size = (1 << inode->i_blkbits);
return ret;
-@@ -855,7 +866,7 @@
+@@ -858,7 +869,7 @@ struct buffer_head *ext3_getblk(handle_t
dummy.b_state = 0;
dummy.b_blocknr = -1000;
buffer_trace_init(&dummy.b_history);
if (!*errp && buffer_mapped(&dummy)) {
struct buffer_head *bh;
bh = sb_getblk(inode->i_sb, dummy.b_blocknr);
-@@ -1587,7 +1598,7 @@
+@@ -1604,7 +1615,7 @@ void ext3_set_aops(struct inode *inode)
* This required during truncate. We need to physically zero the tail end
* of that block so it doesn't yield old data if the file is later grown.
*/
struct address_space *mapping, loff_t from)
{
unsigned long index = from >> PAGE_CACHE_SHIFT;
-@@ -2083,6 +2094,9 @@
+@@ -2100,6 +2111,9 @@ void ext3_truncate(struct inode * inode)
return;
}
handle = start_transaction(inode);
if (IS_ERR(handle)) {
if (page) {
-@@ -2789,6 +2803,9 @@
+@@ -2806,6 +2820,9 @@ int ext3_writepage_trans_blocks(struct i
int indirects = (EXT3_NDIR_BLOCKS % bpp) ? 5 : 3;
int ret;
if (ext3_should_journal_data(inode))
ret = 3 * (bpp + indirects) + 2;
else
-Index: linux-2.6.5-sles9/fs/ext3/Makefile
+Index: linux-2.6.5-7.311/fs/ext3/Makefile
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/Makefile 2005-02-23 01:01:46.501172896 +0300
-+++ linux-2.6.5-sles9/fs/ext3/Makefile 2005-02-23 01:02:37.405434272 +0300
+--- linux-2.6.5-7.311.orig/fs/ext3/Makefile
++++ linux-2.6.5-7.311/fs/ext3/Makefile
@@ -5,7 +5,8 @@
obj-$(CONFIG_EXT3_FS) += ext3.o
ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
-Index: linux-2.6.5-sles9/fs/ext3/super.c
+Index: linux-2.6.5-7.311/fs/ext3/super.c
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/super.c 2005-02-23 01:02:34.072940888 +0300
-+++ linux-2.6.5-sles9/fs/ext3/super.c 2005-02-23 01:47:15.291333736 +0300
-@@ -389,6 +389,7 @@
+--- linux-2.6.5-7.311.orig/fs/ext3/super.c
++++ linux-2.6.5-7.311/fs/ext3/super.c
+@@ -390,6 +390,7 @@ void ext3_put_super (struct super_block
struct ext3_super_block *es = sbi->s_es;
int i;
ext3_xattr_put_super(sb);
journal_destroy(sbi->s_journal);
if (!(sb->s_flags & MS_RDONLY)) {
-@@ -447,6 +448,8 @@
+@@ -451,6 +452,8 @@ static struct inode *ext3_alloc_inode(st
#endif
ei->i_rsv_window.rsv_end = EXT3_RESERVE_WINDOW_NOT_ALLOCATED;
ei->vfs_inode.i_version = 1;
return &ei->vfs_inode;
}
-@@ -537,6 +540,7 @@
+@@ -615,6 +618,7 @@ enum {
Opt_ignore, Opt_barrier,
Opt_err,
Opt_iopen, Opt_noiopen, Opt_iopen_nopriv,
};
static match_table_t tokens = {
-@@ -582,6 +585,9 @@
+@@ -658,6 +662,9 @@ static match_table_t tokens = {
{Opt_iopen, "iopen"},
{Opt_noiopen, "noiopen"},
{Opt_iopen_nopriv, "iopen_nopriv"},
{Opt_barrier, "barrier=%u"},
{Opt_err, NULL}
};
-@@ -797,6 +802,15 @@
+@@ -874,6 +881,15 @@ static int parse_options (char * options
break;
case Opt_ignore:
break;
default:
printk (KERN_ERR
"EXT3-fs: Unrecognized mount option \"%s\" "
-@@ -1449,6 +1460,8 @@
+@@ -1528,6 +1544,8 @@ static int ext3_fill_super (struct super
percpu_counter_mod(&sbi->s_dirs_counter,
ext3_count_dirs(sb));
return 0;
failed_mount3:
-Index: linux-2.6.5-sles9/fs/ext3/ioctl.c
+Index: linux-2.6.5-7.311/include/linux/ext3_fs.h
===================================================================
---- linux-2.6.5-sles9.orig/fs/ext3/ioctl.c 2005-02-23 01:01:42.887722224 +0300
-+++ linux-2.6.5-sles9/fs/ext3/ioctl.c 2005-02-23 01:02:37.412433208 +0300
-@@ -124,6 +124,10 @@
- err = ext3_change_inode_journal_flag(inode, jflag);
- return err;
- }
-+ case EXT3_IOC_GET_EXTENTS:
-+ case EXT3_IOC_GET_TREE_STATS:
-+ case EXT3_IOC_GET_TREE_DEPTH:
-+ return ext3_ext_ioctl(inode, filp, cmd, arg);
- case EXT3_IOC_GETVERSION:
- case EXT3_IOC_GETVERSION_OLD:
- return put_user(inode->i_generation, (int *) arg);
-Index: linux-2.6.5-sles9/include/linux/ext3_fs.h
-===================================================================
---- linux-2.6.5-sles9.orig/include/linux/ext3_fs.h 2005-02-23 01:02:35.823674736 +0300
-+++ linux-2.6.5-sles9/include/linux/ext3_fs.h 2005-02-23 01:02:37.414432904 +0300
-@@ -186,8 +186,9 @@
- #define EXT3_NOTAIL_FL 0x00008000 /* don't merge file tail */
+--- linux-2.6.5-7.311.orig/include/linux/ext3_fs.h
++++ linux-2.6.5-7.311/include/linux/ext3_fs.h
+@@ -185,9 +185,10 @@ struct ext3_group_desc
+ #define EXT3_NOTAIL_FL 0x00008000 /* file tail should not be merged */
#define EXT3_DIRSYNC_FL 0x00010000 /* dirsync behaviour (directories only) */
#define EXT3_TOPDIR_FL 0x00020000 /* Top of directory hierarchies*/
+#define EXT3_EXTENTS_FL 0x00080000 /* Inode uses extents */
+#define EXT3_FL_USER_VISIBLE 0x000BDFFF /* User visible flags */
#define EXT3_FL_USER_MODIFIABLE 0x000380FF /* User modifiable flags */
-@@ -211,6 +212,9 @@
- #endif
- #define EXT3_IOC_GETRSVSZ _IOR('f', 5, long)
- #define EXT3_IOC_SETRSVSZ _IOW('f', 6, long)
-+#define EXT3_IOC_GET_EXTENTS _IOR('f', 7, long)
-+#define EXT3_IOC_GET_TREE_DEPTH _IOR('f', 8, long)
-+#define EXT3_IOC_GET_TREE_STATS _IOR('f', 9, long)
-
/*
- * Structure of an inode on the disk
-@@ -333,6 +337,8 @@
+@@ -333,6 +334,8 @@ struct ext3_inode {
#define EXT3_MOUNT_BARRIER 0x20000 /* Use block barriers */
#define EXT3_MOUNT_IOPEN 0x80000 /* Allow access via iopen */
#define EXT3_MOUNT_IOPEN_NOPRIV 0x100000/* Make iopen world-readable */
/* Compatibility, for having both ext2_fs.h and ext3_fs.h included at once */
#ifndef clear_opt
-@@ -503,11 +509,13 @@
+@@ -521,11 +524,13 @@ static inline struct ext3_inode_info *EX
#define EXT3_FEATURE_INCOMPAT_RECOVER 0x0004 /* Needs recovery */
#define EXT3_FEATURE_INCOMPAT_JOURNAL_DEV 0x0008 /* Journal device */
#define EXT3_FEATURE_INCOMPAT_META_BG 0x0010
#define EXT3_FEATURE_RO_COMPAT_SUPP (EXT3_FEATURE_RO_COMPAT_SPARSE_SUPER| \
EXT3_FEATURE_RO_COMPAT_LARGE_FILE| \
EXT3_FEATURE_RO_COMPAT_BTREE_DIR)
-@@ -729,6 +735,9 @@
+@@ -729,6 +734,9 @@ extern unsigned long ext3_count_free (st
/* 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 *);
-@@ -802,6 +809,16 @@
+@@ -802,6 +810,14 @@ extern struct inode_operations ext3_spec
extern struct inode_operations ext3_symlink_inode_operations;
extern struct inode_operations ext3_fast_symlink_inode_operations;
+extern void ext3_ext_init(struct super_block *);
+extern void ext3_ext_release(struct super_block *);
+extern void ext3_extents_initialize_blockmap(handle_t *, struct inode *);
-+extern int ext3_ext_ioctl(struct inode *inode, struct file *filp,
-+ unsigned int cmd, unsigned long arg);
#endif /* __KERNEL__ */
-Index: linux-2.6.5-sles9/include/linux/ext3_extents.h
+Index: linux-2.6.5-7.311/include/linux/ext3_extents.h
===================================================================
---- linux-2.6.5-sles9.orig/include/linux/ext3_extents.h 2005-02-17 22:07:57.023609040 +0300
-+++ linux-2.6.5-sles9/include/linux/ext3_extents.h 2005-02-23 01:02:37.416432600 +0300
+--- /dev/null
++++ linux-2.6.5-7.311/include/linux/ext3_extents.h
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2003, Cluster File Systems, Inc, info@clusterfs.com
+
+
+#endif /* _LINUX_EXT3_EXTENTS */
-Index: linux-2.6.5-sles9/include/linux/ext3_fs_i.h
+Index: linux-2.6.5-7.311/include/linux/ext3_fs_i.h
===================================================================
---- linux-2.6.5-sles9.orig/include/linux/ext3_fs_i.h 2005-02-23 01:01:52.425272296 +0300
-+++ linux-2.6.5-sles9/include/linux/ext3_fs_i.h 2005-02-23 01:45:55.611446920 +0300
+--- linux-2.6.5-7.311.orig/include/linux/ext3_fs_i.h
++++ linux-2.6.5-7.311/include/linux/ext3_fs_i.h
@@ -19,6 +19,7 @@
#include <linux/rwsem.h>
#include <linux/rbtree.h>
struct reserve_window {
__u32 _rsv_start; /* First byte reserved */
-@@ -128,6 +129,8 @@
+@@ -128,6 +129,8 @@ struct ext3_inode_info {
*/
struct semaphore truncate_sem;
struct inode vfs_inode;
};
#endif /* _LINUX_EXT3_FS_I */
-
-%diffstat
- fs/ext3/Makefile | 2
- fs/ext3/extents.c | 2356 +++++++++++++++++++++++++++++++++++++++++++
- fs/ext3/ialloc.c | 4
- fs/ext3/inode.c | 29
- fs/ext3/ioctl.c | 4
- fs/ext3/super.c | 15
- include/linux/ext3_extents.h | 265 ++++
- include/linux/ext3_fs.h | 17
- include/linux/ext3_fs_i.h | 3
- 9 files changed, 2687 insertions(+), 8 deletions(-)
-