Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
LU-3421 grant: more aggressively book space for precreate
[fs/lustre-release.git]
/
lustre
/
ofd
/
ofd_grant.c
diff --git
a/lustre/ofd/ofd_grant.c
b/lustre/ofd/ofd_grant.c
index
83a0ecb
..
a27a73e
100644
(file)
--- a/
lustre/ofd/ofd_grant.c
+++ b/
lustre/ofd/ofd_grant.c
@@
-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);
}