From c13d65b43b243fe88e6daa29c6f37f524f0a36c4 Mon Sep 17 00:00:00 2001 From: wang di Date: Tue, 27 May 2014 14:14:25 -0700 Subject: [PATCH] LU-5113 osd: add striped dir feature flag to LMA 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 Change-Id: I763217e3554dc4d68ee2f72d53c0e119fff6cbef Reviewed-on: http://review.whamcloud.com/10463 Tested-by: Jenkins Reviewed-by: Andreas Dilger Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/include/lustre/lustre_idl.h | 3 ++- lustre/osd-ldiskfs/osd_handler.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lustre/include/lustre/lustre_idl.h b/lustre/include/lustre/lustre_idl.h index b8a910e..1ed9850 100644 --- a/lustre/include/lustre/lustre_idl.h +++ b/lustre/include/lustre/lustre_idl.h @@ -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, diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 108ddde..c9834e1 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -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); } -- 1.8.3.1