Commit bc06a678 authored by jcl's avatar jcl Committed by Greg Kroah-Hartman

staging/lustre/llapi: add user space method for lov_user_md

move lov_mds_md_size from obd_lov.h to lustre_idl.h
to have it close to lov_mds_md definition.

add lov_user_md_size() to compute lum size so
llapi and user space utils do not use kernel internal
definitions/methods

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3345
Lustre-change: http://review.whamcloud.com/6345Signed-off-by: default avatarJC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: default avatarJinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarPeng Tao <tao.peng@emc.com>
Signed-off-by: default avatarAndreas Dilger <andreas.dilger@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 001f5487
...@@ -1670,6 +1670,17 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */ ...@@ -1670,6 +1670,17 @@ struct lov_mds_md_v3 { /* LOV EA mds/wire data (little-endian) */
struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */ struct lov_ost_data_v1 lmm_objects[0]; /* per-stripe data */
}; };
static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
{
if (lmm_magic == LOV_MAGIC_V3)
return sizeof(struct lov_mds_md_v3) +
stripes * sizeof(struct lov_ost_data_v1);
else
return sizeof(struct lov_mds_md_v1) +
stripes * sizeof(struct lov_ost_data_v1);
}
#define OBD_MD_FLID (0x00000001ULL) /* object ID */ #define OBD_MD_FLID (0x00000001ULL) /* object ID */
#define OBD_MD_FLATIME (0x00000002ULL) /* access time */ #define OBD_MD_FLATIME (0x00000002ULL) /* access time */
#define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */ #define OBD_MD_FLMTIME (0x00000004ULL) /* data modification time */
......
...@@ -347,6 +347,16 @@ struct lov_user_md_v3 { /* LOV EA user data (host-endian) */ ...@@ -347,6 +347,16 @@ struct lov_user_md_v3 { /* LOV EA user data (host-endian) */
struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */ struct lov_user_ost_data_v1 lmm_objects[0]; /* per-stripe data */
} __attribute__((packed)); } __attribute__((packed));
static inline __u32 lov_user_md_size(__u16 stripes, __u32 lmm_magic)
{
if (lmm_magic == LOV_USER_MAGIC_V3)
return sizeof(struct lov_user_md_v3) +
stripes * sizeof(struct lov_user_ost_data_v1);
else
return sizeof(struct lov_user_md_v1) +
stripes * sizeof(struct lov_user_ost_data_v1);
}
/* Compile with -D_LARGEFILE64_SOURCE or -D_GNU_SOURCE (or #define) to /* Compile with -D_LARGEFILE64_SOURCE or -D_GNU_SOURCE (or #define) to
* use this. It is unsafe to #define those values in this header as it * use this. It is unsafe to #define those values in this header as it
* is possible the application has already #included <sys/stat.h>. */ * is possible the application has already #included <sys/stat.h>. */
......
...@@ -44,16 +44,6 @@ static inline int lov_stripe_md_size(__u16 stripes) ...@@ -44,16 +44,6 @@ static inline int lov_stripe_md_size(__u16 stripes)
return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo*); return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo*);
} }
static inline __u32 lov_mds_md_size(__u16 stripes, __u32 lmm_magic)
{
if (lmm_magic == LOV_MAGIC_V3)
return sizeof(struct lov_mds_md_v3) +
stripes * sizeof(struct lov_ost_data_v1);
else
return sizeof(struct lov_mds_md_v1) +
stripes * sizeof(struct lov_ost_data_v1);
}
struct lov_version_size { struct lov_version_size {
__u32 lvs_magic; __u32 lvs_magic;
size_t lvs_lmm_size; size_t lvs_lmm_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment