Re: [PATCH 1/3] object-store: factor out odb_loose_cache()

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

 



On Sun, Jan 06, 2019 at 05:45:30PM +0100, René Scharfe wrote:

> Add and use a function for loading the entries if a loose object
> subdirectory for a given object ID.  It frees callers from deriving the
> fanout key; they can use the returned oid_array reference for lookups or
> forward range scans.

Much nicer.

> diff --git a/object-store.h b/object-store.h
> index 60758efad8..7236c571c0 100644
> --- a/object-store.h
> +++ b/object-store.h
> @@ -54,6 +54,13 @@ void add_to_alternates_memory(const char *dir);
>   */
>  void odb_load_loose_cache(struct object_directory *odb, int subdir_nr);
>  
> +/*
> + * Populate and return the loose object cache array corresponding to the
> + * given object ID.
> + */
> +struct oid_array *odb_loose_cache(struct object_directory *odb,
> +				  const struct object_id *oid);
> +

I think the ugly-interfaced odb_load_loose_cache() can become "static"
now, as the only outside caller (from sha1-name.c) has gone away.

> +struct oid_array *odb_loose_cache(struct object_directory *odb,
> +				  const struct object_id *oid)
> +{
> +	int subdir_nr = oid->hash[0];
> +	odb_load_loose_cache(odb, subdir_nr);
> +	return &odb->loose_objects_cache;
> +}
> +
>  void odb_load_loose_cache(struct object_directory *odb, int subdir_nr)

You'd need to re-order these definitions, of course (or alternatively,
just fold the load function inline into odb_loose_cache()).

-Peff



[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