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

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

 



Am 07.01.2019 um 09:27 schrieb Jeff King:
> On Sun, Jan 06, 2019 at 05:45:30PM +0100, René Scharfe wrote:
>> 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()).

Yes, the functions are arranged so that odb_load_loose_cache() can be
inlined easily.  I meant to include a patch for that but then quibbled
about keeping the BUG check (which is probably optimized out) or not,
and dropped it for now to get the performance fix in more quickly..

René



[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