Whamcloud - gitweb
LU-5113 osd: add striped dir feature flag to LMA 63/10463/2
authorwang di <di.wang@intel.com>
Tue, 27 May 2014 21:14:25 +0000 (14:14 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 30 May 2014 03:55:30 +0000 (03:55 +0000)
Add striped directory feature flag(LMAI_STRIPED) to LMA, so
once MDS is downgraded, the striped directory will be accessed
by old lustre(< 2.6) on MDT.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: I763217e3554dc4d68ee2f72d53c0e119fff6cbef
Reviewed-on: http://review.whamcloud.com/10463
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/include/lustre/lustre_idl.h
lustre/osd-ldiskfs/osd_handler.c

index b8a910e..1ed9850 100644 (file)
@@ -342,8 +342,9 @@ enum lma_incompat {
        LMAI_AGENT              = 0x00000002, /* agent inode */
        LMAI_REMOTE_PARENT      = 0x00000004, /* the parent of the object
                                                 is on the remote MDT */
+       LMAI_STRIPED            = 0x00000008, /* striped directory inode */
 };
-#define LMA_INCOMPAT_SUPP      (LMAI_AGENT | LMAI_REMOTE_PARENT)
+#define LMA_INCOMPAT_SUPP      (LMAI_AGENT | LMAI_REMOTE_PARENT | LMAI_STRIPED)
 
 extern void lustre_lma_swab(struct lustre_mdt_attrs *lma);
 extern void lustre_lma_init(struct lustre_mdt_attrs *lma,
index 108ddde..c9834e1 100644 (file)
@@ -3011,6 +3011,22 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt,
        if (fl & LU_XATTR_CREATE)
                fs_flags |= XATTR_CREATE;
 
+       if (strcmp(name, XATTR_NAME_LMV) == 0) {
+               struct lustre_mdt_attrs *lma = &info->oti_mdt_attrs;
+               int                      rc;
+
+               rc = osd_get_lma(info, inode, &info->oti_obj_dentry, lma);
+               if (rc != 0)
+                       RETURN(rc);
+
+               lma->lma_incompat |= LMAI_STRIPED;
+               lustre_lma_swab(lma);
+               rc = __osd_xattr_set(info, inode, XATTR_NAME_LMA, lma,
+                                    sizeof(*lma), XATTR_REPLACE);
+               if (rc != 0)
+                       RETURN(rc);
+       }
+
        return __osd_xattr_set(info, inode, name, buf->lb_buf, buf->lb_len,
                               fs_flags);
 }