From 091988499717c729f8870b331ab3774b249d5818 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Sat, 5 Sep 2015 10:37:06 -0700 Subject: [PATCH] LU-7015 ofd: Fix wanted grant calculation When clients sends a "we want this much grant number", the value is a total amount of space client wants including whatever it has. So in order to properly reconcile this on the server we need to substract what the client alreay has to see how much we grant back. This will still overshoot some due to multiple RPCs in flight, but at least it should not be as bad anymore. Change-Id: I94cec016656b005891694dd70e6a7bab123cd690 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/16216 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Alex Zhuravlev Reviewed-by: Johann Lombardi Reviewed-by: Andreas Dilger --- lustre/ofd/ofd_grant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lustre/ofd/ofd_grant.c b/lustre/ofd/ofd_grant.c index b2c486a..fd2f101 100644 --- a/lustre/ofd/ofd_grant.c +++ b/lustre/ofd/ofd_grant.c @@ -700,7 +700,7 @@ static long ofd_grant_alloc(struct obd_export *exp, u64 curgrant, /* don't grant more than 1/8th of the remaining free space in * one chunk */ left >>= 3; - grant = min(want, left); + grant = min(want - curgrant, left); /* round grant upt to the next block size */ grant = (grant + (1 << ofd->ofd_blockbits) - 1) & ~((1ULL << ofd->ofd_blockbits) - 1); -- 1.8.3.1