i=adilger
i=girish
update fiemap structures and API to match upstream
A large part of this code is from the generic VFS code in fs/ioctl.c in the
upstream kernel.
A large part of this code is from the generic VFS code in fs/ioctl.c in the
upstream kernel.
-Index: linux-2.6.18-53.1.14/fs/ext3/ioctl.c
+Index: linux-2.6.18-92.1.22/fs/ext3/ioctl.c
===================================================================
===================================================================
---- linux-2.6.18-53.1.14.orig/fs/ext3/ioctl.c
-+++ linux-2.6.18-53.1.14/fs/ext3/ioctl.c
-@@ -15,7 +15,159 @@
+--- linux-2.6.18-92.1.22.orig/fs/ext3/ioctl.c
++++ linux-2.6.18-92.1.22/fs/ext3/ioctl.c
+@@ -15,7 +15,161 @@
#include <linux/time.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
#include <linux/time.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
-+ * @len: Extent length, in bytes
++ * @len: Extent length, in bytes
+ * @flags: FIEMAP_EXTENT flags that describe this extent
+ * @flags: FIEMAP_EXTENT flags that describe this extent
-+ * @lun: LUN on which this extent resides
++ * @lun: LUN on which this extent resides
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
-+#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_COMPRESSED \
-+ |FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
-+ fieinfo->fi_extents_mapped++;
-+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
++ fieinfo->fi_extents_mapped++;
++ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+
+ if (flags & SET_UNKNOWN_FLAGS)
+
+ if (flags & SET_UNKNOWN_FLAGS)
-+ flags |= FIEMAP_EXTENT_UNKNOWN;
++ flags |= FIEMAP_EXTENT_UNKNOWN;
+ if (flags & SET_NO_DIRECT_FLAGS)
+ if (flags & SET_NO_DIRECT_FLAGS)
-+ flags |= FIEMAP_EXTENT_NO_DIRECT;
++ flags |= FIEMAP_EXTENT_NO_DIRECT;
+ if (flags & SET_NOT_ALIGNED_FLAGS)
+ if (flags & SET_NOT_ALIGNED_FLAGS)
-+ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
++ flags |= FIEMAP_EXTENT_ENCODED;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
-+ sizeof(struct fiemap)))
++ sizeof(struct fiemap)))
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
-@@ -272,7 +424,9 @@ flags_err:
+@@ -272,7 +426,9 @@ flags_err:
-Index: linux-2.6.18-53.1.14/include/linux/ext3_fs.h
+Index: linux-2.6.18-92.1.22/include/linux/ext3_fs.h
===================================================================
===================================================================
---- linux-2.6.18-53.1.14.orig/include/linux/ext3_fs.h
-+++ linux-2.6.18-53.1.14/include/linux/ext3_fs.h
-@@ -257,15 +257,19 @@ struct ext3_new_group_data {
+--- linux-2.6.18-92.1.22.orig/include/linux/ext3_fs.h
++++ linux-2.6.18-92.1.22/include/linux/ext3_fs.h
+@@ -258,15 +258,19 @@ struct ext3_new_group_data {
#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_SETFLAGS _IOW('f', 2, long)
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
+#define EXT3_IOC_SETRSVSZ _IOW('f', 6, 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_SETRSVSZ _IOW('f', 6, 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_FIEMAP _IOWR('f', 10, struct fiemap)
++#define EXT3_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
#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_GETVERSION_OLD _IOR('v', 1, long)
#define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
#ifdef CONFIG_JBD_DEBUG
-@@ -1040,6 +1044,9 @@ extern int ext3_block_truncate_page(hand
+@@ -1041,6 +1045,9 @@ extern int ext3_block_truncate_page(hand
/* ioctl.c */
extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
/* ioctl.c */
extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
/* namei.c */
extern int ext3_orphan_add(handle_t *, struct inode *);
/* namei.c */
extern int ext3_orphan_add(handle_t *, struct inode *);
-@@ -1117,7 +1124,6 @@ ext3_get_blocks_wrap(handle_t *handle, s
+@@ -1118,7 +1125,6 @@ ext3_get_blocks_wrap(handle_t *handle, s
#endif /* __KERNEL__ */
/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
#endif /* __KERNEL__ */
/* EXT3_IOC_CREATE_INUM at bottom of file (visible to kernel and user). */
-Index: linux-2.6.18-53.1.14/include/linux/ext3_extents.h
+Index: linux-2.6.18-92.1.22/include/linux/ext3_extents.h
===================================================================
===================================================================
---- linux-2.6.18-53.1.14.orig/include/linux/ext3_extents.h
-+++ linux-2.6.18-53.1.14/include/linux/ext3_extents.h
+--- linux-2.6.18-92.1.22.orig/include/linux/ext3_extents.h
++++ linux-2.6.18-92.1.22/include/linux/ext3_extents.h
@@ -142,8 +142,10 @@ struct ext3_ext_path {
* callback must return valid extent (passed or newly created)
*/
@@ -142,8 +142,10 @@ struct ext3_ext_path {
* callback must return valid extent (passed or newly created)
*/
#define EXT_CONTINUE 0
#define EXT_BREAK 1
#define EXT_CONTINUE 0
#define EXT_BREAK 1
-@@ -152,6 +154,26 @@ typedef int (*ext_prepare_callback)(stru
-
+@@ -153,6 +155,26 @@ typedef int (*ext_prepare_callback)(stru
#define EXT_MAX_BLOCK 0xffffffff
#define EXT_MAX_BLOCK 0xffffffff
+ #define EXT_UNSET_BLOCK 1
+/*
+ * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
+/*
+ * EXT_INIT_MAX_LEN is the maximum number of blocks we can have in an
#define EXT_FLAGS_CLR_UNKNOWN 0x7 /* Flags cleared on modification */
#define EXT_HDR_GEN_BITS 24
#define EXT_HDR_GEN_MASK ((1 << EXT_HDR_GEN_BITS) - 1)
#define EXT_FLAGS_CLR_UNKNOWN 0x7 /* Flags cleared on modification */
#define EXT_HDR_GEN_BITS 24
#define EXT_HDR_GEN_MASK ((1 << EXT_HDR_GEN_BITS) - 1)
-@@ -219,6 +241,12 @@ ext3_ext_invalidate_cache(struct inode *
+@@ -220,6 +242,12 @@ ext3_ext_invalidate_cache(struct inode *
EXT3_I(inode)->i_cached_extent.ec_type = EXT3_EXT_CACHE_NO;
}
EXT3_I(inode)->i_cached_extent.ec_type = EXT3_EXT_CACHE_NO;
}
extern int ext3_ext_search_left(struct inode *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_ext_search_right(struct inode *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_extent_tree_init(handle_t *, struct inode *);
extern int ext3_ext_search_left(struct inode *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_ext_search_right(struct inode *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_extent_tree_init(handle_t *, struct inode *);
-Index: linux-2.6.18-53.1.14/fs/ext3/extents.c
+Index: linux-2.6.18-92.1.22/fs/ext3/extents.c
===================================================================
===================================================================
---- linux-2.6.18-53.1.14.orig/fs/ext3/extents.c
-+++ linux-2.6.18-53.1.14/fs/ext3/extents.c
+--- linux-2.6.18-92.1.22.orig/fs/ext3/extents.c
++++ linux-2.6.18-92.1.22/fs/ext3/extents.c
@@ -41,6 +41,7 @@
#include <linux/string.h>
#include <linux/slab.h>
@@ -41,6 +41,7 @@
#include <linux/string.h>
#include <linux/slab.h>
EXPORT_SYMBOL(ext3_mark_inode_dirty);
EXPORT_SYMBOL(ext3_ext_invalidate_cache);
EXPORT_SYMBOL(ext3_ext_insert_extent);
EXPORT_SYMBOL(ext3_mark_inode_dirty);
EXPORT_SYMBOL(ext3_ext_invalidate_cache);
EXPORT_SYMBOL(ext3_ext_insert_extent);
-Index: linux-2.6.18-53.1.14/fs/ext3/fiemap.h
+Index: linux-2.6.18-92.1.22/fs/ext3/fiemap.h
===================================================================
--- /dev/null
===================================================================
--- /dev/null
-+++ linux-2.6.18-53.1.14/fs/ext3/fiemap.h
-@@ -0,0 +1,84 @@
++++ linux-2.6.18-92.1.22/fs/ext3/fiemap.h
+@@ -0,0 +1,85 @@
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
++ __u64 fe_reserved64[2];
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
-+ * Sets EXTENT_UNKNOWN. */
-+#define FIEMAP_EXTENT_NO_DIRECT 0x00000008 /* Data mapping undefined */
-+#define FIEMAP_EXTENT_SECONDARY 0x00000010 /* Data copied offline. May
-+ * set EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_NET 0x00000020 /* Data stored remotely.
-+ * Sets EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_DATA_COMPRESSED 0x00000040 /* Data is compressed by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_UNKNOWN. */
++#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
++ * while fs is unmounted */
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_NO_DIRECT. */
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
-+ * no data (i.e. zero). */
++ * no data (i.e. zero). */
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
-+ * support extents. Result
-+ * merged for efficiency. */
++ * support extents. Result
++ * merged for efficiency. */
++
++/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
++#define FIEMAP_EXTENT_NO_DIRECT 0x40000000 /* Data mapping undefined */
++#define FIEMAP_EXTENT_NET 0x80000000 /* Data stored remotely.
++ * Sets NO_DIRECT flag */
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+
A large part of this code is from the generic VFS code in fs/ioctl.c in the
upstream kernel.
A large part of this code is from the generic VFS code in fs/ioctl.c in the
upstream kernel.
-Index: linux-2.6.16.60-0.23/fs/ext3/ioctl.c
+Index: linux-2.6.9-67.0.22/fs/ext3/ioctl.c
===================================================================
===================================================================
---- linux-2.6.16.60-0.23.orig/fs/ext3/ioctl.c
-+++ linux-2.6.16.60-0.23/fs/ext3/ioctl.c
-@@ -15,7 +15,159 @@
+--- linux-2.6.9-67.0.22.orig/fs/ext3/ioctl.c
++++ linux-2.6.9-67.0.22/fs/ext3/ioctl.c
+@@ -14,7 +14,161 @@
#include <linux/time.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
#include <linux/time.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
-+ * @len: Extent length, in bytes
++ * @len: Extent length, in bytes
+ * @flags: FIEMAP_EXTENT flags that describe this extent
+ * @flags: FIEMAP_EXTENT flags that describe this extent
-+ * @lun: LUN on which this extent resides
++ * @lun: LUN on which this extent resides
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
-+#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_COMPRESSED \
-+ |FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
-+ fieinfo->fi_extents_mapped++;
-+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
++ fieinfo->fi_extents_mapped++;
++ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+
+ if (flags & SET_UNKNOWN_FLAGS)
+
+ if (flags & SET_UNKNOWN_FLAGS)
-+ flags |= FIEMAP_EXTENT_UNKNOWN;
++ flags |= FIEMAP_EXTENT_UNKNOWN;
+ if (flags & SET_NO_DIRECT_FLAGS)
+ if (flags & SET_NO_DIRECT_FLAGS)
-+ flags |= FIEMAP_EXTENT_NO_DIRECT;
++ flags |= FIEMAP_EXTENT_NO_DIRECT;
+ if (flags & SET_NOT_ALIGNED_FLAGS)
+ if (flags & SET_NOT_ALIGNED_FLAGS)
-+ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
++ flags |= FIEMAP_EXTENT_ENCODED;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
-+ sizeof(struct fiemap)))
++ sizeof(struct fiemap)))
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
-@@ -262,7 +414,9 @@ flags_err:
+@@ -244,7 +398,9 @@ flags_err:
-Index: linux-2.6.16.60-0.23/include/linux/ext3_fs.h
+Index: linux-2.6.9-67.0.22/include/linux/ext3_fs.h
===================================================================
===================================================================
---- linux-2.6.16.60-0.23.orig/include/linux/ext3_fs.h
-+++ linux-2.6.16.60-0.23/include/linux/ext3_fs.h
+--- linux-2.6.9-67.0.22.orig/include/linux/ext3_fs.h
++++ linux-2.6.9-67.0.22/include/linux/ext3_fs.h
@@ -260,15 +260,19 @@ struct ext3_new_group_data {
#define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
@@ -260,15 +260,19 @@ struct ext3_new_group_data {
#define EXT3_IOC_SETFLAGS _IOW('f', 2, long)
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
+#define EXT3_IOC_SETRSVSZ _IOW('f', 6, 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_SETRSVSZ _IOW('f', 6, 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_FIEMAP _IOWR('f', 10, struct fiemap)
++#define EXT3_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
#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_GETVERSION_OLD _IOR('v', 1, long)
#define EXT3_IOC_SETVERSION_OLD _IOW('v', 2, long)
#ifdef CONFIG_JBD_DEBUG
+#define EXT3_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC)
/*
+#define EXT3_FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC)
/*
- * Mount options
-@@ -996,6 +1000,9 @@ extern int ext3_writepage_trans_blocks(s
+ * Structure of an inode on the disk
+@@ -963,6 +967,9 @@ extern void ext3_set_aops(struct inode *
/* ioctl.c */
extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
/* ioctl.c */
extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
/* namei.c */
extern int ext3_orphan_add(handle_t *, struct inode *);
/* namei.c */
extern int ext3_orphan_add(handle_t *, struct inode *);
-Index: linux-2.6.16.60-0.23/include/linux/ext3_extents.h
+Index: linux-2.6.9-67.0.22/include/linux/ext3_extents.h
===================================================================
===================================================================
---- linux-2.6.16.60-0.23.orig/include/linux/ext3_extents.h
-+++ linux-2.6.16.60-0.23/include/linux/ext3_extents.h
+--- linux-2.6.9-67.0.22.orig/include/linux/ext3_extents.h
++++ linux-2.6.9-67.0.22/include/linux/ext3_extents.h
@@ -170,7 +170,10 @@ struct ext3_extents_helpers {
*/
typedef int (*ext_prepare_callback)(struct ext3_extents_tree *,
@@ -170,7 +170,10 @@ struct ext3_extents_helpers {
*/
typedef int (*ext_prepare_callback)(struct ext3_extents_tree *,
#define EXT_FIRST_EXTENT(__hdr__) \
((struct ext3_extent *) (((char *) (__hdr__)) + \
#define EXT_FIRST_EXTENT(__hdr__) \
((struct ext3_extent *) (((char *) (__hdr__)) + \
-@@ -242,6 +264,12 @@ struct ext3_extent_tree_stats {
+@@ -244,6 +266,12 @@ struct ext3_extent_tree_stats {
extern int ext3_ext_search_left(struct ext3_extents_tree *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_ext_search_right(struct ext3_extents_tree *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern void ext3_init_tree_desc(struct ext3_extents_tree *, struct inode *);
extern int ext3_ext_search_left(struct ext3_extents_tree *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern int ext3_ext_search_right(struct ext3_extents_tree *, struct ext3_ext_path *, unsigned long *, unsigned long *);
extern void ext3_init_tree_desc(struct ext3_extents_tree *, struct inode *);
-Index: linux-2.6.16.60-0.23/fs/ext3/extents.c
+Index: linux-2.6.9-67.0.22/fs/ext3/extents.c
===================================================================
===================================================================
---- linux-2.6.16.60-0.23.orig/fs/ext3/extents.c
-+++ linux-2.6.16.60-0.23/fs/ext3/extents.c
+--- linux-2.6.9-67.0.22.orig/fs/ext3/extents.c
++++ linux-2.6.9-67.0.22/fs/ext3/extents.c
@@ -41,6 +41,7 @@
#include <linux/string.h>
#include <linux/slab.h>
@@ -41,6 +41,7 @@
#include <linux/string.h>
#include <linux/slab.h>
-@@ -1488,7 +1489,7 @@ int ext3_ext_walk_space(struct ext3_exte
+@@ -1489,7 +1490,7 @@ int ext3_ext_walk_space(struct ext3_exte
EXT_ASSERT(cbex.ec_len > 0);
EXT_ASSERT(path[depth].p_hdr);
EXT_ASSERT(cbex.ec_len > 0);
EXT_ASSERT(path[depth].p_hdr);
ext3_ext_drop_refs(path);
if (err < 0)
ext3_ext_drop_refs(path);
if (err < 0)
-@@ -2502,7 +2503,109 @@ int ext3_ext_calc_blockmap_metadata(stru
+@@ -2503,7 +2504,109 @@ int ext3_ext_calc_blockmap_metadata(stru
ext3_init_tree_desc(&tree, inode);
return ext3_ext_calc_metadata_amount(&tree, blocks);
}
ext3_init_tree_desc(&tree, inode);
return ext3_ext_calc_metadata_amount(&tree, blocks);
}
EXPORT_SYMBOL(ext3_init_tree_desc);
EXPORT_SYMBOL(ext3_mark_inode_dirty);
EXPORT_SYMBOL(ext3_ext_invalidate_cache);
EXPORT_SYMBOL(ext3_init_tree_desc);
EXPORT_SYMBOL(ext3_mark_inode_dirty);
EXPORT_SYMBOL(ext3_ext_invalidate_cache);
-Index: linux-2.6.16.60-0.23/fs/ext3/fiemap.h
+Index: linux-2.6.9-67.0.22/fs/ext3/fiemap.h
===================================================================
--- /dev/null
===================================================================
--- /dev/null
-+++ linux-2.6.16.60-0.23/fs/ext3/fiemap.h
-@@ -0,0 +1,84 @@
++++ linux-2.6.9-67.0.22/fs/ext3/fiemap.h
+@@ -0,0 +1,85 @@
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
++ __u64 fe_reserved64[2];
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
-+ * Sets EXTENT_UNKNOWN. */
-+#define FIEMAP_EXTENT_NO_DIRECT 0x00000008 /* Data mapping undefined */
-+#define FIEMAP_EXTENT_SECONDARY 0x00000010 /* Data copied offline. May
-+ * set EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_NET 0x00000020 /* Data stored remotely.
-+ * Sets EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_DATA_COMPRESSED 0x00000040 /* Data is compressed by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_UNKNOWN. */
++#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
++ * while fs is unmounted */
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_NO_DIRECT. */
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
-+ * no data (i.e. zero). */
++ * no data (i.e. zero). */
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
-+ * support extents. Result
-+ * merged for efficiency. */
++ * support extents. Result
++ * merged for efficiency. */
++
++/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
++#define FIEMAP_EXTENT_NO_DIRECT 0x40000000 /* Data mapping undefined */
++#define FIEMAP_EXTENT_NET 0x80000000 /* Data stored remotely.
++ * Sets NO_DIRECT flag */
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+
===================================================================
--- linux-2.6.22.14.orig/fs/ext3/ioctl.c
+++ linux-2.6.22.14/fs/ext3/ioctl.c
===================================================================
--- linux-2.6.22.14.orig/fs/ext3/ioctl.c
+++ linux-2.6.22.14/fs/ext3/ioctl.c
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <linux/namei.h>
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
+ * @fieinfo: Fiemap context passed into ->fiemap
+ * @logical: Extent logical start offset, in bytes
+ * @phys: Extent physical start offset, in bytes
-+ * @len: Extent length, in bytes
++ * @len: Extent length, in bytes
+ * @flags: FIEMAP_EXTENT flags that describe this extent
+ * @flags: FIEMAP_EXTENT flags that describe this extent
-+ * @lun: LUN on which this extent resides
++ * @lun: LUN on which this extent resides
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ *
+ * Called from file system ->fiemap callback. Will populate extent
+ * info as passed in via arguments and copy to user memory. On
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
+ * extent that will fit in user array.
+ */
+#define SET_UNKNOWN_FLAGS (FIEMAP_EXTENT_DELALLOC)
-+#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_COMPRESSED \
-+ |FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_DIRECT_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED \
++#define SET_NO_UNMOUNTED_IO_FLAGS (FIEMAP_EXTENT_DATA_ENCRYPTED)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+#define SET_NOT_ALIGNED_FLAGS (FIEMAP_EXTENT_DATA_TAIL|FIEMAP_EXTENT_DATA_INLINE)
+int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical,
+ u64 phys, u64 len, u32 flags, dev_t dev)
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
+
+ /* only count the extents */
+ if (fieinfo->fi_extents_max == 0) {
-+ fieinfo->fi_extents_mapped++;
-+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
++ fieinfo->fi_extents_mapped++;
++ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+ }
+
+ if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max)
+
+ if (flags & SET_UNKNOWN_FLAGS)
+
+ if (flags & SET_UNKNOWN_FLAGS)
-+ flags |= FIEMAP_EXTENT_UNKNOWN;
++ flags |= FIEMAP_EXTENT_UNKNOWN;
+ if (flags & SET_NO_DIRECT_FLAGS)
+ if (flags & SET_NO_DIRECT_FLAGS)
-+ flags |= FIEMAP_EXTENT_NO_DIRECT;
++ flags |= FIEMAP_EXTENT_NO_DIRECT;
+ if (flags & SET_NOT_ALIGNED_FLAGS)
+ if (flags & SET_NOT_ALIGNED_FLAGS)
-+ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ flags |= FIEMAP_EXTENT_NOT_ALIGNED;
++ if (flags & SET_NO_UNMOUNTED_IO_FLAGS)
++ flags |= FIEMAP_EXTENT_ENCODED;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ extent.fe_logical = logical;
+ extent.fe_physical = phys;
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ dest += fieinfo->fi_extents_mapped;
+ if (copy_to_user(dest, &extent, sizeof(extent)))
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ fieinfo->fi_extents_mapped++;
+ if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max)
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+
+ return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0;
+}
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
+ int error = 0;
+
+ if (copy_from_user(&fiemap, (struct fiemap __user *) arg,
-+ sizeof(struct fiemap)))
++ sizeof(struct fiemap)))
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+ return -EFAULT;
+
+ if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS)
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+
+ error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length,
+ &len);
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+ if (fiemap.fm_extent_count != 0 &&
+ !access_ok(VERIFY_WRITE, (void *)arg,
+ offsetof(typeof(fiemap), fm_extents[fiemap.fm_extent_count])))
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
+
+ if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC)
+ filemap_write_and_wait(inode->i_mapping);
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
int ext3_ioctl (struct inode * inode, struct file * filp, unsigned int cmd,
unsigned long arg)
-@@ -274,7 +427,9 @@ flags_err:
+@@ -274,7 +429,9 @@ flags_err:
===================================================================
--- linux-2.6.22.14.orig/include/linux/ext3_fs.h
+++ linux-2.6.22.14/include/linux/ext3_fs.h
===================================================================
--- linux-2.6.22.14.orig/include/linux/ext3_fs.h
+++ linux-2.6.22.14/include/linux/ext3_fs.h
-@@ -254,15 +254,16 @@ struct ext3_new_group_data {
+@@ -255,15 +255,16 @@ struct ext3_new_group_data {
#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_SETFLAGS FS_IOC_SETFLAGS
#define EXT3_IOC_GETVERSION _IOR('f', 3, long)
#define EXT3_IOC_SETVERSION _IOW('f', 4, long)
+#define EXT3_IOC_SETRSVSZ _IOW('f', 6, 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_SETRSVSZ _IOW('f', 6, 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_FIEMAP _IOWR('f', 10, struct fiemap)
++#define EXT3_IOC_FIEMAP _IOWR('f', 11, struct fiemap)
#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
#ifdef CONFIG_JBD_DEBUG
#define EXT3_IOC_GETVERSION_OLD FS_IOC_GETVERSION
#define EXT3_IOC_SETVERSION_OLD FS_IOC_SETVERSION
#ifdef CONFIG_JBD_DEBUG
/*
* ioctl commands in 32 bit emulation
/*
* ioctl commands in 32 bit emulation
-@@ -280,6 +281,8 @@ struct ext3_new_group_data {
+@@ -281,6 +282,8 @@ struct ext3_new_group_data {
#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
#define EXT3_IOC32_GETVERSION_OLD FS_IOC32_GETVERSION
#define EXT3_IOC32_SETVERSION_OLD FS_IOC32_SETVERSION
-@@ -1056,6 +1059,9 @@ extern int ext3_block_truncate_page(hand
+@@ -1057,6 +1060,9 @@ extern int ext3_block_truncate_page(hand
extern int ext3_ioctl (struct inode *, struct file *, unsigned int,
unsigned long);
extern long ext3_compat_ioctl (struct file *, unsigned int, unsigned long);
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 *);
/* namei.c */
extern int ext3_orphan_add(handle_t *, struct inode *);
-@@ -1133,7 +1139,6 @@ ext3_get_blocks_wrap(handle_t *handle, s
+@@ -1134,7 +1140,6 @@ ext3_get_blocks_wrap(handle_t *handle, s
===================================================================
--- /dev/null
+++ linux-2.6.22.14/fs/ext3/fiemap.h
===================================================================
--- /dev/null
+++ linux-2.6.22.14/fs/ext3/fiemap.h
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+/*
+ * FIEMAP ioctl infrastructure.
+ *
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
+ __u64 fe_physical; /* physical offset in bytes for the start
+ * of the extent from the beginning of the disk */
+ __u64 fe_length; /* length in bytes for this extent */
++ __u64 fe_reserved64[2];
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+ __u32 fe_flags; /* FIEMAP_EXTENT_* flags for this extent */
+ __u32 fe_device; /* device number for this extent */
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+/* ldiskfs only supports FLAG_SYNC flag currently */
+#define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR)
+
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
+#define FIEMAP_EXTENT_LAST 0x00000001 /* Last extent in file. */
+#define FIEMAP_EXTENT_UNKNOWN 0x00000002 /* Data location unknown. */
+#define FIEMAP_EXTENT_DELALLOC 0x00000004 /* Location still pending.
-+ * Sets EXTENT_UNKNOWN. */
-+#define FIEMAP_EXTENT_NO_DIRECT 0x00000008 /* Data mapping undefined */
-+#define FIEMAP_EXTENT_SECONDARY 0x00000010 /* Data copied offline. May
-+ * set EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_NET 0x00000020 /* Data stored remotely.
-+ * Sets EXTENT_NO_DIRECT. */
-+#define FIEMAP_EXTENT_DATA_COMPRESSED 0x00000040 /* Data is compressed by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_UNKNOWN. */
++#define FIEMAP_EXTENT_ENCODED 0x00000008 /* Data can not be read
++ * while fs is unmounted */
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
+#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs.
-+ * Sets EXTENT_NO_DIRECT. */
++ * Sets EXTENT_NO_DIRECT. */
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
+#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
+#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block.
-+ * Sets EXTENT_NOT_ALIGNED.*/
++ * Sets EXTENT_NOT_ALIGNED.*/
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
+#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but
-+ * no data (i.e. zero). */
++ * no data (i.e. zero). */
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
+#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively
-+ * support extents. Result
-+ * merged for efficiency. */
++ * support extents. Result
++ * merged for efficiency. */
++
++/* Lustre specific flags - use a high bit, don't conflict with upstream flag */
++#define FIEMAP_EXTENT_NO_DIRECT 0x40000000 /* Data mapping undefined */
++#define FIEMAP_EXTENT_NET 0x80000000 /* Data stored remotely.
++ * Sets NO_DIRECT flag */
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+
+
+#endif /* _LINUX_EXT3_FIEMAP_H */
+