if (mfd == NULL &&
lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) {
struct mdt_export_data *med = &req->rq_export->exp_mdt_data;
- list_for_each_entry(mfd, &med->med_open_head, mfd_list) {
+ cfs_list_for_each_entry(mfd, &med->med_open_head, mfd_list) {
if (mfd->mfd_old_handle.cookie == handle->cookie)
RETURN (mfd);
}
/* free mfd */
void mdt_mfd_free(struct mdt_file_data *mfd)
{
- LASSERT(list_empty(&mfd->mfd_list));
+ LASSERT(cfs_list_empty(&mfd->mfd_list));
OBD_FREE_RCU(mfd, sizeof *mfd, &mfd->mfd_handle);
}
!S_ISREG(lu_object_attr(&o->mot_obj.mo_lu)))
RETURN(0);
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
if (mdt_ioepoch_opened(o)) {
/* Epoch continues even if there is no writers yet. */
CDEBUG(D_INODE, "continue epoch "LPU64" for "DFID"\n",
o->mot_ioepoch, PFID(mdt_object_fid(o)));
} else {
/* XXX: ->mdt_ioepoch is not initialized at the mount */
- spin_lock(&mdt->mdt_ioepoch_lock);
+ cfs_spin_lock(&mdt->mdt_ioepoch_lock);
if (mdt->mdt_ioepoch < info->mti_replayepoch)
mdt->mdt_ioepoch = info->mti_replayepoch;
else
o->mot_ioepoch = mdt->mdt_ioepoch;
- spin_unlock(&mdt->mdt_ioepoch_lock);
+ cfs_spin_unlock(&mdt->mdt_ioepoch_lock);
CDEBUG(D_INODE, "starting epoch "LPU64" for "DFID"\n",
o->mot_ioepoch, PFID(mdt_object_fid(o)));
cancel = 1;
}
o->mot_ioepoch_count++;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
/* Cancel Size-on-MDS attributes cached on clients for the open case.
* In the truncate case, see mdt_reint_setattr(). */
{
int rc = 0;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
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);
}
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
int rc = MDT_IOEPOCH_CLOSED;
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
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);
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
la = &info->mti_attr.ma_attr;
achange = (info->mti_ioepoch->flags & MF_SOM_CHANGE);
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
o->mot_ioepoch_count--;
tmp_ma = &info->mti_u.som.attr;
mdt_object_som_enable(o, o->mot_ioepoch);
}
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
/* If recovery is needed, tell the client to perform GETATTR under
* the lock. */
if (ret == MDT_IOEPOCH_GETATTR && recovery) {
RETURN(rc ? : ret);
error_up:
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
return rc;
}
!(info->mti_attr.ma_attr.la_valid & LA_SIZE)))
act = MDT_SOM_DISABLE;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
/* 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);
}
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
{
int rc = 0;
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
rc = o->mot_writecount;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
{
int rc = 0;
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
if (o->mot_writecount < 0)
rc = -ETXTBSY;
else
o->mot_writecount++;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
void mdt_write_put(struct mdt_object *o)
{
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
o->mot_writecount--;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
EXIT;
}
{
int rc = 0;
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
if (o->mot_writecount > 0)
rc = -ETXTBSY;
else
o->mot_writecount--;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
RETURN(rc);
}
static void mdt_write_allow(struct mdt_object *o)
{
ENTRY;
- down(&o->mot_ioepoch_sem);
+ cfs_down(&o->mot_ioepoch_sem);
o->mot_writecount++;
- up(&o->mot_ioepoch_sem);
+ cfs_up(&o->mot_ioepoch_sem);
EXIT;
}
return;
}
- spin_lock(&mdt->mdt_transno_lock);
+ cfs_spin_lock(&mdt->mdt_transno_lock);
if (info->mti_transno == 0) {
info->mti_transno = ++ mdt->mdt_last_transno;
} else {
if (info->mti_transno > mdt->mdt_last_transno)
mdt->mdt_last_transno = info->mti_transno;
}
- spin_unlock(&mdt->mdt_transno_lock);
+ cfs_spin_unlock(&mdt->mdt_transno_lock);
CDEBUG(D_INODE, "transno = %llu, last_committed = %llu\n",
info->mti_transno,
mfd,
PFID(mdt_object_fid(mfd->mfd_object)),
info->mti_rr.rr_handle->cookie);
- spin_lock(&med->med_open_lock);
+ cfs_spin_lock(&med->med_open_lock);
class_handle_unhash(&old_mfd->mfd_handle);
- list_del_init(&old_mfd->mfd_list);
- spin_unlock(&med->med_open_lock);
+ cfs_list_del_init(&old_mfd->mfd_list);
+ cfs_spin_unlock(&med->med_open_lock);
mdt_mfd_close(info, old_mfd);
}
CDEBUG(D_HA, "Store old cookie "LPX64" in new mfd\n",
repbody->handle.cookie = mfd->mfd_handle.h_cookie;
if (req->rq_export->exp_disconnected) {
- spin_lock(&med->med_open_lock);
+ cfs_spin_lock(&med->med_open_lock);
class_handle_unhash(&mfd->mfd_handle);
- list_del_init(&mfd->mfd_list);
- spin_unlock(&med->med_open_lock);
+ cfs_list_del_init(&mfd->mfd_list);
+ cfs_spin_unlock(&med->med_open_lock);
mdt_mfd_close(info, mfd);
} else {
- spin_lock(&med->med_open_lock);
- list_add(&mfd->mfd_list, &med->med_open_head);
- spin_unlock(&med->med_open_lock);
+ cfs_spin_lock(&med->med_open_lock);
+ cfs_list_add(&mfd->mfd_list, &med->med_open_head);
+ cfs_spin_unlock(&med->med_open_lock);
}
mdt_empty_transno(info);
struct mdt_body *repbody;
int rc = 0;
int isreg, isdir, islnk;
- struct list_head *t;
+ cfs_list_t *t;
ENTRY;
LASSERT(ma->ma_valid & MA_INODE);
mfd = NULL;
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) {
- spin_lock(&med->med_open_lock);
- list_for_each(t, &med->med_open_head) {
- mfd = list_entry(t, struct mdt_file_data, mfd_list);
+ cfs_spin_lock(&med->med_open_lock);
+ cfs_list_for_each(t, &med->med_open_head) {
+ mfd = cfs_list_entry(t, struct mdt_file_data, mfd_list);
if (mfd->mfd_xid == req->rq_xid) {
break;
}
mfd = NULL;
}
- spin_unlock(&med->med_open_lock);
+ cfs_spin_unlock(&med->med_open_lock);
if (mfd != NULL) {
repbody->handle.cookie = mfd->mfd_handle.h_cookie;
LASSERT(mdt_info_req(info));
med = &mdt_info_req(info)->rq_export->exp_mdt_data;
- spin_lock(&med->med_open_lock);
- list_add(&mfd->mfd_list, &med->med_open_head);
+ cfs_spin_lock(&med->med_open_lock);
+ cfs_list_add(&mfd->mfd_list, &med->med_open_head);
class_handle_hash_back(&mfd->mfd_handle);
- spin_unlock(&med->med_open_lock);
+ cfs_spin_unlock(&med->med_open_lock);
if (ret == MDT_IOEPOCH_OPENED) {
ret = 0;
}
med = &req->rq_export->exp_mdt_data;
- spin_lock(&med->med_open_lock);
+ cfs_spin_lock(&med->med_open_lock);
mfd = mdt_handle2mfd(info, &info->mti_ioepoch->handle);
if (mdt_mfd_closed(mfd)) {
- spin_unlock(&med->med_open_lock);
+ cfs_spin_unlock(&med->med_open_lock);
CDEBUG(D_INODE, "no handle for file close: fid = "DFID
": cookie = "LPX64"\n", PFID(info->mti_rr.rr_fid1),
info->mti_ioepoch->handle.cookie);
rc = -ESTALE;
} else {
class_handle_unhash(&mfd->mfd_handle);
- list_del_init(&mfd->mfd_list);
- spin_unlock(&med->med_open_lock);
+ cfs_list_del_init(&mfd->mfd_list);
+ cfs_spin_unlock(&med->med_open_lock);
/* Do not lose object before last unlink. */
o = mfd->mfd_object;
RETURN(lustre_msg_get_status(req->rq_repmsg));
med = &info->mti_exp->exp_mdt_data;
- spin_lock(&med->med_open_lock);
+ cfs_spin_lock(&med->med_open_lock);
mfd = mdt_handle2mfd(info, &info->mti_ioepoch->handle);
if (mfd == NULL) {
- spin_unlock(&med->med_open_lock);
+ cfs_spin_unlock(&med->med_open_lock);
CDEBUG(D_INODE, "no handle for done write: fid = "DFID
": cookie = "LPX64" ioepoch = "LPU64"\n",
PFID(info->mti_rr.rr_fid1),
LASSERT(mfd->mfd_mode == FMODE_EPOCH ||
mfd->mfd_mode == FMODE_TRUNC);
class_handle_unhash(&mfd->mfd_handle);
- list_del_init(&mfd->mfd_list);
- spin_unlock(&med->med_open_lock);
+ cfs_list_del_init(&mfd->mfd_list);
+ cfs_spin_unlock(&med->med_open_lock);
/* Set EPOCH CLOSE flag if not set by client. */
info->mti_ioepoch->flags |= MF_EPOCH_CLOSE;