ma->ma_need = MA_INODE | MA_LOV;
ma->ma_valid = 0;
- cfs_down(&o->mot_lov_sem);
+ cfs_mutex_lock(&o->mot_lov_mutex);
if (!(o->mot_flags & MOF_LOV_CREATED)) {
rc = mdo_create_data(info->mti_env,
p ? mdt_object_child(p) : NULL,
if (rc == 0 && ma->ma_valid & MA_LOV)
o->mot_flags |= MOF_LOV_CREATED;
}
- cfs_up(&o->mot_lov_sem);
+ cfs_mutex_unlock(&o->mot_lov_mutex);
RETURN(rc);
}
/**
* Re-enable Size-on-MDS.
- * Call under ->mot_ioepoch_sem.
+ * Call under ->mot_ioepoch_mutex.
*/
static void mdt_object_som_enable(struct mdt_object *mo, __u64 ioepoch)
{
/**
* Open the IOEpoch. It is allowed if @writecount is not negative.
- * The epoch and writecount handling is performed under the mot_ioepoch_sem.
+ * The epoch and writecount handling is performed under the mot_ioepoch_mutex.
*/
int mdt_ioepoch_open(struct mdt_thread_info *info, struct mdt_object *o,
int created)
!S_ISREG(lu_object_attr(&o->mot_obj.mo_lu)))
RETURN(0);
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
if (mdt_ioepoch_opened(o)) {
/* Epoch continues even if there is no writers yet. */
CDEBUG(D_INODE, "continue epoch "LPU64" for "DFID"\n",
cancel = 1;
}
o->mot_ioepoch_count++;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
/* Cancel Size-on-MDS attributes cached on clients for the open case.
* In the truncate case, see mdt_reint_setattr(). */
* Update SOM on-disk attributes.
* If enabling, write update inodes and lustre-ea with the proper IOEpoch,
* mountid and attributes. If disabling, zero IOEpoch id in lustre-ea.
- * Call under ->mot_ioepoch_sem.
+ * Call under ->mot_ioepoch_mutex.
*/
static int mdt_som_attr_set(struct mdt_thread_info *info,
struct mdt_object *obj, __u64 ioepoch, int enable)
{
int rc = 0;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
CDEBUG(D_INODE, "Eviction. Closing IOepoch "LPU64" on "DFID". "
"Count %d\n", o->mot_ioepoch, PFID(mdt_object_fid(o)),
o->mot_ioepoch_count);
rc = mdt_som_attr_set(info, o, o->mot_ioepoch, MDT_SOM_DISABLE);
mdt_object_som_enable(o, o->mot_ioepoch);
}
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
int rc = MDT_IOEPOCH_CLOSED;
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
CDEBUG(D_INODE, "Replay. Closing epoch "LPU64" on "DFID". Count %d\n",
o->mot_ioepoch, PFID(mdt_object_fid(o)), o->mot_ioepoch_count);
o->mot_ioepoch_count--;
if (!mdt_ioepoch_opened(o))
mdt_object_som_enable(o, info->mti_ioepoch->ioepoch);
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
la = &info->mti_attr.ma_attr;
achange = (info->mti_ioepoch->flags & MF_SOM_CHANGE);
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
o->mot_ioepoch_count--;
tmp_ma = &info->mti_u.som.attr;
mdt_object_som_enable(o, o->mot_ioepoch);
}
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
/* If recovery is needed, tell the client to perform GETATTR under
* the lock. */
if (ret == MDT_IOEPOCH_GETATTR && recovery) {
RETURN(rc ? : ret);
error_up:
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
return rc;
}
!(info->mti_attr.ma_attr.la_valid & LA_SIZE)))
act = MDT_SOM_DISABLE;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
/* Mark the object it is the recovery state if we failed to obtain
* SOM attributes. */
if (act == MDT_SOM_DISABLE)
rc = mdt_som_attr_set(info, o, ioepoch, act);
mdt_object_som_enable(o, ioepoch);
}
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
{
int rc = 0;
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
rc = o->mot_writecount;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
{
int rc = 0;
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
if (o->mot_writecount < 0)
rc = -ETXTBSY;
else
o->mot_writecount++;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
void mdt_write_put(struct mdt_object *o)
{
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
o->mot_writecount--;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
EXIT;
}
{
int rc = 0;
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
if (o->mot_writecount > 0)
rc = -ETXTBSY;
else
o->mot_writecount--;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
RETURN(rc);
}
static void mdt_write_allow(struct mdt_object *o)
{
ENTRY;
- cfs_down(&o->mot_ioepoch_sem);
+ cfs_mutex_lock(&o->mot_ioepoch_mutex);
o->mot_writecount++;
- cfs_up(&o->mot_ioepoch_sem);
+ cfs_mutex_unlock(&o->mot_ioepoch_mutex);
EXIT;
}
/* update lcd in memory only for resent cases */
ted = &req->rq_export->exp_target_data;
LASSERT(ted);
- cfs_mutex_down(&ted->ted_lcd_lock);
+ cfs_mutex_lock(&ted->ted_lcd_lock);
lcd = ted->ted_lcd;
if (lustre_msg_get_opc(req->rq_reqmsg) == MDS_CLOSE ||
lustre_msg_get_opc(req->rq_reqmsg) == MDS_DONE_WRITING) {
lcd->lcd_last_result = rc;
lcd->lcd_last_data = info->mti_opdata;
}
- cfs_mutex_up(&ted->ted_lcd_lock);
+ cfs_mutex_unlock(&ted->ted_lcd_lock);
EXIT;
}