# HG changeset patch # User Josef 'Jeff' Sipek # Date 1671305199 18000 # Node ID dc84208232c62d862373cee6f60c11f7a6e02a58 # Parent 8ccfc441cff6ea18073eb43c91907dffb830b204 objstore: rename cleanup txn entry method to rollback The code executes when the transaction is aborted, so calling it rollback makes it clearer when it executes. Signed-off-by: Josef 'Jeff' Sipek diff -r 8ccfc441cff6 -r dc84208232c6 src/objstore/include/nomad/objstore_backend.h --- a/src/objstore/include/nomad/objstore_backend.h Sat Dec 17 14:03:31 2022 -0500 +++ b/src/objstore/include/nomad/objstore_backend.h Sat Dec 17 14:26:39 2022 -0500 @@ -136,7 +136,7 @@ bool failed; /* log entry failed */ int (*perform)(struct txn *txn, struct txn_entry *entry); - void (*cleanup)(struct txn *txn, struct txn_entry *entry); + void (*rollback)(struct txn *txn, struct txn_entry *entry); union { struct { diff -r 8ccfc441cff6 -r dc84208232c6 src/objstore/obj.c --- a/src/objstore/obj.c Sat Dec 17 14:03:31 2022 -0500 +++ b/src/objstore/obj.c Sat Dec 17 14:26:39 2022 -0500 @@ -547,7 +547,7 @@ return 0; } -static void __obj_cow_cleanup(struct txn *txn, struct txn_entry *entry) +static void __obj_cow_rollback(struct txn *txn, struct txn_entry *entry) { struct objstore_open_obj_info *open = entry->cow.open; struct objver *old = entry->cow.old; @@ -605,7 +605,7 @@ entry = txn_alloc_entry(txn); entry->op = OP_COW; entry->perform = __obj_cow_perform; - entry->cleanup = __obj_cow_cleanup; + entry->rollback = __obj_cow_rollback; entry->cow.open = open; entry->cow.old = old; entry->cow.new = new; diff -r 8ccfc441cff6 -r dc84208232c6 src/objstore/obj_txn.c --- a/src/objstore/obj_txn.c Sat Dec 17 14:03:31 2022 -0500 +++ b/src/objstore/obj_txn.c Sat Dec 17 14:26:39 2022 -0500 @@ -75,7 +75,7 @@ return ret; } -static void __obj_setattr_cleanup(struct txn *txn, struct txn_entry *entry) +static void __obj_setattr_rollback(struct txn *txn, struct txn_entry *entry) { struct objver *ver = entry->setattr.ver; @@ -108,7 +108,7 @@ entry = txn_alloc_entry(txn); entry->op = OP_SETATTR; entry->perform = __obj_setattr_perform; - entry->cleanup = __obj_setattr_cleanup; + entry->rollback = __obj_setattr_rollback; entry->setattr.ver = ver; entry->setattr.old_attrs = ver->attrs; entry->setattr.changed = valid; @@ -181,7 +181,7 @@ return ret; } -static void __obj_write_cleanup(struct txn *txn, struct txn_entry *entry) +static void __obj_write_rollback(struct txn *txn, struct txn_entry *entry) { /* drop the dirty pages */ page_inval_range(entry->write.ver, entry->write.pgno, @@ -207,7 +207,7 @@ entry = txn_alloc_entry(txn); entry->op = OP_WRITE; entry->perform = __obj_write_perform; - entry->cleanup = __obj_write_cleanup; + entry->rollback = __obj_write_rollback; entry->write.ver = ver; entry->write.pgno = offset / PAGE_SIZE; entry->write.pgcnt = p2roundup(len, PAGE_SIZE) / PAGE_SIZE; diff -r 8ccfc441cff6 -r dc84208232c6 src/objstore/txn.c --- a/src/objstore/txn.c Sat Dec 17 14:03:31 2022 -0500 +++ b/src/objstore/txn.c Sat Dec 17 14:26:39 2022 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2020 Josef 'Jeff' Sipek + * Copyright (c) 2019-2020,2022 Josef 'Jeff' Sipek * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -120,7 +120,7 @@ txn->entries[i].logged = false; txn->entries[i].failed = false; txn->entries[i].perform = NULL; - txn->entries[i].cleanup = NULL; + txn->entries[i].rollback = NULL; } return clone->ops->txn_begin(txn); @@ -143,8 +143,8 @@ case OP_CREATE: case OP_SETATTR: case OP_WRITE: - if (entry->cleanup) - entry->cleanup(txn, entry); + if (entry->rollback) + entry->rollback(txn, entry); break; } }