X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Fuapi%2Flinux%2Flustre%2Flustre_fiemap.h;h=8204cd96885f96ede3e017927c31f74cf28537d7;hb=1ac4b9598ad6e2f94c4c672b4733186364255c6a;hp=68562cda1da7cb893b38747d4d6ab01c44150e2d;hpb=a05c6e3f5598adaa68f7ac52bf489354953b7c2c;p=fs%2Flustre-release.git diff --git a/lustre/include/uapi/linux/lustre/lustre_fiemap.h b/lustre/include/uapi/linux/lustre/lustre_fiemap.h index 68562cd..8204cd9 100644 --- a/lustre/include/uapi/linux/lustre/lustre_fiemap.h +++ b/lustre/include/uapi/linux/lustre/lustre_fiemap.h @@ -27,9 +27,6 @@ */ /* * This file is part of Lustre, http://www.lustre.org/ - * Lustre is a trademark of Sun Microsystems, Inc. - * - * lustre/include/lustre/ll_fiemap.h * * FIEMAP data structures and flags. This header file will be used until * fiemap.h is available in the upstream kernel. @@ -41,22 +38,46 @@ #ifndef _LUSTRE_FIEMAP_H #define _LUSTRE_FIEMAP_H -#ifndef __KERNEL__ #include #include -#endif #include -/* XXX: We use fiemap_extent::fe_reserved[0] */ +/** + * XXX: We use fiemap_extent::fe_reserved[0], notice the high 16bits of it + * is used to locate the stripe number starting from the very beginning to + * resume the fiemap call. + */ #define fe_device fe_reserved[0] -static inline size_t fiemap_count_to_size(size_t extent_count) +static inline int get_fe_device(struct fiemap_extent *fe) +{ + return fe->fe_device & 0xffff; +} +static inline void set_fe_device(struct fiemap_extent *fe, int devno) +{ + fe->fe_device = (fe->fe_device & 0xffff0000) | (devno & 0xffff); +} +static inline int get_fe_stripenr(struct fiemap_extent *fe) +{ + return fe->fe_device >> 16; +} +static inline void set_fe_stripenr(struct fiemap_extent *fe, int nr) +{ + fe->fe_device = (fe->fe_device & 0xffff) | (nr << 16); +} +static inline void set_fe_device_stripenr(struct fiemap_extent *fe, int devno, + int nr) +{ + fe->fe_device = (nr << 16) | (devno & 0xffff); +} + +static inline __kernel_size_t fiemap_count_to_size(__kernel_size_t extent_count) { return sizeof(struct fiemap) + extent_count * sizeof(struct fiemap_extent); } -static inline unsigned fiemap_size_to_count(size_t array_size) +static inline unsigned int fiemap_size_to_count(__kernel_size_t array_size) { return (array_size - sizeof(struct fiemap)) / sizeof(struct fiemap_extent); @@ -68,8 +89,6 @@ static inline unsigned fiemap_size_to_count(size_t array_size) #undef FIEMAP_FLAGS_COMPAT #endif -/* 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 */