[Linux-cachefs] [PATCH] Updated NFS client to reflect CacheFS Spilt

David Howells dhowells at redhat.com
Fri Oct 8 09:46:48 UTC 2004


Hi Steve,

> Attached is a patch that changes all of the names from
> cachefs to fscache to reflect the recent CacheFS split.
> It also moves the nfs_invalidatepage(), nfs_releasepage(),
> and nfs_mkwrite() routines from file.c into read.c per
> your request....

You need to update nfs_cache_fh_match() to look like this:

static fscache_match_val_t nfs_cache_fh_match(void *target, const void *entry)
{
	struct nfs_inode *nfsi = target;
	const uint8_t *data = entry;
	uint16_t nsize;

	/* check the file handle matches */
	memcpy(&nsize, data, 2);
	nsize = ntohs(nsize);

	if (nsize <= NFS_CACHE_FH_INDEX_SIZE && nfsi->fh.size == nsize) {
		if (memcmp(data + 2, nfsi->fh.data, nsize) == 0) {
			kleave(" = SUCCESS");
			return FSCACHE_MATCH_SUCCESS;
		}
	}

	kleave(" = FAILED");
	return FSCACHE_MATCH_FAILED;
}


Since cachefs is endiannised, I wonder if I should decree that keys of type
FSCACHE_INDEX_KEYS_BIN_SZ2 should be stored in the cache in host endian order
not network endian order; on the other hand, that only applies to cachefs.

David




More information about the Linux-cachefs mailing list