Christian Couder <christian.couder@xxxxxxxxx> writes: > On Mon, Dec 9, 2024 at 12:11 PM Karthik Nayak <karthik.188@xxxxxxxxx> wrote: >> >> When refs are updated in the files-backend, a lock is obtained for the >> corresponding file path. This is the case even for reflogs, i.e. a lock >> is obtained on the reference path instead of the reflog path. This >> works, since generally, reflogs are updated alongside the ref. >> >> The upcoming patches will add support for reflog updates in ref >> transaction. This means, in a particular transaction we want to have ref >> updates and reflog updates. For refs, in a given transaction there can >> only be one update. But, we can theoretically have multiple reflog >> updates in a given transaction. > > Nit: Giving an example might help understand where multiple reflog > updates can happen in a given transaction. Alternatively pointing to > an existing doc that contains such an example or explanations might > help too. > The use-case is added in the series. I've added a note about how this is needed in reflog migration. >> @@ -2572,18 +2588,25 @@ static int lock_ref_for_update(struct files_ref_store *refs, >> goto out; >> } >> >> - ret = lock_raw_ref(refs, update->refname, mustexist, >> - affected_refnames, >> - &lock, &referent, >> - &update->type, err); >> - if (ret) { >> - char *reason; >> + lock = strmap_get(&backend_data->ref_locks, update->refname); >> + if (lock) { >> + lock->count = lock->count + 1; > > Nit: > lock->count++; > Will fix, thanks. [snip]
Attachment:
signature.asc
Description: PGP signature