changeset 815:90b3c3ada431

objstore: add parent oid to the create transaction operation Currently unused. Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Mon, 06 Apr 2020 22:14:03 -0400
parents 19b4d82493e6
children 7938320113fb
files src/objstore/include/nomad/objstore_backend.h src/objstore/obj_dir_create.c src/objstore/obj_txn.c src/objstore/objstore_impl.h
diffstat 4 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/objstore/include/nomad/objstore_backend.h	Sun Apr 05 18:52:10 2020 -0400
+++ b/src/objstore/include/nomad/objstore_backend.h	Mon Apr 06 22:14:03 2020 -0400
@@ -142,6 +142,7 @@
 		} cow;
 		struct {
 			struct noid oid;
+			struct noid parent;
 			struct nvclock clock;
 			struct nattr attrs;
 		} create;
--- a/src/objstore/obj_dir_create.c	Sun Apr 05 18:52:10 2020 -0400
+++ b/src/objstore/obj_dir_create.c	Mon Apr 06 22:14:03 2020 -0400
@@ -26,7 +26,8 @@
 
 /* allocate a new oid - the child */
 static int __dir_create_allocoid(struct txn *txn, uint32_t owner, uint32_t group,
-				 uint16_t mode, struct noid *oid)
+				 uint16_t mode, struct noid *oid,
+				 const struct noid *parent)
 {
 	const uint64_t now = gettime();
 	struct nattr attrs = {
@@ -41,7 +42,7 @@
 		.group = group,
 	};
 
-	return obj_create(txn, &attrs, oid);
+	return obj_create(txn, &attrs, oid, parent);
 }
 
 static int __dir_create_child_contents(struct txn *txn,
@@ -243,7 +244,8 @@
 	}
 
 	/* make new oid for the child */
-	ret = __dir_create_allocoid(txn, owner, group, mode, child);
+	ret = __dir_create_allocoid(txn, owner, group, mode, child,
+				    &dirver->obj->oid);
 	if (ret)
 		return ret;
 
--- a/src/objstore/obj_txn.c	Sun Apr 05 18:52:10 2020 -0400
+++ b/src/objstore/obj_txn.c	Mon Apr 06 22:14:03 2020 -0400
@@ -33,7 +33,7 @@
 }
 
 int obj_create(struct txn *txn, const struct nattr *attrs,
-	       struct noid *oid)
+	       struct noid *oid, const struct noid *parent)
 {
 	struct txn_entry *entry;
 	int ret;
@@ -49,6 +49,7 @@
 	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;
--- a/src/objstore/objstore_impl.h	Sun Apr 05 18:52:10 2020 -0400
+++ b/src/objstore/objstore_impl.h	Mon Apr 06 22:14:03 2020 -0400
@@ -67,7 +67,7 @@
 /* add various transaction ops to the transaction */
 extern int obj_cow(struct txn *txn, struct objstore_open_obj_info *open);
 extern int obj_create(struct txn *txn, const struct nattr *attrs,
-		      struct noid *oid);
+		      struct noid *oid, const struct noid *parent);
 extern void obj_setattr(struct txn *txn, struct objver *ver,
 			const struct nattr *attrs, unsigned valid);
 extern void obj_write(struct txn *txn, struct objver *ver, struct buffer *buf,