mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-14 15:54:15 +08:00
26aaeffcaf
Add an alternate API by which the cache can be accessed through a kiocb, doing async DIO, rather than using the current API that tells the cache where all the pages are. The new API is intended to be used in conjunction with the netfs helper library. A filesystem must pick one or the other and not mix them. Filesystems wanting to use the new API must #define FSCACHE_USE_NEW_IO_API before #including the header. This prevents them from continuing to use the old API at the same time as there are incompatibilities in how the PG_fscache page bit is used. Changes: v6: - Provide a routine to shape a write so that the start and length can be aligned for DIO[3]. v4: - Use the vfs_iocb_iter_read/write() helpers[1] - Move initial definition of fscache_begin_read_operation() here. - Remove a commented-out line[2] - Combine ki->term_func calls in cachefiles_read_complete()[2]. - Remove explicit NULL initialiser[2]. - Remove extern on func decl[2]. - Put in param names on func decl[2]. - Remove redundant else[2]. - Fill out the kdoc comment for fscache_begin_read_operation(). - Rename fs/fscache/page2.c to io.c to match later patches. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-and-tested-by: Jeff Layton <jlayton@kernel.org> Tested-by: Dave Wysochanski <dwysocha@redhat.com> Tested-By: Marc Dionne <marc.dionne@auristor.com> cc: Christoph Hellwig <hch@lst.de> cc: linux-cachefs@redhat.com cc: linux-afs@lists.infradead.org cc: linux-nfs@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: ceph-devel@vger.kernel.org cc: v9fs-developer@lists.sourceforge.net cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/20210216102614.GA27555@lst.de/ [1] Link: https://lore.kernel.org/r/20210216084230.GA23669@lst.de/ [2] Link: https://lore.kernel.org/r/161781047695.463527.7463536103593997492.stgit@warthog.procyon.org.uk/ [3] Link: https://lore.kernel.org/r/161118142558.1232039.17993829899588971439.stgit@warthog.procyon.org.uk/ # rfc Link: https://lore.kernel.org/r/161161037850.2537118.8819808229350326503.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/161340402057.1303470.8038373593844486698.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/161539545919.286939.14573472672781434757.stgit@warthog.procyon.org.uk/ # v4 Link: https://lore.kernel.org/r/161653801477.2770958.10543270629064934227.stgit@warthog.procyon.org.uk/ # v5 Link: https://lore.kernel.org/r/161789084517.6155.12799689829859169640.stgit@warthog.procyon.org.uk/ # v6
284 lines
9.9 KiB
C
284 lines
9.9 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/* FS-Cache statistics
|
|
*
|
|
* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.
|
|
* Written by David Howells (dhowells@redhat.com)
|
|
*/
|
|
|
|
#define FSCACHE_DEBUG_LEVEL THREAD
|
|
#include <linux/module.h>
|
|
#include <linux/proc_fs.h>
|
|
#include <linux/seq_file.h>
|
|
#include "internal.h"
|
|
|
|
/*
|
|
* operation counters
|
|
*/
|
|
atomic_t fscache_n_op_pend;
|
|
atomic_t fscache_n_op_run;
|
|
atomic_t fscache_n_op_enqueue;
|
|
atomic_t fscache_n_op_deferred_release;
|
|
atomic_t fscache_n_op_initialised;
|
|
atomic_t fscache_n_op_release;
|
|
atomic_t fscache_n_op_gc;
|
|
atomic_t fscache_n_op_cancelled;
|
|
atomic_t fscache_n_op_rejected;
|
|
|
|
atomic_t fscache_n_attr_changed;
|
|
atomic_t fscache_n_attr_changed_ok;
|
|
atomic_t fscache_n_attr_changed_nobufs;
|
|
atomic_t fscache_n_attr_changed_nomem;
|
|
atomic_t fscache_n_attr_changed_calls;
|
|
|
|
atomic_t fscache_n_allocs;
|
|
atomic_t fscache_n_allocs_ok;
|
|
atomic_t fscache_n_allocs_wait;
|
|
atomic_t fscache_n_allocs_nobufs;
|
|
atomic_t fscache_n_allocs_intr;
|
|
atomic_t fscache_n_allocs_object_dead;
|
|
atomic_t fscache_n_alloc_ops;
|
|
atomic_t fscache_n_alloc_op_waits;
|
|
|
|
atomic_t fscache_n_retrievals;
|
|
atomic_t fscache_n_retrievals_ok;
|
|
atomic_t fscache_n_retrievals_wait;
|
|
atomic_t fscache_n_retrievals_nodata;
|
|
atomic_t fscache_n_retrievals_nobufs;
|
|
atomic_t fscache_n_retrievals_intr;
|
|
atomic_t fscache_n_retrievals_nomem;
|
|
atomic_t fscache_n_retrievals_object_dead;
|
|
atomic_t fscache_n_retrieval_ops;
|
|
atomic_t fscache_n_retrieval_op_waits;
|
|
|
|
atomic_t fscache_n_stores;
|
|
atomic_t fscache_n_stores_ok;
|
|
atomic_t fscache_n_stores_again;
|
|
atomic_t fscache_n_stores_nobufs;
|
|
atomic_t fscache_n_stores_oom;
|
|
atomic_t fscache_n_store_ops;
|
|
atomic_t fscache_n_store_calls;
|
|
atomic_t fscache_n_store_pages;
|
|
atomic_t fscache_n_store_radix_deletes;
|
|
atomic_t fscache_n_store_pages_over_limit;
|
|
|
|
atomic_t fscache_n_store_vmscan_not_storing;
|
|
atomic_t fscache_n_store_vmscan_gone;
|
|
atomic_t fscache_n_store_vmscan_busy;
|
|
atomic_t fscache_n_store_vmscan_cancelled;
|
|
atomic_t fscache_n_store_vmscan_wait;
|
|
|
|
atomic_t fscache_n_marks;
|
|
atomic_t fscache_n_uncaches;
|
|
|
|
atomic_t fscache_n_acquires;
|
|
atomic_t fscache_n_acquires_null;
|
|
atomic_t fscache_n_acquires_no_cache;
|
|
atomic_t fscache_n_acquires_ok;
|
|
atomic_t fscache_n_acquires_nobufs;
|
|
atomic_t fscache_n_acquires_oom;
|
|
|
|
atomic_t fscache_n_invalidates;
|
|
atomic_t fscache_n_invalidates_run;
|
|
|
|
atomic_t fscache_n_updates;
|
|
atomic_t fscache_n_updates_null;
|
|
atomic_t fscache_n_updates_run;
|
|
|
|
atomic_t fscache_n_relinquishes;
|
|
atomic_t fscache_n_relinquishes_null;
|
|
atomic_t fscache_n_relinquishes_waitcrt;
|
|
atomic_t fscache_n_relinquishes_retire;
|
|
|
|
atomic_t fscache_n_cookie_index;
|
|
atomic_t fscache_n_cookie_data;
|
|
atomic_t fscache_n_cookie_special;
|
|
|
|
atomic_t fscache_n_object_alloc;
|
|
atomic_t fscache_n_object_no_alloc;
|
|
atomic_t fscache_n_object_lookups;
|
|
atomic_t fscache_n_object_lookups_negative;
|
|
atomic_t fscache_n_object_lookups_positive;
|
|
atomic_t fscache_n_object_lookups_timed_out;
|
|
atomic_t fscache_n_object_created;
|
|
atomic_t fscache_n_object_avail;
|
|
atomic_t fscache_n_object_dead;
|
|
|
|
atomic_t fscache_n_checkaux_none;
|
|
atomic_t fscache_n_checkaux_okay;
|
|
atomic_t fscache_n_checkaux_update;
|
|
atomic_t fscache_n_checkaux_obsolete;
|
|
|
|
atomic_t fscache_n_cop_alloc_object;
|
|
atomic_t fscache_n_cop_lookup_object;
|
|
atomic_t fscache_n_cop_lookup_complete;
|
|
atomic_t fscache_n_cop_grab_object;
|
|
atomic_t fscache_n_cop_invalidate_object;
|
|
atomic_t fscache_n_cop_update_object;
|
|
atomic_t fscache_n_cop_drop_object;
|
|
atomic_t fscache_n_cop_put_object;
|
|
atomic_t fscache_n_cop_sync_cache;
|
|
atomic_t fscache_n_cop_attr_changed;
|
|
atomic_t fscache_n_cop_read_or_alloc_page;
|
|
atomic_t fscache_n_cop_read_or_alloc_pages;
|
|
atomic_t fscache_n_cop_allocate_page;
|
|
atomic_t fscache_n_cop_allocate_pages;
|
|
atomic_t fscache_n_cop_write_page;
|
|
atomic_t fscache_n_cop_uncache_page;
|
|
atomic_t fscache_n_cop_dissociate_pages;
|
|
|
|
atomic_t fscache_n_cache_no_space_reject;
|
|
atomic_t fscache_n_cache_stale_objects;
|
|
atomic_t fscache_n_cache_retired_objects;
|
|
atomic_t fscache_n_cache_culled_objects;
|
|
|
|
/*
|
|
* display the general statistics
|
|
*/
|
|
int fscache_stats_show(struct seq_file *m, void *v)
|
|
{
|
|
seq_puts(m, "FS-Cache statistics\n");
|
|
|
|
seq_printf(m, "Cookies: idx=%u dat=%u spc=%u\n",
|
|
atomic_read(&fscache_n_cookie_index),
|
|
atomic_read(&fscache_n_cookie_data),
|
|
atomic_read(&fscache_n_cookie_special));
|
|
|
|
seq_printf(m, "Objects: alc=%u nal=%u avl=%u ded=%u\n",
|
|
atomic_read(&fscache_n_object_alloc),
|
|
atomic_read(&fscache_n_object_no_alloc),
|
|
atomic_read(&fscache_n_object_avail),
|
|
atomic_read(&fscache_n_object_dead));
|
|
seq_printf(m, "ChkAux : non=%u ok=%u upd=%u obs=%u\n",
|
|
atomic_read(&fscache_n_checkaux_none),
|
|
atomic_read(&fscache_n_checkaux_okay),
|
|
atomic_read(&fscache_n_checkaux_update),
|
|
atomic_read(&fscache_n_checkaux_obsolete));
|
|
|
|
seq_printf(m, "Pages : mrk=%u unc=%u\n",
|
|
atomic_read(&fscache_n_marks),
|
|
atomic_read(&fscache_n_uncaches));
|
|
|
|
seq_printf(m, "Acquire: n=%u nul=%u noc=%u ok=%u nbf=%u"
|
|
" oom=%u\n",
|
|
atomic_read(&fscache_n_acquires),
|
|
atomic_read(&fscache_n_acquires_null),
|
|
atomic_read(&fscache_n_acquires_no_cache),
|
|
atomic_read(&fscache_n_acquires_ok),
|
|
atomic_read(&fscache_n_acquires_nobufs),
|
|
atomic_read(&fscache_n_acquires_oom));
|
|
|
|
seq_printf(m, "Lookups: n=%u neg=%u pos=%u crt=%u tmo=%u\n",
|
|
atomic_read(&fscache_n_object_lookups),
|
|
atomic_read(&fscache_n_object_lookups_negative),
|
|
atomic_read(&fscache_n_object_lookups_positive),
|
|
atomic_read(&fscache_n_object_created),
|
|
atomic_read(&fscache_n_object_lookups_timed_out));
|
|
|
|
seq_printf(m, "Invals : n=%u run=%u\n",
|
|
atomic_read(&fscache_n_invalidates),
|
|
atomic_read(&fscache_n_invalidates_run));
|
|
|
|
seq_printf(m, "Updates: n=%u nul=%u run=%u\n",
|
|
atomic_read(&fscache_n_updates),
|
|
atomic_read(&fscache_n_updates_null),
|
|
atomic_read(&fscache_n_updates_run));
|
|
|
|
seq_printf(m, "Relinqs: n=%u nul=%u wcr=%u rtr=%u\n",
|
|
atomic_read(&fscache_n_relinquishes),
|
|
atomic_read(&fscache_n_relinquishes_null),
|
|
atomic_read(&fscache_n_relinquishes_waitcrt),
|
|
atomic_read(&fscache_n_relinquishes_retire));
|
|
|
|
seq_printf(m, "AttrChg: n=%u ok=%u nbf=%u oom=%u run=%u\n",
|
|
atomic_read(&fscache_n_attr_changed),
|
|
atomic_read(&fscache_n_attr_changed_ok),
|
|
atomic_read(&fscache_n_attr_changed_nobufs),
|
|
atomic_read(&fscache_n_attr_changed_nomem),
|
|
atomic_read(&fscache_n_attr_changed_calls));
|
|
|
|
seq_printf(m, "Allocs : n=%u ok=%u wt=%u nbf=%u int=%u\n",
|
|
atomic_read(&fscache_n_allocs),
|
|
atomic_read(&fscache_n_allocs_ok),
|
|
atomic_read(&fscache_n_allocs_wait),
|
|
atomic_read(&fscache_n_allocs_nobufs),
|
|
atomic_read(&fscache_n_allocs_intr));
|
|
seq_printf(m, "Allocs : ops=%u owt=%u abt=%u\n",
|
|
atomic_read(&fscache_n_alloc_ops),
|
|
atomic_read(&fscache_n_alloc_op_waits),
|
|
atomic_read(&fscache_n_allocs_object_dead));
|
|
|
|
seq_printf(m, "Retrvls: n=%u ok=%u wt=%u nod=%u nbf=%u"
|
|
" int=%u oom=%u\n",
|
|
atomic_read(&fscache_n_retrievals),
|
|
atomic_read(&fscache_n_retrievals_ok),
|
|
atomic_read(&fscache_n_retrievals_wait),
|
|
atomic_read(&fscache_n_retrievals_nodata),
|
|
atomic_read(&fscache_n_retrievals_nobufs),
|
|
atomic_read(&fscache_n_retrievals_intr),
|
|
atomic_read(&fscache_n_retrievals_nomem));
|
|
seq_printf(m, "Retrvls: ops=%u owt=%u abt=%u\n",
|
|
atomic_read(&fscache_n_retrieval_ops),
|
|
atomic_read(&fscache_n_retrieval_op_waits),
|
|
atomic_read(&fscache_n_retrievals_object_dead));
|
|
|
|
seq_printf(m, "Stores : n=%u ok=%u agn=%u nbf=%u oom=%u\n",
|
|
atomic_read(&fscache_n_stores),
|
|
atomic_read(&fscache_n_stores_ok),
|
|
atomic_read(&fscache_n_stores_again),
|
|
atomic_read(&fscache_n_stores_nobufs),
|
|
atomic_read(&fscache_n_stores_oom));
|
|
seq_printf(m, "Stores : ops=%u run=%u pgs=%u rxd=%u olm=%u\n",
|
|
atomic_read(&fscache_n_store_ops),
|
|
atomic_read(&fscache_n_store_calls),
|
|
atomic_read(&fscache_n_store_pages),
|
|
atomic_read(&fscache_n_store_radix_deletes),
|
|
atomic_read(&fscache_n_store_pages_over_limit));
|
|
|
|
seq_printf(m, "VmScan : nos=%u gon=%u bsy=%u can=%u wt=%u\n",
|
|
atomic_read(&fscache_n_store_vmscan_not_storing),
|
|
atomic_read(&fscache_n_store_vmscan_gone),
|
|
atomic_read(&fscache_n_store_vmscan_busy),
|
|
atomic_read(&fscache_n_store_vmscan_cancelled),
|
|
atomic_read(&fscache_n_store_vmscan_wait));
|
|
|
|
seq_printf(m, "Ops : pend=%u run=%u enq=%u can=%u rej=%u\n",
|
|
atomic_read(&fscache_n_op_pend),
|
|
atomic_read(&fscache_n_op_run),
|
|
atomic_read(&fscache_n_op_enqueue),
|
|
atomic_read(&fscache_n_op_cancelled),
|
|
atomic_read(&fscache_n_op_rejected));
|
|
seq_printf(m, "Ops : ini=%u dfr=%u rel=%u gc=%u\n",
|
|
atomic_read(&fscache_n_op_initialised),
|
|
atomic_read(&fscache_n_op_deferred_release),
|
|
atomic_read(&fscache_n_op_release),
|
|
atomic_read(&fscache_n_op_gc));
|
|
|
|
seq_printf(m, "CacheOp: alo=%d luo=%d luc=%d gro=%d\n",
|
|
atomic_read(&fscache_n_cop_alloc_object),
|
|
atomic_read(&fscache_n_cop_lookup_object),
|
|
atomic_read(&fscache_n_cop_lookup_complete),
|
|
atomic_read(&fscache_n_cop_grab_object));
|
|
seq_printf(m, "CacheOp: inv=%d upo=%d dro=%d pto=%d atc=%d syn=%d\n",
|
|
atomic_read(&fscache_n_cop_invalidate_object),
|
|
atomic_read(&fscache_n_cop_update_object),
|
|
atomic_read(&fscache_n_cop_drop_object),
|
|
atomic_read(&fscache_n_cop_put_object),
|
|
atomic_read(&fscache_n_cop_attr_changed),
|
|
atomic_read(&fscache_n_cop_sync_cache));
|
|
seq_printf(m, "CacheOp: rap=%d ras=%d alp=%d als=%d wrp=%d ucp=%d dsp=%d\n",
|
|
atomic_read(&fscache_n_cop_read_or_alloc_page),
|
|
atomic_read(&fscache_n_cop_read_or_alloc_pages),
|
|
atomic_read(&fscache_n_cop_allocate_page),
|
|
atomic_read(&fscache_n_cop_allocate_pages),
|
|
atomic_read(&fscache_n_cop_write_page),
|
|
atomic_read(&fscache_n_cop_uncache_page),
|
|
atomic_read(&fscache_n_cop_dissociate_pages));
|
|
seq_printf(m, "CacheEv: nsp=%d stl=%d rtr=%d cul=%d\n",
|
|
atomic_read(&fscache_n_cache_no_space_reject),
|
|
atomic_read(&fscache_n_cache_stale_objects),
|
|
atomic_read(&fscache_n_cache_retired_objects),
|
|
atomic_read(&fscache_n_cache_culled_objects));
|
|
netfs_stats_show(m);
|
|
return 0;
|
|
}
|