From 1594ed0d687be8723035068bc9bec32d51875ac8 Mon Sep 17 00:00:00 2001 From: kalpak Date: Tue, 20 Jan 2009 04:43:42 +0000 Subject: [PATCH] b=17942 i=adilger i=girish update fiemap structures and API to match upstream --- lustre/include/lustre/ll_fiemap.h | 85 +++++++++++++++++++------------------ lustre/include/lustre/lustre_user.h | 2 +- lustre/include/obd.h | 2 +- lustre/ptlrpc/wiretest.c | 18 ++++---- lustre/utils/wirecheck.c | 7 ++- lustre/utils/wiretest.c | 18 ++++---- 6 files changed, 64 insertions(+), 68 deletions(-) diff --git a/lustre/include/lustre/ll_fiemap.h b/lustre/include/lustre/ll_fiemap.h index 92f71a9..271ca5b 100644 --- a/lustre/include/lustre/ll_fiemap.h +++ b/lustre/include/lustre/ll_fiemap.h @@ -50,27 +50,27 @@ #include struct ll_fiemap_extent { - __u64 fe_logical; /* logical offset in bytes for the start of - * the extent from the beginning of the file */ - __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 the extent */ - __u32 fe_flags; /* FIEMAP_EXTENT_* flags for the extent */ - __u32 fe_device; /* device number for this extent */ + __u64 fe_logical; /* logical offset in bytes for the start of + * the extent from the beginning of the file */ + __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_reserved[2]; }; struct ll_user_fiemap { - __u64 fm_start; /* logical offset (inclusive) at - * which to start mapping (in) */ - __u64 fm_length; /* logical length of mapping which - * userspace wants (in) */ - __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ - __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ - __u32 fm_extent_count; /* size of fm_extents array (in) */ - __u32 fm_reserved; - struct ll_fiemap_extent fm_extents[0]; /* array of mapped extents (out). - * Lustre uses first extent to - * send end_offset */ + __u64 fm_start; /* logical offset (inclusive) at + * which to start mapping (in) */ + __u64 fm_length; /* logical length of mapping which + * userspace wants (in) */ + __u32 fm_flags; /* FIEMAP_FLAG_* flags for request (in/out) */ + __u32 fm_mapped_extents;/* number of extents that were mapped (out) */ + __u32 fm_extent_count; /* size of fm_extents array (in) */ + __u32 fm_reserved; + struct ll_fiemap_extent fm_extents[0]; /* array of mapped extents (out) */ }; #define FIEMAP_MAX_OFFSET (~0ULL) @@ -82,30 +82,31 @@ struct ll_user_fiemap { #define FIEMAP_FLAGS_COMPAT (FIEMAP_FLAG_SYNC | FIEMAP_FLAG_XATTR | \ FIEMAP_FLAG_DEVICE_ORDER) -#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. */ -#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. - * Sets EXTENT_NO_DIRECT. */ -#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be - * block aligned. */ -#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. - * Sets EXTENT_NOT_ALIGNED.*/ -#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. - * Sets EXTENT_NOT_ALIGNED.*/ -#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but - * no data (i.e. zero). */ -#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively - * support extents. Result - * merged for efficiency. */ + +#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_ENCODED 0x00000008 /* Data can not be read + * while fs is unmounted */ +#define FIEMAP_EXTENT_DATA_ENCRYPTED 0x00000080 /* Data is encrypted by fs. + * Sets EXTENT_NO_DIRECT. */ +#define FIEMAP_EXTENT_NOT_ALIGNED 0x00000100 /* Extent offsets may not be + * block aligned. */ +#define FIEMAP_EXTENT_DATA_INLINE 0x00000200 /* Data mixed with metadata. + * Sets EXTENT_NOT_ALIGNED.*/ +#define FIEMAP_EXTENT_DATA_TAIL 0x00000400 /* Multiple files in block. + * Sets EXTENT_NOT_ALIGNED.*/ +#define FIEMAP_EXTENT_UNWRITTEN 0x00000800 /* Space allocated, but + * no data (i.e. zero). */ +#define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively + * 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 */ #else diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index f263c38..4dfafcd 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -62,7 +62,7 @@ #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_FIEMAP _IOWR('f', 10, struct ll_user_fiemap) +#define EXT3_IOC_FIEMAP _IOWR('f', 11, struct ll_user_fiemap) #endif /* FIEMAP flags supported by Lustre */ diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 045b9e9..f12f648 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -1029,7 +1029,7 @@ enum obd_cleanup_stage { #define KEY_BLOCKSIZE "blocksize" #define KEY_BLOCKSIZE_BITS "blocksize_bits" #define KEY_MAX_EASIZE "max_ea_size" -#define KEY_FIEMAP "FIEMAP" +#define KEY_FIEMAP "fiemap" /* XXX unused */ #define KEY_ASYNC "async" diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 998eff1..2407c0b 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -61,13 +61,12 @@ #include #include #include - void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux vb1 2.6.18-build.1 #1 SMP Thu Mar 27 14:34:21 MDT 2008 i686 i686 i386 GNU - * with gcc version 4.1.2 20070626 (Red Hat 4.1.2-14) */ + * running on Linux localhost.localdomain 2.6.18-prep #3 SMP Sun Nov 23 08:04:44 EST 2008 i68 + * with gcc version 4.1.1 20061011 (Red Hat 4.1.1-30) */ /* Constants... */ @@ -2419,7 +2418,7 @@ void lustre_assert_wire_constants(void) CLASSERT(FIEMAP_FLAG_DEVICE_ORDER == 0x40000000); /* Checks for struct ll_fiemap_extent */ - LASSERTF((int)sizeof(struct ll_fiemap_extent) == 32, " found %lld\n", + LASSERTF((int)sizeof(struct ll_fiemap_extent) == 56, " found %lld\n", (long long)(int)sizeof(struct ll_fiemap_extent)); LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_logical) == 0, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_logical)); @@ -2433,27 +2432,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ll_fiemap_extent, fe_length)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_length) == 8, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_length)); - LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_flags) == 24, " found %lld\n", + LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_flags) == 40, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_flags)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_flags)); - LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_device) == 28, " found %lld\n", + LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_device) == 44, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_device)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_device) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_device)); CLASSERT(FIEMAP_EXTENT_LAST == 0x00000001); CLASSERT(FIEMAP_EXTENT_UNKNOWN == 0x00000002); CLASSERT(FIEMAP_EXTENT_DELALLOC == 0x00000004); - CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x00000008); - CLASSERT(FIEMAP_EXTENT_SECONDARY == 0x00000010); - CLASSERT(FIEMAP_EXTENT_NET == 0x00000020); - CLASSERT(FIEMAP_EXTENT_DATA_COMPRESSED == 0x00000040); + CLASSERT(FIEMAP_EXTENT_ENCODED == 0x00000008); CLASSERT(FIEMAP_EXTENT_DATA_ENCRYPTED == 0x00000080); CLASSERT(FIEMAP_EXTENT_NOT_ALIGNED == 0x00000100); CLASSERT(FIEMAP_EXTENT_DATA_INLINE == 0x00000200); CLASSERT(FIEMAP_EXTENT_DATA_TAIL == 0x00000400); CLASSERT(FIEMAP_EXTENT_UNWRITTEN == 0x00000800); CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); + CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); + CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); #if defined(LIBLUSTRE_POSIX_ACL) && defined(CONFIG_FS_POSIX_ACL) /* Checks for type posix_acl_xattr_entry */ diff --git a/lustre/utils/wirecheck.c b/lustre/utils/wirecheck.c index 3c0ef9e..ddfcd97 100644 --- a/lustre/utils/wirecheck.c +++ b/lustre/utils/wirecheck.c @@ -1191,16 +1191,15 @@ check_ll_fiemap_extent(void) CHECK_CDEFINE(FIEMAP_EXTENT_LAST); CHECK_CDEFINE(FIEMAP_EXTENT_UNKNOWN); CHECK_CDEFINE(FIEMAP_EXTENT_DELALLOC); - CHECK_CDEFINE(FIEMAP_EXTENT_NO_DIRECT); - CHECK_CDEFINE(FIEMAP_EXTENT_SECONDARY); - CHECK_CDEFINE(FIEMAP_EXTENT_NET); - CHECK_CDEFINE(FIEMAP_EXTENT_DATA_COMPRESSED); + CHECK_CDEFINE(FIEMAP_EXTENT_ENCODED); CHECK_CDEFINE(FIEMAP_EXTENT_DATA_ENCRYPTED); CHECK_CDEFINE(FIEMAP_EXTENT_NOT_ALIGNED); CHECK_CDEFINE(FIEMAP_EXTENT_DATA_INLINE); CHECK_CDEFINE(FIEMAP_EXTENT_DATA_TAIL); CHECK_CDEFINE(FIEMAP_EXTENT_UNWRITTEN); CHECK_CDEFINE(FIEMAP_EXTENT_MERGED); + CHECK_CDEFINE(FIEMAP_EXTENT_NO_DIRECT); + CHECK_CDEFINE(FIEMAP_EXTENT_NET); } static void diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index ca74af3..dd98a0e 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -59,13 +59,12 @@ int main() return ret; } - void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux vb1 2.6.18-build.1 #1 SMP Thu Mar 27 14:34:21 MDT 2008 i686 i686 i386 GNU - * with gcc version 4.1.2 20070626 (Red Hat 4.1.2-14) */ + * running on Linux localhost.localdomain 2.6.18-prep #3 SMP Sun Nov 23 08:04:44 EST 2008 i68 + * with gcc version 4.1.1 20061011 (Red Hat 4.1.1-30) */ /* Constants... */ @@ -2417,7 +2416,7 @@ void lustre_assert_wire_constants(void) CLASSERT(FIEMAP_FLAG_DEVICE_ORDER == 0x40000000); /* Checks for struct ll_fiemap_extent */ - LASSERTF((int)sizeof(struct ll_fiemap_extent) == 32, " found %lld\n", + LASSERTF((int)sizeof(struct ll_fiemap_extent) == 56, " found %lld\n", (long long)(int)sizeof(struct ll_fiemap_extent)); LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_logical) == 0, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_logical)); @@ -2431,27 +2430,26 @@ void lustre_assert_wire_constants(void) (long long)(int)offsetof(struct ll_fiemap_extent, fe_length)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_length) == 8, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_length)); - LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_flags) == 24, " found %lld\n", + LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_flags) == 40, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_flags)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_flags) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_flags)); - LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_device) == 28, " found %lld\n", + LASSERTF((int)offsetof(struct ll_fiemap_extent, fe_device) == 44, " found %lld\n", (long long)(int)offsetof(struct ll_fiemap_extent, fe_device)); LASSERTF((int)sizeof(((struct ll_fiemap_extent *)0)->fe_device) == 4, " found %lld\n", (long long)(int)sizeof(((struct ll_fiemap_extent *)0)->fe_device)); CLASSERT(FIEMAP_EXTENT_LAST == 0x00000001); CLASSERT(FIEMAP_EXTENT_UNKNOWN == 0x00000002); CLASSERT(FIEMAP_EXTENT_DELALLOC == 0x00000004); - CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x00000008); - CLASSERT(FIEMAP_EXTENT_SECONDARY == 0x00000010); - CLASSERT(FIEMAP_EXTENT_NET == 0x00000020); - CLASSERT(FIEMAP_EXTENT_DATA_COMPRESSED == 0x00000040); + CLASSERT(FIEMAP_EXTENT_ENCODED == 0x00000008); CLASSERT(FIEMAP_EXTENT_DATA_ENCRYPTED == 0x00000080); CLASSERT(FIEMAP_EXTENT_NOT_ALIGNED == 0x00000100); CLASSERT(FIEMAP_EXTENT_DATA_INLINE == 0x00000200); CLASSERT(FIEMAP_EXTENT_DATA_TAIL == 0x00000400); CLASSERT(FIEMAP_EXTENT_UNWRITTEN == 0x00000800); CLASSERT(FIEMAP_EXTENT_MERGED == 0x00001000); + CLASSERT(FIEMAP_EXTENT_NO_DIRECT == 0x40000000); + CLASSERT(FIEMAP_EXTENT_NET == 0x80000000); #if defined(LIBLUSTRE_POSIX_ACL) && defined(CONFIG_FS_POSIX_ACL) /* Checks for type posix_acl_xattr_entry */ -- 1.8.3.1