Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

2 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:03:12

Stefan Beller [off-list ref] writes:
quoted
quoted
+static struct lock_file reflog_lock;
If this lockfile is only used in that one function, it can be declared
inside the function.

If it is meant to be used throughout the 'git reflog' command, then it
can go near the top of the file.
After the series completes, this lock is only used in reflog_expire.
So I'd rather move it inside the function? Then we could run the reflog_expire
function in parallel for different locks in theory?
I am not sure about the "parallel" part, but I would imagine that it
is an essential prerequisite to move this outside the "client" code
if we want to later replace the backing storage of refs and reflogs
outside the filesystem, so from that point of view,  I think the
suggestion makes sense.

Thanks.

Re: [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file

From: Stefan Beller <hidden>
Date: 2016-06-15 23:03:12

On Fri, Dec 5, 2014 at 11:32 AM, Junio C Hamano [off-list ref] wrote:
Stefan Beller [off-list ref] writes:
quoted
quoted
quoted
+static struct lock_file reflog_lock;
If this lockfile is only used in that one function, it can be declared
inside the function.

If it is meant to be used throughout the 'git reflog' command, then it
can go near the top of the file.
After the series completes, this lock is only used in reflog_expire.
So I'd rather move it inside the function? Then we could run the reflog_expire
function in parallel for different locks in theory?
I am not sure about the "parallel" part, but I would imagine that it
is an essential prerequisite to move this outside the "client" code
if we want to later replace the backing storage of refs and reflogs
outside the filesystem, so from that point of view,  I think the
suggestion makes sense.

Thanks.
Sorry for the confusion. With parallel I mean, that in theory we could have
multiple threads running reflog expire at the same time in the same program.
Having the "static struct lock_file reflog_lock;" around, we can only
process one
reflog at a time, as that is holding the lock_file struct.

I am not saying we want to go multi-threading any time soon if at all.
Just that it would
be easier to do, if not having the lock file as a file-global variable
instead of a
variable inside a function.

Thanks,
Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help