X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fmd_attrs.c;h=e06eb505d1e0bcbbe95d6a40e7a50e488a8b6a59;hb=6acf93339ad3297f2e5c659f2269c05df6198f74;hp=7d5364a067cdb884fec5c19eacf9731d646ccc79;hpb=4e7541ab2328da4d57f60b3b4d6514990f996858;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/md_attrs.c b/lustre/obdclass/md_attrs.c index 7d5364a..e06eb50 100644 --- a/lustre/obdclass/md_attrs.c +++ b/lustre/obdclass/md_attrs.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2013, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -39,18 +39,17 @@ * \param incompat - features that MDS must understand to access object */ void lustre_lma_init(struct lustre_mdt_attrs *lma, const struct lu_fid *fid, - __u32 incompat) + __u32 compat, __u32 incompat) { - lma->lma_compat = 0; + lma->lma_compat = compat; lma->lma_incompat = incompat; lma->lma_self_fid = *fid; - lma->lma_flags = 0; /* If a field is added in struct lustre_mdt_attrs, zero it explicitly * and change the test below. */ LASSERT(sizeof(*lma) == - (offsetof(struct lustre_mdt_attrs, lma_flags) + - sizeof(lma->lma_flags))); + (offsetof(struct lustre_mdt_attrs, lma_self_fid) + + sizeof(lma->lma_self_fid))); }; EXPORT_SYMBOL(lustre_lma_init); @@ -66,71 +65,11 @@ void lustre_lma_swab(struct lustre_mdt_attrs *lma) __swab32s(&lma->lma_compat); __swab32s(&lma->lma_incompat); lustre_swab_lu_fid(&lma->lma_self_fid); - __swab64s(&lma->lma_flags); } }; EXPORT_SYMBOL(lustre_lma_swab); /** - * Swab, if needed, SOM structure which is stored on-disk in little-endian - * order. - * - * \param attrs - is a pointer to the SOM structure to be swabbed. - */ -void lustre_som_swab(struct som_attrs *attrs) -{ - /* Use LUSTRE_MSG_MAGIC to detect local endianess. */ - if (LUSTRE_MSG_MAGIC != cpu_to_le32(LUSTRE_MSG_MAGIC)) { - __swab32s(&attrs->som_compat); - __swab32s(&attrs->som_incompat); - __swab64s(&attrs->som_ioepoch); - __swab64s(&attrs->som_size); - __swab64s(&attrs->som_blocks); - __swab64s(&attrs->som_mountid); - } -}; -EXPORT_SYMBOL(lustre_som_swab); - -/* - * Swab and extract SOM attributes from on-disk xattr. - * - * \param buf - is a buffer containing the on-disk SOM extended attribute. - * \param rc - is the SOM xattr stored in \a buf - * \param msd - is the md_som_data structure where to extract SOM attributes. - */ -int lustre_buf2som(void *buf, int rc, struct md_som_data *msd) -{ - struct som_attrs *attrs = (struct som_attrs *)buf; - ENTRY; - - if (rc == 0 || rc == -ENODATA) - /* no SOM attributes */ - RETURN(-ENODATA); - - if (rc < 0) - /* error hit while fetching xattr */ - RETURN(rc); - - /* check SOM compatibility */ - if (attrs->som_incompat & ~cpu_to_le32(SOM_INCOMPAT_SUPP)) - RETURN(-ENODATA); - - /* unpack SOM attributes */ - lustre_som_swab(attrs); - - /* fill in-memory msd structure */ - msd->msd_compat = attrs->som_compat; - msd->msd_incompat = attrs->som_incompat; - msd->msd_ioepoch = attrs->som_ioepoch; - msd->msd_size = attrs->som_size; - msd->msd_blocks = attrs->som_blocks; - msd->msd_mountid = attrs->som_mountid; - - RETURN(0); -} -EXPORT_SYMBOL(lustre_buf2som); - -/** * Swab, if needed, HSM structure which is stored on-disk in little-endian * order. * @@ -146,7 +85,6 @@ void lustre_hsm_swab(struct hsm_attrs *attrs) __swab64s(&attrs->hsm_arch_ver); } }; -EXPORT_SYMBOL(lustre_hsm_swab); /* * Swab and extract HSM attributes from on-disk xattr. @@ -187,7 +125,7 @@ EXPORT_SYMBOL(lustre_buf2hsm); * \param buf - is the output buffer where to pack the on-disk HSM xattr. * \param mh - is the md_hsm structure to pack. */ -void lustre_hsm2buf(void *buf, struct md_hsm *mh) +void lustre_hsm2buf(void *buf, const struct md_hsm *mh) { struct hsm_attrs *attrs = (struct hsm_attrs *)buf; ENTRY;