Re: [PATCH 2/8] refs/reftable: handle reloading stacks in the reftable backend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Patrick Steinhardt <ps@xxxxxx> writes:

[snip]

> @@ -898,27 +915,31 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
>  				      struct ref_update *update,
>  				      struct strbuf *err)
>  {
> -	struct reftable_stack *stack = backend_for(refs, update->refname, NULL)->stack;
>  	struct write_transaction_table_arg *arg = NULL;
> +	struct reftable_backend *be;
>  	size_t i;
>  	int ret;
>
> +	ret = backend_for(&be, refs, update->refname, NULL, 0);

So here, we don't reload the stack, it would be nice to add a comment
why, in the places we don't. Here, it seems to be because we possibly
already have an update which would have pushed us to reload the stack.

> +	if (ret)
> +		return ret;
> +

[snip]

> @@ -1995,15 +2022,19 @@ static int reftable_be_for_each_reflog_ent_reverse(struct ref_store *ref_store,
>  {
>  	struct reftable_ref_store *refs =
>  		reftable_be_downcast(ref_store, REF_STORE_READ, "for_each_reflog_ent_reverse");
> -	struct reftable_stack *stack = backend_for(refs, refname, &refname)->stack;
>  	struct reftable_log_record log = {0};
>  	struct reftable_iterator it = {0};
> +	struct reftable_backend *be;
>  	int ret;
>
>  	if (refs->err < 0)
>  		return refs->err;
>
> -	ret = reftable_stack_init_log_iterator(stack, &it);
> +	ret = backend_for(&be, refs, refname, &refname, 0);

Like here, I'm not entirely sure why we don't reload the stack.

> +	if (ret)
> +		goto done;
> +
> +	ret = reftable_stack_init_log_iterator(be->stack, &it);
>  	if (ret < 0)
>  		goto done;
>

[snip]

> @@ -2462,7 +2498,7 @@ static int reftable_be_reflog_expire(struct ref_store *ref_store,
>  	arg.refs = refs;
>  	arg.records = rewritten;
>  	arg.len = logs_nr;
> -	arg.stack = stack,
> +	arg.stack = be->stack,
>  	arg.refname = refname,
>

Shouldn't these lines end with ';'?

>  	ret = reftable_addition_add(add, &write_reflog_expiry_table, &arg);
> --
> 2.47.0.229.g8f8d6eee53.dirty

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux