Whamcloud - gitweb
LU-3421 grant: more aggressively book space for precreate 46/6546/3
authorJohann Lombardi <johann.lombardi@intel.com>
Tue, 4 Jun 2013 15:46:29 +0000 (17:46 +0200)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 03:44:26 +0000 (03:44 +0000)
- ofd_grant() should not round sub-block allocation to 0.
- ofd_grant_create() should be more aggressive in reserving space.
  Precreation should try to always have enough grant space to process
  a very large preallocation request.

Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Change-Id: I5803b2d5fae216edcaae124d3b50b589c02e7251
Reviewed-on: http://review.whamcloud.com/6546
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
lustre/ofd/ofd_dev.c
lustre/ofd/ofd_grant.c

index 20e3c59..a9237f7 100644 (file)
@@ -373,17 +373,17 @@ static int ofd_recovery_complete(const struct lu_env *env,
 {
        struct ofd_device       *ofd = ofd_dev(dev);
        struct lu_device        *next = &ofd->ofd_osd->dd_lu_dev;
-       int                      rc = 0;
+       int                      rc = 0, max_precreate;
 
        ENTRY;
 
        /* Grant space for object precreation on the self export.
-        * This initial reserved space (i.e. 20MB for zfs and 560KB for ldiskfs)
-        * is enough to create 20k objects. It is then adapted based on the
-        * precreate request size (see ofd_grant_create()
+        * This initial reserved space (i.e. 10MB for zfs and 280KB for ldiskfs)
+        * is enough to create 10k objects. More space is then acquired for
+        * precreation in ofd_grant_create().
         */
-       ofd_grant_connect(env, dev->ld_obd->obd_self_export,
-                         OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace,
+       max_precreate = OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace / 2;
+       ofd_grant_connect(env, dev->ld_obd->obd_self_export, max_precreate,
                          false);
        rc = next->ld_ops->ldo_recovery_complete(env, next);
        RETURN(rc);
index 83a0ecb..a27a73e 100644 (file)
@@ -72,7 +72,7 @@ static inline obd_size ofd_grant_chunk(struct obd_export *exp,
 {
        if (ofd_obd(ofd)->obd_self_export == exp)
                /* Grant enough space to handle a big precreate request */
-               return OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace;
+               return OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace / 2;
 
        if (ofd_grant_compat(exp, ofd))
                /* Try to grant enough space to send a full-size RPC */
@@ -610,8 +610,8 @@ static long ofd_grant(struct obd_export *exp, obd_size curgrant,
 
        /* client not supporting OBD_CONNECT_GRANT_PARAM works with a 4KB block
         * size while the reality is different */
-       curgrant    = ofd_grant_from_cli(exp, ofd, curgrant);
-       want    = ofd_grant_from_cli(exp, ofd, want);
+       curgrant = ofd_grant_from_cli(exp, ofd, curgrant);
+       want = ofd_grant_from_cli(exp, ofd, want);
        grant_chunk = ofd_grant_chunk(exp, ofd);
 
        /* Grant some fraction of the client's requested grant space so that
@@ -634,8 +634,9 @@ static long ofd_grant(struct obd_export *exp, obd_size curgrant,
                 * one chunk */
                left >>= 3;
        grant = min(want, left);
-       /* align grant on block size */
-       grant &= ~((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);
 
        if (!grant)
                RETURN(0);
@@ -931,7 +932,6 @@ int ofd_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr)
        struct filter_export_data       *fed = &exp->exp_filter_data;
        obd_size                         left = 0;
        unsigned long                    wanted;
-
        ENTRY;
 
        info->fti_used = 0;
@@ -994,9 +994,14 @@ int ofd_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr)
        fed->fed_pending += info->fti_used;
        ofd->ofd_tot_pending += info->fti_used;
 
-       /* grant more space (twice as much as needed for this request) for
-        * precreate purpose if possible */
-       ofd_grant(exp, fed->fed_grant, wanted * 2, left, true);
+       /* grant more space for precreate purpose if possible. */
+       wanted = OST_MAX_PRECREATE * ofd->ofd_dt_conf.ddp_inodespace / 2;
+       if (wanted > fed->fed_grant) {
+               /* always try to book enough space to handle a large precreate
+                * request */
+               wanted -= fed->fed_grant;
+               ofd_grant(exp, fed->fed_grant, wanted, left, false);
+       }
        spin_unlock(&ofd->ofd_grant_lock);
        RETURN(0);
 }