if (obd->obd_num_exports > 100)
return;
- spin_lock(&obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
spin_lock(&obd->obd_dev_lock);
list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
int error = 0;
fo_tot_pending = ofd->ofd_tot_pending;
fo_tot_dirty = ofd->ofd_tot_dirty;
spin_unlock(&obd->obd_dev_lock);
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
/* Do these assertions outside the spinlocks so we don't kill system */
if (tot_granted != fo_tot_granted)
struct filter_device *ofd = filter_exp(exp);
struct filter_export_data *fed = &exp->exp_filter_data;
- spin_lock(&obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
spin_lock(&obd->obd_dev_lock);
list_del_init(&exp->exp_obd_chain);
spin_unlock(&obd->obd_dev_lock);
ofd->ofd_tot_dirty -= fed->fed_dirty;
fed->fed_dirty = 0;
fed->fed_grant = 0;
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
}
/*
struct obd_device *obd = exp->exp_obd;
ENTRY;
- LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+ //LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
if ((oa->o_valid & (OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) !=
(OBD_MD_FLBLOCKS|OBD_MD_FLGRANT)) {
CERROR("%s: cli %s/%p dirty %ld pend %ld grant %ld\n",
obd->obd_name, exp->exp_client_uuid.uuid, exp,
fed->fed_dirty, fed->fed_pending, fed->fed_grant);
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
LBUG();
}
EXIT;
int statfs_done = 0;
long frsize;
- LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+ //LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
if (cfs_time_before_64(obd->obd_osfs_age,
cfs_time_current_64() - HZ)) {
unsigned long using = 0;
int rc = 0;
- LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+ //LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
*left -= *ungranted;
LASSERT(fed->fed_grant >= *used);
CERROR("%s: cli %s/%p dirty %ld pend %ld grant %ld\n",
obd->obd_name, exp->exp_client_uuid.uuid, exp,
fed->fed_dirty, fed->fed_pending, fed->fed_grant);
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
LBUG();
}
return rc;
struct filter_export_data *fed = &exp->exp_filter_data;
int i, rc = -ENOSPC, obj, n = 0;
- LASSERT_SPIN_LOCKED(&exp->exp_obd->obd_osfs_lock);
+ //LASSERT_SPIN_LOCKED(&exp->exp_obd->obd_osfs_lock);
for (obj = 0; obj < objcount; obj++) {
for (i = 0; i < objs[obj].ioo_bufcnt; i++, n++) {
long frsize = obd->obd_osfs.os_bsize;
__u64 grant = 0;
- LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
+ //LASSERT_SPIN_LOCKED(&obd->obd_osfs_lock);
LASSERT(frsize);
/* Grant some fraction of the client's requested grant space so that
"current"LPU64"\n", obd->obd_name,
exp->exp_client_uuid.uuid, exp,
fed->fed_grant, want, curgrant);
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
LBUG();
}
}
unsigned long pending = 0;
int i;
- spin_lock(&exp->exp_obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
for (i = 0, lnb = res; i < niocount; i++, lnb++)
pending += lnb->lnb_grant_used;
ofd->ofd_tot_pending, pending);
ofd->ofd_tot_pending -= pending;
- spin_unlock(&exp->exp_obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
}
*nr_local = j;
LASSERT(*nr_local > 0 && *nr_local <= PTLRPC_MAX_BRW_PAGES);
- spin_lock(&exp->exp_obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
filter_grant_incoming(env, exp, oa);
left = filter_grant_space_left(env, exp);
if (oa->o_valid & OBD_MD_FLGRANT)
oa->o_grant = filter_grant(env, exp, oa->o_grant,
oa->o_undirty, left);
- spin_unlock(&exp->exp_obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
rc = dt_write_prep(env, filter_object_child(fo), res, *nr_local, &used);
if (rc == 0) {
if (oa && oa->o_valid & OBD_MD_FLGRANT) {
struct obd_device *obd = filter_obd(ofd);
- spin_lock(&obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
filter_grant_incoming(&env, exp, oa);
if (!(oa->o_flags & OBD_FL_SHRINK_GRANT))
oa->o_grant = 0;
- spin_unlock(&obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
}
rc = filter_preprw_read(&env, ofd, &info->fti_fid,
&info->fti_attr, obj->ioo_bufcnt,
if (exp->exp_connect_flags & OBD_CONNECT_GRANT) {
obd_size left, want;
- spin_lock(&exp->exp_obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
left = filter_grant_space_left(env, exp);
want = data->ocd_grant;
filter_grant(env, exp, fed->fed_grant, want, left);
data->ocd_grant = fed->fed_grant;
- spin_unlock(&exp->exp_obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
CDEBUG(D_CACHE, "%s: cli %s/%p ocd_grant: %d want: "
LPU64" left: "LPU64"\n", exp->exp_obd->obd_name,
if (KEY_IS(KEY_GRANT_SHRINK)) {
struct ost_body *body = (struct ost_body *)val;
/* handle shrink grant */
- spin_lock(&exp->exp_obd->obd_osfs_lock);
+ mutex_down(&ofd->ofd_grant_sem);
filter_grant_incoming(&env, exp, &body->oa);
- spin_unlock(&exp->exp_obd->obd_osfs_lock);
+ mutex_up(&ofd->ofd_grant_sem);
GOTO(out, rc = 0);
}