From: Niu Yawei Date: Fri, 12 Sep 2014 03:30:05 +0000 (-0400) Subject: LU-5612 osd: typo in osd_declare_write() X-Git-Tag: 2.5.3.90~105 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F89%2F11889%2F2;p=fs%2Flustre-release.git LU-5612 osd: typo in osd_declare_write() Some bits are lost when porting the fix of LU-4611 3902ff4c54925b2f1fcb732a32ed7ee5428e9f77 That could result in insufficient credits in certain situation. Signed-off-by: Niu Yawei Change-Id: I828a75c674978278b5adaf210586baa177ea0dc9 Reviewed-on: http://review.whamcloud.com/11889 Tested-by: Jenkins Reviewed-by: Alex Zhuravlev Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 83d8efe..7e0bab8 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -1106,8 +1106,14 @@ static ssize_t osd_declare_write(const struct lu_env *env, struct dt_object *dt, credits = osd_calc_bkmap_credits(sb, inode, size, _pos, blocks); } - osd_trans_declare_op(env, oh, OSD_OT_WRITE, credits); + /* if inode is created as part of the transaction, + * then it's counted already by the creation method */ + if (inode != NULL) + credits++; + out: + osd_trans_declare_op(env, oh, OSD_OT_WRITE, credits); + /* dt_declare_write() is usually called for system objects, such * as llog or last_rcvd files. We needn't enforce quota on those * objects, so always set the lqi_space as 0. */