X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Finclude%2Fuapi%2Flinux%2Flustre%2Flustre_fiemap.h;h=8204cd96885f96ede3e017927c31f74cf28537d7;hp=beea76d98fa3209688fe8e4f7118fd3dd4534aa5;hb=1d3c585194a907addbe8be7a884cc28d51db4b48;hpb=7a7309fa849577ddd5a4f6bb5bfb69e84a7fec89 diff --git a/lustre/include/uapi/linux/lustre/lustre_fiemap.h b/lustre/include/uapi/linux/lustre/lustre_fiemap.h index beea76d..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 __kernel_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 */