* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011 Whamcloud, Inc.
- *
+ * Copyright (c) 2011, 2012, Whamcloud, Inc.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
LASSERT(mdd->mdd_capa);
+ /* XXX: Since we use the 'mdd_capa' as fake llog object here, we
+ * have to set the parameter 'size' as INT_MAX or 0 to inform
+ * OSD that this record write is for a llog write or catalog
+ * header update, and osd declare function will reserve less
+ * credits for optimization purpose.
+ *
+ * Reserve 6 blocks for a llog write, since the llog file is
+ * usually small, reserve 2 blocks for catalog header update,
+ * because we know for sure that catalog header is already
+ * allocated.
+ *
+ * This hack should be removed in 2.3.
+ */
+
/* record itself */
- rc = dt_declare_record_write(env, mdd->mdd_capa, reclen, 0, handle);
+ rc = dt_declare_record_write(env, mdd->mdd_capa,
+ DECLARE_LLOG_WRITE, 0, handle);
if (rc)
return rc;
/* header will be updated as well */
- rc = dt_declare_record_write(env, mdd->mdd_capa, LLOG_CHUNK_SIZE,
- 0, handle);
+ rc = dt_declare_record_write(env, mdd->mdd_capa,
+ DECLARE_LLOG_WRITE, 0, handle);
if (rc)
return rc;
/* new record referencing new plain llog */
rc = dt_declare_record_write(env, mdd->mdd_capa,
- sizeof(struct llog_logid_rec), 0, handle);
+ DECLARE_LLOG_WRITE, 0, handle);
if (rc)
return rc;
/* catalog's header will be updated as well */
- rc = dt_declare_record_write(env, mdd->mdd_capa, LLOG_CHUNK_SIZE,
- 0, handle);
+ rc = dt_declare_record_write(env, mdd->mdd_capa,
+ DECLARE_LLOG_REWRITE, 0, handle);
return rc;
}
stop:
mdd_trans_stop(env, mdd, rc, handle);
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2,3,50,0)
+ if (rc == 0 && ma->ma_valid & MA_COOKIE && ma->ma_valid & MA_LOV &&
+ ma->ma_valid & MA_FLAGS && ma->ma_attr_flags & MDS_UNLINK_DESTROY)
+ /* Since echo client is incapable of destorying ost object,
+ * it will destory the object here. */
+ rc = mdd_lovobj_unlink(env, mdd, mdd_cobj, la,
+ ma->ma_lmm, ma->ma_lmm_size,
+ ma->ma_cookie, 1);
+#else
+#warning "please remove this after 2.4 (LOD/OSP)."
+#endif
+
#ifdef HAVE_QUOTA_SUPPORT
if (quota_opc)
/* Trigger dqrel on the owner of child and parent. If failed,