changeset 848:2bd3ee5a7f8b

objstore: move obj_create into obj.c For the same reasons why obj_cow is in this file (i.e., the needed helpers are in this file), we should keep obj_create here as well. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Sat, 17 Dec 2022 12:53:08 -0500
parents fecec851b5d6
children cf7893023f05
files src/objstore/obj.c src/objstore/obj_txn.c
diffstat 2 files changed, 32 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/objstore/obj.c	Sat Mar 16 11:28:30 2019 -0400
+++ b/src/objstore/obj.c	Sat Dec 17 12:53:08 2022 -0500
@@ -467,6 +467,38 @@
 	return ERR_PTR(ret);
 }
 
+static int __obj_create_perform(struct txn *txn, struct txn_entry *entry)
+{
+	return txn->clone->ops->createobj(txn->clone,
+					  &entry->create.oid,
+					  &entry->create.clock,
+					  &entry->create.attrs,
+					  &entry->create.parent);
+}
+
+int obj_create(struct txn *txn, const struct nattr *attrs,
+	       struct noid *oid, const struct noid *parent)
+{
+	struct txn_entry *entry;
+	int ret;
+
+	ret = txn->clone->ops->allocoid(txn->clone, oid);
+	if (ret)
+		return ret;
+
+	entry = txn_alloc_entry(txn);
+	entry->op = OP_CREATE;
+	entry->perform = __obj_create_perform;
+	entry->create.oid = *oid;
+	nvclock_reset(&entry->create.clock);
+	VERIFY0(nvclock_inc(&entry->create.clock));
+	entry->create.attrs = *attrs;
+	entry->create.parent = *parent;
+	txn_log_entry(txn, entry);
+
+	return 0;
+}
+
 static int __obj_cow_perform(struct txn *txn, struct txn_entry *entry)
 {
 	struct objstore_open_obj_info *open = entry->cow.open;
--- a/src/objstore/obj_txn.c	Sat Mar 16 11:28:30 2019 -0400
+++ b/src/objstore/obj_txn.c	Sat Dec 17 12:53:08 2022 -0500
@@ -24,38 +24,6 @@
 
 #include "objstore_impl.h"
 
-static int __obj_create_perform(struct txn *txn, struct txn_entry *entry)
-{
-	return txn->clone->ops->createobj(txn->clone,
-					  &entry->create.oid,
-					  &entry->create.clock,
-					  &entry->create.attrs,
-					  &entry->create.parent);
-}
-
-int obj_create(struct txn *txn, const struct nattr *attrs,
-	       struct noid *oid, const struct noid *parent)
-{
-	struct txn_entry *entry;
-	int ret;
-
-	ret = txn->clone->ops->allocoid(txn->clone, oid);
-	if (ret)
-		return ret;
-
-	entry = txn_alloc_entry(txn);
-	entry->op = OP_CREATE;
-	entry->perform = __obj_create_perform;
-	entry->create.oid = *oid;
-	nvclock_reset(&entry->create.clock);
-	VERIFY0(nvclock_inc(&entry->create.clock));
-	entry->create.attrs = *attrs;
-	entry->create.parent = *parent;
-	txn_log_entry(txn, entry);
-
-	return 0;
-}
-
 /* returns number of bytes read (if > 0), or negated errno otherwise */
 ssize_t obj_read(struct objver *ver, void *_buf, size_t len,
 		 uint64_t offset)