Re: [RFC/PATCHv2 2/6] add metadata-cache infrastructure

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

 



Jeff King <peff@xxxxxxxx> writes:

> +`metadata_cache_lookup_uint32`::
> +`metadata_cache_add_uint32`::

I think these are "uint31" functions, as you cannot signal missing entry
by returning a value with the MSB set if higher-end of uint32 range can be
a valid value.

> +	if (c->validity_fun) {
> +		c->validity_fun(validity);
> +		if (hashcmp(validity, p))
> +			return NULL;
> +	}

Two comments.

 - I would have expected that c->validity_check() would be a way for a
   caller to implement a boolean function to check the validity of the
   cache, with another hook c->validity_token() to generate/update the
   token. I could then use the 20-byte space to store a timestamp and
   check can say "It was still 3-days ago? fresh enough", or something
   like that. But this is not a complaint--such a scheme I wrote in the
   above four lines may be _too_ flexible to be useful.

 - I wonder if validity_fn() callback wants a callback parameter (the
   pointer "c" itself, after adding an extra field to metadata_cache that
   stores the callback parameter pointer of type "void *" and adding a
   parameter to METADATA_CACHE_INIT() macro to initialize it).

Other than that, this is looking fun ;-)
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]