-Index: linux-2.4.21-suse2/fs/ext3/extents-in-ea.c
+Index: linux-2.6.7/fs/ext3/extents-in-ea.c
===================================================================
---- linux-2.4.21-suse2.orig/fs/ext3/extents-in-ea.c 2003-01-30 13:24:37.000000000 +0300
-+++ linux-2.4.21-suse2/fs/ext3/extents-in-ea.c 2004-08-19 16:45:44.000000000 +0400
+--- linux-2.6.7.orig/fs/ext3/extents-in-ea.c 2003-01-30 18:24:37.000000000 +0800
++++ linux-2.6.7/fs/ext3/extents-in-ea.c 2004-08-12 14:31:13.000000000 +0800
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2003, Cluster File Systems, Inc, info@clusterfs.com
+ handle = ext3_journal_start(inode, EXT3_ALLOC_NEEDED + 3);
+ if (IS_ERR(handle))
+ return PTR_ERR(handle);
-+ if ((err = ext3_xattr_set(handle, inode, name_index,
-+ eaname, root, size, 0)))
++ if ((err = ext3_xattr_set(inode, name_index,
++ eaname, root, size, 0)))
+ goto out;
+ if ((err = ext3_init_tree_in_ea_desc(&tree, inode, name_index, eaname)))
+ goto out;
+
+ tgen = EXT_GENERATION(tree);
+ needed = ext3_ext_calc_credits_for_insert(tree, path);
-+ up_write(&EXT3_I(inode)->truncate_sem);
++ up(&EXT3_I(inode)->truncate_sem);
+ handle = ext3_journal_start(tree->inode, needed + 10);
+ if (IS_ERR(handle)) {
+ down_write(&EXT3_I(inode)->truncate_sem);
+ return err;
+}
+
-Index: linux-2.4.21-suse2/fs/ext3/Makefile
+Index: linux-2.6.7/fs/ext3/Makefile
===================================================================
---- linux-2.4.21-suse2.orig/fs/ext3/Makefile 2004-08-19 13:51:49.000000000 +0400
-+++ linux-2.4.21-suse2/fs/ext3/Makefile 2004-08-19 16:45:44.000000000 +0400
-@@ -19,7 +19,7 @@
- obj-m := $(O_TARGET)
+--- linux-2.6.7.orig/fs/ext3/Makefile 2004-08-12 13:42:21.000000000 +0800
++++ linux-2.6.7/fs/ext3/Makefile 2004-08-12 13:42:23.000000000 +0800
+@@ -7,6 +7,6 @@
+ ext3-y := balloc.o bitmap.o dir.o file.o fsync.o ialloc.o inode.o \
+ ioctl.o namei.o super.o symlink.o hash.o extents.o
- export-objs += xattr.o
--obj-$(CONFIG_EXT3_FS_XATTR) += xattr.o
-+obj-$(CONFIG_EXT3_FS_XATTR) += xattr.o extents-in-ea.o
- obj-$(CONFIG_EXT3_FS_XATTR_USER) += xattr_user.o
- obj-$(CONFIG_EXT3_FS_XATTR_TRUSTED) += xattr_trusted.o
- obj-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
-Index: linux-2.4.21-suse2/fs/ext3/xattr.c
+-ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o
++ext3-$(CONFIG_EXT3_FS_XATTR) += xattr.o xattr_user.o xattr_trusted.o extents-in-ea.o
+ ext3-$(CONFIG_EXT3_FS_POSIX_ACL) += acl.o
+ ext3-$(CONFIG_EXT3_FS_SECURITY) += xattr_security.o
+Index: linux-2.6.7/fs/ext3/xattr.c
===================================================================
---- linux-2.4.21-suse2.orig/fs/ext3/xattr.c 2004-08-19 13:51:48.000000000 +0400
-+++ linux-2.4.21-suse2/fs/ext3/xattr.c 2004-08-19 17:12:21.000000000 +0400
-@@ -715,7 +715,8 @@
- return -ERANGE;
-
- /* try to find attribute in inode body */
-- err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
-+ err = ext3_xattr_ibody_find(inode, name_index, name,
-+ &entry, &free1, NULL, NULL);
- if (err == 0) {
- /* found EA in inode */
- found = 1;
-@@ -724,7 +725,7 @@
- /* there is no such attribute in inode body */
- /* try to find attribute in dedicated block */
- err = ext3_xattr_block_find(inode, name_index, name,
-- &entry, &free2);
-+ &entry, &free2, NULL, NULL);
- if (err != 0 && err != -ENOENT) {
- /* not found EA in block */
- goto finish;
-@@ -780,6 +781,38 @@
- return err;
- }
-
-+int ext3_xattr_get_ea_loc(struct inode *inode, int name_index,
-+ const char *name, struct buffer_head **bh,
-+ int *offset, int *size)
-+ {
-+ int free1 = -1, free2 = -1, err, name_len;
-+ struct ext3_xattr_entry entry;
-+
-+ ea_idebug(inode, "name=%d.%s", name_index, name);
-+
-+ if (name == NULL)
-+ return -EINVAL;
-+ name_len = strlen(name);
-+ if (name_len > 255)
-+ return -ERANGE;
-+
-+ down_write(&EXT3_I(inode)->xattr_sem);
-+
-+ /* try to find attribute in inode body */
-+ err = ext3_xattr_ibody_find(inode, name_index, name,
-+ &entry, &free1, bh, offset);
-+ if (err == -ENOENT) {
-+ /* there is no such attribute in inode body */
-+ /* try to find attribute in dedicated block */
-+ err = ext3_xattr_block_find(inode, name_index, name,
-+ &entry, &free2, bh, offset);
-+ }
-+ if (err == 0 && size)
-+ *size = le32_to_cpu(entry.e_value_size);
-+ up_write(&EXT3_I(inode)->xattr_sem);
-+ return err;
-+ }
-+
- /*
- * ext3_xattr_block_set()
- *
-@@ -1183,7 +1216,8 @@
+--- linux-2.6.7.orig/fs/ext3/xattr.c 2004-08-12 13:04:19.000000000 +0800
++++ linux-2.6.7/fs/ext3/xattr.c 2004-08-12 13:43:10.000000000 +0800
+@@ -680,7 +680,8 @@
*/
int
ext3_xattr_ibody_find(struct inode *inode, int name_index,
{
struct ext3_xattr_entry *last;
struct ext3_inode *raw_inode;
-@@ -1230,6 +1264,15 @@
+@@ -727,6 +728,15 @@
name_len == last->e_name_len &&
!memcmp(name, last->e_name, name_len)) {
memcpy(rentry, last, sizeof(struct ext3_xattr_entry));
ret = 0;
} else {
*free -= EXT3_XATTR_LEN(last->e_name_len);
-@@ -1250,7 +1293,8 @@
+@@ -747,7 +757,8 @@
*/
int
ext3_xattr_block_find(struct inode *inode, int name_index, const char *name,
{
struct buffer_head *bh = NULL;
struct ext3_xattr_entry *entry;
-@@ -1293,6 +1337,12 @@
+@@ -790,6 +801,12 @@
memcmp(name, entry->e_name, name_len) == 0) {
memcpy(rentry, entry, sizeof(struct ext3_xattr_entry));
error = 0;
} else {
*free -= EXT3_XATTR_LEN(entry->e_name_len);
*free -= le32_to_cpu(entry->e_value_size);
-Index: linux-2.4.21-suse2/include/linux/ext3_xattr.h
+@@ -984,7 +1001,8 @@
+ down_write(&EXT3_I(inode)->xattr_sem);
+
+ /* try to find attribute in inode body */
+- err = ext3_xattr_ibody_find(inode, name_index, name, &entry, &free1);
++ err = ext3_xattr_ibody_find(inode, name_index, name,
++ &entry, &free1, NULL, NULL);
+ if (err == 0) {
+ /* found EA in inode */
+ found = 1;
+@@ -993,7 +1011,7 @@
+ /* there is no such attribute in inode body */
+ /* try to find attribute in dedicated block */
+ err = ext3_xattr_block_find(inode, name_index, name,
+- &entry, &free2);
++ &entry, &free2, NULL, NULL);
+ if (err != 0 && err != -ENOENT) {
+ /* not found EA in block */
+ goto finish;
+@@ -1050,6 +1068,35 @@
+ return err;
+ }
+
++int ext3_xattr_get_ea_loc(struct inode *inode, int name_index,
++ const char *name, struct buffer_head **bh,
++ int *offset, int *size)
++{
++ int free1 = -1, free2 = -1, err, name_len;
++ struct ext3_xattr_entry entry;
++
++ ea_idebug(inode, "name=%d.%s", name_index, name);
++
++ if (name == NULL)
++ return -EINVAL;
++ name_len = strlen(name);
++ if (name_len > 255)
++ return -ERANGE;
++
++ /* try to find attribute in inode body */
++ err = ext3_xattr_ibody_find(inode, name_index, name,
++ &entry, &free1, bh, offset);
++ if (err == -ENOENT) {
++ /* there is no such attribute in inode body */
++ /* try to find attribute in dedicated block */
++ err = ext3_xattr_block_find(inode, name_index, name,
++ &entry, &free2, bh, offset);
++ }
++ if (err == 0 && size)
++ *size = le32_to_cpu(entry.e_value_size);
++ return err;
++}
++
+ /*
+ * ext3_xattr_block_set()
+ *
+Index: linux-2.6.7/fs/ext3/xattr.h
===================================================================
---- linux-2.4.21-suse2.orig/include/linux/ext3_xattr.h 2004-08-19 13:50:00.000000000 +0400
-+++ linux-2.4.21-suse2/include/linux/ext3_xattr.h 2004-08-19 16:45:44.000000000 +0400
-@@ -84,6 +84,7 @@
- size_t, int);
- extern int ext3_xattr_set(handle_t *, struct inode *, int, const char *,
- const void *, size_t, int);
-+extern int ext3_xattr_get_ea_loc(struct inode *, int, const char *, struct buffer_head **, int *, int *);
+--- linux-2.6.7.orig/fs/ext3/xattr.h 2004-08-12 13:04:19.000000000 +0800
++++ linux-2.6.7/fs/ext3/xattr.h 2004-08-12 13:42:23.000000000 +0800
+@@ -80,6 +80,7 @@
+ extern int ext3_xattr_set_handle(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
+ extern int ext3_xattr_block_set(handle_t *, struct inode *, int, const char *,const void *,size_t,int);
++extern int ext3_xattr_get_ea_loc(struct inode *, int, const char *, struct buffer_head **, int *, int *);
extern void ext3_xattr_delete_inode(handle_t *, struct inode *);
extern void ext3_xattr_put_super(struct super_block *);
+