staging: lustre: clio: pass fid for OST setattr
authorBobi Jam <bobijam.xu@intel.com>
Sun, 18 Sep 2016 20:38:44 +0000 (16:38 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 19 Sep 2016 08:03:41 +0000 (10:03 +0200)
Store inode's fid in cl_setattr_ost() and OSC packs this info on the
wire (via lustre_set_wire_obdo) so that OST can use.

NOTE: currently lu_fid::f_ver and obdo::o_parent_ver are not used on
OFD device, and we use obdo::o_stripe_idx as
filter_fid::ff_parent::f_ver and save it to the device.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1154
Reviewed-on: http://review.whamcloud.com/12902
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/cl_object.h
drivers/staging/lustre/lustre/llite/lcommon_cl.c
drivers/staging/lustre/lustre/lov/lov_io.c
drivers/staging/lustre/lustre/osc/osc_io.c

index 9403c0c51e0c2d6f8ca78144c87a3337807c8f12..89292c93dcd5fe0130bc03e80f369f3d03e3efc7 100644 (file)
@@ -1766,6 +1766,8 @@ struct cl_io {
                struct cl_setattr_io {
                        struct ost_lvb   sa_attr;
                        unsigned int     sa_valid;
+                       int             sa_stripe_index;
+                       struct lu_fid  *sa_parent_fid;
                } ci_setattr;
                struct cl_fault_io {
                        /** page index within file. */
index 2ded6b5ef5a8bd75694493a9140dc9e25981aa12..084330d08f7a9ec4ce8eec160e3f69947226eb0b 100644 (file)
@@ -99,6 +99,7 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
        io->u.ci_setattr.sa_attr.lvb_ctime = LTIME_S(attr->ia_ctime);
        io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size;
        io->u.ci_setattr.sa_valid = attr->ia_valid;
+       io->u.ci_setattr.sa_parent_fid = ll_inode2fid(inode);
 
 again:
        if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
index 5d47a5ab97f7042e9057846f8709d03fb9b12075..d10157985ed91806d1c327ba435e623a0890f52f 100644 (file)
@@ -87,6 +87,9 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
        case CIT_SETATTR: {
                io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr;
                io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid;
+               io->u.ci_setattr.sa_stripe_index = stripe;
+               io->u.ci_setattr.sa_parent_fid =
+                                       parent->u.ci_setattr.sa_parent_fid;
                if (cl_io_is_trunc(io)) {
                        loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
 
index 42e9761aa36882a83c498b9cee879038684c2903..8a559cbcdd0c9f5bf264ca776b6bc4661713a3fe 100644 (file)
@@ -484,11 +484,13 @@ static int osc_io_setattr_start(const struct lu_env *env,
        memset(oa, 0, sizeof(*oa));
        if (result == 0) {
                oa->o_oi = loi->loi_oi;
+               obdo_set_parent_fid(oa, io->u.ci_setattr.sa_parent_fid);
+               oa->o_stripe_idx = io->u.ci_setattr.sa_stripe_index;
                oa->o_mtime = attr->cat_mtime;
                oa->o_atime = attr->cat_atime;
                oa->o_ctime = attr->cat_ctime;
-               oa->o_valid = OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
-                       OBD_MD_FLCTIME | OBD_MD_FLMTIME;
+               oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP | OBD_MD_FLATIME |
+                              OBD_MD_FLCTIME | OBD_MD_FLMTIME;
                if (ia_valid & ATTR_SIZE) {
                        oa->o_size = size;
                        oa->o_blocks = OBD_OBJECT_EOF;