From e9bcde336651284ced67c1f2de8c51c3023d64c2 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Fri, 29 Jun 2012 03:08:02 -0400 Subject: [PATCH] LU-1579 osd: reserve credits for set version In current osd_declare_xattr_set(), we assume that version change is always accompanied with inode changes, so we don't reserve extra credits for the setting verison. However, in the new quota design, we may issue a sole version change without any other updates. I think osd_declare_xattr_set() should not make assumption on the caller's behavior and reserve at least 1 block for version change. Signed-off-by: Niu Yawei Change-Id: I77a13173eea8007b5300155e0d726bd82ace8ede Reviewed-on: http://review.whamcloud.com/3242 Tested-by: Hudson Reviewed-by: Johann Lombardi Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Mike Pershin --- lustre/osd-ldiskfs/osd_handler.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index d0a162a..54e631e 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -2397,22 +2397,20 @@ static int osd_declare_xattr_set(const struct lu_env *env, const struct lu_buf *buf, const char *name, int fl, struct thandle *handle) { - struct osd_thandle *oh; + struct osd_thandle *oh; - LASSERT(handle != NULL); + LASSERT(handle != NULL); - if (strcmp(name, XATTR_NAME_VERSION) == 0) { - /* no credits for version */ - return 0; - } + oh = container_of0(handle, struct osd_thandle, ot_super); + LASSERT(oh->ot_handle == NULL); - oh = container_of0(handle, struct osd_thandle, ot_super); - LASSERT(oh->ot_handle == NULL); - - OSD_DECLARE_OP(oh, xattr_set); - oh->ot_credits += osd_dto_credits_noquota[DTO_XATTR_SET]; + OSD_DECLARE_OP(oh, xattr_set); + if (strcmp(name, XATTR_NAME_VERSION) == 0) + oh->ot_credits += osd_dto_credits_noquota[DTO_ATTR_SET_BASE]; + else + oh->ot_credits += osd_dto_credits_noquota[DTO_XATTR_SET]; - return 0; + return 0; } /* -- 1.8.3.1