# HG changeset patch # User Josef 'Jeff' Sipek # Date 1671299588 18000 # Node ID 2bd3ee5a7f8b9c2bebc8890d82b060d7dd818c81 # Parent fecec851b5d620a4c66029e4321cb6c80c30d356 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 diff -r fecec851b5d6 -r 2bd3ee5a7f8b src/objstore/obj.c --- 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; diff -r fecec851b5d6 -r 2bd3ee5a7f8b src/objstore/obj_txn.c --- 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)