Whamcloud - gitweb
LU-7015 ofd: Fix wanted grant calculation 16/16216/3
authorOleg Drokin <oleg.drokin@intel.com>
Sat, 5 Sep 2015 17:37:06 +0000 (10:37 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Thu, 10 Sep 2015 01:04:39 +0000 (01:04 +0000)
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 <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/16216
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/ofd/ofd_grant.c

index b2c486a..fd2f101 100644 (file)
@@ -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;
                /* 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);
        /* round grant upt to the next block size */
        grant = (grant + (1 << ofd->ofd_blockbits) - 1) &
                ~((1ULL << ofd->ofd_blockbits) - 1);