Re: [PATCH 01/16] packfile: introduce a new `struct packfile_store`

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

 



Patrick Steinhardt <ps@xxxxxx> writes:

> Information about a object database's packfiles is currently distributed
> across two different structures:
>
>   - `struct packed_git` contains the `next` pointer as well as the
>     `mru_head`, both of which serve to store the list of packfiles.
>
>   - `struct object_database` contains several fields that relate to the
>     packfiles.
>
> So we don't really have a central data structure that tracks our
> packfiles, and consequently responsibilities aren't always clear cut.
> A consequence for the upcoming pluggable object databases is that this
> makes it very hard to move management of packfiles from the object
> database level down into the object database source.
>
> Introduce a new `struct packfile_store` which is about to become the
> single source of truth for managing packfiles. Right now this data
> structure doesn't yet contain anything, but in subsequent patches we
> will move all data structures that relate to packfiles and that are
> currently contained in `struct object_database` into this new home.
>
> Note that this is only a first step: most importantly, we won't (yet)
> move the `struct packed_git::next` pointer around. This will happen in a
> subsequent patch series though so that `struct packed_git` will really
> only host information about the specific packfile it represents.
>
> Further note that the new structure still sits at the wrong level at the
> end of this patch series: as mentioned, it should eventually sit at the
> level of the object database source, not at the object database level.
> But introducing the packfile store now already makes it way easier to
> eventually push down the now-selfcontained data structure by one level.
>
> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  odb.c      |  1 +
>  odb.h      |  2 ++
>  packfile.c | 13 +++++++++++++
>  packfile.h | 18 ++++++++++++++++++
>  4 files changed, 34 insertions(+)
>
> diff --git a/odb.c b/odb.c
> index 2a92a018c4..34b70d0074 100644
> --- a/odb.c
> +++ b/odb.c
> @@ -996,6 +996,7 @@ struct object_database *odb_new(struct repository *repo)
>
>  	memset(o, 0, sizeof(*o));
>  	o->repo = repo;
> +	o->packfiles = packfile_store_new(o);
>  	INIT_LIST_HEAD(&o->packed_git_mru);
>  	hashmap_init(&o->pack_map, pack_map_entry_cmp, NULL, 0);
>  	pthread_mutex_init(&o->replace_mutex, NULL);
> diff --git a/odb.h b/odb.h
> index 3dfc66d75a..026ba9386d 100644
> --- a/odb.h
> +++ b/odb.h
> @@ -83,6 +83,7 @@ struct odb_source {
>  };
>
>  struct packed_git;
> +struct packfile_store;
>  struct cached_object_entry;
>
>  /*
> @@ -128,6 +129,7 @@ struct object_database {
>  	 *
>  	 * should only be accessed directly by packfile.c
>  	 */
> +	struct packfile_store *packfiles;
>

Nit: The newline spacing makes it seem like the comment above only
applies to `struct packfile_store` while actually it also applies to
`struct packed_git`.

>  	struct packed_git *packed_git;
>  	/* A most-recently-used ordered version of the packed_git list. */

[snip]

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