{
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);
{
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 */
/* 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
* 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);
struct filter_export_data *fed = &exp->exp_filter_data;
obd_size left = 0;
unsigned long wanted;
-
ENTRY;
info->fti_used = 0;
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);
}