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-5051 hsm: do not reallocate hsm receive buffer
[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
..
a1819fc
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 */
@@
-206,7
+206,8
@@
static void ofd_grant_statfs(const struct lu_env *env, struct obd_export *exp,
rc = ofd_statfs_internal(env, ofd, osfs, max_age, from_cache);
if (unlikely(rc)) {
- *from_cache = 0;
+ if (from_cache)
+ *from_cache = 0;
return;
}
@@
-233,7
+234,7
@@
static obd_size ofd_grant_space_left(struct obd_export *exp)
obd_size unstable;
ENTRY;
-
LASSERT_SPIN_LOCKED
(&ofd->ofd_grant_lock);
+
assert_spin_locked
(&ofd->ofd_grant_lock);
spin_lock(&ofd->ofd_osfs_lock);
/* get available space from cached statfs data */
@@
-249,10
+250,11
@@
static obd_size ofd_grant_space_left(struct obd_export *exp)
D_ERROR : D_CACHE;
CDEBUG_LIMIT(mask, "%s: cli %s/%p left "LPU64" < tot_grant "
- LPU64" unstable "LPU64" pending "LPU64"\n",
+ LPU64" unstable "LPU64" pending "LPU64" "
+ "dirty "LPU64"\n",
obd->obd_name, exp->exp_client_uuid.uuid, exp,
left, tot_granted, unstable,
- ofd->ofd_tot_pending);
+ ofd->ofd_tot_pending
, ofd->ofd_tot_dirty
);
RETURN(0);
}
@@
-297,7
+299,7
@@
static void ofd_grant_incoming(const struct lu_env *env, struct obd_export *exp,
long dirty, dropped, grant_chunk;
ENTRY;
-
LASSERT_SPIN_LOCKED
(&ofd->ofd_grant_lock);
+
assert_spin_locked
(&ofd->ofd_grant_lock);
if ((oa->o_valid & (OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) !=
(OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) {
@@
-375,7
+377,7
@@
static void ofd_grant_shrink(struct obd_export *exp,
struct obd_device *obd = exp->exp_obd;
long grant_shrink;
-
LASSERT_SPIN_LOCKED
(&ofd->ofd_grant_lock);
+
assert_spin_locked
(&ofd->ofd_grant_lock);
LASSERT(exp);
if (left_space >= ofd->ofd_tot_granted_clients *
OFD_GRANT_SHRINK_LIMIT(exp))
@@
-456,7
+458,7
@@
static void ofd_grant_check(const struct lu_env *env, struct obd_export *exp,
ENTRY;
-
LASSERT_SPIN_LOCKED
(&ofd->ofd_grant_lock);
+
assert_spin_locked
(&ofd->ofd_grant_lock);
if ((oa->o_valid & OBD_MD_FLFLAGS) &&
(oa->o_flags & OBD_FL_RECOV_RESEND)) {
@@
-610,8
+612,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
+636,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
+934,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;
@@
-953,7
+955,7
@@
int ofd_grant_create(const struct lu_env *env, struct obd_export *exp, int *nr)
(ofd->ofd_osfs.os_blocks >> 10)) {
spin_unlock(&ofd->ofd_grant_lock);
CDEBUG(D_RPCTRACE, "%s: not enough space for create "LPU64"\n",
- ofd_
obd(ofd)->obd_name
,
+ ofd_
name(ofd)
,
ofd->ofd_osfs.os_bavail * ofd->ofd_osfs.os_blocks);
RETURN(-ENOSPC);
}
@@
-994,9
+996,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);
}