Commit 89594c74 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'fscache-next-20210829' of...

Merge tag 'fscache-next-20210829' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull fscache updates from David Howells:
 "Preparatory work for the fscache rewrite that's being worked on and
  fix some bugs. These include:

   - Always select netfs stats when enabling fscache stats since they're
     displayed through the same procfile.

   - Add a cookie debug ID that can be used in tracepoints instead of a
     pointer and cache it in the netfs_cache_resources struct rather
     than in the netfs_read_request struct to make it more available.

   - Use file_inode() in cachefiles rather than dereferencing
     file->f_inode directly.

   - Provide a procfile to display fscache cookies.

   - Remove the fscache and cachefiles histogram procfiles.

   - Remove the fscache object list procfile.

   - Avoid using %p in fscache and cachefiles as the value is hashed and
     not comparable to the register dump in an oops trace.

   - Fix the cookie hash function to actually achieve useful dispersion.

   - Fix fscache_cookie_put() so that it doesn't dereference the cookie
     pointer in the tracepoint after the refcount has been decremented
     (we're only allowed to do that if we decremented it to zero).

   - Use refcount_t rather than atomic_t for the fscache_cookie
     refcount"

* tag 'fscache-next-20210829' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
  fscache: Use refcount_t for the cookie refcount instead of atomic_t
  fscache: Fix fscache_cookie_put() to not deref after dec
  fscache: Fix cookie key hashing
  cachefiles: Change %p in format strings to something else
  fscache: Change %p in format strings to something else
  fscache: Remove the object list procfile
  fscache, cachefiles: Remove the histogram stuff
  fscache: Procfile to display cookies
  fscache: Add a cookie debug ID and use that in traces
  cachefiles: Use file_inode() rather than accessing ->f_inode
  netfs: Move cookie debug ID to struct netfs_cache_resources
  fscache: Select netfs stats if fscache stats are enabled
parents 75ae663d 20ec197b
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
@@ -19,22 +19,3 @@ config CACHEFILES_DEBUG
	  caching on files module.  If this is set, the debugging output may be
	  enabled by setting bits in /sys/modules/cachefiles/parameter/debug or
	  by including a debugging specifier in /etc/cachefilesd.conf.

config CACHEFILES_HISTOGRAM
	bool "Gather latency information on CacheFiles"
	depends on CACHEFILES && PROC_FS
	help

	  This option causes latency information to be gathered on CacheFiles
	  operation and exported through file:

		/proc/fs/cachefiles/histogram

	  The generation of this histogram adds a certain amount of overhead to
	  execution as there are a number of points at which data is gathered,
	  and on a multi-CPU system these may be on cachelines that keep
	  bouncing between CPUs.  On the other hand, the histogram may be
	  useful for debugging purposes.  Saying 'N' here is recommended.

	  See Documentation/filesystems/caching/cachefiles.rst for more
	  information.
+0 −2
Original line number Diff line number Diff line
@@ -15,6 +15,4 @@ cachefiles-y := \
	security.o \
	xattr.o

cachefiles-$(CONFIG_CACHEFILES_HISTOGRAM) += proc.o

obj-$(CONFIG_CACHEFILES) := cachefiles.o
+0 −2
Original line number Diff line number Diff line
@@ -108,8 +108,6 @@ static int cachefiles_daemon_add_cache(struct cachefiles_cache *cache)
	atomic_set(&fsdef->usage, 1);
	fsdef->type = FSCACHE_COOKIE_TYPE_INDEX;

	_debug("- fsdef %p", fsdef);

	/* look up the directory at the root of the cache */
	ret = kern_path(cache->rootdirname, LOOKUP_DIRECTORY, &path);
	if (ret < 0)
+3 −3
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ static struct fscache_object *cachefiles_alloc_object(

	cache = container_of(_cache, struct cachefiles_cache, cache);

	_enter("{%s},%p,", cache->cache.identifier, cookie);
	_enter("{%s},%x,", cache->cache.identifier, cookie->debug_id);

	lookup_data = kmalloc(sizeof(*lookup_data), cachefiles_gfp);
	if (!lookup_data)
@@ -96,7 +96,7 @@ static struct fscache_object *cachefiles_alloc_object(
	lookup_data->key = key;
	object->lookup_data = lookup_data;

	_leave(" = %p [%p]", &object->fscache, lookup_data);
	_leave(" = %x [%p]", object->fscache.debug_id, lookup_data);
	return &object->fscache;

nomem_key:
@@ -379,7 +379,7 @@ static void cachefiles_sync_cache(struct fscache_cache *_cache)
	const struct cred *saved_cred;
	int ret;

	_enter("%p", _cache);
	_enter("%s", _cache->tag->name);

	cache = container_of(_cache, struct cachefiles_cache, cache);

+0 −25
Original line number Diff line number Diff line
@@ -180,31 +180,6 @@ extern int cachefiles_cull(struct cachefiles_cache *cache, struct dentry *dir,
extern int cachefiles_check_in_use(struct cachefiles_cache *cache,
				   struct dentry *dir, char *filename);

/*
 * proc.c
 */
#ifdef CONFIG_CACHEFILES_HISTOGRAM
extern atomic_t cachefiles_lookup_histogram[HZ];
extern atomic_t cachefiles_mkdir_histogram[HZ];
extern atomic_t cachefiles_create_histogram[HZ];

extern int __init cachefiles_proc_init(void);
extern void cachefiles_proc_cleanup(void);
static inline
void cachefiles_hist(atomic_t histogram[], unsigned long start_jif)
{
	unsigned long jif = jiffies - start_jif;
	if (jif >= HZ)
		jif = HZ - 1;
	atomic_inc(&histogram[jif]);
}

#else
#define cachefiles_proc_init()		(0)
#define cachefiles_proc_cleanup()	do {} while (0)
#define cachefiles_hist(hist, start_jif) do {} while (0)
#endif

/*
 * rdwr.c
 */
Loading