/* for ldlm_add_ast_work_item() */
struct list_head l_bl_ast;
struct list_head l_cp_ast;
- struct ldlm_lock *l_blocking_lock;
+ struct ldlm_lock *l_blocking_lock;
int l_bl_ast_run;
};
ldlm_res_iterator_t iter, void *closure);
int ldlm_replay_locks(struct obd_import *imp);
-void ldlm_resource_iterate(struct ldlm_namespace *, struct ldlm_res_id *,
+void ldlm_resource_iterate(struct ldlm_namespace *, const struct ldlm_res_id *,
ldlm_iterator_t iter, void *data);
void ldlm_lock_decref(struct lustre_handle *lockh, __u32 mode);
void ldlm_lock_decref_and_cancel(struct lustre_handle *lockh, __u32 mode);
void ldlm_lock_allow_match(struct ldlm_lock *lock);
-int ldlm_lock_match(struct ldlm_namespace *ns, int flags, struct ldlm_res_id *,
+int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
+ const struct ldlm_res_id *,
ldlm_type_t type, ldlm_policy_data_t *, ldlm_mode_t mode,
struct lustre_handle *);
struct ldlm_resource *ldlm_lock_convert(struct ldlm_lock *lock, int new_mode,
/* resource.c - internal */
struct ldlm_resource *ldlm_resource_get(struct ldlm_namespace *ns,
struct ldlm_resource *parent,
- struct ldlm_res_id, ldlm_type_t type,
- int create);
+ const struct ldlm_res_id *,
+ ldlm_type_t type, int create);
struct ldlm_resource *ldlm_resource_getref(struct ldlm_resource *res);
int ldlm_resource_putref(struct ldlm_resource *res);
void ldlm_resource_add_lock(struct ldlm_resource *res, struct list_head *head,
void ldlm_namespace_dump(int level, struct ldlm_namespace *);
void ldlm_resource_dump(int level, struct ldlm_resource *);
int ldlm_lock_change_resource(struct ldlm_namespace *, struct ldlm_lock *,
- struct ldlm_res_id);
+ const struct ldlm_res_id *);
struct ldlm_callback_suite {
ldlm_completion_callback lcs_completion;
int ldlm_glimpse_ast(struct ldlm_lock *lock, void *reqp);
int ldlm_completion_ast(struct ldlm_lock *lock, int flags, void *data);
int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
- struct ldlm_res_id res_id,
- ldlm_type_t type, ldlm_policy_data_t *policy,
+ const struct ldlm_res_id *res_id,
+ ldlm_type_t type, ldlm_policy_data_t *policy,
ldlm_mode_t mode, int *flags,
ldlm_blocking_callback blocking,
ldlm_completion_callback completion,
int *flags, void *lvb, __u32 lvb_len,
void *lvb_swabber, struct lustre_handle *lockh,
int rc);
-int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id res_id,
+int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
+ const struct ldlm_res_id *res_id,
ldlm_type_t type, ldlm_policy_data_t *policy,
ldlm_mode_t mode, int *flags,
ldlm_blocking_callback blocking,
int ldlm_handle_convert0(struct ptlrpc_request *req,
const struct ldlm_request *dlm_req);
int ldlm_cli_cancel(struct lustre_handle *lockh);
-int ldlm_cli_cancel_unused(struct ldlm_namespace *, struct ldlm_res_id *,
+int ldlm_cli_cancel_unused(struct ldlm_namespace *, const struct ldlm_res_id *,
int flags, void *opaque);
-int ldlm_cli_join_lru(struct ldlm_namespace *, struct ldlm_res_id *, int join);
+int ldlm_cli_join_lru(struct ldlm_namespace *,
+ const struct ldlm_res_id *, int join);
/* mds/handler.c */
/* This has to be here because recursive inclusion sucks. */
/* XXX - if ldlm_lock_new() can sleep we should
* release the ns_lock, allocate the new lock,
* and restart processing this lock. */
- new2 = ldlm_lock_create(ns, NULL, res->lr_name, LDLM_FLOCK,
+ new2 = ldlm_lock_create(ns, NULL, &res->lr_name, LDLM_FLOCK,
lock->l_granted_mode, NULL, NULL, NULL,
NULL, 0);
if (!new2) {
if (*flags != LDLM_FL_WAIT_NOREPROC) {
if (first_enq) {
/* If this is an unlock, reprocess the waitq and
- * send completions ASTs for locks that can now be
+ * send completions ASTs for locks that can now be
* granted. The only problem with doing this
* reprocessing here is that the completion ASTs for
* newly granted locks will be sent before the unlock
LDLM_DEBUG(lock, "client-side enqueue waking up: rc = %d", rc);
RETURN(rc);
-
+
granted:
LDLM_DEBUG(lock, "client-side enqueue granted");
struct ldlm_lock *
ldlm_lock_create(struct ldlm_namespace *ns,
const struct lustre_handle *parent_lock_handle,
- const struct ldlm_res_id,
+ const struct ldlm_res_id *,
ldlm_type_t type, ldlm_mode_t, ldlm_blocking_callback,
ldlm_completion_callback, ldlm_glimpse_callback, void *data,
__u32 lvb_len);
}
int ldlm_lock_change_resource(struct ldlm_namespace *ns, struct ldlm_lock *lock,
- struct ldlm_res_id new_resid)
+ const struct ldlm_res_id *new_resid)
{
struct ldlm_resource *oldres = lock->l_resource;
struct ldlm_resource *newres;
LASSERT(ns->ns_client != 0);
lock_res_and_lock(lock);
- if (memcmp(&new_resid, &lock->l_resource->lr_name,
+ if (memcmp(new_resid, &lock->l_resource->lr_name,
sizeof(lock->l_resource->lr_name)) == 0) {
/* Nothing to do */
unlock_res_and_lock(lock);
RETURN(0);
}
- LASSERT(new_resid.name[0] != 0);
+ LASSERT(new_resid->name[0] != 0);
/* This function assumes that the lock isn't on any lists */
LASSERT(list_empty(&lock->l_res_link));
}
lock_res_and_lock(lock);
- LASSERT(memcmp(&new_resid, &lock->l_resource->lr_name,
+ LASSERT(memcmp(new_resid, &lock->l_resource->lr_name,
sizeof(lock->l_resource->lr_name)) != 0);
lock_res(newres);
lock->l_resource = newres;
check_res_locked(lock->l_resource);
if (new)
ldlm_add_bl_work_item(lock, new, work_list);
- else
+ else
ldlm_add_cp_work_item(lock, work_list);
EXIT;
}
* sometime later.
*/
int ldlm_lock_match(struct ldlm_namespace *ns, int flags,
- struct ldlm_res_id *res_id, ldlm_type_t type,
+ const struct ldlm_res_id *res_id, ldlm_type_t type,
ldlm_policy_data_t *policy, ldlm_mode_t mode,
struct lustre_handle *lockh)
{
mode = old_lock->l_req_mode;
}
- res = ldlm_resource_get(ns, NULL, *res_id, type, 0);
+ res = ldlm_resource_get(ns, NULL, res_id, type, 0);
if (res == NULL) {
LASSERT(old_lock == NULL);
RETURN(0);
/* Returns a referenced lock */
struct ldlm_lock *ldlm_lock_create(struct ldlm_namespace *ns,
const struct lustre_handle *parent_lock_handle,
- const struct ldlm_res_id res_id,
+ const struct ldlm_res_id *res_id,
ldlm_type_t type,
ldlm_mode_t mode,
ldlm_blocking_callback blocking,
* will never call the local blocking_ast until we drop our
* reader/writer reference, which we won't do until we get the
* reply and finish enqueueing. */
-
+
list_for_each_safe(tmp, pos, rpc_list) {
struct ldlm_lock *lock =
list_entry(tmp, struct ldlm_lock, l_cp_ast);
{
struct list_head *tmp;
int i, rc;
-
+
if (ns == NULL)
return;
ldlm_del_waiting_lock(lock);
lock_res_and_lock(lock);
-
+
res = lock->l_resource;
ns = res->lr_namespace;
ldlm_resource_unlink_lock(lock);
unlock_res_and_lock(lock);
-
+
ldlm_lock_destroy(lock);
EXIT;
libcfs_nid2str(imp->imp_connection->c_peer.nid),
lock->l_remote_handle.cookie);
}
- CDEBUG(level, " Resource: %p ("LPU64"/"LPU64"/"LPU64")\n",
+ CDEBUG(level, " Resource: %p ("LPU64"/"LPU64"/"LPU64")\n",
lock->l_resource,
lock->l_resource->lr_name.name[0],
lock->l_resource->lr_name.name[1],
switch (lock->l_resource->lr_type) {
case LDLM_EXTENT:
cdebug(cdls, level, file, func, line,
- " ns: %s lock: %p/"LPX64" lrc: %d/%d,%d mode: %s/%s "
+ " ns: %s lock: %p/"LPX64" lrc: %d/%d,%d mode: %s/%s "
"res: "LPU64"/"LPU64" rrc: %d type: %s ["LPU64"->"LPU64
"] (req "LPU64"->"LPU64") flags: %x remote: "LPX64
" expref: %d pid: %u\n",
/*
* Prolong the lock
- *
+ *
* Called with namespace lock held.
*/
int ldlm_refresh_waiting_lock(struct ldlm_lock *lock)
/* The lock's callback data might be set in the policy function */
lock = ldlm_lock_create(ns, &dlm_req->lock_handle2,
- dlm_req->lock_desc.l_resource.lr_name,
+ &dlm_req->lock_desc.l_resource.lr_name,
dlm_req->lock_desc.l_resource.lr_type,
dlm_req->lock_desc.l_req_mode,
cbs->lcs_blocking, cbs->lcs_completion,
sizeof(lock->l_resource->lr_name)) != 0) {
unlock_res_and_lock(lock);
ldlm_lock_change_resource(ns, lock,
- dlm_req->lock_desc.l_resource.lr_name);
+ &dlm_req->lock_desc.l_resource.lr_name);
LDLM_DEBUG(lock, "completion AST, new resource");
CERROR("change resource!\n");
lock_res_and_lock(lock);
return -ELDLM_NO_LOCK_DATA;
}
-int ldlm_cli_enqueue_local(struct ldlm_namespace *ns, struct ldlm_res_id res_id,
+int ldlm_cli_enqueue_local(struct ldlm_namespace *ns,
+ const struct ldlm_res_id *res_id,
ldlm_type_t type, ldlm_policy_data_t *policy,
ldlm_mode_t mode, int *flags,
ldlm_blocking_callback blocking,
if (policy != NULL)
*policy = lock->l_policy_data;
- if ((*flags) & LDLM_FL_LOCK_CHANGED)
- res_id = lock->l_resource->lr_name;
LDLM_DEBUG_NOLOCK("client-side local enqueue handler END (lock %p)",
lock);
}
if (memcmp(reply->lock_desc.l_resource.lr_name.name,
- lock->l_resource->lr_name.name,
+ lock->l_resource->lr_name.name,
sizeof(struct ldlm_res_id))) {
CDEBUG(D_INFO, "remote intent success, locking "
"(%ld,%ld,%ld) instead of "
(long)lock->l_resource->lr_name.name[2]);
ldlm_lock_change_resource(ns, lock,
- reply->lock_desc.l_resource.lr_name);
+ &reply->lock_desc.l_resource.lr_name);
if (lock->l_resource == NULL) {
LBUG();
GOTO(cleanup, rc = -ENOMEM);
* request was created in ldlm_cli_enqueue and it is the async request,
* pass it to the caller in @reqp. */
int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
- struct ldlm_res_id res_id,
- ldlm_type_t type, ldlm_policy_data_t *policy,
+ const struct ldlm_res_id *res_id,
+ ldlm_type_t type, ldlm_policy_data_t *policy,
ldlm_mode_t mode, int *flags,
ldlm_blocking_callback blocking,
ldlm_completion_callback completion,
}
static int ldlm_cli_cancel_unused_resource(struct ldlm_namespace *ns,
- struct ldlm_res_id res_id, int flags,
- void *opaque)
+ const struct ldlm_res_id *res_id,
+ int flags, void *opaque)
{
struct list_head *tmp, *next, list = CFS_LIST_HEAD_INIT(list);
struct ldlm_resource *res;
res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
if (res == NULL) {
/* This is not a problem. */
- CDEBUG(D_INFO, "No resource "LPU64"\n", res_id.name[0]);
+ CDEBUG(D_INFO, "No resource "LPU64"\n", res_id->name[0]);
RETURN(0);
}
* to notify the server.
* If flags & LDLM_FL_WARN, print a warning if some locks are still in use. */
int ldlm_cli_cancel_unused(struct ldlm_namespace *ns,
- struct ldlm_res_id *res_id, int flags, void *opaque)
+ const struct ldlm_res_id *res_id,
+ int flags, void *opaque)
{
int i;
ENTRY;
RETURN(ELDLM_OK);
if (res_id)
- RETURN(ldlm_cli_cancel_unused_resource(ns, *res_id, flags,
+ RETURN(ldlm_cli_cancel_unused_resource(ns, res_id, flags,
opaque));
spin_lock(&ns->ns_hash_lock);
ldlm_resource_getref(res);
spin_unlock(&ns->ns_hash_lock);
- rc = ldlm_cli_cancel_unused_resource(ns, res->lr_name,
+ rc = ldlm_cli_cancel_unused_resource(ns, &res->lr_name,
flags, opaque);
if (rc)
/* join/split resource locks to/from lru list */
int ldlm_cli_join_lru(struct ldlm_namespace *ns,
- struct ldlm_res_id *res_id, int join)
+ const struct ldlm_res_id *res_id, int join)
{
struct ldlm_resource *res;
struct ldlm_lock *lock, *n;
LASSERT(ns->ns_client == LDLM_NAMESPACE_CLIENT);
- res = ldlm_resource_get(ns, NULL, *res_id, LDLM_EXTENT, 0);
+ res = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
if (res == NULL)
RETURN(count);
LASSERT(res->lr_type == LDLM_EXTENT);
}
/* non-blocking function to manipulate a lock whose cb_data is being put away.*/
-void ldlm_resource_iterate(struct ldlm_namespace *ns, struct ldlm_res_id *res_id,
+void ldlm_resource_iterate(struct ldlm_namespace *ns,
+ const struct ldlm_res_id *res_id,
ldlm_iterator_t iter, void *data)
{
struct ldlm_resource *res;
LBUG();
}
- res = ldlm_resource_get(ns, NULL, *res_id, 0, 0);
+ res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
if (res == NULL) {
EXIT;
return;
int local_only = (flags & LDLM_FL_LOCAL_ONLY);
ENTRY;
-
+
do {
struct ldlm_lock *lock = NULL;
-
+
/* first, we look for non-cleaned-yet lock
* all cleaned locks are marked by CLEANED flag */
lock_res(res);
lock->l_flags |= LDLM_FL_CLEANED;
break;
}
-
+
if (lock == NULL) {
unlock_res(res);
break;
return ELDLM_OK;
}
-static __u32 ldlm_hash_fn(struct ldlm_resource *parent, struct ldlm_res_id name)
+static __u32 ldlm_hash_fn(struct ldlm_resource *parent,
+ const struct ldlm_res_id *name)
{
__u32 hash = 0;
int i;
for (i = 0; i < RES_NAME_SIZE; i++)
- hash += name.name[i];
+ hash += name->name[i];
hash += (__u32)((unsigned long)parent >> 4);
/* must be called with hash lock held */
static struct ldlm_resource *
-ldlm_resource_find(struct ldlm_namespace *ns, struct ldlm_res_id name, __u32 hash)
+ldlm_resource_find(struct ldlm_namespace *ns, const struct ldlm_res_id *name,
+ __u32 hash)
{
struct list_head *bucket, *tmp;
struct ldlm_resource *res;
list_for_each(tmp, bucket) {
res = list_entry(tmp, struct ldlm_resource, lr_hash);
- if (memcmp(&res->lr_name, &name, sizeof(res->lr_name)) == 0)
+ if (memcmp(&res->lr_name, name, sizeof(res->lr_name)) == 0)
return res;
}
* Returns: newly-allocated, referenced, unlocked resource */
static struct ldlm_resource *
ldlm_resource_add(struct ldlm_namespace *ns, struct ldlm_resource *parent,
- struct ldlm_res_id name, __u32 hash, ldlm_type_t type)
+ const struct ldlm_res_id *name, __u32 hash, ldlm_type_t type)
{
struct list_head *bucket;
struct ldlm_resource *res, *old_res;
if (!res)
RETURN(NULL);
- res->lr_name = name;
+ res->lr_name = *name;
res->lr_namespace = ns;
res->lr_type = type;
res->lr_most_restr = LCK_NL;
rc = ns->ns_lvbo->lvbo_init(res);
if (rc)
CERROR("lvbo_init failed for resource "
- LPU64": rc %d\n", name.name[0], rc);
+ LPU64": rc %d\n", name->name[0], rc);
/* we create resource with locked lr_lvb_sem */
up(&res->lr_lvb_sem);
}
* Returns: referenced, unlocked ldlm_resource or NULL */
struct ldlm_resource *
ldlm_resource_get(struct ldlm_namespace *ns, struct ldlm_resource *parent,
- struct ldlm_res_id name, ldlm_type_t type, int create)
+ const struct ldlm_res_id *name, ldlm_type_t type, int create)
{
__u32 hash = ldlm_hash_fn(parent, name);
struct ldlm_resource *res = NULL;
LASSERT(ns != NULL);
LASSERT(ns->ns_hash != NULL);
- LASSERT(name.name[0] != 0);
+ LASSERT(name->name[0] != 0);
spin_lock(&ns->ns_hash_lock);
res = ldlm_resource_find(ns, name, hash);
lock_res(res);
ldlm_resource_dump(level, res);
unlock_res(res);
-
+
spin_lock(&ns->ns_hash_lock);
tmp = tmp->next;
ldlm_resource_putref_locked(res);
if (body->valid & OBD_MD_FLATIME &&
body->atime > LTIME_S(st->st_atime))
LTIME_S(st->st_atime) = body->atime;
-
+
/* mtime is always updated with ctime, but can be set in past.
As write and utime(2) may happen within 1 second, and utime's
- mtime has a priority over write's one, so take mtime from mds
+ mtime has a priority over write's one, so take mtime from mds
for the same ctimes. */
if (body->valid & OBD_MD_FLCTIME &&
body->ctime >= LTIME_S(st->st_ctime)) {
struct ptlrpc_request *request = NULL;
int rc;
ENTRY;
-
+
llu_prep_md_op_data(op_data, inode, NULL, NULL, 0, 0);
rc = md_setattr(sbi->ll_md_exp, op_data, NULL, 0, NULL, 0, &request);
struct intnl_stat *st = llu_i2stat(inode);
int rc = 0;
ENTRY;
-
+
LASSERT(op_data != NULL);
if (!S_ISREG(st->st_mode))
RETURN(0);
attr->ia_valid |= ATTR_MTIME_SET;
}
if ((attr->ia_valid & ATTR_CTIME) && !(attr->ia_valid & ATTR_MTIME)) {
- /* To avoid stale mtime on mds, obtain it from ost and send
+ /* To avoid stale mtime on mds, obtain it from ost and send
to mds. */
rc = llu_glimpse_size(inode);
- if (rc)
+ if (rc)
RETURN(rc);
-
+
attr->ia_valid |= ATTR_MTIME_SET | ATTR_MTIME;
attr->ia_mtime = inode->i_stbuf.st_mtime;
}
}
}
-
+
/* Won't invoke llu_vmtruncate(), as we already cleared
* ATTR_SIZE */
inode_setattr(inode, attr);
if (!rc)
rc = err;
}
-
+
if (op_data.ioepoch)
rc = llu_setattr_done_writing(inode, &op_data);
} else if (ia_valid & (ATTR_MTIME | ATTR_MTIME_SET)) {
"start="LPU64", end="LPU64"\n", st->st_ino, flock.l_flock.pid,
flags, mode, flock.l_flock.start, flock.l_flock.end);
- rc = ldlm_cli_enqueue(llu_i2mdcexp(ino), NULL, res_id,
- LDLM_FLOCK, &flock, mode, &flags, NULL,
- ldlm_flock_completion_ast, NULL,
+ rc = ldlm_cli_enqueue(llu_i2mdcexp(ino), NULL, &res_id,
+ LDLM_FLOCK, &flock, mode, &flags, NULL,
+ ldlm_flock_completion_ast, NULL,
file_lock, NULL, 0, NULL, &lockh, 0);
RETURN(rc);
}
static int llu_lov_dir_setstripe(struct inode *ino, unsigned long arg)
{
- struct llu_sb_info *sbi = llu_i2sbi(ino);
+ struct llu_sb_info *sbi = llu_i2sbi(ino);
struct ptlrpc_request *request = NULL;
struct md_op_data op_data;
struct lov_user_md lum, *lump = (struct lov_user_md *)arg;
static int llu_lov_setstripe_ea_info(struct inode *ino, int flags,
struct lov_user_md *lum, int lum_size)
{
- struct llu_sb_info *sbi = llu_i2sbi(ino);
+ struct llu_sb_info *sbi = llu_i2sbi(ino);
struct llu_inode_info *lli = llu_i2info(ino);
struct llu_inode_info *lli2 = NULL;
struct lov_stripe_md *lsm;
OBD_ALLOC(lli2, sizeof(struct llu_inode_info));
if (!lli2)
return -ENOMEM;
-
+
memcpy(lli2, lli, sizeof(struct llu_inode_info));
lli2->lli_open_count = 0;
lli2->lli_it = NULL;
llu_md_blocking_ast, NULL, LDLM_FL_INTENT_ONLY);
if (rc)
GOTO(out, rc);
-
+
req = oit.d.lustre.it_data;
rc = it_open_error(DISP_IT_EXECD, &oit);
if (rc) {
req->rq_replay = 0;
GOTO(out, rc);
}
-
+
rc = it_open_error(DISP_OPEN_OPEN, &oit);
if (rc) {
req->rq_replay = 0;
GOTO(out, rc);
}
-
+
rc = md_get_lustre_md(sbi->ll_md_exp, req,
1, sbi->ll_dt_exp, sbi->ll_md_exp, &md);
if (rc)
GOTO(out, rc);
-
+
llu_update_inode(ino, md.body, md.lsm);
lli->lli_smd = lli2->lli_smd;
lli2->lli_smd = NULL;
llu_local_open(lli2, &oit);
-
+
/* release intent */
if (lustre_handle_is_used(&lockh))
ldlm_lock_decref(&lockh, LCK_CR);
ptlrpc_req_finished(req);
req = NULL;
-
+
rc = llu_file_release(ino);
out:
ino->i_private = lli;
return llu_lov_file_setstripe(ino, arg);
if (S_ISDIR(st->st_mode))
return llu_lov_dir_setstripe(ino, arg);
-
- return -EINVAL;
+
+ return -EINVAL;
}
static int llu_lov_getstripe(struct inode *ino, unsigned long arg)
struct obd_client_handle *och)
{
ENTRY;
-
+
op_data->attr.ia_valid = ATTR_MODE | ATTR_ATIME_SET |
ATTR_MTIME_SET | ATTR_CTIME_SET;
if (!(och->och_flags & FMODE_WRITE))
goto out;
-
+
if (!S_ISREG(inode->i_mode))
op_data->attr.ia_valid |= ATTR_SIZE | ATTR_BLOCKS;
else
obd = class_exp2obd(ll_i2mdexp(inode));
if (obd == NULL) {
- /*
- * XXX: in case of LMV, is this correct to access
- * ->exp_handle?
+ /*
+ * XXX: in case of LMV, is this correct to access
+ * ->exp_handle?
*/
CERROR("Invalid MDC connection handle "LPX64"\n",
ll_i2mdexp(inode)->exp_handle.h_cookie);
GOTO(out, rc = -ENOMEM);
ll_prepare_close(inode, op_data, och);
- epoch_close = (och->och_flags & FMODE_WRITE) &&
- ((op_data->flags & MF_EPOCH_CLOSE) ||
+ epoch_close = (och->och_flags & FMODE_WRITE) &&
+ ((op_data->flags & MF_EPOCH_CLOSE) ||
!S_ISREG(inode->i_mode));
rc = md_close(md_exp, op_data, och, &req);
if (rc == -EAGAIN) {
/* This close must have closed the epoch. */
LASSERT(epoch_close);
- /* MDS has instructed us to obtain Size-on-MDS attribute from
+ /* MDS has instructed us to obtain Size-on-MDS attribute from
* OSTs and send setattr to back to MDS. */
rc = ll_sizeonmds_update(inode, &och->och_fh);
if (rc) {
CERROR("inode %lu mdc close failed: rc = %d\n",
inode->i_ino, rc);
}
-
+
if (!epoch_close && (och->och_flags & FMODE_WRITE))
ll_queue_done_writing(inode, LLIF_DONE_WRITING);
if (och) { /* There might be a race and somebody have freed this och
already */
- rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
+ rc = ll_close_inode_openhandle(ll_i2sbi(inode)->ll_md_exp,
inode, och);
/* Do not free @och is it is waiting for DONE_WRITING. */
if (och->och_fh.cookie == DEAD_HANDLE_MAGIC)
CERROR("Releasing a file %p with negative dentry %p. Name %s",
file, file->f_dentry, file->f_dentry->d_name.name);
}
-
+
LUSTRE_FPRIVATE(file) = NULL;
ll_file_data_put(fd);
ll_capa_close(inode);
* parameters. No need for the open lock */
if (!lmm && !lmmsize)
itp->it_flags |= MDS_OPEN_LOCK;
-
+
op_data = ll_prep_md_op_data(NULL, parent->d_inode, NULL, name, len,
O_RDWR);
if (op_data == NULL)
rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, lli, it, och);
if (rc)
RETURN(rc);
-
+
body = lustre_msg_buf(req->rq_repmsg,
DLM_REPLY_REC_OFF, sizeof(*body));
- if ((it->it_flags & FMODE_WRITE) &&
+ if ((it->it_flags & FMODE_WRITE) &&
(body->valid & OBD_MD_FLSIZE))
{
CDEBUG(D_INODE, "Epoch "LPU64" opened on "DFID"\n",
lli->lli_ioepoch, PFID(&lli->lli_fid));
}
}
-
+
LUSTRE_FPRIVATE(file) = fd;
ll_readahead_init(inode, &fd->fd_ras);
fd->fd_omode = it->it_flags;
* first before coming here, so if we got here, we either came
* from NFS or all access checks ar eok, so it is safe to set
* this flag in any case (XXX - race with chmod?)
- */
+ */
oit.it_flags |= MDS_OPEN_OWNEROVERRIDE;
/* We do not want O_EXCL here, presumably we opened the file
req = it->d.lustre.it_data;
/* md_intent_lock() didn't get a request ref if there was an
- * open error, so don't do cleanup on the request here
+ * open error, so don't do cleanup on the request here
* (bug 3430) */
/* XXX (green): Should not we bail out on any error here, not
* just open error? */
l_flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
/* check to see if another DLM lock covers this page b=2765 */
rc2 = ldlm_lock_match(lock->l_resource->lr_namespace,
- l_flags, &lock->l_resource->lr_name,
+ l_flags, &lock->l_resource->lr_name,
LDLM_EXTENT, &tmpex, LCK_PR | LCK_PW, &lockh);
-
+
if (rc2 <= 0 && page->mapping != NULL) {
struct ll_async_page *llap = llap_cast_private(page);
// checking again to account for writeback's lock_page()
if (lli->lli_smd->lsm_stripe_count == 0)
RETURN(0);
-
+
rc = obd_match(sbi->ll_dt_exp, lli->lli_smd, LDLM_EXTENT,
&policy, LCK_PR | LCK_PW, &flags, inode, &lockh);
if (rc < 0)
RETURN(rc);
else if (rc == 0)
RETURN(-ENODATA);
-
+
ll_merge_lvb(inode);
obd_cancel(sbi->ll_dt_exp, lli->lli_smd, LCK_PR | LCK_PW, &lockh);
RETURN(0);
struct obd_info oinfo = { { { 0 } } };
struct ost_lvb lvb;
int rc;
-
+
ENTRY;
-
+
einfo.ei_type = LDLM_EXTENT;
einfo.ei_mode = LCK_PR;
einfo.ei_flags = LDLM_FL_HAS_INTENT;
"returning -EIO\n", rc);
RETURN(rc > 0 ? -EIO : rc);
}
-
+
lov_stripe_lock(lsm);
memset(&lvb, 0, sizeof(lvb));
obd_merge_lvb(sbi->ll_dt_exp, lsm, &lvb, 0);
st->st_atime = lvb.lvb_atime;
st->st_ctime = lvb.lvb_ctime;
lov_stripe_unlock(lsm);
-
+
RETURN(rc);
}
if (lli->lli_flags & LLIF_MDS_SIZE_LOCK)
RETURN(0);
-
+
CDEBUG(D_DLMTRACE, "Glimpsing inode %lu\n", inode->i_ino);
if (!lli->lli_smd) {
}
ll_merge_lvb(inode);
-
+
CDEBUG(D_DLMTRACE, "glimpse: size: %llu, blocks: %lu\n",
inode->i_size, inode->i_blocks);
} else {
end = *ppos + count - 1;
}
-
+
node = ll_node_from_inode(inode, *ppos, end, LCK_PR);
tree.lt_fd = LUSTRE_FPRIVATE(file);
rc = ll_tree_lock(&tree, node, buf, count,
"start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
flags, mode, flock.l_flock.start, flock.l_flock.end);
- rc = ldlm_cli_enqueue(sbi->ll_md_exp, NULL, res_id,
- LDLM_FLOCK, &flock, mode, &flags, NULL,
+ rc = ldlm_cli_enqueue(sbi->ll_md_exp, NULL, &res_id,
+ LDLM_FLOCK, &flock, mode, &flags, NULL,
ldlm_flock_completion_ast, NULL, file_lock,
NULL, 0, NULL, &lockh, 0);
RETURN(rc);
CDEBUG(D_INFO, "trying to match res "DFID"\n", PFID(fid));
flags = LDLM_FL_BLOCK_GRANTED | LDLM_FL_CBPENDING | LDLM_FL_TEST_LOCK;
- if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy,
+ if (md_lock_match(ll_i2mdexp(inode), flags, fid, LDLM_IBITS, &policy,
LCK_CR|LCK_CW|LCK_PR, &lockh)) {
RETURN(1);
}
rc = ll_inode_revalidate_fini(inode, rc);
GOTO (out, rc);
}
-
+
rc = ll_revalidate_it_finish(req, DLM_REPLY_REC_OFF, &oit, dentry);
if (rc != 0) {
ll_intent_release(&oit);
if (S_ISREG(inode->i_mode)) {
rc = ll_get_max_mdsize(sbi, &ealen);
- if (rc)
- RETURN(rc);
+ if (rc)
+ RETURN(rc);
valid |= OBD_MD_FLEASIZE | OBD_MD_FLMODEASIZE;
}
oc = ll_mdscapa_get(inode);
if (rc)
GOTO(out, rc);
}
-
+
/* if object not yet allocated, don't validate size */
- if (ll_i2info(inode)->lli_smd == NULL)
+ if (ll_i2info(inode)->lli_smd == NULL)
GOTO(out, rc = 0);
/* ll_glimpse_size will prefer locally cached writes if they extend
#include <linux/lustre_acl.h>
#include <obd_class.h>
#include <lustre_dlm.h>
+/* fid_res_name_eq() */
+#include <lustre_fid.h>
#include <lprocfs_status.h>
#include "mdc_internal.h"
* rpcs in flight counter */
mdc_get_rpc_lock(obddev->u.cli.cl_rpc_lock, it);
mdc_enter_request(&obddev->u.cli);
- rc = ldlm_cli_enqueue(exp, &req, res_id, lock_type, &policy,
+ rc = ldlm_cli_enqueue(exp, &req, &res_id, lock_type, &policy,
lock_mode, &flags, cb_blocking, cb_completion,
NULL, cb_data, NULL, 0, NULL, lockh, 0);
mdc_exit_request(&obddev->u.cli);
res_id.name[0] = de->d_inode->i_ino;
res_id.name[1] = de->d_inode->i_generation;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id,
LDLM_IBITS, &policy, lock_mode, &flags,
ldlm_blocking_ast, ldlm_completion_ast,
NULL, NULL, 0, NULL, lockh);
}
/* mds/mds_reint.c */
-int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
+int res_gt(const struct ldlm_res_id *res1, const struct ldlm_res_id *res2,
ldlm_policy_data_t *p1, ldlm_policy_data_t *p2);
-int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
+int enqueue_ordered_locks(struct obd_device *obd,
+ const struct ldlm_res_id *p1_res_id,
struct lustre_handle *p1_lockh, int p1_lock_mode,
ldlm_policy_data_t *p1_policy,
- struct ldlm_res_id *p2_res_id,
+ const struct ldlm_res_id *p2_res_id,
struct lustre_handle *p2_lockh, int p2_lock_mode,
ldlm_policy_data_t *p2_policy);
void mds_commit_cb(struct obd_device *, __u64 last_rcvd, void *data, int error);
/* mds/mds_log.c */
-int mds_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+int mds_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
struct obd_device *tgt, int count,
struct llog_catid *logid, struct obd_uuid *uuid);
int mds_llog_finish(struct obd_device *obd, int count);
int mds_lov_clear_orphans(struct mds_obd *mds, struct obd_uuid *ost_uuid);
void mds_lov_update_objids(struct obd_device *obd, obd_id *ids);
int mds_lov_set_nextid(struct obd_device *obd);
-int mds_lov_start_synchronize(struct obd_device *obd,
+int mds_lov_start_synchronize(struct obd_device *obd,
struct obd_device *watched,
void *data, int nonblock);
int mds_post_mds_lovconf(struct obd_device *obd);
int mds_done_writing(struct ptlrpc_request *req, int offset);
/*mds/mds_join.c*/
-int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req,
+int mds_join_file(struct mds_update_record *rec, struct ptlrpc_request *req,
struct dentry *dchild, struct lustre_handle *lockh);
/* mds/mds_fs.c */
if (rc)
GOTO(out_oa, rc);
}
- rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa,
+ rc = obd_create(mds->mds_osc_exp, oinfo.oi_oa,
&oinfo.oi_md, &oti);
if (rc) {
int level = D_ERROR;
}
if (inode->i_size) {
oinfo.oi_oa->o_size = inode->i_size;
- obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE |
- OBD_MD_FLATIME | OBD_MD_FLMTIME |
+ obdo_from_inode(oinfo.oi_oa, inode, OBD_MD_FLTYPE |
+ OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME | OBD_MD_FLSIZE);
/* pack lustre id to OST */
if (child_lockh == NULL)
child_lockh = &lockh;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
LDLM_PLAIN, NULL, LCK_EX, &lock_flags,
ldlm_blocking_ast, ldlm_completion_ast,
NULL, NULL, 0, NULL, child_lockh);
else
child_mode = LCK_CR;
- if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) &&
+ if (!(lustre_msg_get_flags(req->rq_reqmsg) & MSG_REPLAY) &&
(rec->ur_flags & MDS_OPEN_LOCK)) {
/* In case of replay we do not get a lock assuming that the
caller has it already */
child_res_id.name[0] = dchild->d_inode->i_ino;
child_res_id.name[1] = dchild->d_inode->i_generation;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
- LDLM_IBITS, &policy, child_mode,
- &lock_flags, ldlm_blocking_ast,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &child_res_id,
+ LDLM_IBITS, &policy, child_mode,
+ &lock_flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL,
0, NULL, child_lockh);
if (rc != ELDLM_OK)
oinfo.oi_oa->o_gid = gid;
oinfo.oi_oa->o_id = oinfo.oi_md->lsm_object_id;
oinfo.oi_oa->o_gr = oinfo.oi_md->lsm_object_gr;
- oinfo.oi_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
+ oinfo.oi_oa->o_valid |= OBD_MD_FLID | OBD_MD_FLGROUP |
OBD_MD_FLUID | OBD_MD_FLGID;
if (logcookies) {
oinfo.oi_oa->o_valid |= OBD_MD_FLCOOKIE;
int lmm_size = 0, need_lock = 1, cookie_size = 0;
int rc = 0, cleanup_phase = 0, err, locked = 0;
unsigned int qcids[MAXQUOTAS] = { 0, 0 };
- unsigned int qpids[MAXQUOTAS] = { rec->ur_iattr.ia_uid,
+ unsigned int qpids[MAXQUOTAS] = { rec->ur_iattr.ia_uid,
rec->ur_iattr.ia_gid };
ENTRY;
err = mds_finish_transno(mds, inode, handle, req, rc, 0);
/* do mds to ost setattr if needed */
if (!rc && !err && lmm_size)
- mds_osc_setattr_async(obd, inode->i_ino, inode->i_generation, lmm,
+ mds_osc_setattr_async(obd, inode->i_ino, inode->i_generation, lmm,
lmm_size, logcookies, rec->ur_fid1->id,
rec->ur_fid1->generation, NULL);
return 0;
}
-int res_gt(struct ldlm_res_id *res1, struct ldlm_res_id *res2,
+int res_gt(const struct ldlm_res_id *res1, const struct ldlm_res_id *res2,
ldlm_policy_data_t *p1, ldlm_policy_data_t *p2)
{
int i;
*
* One or two locks are taken in numerical order. A res_id->name[0] of 0 means
* no lock is taken for that res_id. Must be at least one non-zero res_id. */
-int enqueue_ordered_locks(struct obd_device *obd, struct ldlm_res_id *p1_res_id,
+int enqueue_ordered_locks(struct obd_device *obd,
+ const struct ldlm_res_id *p1_res_id,
struct lustre_handle *p1_lockh, int p1_lock_mode,
ldlm_policy_data_t *p1_policy,
- struct ldlm_res_id *p2_res_id,
+ const struct ldlm_res_id *p2_res_id,
struct lustre_handle *p2_lockh, int p2_lock_mode,
ldlm_policy_data_t *p2_policy)
{
- struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id };
+ const struct ldlm_res_id *res_id[2] = { p1_res_id, p2_res_id };
struct lustre_handle *handles[2] = { p1_lockh, p2_lockh };
int lock_modes[2] = { p1_lock_mode, p2_lock_mode };
ldlm_policy_data_t *policies[2] = {p1_policy, p2_policy};
res_id[0]->name[0], res_id[1]->name[0]);
flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, *res_id[0],
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id[0],
LDLM_IBITS, policies[0], lock_modes[0],
- &flags, ldlm_blocking_ast,
- ldlm_completion_ast, NULL, NULL, 0,
+ &flags, ldlm_blocking_ast,
+ ldlm_completion_ast, NULL, NULL, 0,
NULL, handles[0]);
if (rc != ELDLM_OK)
RETURN(-EIO);
ldlm_lock_addref(handles[1], lock_modes[1]);
} else if (res_id[1]->name[0] != 0) {
flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, *res_id[1],
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id[1],
LDLM_IBITS, policies[1],
- lock_modes[1], &flags,
+ lock_modes[1], &flags,
ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL,
0, NULL, handles[1]);
RETURN(0);
}
-static inline int res_eq(struct ldlm_res_id *res1, struct ldlm_res_id *res2)
+static inline int res_eq(const struct ldlm_res_id *res1,
+ const struct ldlm_res_id *res2)
{
return !memcmp(res1, res2, sizeof(*res1));
}
static inline void
-try_to_aggregate_locks(struct ldlm_res_id *res1, ldlm_policy_data_t *p1,
- struct ldlm_res_id *res2, ldlm_policy_data_t *p2)
+try_to_aggregate_locks(const struct ldlm_res_id *res1, ldlm_policy_data_t *p1,
+ const struct ldlm_res_id *res2, ldlm_policy_data_t *p2)
{
if (!res_eq(res1, res2))
return;
p1->l_inodebits.bits |= p2->l_inodebits.bits;
}
-int enqueue_4ordered_locks(struct obd_device *obd,struct ldlm_res_id *p1_res_id,
+int enqueue_4ordered_locks(struct obd_device *obd,
+ const struct ldlm_res_id *p1_res_id,
struct lustre_handle *p1_lockh, int p1_lock_mode,
ldlm_policy_data_t *p1_policy,
- struct ldlm_res_id *p2_res_id,
+ const struct ldlm_res_id *p2_res_id,
struct lustre_handle *p2_lockh, int p2_lock_mode,
ldlm_policy_data_t *p2_policy,
- struct ldlm_res_id *c1_res_id,
+ const struct ldlm_res_id *c1_res_id,
struct lustre_handle *c1_lockh, int c1_lock_mode,
ldlm_policy_data_t *c1_policy,
- struct ldlm_res_id *c2_res_id,
+ const struct ldlm_res_id *c2_res_id,
struct lustre_handle *c2_lockh, int c2_lock_mode,
ldlm_policy_data_t *c2_policy)
{
- struct ldlm_res_id *res_id[5] = { p1_res_id, p2_res_id,
- c1_res_id, c2_res_id };
+ const struct ldlm_res_id *res_id[5] = { p1_res_id, p2_res_id,
+ c1_res_id, c2_res_id };
struct lustre_handle *dlm_handles[5] = { p1_lockh, p2_lockh,
c1_lockh, c2_lockh };
int lock_modes[5] = { p1_lock_mode, p2_lock_mode,
try_to_aggregate_locks(res_id[i], policies[i],
res_id[i+1], policies[i+1]);
rc = ldlm_cli_enqueue_local(obd->obd_namespace,
- *res_id[i], LDLM_IBITS,
+ res_id[i], LDLM_IBITS,
policies[i], lock_modes[i],
&flags, ldlm_blocking_ast,
- ldlm_completion_ast, NULL,
- NULL, 0, NULL,
+ ldlm_completion_ast, NULL,
+ NULL, 0, NULL,
dlm_handles[i]);
if (rc != ELDLM_OK)
GOTO(out_err, rc = -EIO);
* Returns 1 if the child changed and we need to re-lock (no locks held).
* Returns -ve error with a valid dchild (no locks held). */
static int mds_verify_child(struct obd_device *obd,
- struct ldlm_res_id *parent_res_id,
+ const struct ldlm_res_id *parent_res_id,
struct lustre_handle *parent_lockh,
struct dentry *dparent, int parent_mode,
struct ldlm_res_id *child_res_id,
struct dentry **dchildp, int child_mode,
ldlm_policy_data_t *child_policy,
const char *name, int namelen,
- struct ldlm_res_id *maxres)
+ const struct ldlm_res_id *maxres)
{
struct dentry *vchild, *dchild = *dchildp;
int rc = 0, cleanup_phase = 2; /* parent, child locks */
GOTO(cleanup, rc = 1);
}
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, *child_res_id,
- LDLM_IBITS, child_policy,
- child_mode, &flags,
- ldlm_blocking_ast,
- ldlm_completion_ast, NULL,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, child_res_id,
+ LDLM_IBITS, child_policy,
+ child_mode, &flags,
+ ldlm_blocking_ast,
+ ldlm_completion_ast, NULL,
NULL, 0, NULL, child_lockh);
if (rc != ELDLM_OK)
GOTO(cleanup, rc = -EIO);
child_res_id.name[1] = inode->i_generation;
/* If we want a LCK_CR for a directory, and this directory has not been
- changed for some time, we return not only a LOOKUP lock, but also an
+ changed for some time, we return not only a LOOKUP lock, but also an
UPDATE lock to have negative dentry starts working for this dir.
Also we apply same logic to non-directories. If the file is rarely
changed - we return both locks and this might save us RPC on
CDEBUG(D_INFO, "Shrink to md_size %d cookie_size %d \n", md_size,
cookie_size);
-
+
lustre_shrink_reply(req, md_off, md_size, 1);
-
- lustre_shrink_reply(req, md_off + (md_size > 0), cookie_size, 0);
+
+ lustre_shrink_reply(req, md_off + (md_size > 0), cookie_size, 0);
}
static int mds_reint_unlink(struct mds_update_record *rec, int offset,
rec->ur_fid1->id, rec->ur_fid1->generation, rec->ur_name,
rec->ur_fid2->id, rec->ur_fid2->generation, rec->ur_tgt);
lprocfs_counter_incr(obd->obd_stats, LPROC_MDS_RENAME);
-
+
MDS_CHECK_RESENT(req, mds_reconstruct_generic(req));
rc = mds_get_parents_children_locked(obd, mds, rec->ur_fid1, &de_srcdir,
struct lu_fid mti_tmp_fid1;
struct lu_fid mti_tmp_fid2;
- ldlm_policy_data_t mti_policy; /* for mdt_object_lock() */
- struct ldlm_res_id mti_res_id; /* for mdt_object_lock() */
+ ldlm_policy_data_t mti_policy; /* for mdt_object_lock() and
+ * mdt_rename_lock() */
+ struct ldlm_res_id mti_res_id; /* for mdt_object_lock() and
+ mdt_rename_lock() */
union {
struct obd_uuid uuid[2]; /* for mdt_seq_init_cli() */
char ns_name[48]; /* for mdt_init0() */
struct lustre_handle *lh,
ldlm_mode_t mode,
ldlm_policy_data_t *policy,
- struct ldlm_res_id *res_id,
+ const struct ldlm_res_id *res_id,
int flags)
{
int rc;
LASSERT(ns != NULL);
LASSERT(lh != NULL);
- rc = ldlm_cli_enqueue_local(ns, *res_id, LDLM_IBITS, policy,
+ rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
mode, &flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL,
0, NULL, lh);
int rc;
ENTRY;
- DEBUG_REQ(D_INODE, mdt_info_req(info), "partial create "DFID"\n",
+ DEBUG_REQ(D_INODE, mdt_info_req(info), "partial create "DFID"\n",
PFID(info->mti_rr.rr_fid2));
repbody = req_capsule_server_get(&info->mti_pill, &RMF_MDT_BODY);
if (mdt_object_exists(o) == 1) {
rc = mo_attr_get(info->mti_env, next, ma);
} else {
- rc = mo_object_create(info->mti_env, next,
+ rc = mo_object_create(info->mti_env, next,
&info->mti_spec, ma);
}
if (rc == 0) {
parent_lh = &info->mti_lh[MDT_LH_PARENT];
mdt_lock_pdo_init(parent_lh, LCK_PW, rr->rr_name,
rr->rr_namelen);
-
+
mp = mdt_object_find_lock(info, rr->rr_fid1, parent_lh,
MDS_INODELOCK_UPDATE);
if (IS_ERR(mp))
if (rr->rr_name[0] == 0) {
/* remote partial operation
* It is possible that replay can happen on parent MDS
- * and this operation will be repeated.
+ * and this operation will be repeated.
* Therefore the object absense is allowed case
* and nothing should be done
*/
static int mdt_rename_lock(struct mdt_thread_info *info,
struct lustre_handle *lh)
{
- ldlm_policy_data_t policy = { .l_inodebits = { MDS_INODELOCK_UPDATE } };
- struct ldlm_namespace *ns = info->mti_mdt->mdt_namespace;
- struct ldlm_res_id res_id;
- struct lu_site *ls;
+ struct ldlm_namespace *ns = info->mti_mdt->mdt_namespace;
+ ldlm_policy_data_t *policy = &info->mti_policy;
+ struct ldlm_res_id *res_id = &info->mti_res_id;
+ struct lu_site *ls;
int rc;
ENTRY;
ls = info->mti_mdt->mdt_md_dev.md_lu_dev.ld_site;
- fid_build_reg_res_name(&LUSTRE_BFL_FID, &res_id);
+ fid_build_reg_res_name(&LUSTRE_BFL_FID, res_id);
+
+ memset(policy, 0, sizeof *policy);
+ policy->l_inodebits.bits = MDS_INODELOCK_UPDATE;
if (ls->ls_control_exp == NULL) {
int flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
-
+
/*
* Current node is controller, that is mdt0, where we should
* take BFL lock.
*/
- rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, &policy,
+ rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
LCK_EX, &flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL, 0,
NULL, lh);
} else {
int flags = 0;
-
+
/*
* This is the case mdt0 is remote node, issue DLM lock like
* other clients.
*/
rc = ldlm_cli_enqueue(ls->ls_control_exp, NULL, res_id,
- LDLM_IBITS, &policy, LCK_EX, &flags,
+ LDLM_IBITS, policy, LCK_EX, &flags,
ldlm_blocking_ast, ldlm_completion_ast,
NULL, NULL, NULL, 0, NULL, lh, 0);
}
mdt_set_capainfo(info, 2, old_fid, BYPASS_CAPA);
mdt_set_capainfo(info, 3, new_fid, BYPASS_CAPA);
-
+
/* Check if @dst is subdir of @src. */
rc = mdt_rename_sanity(info, old_fid);
if (rc)
memcpy(&resname, logname, len);
memset(res_id, 0, sizeof(*res_id));
-
+
/* Always use the same endianness for the resid */
res_id->name[0] = cpu_to_le64(resname);
CDEBUG(D_MGC, "log %s to resid "LPX64"/"LPX64" (%.8s)\n", logname,
RETURN(0);
}
-/* Drop a reference to a config log. When no longer referenced,
+/* Drop a reference to a config log. When no longer referenced,
we can free the config log data */
static void config_log_put(struct config_llog_data *cld)
{
}
/* Find a config log by name */
-static struct config_llog_data *config_log_find(char *logname,
+static struct config_llog_data *config_log_find(char *logname,
struct config_llog_instance *cfg)
{
struct list_head *tmp;
cld->cld_cfg.cfg_flags = 0;
cld->cld_cfg.cfg_sb = sb;
atomic_set(&cld->cld_refcount, 1);
-
+
/* Keep the mgc around until we are done */
cld->cld_mgcexp = class_export_get(lsi->lsi_mgc->obd_self_export);
-
+
if (cfg->cfg_instance != NULL) {
OBD_ALLOC(cld->cld_cfg.cfg_instance,
strlen(cfg->cfg_instance) + 1);
ENTRY;
switch (stage) {
- case OBD_CLEANUP_EARLY:
+ case OBD_CLEANUP_EARLY:
break;
case OBD_CLEANUP_EXPORTS:
break;
ENTRY;
LASSERT(cli->cl_mgc_vfsmnt == NULL);
-
- /* COMPAT_146 - old config logs may have added profiles we don't
+
+ /* COMPAT_146 - old config logs may have added profiles we don't
know about */
- if (obd->obd_type->typ_refcnt <= 1)
+ if (obd->obd_type->typ_refcnt <= 1)
/* Only for the last mgc */
class_del_profiles();
it's needed. */
/* Unsafe - we don't know that the lsi hasn't been destroyed */
server_register_target(cld->cld_cfg.cfg_sb);
-#endif
+#endif
rc = mgc_process_log(cld->cld_mgcexp->exp_obd, cld);
out:
/* We need a callback for every lockholder, so don't try to
ldlm_lock_match (see rev 1.1.2.11.2.47) */
- rc = ldlm_cli_enqueue(exp, NULL, cld->cld_resid,
- type, NULL, mode, flags,
+ rc = ldlm_cli_enqueue(exp, NULL, &cld->cld_resid,
+ type, NULL, mode, flags,
mgc_blocking_ast, ldlm_completion_ast, NULL,
data, NULL, 0, NULL, lockh, 0);
RETURN(-ENOMEM);
req_mti = lustre_msg_buf(req->rq_reqmsg, REQ_REC_OFF, sizeof(*req_mti));
- if (!req_mti)
+ if (!req_mti)
RETURN(-ENOMEM);
memcpy(req_mti, mti, sizeof(*req_mti));
}
int mgc_set_info_async(struct obd_export *exp, obd_count keylen,
- void *key, obd_count vallen, void *val,
+ void *key, obd_count vallen, void *val,
struct ptlrpc_request_set *set)
{
struct obd_import *imp = class_exp2cliimp(exp);
RETURN(-EINVAL);
value = *(int *)val;
imp->imp_initial_recov_bk = value > 0;
- /* Even after the initial connection, give up all comms if
+ /* Even after the initial connection, give up all comms if
nobody answers the first time. */
imp->imp_recon_bk = 1;
- CDEBUG(D_MGC, "InitRecov %s %d/%d:d%d:i%d:r%d:or%d:%s\n",
+ CDEBUG(D_MGC, "InitRecov %s %d/%d:d%d:i%d:r%d:or%d:%s\n",
imp->imp_obd->obd_name, value, imp->imp_initial_recov,
- imp->imp_deactive, imp->imp_invalid,
+ imp->imp_deactive, imp->imp_invalid,
imp->imp_replayable, imp->imp_obd->obd_replayable,
ptlrpc_import_state_name(imp->imp_state));
/* Resurrect if we previously died */
CDEBUG(D_MGC, "import event %#x\n", event);
switch (event) {
- case IMP_EVENT_DISCON:
+ case IMP_EVENT_DISCON:
/* MGC imports should not wait for recovery */
ptlrpc_invalidate_import(imp);
break;
- case IMP_EVENT_INACTIVE:
+ case IMP_EVENT_INACTIVE:
break;
case IMP_EVENT_INVALIDATE: {
struct ldlm_namespace *ns = obd->obd_namespace;
ldlm_namespace_cleanup(ns, LDLM_FL_LOCAL_ONLY);
break;
}
- case IMP_EVENT_ACTIVE:
+ case IMP_EVENT_ACTIVE:
case IMP_EVENT_OCD:
break;
default:
RETURN(rc);
}
-static int mgc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
- struct obd_device *tgt, int count,
+static int mgc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+ struct obd_device *tgt, int count,
struct llog_catid *logid, struct obd_uuid *uuid)
{
struct llog_ctxt *ctxt;
break;
}
case LCFG_LOV_DEL_OBD:
- /* Remove target from the fs? */
+ /* Remove target from the fs? */
/* FIXME */
CERROR("lov_del_obd unimplemented\n");
rc = -ENOSYS;
/* FIXME only set this for old logs! Right now this forces
us to always skip the "inside markers" check */
cld->cld_cfg.cfg_flags |= CFG_F_COMPAT146;
-
+
rc = mgc_process_log(obd, cld);
config_log_put(cld);
int __init mgc_init(void)
{
- return class_register_type(&mgc_obd_ops, NULL, NULL,
+ return class_register_type(&mgc_obd_ops, NULL, NULL,
LUSTRE_MGC_NAME, NULL);
}
rc = mgc_logname2resid(fsname, &res_id);
if (!rc)
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id,
LDLM_PLAIN, NULL, LCK_EX,
&flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL,
RETURN(-ENOMEM);
}
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id, LDLM_PLAIN,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
NULL, LCK_NL, &lock_flags, NULL,
ldlm_completion_ast, NULL, NULL,
0, NULL, &obd->u.echo.eo_nl_lock);
ENTRY;
/* Tell the clients that the object is gone now and that they should
* throw away any cached pages. */
- rc = ldlm_cli_enqueue_local(obd->obd_namespace, res_id, LDLM_EXTENT,
+ rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_EXTENT,
&policy, LCK_PW, &flags, ldlm_blocking_ast,
ldlm_completion_ast, NULL, NULL, 0, NULL,
&lockh);
GOTO(out_unlock, rc);
res = ldlm_resource_get(exp->exp_obd->obd_namespace, NULL,
- res_id, LDLM_EXTENT, 0);
+ &res_id, LDLM_EXTENT, 0);
if (res != NULL) {
ns_lvbo = res->lr_namespace->ns_lvbo;
* and we should update the lvb so that other glimpses will also
* get the updated value. bug 5972 */
if (oa && ns && ns->ns_lvbo && ns->ns_lvbo->lvbo_update) {
- resource = ldlm_resource_get(ns, NULL, res_id, LDLM_EXTENT, 0);
+ resource = ldlm_resource_get(ns, NULL, &res_id, LDLM_EXTENT, 0);
if (resource != NULL) {
ns->ns_lvbo->lvbo_update(resource, NULL, 0, 1);
int rc, size[3] = { sizeof(struct ptlrpc_body), sizeof(*body) };
ENTRY;
- LASSERT(!(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP) ||
+ LASSERT(!(oinfo->oi_oa->o_valid & OBD_MD_FLGROUP) ||
oinfo->oi_oa->o_gr > 0);
size[REQ_REC_OFF + 1] = oinfo->oi_capa ? sizeof(struct lustre_capa) : 0;
req = ptlrpc_prep_req(class_exp2cliimp(exp), LUSTRE_OST_VERSION,
if (pga[i]->count > nob_read) {
/* EOF inside this page */
- ptr = cfs_kmap(pga[i]->pg) +
+ ptr = cfs_kmap(pga[i]->pg) +
(pga[i]->off & ~CFS_PAGE_MASK);
memset(ptr + nob_read, 0, pga[i]->count - nob_read);
cfs_kunmap(pga[i]->pg);
/* We already have a lock, and it's referenced */
oinfo->oi_cb_up(oinfo, ELDLM_OK);
-
+
/* For async requests, decref the lock. */
if (einfo->ei_rqset)
ldlm_lock_decref(oinfo->oi_lockh, einfo->ei_mode);
RETURN(-ENOMEM);
size[DLM_LOCKREPLY_OFF] = sizeof(*rep);
- size[DLM_REPLY_REC_OFF] =
+ size[DLM_REPLY_REC_OFF] =
sizeof(oinfo->oi_md->lsm_oinfo->loi_lvb);
ptlrpc_req_set_repsize(req, 3, size);
}
/* users of osc_enqueue() can pass this flag for ldlm_lock_match() */
einfo->ei_flags &= ~LDLM_FL_BLOCK_GRANTED;
- rc = ldlm_cli_enqueue(exp, &req, res_id, einfo->ei_type,
+ rc = ldlm_cli_enqueue(exp, &req, &res_id, einfo->ei_type,
&oinfo->oi_policy, einfo->ei_mode,
&einfo->ei_flags, einfo->ei_cb_bl,
einfo->ei_cb_cp, einfo->ei_cb_gl,
struct obd_device *obd = exp->exp_obd;
int rc;
ENTRY;
-
+
res_id.name[0] = lsm->lsm_object_id;
res_id.name[2] = lsm->lsm_object_gr;
resp = &res_id;
}
- return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags,
+ return ldlm_cli_cancel_unused(obd->obd_namespace, resp, flags,
opaque);
}
};
static struct llog_operations osc_mds_ost_orig_logops;
-static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
- struct obd_device *tgt, int count,
+static int osc_llog_init(struct obd_device *obd, struct obd_llogs *llogs,
+ struct obd_device *tgt, int count,
struct llog_catid *catid, struct obd_uuid *uuid)
{
int rc;
rc = llog_setup(obd, llogs, LLOG_SIZE_REPL_CTXT, tgt, count, NULL,
&osc_size_repl_logops);
- if (rc)
+ if (rc)
CERROR("failed LLOG_SIZE_REPL_CTXT\n");
out:
if (rc) {
- CERROR("osc '%s' tgt '%s' cnt %d catid %p rc=%d\n",
+ CERROR("osc '%s' tgt '%s' cnt %d catid %p rc=%d\n",
obd->obd_name, tgt->obd_name, count, catid, rc);
CERROR("logid "LPX64":0x%x\n",
catid->lci_logid.lgl_oid, catid->lci_logid.lgl_ogen);
osfs = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*osfs));
- req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
+ req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs,
cfs_time_current_64() - HZ);
if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC))
osfs->os_bfree = osfs->os_bavail = 64;
else
policy.l_extent.end = finis | ~CFS_PAGE_MASK;
- RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, res_id,
+ RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
LDLM_EXTENT, &policy, LCK_PW, &flags,
ldlm_blocking_ast, ldlm_completion_ast,
ldlm_glimpse_ast, NULL, 0, NULL, lh));
policy.l_extent.end = (nb[nrbufs - 1].offset +
nb[nrbufs - 1].len - 1) | ~CFS_PAGE_MASK;
- RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, res_id,
+ RETURN(ldlm_cli_enqueue_local(exp->exp_obd->obd_namespace, &res_id,
LDLM_EXTENT, &policy, mode, &flags,
ldlm_blocking_ast, ldlm_completion_ast,
ldlm_glimpse_ast, NULL, 0, NULL, lh));
static void ost_prolong_locks(struct obd_export *exp, struct obd_ioobj *obj,
struct niobuf_remote *nb, ldlm_mode_t mode)
{
- struct ldlm_res_id res_id = { .name = { obj->ioo_id, 0,
+ struct ldlm_res_id res_id = { .name = { obj->ioo_id, 0,
obj->ioo_gr, 0} };
int nrbufs = obj->ioo_bufcnt;
struct ost_prolong_data opd;