* GPL HEADER END
*/
/*
- * Copyright 2008 Sun Microsystems, Inc. All rights reserved
+ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
/* Close the found mfd, update attributes. */
ma->ma_lmm_size = info->mti_mdt->mdt_max_mdsize;
- OBD_ALLOC(ma->ma_lmm, ma->ma_lmm_size);
+ OBD_ALLOC(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize);
if (ma->ma_lmm == NULL)
GOTO(out_put, rc = -ENOMEM);
mdt_mfd_close(info, mfd);
- OBD_FREE(ma->ma_lmm, ma->ma_lmm_size);
+ OBD_FREE(ma->ma_lmm, info->mti_mdt->mdt_max_mdsize);
} else {
rc = mdt_attr_set(info, mo, ma, rr->rr_flags);
if (rc)
static int mdt_reint_create(struct mdt_thread_info *info,
struct mdt_lock_handle *lhc)
{
- int rc;
+ struct ptlrpc_request *req = mdt_info_req(info);
+ int rc;
ENTRY;
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_REINT_CREATE))
switch (info->mti_attr.ma_attr.la_mode & S_IFMT) {
case S_IFDIR:{
/* Cross-ref case. */
+ /* TODO: we can add LPROC_MDT_CROSS for cross-ref stats */
if (info->mti_cross_ref) {
rc = mdt_md_mkobj(info);
- break;
+ } else {
+ LASSERT(info->mti_rr.rr_namelen > 0);
+ mdt_counter_incr(req->rq_export, LPROC_MDT_MKDIR);
+ rc = mdt_md_create(info);
}
+ break;
}
case S_IFREG:
case S_IFLNK:
case S_IFSOCK:{
/* Special file should stay on the same node as parent. */
LASSERT(info->mti_rr.rr_namelen > 0);
+ mdt_counter_incr(req->rq_export, LPROC_MDT_MKNOD);
rc = mdt_md_create(info);
break;
}
/*
* VBR: save parent version in reply and child version getting by its name.
- * Version of child is getting and checking during its lookup. If
+ * Version of child is getting and checking during its lookup. If
*/
static int mdt_reint_unlink(struct mdt_thread_info *info,
struct mdt_lock_handle *lhc)
if (rc == 0)
mdt_handle_last_unlink(info, mc, ma);
+ if (ma->ma_valid & MA_INODE) {
+ switch (ma->ma_attr.la_mode & S_IFMT) {
+ case S_IFDIR:
+ mdt_counter_incr(req->rq_export, LPROC_MDT_RMDIR);
+ break;
+ case S_IFREG:
+ case S_IFLNK:
+ case S_IFCHR:
+ case S_IFBLK:
+ case S_IFIFO:
+ case S_IFSOCK:
+ mdt_counter_incr(req->rq_export, LPROC_MDT_UNLINK);
+ break;
+ default:
+ LASSERTF(0, "bad file type %o unlinking\n",
+ ma->ma_attr.la_mode);
+ }
+ }
+
EXIT;
mdt_object_unlock_put(info, mc, child_lh, rc);
rc = mdo_link(info->mti_env, mdt_object_child(mp),
mdt_object_child(ms), lname, ma);
+ if (rc == 0)
+ mdt_counter_incr(req->rq_export, LPROC_MDT_LINK);
+
EXIT;
out_unlock_child:
mdt_object_unlock_put(info, ms, lhs, rc);
lname, ma);
/* handle last link of tgt object */
- if (rc == 0 && mnew)
- mdt_handle_last_unlink(info, mnew, ma);
+ if (rc == 0) {
+ mdt_counter_incr(req->rq_export, LPROC_MDT_RENAME);
+ if (mnew)
+ mdt_handle_last_unlink(info, mnew, ma);
+ }
EXIT;
out_unlock_new: