Whamcloud - gitweb
LU-1579 osd: reserve credits for set version
authorNiu Yawei <niu@whamcloud.com>
Fri, 29 Jun 2012 07:08:02 +0000 (03:08 -0400)
committerOleg Drokin <green@whamcloud.com>
Mon, 27 Aug 2012 14:04:40 +0000 (10:04 -0400)
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 <niu@whamcloud.com>
Change-Id: I77a13173eea8007b5300155e0d726bd82ace8ede
Reviewed-on: http://review.whamcloud.com/3242
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
lustre/osd-ldiskfs/osd_handler.c

index d0a162a..54e631e 100644 (file)
@@ -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;
 }
 
 /*