X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fobdclass%2Fobdo.c;h=322b2f59309a7543ecece4c875ec6ecf3f219803;hb=62640bf7796e15d953703b2842a70fbcfa5b399f;hp=45cb2f4f8b1c11931870157b3fcfb97ee03107b9;hpb=d843591c30d63bf54024e21b48dec92eb0ec9f68;p=fs%2Flustre-release.git diff --git a/lustre/obdclass/obdo.c b/lustre/obdclass/obdo.c index 45cb2f4..322b2f5 100644 --- a/lustre/obdclass/obdo.c +++ b/lustre/obdclass/obdo.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -47,7 +43,7 @@ # include #endif #include -#include +#include void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent) { @@ -58,6 +54,13 @@ void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent) } EXPORT_SYMBOL(obdo_set_parent_fid); +void obdo_set_o_projid(struct obdo *dst, u32 projid) +{ + dst->o_projid = projid; + dst->o_valid |= OBD_MD_FLPROJID; +} +EXPORT_SYMBOL(obdo_set_o_projid); + /* WARNING: the file systems must take care not to tinker with attributes they don't manage (such as blocks). */ void obdo_from_inode(struct obdo *dst, struct inode *src, u64 valid) @@ -65,7 +68,7 @@ void obdo_from_inode(struct obdo *dst, struct inode *src, u64 valid) u64 newvalid = 0; if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME)) - CDEBUG(D_INODE, "valid "LPX64", new time %lu/%lu\n", + CDEBUG(D_INODE, "valid %#llx, new time %lu/%lu\n", valid, LTIME_S(src->i_mtime), LTIME_S(src->i_ctime)); @@ -121,7 +124,7 @@ EXPORT_SYMBOL(obdo_from_inode); void obdo_cpy_md(struct obdo *dst, const struct obdo *src, u64 valid) { - CDEBUG(D_INODE, "src obdo "DOSTID" valid "LPX64", dst obdo "DOSTID"\n", + CDEBUG(D_INODE, "src obdo "DOSTID" valid %#llx, dst obdo "DOSTID"\n", POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi)); if (valid & OBD_MD_FLATIME) dst->o_atime = src->o_atime; @@ -169,3 +172,45 @@ void obdo_to_ioobj(const struct obdo *oa, struct obd_ioobj *ioobj) ioobj->ioo_max_brw = 0; } EXPORT_SYMBOL(obdo_to_ioobj); + +/** + * Create an obdo to send over the wire + */ +void lustre_set_wire_obdo(const struct obd_connect_data *ocd, + struct obdo *wobdo, + const struct obdo *lobdo) +{ + *wobdo = *lobdo; + if (ocd == NULL) + return; + + if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) && + fid_seq_is_echo(ostid_seq(&lobdo->o_oi))) { + /* Currently OBD_FL_OSTID will only be used when 2.4 echo + * client communicate with pre-2.4 server */ + wobdo->o_oi.oi.oi_id = fid_oid(&lobdo->o_oi.oi_fid); + wobdo->o_oi.oi.oi_seq = fid_seq(&lobdo->o_oi.oi_fid); + } +} +EXPORT_SYMBOL(lustre_set_wire_obdo); + +/** + * Create a local obdo from a wire based odbo + */ +void lustre_get_wire_obdo(const struct obd_connect_data *ocd, + struct obdo *lobdo, + const struct obdo *wobdo) +{ + *lobdo = *wobdo; + if (ocd == NULL) + return; + + if (unlikely(!(ocd->ocd_connect_flags & OBD_CONNECT_FID)) && + fid_seq_is_echo(wobdo->o_oi.oi.oi_seq)) { + /* see above */ + lobdo->o_oi.oi_fid.f_seq = wobdo->o_oi.oi.oi_seq; + lobdo->o_oi.oi_fid.f_oid = wobdo->o_oi.oi.oi_id; + lobdo->o_oi.oi_fid.f_ver = 0; + } +} +EXPORT_SYMBOL(lustre_get_wire_obdo);