Re: [PATCH 8/8] midx: remove now-unused linked list of multi-pack indices

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

 



On 25/07/09 09:54AM, Patrick Steinhardt wrote:
> In the preceding commits we have migrated all users of the linked list
> of multi-pack indices to instead use those stored in the object database
> sources. Remove those now-unused pointers.
> 
> Signed-off-by: Patrick Steinhardt <ps@xxxxxx>
> ---
>  midx.c     | 16 ++--------------
>  midx.h     |  2 --
>  odb.h      |  7 -------
>  packfile.c |  1 -
>  4 files changed, 2 insertions(+), 24 deletions(-)
> 
> diff --git a/midx.c b/midx.c
> index 6d3a166fa01..27623e8cbb7 100644
> --- a/midx.c
> +++ b/midx.c
> @@ -726,7 +726,6 @@ int midx_preferred_pack(struct multi_pack_index *m, uint32_t *pack_int_id)
>  int prepare_multi_pack_index_one(struct odb_source *source, int local)
>  {
>  	struct repository *r = source->odb->repo;
> -	struct multi_pack_index *m;
>  
>  	if (source->multi_pack_index_loaded)
>  		return !!source->multi_pack_index;
> @@ -735,19 +734,9 @@ int prepare_multi_pack_index_one(struct odb_source *source, int local)
>  	if (!r->settings.core_multi_pack_index)
>  		return 0;
>  
> -	m = load_multi_pack_index(r, source->path, local);
> -	if (m) {
> -		struct multi_pack_index *mp = r->objects->multi_pack_index;
> -		if (mp) {
> -			m->next = mp->next;
> -			mp->next = m;
> -		} else {
> -			r->objects->multi_pack_index = m;
> -		}
> -		source->multi_pack_index = m;
> -	}
> -
> +	source->multi_pack_index = load_multi_pack_index(r, source->path, local);

Now that we are dropping the MIDX list stored in the object database, we
no longer have to store. Nice and simple.

>  	source->multi_pack_index_loaded = 1;
> +
>  	return !!source->multi_pack_index;
>  }
>  
> @@ -840,7 +829,6 @@ void clear_midx_file(struct repository *r)
>  			source->multi_pack_index = NULL;
>  			source->multi_pack_index_loaded = 0;
>  		}
> -		r->objects->multi_pack_index = NULL;
>  	}
>  
>  	if (remove_path(midx.buf))
> diff --git a/midx.h b/midx.h
> index b1626a9a7c4..c4192c92d44 100644
> --- a/midx.h
> +++ b/midx.h
> @@ -35,8 +35,6 @@ struct repository;
>  	"GIT_TEST_MULTI_PACK_INDEX_WRITE_INCREMENTAL"
>  
>  struct multi_pack_index {
> -	struct multi_pack_index *next;

We no longer need the next pointer since each `struct multi_pack_index`
represents an indepented MIDX chain.

> -
>  	const unsigned char *data;
>  	size_t data_len;
>  
> diff --git a/odb.h b/odb.h
> index b39534dd55b..8ff523a33de 100644
> --- a/odb.h
> +++ b/odb.h
> @@ -124,13 +124,6 @@ struct object_database {
>  	struct commit_graph *commit_graph;
>  	unsigned commit_graph_attempted : 1; /* if loading has been attempted */
>  
> -	/*
> -	 * private data
> -	 *
> -	 * should only be accessed directly by packfile.c and midx.c
> -	 */
> -	struct multi_pack_index *multi_pack_index;

Now each object source specifies its own MIDX and this one can go away.
Nice :)

> -
>  	/*
>  	 * private data
>  	 *
> diff --git a/packfile.c b/packfile.c
> index 3eeec20906b..453a38395bb 100644
> --- a/packfile.c
> +++ b/packfile.c
> @@ -375,7 +375,6 @@ void close_object_store(struct object_database *o)
>  		source->multi_pack_index = NULL;
>  		source->multi_pack_index_loaded = 0;
>  	}
> -	o->multi_pack_index = NULL;
>  
>  	close_commit_graph(o);
>  }
> 
> -- 
> 2.50.1.327.g047016eb4a.dirty
> 
> 




[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