ceph: add binary logging (BLOG) for CephFS
Subsystems (3)
Alex Markuze
maintainercover ceph: add binary logging (BLOG) for CephFS
This series adds a binary logging subsystem for the CephFS kernel client. On hot I/O paths every dout() call formats a printk-style string even when nobody is reading the log. BLOG sidesteps that cost by storing compact binary records keyed by a source-ID; the records are decoded offline or via debugfs.
All new code lives under fs/ceph/ and include/linux/ceph/. There are no changes outside the Ceph subsystem apart from the kselftests.
Design
------
Allocation. A page-fragment allocator hands out buffer slices without taking any global lock. Freed fragments are recycled through per-CPU magazine batches so the common-case log path is allocation-free. Filesystem-reachable allocation uses GFP_NOFS to avoid reclaim recursion.
Source-ID caching. Each (file, func, line, fmt) tuple is registered once in a per-logger rhashtable and assigned a u32 source-ID. A per-callsite cache with smp_store_release / smp_load_acquire avoids the rhashtable lookup after the first hit. A generation counter on the logger prevents stale cache hits across mount/unmount cycles.
Per-superblock ownership. Every mounted CephFS instance (including -o noshare mounts) gets its own blog_module_context, so enable/disable and debugfs are fully isolated between mounts.
Context propagation. ceph_blog_enter() stashes the owning ceph_fs_client and an optional mds_request pointer in a ceph_journal_info that lives in current->journal_info. Nested VFS re-entry inherits the context only when the owning fsc matches, preventing cross-mount leaks. Task pointers used as hash keys are not pinned; stale entries are retired lazily via PID-mismatch detection on reuse.
debugfs. Per-superblock files appear under
/sys/kernel/debug/ceph/<fsid>/blog/{entries,stats,sources,clients}
plus a bool "enable" knob and a write-only "clear" trigger.
Logging macros. bout() and boutc() are drop-in replacements for dout() and doutc(), gated on fsc->blog_enabled. The serializer supports all kernel printf specifiers used by Ceph debug logs including %o.
Patch breakdown
---------------
01-06 BLOG infrastructure, one patch per compilation unit:
headers, deserializer, pagefrag allocator, magazine batcher, logger core, per-module context manager.
07 Ceph BLOG scaffolding -- ceph_blog.h, blog_client.c,
super.h / libceph.h additions, Makefile wiring.
08 bout/boutc macro definitions in ceph_debug.h.
09 MDS request plumbing -- switch __do_request() to
ceph_blog_enter() / ceph_blog_exit().
10 debugfs interface -- blog_debugfs.c and lifecycle hooks.
11-14 Callsite conversions -- dout/doutc -> bout/boutc, grouped
by subsystem: inodes+dirs, data I/O, caps+snaps, helpers.
15 Selftests and MAINTAINERS update.
Alex Markuze (15):
ceph: add BLOG public headers
ceph: add BLOG deserialization support
ceph: add BLOG page-fragment allocator
ceph: add BLOG magazine batch allocator
ceph: add BLOG logger core
ceph: add BLOG per-module context management
ceph: add Ceph BLOG scaffolding
ceph: add bout and boutc wrappers for BLOG
ceph: switch MDS request plumbing to struct ceph_journal_info
ceph: add BLOG debugfs interface
ceph: convert VFS inode and directory paths to bout
ceph: convert VFS data I/O paths to bout
ceph: convert capability and snapshot paths to bout
ceph: convert remaining helper paths to bout
selftests: add Ceph BLOG smoke test and collection helpers
MAINTAINERS | 1 + fs/ceph/Makefile | 6 + fs/ceph/addr.c | 168 ++--- fs/ceph/blog_batch.c | 312 ++++++++++ fs/ceph/blog_client.c | 266 ++++++++ fs/ceph/blog_core.c | 424 +++++++++++++ fs/ceph/blog_debugfs.c | 434 +++++++++++++ fs/ceph/blog_des.c | 342 ++++++++++ fs/ceph/blog_module.c | 584 ++++++++++++++++++ fs/ceph/blog_pagefrag.c | 95 +++ fs/ceph/caps.c | 252 ++++---- fs/ceph/crypto.c | 14 +- fs/ceph/debugfs.c | 23 +- fs/ceph/dir.c | 290 ++++++--- fs/ceph/export.c | 83 ++- fs/ceph/file.c | 274 +++++--- fs/ceph/inode.c | 233 ++++--- fs/ceph/ioctl.c | 6 +- fs/ceph/locks.c | 66 +- fs/ceph/mds_client.c | 293 ++++----- fs/ceph/mdsmap.c | 8 +- fs/ceph/quota.c | 2 +- fs/ceph/snap.c | 66 +- fs/ceph/super.c | 58 +- fs/ceph/super.h | 5 + fs/ceph/xattr.c | 88 ++- include/linux/ceph/blog.h | 0 include/linux/ceph/blog_batch.h | 0 include/linux/ceph/blog_des.h | 0 include/linux/ceph/blog_module.h | 0 include/linux/ceph/blog_pagefrag.h | 0 include/linux/ceph/blog_ser.h | 0 include/linux/ceph/ceph_blog.h | 284 +++++++++ include/linux/ceph/ceph_debug.h | 44 +- include/linux/ceph/libceph.h | 2 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/ceph_blog/Makefile | 7 + .../selftests/ceph_blog/blog_analyze.sh | 124 ++++ .../selftests/ceph_blog/blog_collect.sh | 116 ++++ .../selftests/ceph_blog/blog_smoke_test.sh | 363 +++++++++++ tools/testing/selftests/ceph_blog/config | 2 + 41 files changed, 4583 insertions(+), 753 deletions(-) create mode 100644 fs/ceph/blog_batch.c create mode 100644 fs/ceph/blog_client.c create mode 100644 fs/ceph/blog_core.c create mode 100644 fs/ceph/blog_debugfs.c create mode 100644 fs/ceph/blog_des.c create mode 100644 fs/ceph/blog_module.c create mode 100644 fs/ceph/blog_pagefrag.c create mode 100644 include/linux/ceph/blog.h create mode 100644 include/linux/ceph/blog_batch.h create mode 100644 include/linux/ceph/blog_des.h create mode 100644 include/linux/ceph/blog_module.h create mode 100644 include/linux/ceph/blog_pagefrag.h create mode 100644 include/linux/ceph/blog_ser.h create mode 100644 include/linux/ceph/ceph_blog.h create mode 100644 tools/testing/selftests/ceph_blog/Makefile create mode 100644 tools/testing/selftests/ceph_blog/blog_analyze.sh create mode 100644 tools/testing/selftests/ceph_blog/blog_collect.sh create mode 100644 tools/testing/selftests/ceph_blog/blog_smoke_test.sh create mode 100644 tools/testing/selftests/ceph_blog/config
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 1/15 ceph: add BLOG public headers
Add the public header files for the binary logging (BLOG) subsystem:
blog.h - core types: blog_logger, blog_log_entry,
blog_tls_ctx, blog_source_info, blog_log_iter, blog_source_id_cache; core API prototypes
blog_ser.h - type-safe serialization macros (blog_ser,
blog_cnt) with compile-time type dispatch
blog_des.h - deserialization prototypes
blog_batch.h - per-CPU magazine batch allocator types
blog_pagefrag.h - page-fragment allocator types
blog_module.h - per-module context types (blog_task_entry,
blog_module_context) and the __BLOG_LOG_CTX macro that drives the per-callsite fast path
All headers live under include/linux/ceph/ since BLOG is consumed exclusively by the CephFS client.
--- include/linux/ceph/blog.h | 0 include/linux/ceph/blog_batch.h | 0 include/linux/ceph/blog_des.h | 0 include/linux/ceph/blog_module.h | 0 include/linux/ceph/blog_pagefrag.h | 0 include/linux/ceph/blog_ser.h | 0 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 include/linux/ceph/blog.h create mode 100644 include/linux/ceph/blog_batch.h create mode 100644 include/linux/ceph/blog_des.h create mode 100644 include/linux/ceph/blog_module.h create mode 100644 include/linux/ceph/blog_pagefrag.h create mode 100644 include/linux/ceph/blog_ser.h
include/linux/ceph/blog.h new file +0 -0
include/linux/ceph/blog_batch.h new file +0 -0
include/linux/ceph/blog_des.h new file +0 -0
include/linux/ceph/blog_module.h new file +0 -0
include/linux/ceph/blog_pagefrag.h new file +0 -0
include/linux/ceph/blog_ser.h new file +0 -0
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 2/15 ceph: add BLOG deserialization support
In reply to Alex MarkuzeAdd blog_des.c implementing the binary record deserialization engine used by the debugfs read paths. Supports %d, %i, %u, %o, %x, %X, %s, %p, %c, and length modifiers (l, ll, h, hh, z).
--- fs/ceph/blog_des.c | 342 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 342 insertions(+) create mode 100644 fs/ceph/blog_des.c
fs/ceph/blog_des.c new file +342 -0
@@ -0,0 +1,342 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Binary Logging Deserialization +*/ + +#include <linux/ceph/blog_des.h> +#include <linux/ceph/blog.h> +#include <linux/string.h> +#include <linux/ctype.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/printk.h> +#include <linux/align.h> +#include <linux/unaligned.h> + +/** +* blog_des_reconstruct - Reconstructs a formatted string from serialized values +* @fmt: Format string containing % specifiers +* @buffer: Buffer containing serialized values +* @size: Size of the buffer in bytes +* @out: Buffer to store the reconstructed string +* @out_size: Size of the output buffer +* +* Return: Number of bytes written to out buffer, or negative error code on failure +*/ +int blog_des_reconstruct (const char *fmt,const void *buffer, +size_t size,char *out,size_t out_size) +{ +const char *buf_start = (const char *)buffer; +const char *buf_ptr = buf_start; +const char *buf_end = buf_start + size; +const char *fmt_ptr = fmt; +char *out_ptr = out; +size_t remaining = out_size -1 ;/* Reserve space for null terminator */ +size_t arg_count =0 ; +int ret; + +if (!fmt || !buffer || !out || !out_size) { +pr_err ("blog_des_reconstruct: invalid params fmt=%p buffer=%p out=%p out_size=%zu\n" , + fmt, buffer, out, out_size); +return -EINVAL ; + } + + *out_ptr ='\0' ; + +/* Process the format string */ +while (*fmt_ptr && remaining >0 ) { +int is_long; +int is_long_long; +int dyn_width =-1 ; +int dyn_precision =-1 ; + +if (*fmt_ptr !='%' ) { +/* Copy literal character */ + *out_ptr++ = *fmt_ptr++; + remaining--; +continue ; + } + +/* Skip the '%' */ + fmt_ptr++; + +/* Handle %% */ +if (*fmt_ptr =='%' ) { + *out_ptr++ ='%' ; + fmt_ptr++; + remaining--; +continue ; + } + +/* Skip flags (-+#0 space) */ +while (*fmt_ptr && (*fmt_ptr =='-' || *fmt_ptr =='+' || *fmt_ptr =='#' || + *fmt_ptr =='0' || *fmt_ptr ==' ' )) { + fmt_ptr++; + } + +/* Consume field width: digits are format-only, * is serialized */ +while (*fmt_ptr && (*fmt_ptr >='0' && *fmt_ptr <='9' )) + fmt_ptr++; +if (*fmt_ptr =='*' ) { +if (buf_ptr +sizeof (int ) > buf_end) +return -EFAULT ; + dyn_width =get_unaligned ((int *)buf_ptr); + buf_ptr +=sizeof (int ); + fmt_ptr++; + } + +/* Consume precision: digits are format-only, * is serialized */ +if (*fmt_ptr =='.' ) { + fmt_ptr++; +while (*fmt_ptr && (*fmt_ptr >='0' && *fmt_ptr <='9' )) + fmt_ptr++; +if (*fmt_ptr =='*' ) { +if (buf_ptr +sizeof (int ) > buf_end) +return -EFAULT ; + dyn_precision =get_unaligned ((int *)buf_ptr); + buf_ptr +=sizeof (int ); + fmt_ptr++; + } + } + +/* +* dyn_width: consumed from the buffer to keep offsets +* aligned; output width-padding is not implemented. +*/ + (void )dyn_width; + +/* Parse length modifiers (l, ll, h, hh, z) */ + is_long =0 ; + is_long_long =0 ; + +if (*fmt_ptr =='l' ) { + fmt_ptr++; + is_long =1 ; +if (*fmt_ptr =='l' ) { + fmt_ptr++; + is_long_long =1 ; + is_long =0 ; + } + }else if (*fmt_ptr =='h' ) { + fmt_ptr++; +if (*fmt_ptr =='h' ) + fmt_ptr++; + }else if (*fmt_ptr =='z' ) { + fmt_ptr++; +if (sizeof (size_t ) ==sizeof (long long )) + is_long_long =1 ; +else + is_long =1 ; + } + +/* Parse and handle format specifier */ +switch (*fmt_ptr) { +case 's' : { +const char *str; +size_t str_len; +size_t out_len; +size_t max_scan_len; + +if (buf_ptr >= buf_end) { +pr_err ("blog_des_reconstruct: string arg %zu overruns buffer (no space)\n" , + arg_count); +return -EFAULT ; + } + + str = buf_ptr; + max_scan_len = buf_end - buf_ptr; + + str_len =strnlen (str, max_scan_len); +if (str_len == max_scan_len && str[str_len -1 ] !='\0' ) { +pr_err ("blog_des_reconstruct: unterminated string at arg %zu (fmt=%s)\n" , + arg_count, fmt); +return -EFAULT ; + } + + buf_ptr +=round_up (str_len +1 ,4 ); +if (buf_ptr > buf_end) { +pr_err ("blog_des_reconstruct: string arg %zu overruns buffer after copy (fmt=%s)\n" , + arg_count, fmt); +return -EFAULT ; + } + + out_len = str_len; +if (dyn_precision >=0 && (size_t )dyn_precision < out_len) + out_len = (size_t )dyn_precision; +if (out_len > remaining) + out_len = remaining; +memcpy (out_ptr, str, out_len); + out_ptr += out_len; + remaining -= out_len; +break ; + } +case 'd' : +case 'i' : { +if (is_long_long) { +long long val; + +if (buf_ptr +sizeof (long long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((long long *)buf_ptr); + buf_ptr +=sizeof (long long ); + ret =snprintf (out_ptr, remaining,"%lld" , val); + }else if (is_long) { +long val; + +if (buf_ptr +sizeof (long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((long *)buf_ptr); + buf_ptr +=sizeof (long ); + ret =snprintf (out_ptr, remaining,"%ld" , val); + }else { +int val; + +if (buf_ptr +sizeof (int ) > buf_end) +return -EFAULT ; + val =get_unaligned ((int *)buf_ptr); + buf_ptr +=sizeof (int ); + ret =snprintf (out_ptr, remaining,"%d" , val); + } +if (ret >0 ) { +if (ret > remaining) + ret = remaining; + out_ptr += ret; + remaining -= ret; + } +break ; + } +case 'u' : { +if (is_long_long) { +unsigned long long val; + +if (buf_ptr +sizeof (unsigned long long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned long long *)buf_ptr); + buf_ptr +=sizeof (unsigned long long ); + ret =snprintf (out_ptr, remaining,"%llu" , val); + }else if (is_long) { +unsigned long val; + +if (buf_ptr +sizeof (unsigned long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned long *)buf_ptr); + buf_ptr +=sizeof (unsigned long ); + ret =snprintf (out_ptr, remaining,"%lu" , val); + }else { +unsigned int val; + +if (buf_ptr +sizeof (unsigned int ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned int *)buf_ptr); + buf_ptr +=sizeof (unsigned int ); + ret =snprintf (out_ptr, remaining,"%u" , val); + } +if (ret >0 ) { +if (ret > remaining) + ret = remaining; + out_ptr += ret; + remaining -= ret; + } +break ; + } +case 'o' : +case 'x' : +case 'X' : { +const char *num_fmt; + +if (*fmt_ptr =='o' ) + num_fmt = is_long_long ?"%llo" : is_long ?"%lo" :"%o" ; +else if (*fmt_ptr =='x' ) + num_fmt = is_long_long ?"%llx" : is_long ?"%lx" :"%x" ; +else + num_fmt = is_long_long ?"%llX" : is_long ?"%lX" :"%X" ; + +if (is_long_long) { +unsigned long long val; + +if (buf_ptr +sizeof (unsigned long long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned long long *)buf_ptr); + buf_ptr +=sizeof (unsigned long long ); + ret =snprintf (out_ptr, remaining, num_fmt, val); + }else if (is_long) { +unsigned long val; + +if (buf_ptr +sizeof (unsigned long ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned long *)buf_ptr); + buf_ptr +=sizeof (unsigned long ); + ret =snprintf (out_ptr, remaining, num_fmt, val); + }else { +unsigned int val; + +if (buf_ptr +sizeof (unsigned int ) > buf_end) +return -EFAULT ; + val =get_unaligned ((unsigned int *)buf_ptr); + buf_ptr +=sizeof (unsigned int ); + ret =snprintf (out_ptr, remaining, num_fmt, val); + } +if (ret >0 ) { +if (ret > remaining) + ret = remaining; + out_ptr += ret; + remaining -= ret; + } +break ; + } +case 'p' : { +void *ptr; + +if (buf_ptr +sizeof (void *) > buf_end) +return -EFAULT ; + + ptr = (void *)(unsigned long )get_unaligned ((unsigned long *)buf_ptr); + buf_ptr +=sizeof (void *); + +/* +* Skip kernel %p sub-specifiers (U, I, d, D, etc.). +* bout/boutc do not support %p extensions; call sites +* must pre-format them with snprintf and pass %s. +*/ +while (fmt_ptr[1 ] &&isalpha (fmt_ptr[1 ])) + fmt_ptr++; + + ret =snprintf (out_ptr, remaining,"%p" , ptr); +if (ret >0 ) { +if (ret > remaining) + ret = remaining; + out_ptr += ret; + remaining -= ret; + } +break ; + } +case 'c' : { +char val; + +if (buf_ptr +sizeof (int ) > buf_end) +return -EFAULT ; + + val = (char )get_unaligned ((int *)buf_ptr); + buf_ptr +=sizeof (int ); + +if (remaining >0 ) { + *out_ptr++ = val; + remaining--; + } +break ; + } +default : +pr_err ("%s: unsupported format specifier '%%%c' at argument %zu\n" , + __func__, *fmt_ptr, arg_count); +return -EINVAL ; + } + + fmt_ptr++; + arg_count++; + } + +/* Null-terminate the output */ + *out_ptr ='\0' ; + +return out_ptr - out; +}
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 3/15 ceph: add BLOG page-fragment allocator
In reply to Alex MarkuzeAdd blog_pagefrag.c: lockless page-fragment buffer allocator for per-task BLOG contexts.
--- fs/ceph/blog_pagefrag.c | 95 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 fs/ceph/blog_pagefrag.c
fs/ceph/blog_pagefrag.c new file +95 -0
@@ -0,0 +1,95 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Binary Logging Page Fragment Management +*/ + +#include <linux/printk.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/module.h> +#include <linux/ceph/blog_pagefrag.h> + +/** +* blog_pagefrag_reserve - Reserve space in the pagefrag buffer +* @pf: pagefrag allocator +* @n: number of bytes to reserve +* +* Checks if there is sufficient space and returns the current head offset +* WITHOUT advancing the head pointer. This allows the caller to write data +* before making it visible via blog_pagefrag_publish(). +* +* This is lockless - only one writer per pagefrag (per-task context). +* +* Return: offset to reserved memory, or negative error if not enough space +*/ +int blog_pagefrag_reserve (struct blog_pagefrag *pf,unsigned int n) +{ +if (n > pf->capacity - pf->head) +return -ENOMEM ;/* No space left */ +return pf->head;/* Return offset without advancing */ +} + +/** +* blog_pagefrag_publish - Publish reserved space by advancing head pointer +* @pf: pagefrag allocator +* @publish_head: new head value (offset + bytes_written) +* +* Advances the head pointer to make previously written data visible to +* readers. Uses store-release so that any reader that observes the new +* head value (via load-acquire or under pf->lock) is guaranteed to see +* the preceding entry writes. +* +* Single-writer per pagefrag (per-task context). +*/ +void blog_pagefrag_publish (struct blog_pagefrag *pf,u64 publish_head) +{ + pf->alloc_count++; + pf->active_elements++; +/* Release-store pairs with the acquire in readers (pf->lock). */ +smp_store_release (&pf->head, (unsigned int )publish_head); +} + +/** +* blog_pagefrag_get_ptr - Get buffer pointer from pagefrag reserve result +* @pf: pagefrag allocator +* @val: return value from blog_pagefrag_reserve +* +* Return: pointer to reserved buffer region +*/ +void *blog_pagefrag_get_ptr (struct blog_pagefrag *pf,u64 val) +{ +char *base = (char *)pf->buffer; +void *rc = base + val; + +if (unlikely (rc < pf->buffer || + rc >= (void *)(base + pf->capacity))) { +pr_err ("%s: invalid pointer %llx\n" , __func__, + (unsigned long long )(uintptr_t )rc); +WARN_ON_ONCE (1 ); +return NULL ; + } +return rc; +} + +/** +* blog_pagefrag_reset - Reset the pagefrag allocator +* @pf: pagefrag allocator to reset +* +* Resets the head pointer and counters to the beginning of the buffer, +* discarding all stored entries. +* +* Context: Callers must ensure that no writers are active on this +* pagefrag before calling reset. The pagefrag is single-writer and +* writers do not take pf->lock, so resetting while a writer is mid- +* reservation corrupts state. In practice this means the owning task +* must have finished its current blog_log() / blog_log_commit() pair. +*/ +void blog_pagefrag_reset (struct blog_pagefrag *pf) +{ +spin_lock (&pf->lock); + pf->head =0 ; + pf->active_elements =0 ; + pf->alloc_count =0 ; + pf->last_entry =NULL ; +spin_unlock (&pf->lock); +}
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 4/15 ceph: add BLOG magazine batch allocator
In reply to Alex MarkuzeAdd blog_batch.c: per-CPU magazine batching for TLS context recycling. Freed composites go to a local magazine; subsequent acquisitions reclaim from the magazine, making the common-case log path allocation-free.
--- fs/ceph/blog_batch.c | 312 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 fs/ceph/blog_batch.c
fs/ceph/blog_batch.c new file +312 -0
@@ -0,0 +1,312 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Binary Logging Batch Management +* +* Magazine-based batching for efficient object recycling. +*/ + +#include <linux/slab.h> +#include <linux/module.h> +#include <linux/percpu.h> +#include <linux/preempt.h> +#include <linux/spinlock.h> +#include <linux/list.h> +#include <linux/ceph/blog_batch.h> +#include <linux/ceph/blog.h> + +static struct blog_magazine *alloc_magazine (struct blog_batch *batch,gfp_t gfp) +{ +struct blog_magazine *mag; + +/* Allocate magazine structure from cache */ + mag =kmem_cache_zalloc (batch->magazine_cache, gfp); +if (!mag) +return NULL ; + +INIT_LIST_HEAD (&mag->list); + mag->count =0 ; +return mag; +} + +static void free_magazine (struct blog_batch *batch,struct blog_magazine *mag) +{ +int i; +struct blog_tls_pagefrag *composite; + +/* Free all composites in this magazine before freeing magazine itself */ +for (i =0 ; i < mag->count; i++) { + composite = mag->elements[i]; +if (composite) { +/* Composites are allocated with alloc_pages(), free with __free_pages() */ +__free_pages (virt_to_page (composite), +get_order (BLOG_TLS_PAGEFRAG_ALLOC_SIZE )); + } + } + +/* Free the magazine structure itself */ +kmem_cache_free (batch->magazine_cache, mag); +} + +/** +* blog_batch_init - Initialize the batching system +* @batch: Batch structure to initialize +* @mag_cache: Slab cache for magazine structs, or NULL to create one +* @nr_prealloc: Number of composites to preallocate (0 = none) +* @retain_limit: Max composites to retain on put; excess are freed (0 = unlimited) +* +* Allocates and initializes the per-CPU magazines and global pools. +* Composites are allocated via alloc_pages() in BLOG_MAGAZINE_SIZE +* batches. Pass nr_prealloc = 0 for batches that start empty +* (e.g. the log_batch). +* +* Return: 0 on success, negative error code on failure +*/ +int blog_batch_init (struct blog_batch *batch,struct kmem_cache *mag_cache, +unsigned int nr_prealloc,unsigned int retain_limit) +{ +unsigned int nr_mags, i, j; +int cpu; +struct blog_cpu_magazine *cpu_mag; +struct blog_magazine *mag; +struct blog_tls_pagefrag *composite; +struct page *pages; + +/* Initialize counters */ + batch->nr_full =0 ; + batch->nr_empty =0 ; + batch->retain_limit = retain_limit; + +/* Use caller-provided cache or create one */ +if (mag_cache) { + batch->magazine_cache = mag_cache; + batch->external_cache = true; + }else { + batch->magazine_cache =kmem_cache_create ("blog_magazine" , +sizeof (struct blog_magazine ), +0 ,SLAB_HWCACHE_ALIGN ,NULL ); +if (!batch->magazine_cache) +return -ENOMEM ; + batch->external_cache = false; + } + +/* Initialize global magazine lists */ +INIT_LIST_HEAD (&batch->full_magazines); +INIT_LIST_HEAD (&batch->empty_magazines); +spin_lock_init (&batch->full_lock); +spin_lock_init (&batch->empty_lock); + +/* Allocate per-CPU magazines */ + batch->cpu_magazines = alloc_percpu(struct blog_cpu_magazine); +if (!batch->cpu_magazines) + goto cleanup_cache; + +/* Initialize per-CPU magazines to NULL (magazines allocated on-demand) */ +for_each_possible_cpu (cpu) { + cpu_mag =per_cpu_ptr (batch->cpu_magazines, cpu); + cpu_mag->mag =NULL ; + } + +/* Pre-populate magazines with composites */ + nr_mags =DIV_ROUND_UP (nr_prealloc,BLOG_MAGAZINE_SIZE ); +for (i =0 ; i < nr_mags; i++) { + mag =alloc_magazine (batch,GFP_KERNEL ); +if (!mag) + goto cleanup; + +for (j =0 ; j <BLOG_MAGAZINE_SIZE ; j++) { + pages =alloc_pages (GFP_KERNEL | __GFP_ZERO, +get_order (BLOG_TLS_PAGEFRAG_ALLOC_SIZE )); +if (!pages) { +free_magazine (batch, mag); + goto cleanup; + } + composite =page_address (pages); + mag->elements[j] = composite; + mag->count++; + } + +spin_lock (&batch->full_lock); +list_add (&mag->list, &batch->full_magazines); + batch->nr_full++; +spin_unlock (&batch->full_lock); + } + +return 0 ; + +cleanup: +blog_batch_cleanup (batch); +return -ENOMEM ; + +cleanup_cache: +if (!batch->external_cache && batch->magazine_cache) +kmem_cache_destroy (batch->magazine_cache); +return -ENOMEM ; +} + +/** +* blog_batch_cleanup - Clean up the batching system +* @batch: Batch structure to clean up +* +* Frees all magazines and composites, and destroys the magazine cache. +*/ +void blog_batch_cleanup (struct blog_batch *batch) +{ +int cpu; +struct blog_magazine *mag, *tmp; +struct blog_cpu_magazine *cpu_mag; + +/* Free per-CPU magazines */ +if (batch->cpu_magazines) { +for_each_possible_cpu (cpu) { + cpu_mag =per_cpu_ptr (batch->cpu_magazines, cpu); +if (cpu_mag->mag) +free_magazine (batch, cpu_mag->mag); + } +free_percpu (batch->cpu_magazines); + } + +/* Free magazines in the full pool */ +spin_lock (&batch->full_lock); +list_for_each_entry_safe (mag, tmp, &batch->full_magazines, list) { +list_del (&mag->list); + batch->nr_full--; +free_magazine (batch, mag); + } +spin_unlock (&batch->full_lock); + +/* Free magazines in the empty pool */ +spin_lock (&batch->empty_lock); +list_for_each_entry_safe (mag, tmp, &batch->empty_magazines, list) { +list_del (&mag->list); + batch->nr_empty--; +free_magazine (batch, mag); + } +spin_unlock (&batch->empty_lock); + +/* Destroy magazine cache */ +if (!batch->external_cache && batch->magazine_cache) +kmem_cache_destroy (batch->magazine_cache); + + batch->magazine_cache =NULL ; + batch->external_cache = false; +} + +/** +* blog_batch_get - Get an element from the batch +* @batch: Batch to get element from +* +* Return: Element from the magazine, or NULL if none available +*/ +void *blog_batch_get (struct blog_batch *batch) +{ +struct blog_cpu_magazine *cpu_mag; +struct blog_magazine *old_mag, *new_mag; +void *element =NULL ; + +preempt_disable (); + cpu_mag =this_cpu_ptr (batch->cpu_magazines); + +/* If we have a magazine and it has elements, use it */ +if (cpu_mag->mag && cpu_mag->mag->count >0 ) { + element = cpu_mag->mag->elements[--cpu_mag->mag->count]; + goto out; + } + +/* Current magazine is empty, try to get a full one */ + old_mag = cpu_mag->mag; + +/* Return old magazine to empty pool if we have one */ +if (old_mag) { +spin_lock (&batch->empty_lock); +list_add (&old_mag->list, &batch->empty_magazines); + batch->nr_empty++; +spin_unlock (&batch->empty_lock); + cpu_mag->mag =NULL ; + } + +if (READ_ONCE (batch->nr_full) >0 ) { +/* Try to get a full magazine */ +spin_lock (&batch->full_lock); +if (!list_empty (&batch->full_magazines)) { + new_mag =list_first_entry (&batch->full_magazines, + struct blog_magazine, list); +list_del (&new_mag->list); + batch->nr_full--; +spin_unlock (&batch->full_lock); + + cpu_mag->mag = new_mag; +if (new_mag->count >0 ) + element = new_mag->elements[--new_mag->count]; + }else { +spin_unlock (&batch->full_lock); + } + } +out: +preempt_enable (); +return element; +} + +/** +* blog_batch_put - Put an element back into the batch +* @batch: Batch to put element into +* @element: Element to put back +*/ +void blog_batch_put (struct blog_batch *batch,void *element) +{ +struct blog_cpu_magazine *cpu_mag; +struct blog_magazine *mag; + +/* Trim: if over retention limit, free the element instead of storing */ +if (batch->retain_limit && +READ_ONCE (batch->nr_full) *BLOG_MAGAZINE_SIZE >= batch->retain_limit) { +__free_pages (virt_to_page (element), +get_order (BLOG_TLS_PAGEFRAG_ALLOC_SIZE )); +return ; + } + +preempt_disable (); + cpu_mag =this_cpu_ptr (batch->cpu_magazines); + +/* Optimistically try to add to current magazine */ +if (likely (cpu_mag->mag && cpu_mag->mag->count <BLOG_MAGAZINE_SIZE )) { + cpu_mag->mag->elements[cpu_mag->mag->count++] = element; + goto out; + } + +/* If current magazine is full, move it to full pool */ +if (likely (cpu_mag->mag && cpu_mag->mag->count >=BLOG_MAGAZINE_SIZE )) { +spin_lock (&batch->full_lock); +list_add_tail (&cpu_mag->mag->list, &batch->full_magazines); + batch->nr_full++; +spin_unlock (&batch->full_lock); + cpu_mag->mag =NULL ; + } + +/* Get new magazine if needed */ +if (likely (!cpu_mag->mag)) { +/* Try to get from empty pool first */ +spin_lock (&batch->empty_lock); +if (!list_empty (&batch->empty_magazines)) { + mag =list_first_entry (&batch->empty_magazines, + struct blog_magazine, list); +list_del (&mag->list); + batch->nr_empty--; +spin_unlock (&batch->empty_lock); + cpu_mag->mag = mag; + }else { +spin_unlock (&batch->empty_lock); + cpu_mag->mag =alloc_magazine (batch,GFP_ATOMIC ); + } + +if (unlikely (!cpu_mag->mag)) { +/* Cannot store element; free it to avoid a leak */ +__free_pages (virt_to_page (element), +get_order (BLOG_TLS_PAGEFRAG_ALLOC_SIZE )); + goto out; + } + } +/* Add element to magazine */ + cpu_mag->mag->elements[cpu_mag->mag->count++] = element; +out: +preempt_enable (); +}
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 5/15 ceph: add BLOG logger core
In reply to Alex MarkuzeAdd blog_core.c: central logger, source-ID registry with per-callsite caching (smp_store_release/smp_load_acquire plus generation counter), circular entry buffer, and iteration API for debugfs consumers.
--- fs/ceph/blog_core.c | 424 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 424 insertions(+) create mode 100644 fs/ceph/blog_core.c
fs/ceph/blog_core.c new file +424 -0
@@ -0,0 +1,424 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Binary Logging Infrastructure - Core Implementation +* +* Per-module logger instances, source-ID registration, log-entry +* reservation/commit, and pagefrag-based context management. +*/ + +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/slab.h> +#include <linux/string.h> +#include <linux/printk.h> +#include <linux/time.h> +#include <linux/percpu.h> +#include <linux/spinlock.h> +#include <linux/list.h> +#include <linux/sched.h> +#include <linux/atomic.h> + +#include <linux/rhashtable.h> +#include <linux/ceph/blog.h> +#include <linux/ceph/blog_batch.h> +#include <linux/ceph/blog_pagefrag.h> +#include <linux/ceph/blog_ser.h> +#include <linux/ceph/blog_des.h> +#include <linux/ceph/blog_module.h> + +/* Core BLOG functions - all require a valid logger parameter */ + +static struct blog_tls_ctx *lookup_active_ctx (struct blog_logger *logger) +{ +struct task_struct *task = current; +struct blog_task_entry *entry; + +if (!logger) +return NULL ; + +rcu_read_lock (); + entry =rhashtable_lookup_fast (&logger->task_map, &task, + logger->task_map.p); +if (entry && entry->pid == task->pid) { +struct blog_tls_ctx *ctx = entry->ctx; + +rcu_read_unlock (); +return ctx; + } +rcu_read_unlock (); +return NULL ; +} + +/** +* blog_get_tls_ctx - Get or create TLS context for current task +* @logger: Logger instance to use +* +* Returns pointer to TLS context or NULL on error +*/ +struct blog_tls_ctx *blog_get_tls_ctx (struct blog_logger *logger) +{ +struct blog_tls_ctx *ctx; + +if (!logger) +return NULL ; + + ctx =lookup_active_ctx (logger); +if (ctx) +return ctx; + +/* Delegate to module layer which manages the rhashtable insert */ +if (logger->owner_ctx) +return blog_get_tls_ctx_ctx (logger->owner_ctx); + +return NULL ; +} + +static bool blog_source_matches (const struct blog_source_info *info, +const char *file,const char *func, +unsigned int line,const char *fmt) +{ +return info->file && info->func && info->fmt && + info->line == line && info->fmt == fmt && + !strcmp (info->file, file) && !strcmp (info->func, func); +} + +/** +* blog_get_source_id - Get or create a source ID for the given location +* @logger: Logger instance to use (NULL for global) +* @file: Source file name +* @func: Function name +* @line: Line number +* @fmt: Format string +* +* Returns a unique ID for this source location +*/ +u32 blog_get_source_id (struct blog_logger *logger,const char *file, +const char *func,unsigned int line,const char *fmt) +{ +struct blog_source_info *info; +u32 id, next_id; + +if (!logger) +return 0 ; + +spin_lock (&logger->source_lock); + next_id =atomic_read (&logger->next_source_id); +for (id =1 ; id < next_id; id++) { + info = &logger->source_map[id]; +if (blog_source_matches (info, file, func, line, fmt)) + goto out_unlock; + } + + id = next_id; +if (id >=BLOG_MAX_SOURCE_IDS ) { +atomic_set (&logger->next_source_id,BLOG_MAX_SOURCE_IDS ); +spin_unlock (&logger->source_lock); +pr_warn_once ("blog: source ID overflow\n" ); +return 0 ; + } + +atomic_inc (&logger->next_source_id); + info = &logger->source_map[id]; + info->file = file; + info->func = func; + info->line = line; + info->fmt = fmt; + info->warn_count =0 ; +#if BLOG_TRACK_USAGE +atomic_set (&info->task_usage,0 ); +atomic_set (&info->task_bytes,0 ); +#endif + +out_unlock: +spin_unlock (&logger->source_lock); +return id; +} + +u32 blog_get_source_id_cached (struct blog_logger *logger, +struct blog_source_id_cache *cache, +const char *file,const char *func, +unsigned int line,const char *fmt) +{ +u32 sid; + +if (!logger) +return 0 ; +if (cache) { + sid =smp_load_acquire (&cache->id); +if (sid &&READ_ONCE (cache->logger) == logger && +READ_ONCE (cache->generation) == logger->generation) +return sid; + } + + sid =blog_get_source_id (logger, file, func, line, fmt); +if (cache && sid) { +WRITE_ONCE (cache->logger, logger); +WRITE_ONCE (cache->generation, logger->generation); +smp_store_release (&cache->id, sid); + } + +return sid; +} + +/** +* blog_get_source_info - Get source info for a given ID +* @id: Source ID +* +* Returns the source information for this ID +*/ +struct blog_source_info *blog_get_source_info (struct blog_logger *logger,u32 id) +{ +if (!logger ||unlikely (id ==0 || id >=BLOG_MAX_SOURCE_IDS )) +return NULL ; +return &logger->source_map[id]; +} + +/** +* blog_log - Reserve buffer for a binary log message +* @logger: Logger instance to use +* @source_id: Source ID for this location +* @client_id: Client ID for this message (module-specific) +* @needed_size: Size needed for the message +* +* Only one reservation may be outstanding per context at a time. +* The caller must call blog_log_commit() before issuing another +* blog_log() on the same context. +* +* Returns a buffer to write the message into, or NULL on failure +*/ +void *blog_log (struct blog_logger *logger,u32 source_id,u8 client_id,size_t needed_size) +{ +struct blog_tls_ctx *ctx; +struct blog_log_entry *entry =NULL ; +int alloc; +int retry_count =0 ; + +#if BLOG_TRACK_USAGE +struct blog_source_info *source; +#endif +/* Preserve payload length; compute rounded total allocation separately */ +size_t payload_len = needed_size; + +if (payload_len >BLOG_MAX_PAYLOAD ) { +pr_warn_once ("%s: payload %zu exceeds max %u\n" , + __func__, payload_len,BLOG_MAX_PAYLOAD ); +return NULL ; + } + + needed_size =round_up (payload_len +sizeof (struct blog_log_entry ),8 ); +#if BLOG_TRACK_USAGE + source =blog_get_source_info (logger, source_id); +if (unlikely (source)) { +atomic_inc (&source->task_usage); +atomic_add (needed_size, &source->task_bytes); + } +#endif + +while (entry ==NULL ) { +struct blog_pagefrag *pf; + + ctx =blog_get_ctx (logger); +if (!ctx) +return NULL ; +if (unlikely (retry_count)) { +pr_debug ( +"[%d]Retrying allocation with ctx %llu (%s, pid %d) (retry %d, needed_size=%zu @ %d)\n" , +smp_processor_id (), ctx->id, ctx->comm, + ctx->pid, retry_count, needed_size, source_id); + } + + pf =blog_ctx_pf (ctx); + +if (test_and_clear_bit (BLOG_CTX_NEEDS_RESET , &ctx->flags)) { +blog_pagefrag_reset (pf); + ctx->pending_offset =0 ; + ctx->pending_size =0 ; + } + + alloc =blog_pagefrag_reserve (pf, needed_size); +if (alloc == -ENOMEM ) { +pr_debug ("%s: allocation failed (needed %zu), resetting context\n" , + __func__, needed_size); +blog_pagefrag_reset (pf); + retry_count++; +if (retry_count >3 ) { +pr_err ("%s: failed to allocate after 3 retries\n" , __func__); +return NULL ; + } +continue ; + } + + entry =blog_pagefrag_get_ptr (pf, alloc); +if (!entry) { +pr_err ("%s: failed to get pointer from pagefrag\n" , __func__); +return NULL ; + } + pf->last_entry = entry; + +/* Store pending publish info for blog_log_commit() */ +if (WARN_ON_ONCE (ctx->pending_size !=0 )) +return NULL ; + ctx->pending_offset = alloc; + ctx->pending_size = needed_size; + } + +#if BLOG_DEBUG_POISON + entry->debug_poison =BLOG_LOG_ENTRY_POISON ; +#endif + entry->ts_delta = (u32)(jiffies - ctx->base_jiffies); + entry->source_id = (u16 )source_id; + entry->len = (u16 )payload_len; + entry->client_id = client_id; + entry->flags =0 ; + +return entry->buffer; +} + +/** +* blog_log_commit - Publish a reserved log entry +* @logger: Logger instance +* @actual_size: Actual bytes written during serialization +* +* Publishes the log entry that was reserved by the last blog_log() call. +* Must be called after serialization is complete to make the entry visible +* to readers. +* +* Context: Same context as the preceding blog_log() call +* Return: 0 on success, negative error code on failure +*/ +int blog_log_commit (struct blog_logger *logger,size_t actual_size) +{ +struct blog_tls_ctx *ctx =blog_get_ctx (logger); +struct blog_pagefrag *pf; +struct blog_log_entry *entry; +size_t total_size; + +if (!ctx) +return -EINVAL ; + +/* Validate that actual_size fits within the reservation */ + total_size =round_up (sizeof (struct blog_log_entry ) + actual_size,8 ); +if (total_size > ctx->pending_size) +return -ENOSPC ; + + pf =blog_ctx_pf (ctx); + + entry =blog_pagefrag_get_ptr (pf, ctx->pending_offset); +if (!entry) { + ctx->pending_offset =0 ; + ctx->pending_size =0 ; +return -EFAULT ; + } + entry->len = (u16 )actual_size; + +blog_pagefrag_publish (pf, ctx->pending_offset + total_size); + ctx->pending_offset =0 ; + ctx->pending_size =0 ; + +return 0 ; +} + +/** +* blog_get_ctx - Get logging context for current task +*/ +struct blog_tls_ctx *blog_get_ctx (struct blog_logger *logger) +{ +return blog_get_tls_ctx (logger); +} + +/** +* blog_log_iter_init - Initialize the iterator for a specific pagefrag +*/ +void blog_log_iter_init (struct blog_log_iter *iter,struct blog_pagefrag *pf, +u64 head_snapshot) +{ +if (!iter || !pf) +return ; + + iter->pf = pf; + iter->current_offset =0 ; + iter->end_offset = head_snapshot; + iter->prev_offset =0 ; + iter->steps =0 ; +} + +/** +* blog_log_iter_next - Get next log entry +*/ +struct blog_log_entry *blog_log_iter_next (struct blog_log_iter *iter) +{ +struct blog_log_entry *entry; + +if (!iter || iter->current_offset >= iter->end_offset) +return NULL ; + +/* Ensure the entry header itself fits within the snapshot. */ +if (iter->current_offset +sizeof (struct blog_log_entry ) > + iter->end_offset) +return NULL ; + + entry =blog_pagefrag_get_ptr (iter->pf, iter->current_offset); +if (!entry) +return NULL ; + + iter->prev_offset = iter->current_offset; + iter->current_offset += +round_up (sizeof (struct blog_log_entry ) + entry->len,8 ); + iter->steps++; + +/* +* Clamp to the snapshot boundary: a corrupted entry->len could +* push current_offset past end_offset into garbage memory. +*/ +if (iter->current_offset > iter->end_offset) + iter->current_offset = iter->end_offset; + +return entry; +} + +/** +* blog_des_entry - Deserialize entry with callback +*/ +int blog_des_entry (struct blog_logger *logger,struct blog_log_entry *entry, +char *output,size_t out_size,blog_client_des_fn client_cb) +{ +int len =0 ; +struct blog_source_info *source; + +if (!entry || !output) +return -EINVAL ; + +/* Let module handle client_id if callback provided */ +if (client_cb) { + len =client_cb (output, out_size, entry->client_id); +if (len <0 ) +return len; + } + +/* Get source info */ + source =blog_get_source_info (logger, entry->source_id); +if (!source) { + len +=snprintf (output + len, out_size - len, +"[unknown source %u]" , entry->source_id); +return len; + } + +/* Add source location */ + len +=snprintf (output + len, out_size - len,"[%s:%s:%u] " , + source->file, source->func, source->line); + +/* Deserialize the buffer content */ + { +int ret; + + ret =blog_des_reconstruct (source->fmt, entry->buffer, + entry->len, output + len, + out_size - len); +if (ret <0 ) +return ret; + len += ret; + } + +return len; +}
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 6/15 ceph: add BLOG per-module context management
In reply to Alex MarkuzeAdd blog_module.c: per-superblock rhashtable mapping tasks to blog_task_entry structures, with context acquire/release and safe retirement that clears the RETIRED bit on removal failure.
Task pointers are not pinned with get_task_struct(); retirement happens lazily on pointer reuse (PID-mismatch detection) and at unmount. Filesystem-reachable allocation paths use GFP_NOFS to avoid reclaim recursion.
--- fs/ceph/blog_module.c | 584 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 584 insertions(+) create mode 100644 fs/ceph/blog_module.c
fs/ceph/blog_module.c new file +584 -0
@@ -0,0 +1,584 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Binary Logging Infrastructure (BLOG) - Per-Module Support +* +* Per-task context association via rhashtable keyed by task pointer. +* Stale entries (task_struct reuse) are detected by PID comparison. +*/ + +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/mm.h> +#include <linux/spinlock.h> +#include <linux/list.h> +#include <linux/atomic.h> +#include <linux/sched.h> +#include <linux/sched/signal.h> +#include <linux/rhashtable.h> +#include <linux/ceph/blog.h> +#include <linux/ceph/blog_module.h> + +static LIST_HEAD (blog_module_contexts); +static DEFINE_SPINLOCK (blog_modules_lock); +static atomic64_t blog_logger_gen =ATOMIC64_INIT (1 ); + +#define BLOG_LOG_BATCH_MAX_FULL 16 +#define BLOG_TASK_ENTRY_RETIRED 0 + +/* --- rhashtable parameters for task -> context mapping --- */ + +static const struct rhashtable_params blog_task_ht_params = { + .key_offset = offsetof(struct blog_task_entry , task), + .key_len =sizeof (struct task_struct *), + .head_offset = offsetof(struct blog_task_entry , node), + .automatic_shrinking = true, +}; + +/* --- helper: recycle a TLS context back to the magazine batches --- */ + +static void blog_module_rebalance_log_batch (struct blog_logger *logger) +{ +struct blog_magazine *mag; + +if (!logger || logger->log_batch.nr_full <=BLOG_LOG_BATCH_MAX_FULL ) +return ; + +spin_lock (&logger->log_batch.full_lock); +if (list_empty (&logger->log_batch.full_magazines)) { +spin_unlock (&logger->log_batch.full_lock); +return ; + } + mag =list_first_entry (&logger->log_batch.full_magazines, + struct blog_magazine, list); +list_del (&mag->list); + logger->log_batch.nr_full--; +spin_unlock (&logger->log_batch.full_lock); + +spin_lock (&logger->alloc_batch.full_lock); +list_add (&mag->list, &logger->alloc_batch.full_magazines); + logger->alloc_batch.nr_full++; +spin_unlock (&logger->alloc_batch.full_lock); +} + +static void blog_module_queue_to_log_batch (struct blog_logger *logger, +struct blog_tls_ctx *ctx) +{ +struct blog_tls_pagefrag *composite; + +if (!logger || !ctx) +return ; +if (logger->owner_ctx) +atomic_dec (&logger->owner_ctx->allocated_contexts); + composite =blog_ctx_container (ctx); +atomic_set (&ctx->refcount,0 ); + ctx->pending_offset =0 ; + ctx->pending_size =0 ; +blog_batch_put (&logger->log_batch, composite); +blog_module_rebalance_log_batch (logger); +} + +static void blog_module_clear_task (struct blog_tls_ctx *ctx) +{ +if (ctx) +WRITE_ONCE (ctx->task,NULL ); +} + +static void blog_module_tls_release (void *ptr) +{ +struct blog_tls_ctx *ctx = ptr; +struct blog_logger *logger; + +if (!ctx) +return ; + logger = ctx->logger; +if (!logger) { +pr_err ("BUG: TLS context id=%llu has no logger\n" , ctx->id); +return ; + } +blog_module_clear_task (ctx); +blog_module_queue_to_log_batch (logger, ctx); +} + +/* --- task-entry lifecycle --- */ + +static void blog_task_entry_free_rcu (struct rcu_head *rcu) +{ +kfree (container_of(rcu ,struct blog_task_entry ,rcu )); +} + +/* +* Retire a stale rhashtable entry: remove from hash table, recycle the +* TLS context back to the magazine batch, and schedule the entry for +* RCU-deferred freeing. +*/ +static bool blog_retire_entry_locked (struct blog_logger *logger, +struct blog_task_entry *entry, +struct blog_tls_ctx **tls_ctx) +{ +if (test_and_set_bit (BLOG_TASK_ENTRY_RETIRED , &entry->flags)) +return false; +if (rhashtable_remove_fast (&logger->task_map, &entry->node, + blog_task_ht_params)) { +clear_bit (BLOG_TASK_ENTRY_RETIRED , &entry->flags); +return false; + } + + *tls_ctx = entry->ctx; +if (*tls_ctx && !list_empty (&(*tls_ctx)->list)) +list_del_init (&(*tls_ctx)->list); +return true; +} + +static bool blog_retire_stale_task (struct blog_logger *logger, +struct task_struct *task) +{ +struct blog_task_entry *entry; +struct blog_tls_ctx *tls_ctx =NULL ; +bool retired = false; + +spin_lock (&logger->lock); +rcu_read_lock (); + entry =rhashtable_lookup_fast (&logger->task_map, &task, + blog_task_ht_params); +if (entry && entry->pid != task->pid) + retired =blog_retire_entry_locked (logger, entry, &tls_ctx); +rcu_read_unlock (); +spin_unlock (&logger->lock); + +if (tls_ctx) { +blog_module_clear_task (tls_ctx); +blog_module_queue_to_log_batch (logger, tls_ctx); + } +if (retired) +call_rcu (&entry->rcu, blog_task_entry_free_rcu); +return retired; +} + +/* +* Allocate a fresh TLS context (composite) from the magazine batch or +* the page allocator, initialize it, and link it into the logger. +*/ +static struct blog_tls_ctx *blog_alloc_tls_ctx (struct blog_logger *logger) +{ +struct blog_tls_pagefrag *composite; +struct blog_tls_ctx *tls_ctx; +struct blog_pagefrag *pf; +struct task_struct *task = current; + + composite =blog_batch_get (&logger->alloc_batch); +if (!composite) { +struct page *pages; + + pages =alloc_pages (GFP_NOFS | __GFP_ZERO, +get_order (BLOG_TLS_PAGEFRAG_ALLOC_SIZE )); +if (!pages) +return NULL ; + composite =page_address (pages); + } + + tls_ctx = &composite->ctx; + +if (tls_ctx->id ==0 ) { +INIT_LIST_HEAD (&tls_ctx->list); +spin_lock (&logger->ctx_id_lock); + tls_ctx->id = logger->next_ctx_id++; +spin_unlock (&logger->ctx_id_lock); +#if BLOG_DEBUG_POISON + tls_ctx->debug_poison =BLOG_CTX_POISON ; +#endif + } + +atomic_set (&tls_ctx->refcount,1 ); + tls_ctx->task = task; + tls_ctx->pid = task->pid; +get_task_comm (tls_ctx->comm, task); + tls_ctx->base_jiffies = jiffies; + tls_ctx->release = blog_module_tls_release; + tls_ctx->logger = logger; + tls_ctx->flags =0 ; + tls_ctx->pending_offset =0 ; + tls_ctx->pending_size =0 ; + + pf = &composite->pf; + pf->pages =NULL ; + pf->buffer = composite->buf; + pf->capacity =BLOG_TLS_PAGEFRAG_BUFFER_SIZE ; +spin_lock_init (&pf->lock); + pf->head =0 ; + pf->alloc_count =0 ; + pf->active_elements =0 ; + pf->last_entry =NULL ; + +spin_lock (&logger->lock); +if (list_empty (&tls_ctx->list)) { +list_add (&tls_ctx->list, &logger->contexts); + logger->total_contexts_allocated++; + } +spin_unlock (&logger->lock); + +return tls_ctx; +} + +/* --- public module API --- */ + +struct blog_module_context *blog_module_init (const char *module_name) +{ +struct blog_module_context *ctx; +struct blog_logger *logger; +int ret; + +if (!module_name || !*module_name) +return NULL ; +if (strlen (module_name) >=sizeof (ctx->name)) +return NULL ; + + ctx =kzalloc (sizeof (*ctx),GFP_KERNEL ); +if (!ctx) +return NULL ; + + logger =kzalloc (sizeof (*logger),GFP_KERNEL ); +if (!logger) + goto err_ctx; + + logger->magazine_cache =kmem_cache_create ("blog_magazine" , +sizeof (struct blog_magazine ), +0 ,SLAB_HWCACHE_ALIGN ,NULL ); +if (!logger->magazine_cache) + goto err_logger; + + logger->source_map =kvcalloc (BLOG_MAX_SOURCE_IDS , +sizeof (struct blog_source_info ), +GFP_KERNEL ); +if (!logger->source_map) + goto err_cache; + +strscpy (ctx->name, module_name,sizeof (ctx->name)); + ctx->logger = logger; +atomic_set (&ctx->refcount,1 ); +atomic_set (&ctx->allocated_contexts,0 ); +INIT_LIST_HEAD (&ctx->list); + +INIT_LIST_HEAD (&logger->contexts); +spin_lock_init (&logger->lock); +spin_lock_init (&logger->source_lock); +spin_lock_init (&logger->ctx_id_lock); +atomic_set (&logger->next_source_id,1 ); + logger->next_ctx_id =1 ; + logger->total_contexts_allocated =0 ; + logger->owner_ctx = ctx; + logger->generation =atomic64_inc_return (&blog_logger_gen); + + ret =rhashtable_init (&logger->task_map, &blog_task_ht_params); +if (ret) + goto err_source_map; + + ret =blog_batch_init (&logger->alloc_batch, logger->magazine_cache, +num_possible_cpus () *4 +32 , +num_possible_cpus () +32 ); +if (ret) + goto err_ht; + + ret =blog_batch_init (&logger->log_batch, logger->magazine_cache,0 ,0 ); +if (ret) + goto err_batch_alloc; + +spin_lock (&blog_modules_lock); +list_add (&ctx->list, &blog_module_contexts); +spin_unlock (&blog_modules_lock); + + ctx->initialized = true; +pr_debug ("BLOG: module '%s' initialized\n" , module_name); +return ctx; + +err_batch_alloc: +blog_batch_cleanup (&logger->alloc_batch); +err_ht: +rhashtable_destroy (&logger->task_map); +err_source_map: +kvfree (logger->source_map); +err_cache: +kmem_cache_destroy (logger->magazine_cache); +err_logger: +kfree (logger); +err_ctx: +kfree (ctx); +return NULL ; +} + +/* +* Walk callback for rhashtable_free_and_destroy -- release each +* task entry and its associated TLS context. +*/ +static void blog_task_entry_free_cb (void *ptr,void *arg) +{ +struct blog_task_entry *entry = ptr; +struct blog_logger *logger = arg; + +if (entry->ctx) { +spin_lock (&logger->lock); +if (!list_empty (&entry->ctx->list)) +list_del_init (&entry->ctx->list); +spin_unlock (&logger->lock); + +blog_module_clear_task (entry->ctx); +blog_module_queue_to_log_batch (logger, entry->ctx); + } +kfree (entry); +} + +void blog_module_cleanup (struct blog_module_context *ctx) +{ +struct blog_logger *logger; +struct blog_tls_ctx *tls_ctx, *tmp; +LIST_HEAD (pending); + +if (!ctx || !ctx->initialized) +return ; + logger = ctx->logger; +if (!logger) +return ; + +spin_lock (&blog_modules_lock); +list_del (&ctx->list); +spin_unlock (&blog_modules_lock); + +/* Drain the task hash table */ +rhashtable_free_and_destroy (&logger->task_map, + blog_task_entry_free_cb, logger); + +/* Detach any remaining contexts from the logger list */ +spin_lock (&logger->lock); +list_for_each_entry_safe (tls_ctx, tmp, &logger->contexts, list) +list_move (&tls_ctx->list, &pending); +spin_unlock (&logger->lock); + +list_for_each_entry_safe (tls_ctx, tmp, &pending, list) { +list_del_init (&tls_ctx->list); +blog_module_clear_task (tls_ctx); +if (tls_ctx->release) + tls_ctx->release (tls_ctx); +else +blog_module_queue_to_log_batch (logger, tls_ctx); + } + +blog_batch_cleanup (&logger->alloc_batch); +blog_batch_cleanup (&logger->log_batch); + +if (logger->magazine_cache) +kmem_cache_destroy (logger->magazine_cache); +kvfree (logger->source_map); + +pr_debug ("BLOG: module '%s' cleaned up\n" , ctx->name); + +kfree (logger); + ctx->logger =NULL ; + ctx->initialized = false; +kfree (ctx); +} + +void blog_module_get (struct blog_module_context *ctx) +{ +if (ctx) +atomic_inc (&ctx->refcount); +} + +void blog_module_put (struct blog_module_context *ctx) +{ +if (ctx &&atomic_dec_and_test (&ctx->refcount)) +blog_module_cleanup (ctx); +} + +/* --- source ID helpers --- */ + +u32 blog_get_source_id_ctx (struct blog_module_context *ctx,const char *file, +const char *func,unsigned int line,const char *fmt) +{ +if (!ctx || !ctx->logger) +return 0 ; +return blog_get_source_id (ctx->logger, file, func, line, fmt); +} + +struct blog_source_info *blog_get_source_info_ctx (struct blog_module_context *ctx, +u32 id) +{ +if (!ctx || !ctx->logger || id >=BLOG_MAX_SOURCE_IDS ) +return NULL ; +return &ctx->logger->source_map[id]; +} + +/* --- per-task context acquisition (rhashtable-based) --- */ + +struct blog_tls_ctx *blog_get_tls_ctx_ctx (struct blog_module_context *ctx) +{ +struct blog_logger *logger; +struct blog_task_entry *entry; +struct blog_tls_ctx *tls_ctx; +struct task_struct *task = current; +bool stale; + +if (!ctx || !ctx->logger) +return NULL ; + logger = ctx->logger; + +retry: +rcu_read_lock (); + entry =rhashtable_lookup_fast (&logger->task_map, &task, + blog_task_ht_params); +if (entry && entry->pid == task->pid) { + tls_ctx = entry->ctx; +rcu_read_unlock (); +return tls_ctx; + } + stale = !!entry; +rcu_read_unlock (); + +if (stale) { +if (!blog_retire_stale_task (logger, task)) +return NULL ; + goto retry; + } + +/* Allocate fresh context */ + tls_ctx =blog_alloc_tls_ctx (logger); +if (!tls_ctx) +return NULL ; + + entry =kzalloc (sizeof (*entry),GFP_NOFS ); +if (!entry) { +blog_module_queue_to_log_batch (logger, tls_ctx); +return NULL ; + } + + entry->task = task; + entry->pid = task->pid; +get_task_comm (entry->comm, task); + entry->ctx = tls_ctx; + +if (rhashtable_lookup_insert_fast (&logger->task_map, &entry->node, + blog_task_ht_params)) { +/* +* Race: another thread inserted for the same task. +* Recycle our context and use theirs. +*/ +kfree (entry); +blog_module_clear_task (tls_ctx); +blog_module_queue_to_log_batch (logger, tls_ctx); + +rcu_read_lock (); + entry =rhashtable_lookup_fast (&logger->task_map, &task, + blog_task_ht_params); + tls_ctx = entry && entry->pid == task->pid ? entry->ctx :NULL ; +rcu_read_unlock (); +if (!tls_ctx) + goto retry; +return tls_ctx; + } + +atomic_inc (&ctx->allocated_contexts); +return tls_ctx; +} + +struct blog_tls_ctx *blog_get_ctx_ctx (struct blog_module_context *ctx) +{ +return blog_get_tls_ctx_ctx (ctx); +} + +/* --- blog_log_with_ctx / blog_log_commit_with_ctx --- */ + +/** +* blog_log_with_ctx - Reserve buffer for a binary log message (explicit ctx) +* @logger: Logger instance +* @tls_ctx: TLS context to log into +* @source_id: Source ID for this location +* @client_id: Client ID for this message +* @needed_size: Size needed for the message +* +* Only one reservation may be outstanding per context at a time. +* The caller must call blog_log_commit_with_ctx() before issuing +* another reservation on the same context. +* +* Returns a buffer to write the message into, or NULL on failure +*/ +void *blog_log_with_ctx (struct blog_logger *logger, +struct blog_tls_ctx *tls_ctx, +u32 source_id,u8 client_id,size_t needed_size) +{ +struct blog_pagefrag *pf; +struct blog_log_entry *entry; +int alloc; +size_t total_size; + +if (!logger || !tls_ctx) +return NULL ; + +if (needed_size >BLOG_MAX_PAYLOAD ) +return NULL ; + + total_size =round_up (sizeof (*entry) + needed_size,8 ); + pf =blog_ctx_pf (tls_ctx); + +if (test_and_clear_bit (BLOG_CTX_NEEDS_RESET , &tls_ctx->flags)) { +blog_pagefrag_reset (pf); + tls_ctx->pending_offset =0 ; + tls_ctx->pending_size =0 ; + } + + alloc =blog_pagefrag_reserve (pf, total_size); +if (alloc == -ENOMEM ) { +blog_pagefrag_reset (pf); +return NULL ; + } + + entry =blog_pagefrag_get_ptr (pf, alloc); +if (!entry) +return NULL ; + +if (WARN_ON_ONCE (tls_ctx->pending_size !=0 )) +return NULL ; + tls_ctx->pending_offset = alloc; + tls_ctx->pending_size = total_size; + +#if BLOG_DEBUG_POISON + entry->debug_poison =BLOG_LOG_ENTRY_POISON ; +#endif + entry->ts_delta = jiffies - tls_ctx->base_jiffies; + entry->source_id = source_id; + entry->len = (u16 )needed_size; + entry->client_id = client_id; + entry->flags =0 ; + +return entry->buffer; +} + +int blog_log_commit_with_ctx (struct blog_logger *logger, +struct blog_tls_ctx *tls_ctx, +size_t actual_size) +{ +struct blog_pagefrag *pf; +struct blog_log_entry *entry; +size_t total_size; + +if (!logger || !tls_ctx) +return -EINVAL ; + +/* Validate that actual_size fits within the reservation */ + total_size =round_up (sizeof (struct blog_log_entry ) + actual_size,8 ); +if (total_size > tls_ctx->pending_size) +return -ENOSPC ; + + pf =blog_ctx_pf (tls_ctx); + + entry =blog_pagefrag_get_ptr (pf, tls_ctx->pending_offset); +if (!entry) { + tls_ctx->pending_offset =0 ; + tls_ctx->pending_size =0 ; +return -EFAULT ; + } + entry->len = (u16 )actual_size; + +blog_pagefrag_publish (pf, tls_ctx->pending_offset + total_size); + tls_ctx->pending_offset =0 ; + tls_ctx->pending_size =0 ; + +return 0 ; +}
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 7/15 ceph: add Ceph BLOG scaffolding
In reply to Alex MarkuzeWire BLOG into CephFS: ceph_blog.h (journal_info, enter/exit, logging macros), blog_client.c (per-fsc context lifecycle, client-ID), super.h (blog_enabled, blog_ctx, debugfs_blog), libceph.h (blog_client_id), and Makefile (link all BLOG objects into ceph.ko).
--- fs/ceph/Makefile | 3 + fs/ceph/blog_client.c | 266 ++++++++++++++++++++++++++++++ fs/ceph/super.h | 5 + include/linux/ceph/ceph_blog.h | 284 +++++++++++++++++++++++++++++++++ include/linux/ceph/libceph.h | 2 + 5 files changed, 560 insertions(+) create mode 100644 fs/ceph/blog_client.c create mode 100644 include/linux/ceph/ceph_blog.h
fs/ceph/Makefile +3 -0
@@ -10,6 +10,9 @@ ceph-y := super.o inode.o dir.o file.o locks.o addr.o ioctl.o \ mds_client.o mdsmap.o strings.o ceph_frag.o \ debugfs.o util.o metric.o subvolume_metrics.o +ceph-y += blog_core.o blog_module.o blog_batch.o blog_pagefrag.o blog_des.o +ceph-y += blog_client.o + ceph-$(CONFIG_CEPH_FSCACHE) += cache.o ceph-$(CONFIG_CEPH_FS_POSIX_ACL) += acl.o ceph-$(CONFIG_FS_ENCRYPTION) += crypto.o
fs/ceph/blog_client.c new file +266 -0
266 lines not on this page · raw message
fs/ceph/super.h +5 -0
@@ -3,6 +3,7 @@#define _FS_CEPH_SUPER_H#include <linux/ceph/ceph_debug.h> +#include <linux/ceph/ceph_blog.h> #include <linux/ceph/osd_client.h> #include <linux/unaligned.h>
@@ -154,6 +155,7 @@ struct ceph_fs_client {int mount_state;bool blocklisted; +bool blog_enabled;bool have_copy_from2;
@@ -171,6 +173,8 @@ struct ceph_fs_client {DECLARE_HASHTABLE (async_unlink_conflict,CEPH_ASYNC_CREATE_CONFLICT_BITS );spinlock_t async_unlink_conflict_lock; +struct blog_module_context *blog_ctx; +#ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dentry_lru, *debugfs_caps;struct dentry *debugfs_congestion_kb;
@@ -180,6 +184,7 @@ struct ceph_fs_client {struct dentry *debugfs_mds_sessions;struct dentry *debugfs_metrics_dir;struct dentry *debugfs_reset_dir; +struct dentry *debugfs_blog;struct dentry *debugfs_subvolume_metrics;#endif
include/linux/ceph/ceph_blog.h new file +284 -0
284 lines not on this page · raw message
include/linux/ceph/libceph.h +2 -0
@@ -133,6 +133,8 @@ struct ceph_client {struct ceph_mon_client monc;struct ceph_osd_client osdc; +u32 blog_client_id; +#ifdef CONFIG_DEBUG_FS struct dentry *debugfs_dir;struct dentry *debugfs_monmap;
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 8/15 ceph: add bout and boutc wrappers for BLOG
In reply to Alex MarkuzeAdd bout()/boutc() macros to ceph_debug.h as drop-in replacements for dout()/doutc(). When BLOG is enabled they serialize to binary; when disabled they compile to nothing.
--- include/linux/ceph/ceph_debug.h | 44 ++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 12 deletions(-)
include/linux/ceph/ceph_debug.h +32 -12
@@ -8,25 +8,18 @@#ifdef CONFIG_CEPH_LIB_PRETTYDEBUG -/* -* wrap pr_debug to include a filename:lineno prefix on each line. -* this incurs some overhead (kernel size and execution time) due to -* the extra function call at each call site. -*/ -# if defined(DEBUG ) || defined(CONFIG_DYNAMIC_DEBUG )# define dout (fmt, ...) \ pr_debug("%.*s %12.12s:%-4d : " fmt, \ 8 - (int)sizeof(KBUILD_MODNAME), " ", \ kbasename(__FILE__), __LINE__, ##__VA_ARGS__)# define doutc (client, fmt, ...) \ - pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " fmt, \ + pr_debug("%.*s %12.12s:%-4d : [%pU %llu] " fmt, \ 8 - (int)sizeof(KBUILD_MODNAME), " ", \ kbasename(__FILE__), __LINE__, \ &client->fsid, client->monc.auth->global_id, \ ##__VA_ARGS__)# else -/* faux printk call just to see any compiler warnings. */ # define dout (fmt, ...) \ no_printk(KERN_DEBUG fmt, ##__VA_ARGS__)# define doutc (client, fmt, ...) \
@@ -38,16 +31,43 @@#else -/* -* or, just wrap pr_debug -*/ # define dout (fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__)# define doutc (client, fmt, ...) \ - pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \ + pr_debug(" [%pU %llu] %s: " fmt, &client->fsid, \ client->monc.auth->global_id, __func__, ##__VA_ARGS__)#endif +/* +* bout / boutc -- binary-logging variants. +* +* When Ceph BLOG tracing has been explicitly enabled and a BLOG context +* has been cached in current->journal_info (via ceph_blog_enter()), +* these route through the BLOG serialization path. Otherwise they fall +* back to the traditional text-based dout/doutc macros so that existing +* debug semantics remain unchanged. +*/ +#if IS_ENABLED (CONFIG_CEPH_FS ) +# include <linux/ceph/ceph_blog.h> +# define bout (fmt, ...) \ + do { \ + if (ceph_blog_get_cached_ctx()) \ + CEPH_BLOG_LOG(fmt, ##__VA_ARGS__); \ + else \ + dout(fmt, ##__VA_ARGS__); \ + } while (0) +# define boutc (client, fmt, ...) \ + do { \ + if (ceph_blog_get_cached_ctx()) \ + CEPH_BLOG_LOG_CLIENT(client, fmt, ##__VA_ARGS__); \ + else \ + doutc(client, fmt, ##__VA_ARGS__); \ + } while (0) +#else +# define bout (fmt, ...) dout(fmt, ##__VA_ARGS__) +# define boutc (client, fmt, ...) doutc(client, fmt, ##__VA_ARGS__) +#endif +#define pr_notice_client (client, fmt, ...) \ pr_notice("[%pU %llu]: " fmt, &client->fsid, \ client->monc.auth->global_id, ##__VA_ARGS__)
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 9/15 ceph: switch MDS request plumbing to struct ceph_journal_info
In reply to Alex MarkuzeReplace ad-hoc journal_info setup in __do_request() with ceph_blog_enter(mdsc->fsc, &ji) / ceph_blog_exit(&ji) so nested VFS callbacks inherit the BLOG context only when the owning fsc matches.
--- fs/ceph/mds_client.c | 293 ++++++++++++++++++++++--------------------- 1 file changed, 149 insertions(+), 144 deletions(-)
fs/ceph/mds_client.c +149 -144
@@ -501,7 +501,8 @@ static int parse_reply_info_readdir(void **p, void *end,ceph_decode_need (p, end, _name_len, bad); _name = *p; *p += _name_len; -doutc (cl,"parsed dir dname '%.*s'\n" , _name_len, _name); +boutc (cl,"parsed dir dname '%.*s'\n" , _name_len, + (const char *)_name);if (info->hash_order) rde->raw_hash = ceph_str_hash(ci->i_dir_layout.dl_dir_hash,
@@ -621,7 +622,7 @@ static int ceph_parse_deleg_inos(void **p, void *end,u32 sets;ceph_decode_32_safe (p, end, sets, bad); -doutc (cl,"got %u sets of delegated inodes\n" , sets); +boutc (cl,"got %u sets of delegated inodes\n" , sets);while (sets--) {u64 start, len;
@@ -640,7 +641,7 @@ static int ceph_parse_deleg_inos(void **p, void *end,DELEGATED_INO_AVAILABLE , GFP_KERNEL);if (!err) { -doutc (cl,"added delegated inode 0x%llx\n" , start -1 ); +boutc (cl,"added delegated inode 0x%llx\n" , start -1 ); }else if (err == -EBUSY ) { pr_warn_client(cl, "MDS delegated inode 0x%llx more than once.\n",
@@ -925,8 +926,8 @@ int ceph_wait_on_conflict_unlink(struct dentry *dentry)if (likely (!found))return 0 ; -doutc (cl,"dentry %p:%pd conflict with old %p:%pd\n" , dentry, dentry, - found, found); +boutc (cl,"dentry %p:%s conflict with old %p:%s\n" , dentry, dentry->d_name.name, + found, found->d_name.name); err =wait_on_bit (&di->flags,CEPH_DENTRY_ASYNC_UNLINK_BIT ,TASK_KILLABLE );
@@ -1028,7 +1029,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,struct ceph_mds_session **sa;size_t ptr_size =sizeof (struct ceph_mds_session *); -doutc (cl,"realloc to %d\n" , newmax); +boutc (cl,"realloc to %d\n" , newmax); sa =kcalloc (newmax, ptr_size,GFP_NOFS );if (!sa) goto fail_realloc;
@@ -1041,7 +1042,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, mdsc->max_sessions = newmax; } -doutc (cl,"mds%d\n" , mds); +boutc (cl,"mds%d\n" , mds); s->s_mdsc = mdsc; s->s_mds = mds; s->s_state =CEPH_MDS_SESSION_NEW ;
@@ -1084,7 +1085,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc,static void __unregister_session (struct ceph_mds_client *mdsc,struct ceph_mds_session *s) { -doutc (mdsc->fsc->client,"mds%d %p\n" , s->s_mds, s); +boutc (mdsc->fsc->client,"mds%d %p\n" , s->s_mds, s);BUG_ON (mdsc->sessions[s->s_mds] != s); mdsc->sessions[s->s_mds] =NULL ;ceph_con_close (&s->s_con);
@@ -1227,7 +1228,7 @@ static void __register_request(struct ceph_mds_client *mdsc,return ; } } -doutc (cl,"%p tid %lld\n" , req, req->r_tid); +boutc (cl,"%p tid %lld\n" , req, req->r_tid);ceph_mdsc_get_request (req);insert_request (&mdsc->request_tree, req);
@@ -1252,7 +1253,7 @@ static void __register_request(struct ceph_mds_client *mdsc,static void __unregister_request (struct ceph_mds_client *mdsc,struct ceph_mds_request *req) { -doutc (mdsc->fsc->client,"%p tid %lld\n" , req, req->r_tid); +boutc (mdsc->fsc->client,"%p tid %lld\n" , req, req->r_tid);/* Never leave an unregistered request on an unsafe list! */ list_del_init (&req->r_unsafe_item);
@@ -1350,7 +1351,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,if (req->r_resend_mds >=0 && (__have_session (mdsc, req->r_resend_mds) ||ceph_mdsmap_get_state (mdsc->mdsmap, req->r_resend_mds) >0 )) { -doutc (cl,"using resend_mds mds%d\n" , req->r_resend_mds); +boutc (cl,"using resend_mds mds%d\n" , req->r_resend_mds);return req->r_resend_mds; }
@@ -1367,7 +1368,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,rcu_read_lock (); inode =get_nonsnap_parent (req->r_dentry);rcu_read_unlock (); -doutc (cl,"using snapdir's parent %p %llx.%llx\n" , +boutc (cl,"using snapdir's parent %p %llx.%llx\n" , inode,ceph_vinop (inode)); } }else if (req->r_dentry) {
@@ -1388,7 +1389,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,/* direct snapped/virtual snapdir requests * based on parent dir inode */ inode =get_nonsnap_parent (parent); -doutc (cl,"using nonsnap parent %p %llx.%llx\n" , +boutc (cl,"using nonsnap parent %p %llx.%llx\n" , inode,ceph_vinop (inode)); }else {/* dentry target */
@@ -1408,7 +1409,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,if (!inode) goto random; -doutc (cl,"%p %llx.%llx is_hash=%d (0x%x) mode %d\n" , inode, +boutc (cl,"%p %llx.%llx is_hash=%d (0x%x) mode %d\n" , inode,ceph_vinop (inode), (int )is_hash, hash, mode); ci =ceph_inode (inode);
@@ -1425,7 +1426,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,get_random_bytes (&r,1 ); r %= frag.ndist; mds = frag.dist[r]; -doutc (cl,"%p %llx.%llx frag %u mds%d (%d/%d)\n" , +boutc (cl,"%p %llx.%llx frag %u mds%d (%d/%d)\n" , inode,ceph_vinop (inode), frag.frag, mds, (int )r, frag.ndist); if (ceph_mdsmap_get_state(mdsc->mdsmap, mds) >=
@@ -1440,7 +1441,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc,if (frag.mds >=0 ) {/* choose auth mds */ mds = frag.mds; -doutc (cl,"%p %llx.%llx frag %u mds%d (auth)\n" , +boutc (cl,"%p %llx.%llx frag %u mds%d (auth)\n" , inode,ceph_vinop (inode), frag.frag, mds);if (ceph_mdsmap_get_state (mdsc->mdsmap, mds) >=CEPH_MDS_STATE_ACTIVE ) {
@@ -1465,7 +1466,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc, goto random; } mds = cap->session->s_mds; -doutc (cl,"%p %llx.%llx mds%d (%scap %p)\n" , inode, +boutc (cl,"%p %llx.%llx mds%d (%scap %p)\n" , inode,ceph_vinop (inode), mds, cap == ci->i_auth_cap ?"auth " :"" , cap);spin_unlock (&ci->i_ceph_lock);
@@ -1478,7 +1479,7 @@ static int __choose_mds(struct ceph_mds_client *mdsc, *random = true; mds =ceph_mdsmap_get_random_mds (mdsc->mdsmap); -doutc (cl,"chose random mds%d\n" , mds); +boutc (cl,"chose random mds%d\n" , mds);return mds; }
@@ -1718,7 +1719,7 @@ static int __open_session(struct ceph_mds_client *mdsc,/* wait for mds to go active? */ mstate =ceph_mdsmap_get_state (mdsc->mdsmap, mds); -doutc (mdsc->fsc->client,"open_session to mds%d (%s)\n" , mds, +boutc (mdsc->fsc->client,"open_session to mds%d (%s)\n" , mds,ceph_mds_state_name (mstate)); session->s_state =CEPH_MDS_SESSION_OPENING ; session->s_renew_requested = jiffies;
@@ -1765,7 +1766,7 @@ ceph_mdsc_open_export_target_session(struct ceph_mds_client *mdsc, int target)struct ceph_mds_session *session;struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"to mds%d\n" , target); +boutc (cl,"to mds%d\n" , target);mutex_lock (&mdsc->mutex); session =__open_export_target_session (mdsc, target);
@@ -1786,7 +1787,7 @@ static void __open_export_target_sessions(struct ceph_mds_client *mdsc,return ; mi = &mdsc->mdsmap->m_info[mds]; -doutc (cl,"for mds%d (%d targets)\n" , session->s_mds, +boutc (cl,"for mds%d (%d targets)\n" , session->s_mds, mi->num_export_targets);for (i =0 ; i < mi->num_export_targets; i++) {
@@ -1808,7 +1809,7 @@ static void detach_cap_releases(struct ceph_mds_session *session,list_splice_init (&session->s_cap_releases, target); session->s_num_cap_releases =0 ; -doutc (cl,"mds%d\n" , session->s_mds); +boutc (cl,"mds%d\n" , session->s_mds); } static void dispose_cap_releases(struct ceph_mds_client *mdsc,
@@ -1830,7 +1831,7 @@ static void cleanup_session_requests(struct ceph_mds_client *mdsc,struct ceph_mds_request *req;struct rb_node *p; -doutc (cl,"mds%d\n" , session->s_mds); +boutc (cl,"mds%d\n" , session->s_mds);mutex_lock (&mdsc->mutex);while (!list_empty (&session->s_unsafe)) { req = list_first_entry(&session->s_unsafe,
@@ -1872,7 +1873,7 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,struct ceph_cap *old_cap =NULL ;int ret; -doutc (cl,"%p mds%d\n" , session, session->s_mds); +boutc (cl,"%p mds%d\n" , session, session->s_mds);spin_lock (&session->s_cap_lock); p = session->s_caps.next;while (p != &session->s_caps) {
@@ -1903,7 +1904,7 @@ int ceph_iterate_session_caps(struct ceph_mds_session *session,spin_lock (&session->s_cap_lock); p = p->next;if (!cap->ci) { -doutc (cl,"finishing cap %p removal\n" , cap); +boutc (cl,"finishing cap %p removal\n" , cap);BUG_ON (cap->session != session); cap->session =NULL ;list_del_init (&cap->session_caps);
@@ -1940,7 +1941,7 @@ static int remove_session_caps_cb(struct inode *inode, int mds, void *arg)spin_lock (&ci->i_ceph_lock); cap =__get_cap_for_mds (ci, mds);if (cap) { -doutc (cl," removing cap %p, ci is %p, inode is %p\n" , +boutc (cl," removing cap %p, ci is %p, inode is %p\n" , cap, ci, &ci->netfs.inode); iputs =ceph_purge_inode_cap (inode, cap, &invalidate);
@@ -1965,7 +1966,7 @@ static void remove_session_caps(struct ceph_mds_session *session)struct super_block *sb = fsc->sb;LIST_HEAD (dispose); -doutc (fsc->client,"on %p\n" , session); +boutc (fsc->client,"on %p\n" , session);ceph_iterate_session_caps (session, remove_session_caps_cb, fsc);wake_up_all (&fsc->mdsc->cap_flushing_wq);
@@ -2048,7 +2049,7 @@ static void wake_up_session_caps(struct ceph_mds_session *session, int ev) {struct ceph_client *cl = session->s_mdsc->fsc->client; -doutc (cl,"session %p mds%d\n" , session, session->s_mds); +boutc (cl,"session %p mds%d\n" , session, session->s_mds);ceph_iterate_session_caps (session, wake_up_session_cb, (void *)(unsigned long )ev); }
@@ -2075,12 +2076,12 @@ static int send_renew_caps(struct ceph_mds_client *mdsc,* with its clients. */ state =ceph_mdsmap_get_state (mdsc->mdsmap, session->s_mds);if (state <CEPH_MDS_STATE_RECONNECT ) { -doutc (cl,"ignoring mds%d (%s)\n" , session->s_mds, +boutc (cl,"ignoring mds%d (%s)\n" , session->s_mds,ceph_mds_state_name (state));return 0 ; } -doutc (cl,"to mds%d (%s)\n" , session->s_mds, +boutc (cl,"to mds%d (%s)\n" , session->s_mds,ceph_mds_state_name (state)); msg =create_session_full_msg (mdsc,CEPH_SESSION_REQUEST_RENEWCAPS , ++session->s_renew_seq);
@@ -2096,7 +2097,7 @@ static int send_flushmsg_ack(struct ceph_mds_client *mdsc,struct ceph_client *cl = mdsc->fsc->client;struct ceph_msg *msg; -doutc (cl,"to mds%d (%s)s seq %lld\n" , session->s_mds, +boutc (cl,"to mds%d (%s)s seq %lld\n" , session->s_mds,ceph_session_state_name (session->s_state), seq); msg =ceph_create_session_msg (CEPH_SESSION_FLUSHMSG_ACK , seq);if (!msg)
@@ -2134,7 +2135,7 @@ static void renewed_caps(struct ceph_mds_client *mdsc, session->s_mds); } } -doutc (cl,"mds%d ttl now %lu, was %s, now %s\n" , session->s_mds, +boutc (cl,"mds%d ttl now %lu, was %s, now %s\n" , session->s_mds, session->s_cap_ttl, was_stale ?"stale" :"fresh" ,time_before (jiffies, session->s_cap_ttl) ?"stale" :"fresh" );spin_unlock (&session->s_cap_lock);
@@ -2151,7 +2152,7 @@ static int request_close_session(struct ceph_mds_session *session)struct ceph_client *cl = session->s_mdsc->fsc->client;struct ceph_msg *msg; -doutc (cl,"mds%d state %s seq %lld\n" , session->s_mds, +boutc (cl,"mds%d state %s seq %lld\n" , session->s_mds,ceph_session_state_name (session->s_state), session->s_seq); msg =ceph_create_session_msg (CEPH_SESSION_REQUEST_CLOSE , session->s_seq);
@@ -2229,7 +2230,7 @@ static int trim_caps_cb(struct inode *inode, int mds, void *arg) wanted =__ceph_caps_file_wanted (ci); oissued =__ceph_caps_issued_other (ci, cap); -doutc (cl,"%p %llx.%llx cap %p mine %s oissued %s used %s wanted %s\n" , +boutc (cl,"%p %llx.%llx cap %p mine %s oissued %s used %s wanted %s\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (mine),ceph_cap_string (oissued),ceph_cap_string (used),ceph_cap_string (wanted));
@@ -2272,7 +2273,7 @@ static int trim_caps_cb(struct inode *inode, int mds, void *arg) count =icount_read (inode);if (count ==1 ) (*remaining)--; -doutc (cl,"%p %llx.%llx cap %p pruned, count now %d\n" , +boutc (cl,"%p %llx.%llx cap %p pruned, count now %d\n" , inode,ceph_vinop (inode), cap, count); }else {dput (dentry);
@@ -2295,13 +2296,13 @@ int ceph_trim_caps(struct ceph_mds_client *mdsc,struct ceph_client *cl = mdsc->fsc->client;int trim_caps = session->s_nr_caps - max_caps; -doutc (cl,"mds%d start: %d / %d, trim %d\n" , session->s_mds, +boutc (cl,"mds%d start: %d / %d, trim %d\n" , session->s_mds, session->s_nr_caps, max_caps, trim_caps);if (trim_caps >0 ) {int remaining = trim_caps;ceph_iterate_session_caps (session, trim_caps_cb, &remaining); -doutc (cl,"mds%d done: %d / %d, trimmed %d\n" , +boutc (cl,"mds%d done: %d / %d, trimmed %d\n" , session->s_mds, session->s_nr_caps, max_caps, trim_caps - remaining); }
@@ -2322,7 +2323,7 @@ static int check_caps_flush(struct ceph_mds_client *mdsc,list_first_entry (&mdsc->cap_flush_list, struct ceph_cap_flush, g_list);if (cf->tid <= want_flush_tid) { -doutc (cl,"still flushing tid %llu <= %llu\n" , +boutc (cl,"still flushing tid %llu <= %llu\n" , cf->tid, want_flush_tid); ret =0 ; }
@@ -2422,7 +2423,7 @@ static void wait_caps_flush(struct ceph_mds_client *mdsc,int i =0 ;long ret; -doutc (cl,"want %llu\n" , want_flush_tid); +boutc (cl,"want %llu\n" , want_flush_tid); do { /* 60 * HZ fits in a long on all supported architectures. */
@@ -2439,7 +2440,7 @@ static void wait_caps_flush(struct ceph_mds_client *mdsc, } }while (ret ==0 ); -doutc (cl,"ok, flushed thru %llu\n" , want_flush_tid); +boutc (cl,"ok, flushed thru %llu\n" , want_flush_tid); }/*
@@ -2507,7 +2508,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc, msg->front.iov_len +=sizeof (*cap_barrier); msg->hdr.front_len =cpu_to_le32 (msg->front.iov_len); -doutc (cl,"mds%d %p\n" , session->s_mds, msg); +boutc (cl,"mds%d %p\n" , session->s_mds, msg);ceph_con_send (&session->s_con, msg); msg =NULL ; }
@@ -2527,7 +2528,7 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc, msg->front.iov_len +=sizeof (*cap_barrier); msg->hdr.front_len =cpu_to_le32 (msg->front.iov_len); -doutc (cl,"mds%d %p\n" , session->s_mds, msg); +boutc (cl,"mds%d %p\n" , session->s_mds, msg);ceph_con_send (&session->s_con, msg); }return ;
@@ -2563,10 +2564,10 @@ void ceph_flush_session_cap_releases(struct ceph_mds_client *mdsc,ceph_get_mds_session (session);if (queue_work (mdsc->fsc->cap_wq, &session->s_cap_release_work)) { -doutc (cl,"cap release work queued\n" ); +boutc (cl,"cap release work queued\n" ); }else {ceph_put_mds_session (session); -doutc (cl,"failed to queue cap release work\n" ); +boutc (cl,"failed to queue cap release work\n" ); } }
@@ -2598,11 +2599,10 @@ void ceph_queue_cap_reclaim_work(struct ceph_mds_client *mdsc)if (mdsc->stopping)return ; -if (queue_work (mdsc->fsc->cap_wq, &mdsc->cap_reclaim_work)) { -doutc (cl,"caps reclaim work queued\n" ); - }else { -doutc (cl,"failed to queue caps release work\n" ); - } +if (queue_work (mdsc->fsc->cap_wq, &mdsc->cap_reclaim_work)) +boutc (cl,"caps reclaim work queued\n" ); +else +boutc (cl,"failed to queue caps release work\n" ); }void ceph_reclaim_caps_nr (struct ceph_mds_client *mdsc,int nr)
@@ -2623,11 +2623,10 @@ void ceph_queue_cap_unlink_work(struct ceph_mds_client *mdsc)if (mdsc->stopping)return ; -if (queue_work (mdsc->fsc->cap_wq, &mdsc->cap_unlink_work)) { -doutc (cl,"caps unlink work queued\n" ); - }else { -doutc (cl,"failed to queue caps unlink work\n" ); - } +if (queue_work (mdsc->fsc->cap_wq, &mdsc->cap_unlink_work)) +boutc (cl,"caps unlink work queued\n" ); +else +boutc (cl,"failed to queue caps unlink work\n" ); }static void ceph_cap_unlink_work (struct work_struct *work)
@@ -2636,7 +2635,7 @@ static void ceph_cap_unlink_work(struct work_struct *work) container_of(work, struct ceph_mds_client, cap_unlink_work);struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"begin\n" ); +boutc (cl,"begin\n" );spin_lock (&mdsc->cap_delay_lock);while (!list_empty (&mdsc->cap_unlink_delay_list)) {struct ceph_inode_info *ci;
@@ -2650,7 +2649,7 @@ static void ceph_cap_unlink_work(struct work_struct *work) inode =igrab (&ci->netfs.inode);if (inode) {spin_unlock (&mdsc->cap_delay_lock); -doutc (cl,"on %p %llx.%llx\n" , inode, +boutc (cl,"on %p %llx.%llx\n" , inode,ceph_vinop (inode));ceph_check_caps (ci,CHECK_CAPS_FLUSH );iput (inode);
@@ -2658,7 +2657,7 @@ static void ceph_cap_unlink_work(struct work_struct *work) } }spin_unlock (&mdsc->cap_delay_lock); -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }/*
@@ -2873,7 +2872,7 @@ char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc, struct dentry *dentry,spin_lock (&cur->d_lock); inode =d_inode (cur);if (inode &&ceph_snap (inode) ==CEPH_SNAPDIR ) { -doutc (cl,"path+%d: %p SNAPDIR\n" , pos, cur); +boutc (cl,"path+%d: %p SNAPDIR\n" , pos, cur);spin_unlock (&cur->d_lock); parent =dget_parent (cur); } else if (for_wire && inode && dentry != cur &&
@@ -2972,8 +2971,8 @@ char *ceph_mdsc_build_path(struct ceph_mds_client *mdsc, struct dentry *dentry,else path_info->vino.snap =CEPH_NOSNAP ; -doutc (cl,"on %p %d built %llx '%.*s'\n" , dentry,d_count (dentry), - base,PATH_MAX -1 - pos, path + pos); +boutc (cl,"on %p %d built %llx '%.*s'\n" , dentry,d_count (dentry), + base,PATH_MAX -1 - pos, (const char *)(path + pos));return path + pos; }
@@ -3050,12 +3049,12 @@ static int set_request_path_attr(struct ceph_mds_client *mdsc, struct inode *rinif (rinode) { r =build_inode_path (rinode, path_info); -doutc (cl," inode %p %llx.%llx\n" , rinode,ceph_ino (rinode), +boutc (cl," inode %p %llx.%llx\n" , rinode,ceph_ino (rinode),ceph_snap (rinode)); }else if (rdentry) { r =build_dentry_path (mdsc, rdentry, rdiri, path_info, parent_locked); -doutc (cl," dentry %p %llx/%.*s\n" , rdentry, path_info->vino.ino, - path_info->pathlen, path_info->path); +boutc (cl," dentry %p %llx/%.*s\n" , rdentry, path_info->vino.ino, + path_info->pathlen, (const char *)path_info->path); }else if (rpath || rino) { path_info->vino.ino = rino; path_info->vino.snap =CEPH_NOSNAP ;
@@ -3063,7 +3062,8 @@ static int set_request_path_attr(struct ceph_mds_client *mdsc, struct inode *rin path_info->pathlen = rpath ?strlen (rpath) :0 ; path_info->freepath = false; -doutc (cl," path %.*s\n" , path_info->pathlen, rpath); +boutc (cl," path %.*s\n" , path_info->pathlen, + (const char *)rpath); }return r;
@@ -3482,7 +3482,7 @@ static int __prepare_send_request(struct ceph_mds_session *session,else req->r_sent_on_mseq =-1 ; } -doutc (cl,"%p tid %lld %s (attempt %d)\n" , req, req->r_tid, +boutc (cl,"%p tid %lld %s (attempt %d)\n" , req, req->r_tid,ceph_mds_op_name (req->r_op), req->r_attempts);if (test_bit (CEPH_MDS_R_GOT_UNSAFE , &req->r_req_flags)) {
@@ -3551,7 +3551,7 @@ static int __prepare_send_request(struct ceph_mds_session *session, nhead->ext_num_retry =cpu_to_le32 (req->r_attempts -1 ); } -doutc (cl," r_parent = %p\n" , req->r_parent); +boutc (cl," r_parent = %p\n" , req->r_parent);return 0 ; }
@@ -3657,7 +3657,7 @@ static void __do_request(struct ceph_mds_client *mdsc, } req->r_session =ceph_get_mds_session (session); -doutc (cl,"mds%d session %p state %s\n" , mds, session, +boutc (cl,"mds%d session %p state %s\n" , mds, session,ceph_session_state_name (session->s_state));/*
@@ -3754,7 +3754,7 @@ static void __do_request(struct ceph_mds_client *mdsc, cap = ci->i_auth_cap;if (test_bit (CEPH_I_ASYNC_CREATE_BIT , &ci->i_ceph_flags) && mds != cap->mds) { -doutc (cl,"session changed for auth cap %d -> %d\n" , +boutc (cl,"session changed for auth cap %d -> %d\n" , cap->session->s_mds, session->s_mds);/* Remove the auth cap from old session */
@@ -3782,7 +3782,7 @@ static void __do_request(struct ceph_mds_client *mdsc,ceph_put_mds_session (session); finish:if (err) { -doutc (cl,"early error %d\n" , err); +boutc (cl,"early error %d\n" , err); req->r_err = err;complete_request (mdsc, req);__unregister_request (mdsc, req);
@@ -3823,7 +3823,7 @@ static void kick_requests(struct ceph_mds_client *mdsc, int mds)struct ceph_mds_request *req;struct rb_node *p =rb_first (&mdsc->request_tree); -doutc (cl,"kick_requests mds%d\n" , mds); +boutc (cl,"kick_requests mds%d\n" , mds);while (p) { req = rb_entry(p, struct ceph_mds_request, r_node); p =rb_next (p);
@@ -3882,7 +3882,7 @@ int ceph_mdsc_submit_request(struct ceph_mds_client *mdsc, struct inode *dir,if (req->r_inode) { err =ceph_wait_on_async_create (req->r_inode);if (err) { -doutc (cl,"wait for async create returned: %d\n" , err); +boutc (cl,"wait for async create returned: %d\n" , err);return err; } }
@@ -3913,7 +3913,7 @@ int ceph_mdsc_wait_request(struct ceph_mds_client *mdsc,int err;/* wait */ -doutc (cl,"do_request waiting\n" ); +boutc (cl,"do_request waiting\n" );if (wait_func) { err =wait_func (mdsc, req); }else {
@@ -3927,14 +3927,14 @@ int ceph_mdsc_wait_request(struct ceph_mds_client *mdsc,else err = timeleft;/* killed */ } -doutc (cl,"do_request waited, got %d\n" , err); +boutc (cl,"do_request waited, got %d\n" , err);mutex_lock (&mdsc->mutex);/* only abort if we didn't race with a real reply */ if (test_bit (CEPH_MDS_R_GOT_RESULT , &req->r_req_flags)) { err =le32_to_cpu (req->r_reply_info.head->result); }else if (err <0 ) { -doutc (cl,"aborted request %lld with %d\n" , req->r_tid, err); +boutc (cl,"aborted request %lld with %d\n" , req->r_tid, err);/* * ensure we aren't running concurrently with
@@ -3968,13 +3968,13 @@ int ceph_mdsc_do_request(struct ceph_mds_client *mdsc,struct ceph_client *cl = mdsc->fsc->client;int err; -doutc (cl,"do_request on %p\n" , req); +boutc (cl,"do_request on %p\n" , req);/* issue */ err =ceph_mdsc_submit_request (mdsc, dir, req);if (!err) err =ceph_mdsc_wait_request (mdsc, req,NULL ); -doutc (cl,"do_request %p done, result %d\n" , req, err); +boutc (cl,"do_request %p done, result %d\n" , req, err);return err; }
@@ -3988,7 +3988,7 @@ void ceph_invalidate_dir_request(struct ceph_mds_request *req)struct inode *old_dir = req->r_old_dentry_dir;struct ceph_client *cl = req->r_mdsc->fsc->client; -doutc (cl,"invalidate_dir_request %p %p (complete, lease(s))\n" , +boutc (cl,"invalidate_dir_request %p %p (complete, lease(s))\n" , dir, old_dir);ceph_dir_clear_complete (dir);
@@ -4031,11 +4031,11 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)mutex_lock (&mdsc->mutex); req =lookup_get_request (mdsc, tid);if (!req) { -doutc (cl,"on unknown tid %llu\n" , tid); +boutc (cl,"on unknown tid %llu\n" , tid);mutex_unlock (&mdsc->mutex);return ; } -doutc (cl,"handle_reply %p\n" , req); +boutc (cl,"handle_reply %p\n" , req);/* correct session? */ if (req->r_session != session) {
@@ -4079,7 +4079,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)* response. And even if it did, there is nothing * useful we could do with a revised return value. */ -doutc (cl,"got safe reply %llu, mds%d\n" , tid, mds); +boutc (cl,"got safe reply %llu, mds%d\n" , tid, mds);mutex_unlock (&mdsc->mutex); goto out;
@@ -4089,7 +4089,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)list_add_tail (&req->r_unsafe_item, &req->r_session->s_unsafe); } -doutc (cl,"tid %lld result %d\n" , tid, result); +boutc (cl,"tid %lld result %d\n" , tid, result);if (test_bit (CEPHFS_FEATURE_REPLY_ENCODING , &session->s_features)) err =parse_reply_info (session, msg, req, (u64)-1 );else
@@ -4158,14 +4158,19 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)/* insert trace into our cache */ mutex_lock (&req->r_fill_mutex); - current->journal_info = req; - err =ceph_fill_trace (mdsc->fsc->sb, req); -if (err ==0 ) { -if (result ==0 && (req->r_op ==CEPH_MDS_OP_READDIR || - req->r_op ==CEPH_MDS_OP_LSSNAP )) - err =ceph_readdir_prepopulate (req, req->r_session); + { +struct ceph_journal_info ji; + +ceph_blog_enter (mdsc->fsc, &ji); + ji.mds_req = req; + err =ceph_fill_trace (mdsc->fsc->sb, req); +if (err ==0 ) { +if (result ==0 && (req->r_op ==CEPH_MDS_OP_READDIR || + req->r_op ==CEPH_MDS_OP_LSSNAP )) + err =ceph_readdir_prepopulate (req, req->r_session); + } +ceph_blog_exit (&ji); } - current->journal_info =NULL ;mutex_unlock (&req->r_fill_mutex);up_read (&mdsc->snap_rwsem);
@@ -4195,7 +4200,7 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)set_bit (CEPH_MDS_R_GOT_RESULT , &req->r_req_flags); } }else { -doutc (cl,"reply arrived after request %lld was aborted\n" , tid); +boutc (cl,"reply arrived after request %lld was aborted\n" , tid); }mutex_unlock (&mdsc->mutex);
@@ -4242,12 +4247,12 @@ static void handle_forward(struct ceph_mds_client *mdsc, req =lookup_get_request (mdsc, tid);if (!req) {mutex_unlock (&mdsc->mutex); -doutc (cl,"forward tid %llu to mds%d - req dne\n" , tid, next_mds); +boutc (cl,"forward tid %llu to mds%d - req dne\n" , tid, next_mds);return ;/* dup reply? */ }if (test_bit (CEPH_MDS_R_ABORTED , &req->r_req_flags)) { -doutc (cl,"forward tid %llu aborted, unregistering\n" , tid); +boutc (cl,"forward tid %llu aborted, unregistering\n" , tid);__unregister_request (mdsc, req); }else if (fwd_seq <= req->r_num_fwd || (uint32_t )fwd_seq >=U32_MAX ) {/*
@@ -4267,7 +4272,7 @@ static void handle_forward(struct ceph_mds_client *mdsc, tid); }else {/* resend. forward race not possible; mds would drop */ -doutc (cl,"forward tid %llu to mds%d (we resend)\n" , tid, next_mds); +boutc (cl,"forward tid %llu to mds%d (we resend)\n" , tid, next_mds);BUG_ON (req->r_err);BUG_ON (test_bit (CEPH_MDS_R_GOT_RESULT , &req->r_req_flags)); req->r_attempts =0 ;
@@ -4383,7 +4388,7 @@ static void handle_session(struct ceph_mds_session *session,if (msg_version >=6 ) {ceph_decode_32_safe (&p, end, cap_auths_num, bad); -doutc (cl,"cap_auths_num %d\n" , cap_auths_num); +boutc (cl,"cap_auths_num %d\n" , cap_auths_num);if (cap_auths_num && op !=CEPH_SESSION_OPEN ) {WARN_ON_ONCE (op !=CEPH_SESSION_OPEN );
@@ -4453,7 +4458,7 @@ static void handle_session(struct ceph_mds_session *session,ceph_decode_8_safe (&p, end, cap_auths[i].match.root_squash, bad);ceph_decode_8_safe (&p, end, cap_auths[i].readable, bad);ceph_decode_8_safe (&p, end, cap_auths[i].writeable, bad); - doutc(cl, "uid %lld, num_gids %u, path %s, fs_name %s, root_squash %d, readable %d, writeable %d\n", + boutc(cl, "uid %lld, num_gids %u, path %s, fs_name %s, root_squash %d, readable %d, writeable %d\n", cap_auths[i].match.uid, cap_auths[i].match.num_gids, cap_auths[i].match.path, cap_auths[i].match.fs_name, cap_auths[i].match.root_squash,
@@ -4490,7 +4495,7 @@ static void handle_session(struct ceph_mds_session *session,mutex_lock (&session->s_mutex); -doutc (cl,"mds%d %s %p state %s seq %llu\n" , mds, +boutc (cl,"mds%d %s %p state %s seq %llu\n" , mds,ceph_session_op_name (op), session,ceph_session_state_name (session->s_state), seq);
@@ -4573,7 +4578,7 @@ static void handle_session(struct ceph_mds_session *session,break ;case CEPH_SESSION_FORCE_RO : -doutc (cl,"force_session_readonly %p\n" , session); +boutc (cl,"force_session_readonly %p\n" , session);spin_lock (&session->s_cap_lock); session->s_readonly = true;spin_unlock (&session->s_cap_lock);
@@ -4635,7 +4640,7 @@ void ceph_mdsc_release_dir_caps(struct ceph_mds_request *req) dcaps =xchg (&req->r_dir_caps,0 );if (dcaps) { -doutc (cl,"releasing r_dir_caps=%s\n" ,ceph_cap_string (dcaps)); +boutc (cl,"releasing r_dir_caps=%s\n" ,ceph_cap_string (dcaps));ceph_put_cap_refs (ceph_inode (req->r_parent), dcaps); } }
@@ -4647,7 +4652,7 @@ void ceph_mdsc_release_dir_caps_async(struct ceph_mds_request *req) dcaps =xchg (&req->r_dir_caps,0 );if (dcaps) { -doutc (cl,"releasing r_dir_caps=%s\n" ,ceph_cap_string (dcaps)); +boutc (cl,"releasing r_dir_caps=%s\n" ,ceph_cap_string (dcaps));ceph_put_cap_refs_async (ceph_inode (req->r_parent), dcaps); } }
@@ -4661,7 +4666,7 @@ static void replay_unsafe_requests(struct ceph_mds_client *mdsc,struct ceph_mds_request *req, *nreq;struct rb_node *p; -doutc (mdsc->fsc->client,"mds%d\n" , session->s_mds); +boutc (mdsc->fsc->client,"mds%d\n" , session->s_mds);mutex_lock (&mdsc->mutex);list_for_each_entry_safe (req, nreq, &session->s_unsafe, r_unsafe_item)
@@ -4839,7 +4844,7 @@ static int reconnect_caps_cb(struct inode *inode, int mds, void *arg) err =0 ; goto out_err; } -doutc (cl," adding %p ino %llx.%llx cap %p %lld %s\n" , inode, +boutc (cl," adding %p ino %llx.%llx cap %p %lld %s\n" , inode,ceph_vinop (inode), cap, cap->cap_id,ceph_cap_string (cap->issued));
@@ -5043,7 +5048,7 @@ static int encode_snap_realms(struct ceph_mds_client *mdsc,ceph_pagelist_encode_32 (pagelist,sizeof (sr_rec)); } -doutc (cl," adding snap realm %llx seq %lld parent %llx\n" , +boutc (cl," adding snap realm %llx seq %lld parent %llx\n" , realm->ino, realm->seq, realm->parent_ino); sr_rec.ino =cpu_to_le64 (realm->ino); sr_rec.seq =cpu_to_le64 (realm->seq);
@@ -5125,7 +5130,7 @@ static int send_mds_reconnect(struct ceph_mds_client *mdsc, session->s_state =CEPH_MDS_SESSION_RECONNECTING ; session->s_seq =0 ; -doutc (cl,"session %p state %s\n" , session, +boutc (cl,"session %p state %s\n" , session,ceph_session_state_name (session->s_state));atomic_inc (&session->s_cap_gen);
@@ -5777,7 +5782,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,unsigned long targets[DIV_ROUND_UP (CEPH_MAX_MDS ,sizeof (unsigned long ))] = {0 };struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"new %u old %u\n" , newmap->m_epoch, oldmap->m_epoch); +boutc (cl,"new %u old %u\n" , newmap->m_epoch, oldmap->m_epoch);if (newmap->m_info) {for (i =0 ; i < newmap->possible_max_rank; i++) {
@@ -5793,7 +5798,7 @@ static void check_new_map(struct ceph_mds_client *mdsc, oldstate =ceph_mdsmap_get_state (oldmap, i); newstate =ceph_mdsmap_get_state (newmap, i); - doutc(cl, "mds%d state %s%s -> %s%s (session %s)\n", + boutc(cl, "mds%d state %s%s -> %s%s (session %s)\n", i, ceph_mds_state_name(oldstate), ceph_mdsmap_is_laggy(oldmap, i) ? " (laggy)" : "", ceph_mds_state_name(newstate),
@@ -5908,7 +5913,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,continue ; } } -doutc (cl,"send reconnect to export target mds.%d\n" , i); +boutc (cl,"send reconnect to export target mds.%d\n" , i);mutex_unlock (&mdsc->mutex); err =send_mds_reconnect (mdsc, s);if (err)
@@ -5928,7 +5933,7 @@ static void check_new_map(struct ceph_mds_client *mdsc,if (s->s_state ==CEPH_MDS_SESSION_OPEN || s->s_state ==CEPH_MDS_SESSION_HUNG || s->s_state ==CEPH_MDS_SESSION_CLOSING ) { -doutc (cl," connecting to export targets of laggy mds%d\n" , i); +boutc (cl," connecting to export targets of laggy mds%d\n" , i);__open_export_target_sessions (mdsc, s); } }
@@ -5967,7 +5972,7 @@ static void handle_lease(struct ceph_mds_client *mdsc,struct qstr dname;int release =0 ; -doutc (cl,"from mds%d\n" , mds); +boutc (cl,"from mds%d\n" , mds);if (!ceph_inc_mds_stopping_blocker (mdsc, session))return ;
@@ -5985,19 +5990,19 @@ static void handle_lease(struct ceph_mds_client *mdsc,/* lookup inode */ inode =ceph_find_inode (sb, vino); -doutc (cl,"%s, ino %llx %p %.*s\n" ,ceph_lease_op_name (h->action), - vino.ino, inode, dname.len, dname.name); +boutc (cl,"%s, ino %llx %p %.*s\n" ,ceph_lease_op_name (h->action), + vino.ino, inode, dname.len, (const char *)dname.name);mutex_lock (&session->s_mutex);if (!inode) { -doutc (cl,"no inode %llx\n" , vino.ino); +boutc (cl,"no inode %llx\n" , vino.ino); goto release; }/* dentry */ parent =d_find_alias (inode);if (!parent) { -doutc (cl,"no parent dentry on inode %p\n" , inode); +boutc (cl,"no parent dentry on inode %p\n" , inode);WARN_ON (1 ); goto release;/* hrm... */ }
@@ -6071,7 +6076,7 @@ void ceph_mdsc_lease_send_msg(struct ceph_mds_session *session,struct inode *dir;int len =sizeof (*lease) +sizeof (u32) +NAME_MAX ; -doutc (cl,"identry %p %s to mds%d\n" , dentry,ceph_lease_op_name (action), +boutc (cl,"identry %p %s to mds%d\n" , dentry,ceph_lease_op_name (action), session->s_mds); msg =ceph_msg_new (CEPH_MSG_CLIENT_LEASE , len,GFP_NOFS , false);
@@ -6158,7 +6163,7 @@ void inc_session_sequence(struct ceph_mds_session *s)if (s->s_state ==CEPH_MDS_SESSION_CLOSING ) {int ret; -doutc (cl,"resending session close request for mds%d\n" , s->s_mds); +boutc (cl,"resending session close request for mds%d\n" , s->s_mds); ret =request_close_session (s);if (ret <0 ) pr_err_client(cl, "unable to close session to mds%d: %d\n",
@@ -6191,7 +6196,7 @@ static void delayed_work(struct work_struct *work)int renew_caps;int i; -doutc (mdsc->fsc->client,"mdsc delayed_work\n" ); +boutc (mdsc->fsc->client,"mdsc delayed_work\n" );if (mdsc->stopping >=CEPH_MDSC_STOPPING_FLUSHED )return ;
@@ -6347,20 +6352,20 @@ static void wait_requests(struct ceph_mds_client *mdsc)if (__get_oldest_req (mdsc)) {mutex_unlock (&mdsc->mutex); -doutc (cl,"waiting for requests\n" ); +boutc (cl,"waiting for requests\n" );wait_for_completion_timeout (&mdsc->safe_umount_waiters,ceph_timeout_jiffies (opts->mount_timeout));/* tear down remaining requests */ mutex_lock (&mdsc->mutex);while ((req =__get_oldest_req (mdsc))) { -doutc (cl,"timed out on tid %llu\n" , req->r_tid); +boutc (cl,"timed out on tid %llu\n" , req->r_tid);list_del_init (&req->r_wait);__unregister_request (mdsc, req); } }mutex_unlock (&mdsc->mutex); -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }void send_flush_mdlog (struct ceph_mds_session *s)
@@ -6375,7 +6380,7 @@ void send_flush_mdlog(struct ceph_mds_session *s)return ;mutex_lock (&s->s_mutex); -doutc (cl,"request mdlog flush to mds%d (%s)s seq %lld\n" , +boutc (cl,"request mdlog flush to mds%d (%s)s seq %lld\n" , s->s_mds,ceph_session_state_name (s->s_state), s->s_seq); msg =ceph_create_session_msg (CEPH_SESSION_REQUEST_FLUSH_MDLOG , s->s_seq);
@@ -6450,7 +6455,7 @@ static int ceph_mds_auth_match(struct ceph_mds_client *mdsc,bool free_tpath = false;int m, n; -doutc (cl,"server path %s, tpath %s, match.path %s\n" , +boutc (cl,"server path %s, tpath %s, match.path %s\n" , spath, tpath, auth->match.path);if (spath && (m =strlen (spath)) !=1 ) {/* mount path + '/' + tpath + an extra space */
@@ -6474,7 +6479,7 @@ static int ceph_mds_auth_match(struct ceph_mds_client *mdsc, _tpath[tlen -1 ] ='\0' ; tlen -=1 ; } -doutc (cl,"_tpath %s\n" , _tpath); +boutc (cl,"_tpath %s\n" , _tpath);/* * In case first == _tpath && tlen == len:
@@ -6504,7 +6509,7 @@ static int ceph_mds_auth_match(struct ceph_mds_client *mdsc, } } -doutc (cl,"matched\n" ); +boutc (cl,"matched\n" );return 1 ; }
@@ -6518,7 +6523,7 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)bool root_squash_perms = true;int i, err; -doutc (cl,"tpath '%s', mask %d, caller_uid %d, caller_gid %d\n" , +boutc (cl,"tpath '%s', mask %d, caller_uid %d, caller_gid %d\n" , tpath, mask, caller_uid, caller_gid);for (i =0 ; i < mdsc->s_cap_auths_num; i++) {
@@ -6544,23 +6549,23 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)put_cred (cred); -doutc (cl,"root_squash_perms %d, rw_perms_s %p\n" , root_squash_perms, +boutc (cl,"root_squash_perms %d, rw_perms_s %p\n" , root_squash_perms, rw_perms_s);if (root_squash_perms && rw_perms_s ==NULL ) { -doutc (cl,"access allowed\n" ); +boutc (cl,"access allowed\n" );return 0 ; }if (!root_squash_perms) { -doutc (cl,"root_squash is enabled and user(%d %d) isn't allowed to write" , +boutc (cl,"root_squash is enabled and user(%d %d) isn't allowed to write" , caller_uid, caller_gid); }if (rw_perms_s) { -doutc (cl,"mds auth caps readable/writeable %d/%d while request r/w %d/%d" , +boutc (cl,"mds auth caps readable/writeable %d/%d while request r/w %d/%d" , rw_perms_s->readable, rw_perms_s->writeable, !!(mask &MAY_READ ), !!(mask &MAY_WRITE )); } -doutc (cl,"access denied\n" ); +boutc (cl,"access denied\n" );return -EACCES ; }
@@ -6570,7 +6575,7 @@ int ceph_mds_check_access(struct ceph_mds_client *mdsc, char *tpath, int mask)*/ void ceph_mdsc_pre_umount (struct ceph_mds_client *mdsc) { -doutc (mdsc->fsc->client,"begin\n" ); +boutc (mdsc->fsc->client,"begin\n" ); mdsc->stopping =CEPH_MDSC_STOPPING_BEGIN ;ceph_mdsc_iterate_sessions (mdsc, send_flush_mdlog, true);
@@ -6585,7 +6590,7 @@ void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc)ceph_msgr_flush ();ceph_cleanup_quotarealms_inodes (mdsc); -doutc (mdsc->fsc->client,"done\n" ); +boutc (mdsc->fsc->client,"done\n" ); }/*
@@ -6600,7 +6605,7 @@ static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *mdstruct rb_node *n;mutex_lock (&mdsc->mutex); -doutc (cl,"want %lld\n" , want_tid); +boutc (cl,"want %lld\n" , want_tid); restart: req =__get_oldest_req (mdsc);while (req && req->r_tid <= want_tid) {
@@ -6634,7 +6639,7 @@ static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *md }else {ceph_put_mds_session (s); } -doutc (cl,"wait on %llu (want %llu)\n" , +boutc (cl,"wait on %llu (want %llu)\n" , req->r_tid, want_tid);wait_for_completion (&req->r_safe_completion);
@@ -6653,7 +6658,7 @@ static void flush_mdlog_and_wait_mdsc_unsafe_requests(struct ceph_mds_client *md }mutex_unlock (&mdsc->mutex);ceph_put_mds_session (last_session); -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }void ceph_mdsc_sync (struct ceph_mds_client *mdsc)
@@ -6664,7 +6669,7 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc)if (READ_ONCE (mdsc->fsc->mount_state) >=CEPH_MOUNT_SHUTDOWN )return ; -doutc (cl,"sync\n" ); +boutc (cl,"sync\n" );mutex_lock (&mdsc->mutex); want_tid = mdsc->last_tid;mutex_unlock (&mdsc->mutex);
@@ -6681,7 +6686,7 @@ void ceph_mdsc_sync(struct ceph_mds_client *mdsc) }spin_unlock (&mdsc->cap_dirty_lock); -doutc (cl,"sync want tid %lld flush_seq %lld\n" , want_tid, want_flush); +boutc (cl,"sync want tid %lld flush_seq %lld\n" , want_tid, want_flush);flush_mdlog_and_wait_mdsc_unsafe_requests (mdsc, want_tid);wait_caps_flush (mdsc, want_flush);
@@ -6708,7 +6713,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)int i;int skipped =0 ; -doutc (cl,"begin\n" ); +boutc (cl,"begin\n" );/* close sessions */ mutex_lock (&mdsc->mutex);
@@ -6726,7 +6731,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc) }mutex_unlock (&mdsc->mutex); -doutc (cl,"waiting for sessions to close\n" ); +boutc (cl,"waiting for sessions to close\n" );wait_event_timeout (mdsc->session_close_wq,done_closing_sessions (mdsc, skipped),ceph_timeout_jiffies (opts->mount_timeout));
@@ -6755,7 +6760,7 @@ void ceph_mdsc_close_sessions(struct ceph_mds_client *mdsc)cancel_work_sync (&mdsc->cap_unlink_work);cancel_delayed_work_sync (&mdsc->delayed_work);/* cancel timer */ -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }void ceph_mdsc_force_umount (struct ceph_mds_client *mdsc)
@@ -6763,7 +6768,7 @@ void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc)struct ceph_mds_session *session;int mds; -doutc (mdsc->fsc->client,"force umount\n" ); +boutc (mdsc->fsc->client,"force umount\n" );mutex_lock (&mdsc->mutex);for (mds =0 ; mds < mdsc->max_sessions; mds++) {
@@ -6794,7 +6799,7 @@ void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc)static void ceph_mdsc_stop (struct ceph_mds_client *mdsc) { -doutc (mdsc->fsc->client,"stop\n" ); +boutc (mdsc->fsc->client,"stop\n" );/* * Make sure the delayed work stopped before releasing * the resources.
@@ -6827,7 +6832,7 @@ static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)void ceph_mdsc_destroy (struct ceph_fs_client *fsc) {struct ceph_mds_client *mdsc = fsc->mdsc; -doutc (fsc->client,"%p\n" , mdsc); +boutc (fsc->client,"%p\n" , mdsc);if (!mdsc)return ;
@@ -6860,7 +6865,7 @@ void ceph_mdsc_destroy(struct ceph_fs_client *fsc) fsc->mdsc =NULL ;kfree (mdsc); -doutc (fsc->client,"%p done\n" , mdsc); +boutc (fsc->client,"%p done\n" , mdsc); }void ceph_mdsc_handle_fsmap (struct ceph_mds_client *mdsc,struct ceph_msg *msg)
@@ -6878,7 +6883,7 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)ceph_decode_need (&p, end,sizeof (u32), bad); epoch =ceph_decode_32 (&p); -doutc (cl,"epoch %u\n" , epoch); +boutc (cl,"epoch %u\n" , epoch);/* struct_v, struct_cv, map_len, epoch, legacy_client_fscid */ ceph_decode_skip_n (&p, end,2 +sizeof (u32) *3 , bad);
@@ -6954,12 +6959,12 @@ void ceph_mdsc_handle_mdsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg)return ; epoch =ceph_decode_32 (&p); maplen =ceph_decode_32 (&p); -doutc (cl,"epoch %u len %d\n" , epoch, (int )maplen); +boutc (cl,"epoch %u len %d\n" , epoch, (int )maplen);/* do we need it? */ mutex_lock (&mdsc->mutex);if (mdsc->mdsmap && epoch <= mdsc->mdsmap->m_epoch) { -doutc (cl,"epoch %u <= our %u\n" , epoch, mdsc->mdsmap->m_epoch); +boutc (cl,"epoch %u <= our %u\n" , epoch, mdsc->mdsmap->m_epoch);mutex_unlock (&mdsc->mutex);return ; }
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 10/15 ceph: add BLOG debugfs interface
In reply to Alex MarkuzeAdd blog_debugfs.c: per-superblock debugfs files under /sys/kernel/debug/ceph/<fsid>/blog/ (entries, stats, sources, clients, enable, clear). Wire lifecycle hooks in super.c and debugfs.c. Readers use smp_load_acquire() on pf->head to pair with writers' smp_store_release() publication.
--- fs/ceph/Makefile | 3 + fs/ceph/blog_debugfs.c | 434 +++++++++++++++++++++++++++++++++++++++++ fs/ceph/debugfs.c | 23 ++- fs/ceph/super.c | 58 ++++-- 4 files changed, 500 insertions(+), 18 deletions(-) create mode 100644 fs/ceph/blog_debugfs.c
fs/ceph/Makefile +3 -0
@@ -16,3 +16,6 @@ ceph-y += blog_client.o ceph-$(CONFIG_CEPH_FSCACHE) += cache.o ceph-$(CONFIG_CEPH_FS_POSIX_ACL) += acl.o ceph-$(CONFIG_FS_ENCRYPTION) += crypto.o +ifdef CONFIG_DEBUG_FS +ceph-y += blog_debugfs.o +endif
fs/ceph/blog_debugfs.c new file +434 -0
434 lines not on this page · raw message
fs/ceph/debugfs.c +16 -7
@@ -11,12 +11,12 @@#include <linux/ktime.h> #include <linux/uaccess.h> #include <linux/atomic.h> -#include <linux/ceph/libceph.h> #include <linux/ceph/mon_client.h> #include <linux/ceph/auth.h> #include <linux/ceph/debugfs.h> #include <linux/ceph/decode.h> +#include <linux/ceph/ceph_blog.h> #include "super.h"
@@ -639,7 +639,7 @@ DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get,void ceph_fs_debugfs_cleanup (struct ceph_fs_client *fsc) { -doutc (fsc->client,"begin\n" ); +boutc (fsc->client,"begin\n" );debugfs_remove (fsc->debugfs_bdi);debugfs_remove (fsc->debugfs_congestion_kb);debugfs_remove (fsc->debugfs_mdsmap);
@@ -650,14 +650,19 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)debugfs_remove_recursive (fsc->debugfs_reset_dir);debugfs_remove (fsc->debugfs_subvolume_metrics);debugfs_remove_recursive (fsc->debugfs_metrics_dir); -doutc (fsc->client,"done\n" ); + +#if IS_ENABLED (CONFIG_CEPH_FS ) +ceph_blog_debugfs_cleanup (fsc); +#endif + +boutc (fsc->client,"done\n" ); }void ceph_fs_debugfs_init (struct ceph_fs_client *fsc) {char name[NAME_MAX ]; -doutc (fsc->client,"begin\n" ); +boutc (fsc->client,"begin\n" ); fsc->debugfs_congestion_kb = debugfs_create_file("writeback_congestion_kb", 0600,
@@ -728,9 +733,13 @@ void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)debugfs_create_file ("subvolumes" ,0400 , fsc->debugfs_metrics_dir, fsc, &subvolume_metrics_fops); - doutc(fsc->client, "done\n"); -} +#if IS_ENABLED (CONFIG_CEPH_FS ) +ceph_blog_debugfs_init (fsc); +#endif + + boutc(fsc->client, "done\n"); +}#else /* CONFIG_DEBUG_FS */
@@ -742,4 +751,4 @@ void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc) { } -#endif /* CONFIG_DEBUG_FS */ +#endif /* CONFIG_DEBUG_FS */
fs/ceph/super.c +47 -11
157 lines not on this page · raw message
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 11/15 ceph: convert VFS inode and directory paths to bout
In reply to Alex MarkuzeReplace dout()/doutc() with bout()/boutc() in dir.c (readdir, lookup, mkdir, unlink, rename), inode.c (getattr, setattr, fill_inode), and export.c (NFS export ops).
--- fs/ceph/dir.c | 290 ++++++++++++++++++++++++++++++++--------------- fs/ceph/export.c | 83 ++++++++++---- fs/ceph/inode.c | 233 +++++++++++++++++++++---------------- 3 files changed, 401 insertions(+), 205 deletions(-)
fs/ceph/dir.c +201 -89
@@ -122,7 +122,7 @@ static int note_last_dentry(struct ceph_fs_client *fsc,memcpy (dfi->last_name, name, len); dfi->last_name[len] =0 ; dfi->next_offset = next_offset; -doutc (fsc->client,"'%s'\n" , dfi->last_name); +boutc (fsc->client,"'%s'\n" , dfi->last_name);return 0 ; }
@@ -146,7 +146,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx, cache_ctl->folio =filemap_lock_folio (&dir->i_data, ptr_pgoff);if (IS_ERR (cache_ctl->folio)) { cache_ctl->folio =NULL ; -doutc (cl," folio %lu not found\n" , ptr_pgoff); +boutc (cl," folio %lu not found\n" , ptr_pgoff);return ERR_PTR (-EAGAIN ); }/* reading/filling the cache are serialized by
@@ -197,7 +197,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,u64 idx =0 ;int err =0 ; -doutc (cl,"%p %llx.%llx v%u at %llx\n" , dir,ceph_vinop (dir), +boutc (cl,"%p %llx.%llx v%u at %llx\n" , dir,ceph_vinop (dir), (unsigned )shared_gen, ctx->pos);/* search start position */
@@ -228,7 +228,7 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,dput (dentry); } -doutc (cl,"%p %llx.%llx cache idx %llu\n" , dir, +boutc (cl,"%p %llx.%llx cache idx %llu\n" , dir,ceph_vinop (dir), idx); }
@@ -265,8 +265,8 @@ static int __dcache_readdir(struct file *file, struct dir_context *ctx,spin_unlock (&dentry->d_lock); if (emit_dentry) { - doutc(cl, " %llx dentry %p %pd %p\n", di->offset, - dentry, dentry, d_inode(dentry)); + boutc(cl, " %llx dentry %p %s %p\n", di->offset, + dentry, dentry->d_name.name, d_inode(dentry)); ctx->pos = di->offset; if (!dir_emit(ctx, dentry->d_name.name, dentry->d_name.len, ceph_present_inode(d_inode(dentry)),
@@ -326,19 +326,26 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)int err;unsigned frag =-1 ;struct ceph_mds_reply_info_parsed *rinfo; +struct ceph_journal_info __ji; -doutc (cl,"%p %llx.%llx file %p pos %llx\n" , inode, +ceph_blog_enter (fsc, &__ji); + +boutc (cl,"%p %llx.%llx file %p pos %llx\n" , inode,ceph_vinop (inode), file, ctx->pos); -if (dfi->file_info.flags &CEPH_F_ATEND ) +if (dfi->file_info.flags &CEPH_F_ATEND ) { +ceph_blog_exit (&__ji);return 0 ; + }/* always start with . and .. */ if (ctx->pos ==0 ) { -doutc (cl,"%p %llx.%llx off 0 -> '.'\n" , inode, +boutc (cl,"%p %llx.%llx off 0 -> '.'\n" , inode,ceph_vinop (inode));if (!dir_emit (ctx,"." ,1 ,ceph_present_inode (inode), - inode->i_mode >>12 )) + inode->i_mode >>12 )) { +ceph_blog_exit (&__ji);return 0 ; + } ctx->pos =1 ; }if (ctx->pos ==1 ) {
@@ -349,16 +356,20 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) ino =ceph_present_inode (dentry->d_parent->d_inode);spin_unlock (&dentry->d_lock); -doutc (cl,"%p %llx.%llx off 1 -> '..'\n" , inode, +boutc (cl,"%p %llx.%llx off 1 -> '..'\n" , inode,ceph_vinop (inode)); -if (!dir_emit (ctx,".." ,2 , ino, inode->i_mode >>12 )) +if (!dir_emit (ctx,".." ,2 , ino, inode->i_mode >>12 )) { +ceph_blog_exit (&__ji);return 0 ; + } ctx->pos =2 ; } err =ceph_fscrypt_prepare_readdir (inode); -if (err <0 ) +if (err <0 ) { +ceph_blog_exit (&__ji);return err; + }spin_lock (&ci->i_ceph_lock);/* request Fx cap. if have Fx, we don't need to release Fs cap
@@ -374,8 +385,10 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)spin_unlock (&ci->i_ceph_lock); err =__dcache_readdir (file, ctx, shared_gen); -if (err != -EAGAIN ) +if (err != -EAGAIN ) { +ceph_blog_exit (&__ji);return err; + } }else {spin_unlock (&ci->i_ceph_lock); }
@@ -404,15 +417,18 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) frag =fpos_frag (ctx->pos); } -doutc (cl,"fetching %p %llx.%llx frag %x offset '%s'\n" , +boutc (cl,"fetching %p %llx.%llx frag %x offset '%s'\n" , inode,ceph_vinop (inode), frag, dfi->last_name); req =ceph_mdsc_create_request (mdsc, op,USE_AUTH_MDS ); -if (IS_ERR (req)) +if (IS_ERR (req)) { +ceph_blog_exit (&__ji);return PTR_ERR (req); + } err =ceph_alloc_readdir_reply_buffer (req, inode);if (err) {ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return err; }/* hints to request -> mds selection code */
@@ -428,6 +444,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) req->r_path2 =kzalloc (NAME_MAX +1 ,GFP_KERNEL );if (!req->r_path2) {ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return -ENOMEM ; }memcpy (req->r_path2, dfi->last_name, len);
@@ -435,6 +452,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) err =ceph_encode_encrypted_dname (inode, req->r_path2, len);if (err <0 ) {ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return err; } }else if (is_hash_order (ctx->pos)) {
@@ -456,9 +474,10 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) err =ceph_mdsc_do_request (mdsc,NULL , req);if (err <0 ) {ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return err; } - doutc(cl, "%p %llx.%llx got and parsed readdir result=%d" + boutc(cl, "%p %llx.%llx got and parsed readdir result=%d" "on frag %x, end=%d, complete=%d, hash_order=%d\n", inode, ceph_vinop(inode), err, frag, (int)req->r_reply_info.dir_end,
@@ -493,7 +512,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) dfi->dir_ordered_count = req->r_dir_ordered_cnt; } }else { -doutc (cl,"%p %llx.%llx !did_prepopulate\n" , inode, +boutc (cl,"%p %llx.%llx !did_prepopulate\n" , inode,ceph_vinop (inode));/* disable readdir cache */ dfi->readdir_cache_idx =-1 ;
@@ -512,6 +531,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)if (err) {ceph_mdsc_put_request (dfi->last_readdir); dfi->last_readdir =NULL ; +ceph_blog_exit (&__ji);return err; } }else if (req->r_reply_info.dir_end) {
@@ -521,7 +541,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx) } rinfo = &dfi->last_readdir->r_reply_info; -doutc (cl,"%p %llx.%llx frag %x num %d pos %llx chunk first %llx\n" , +boutc (cl,"%p %llx.%llx frag %x num %d pos %llx chunk first %llx\n" , inode,ceph_vinop (inode), dfi->frag, rinfo->dir_nr, ctx->pos, rinfo->dir_nr ? rinfo->dir_entries[0 ].offset :0LL );
@@ -546,16 +566,19 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)pr_warn_client (cl,"%p %llx.%llx rde->offset 0x%llx ctx->pos 0x%llx\n" , inode,ceph_vinop (inode), rde->offset, ctx->pos); +ceph_blog_exit (&__ji);return -EIO ; } -if (WARN_ON_ONCE (!rde->inode.in)) +if (WARN_ON_ONCE (!rde->inode.in)) { +ceph_blog_exit (&__ji);return -EIO ; + } ctx->pos = rde->offset; -doutc (cl,"%p %llx.%llx (%d/%d) -> %llx '%.*s' %p\n" , inode, +boutc (cl,"%p %llx.%llx (%d/%d) -> %llx '%.*s' %p\n" , inode,ceph_vinop (inode), i, rinfo->dir_nr, ctx->pos, - rde->name_len, rde->name, &rde->inode.in); + rde->name_len, (const char *)rde->name, &rde->inode.in); if (!dir_emit(ctx, rde->name, rde->name_len, ceph_present_ino(inode->i_sb, le64_to_cpu(rde->inode.in->ino)),
@@ -566,7 +589,8 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)* doesn't have enough memory, etc. So for next readdir * it will continue. */ -doutc (cl,"filldir stopping us...\n" ); +boutc (cl,"filldir stopping us...\n" ); +ceph_blog_exit (&__ji);return 0 ; }
@@ -597,7 +621,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)kfree (dfi->last_name); dfi->last_name =NULL ; } -doutc (cl,"%p %llx.%llx next frag is %x\n" , inode, +boutc (cl,"%p %llx.%llx next frag is %x\n" , inode,ceph_vinop (inode), frag); goto more; }
@@ -613,7 +637,7 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)spin_lock (&ci->i_ceph_lock);if (dfi->dir_ordered_count ==atomic64_read (&ci->i_ordered_count)) { -doutc (cl," marking %p %llx.%llx complete and ordered\n" , +boutc (cl," marking %p %llx.%llx complete and ordered\n" , inode,ceph_vinop (inode));/* use i_size to track number of entries in * readdir cache */
@@ -621,15 +645,16 @@ static int ceph_readdir(struct file *file, struct dir_context *ctx)i_size_write (inode, dfi->readdir_cache_idx *sizeof (struct dentry *)); }else { -doutc (cl," marking %llx.%llx complete\n" , +boutc (cl," marking %llx.%llx complete\n" ,ceph_vinop (inode)); }__ceph_dir_set_complete (ci, dfi->dir_release_count, dfi->dir_ordered_count);spin_unlock (&ci->i_ceph_lock); } -doutc (cl,"%p %llx.%llx file %p done.\n" , inode,ceph_vinop (inode), +boutc (cl,"%p %llx.%llx file %p done.\n" , inode,ceph_vinop (inode), file); +ceph_blog_exit (&__ji);return 0 ; }
@@ -675,8 +700,12 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) {struct ceph_dir_file_info *dfi = file->private_data;struct inode *inode = file->f_mapping->host; +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_client *cl =ceph_inode_to_client (inode);loff_t retval; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji);inode_lock (inode); retval = -EINVAL ;
@@ -695,7 +724,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence)if (offset >=0 ) {if (need_reset_readdir (dfi, offset)) { -doutc (cl,"%p %llx.%llx dropping %p content\n" , +boutc (cl,"%p %llx.%llx dropping %p content\n" , inode,ceph_vinop (inode), file);reset_readdir (dfi); }else if (is_hash_order (offset) && offset > file->f_pos) {
@@ -713,6 +742,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) } out:inode_unlock (inode); +ceph_blog_exit (&__ji);return retval; }
@@ -733,9 +763,9 @@ struct dentry *ceph_handle_snapdir(struct ceph_mds_request *req,struct inode *inode =ceph_get_snapdir (parent); res =d_splice_alias (inode, dentry); -doutc (cl,"ENOENT on snapdir %p '%pd', linking to " +boutc (cl,"ENOENT on snapdir %p '%s', linking to " "snapdir %p %llx.%llx. Spliced dentry %p\n" , - dentry, dentry, inode,ceph_vinop (inode), res); + dentry, dentry->d_name.name, inode,ceph_vinop (inode), res);if (res) dentry = res; }
@@ -762,7 +792,7 @@ struct dentry *ceph_finish_lookup(struct ceph_mds_request *req,/* no trace? */ err =0 ;if (!req->r_reply_info.head->is_dentry) { -doutc (cl, +boutc (cl,"ENOENT and no trace, dentry %p inode %llx.%llx\n" , dentry,ceph_vinop (d_inode (dentry)));if (d_really_is_positive (dentry)) {
@@ -803,19 +833,26 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,int op;int mask;int err; +struct ceph_journal_info __ji; -doutc (cl,"%p %llx.%llx/'%pd' dentry %p\n" , dir,ceph_vinop (dir), - dentry, dentry); +ceph_blog_enter (fsc, &__ji); -if (dentry->d_name.len >NAME_MAX ) +boutc (cl,"%p %llx.%llx/'%s' dentry %p\n" , dir,ceph_vinop (dir), + dentry->d_name.name, dentry); + +if (dentry->d_name.len >NAME_MAX ) { +ceph_blog_exit (&__ji);return ERR_PTR (-ENAMETOOLONG ); + }if (IS_ENCRYPTED (dir)) {bool had_key =fscrypt_has_encryption_key (dir); err =fscrypt_prepare_lookup_partial (dir, dentry); -if (err <0 ) +if (err <0 ) { +ceph_blog_exit (&__ji);return ERR_PTR (err); + }/* mark directory as incomplete if it has been unlocked */ if (!had_key &&fscrypt_has_encryption_key (dir))
@@ -828,7 +865,7 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry,struct ceph_dentry_info *di =ceph_dentry (dentry);spin_lock (&ci->i_ceph_lock); -doutc (cl," dir %llx.%llx flags are 0x%lx\n" , +boutc (cl," dir %llx.%llx flags are 0x%lx\n" ,ceph_vinop (dir), ci->i_ceph_flags); if (strncmp(dentry->d_name.name, fsc->mount_options->snapdir_name,
@@ -839,11 +876,12 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, __ceph_caps_issued_mask_metric(ci, CEPH_CAP_FILE_SHARED, 1)) {__ceph_touch_fmode (ci, mdsc,CEPH_FILE_MODE_RD );spin_unlock (&ci->i_ceph_lock); -doutc (cl," dir %llx.%llx complete, -ENOENT\n" , +boutc (cl," dir %llx.%llx complete, -ENOENT\n" ,ceph_vinop (dir));if (d_unhashed (dentry))d_add (dentry,NULL ); di->lease_shared_gen =atomic_read (&ci->i_shared_gen); +ceph_blog_exit (&__ji);return NULL ; }spin_unlock (&ci->i_ceph_lock);
@@ -852,8 +890,10 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, op =ceph_snap (dir) ==CEPH_SNAPDIR ?CEPH_MDS_OP_LOOKUPSNAP :CEPH_MDS_OP_LOOKUP ; req =ceph_mdsc_create_request (mdsc, op,USE_ANY_MDS ); -if (IS_ERR (req)) +if (IS_ERR (req)) { +ceph_blog_exit (&__ji);return ERR_CAST (req); + } req->r_dentry =dget (dentry); req->r_num_caps =2 ;
@@ -879,7 +919,8 @@ static struct dentry *ceph_lookup(struct inode *dir, struct dentry *dentry, } dentry =ceph_finish_lookup (req, dentry, err);ceph_mdsc_put_request (req);/* will dput(dentry) */ -doutc (cl,"result=%p\n" , dentry); +boutc (cl,"result=%p\n" , dentry); +ceph_blog_exit (&__ji);return dentry; }
@@ -914,25 +955,33 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode, dev_t rdev) { struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); +struct ceph_fs_client *fsc = mdsc->fsc;struct ceph_client *cl = mdsc->fsc->client;struct ceph_mds_request *req;struct ceph_acl_sec_ctx as_ctx = {};int err; +struct ceph_journal_info __ji; -if (ceph_snap (dir) !=CEPH_NOSNAP ) +ceph_blog_enter (fsc, &__ji); + +if (ceph_snap (dir) !=CEPH_NOSNAP ) { +ceph_blog_exit (&__ji);return -EROFS ; + } err =ceph_wait_on_conflict_unlink (dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + }if (ceph_quota_is_max_files_exceeded (dir)) { err = -EDQUOT ; goto out; } -doutc (cl,"%p %llx.%llx/'%pd' dentry %p mode 0%ho rdev %d\n" , - dir,ceph_vinop (dir), dentry, dentry, mode, rdev); +boutc (cl,"%p %llx.%llx/'%s' dentry %p mode 0%ho rdev %d\n" , + dir,ceph_vinop (dir), dentry->d_name.name, dentry, mode, rdev); req =ceph_mdsc_create_request (mdsc,CEPH_MDS_OP_MKNOD ,USE_AUTH_MDS );if (IS_ERR (req)) { err =PTR_ERR (req);
@@ -974,13 +1023,21 @@ static int ceph_mknod(struct mnt_idmap *idmap, struct inode *dir,else d_drop (dentry);ceph_release_acl_sec_ctx (&as_ctx); +ceph_blog_exit (&__ji);return err; }static int ceph_create (struct mnt_idmap *idmap,struct inode *dir,struct dentry *dentry,umode_t mode,bool excl) { -return ceph_mknod (idmap, dir, dentry, mode,0 ); +struct ceph_fs_client *fsc =ceph_sb_to_fs_client (dir->i_sb); +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); +int ret =ceph_mknod (idmap, dir, dentry, mode,0 ); + +ceph_blog_exit (&__ji); +return ret; }#if IS_ENABLED (CONFIG_FS_ENCRYPTION )
@@ -1025,26 +1082,34 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, const char *dest) { struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(dir->i_sb); +struct ceph_fs_client *fsc = mdsc->fsc;struct ceph_client *cl = mdsc->fsc->client;struct ceph_mds_request *req;struct ceph_acl_sec_ctx as_ctx = {};umode_t mode =S_IFLNK |0777 ;int err; +struct ceph_journal_info __ji; -if (ceph_snap (dir) !=CEPH_NOSNAP ) +ceph_blog_enter (fsc, &__ji); + +if (ceph_snap (dir) !=CEPH_NOSNAP ) { +ceph_blog_exit (&__ji);return -EROFS ; + } err =ceph_wait_on_conflict_unlink (dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + }if (ceph_quota_is_max_files_exceeded (dir)) { err = -EDQUOT ; goto out; } -doutc (cl,"%p %llx.%llx/'%pd' to '%s'\n" , dir,ceph_vinop (dir), dentry, - dest); +boutc (cl,"%p %llx.%llx/'%s' to '%s'\n" , dir,ceph_vinop (dir), + dentry->d_name.name, dest); req =ceph_mdsc_create_request (mdsc,CEPH_MDS_OP_SYMLINK ,USE_AUTH_MDS );if (IS_ERR (req)) { err =PTR_ERR (req);
@@ -1092,6 +1157,7 @@ static int ceph_symlink(struct mnt_idmap *idmap, struct inode *dir,if (err)d_drop (dentry);ceph_release_acl_sec_ctx (&as_ctx); +ceph_blog_exit (&__ji);return err; }
@@ -1099,25 +1165,31 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir, struct dentry *dentry, umode_t mode) {struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (dir->i_sb); +struct ceph_fs_client *fsc = mdsc->fsc;struct ceph_client *cl = mdsc->fsc->client;struct ceph_mds_request *req;struct ceph_acl_sec_ctx as_ctx = {};struct dentry *ret;int err;int op; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); err =ceph_wait_on_conflict_unlink (dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return ERR_PTR (err); + }if (ceph_snap (dir) ==CEPH_SNAPDIR ) {/* mkdir .snap/foo is a MKSNAP */ op =CEPH_MDS_OP_MKSNAP ; -doutc (cl,"mksnap %llx.%llx/'%pd' dentry %p\n" , -ceph_vinop (dir), dentry, dentry); +boutc (cl,"mksnap %llx.%llx/'%s' dentry %p\n" , +ceph_vinop (dir), dentry->d_name.name, dentry); }else if (ceph_snap (dir) ==CEPH_NOSNAP ) { -doutc (cl,"mkdir %llx.%llx/'%pd' dentry %p mode 0%ho\n" , -ceph_vinop (dir), dentry, dentry, mode); +boutc (cl,"mkdir %llx.%llx/'%s' dentry %p mode 0%ho\n" , +ceph_vinop (dir), dentry->d_name.name, dentry, mode); op =CEPH_MDS_OP_MKDIR ; }else { ret =ERR_PTR (-EROFS );
@@ -1184,6 +1256,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,d_drop (dentry); }ceph_release_acl_sec_ctx (&as_ctx); +ceph_blog_exit (&__ji);return ret; }
@@ -1191,29 +1264,42 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) {struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (dir->i_sb); +struct ceph_fs_client *fsc = mdsc->fsc;struct ceph_client *cl = mdsc->fsc->client;struct ceph_mds_request *req;int err; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); -if (dentry->d_flags &DCACHE_DISCONNECTED ) +if (dentry->d_flags &DCACHE_DISCONNECTED ) { +ceph_blog_exit (&__ji);return -EINVAL ; + } err =ceph_wait_on_conflict_unlink (dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + } -if (ceph_snap (dir) !=CEPH_NOSNAP ) +if (ceph_snap (dir) !=CEPH_NOSNAP ) { +ceph_blog_exit (&__ji);return -EROFS ; + } err =fscrypt_prepare_link (old_dentry, dir, dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + } -doutc (cl,"%p %llx.%llx/'%pd' to '%pd'\n" , dir,ceph_vinop (dir), - old_dentry, dentry); +boutc (cl,"%p %llx.%llx/'%s' to '%s'\n" , dir,ceph_vinop (dir), + old_dentry->d_name.name, dentry->d_name.name); req =ceph_mdsc_create_request (mdsc,CEPH_MDS_OP_LINK ,USE_AUTH_MDS );if (IS_ERR (req)) {d_drop (dentry); +ceph_blog_exit (&__ji);return PTR_ERR (req); } req->r_dentry =dget (dentry);
@@ -1240,6 +1326,7 @@ static int ceph_link(struct dentry *old_dentry, struct inode *dir,d_instantiate (dentry,d_inode (old_dentry)); }ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return err; }
@@ -1348,15 +1435,19 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)int err = -EROFS ;int op;char *path; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji);if (ceph_snap (dir) ==CEPH_SNAPDIR ) {/* rmdir .snap/foo is RMSNAP */ -doutc (cl,"rmsnap %llx.%llx/'%pd' dn\n" ,ceph_vinop (dir), - dentry); +boutc (cl,"rmsnap %llx.%llx/'%s' dn\n" ,ceph_vinop (dir), + dentry->d_name.name); op =CEPH_MDS_OP_RMSNAP ; }else if (ceph_snap (dir) ==CEPH_NOSNAP ) { -doutc (cl,"unlink/rmdir %llx.%llx/'%pd' inode %llx.%llx\n" , -ceph_vinop (dir), dentry,ceph_vinop (inode)); +boutc (cl,"unlink/rmdir %llx.%llx/'%s' inode %llx.%llx\n" , +ceph_vinop (dir), dentry->d_name.name, +ceph_vinop (inode)); op =d_is_dir (dentry) ?CEPH_MDS_OP_RMDIR :CEPH_MDS_OP_UNLINK ; }else
@@ -1379,6 +1470,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)/* For none EACCES cases will let the MDS do the mds auth check */ if (err == -EACCES ) { +ceph_blog_exit (&__ji);return err; }else if (err <0 ) { try_async = false;
@@ -1404,8 +1496,8 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry) (req->r_dir_caps = get_caps_for_async_unlink(dir, dentry))) {struct ceph_dentry_info *di =ceph_dentry (dentry); -doutc (cl,"async unlink on %llx.%llx/'%pd' caps=%s" , -ceph_vinop (dir), dentry, +boutc (cl,"async unlink on %llx.%llx/'%s' caps=%s" , +ceph_vinop (dir), dentry->d_name.name,ceph_cap_string (req->r_dir_caps));set_bit (CEPH_MDS_R_ASYNC , &req->r_req_flags); req->r_callback = ceph_async_unlink_cb;
@@ -1465,6 +1557,7 @@ static int ceph_unlink(struct inode *dir, struct dentry *dentry)ceph_mdsc_put_request (req); out: +ceph_blog_exit (&__ji);return err; }
@@ -1473,42 +1566,60 @@ static int ceph_rename(struct mnt_idmap *idmap, struct inode *old_dir, struct dentry *new_dentry, unsigned int flags) {struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (old_dir->i_sb); +struct ceph_fs_client *fsc = mdsc->fsc;struct ceph_client *cl = mdsc->fsc->client;struct ceph_mds_request *req;int op =CEPH_MDS_OP_RENAME ;int err; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); -if (flags) +if (flags) { +ceph_blog_exit (&__ji);return -EINVAL ; + } -if (ceph_snap (old_dir) !=ceph_snap (new_dir)) +if (ceph_snap (old_dir) !=ceph_snap (new_dir)) { +ceph_blog_exit (&__ji);return -EXDEV ; + }if (ceph_snap (old_dir) !=CEPH_NOSNAP ) {if (old_dir == new_dir &&ceph_snap (old_dir) ==CEPH_SNAPDIR ) op =CEPH_MDS_OP_RENAMESNAP ; -else +else { +ceph_blog_exit (&__ji);return -EROFS ; + } }/* don't allow cross-quota renames */ if ((old_dir != new_dir) && - (!ceph_quota_is_same_realm (old_dir, new_dir))) + (!ceph_quota_is_same_realm (old_dir, new_dir))) { +ceph_blog_exit (&__ji);return -EXDEV ; + } err =ceph_wait_on_conflict_unlink (new_dentry); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + } err =fscrypt_prepare_rename (old_dir, old_dentry, new_dir, new_dentry, flags); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + } -doutc (cl,"%llx.%llx/'%pd' to %llx.%llx/'%pd'\n" , -ceph_vinop (old_dir), old_dentry,ceph_vinop (new_dir), - new_dentry); +boutc (cl,"%llx.%llx/'%s' to %llx.%llx/'%s'\n" , +ceph_vinop (old_dir), old_dentry->d_name.name, +ceph_vinop (new_dir), new_dentry->d_name.name); req =ceph_mdsc_create_request (mdsc, op,USE_AUTH_MDS ); -if (IS_ERR (req)) +if (IS_ERR (req)) { +ceph_blog_exit (&__ji);return PTR_ERR (req); + }ihold (old_dir); req->r_dentry =dget (new_dentry); req->r_num_caps =2 ;
@@ -1537,6 +1648,7 @@ static int ceph_rename(struct mnt_idmap *idmap, struct inode *old_dir,d_move (old_dentry, new_dentry); }ceph_mdsc_put_request (req); +ceph_blog_exit (&__ji);return err; }
@@ -1553,7 +1665,7 @@ void __ceph_dentry_lease_touch(struct ceph_dentry_info *di)struct ceph_mds_client *mdsc =ceph_sb_to_fs_client (dn->d_sb)->mdsc;struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"%p %p '%pd'\n" , di, dn, dn); +boutc (cl,"%p %p '%s'\n" , di, dn, dn->d_name.name); di->flags |=CEPH_DENTRY_LEASE_LIST ;if (di->flags &CEPH_DENTRY_SHRINK_LIST ) {
@@ -1587,7 +1699,7 @@ void __ceph_dentry_dir_lease_touch(struct ceph_dentry_info *di)struct ceph_mds_client *mdsc =ceph_sb_to_fs_client (dn->d_sb)->mdsc;struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"%p %p '%pd' (offset 0x%llx)\n" , di, dn, dn, di->offset); +boutc (cl,"%p %p '%s' (offset 0x%llx)\n" , di, dn, dn->d_name.name, di->offset);if (!list_empty (&di->lease_list)) {if (di->flags &CEPH_DENTRY_LEASE_LIST ) {
@@ -1886,7 +1998,7 @@ static int dentry_lease_is_valid(struct dentry *dentry, unsigned int flags) CEPH_MDS_LEASE_RENEW, seq);ceph_put_mds_session (session); } -doutc (cl,"dentry %p = %d\n" , dentry, valid); +boutc (cl,"dentry %p = %d\n" , dentry, valid);return valid; }
@@ -1951,9 +2063,9 @@ static int dir_lease_is_valid(struct inode *dir, struct dentry *dentry, valid =0 ;spin_unlock (&dentry->d_lock); } -doutc (cl,"dir %p %llx.%llx v%u dentry %p '%pd' = %d\n" , dir, +boutc (cl,"dir %p %llx.%llx v%u dentry %p '%s' = %d\n" , dir,ceph_vinop (dir), (unsigned )atomic_read (&ci->i_shared_gen), - dentry, dentry, valid); + dentry, dentry->d_name.name, valid);return valid; }
@@ -1974,16 +2086,16 @@ static int ceph_d_revalidate(struct inode *dir, const struct qstr *name, inode =d_inode_rcu (dentry); -doutc (cl,"%p '%pd' inode %p offset 0x%llx nokey %d\n" , - dentry, dentry, inode,ceph_dentry (dentry)->offset, +boutc (cl,"%p '%s' inode %p offset 0x%llx nokey %d\n" , + dentry, dentry->d_name.name, inode,ceph_dentry (dentry)->offset, !!(dentry->d_flags &DCACHE_NOKEY_NAME )); mdsc =ceph_sb_to_fs_client (dir->i_sb)->mdsc;/* always trust cached snapped dentries, snapdir dentry */ if (ceph_snap (dir) !=CEPH_NOSNAP ) { -doutc (cl,"%p '%pd' inode %p is SNAPPED\n" , dentry, - dentry, inode); +boutc (cl,"%p '%s' inode %p is SNAPPED\n" , dentry, + dentry->d_name.name, inode); valid =1 ; }else if (inode &&ceph_snap (inode) ==CEPH_SNAPDIR ) { valid =1 ;
@@ -2040,14 +2152,14 @@ static int ceph_d_revalidate(struct inode *dir, const struct qstr *name,break ; }ceph_mdsc_put_request (req); -doutc (cl,"%p '%pd', lookup result=%d\n" , dentry, - dentry, err); +boutc (cl,"%p '%s', lookup result=%d\n" , dentry, + dentry->d_name.name, err); } }else {percpu_counter_inc (&mdsc->metric.d_lease_hit); } -doutc (cl,"%p '%pd' %s\n" , dentry, dentry, valid ?"valid" :"invalid" ); +boutc (cl,"%p '%s' %s\n" , dentry, dentry->d_name.name, valid ?"valid" :"invalid" );if (!valid)ceph_dir_clear_complete (dir);return valid;
@@ -2086,7 +2198,7 @@ static void ceph_d_release(struct dentry *dentry)struct ceph_dentry_info *di =ceph_dentry (dentry);struct ceph_fs_client *fsc =ceph_sb_to_fs_client (dentry->d_sb); -doutc (fsc->client,"dentry %p '%pd'\n" , dentry, dentry); +doutc (fsc->client,"dentry %p '%s'\n" , dentry, dentry->d_name.name);atomic64_dec (&fsc->mdsc->metric.total_dentries);
@@ -2112,7 +2224,7 @@ static void ceph_d_prune(struct dentry *dentry)struct ceph_inode_info *dir_ci;struct ceph_dentry_info *di; -doutc (cl,"dentry %p '%pd'\n" , dentry, dentry); +doutc (cl,"dentry %p '%s'\n" , dentry, dentry->d_name.name);/* do we have a valid parent? */ if (IS_ROOT (dentry))
fs/ceph/export.c +64 -19
207 lines not on this page · raw message
fs/ceph/inode.c +136 -97
763 lines not on this page · raw message
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 12/15 ceph: convert VFS data I/O paths to bout
In reply to Alex MarkuzeReplace dout()/doutc() with bout()/boutc() in addr.c (readpage, writepage, direct-IO) and file.c (open, read_iter, write_iter, fsync, fallocate).
--- fs/ceph/addr.c | 168 +++++++++++++++++------------- fs/ceph/file.c | 274 +++++++++++++++++++++++++++++++++---------------- 2 files changed, 286 insertions(+), 156 deletions(-)
fs/ceph/addr.c +99 -69
@@ -82,15 +82,20 @@ static inline struct ceph_snap_context *page_snap_context(struct page *page)static bool ceph_dirty_folio (struct address_space *mapping,struct folio *folio) {struct inode *inode = mapping->host; +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_client *cl =ceph_inode_to_client (inode);struct ceph_mds_client *mdsc =ceph_sb_to_mdsc (inode->i_sb);struct ceph_inode_info *ci;struct ceph_snap_context *snapc; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji);if (folio_test_dirty (folio)) { -doutc (cl,"%llx.%llx %p idx %lu -- already dirty\n" , +boutc (cl,"%llx.%llx %p idx %lu -- already dirty\n" ,ceph_vinop (inode), folio, folio->index);VM_BUG_ON_FOLIO (!folio_test_private (folio), folio); +ceph_blog_exit (&__ji);return false; }
@@ -115,7 +120,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)if (ci->i_wrbuffer_ref ==0 )ihold (inode); ++ci->i_wrbuffer_ref; - doutc(cl, "%llx.%llx %p idx %lu head %d/%d -> %d/%d " + boutc(cl, "%llx.%llx %p idx %lu head %d/%d -> %d/%d " "snapc %p seq %lld (%d snaps)\n", ceph_vinop(inode), folio, folio->index, ci->i_wrbuffer_ref-1, ci->i_wrbuffer_ref_head-1,
@@ -130,6 +135,7 @@ static bool ceph_dirty_folio(struct address_space *mapping, struct folio *folio)VM_WARN_ON_FOLIO (folio->private, folio);folio_attach_private (folio, snapc); +ceph_blog_exit (&__ji);return ceph_fscache_dirty_folio (mapping, folio); }
@@ -142,20 +148,25 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset, size_t length) {struct inode *inode = folio->mapping->host; +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_client *cl =ceph_inode_to_client (inode);struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_snap_context *snapc; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji);if (offset !=0 || length !=folio_size (folio)) { -doutc (cl,"%llx.%llx idx %lu partial dirty page %zu~%zu\n" , +boutc (cl,"%llx.%llx idx %lu partial dirty page %zu~%zu\n" ,ceph_vinop (inode), folio->index, offset, length); +ceph_blog_exit (&__ji);return ; }WARN_ON (!folio_test_locked (folio));if (folio_test_private (folio)) { -doutc (cl,"%llx.%llx idx %lu full dirty page\n" , +boutc (cl,"%llx.%llx idx %lu full dirty page\n" ,ceph_vinop (inode), folio->index); snapc =folio_detach_private (folio);
@@ -164,6 +175,7 @@ static void ceph_invalidate_folio(struct folio *folio, size_t offset, }netfs_invalidate_folio (folio, offset, length); +ceph_blog_exit (&__ji); }static void ceph_netfs_expand_readahead (struct netfs_io_request *rreq)
@@ -223,7 +235,7 @@ static void finish_netfs_read(struct ceph_osd_request *req)ceph_update_read_metrics (&fsc->mdsc->metric, req->r_start_latency, req->r_end_latency, osd_data->length, err); -doutc (cl,"result %d subreq->len=%zu i_size=%lld\n" , req->r_result, +boutc (cl,"result %d subreq->len=%zu i_size=%lld\n" , req->r_result, subreq->len,i_size_read (req->r_inode));/* no object means success but no data */
@@ -400,7 +412,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) goto out; } -doutc (cl,"%llx.%llx pos=%llu orig_len=%zu len=%llu\n" , +boutc (cl,"%llx.%llx pos=%llu orig_len=%zu len=%llu\n" ,ceph_vinop (inode), subreq->start, subreq->len, len);/*
@@ -425,7 +437,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) err =iov_iter_get_pages_alloc2 (&subreq->io_iter, &pages, len, &page_off);if (err <0 ) { -doutc (cl,"%llx.%llx failed to allocate pages, %d\n" , +boutc (cl,"%llx.%llx failed to allocate pages, %d\n" ,ceph_vinop (inode), err); goto out; }
@@ -457,7 +469,7 @@ static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq) subreq->error = err;netfs_read_subreq_terminated (subreq); } -doutc (cl,"%llx.%llx result %d\n" ,ceph_vinop (inode), err); +boutc (cl,"%llx.%llx result %d\n" ,ceph_vinop (inode), err); }static int ceph_init_request (struct netfs_io_request *rreq,struct file *file)
@@ -499,12 +511,12 @@ static int ceph_init_request(struct netfs_io_request *rreq, struct file *file)*/ ret =ceph_try_get_caps (inode,CEPH_CAP_FILE_RD , want, true, &got);if (ret <0 ) { -doutc (cl,"%llx.%llx, error getting cap\n" ,ceph_vinop (inode)); +boutc (cl,"%llx.%llx, error getting cap\n" ,ceph_vinop (inode)); goto out; }if (!(got & want)) { -doutc (cl,"%llx.%llx, no cache cap\n" ,ceph_vinop (inode)); +boutc (cl,"%llx.%llx, no cache cap\n" ,ceph_vinop (inode)); ret = -EACCES ; goto out; }
@@ -634,7 +646,7 @@ get_oldest_context(struct inode *inode, struct ceph_writeback_ctl *ctl,spin_lock (&ci->i_ceph_lock);list_for_each_entry (capsnap, &ci->i_cap_snaps, ci_item) { -doutc (cl," capsnap %p snapc %p has %d dirty pages\n" , +boutc (cl," capsnap %p snapc %p has %d dirty pages\n" , capsnap, capsnap->context, capsnap->dirty_pages);if (!capsnap->dirty_pages)continue ;
@@ -667,7 +679,7 @@ get_oldest_context(struct inode *inode, struct ceph_writeback_ctl *ctl, }if (!snapc && ci->i_wrbuffer_ref_head) { snapc =ceph_get_snap_context (ci->i_head_snapc); -doutc (cl," head snapc %p has %d dirty pages\n" , snapc, +boutc (cl," head snapc %p has %d dirty pages\n" , snapc, ci->i_wrbuffer_ref_head);if (ctl) { ctl->i_size =i_size_read (inode);
@@ -738,7 +750,7 @@ static int write_folio_nounlock(struct folio *folio,bool caching =ceph_is_cache_enabled (inode);struct page *bounce_page =NULL ; -doutc (cl,"%llx.%llx folio %p idx %lu\n" ,ceph_vinop (inode), folio, +boutc (cl,"%llx.%llx folio %p idx %lu\n" ,ceph_vinop (inode), folio, folio->index);if (ceph_inode_is_shutdown (inode))
@@ -747,13 +759,13 @@ static int write_folio_nounlock(struct folio *folio,/* verify this is a writeable snap context */ snapc =page_snap_context (&folio->page);if (!snapc) { -doutc (cl,"%llx.%llx folio %p not dirty?\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx folio %p not dirty?\n" ,ceph_vinop (inode), folio);return 0 ; } oldest =get_oldest_context (inode, &ceph_wbc, snapc);if (snapc->seq > oldest->seq) { -doutc (cl,"%llx.%llx folio %p snapc %p not writeable - noop\n" , +boutc (cl,"%llx.%llx folio %p snapc %p not writeable - noop\n" ,ceph_vinop (inode), folio, snapc);/* we should only noop if called by kswapd */ WARN_ON (!(current->flags &PF_MEMALLOC ));
@@ -765,7 +777,7 @@ static int write_folio_nounlock(struct folio *folio,/* is this a partial page at end of file? */ if (page_off >= ceph_wbc.i_size) { -doutc (cl,"%llx.%llx folio at %lu beyond eof %llu\n" , +boutc (cl,"%llx.%llx folio at %lu beyond eof %llu\n" ,ceph_vinop (inode), folio->index, ceph_wbc.i_size);folio_invalidate (folio,0 ,folio_size (folio));return 0 ;
@@ -775,7 +787,7 @@ static int write_folio_nounlock(struct folio *folio, len = ceph_wbc.i_size - page_off; wlen =IS_ENCRYPTED (inode) ?round_up (len,CEPH_FSCRYPT_BLOCK_SIZE ) : len; -doutc (cl,"%llx.%llx folio %p index %lu on %llu~%llu snapc %p seq %lld\n" , +boutc (cl,"%llx.%llx folio %p index %lu on %llu~%llu snapc %p seq %lld\n" ,ceph_vinop (inode), folio, folio->index, page_off, wlen, snapc, snapc->seq);
@@ -818,7 +830,7 @@ static int write_folio_nounlock(struct folio *folio,osd_req_op_extent_osd_data_pages (req,0 , bounce_page ? &bounce_page : &page, wlen,0 , false, false); -doutc (cl,"%llx.%llx %llu~%llu (%llu bytes, %sencrypted)\n" , +boutc (cl,"%llx.%llx %llu~%llu (%llu bytes, %sencrypted)\n" ,ceph_vinop (inode), page_off, len, wlen,IS_ENCRYPTED (inode) ?"" :"not " );
@@ -843,7 +855,7 @@ static int write_folio_nounlock(struct folio *folio, wbc = &tmp_wbc;if (err == -ERESTARTSYS ) {/* killed by SIGKILL */ -doutc (cl,"%llx.%llx interrupted page %p\n" , +boutc (cl,"%llx.%llx interrupted page %p\n" ,ceph_vinop (inode), folio);folio_redirty_for_writepage (wbc, folio);folio_end_writeback (folio);
@@ -851,12 +863,12 @@ static int write_folio_nounlock(struct folio *folio, }if (err == -EBLOCKLISTED ) fsc->blocklisted = true; -doutc (cl,"%llx.%llx setting mapping error %d %p\n" , +boutc (cl,"%llx.%llx setting mapping error %d %p\n" ,ceph_vinop (inode), err, folio);mapping_set_error (&inode->i_data, err); wbc->pages_skipped++; }else { -doutc (cl,"%llx.%llx cleaned page %p\n" , +boutc (cl,"%llx.%llx cleaned page %p\n" ,ceph_vinop (inode), folio); err =0 ;/* vfs expects us to return 0 */ }
@@ -896,7 +908,7 @@ static void writepages_finish(struct ceph_osd_request *req)unsigned int len =0 ;bool remove_page; -doutc (cl,"%llx.%llx rc %d\n" ,ceph_vinop (inode), rc); +boutc (cl,"%llx.%llx rc %d\n" ,ceph_vinop (inode), rc);if (rc <0 ) {mapping_set_error (mapping, rc);ceph_set_error_write (ci);
@@ -954,7 +966,7 @@ static void writepages_finish(struct ceph_osd_request *req)WARN_ON (atomic64_read (&mdsc->dirty_folios) <0 ); } -doutc (cl,"unlocking %p\n" , page); +boutc (cl,"unlocking %p\n" , page);if (remove_page) generic_error_remove_folio(inode->i_mapping,
@@ -962,7 +974,7 @@ static void writepages_finish(struct ceph_osd_request *req)unlock_page (page); } -doutc (cl,"%llx.%llx wrote %llu bytes cleaned %d pages\n" , +boutc (cl,"%llx.%llx wrote %llu bytes cleaned %d pages\n" ,ceph_vinop (inode), osd_data->length, rc >=0 ? num_pages :0 );
@@ -1088,11 +1100,11 @@ int ceph_define_writeback_range(struct address_space *mapping,if (!ceph_wbc->snapc) {/* hmm, why does writepages get called when there is no dirty data? */ -doutc (cl," no snap context with dirty data?\n" ); +boutc (cl," no snap context with dirty data?\n" );return -ENODATA ; } -doutc (cl," oldest snapc is %p seq %lld (%d snaps)\n" , +boutc (cl," oldest snapc is %p seq %lld (%d snaps)\n" , ceph_wbc->snapc, ceph_wbc->snapc->seq, ceph_wbc->snapc->num_snaps);
@@ -1105,13 +1117,13 @@ int ceph_define_writeback_range(struct address_space *mapping, ceph_wbc->end =-1 ;if (ceph_wbc->index >0 ) ceph_wbc->should_loop = true; -doutc (cl," cyclic, start at %lu\n" , ceph_wbc->index); +boutc (cl," cyclic, start at %lu\n" , ceph_wbc->index); }else { ceph_wbc->index = wbc->range_start >>PAGE_SHIFT ; ceph_wbc->end = wbc->range_end >>PAGE_SHIFT ;if (wbc->range_start ==0 && wbc->range_end ==LLONG_MAX ) ceph_wbc->range_whole = true; -doutc (cl," not cyclic, %lu to %lu\n" , +boutc (cl," not cyclic, %lu to %lu\n" , ceph_wbc->index, ceph_wbc->end); } }else if (!ceph_wbc->head_snapc) {
@@ -1121,7 +1133,7 @@ int ceph_define_writeback_range(struct address_space *mapping,* associated with 'snapc' get written */ if (ceph_wbc->index >0 ) ceph_wbc->should_loop = true; -doutc (cl," non-head snapc, range whole\n" ); +boutc (cl," non-head snapc, range whole\n" ); }ceph_put_snap_context (ceph_wbc->last_snapc);
@@ -1157,14 +1169,14 @@ int ceph_check_page_before_write(struct address_space *mapping,/* only dirty folios, or our accounting breaks */ if (unlikely (!folio_test_dirty (folio) || folio->mapping != mapping)) { -doutc (cl,"!dirty or !mapping %p\n" , folio); +boutc (cl,"!dirty or !mapping %p\n" , folio);return -ENODATA ; }/* only if matching snap context */ pgsnapc =page_snap_context (&folio->page);if (pgsnapc != ceph_wbc->snapc) { -doutc (cl,"folio snapc %p %lld != oldest %p %lld\n" , +boutc (cl,"folio snapc %p %lld != oldest %p %lld\n" , pgsnapc, pgsnapc->seq, ceph_wbc->snapc, ceph_wbc->snapc->seq);
@@ -1176,7 +1188,7 @@ int ceph_check_page_before_write(struct address_space *mapping, }if (folio_pos (folio) >= ceph_wbc->i_size) { -doutc (cl,"folio at %lu beyond eof %llu\n" , +boutc (cl,"folio at %lu beyond eof %llu\n" , folio->index, ceph_wbc->i_size); if ((ceph_wbc->size_stable ||
@@ -1189,7 +1201,7 @@ int ceph_check_page_before_write(struct address_space *mapping,if (ceph_wbc->strip_unit_end && (folio->index > ceph_wbc->strip_unit_end)) { -doutc (cl,"end of strip unit %p\n" , folio); +boutc (cl,"end of strip unit %p\n" , folio);return -E2BIG ; }
@@ -1313,7 +1325,7 @@ void ceph_process_folio_batch(struct address_space *mapping,if (!folio)continue ; - doutc(cl, "? %p idx %lu, folio_test_writeback %#x, " + boutc(cl, "? %p idx %lu, folio_test_writeback %#x, " "folio_test_dirty %#x, folio_test_locked %#x\n", folio, folio->index, folio_test_writeback(folio), folio_test_dirty(folio),
@@ -1321,7 +1333,7 @@ void ceph_process_folio_batch(struct address_space *mapping,if (folio_test_writeback (folio) ||folio_test_private_2 (folio)/* [DEPRECATED] */ ) { -doutc (cl,"waiting on writeback %p\n" , folio); +boutc (cl,"waiting on writeback %p\n" , folio);folio_wait_writeback (folio);folio_wait_private_2 (folio);/* [DEPRECATED] */ continue ;
@@ -1345,7 +1357,7 @@ void ceph_process_folio_batch(struct address_space *mapping, }if (!folio_clear_dirty_for_io (folio)) { -doutc (cl,"%p !folio_clear_dirty_for_io\n" , folio); +boutc (cl,"%p !folio_clear_dirty_for_io\n" , folio);folio_unlock (folio);folio_put (folio); ceph_wbc->fbatch.folios[i] =NULL ;
@@ -1373,7 +1385,7 @@ void ceph_process_folio_batch(struct address_space *mapping, }/* note position of first page in fbatch */ -doutc (cl,"%llx.%llx will write folio %p idx %lu\n" , +boutc (cl,"%llx.%llx will write folio %p idx %lu\n" ,ceph_vinop (inode), folio, folio->index); fsc->write_congested =is_write_congestion_happened (fsc);
@@ -1517,7 +1529,7 @@ int ceph_submit_write(struct address_space *mapping,osd_req_op_extent_dup_last (req, ceph_wbc->op_idx, cur_offset - offset); -doutc (cl,"got pages at %llu~%llu\n" , offset, len); +boutc (cl,"got pages at %llu~%llu\n" , offset, len); osd_req_op_extent_osd_data_pages(req, ceph_wbc->op_idx, ceph_wbc->data_pages,
@@ -1558,7 +1570,7 @@ int ceph_submit_write(struct address_space *mapping,if (IS_ENCRYPTED (inode)) len =round_up (len,CEPH_FSCRYPT_BLOCK_SIZE ); -doutc (cl,"got pages at %llu~%llu\n" , offset, len); +boutc (cl,"got pages at %llu~%llu\n" , offset, len);if (IS_ENCRYPTED (inode) && ((offset | len) & ~CEPH_FSCRYPT_BLOCK_MASK )) {
@@ -1647,16 +1659,21 @@ static int ceph_writepages_start(struct address_space *mapping,struct ceph_client *cl = fsc->client;struct ceph_writeback_ctl ceph_wbc;int rc =0 ; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); -if (wbc->sync_mode ==WB_SYNC_NONE && fsc->write_congested) +if (wbc->sync_mode ==WB_SYNC_NONE && fsc->write_congested) { +ceph_blog_exit (&__ji);return 0 ; + } -doutc (cl,"%llx.%llx (mode=%s)\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx (mode=%s)\n" ,ceph_vinop (inode), wbc->sync_mode ==WB_SYNC_NONE ?"NONE" : (wbc->sync_mode ==WB_SYNC_ALL ?"ALL" :"HOLD" ));if (is_forced_umount (mapping)) { -/* we're in a forced umount, don't write! */ +ceph_blog_exit (&__ji);return -EIO ; }
@@ -1693,7 +1710,7 @@ static int ceph_writepages_start(struct address_space *mapping, ceph_wbc.end, ceph_wbc.tag, &ceph_wbc.fbatch); -doutc (cl,"pagevec_lookup_range_tag for tag %#x got %d\n" , +boutc (cl,"pagevec_lookup_range_tag for tag %#x got %d\n" , ceph_wbc.tag, ceph_wbc.nr_folios);if (!ceph_wbc.nr_folios && !ceph_wbc.locked_pages)
@@ -1710,7 +1727,7 @@ static int ceph_writepages_start(struct address_space *mapping,if (ceph_wbc.processed_in_fbatch) {if (folio_batch_count (&ceph_wbc.fbatch) ==0 && ceph_wbc.locked_pages < ceph_wbc.max_pages) { -doutc (cl,"reached end fbatch, trying for more\n" ); +boutc (cl,"reached end fbatch, trying for more\n" ); goto get_more_pages; } }
@@ -1738,7 +1755,7 @@ static int ceph_writepages_start(struct address_space *mapping, ceph_wbc.done = true; release_folios: -doutc (cl,"folio_batch release on %d folios (%p)\n" , +boutc (cl,"folio_batch release on %d folios (%p)\n" , (int )ceph_wbc.fbatch.nr, ceph_wbc.fbatch.nr ? ceph_wbc.fbatch.folios[0 ] :NULL );folio_batch_release (&ceph_wbc.fbatch);
@@ -1746,7 +1763,7 @@ static int ceph_writepages_start(struct address_space *mapping,if (ceph_wbc.should_loop && !ceph_wbc.done) {/* more to do; loop back to beginning of file */ -doutc (cl,"looping back to beginning of file\n" ); +boutc (cl,"looping back to beginning of file\n" );/* OK even when start_index == 0 */ ceph_wbc.end = ceph_wbc.start_index -1 ;
@@ -1767,9 +1784,10 @@ static int ceph_writepages_start(struct address_space *mapping, out:ceph_put_snap_context (ceph_wbc.last_snapc); -doutc (cl,"%llx.%llx dend - startone, rc = %d\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx dend - startone, rc = %d\n" ,ceph_vinop (inode), rc); +ceph_blog_exit (&__ji);return rc; }
@@ -1805,7 +1823,7 @@ ceph_find_incompatible(struct folio *folio)struct ceph_inode_info *ci =ceph_inode (inode);if (ceph_inode_is_shutdown (inode)) { -doutc (cl," %llx.%llx folio %p is shutdown\n" , +boutc (cl," %llx.%llx folio %p is shutdown\n" ,ceph_vinop (inode), folio);return ERR_PTR (-ESTALE ); }
@@ -1827,14 +1845,14 @@ ceph_find_incompatible(struct folio *folio)if (snapc->seq > oldest->seq) {/* not writeable -- return it for the caller to deal with */ ceph_put_snap_context (oldest); -doutc (cl," %llx.%llx folio %p snapc %p not current or oldest\n" , +boutc (cl," %llx.%llx folio %p snapc %p not current or oldest\n" ,ceph_vinop (inode), folio, snapc);return ceph_get_snap_context (snapc); }ceph_put_snap_context (oldest);/* yay, writeable, do it now (without dropping folio lock) */ -doutc (cl," %llx.%llx folio %p snapc %p not current, but oldest\n" , +boutc (cl," %llx.%llx folio %p snapc %p not current, but oldest\n" ,ceph_vinop (inode), folio, snapc);if (folio_clear_dirty_for_io (folio)) {int r =write_folio_nounlock (folio,NULL );
@@ -1882,15 +1900,22 @@ static int ceph_write_begin(const struct kiocb *iocb, {struct file *file = iocb->ki_filp;struct inode *inode =file_inode (file); +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_inode_info *ci =ceph_inode (inode);int r; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); r =netfs_write_begin (&ci->netfs, file, inode->i_mapping, pos, len, foliop,NULL ); -if (r <0 ) +if (r <0 ) { +ceph_blog_exit (&__ji);return r; + }folio_wait_private_2 (*foliop);/* [DEPRECATED] */ WARN_ON_ONCE (!folio_test_locked (*foliop)); +ceph_blog_exit (&__ji);return 0 ; }
@@ -1905,10 +1930,14 @@ static int ceph_write_end(const struct kiocb *iocb, {struct file *file = iocb->ki_filp;struct inode *inode =file_inode (file); +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_client *cl =ceph_inode_to_client (inode);bool check_cap = false; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); -doutc (cl,"%llx.%llx file %p folio %p %d~%d (%d)\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx file %p folio %p %d~%d (%d)\n" ,ceph_vinop (inode), file, folio, (int )pos, (int )copied, (int )len);if (!folio_test_uptodate (folio)) {
@@ -1933,6 +1962,7 @@ static int ceph_write_end(const struct kiocb *iocb,if (check_cap)ceph_check_caps (ceph_inode (inode),CHECK_CAPS_AUTHONLY ); +ceph_blog_exit (&__ji);return copied; }
@@ -1981,7 +2011,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)ceph_block_sigs (&oldset); -doutc (cl,"%llx.%llx %llu trying to get caps\n" , +boutc (cl,"%llx.%llx %llu trying to get caps\n" ,ceph_vinop (inode), off);if (fi->fmode &CEPH_FILE_MODE_LAZY ) want =CEPH_CAP_FILE_CACHE |CEPH_CAP_FILE_LAZYIO ;
@@ -1993,7 +2023,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)if (err <0 ) goto out_restore; -doutc (cl,"%llx.%llx %llu got cap refs on %s\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx %llu got cap refs on %s\n" ,ceph_vinop (inode), off,ceph_cap_string (got)); if ((got & (CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO)) ||
@@ -2002,7 +2032,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)ceph_add_rw_context (fi, &rw_ctx); ret =filemap_fault (vmf);ceph_del_rw_context (fi, &rw_ctx); -doutc (cl,"%llx.%llx %llu drop cap refs %s ret %x\n" , +boutc (cl,"%llx.%llx %llu drop cap refs %s ret %x\n" ,ceph_vinop (inode), off,ceph_cap_string (got), ret); }else err = -EAGAIN ;
@@ -2044,7 +2074,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf) ret =VM_FAULT_MAJOR |VM_FAULT_LOCKED ; out_inline:filemap_invalidate_unlock_shared (mapping); -doutc (cl,"%llx.%llx %llu read inline data ret %x\n" , +boutc (cl,"%llx.%llx %llu read inline data ret %x\n" ,ceph_vinop (inode), off, ret); } out_restore:
@@ -2086,7 +2116,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)else len =offset_in_folio (folio, size); -doutc (cl,"%llx.%llx %llu~%zd getting caps i_size %llu\n" , +boutc (cl,"%llx.%llx %llu~%zd getting caps i_size %llu\n" ,ceph_vinop (inode), off, len, size);if (fi->fmode &CEPH_FILE_MODE_LAZY ) want =CEPH_CAP_FILE_BUFFER |CEPH_CAP_FILE_LAZYIO ;
@@ -2098,7 +2128,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)if (err <0 ) goto out_free; -doutc (cl,"%llx.%llx %llu~%zd got cap refs on %s\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx %llu~%zd got cap refs on %s\n" ,ceph_vinop (inode), off, len,ceph_cap_string (got));/* Update time before taking folio lock */
@@ -2147,7 +2177,7 @@ static vm_fault_t ceph_page_mkwrite(struct vm_fault *vmf)__mark_inode_dirty (inode, dirty); } -doutc (cl,"%llx.%llx %llu~%zd dropping cap refs on %s ret %x\n" , +boutc (cl,"%llx.%llx %llu~%zd dropping cap refs on %s ret %x\n" ,ceph_vinop (inode), off, len,ceph_cap_string (got), ret);ceph_put_cap_refs_async (ci, got); out_free:
@@ -2183,7 +2213,7 @@ void ceph_fill_inline_data(struct inode *inode, struct page *locked_page, } } -doutc (cl,"%p %llx.%llx len %zu locked_page %p\n" , inode, +boutc (cl,"%p %llx.%llx len %zu locked_page %p\n" , inode,ceph_vinop (inode), len, locked_page);if (len >0 ) {
@@ -2225,7 +2255,7 @@ int ceph_uninline_data(struct file *file) inline_version = ci->i_inline_version;spin_unlock (&ci->i_ceph_lock); -doutc (cl,"%llx.%llx inline_version %llu\n" ,ceph_vinop (inode), +boutc (cl,"%llx.%llx inline_version %llu\n" ,ceph_vinop (inode), inline_version);if (ceph_inode_is_shutdown (inode)) {
@@ -2422,10 +2452,10 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci, goto out;if (pool_ns) -doutc (cl,"pool %lld ns %.*s no perm cached\n" , pool, - (int )pool_ns->len, pool_ns->str); +boutc (cl,"pool %lld ns %.*s no perm cached\n" , pool, + (int )pool_ns->len, (const char *)pool_ns->str);else -doutc (cl,"pool %lld no perm cached\n" , pool); +boutc (cl,"pool %lld no perm cached\n" , pool);down_write (&mdsc->pool_perm_rwsem); p = &mdsc->pool_perm_tree.rb_node;
@@ -2550,10 +2580,10 @@ static int __ceph_pool_perm_get(struct ceph_inode_info *ci,if (!err) err = have;if (pool_ns) -doutc (cl,"pool %lld ns %.*s result = %d\n" , pool, - (int )pool_ns->len, pool_ns->str, err); +boutc (cl,"pool %lld ns %.*s result = %d\n" , pool, + (int )pool_ns->len, (const char *)pool_ns->str, err);else -doutc (cl,"pool %lld result = %d\n" , pool, err); +boutc (cl,"pool %lld result = %d\n" , pool, err);return err; }
@@ -2590,11 +2620,11 @@ int ceph_pool_perm_check(struct inode *inode, int need) check:if (flags &CEPH_I_POOL_PERM ) {if ((need &CEPH_CAP_FILE_RD ) && !(flags &CEPH_I_POOL_RD )) { -doutc (cl,"pool %lld no read perm\n" , pool); +boutc (cl,"pool %lld no read perm\n" , pool);return -EPERM ; }if ((need &CEPH_CAP_FILE_WR ) && !(flags &CEPH_I_POOL_WR )) { -doutc (cl,"pool %lld no write perm\n" , pool); +boutc (cl,"pool %lld no write perm\n" , pool);return -EPERM ; }return 0 ;
fs/ceph/file.c +187 -87
851 lines not on this page · raw message
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 13/15 ceph: convert capability and snapshot paths to bout
In reply to Alex MarkuzeReplace dout()/doutc() with bout()/boutc() in caps.c (cap grant, release, flush, revoke) and snap.c (snap handling, cap snap queue).
--- fs/ceph/caps.c | 252 ++++++++++++++++++++++++++----------------------- fs/ceph/snap.c | 66 ++++++------- 2 files changed, 165 insertions(+), 153 deletions(-)
fs/ceph/caps.c +132 -120
@@ -188,7 +188,7 @@ static void __ceph_unreserve_caps(struct ceph_mds_client *mdsc, int nr_caps) mdsc->caps_avail_count += nr_caps; } -doutc (mdsc->fsc->client, +boutc (mdsc->fsc->client,"caps %d = %d used + %d resv + %d avail\n" , mdsc->caps_total_count, mdsc->caps_use_count, mdsc->caps_reserve_count, mdsc->caps_avail_count);
@@ -215,7 +215,7 @@ int ceph_reserve_caps(struct ceph_mds_client *mdsc,struct ceph_mds_session *s;LIST_HEAD (newcaps); -doutc (cl,"ctx=%p need=%d\n" , ctx, need); +boutc (cl,"ctx=%p need=%d\n" , ctx, need);/* first reserve any caps that are already allocated */ spin_lock (&mdsc->caps_list_lock);
@@ -301,7 +301,7 @@ int ceph_reserve_caps(struct ceph_mds_client *mdsc,spin_unlock (&mdsc->caps_list_lock); -doutc (cl,"ctx=%p %d = %d used + %d resv + %d avail\n" , ctx, +boutc (cl,"ctx=%p %d = %d used + %d resv + %d avail\n" , ctx, mdsc->caps_total_count, mdsc->caps_use_count, mdsc->caps_reserve_count, mdsc->caps_avail_count);return err;
@@ -315,7 +315,7 @@ void ceph_unreserve_caps(struct ceph_mds_client *mdsc,if (!ctx->count)return ; -doutc (cl,"ctx=%p count=%d\n" , ctx, ctx->count); +boutc (cl,"ctx=%p count=%d\n" , ctx, ctx->count);spin_lock (&mdsc->caps_list_lock);__ceph_unreserve_caps (mdsc, ctx->count); ctx->count =0 ;
@@ -364,7 +364,7 @@ struct ceph_cap *ceph_get_cap(struct ceph_mds_client *mdsc, }spin_lock (&mdsc->caps_list_lock); -doutc (cl,"ctx=%p (%d) %d = %d used + %d resv + %d avail\n" , ctx, +boutc (cl,"ctx=%p (%d) %d = %d used + %d resv + %d avail\n" , ctx, ctx->count, mdsc->caps_total_count, mdsc->caps_use_count, mdsc->caps_reserve_count, mdsc->caps_avail_count);BUG_ON (!ctx->count);
@@ -390,7 +390,7 @@ void ceph_put_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap)struct ceph_client *cl = mdsc->fsc->client;spin_lock (&mdsc->caps_list_lock); -doutc (cl,"%p %d = %d used + %d resv + %d avail\n" , cap, +boutc (cl,"%p %d = %d used + %d resv + %d avail\n" , cap, mdsc->caps_total_count, mdsc->caps_use_count, mdsc->caps_reserve_count, mdsc->caps_avail_count); mdsc->caps_use_count--;
@@ -503,7 +503,7 @@ static void __cap_set_timeouts(struct ceph_mds_client *mdsc, ci->i_hold_caps_max =round_jiffies (jiffies + opt->caps_wanted_delay_max *HZ ); -doutc (mdsc->fsc->client,"%p %llx.%llx %lu\n" , inode, +boutc (mdsc->fsc->client,"%p %llx.%llx %lu\n" , inode,ceph_vinop (inode), ci->i_hold_caps_max - jiffies); }
@@ -520,7 +520,7 @@ static void __cap_delay_requeue(struct ceph_mds_client *mdsc, {struct inode *inode = &ci->netfs.inode; -doutc (mdsc->fsc->client,"%p %llx.%llx flags 0x%lx at %lu\n" , +boutc (mdsc->fsc->client,"%p %llx.%llx flags 0x%lx at %lu\n" , inode,ceph_vinop (inode), ci->i_ceph_flags, ci->i_hold_caps_max);if (!mdsc->stopping) {
@@ -547,7 +547,7 @@ static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, {struct inode *inode = &ci->netfs.inode; -doutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode,ceph_vinop (inode)); +boutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode,ceph_vinop (inode));spin_lock (&mdsc->cap_delay_lock);set_bit (CEPH_I_FLUSH_BIT , &ci->i_ceph_flags);if (!list_empty (&ci->i_cap_delay_list))
@@ -566,7 +566,7 @@ static void __cap_delay_cancel(struct ceph_mds_client *mdsc, {struct inode *inode = &ci->netfs.inode; -doutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode,ceph_vinop (inode)); +boutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode,ceph_vinop (inode));if (list_empty (&ci->i_cap_delay_list))return ;spin_lock (&mdsc->cap_delay_lock);
@@ -605,7 +605,7 @@ static void __check_cap_issue(struct ceph_inode_info *ci, struct ceph_cap *cap,if (issued &CEPH_CAP_FILE_SHARED )atomic_inc (&ci->i_shared_gen);if (S_ISDIR (ci->netfs.inode.i_mode)) { -doutc (cl," marking %p NOT complete\n" , inode); +boutc (cl," marking %p NOT complete\n" , inode);__ceph_dir_clear_complete (ci); } }
@@ -664,7 +664,7 @@ void ceph_add_cap(struct inode *inode,lockdep_assert_held (&ci->i_ceph_lock); -doutc (cl,"%p %llx.%llx mds%d cap %llx %s seq %d\n" , inode, +boutc (cl,"%p %llx.%llx mds%d cap %llx %s seq %d\n" , inode,ceph_vinop (inode), session->s_mds, cap_id,ceph_cap_string (issued), seq);
@@ -744,7 +744,7 @@ void ceph_add_cap(struct inode *inode, actual_wanted =__ceph_caps_wanted (ci);if ((wanted & ~actual_wanted) || (issued & ~actual_wanted &CEPH_CAP_ANY_WR )) { -doutc (cl,"issued %s, mds wanted %s, actual %s, queueing\n" , +boutc (cl,"issued %s, mds wanted %s, actual %s, queueing\n" ,ceph_cap_string (issued),ceph_cap_string (wanted),ceph_cap_string (actual_wanted));__cap_delay_requeue (mdsc, ci);
@@ -763,7 +763,7 @@ void ceph_add_cap(struct inode *inode,WARN_ON (ci->i_auth_cap == cap); } -doutc (cl,"inode %p %llx.%llx cap %p %s now %s seq %d mds%d\n" , +boutc (cl,"inode %p %llx.%llx cap %p %s now %s seq %d mds%d\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (issued),ceph_cap_string (issued|cap->issued), seq, mds); cap->cap_id = cap_id;
@@ -796,7 +796,7 @@ static int __cap_is_valid(struct ceph_cap *cap) ttl = cap->session->s_cap_ttl;if (cap->cap_gen < gen ||time_after_eq (jiffies, ttl)) { -doutc (cl,"%p %llx.%llx cap %p issued %s but STALE (gen %u vs %u)\n" , +boutc (cl,"%p %llx.%llx cap %p issued %s but STALE (gen %u vs %u)\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (cap->issued), cap->cap_gen, gen);return 0 ;
@@ -824,7 +824,7 @@ int __ceph_caps_issued(struct ceph_inode_info *ci, int *implemented) cap = rb_entry(p, struct ceph_cap, ci_node);if (!__cap_is_valid (cap))continue ; -doutc (cl,"%p %llx.%llx cap %p issued %s\n" , inode, +boutc (cl,"%p %llx.%llx cap %p issued %s\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (cap->issued)); have |= cap->issued;if (implemented)
@@ -874,11 +874,11 @@ static void __touch_cap(struct ceph_cap *cap)spin_lock (&s->s_cap_lock);if (!s->s_cap_iterator) { -doutc (cl,"%p %llx.%llx cap %p mds%d\n" , inode, +boutc (cl,"%p %llx.%llx cap %p mds%d\n" , inode,ceph_vinop (inode), cap, s->s_mds);list_move_tail (&cap->session_caps, &s->s_caps); }else { -doutc (cl,"%p %llx.%llx cap %p mds%d NOP, iterating over caps\n" , +boutc (cl,"%p %llx.%llx cap %p mds%d NOP, iterating over caps\n" , inode,ceph_vinop (inode), cap, s->s_mds); }spin_unlock (&s->s_cap_lock);
@@ -898,7 +898,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)int have = ci->i_snap_caps;if ((have & mask) == mask) { -doutc (cl,"mask %p %llx.%llx snap issued %s (mask %s)\n" , +boutc (cl,"mask %p %llx.%llx snap issued %s (mask %s)\n" , inode,ceph_vinop (inode),ceph_cap_string (have),ceph_cap_string (mask));return 1 ;
@@ -909,7 +909,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)if (!__cap_is_valid (cap))continue ;if ((cap->issued & mask) == mask) { -doutc (cl,"mask %p %llx.%llx cap %p issued %s (mask %s)\n" , +boutc (cl,"mask %p %llx.%llx cap %p issued %s (mask %s)\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (cap->issued),ceph_cap_string (mask));
@@ -921,7 +921,7 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)/* does a combination of caps satisfy mask? */ have |= cap->issued;if ((have & mask) == mask) { -doutc (cl,"mask %p %llx.%llx combo issued %s (mask %s)\n" , +boutc (cl,"mask %p %llx.%llx combo issued %s (mask %s)\n" , inode,ceph_vinop (inode),ceph_cap_string (cap->issued),ceph_cap_string (mask));
@@ -1130,13 +1130,13 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)/* 'ci' being NULL means the remove have already occurred */ if (!ci) { -doutc (cl,"inode is NULL\n" ); +boutc (cl,"inode is NULL\n" );return ; }lockdep_assert_held (&ci->i_ceph_lock); -doutc (cl,"%p from %p %llx.%llx\n" , cap, inode,ceph_vinop (inode)); +boutc (cl,"%p from %p %llx.%llx\n" , cap, inode,ceph_vinop (inode)); mdsc =ceph_inode_to_fs_client (&ci->netfs.inode)->mdsc;
@@ -1149,7 +1149,7 @@ void __ceph_remove_cap(struct ceph_cap *cap, bool queue_release)spin_lock (&session->s_cap_lock);if (session->s_cap_iterator == cap) {/* not yet, we are iterating over this very cap */ -doutc (cl,"delaying %p removal from session %p\n" , cap, +boutc (cl,"delaying %p removal from session %p\n" , cap, cap->session); }else {list_del_init (&cap->session_caps);
@@ -1203,7 +1203,7 @@ void ceph_remove_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap,/* 'ci' being NULL means the remove have already occurred */ if (!ci) { -doutc (mdsc->fsc->client,"inode is NULL\n" ); +boutc (mdsc->fsc->client,"inode is NULL\n" );return ; }
@@ -1248,7 +1248,7 @@ static void encode_cap_msg(struct ceph_msg *msg, struct cap_msg_args *arg)struct ceph_mds_client *mdsc = arg->session->s_mdsc;struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc; - doutc(mdsc->fsc->client, + boutc(mdsc->fsc->client, "%s %llx %llx caps %s wanted %s dirty %s seq %u/%u" " tid %llu/%llu mseq %u follows %lld size %llu/%llu" " xattr_ver %llu xattr_len %d\n",
@@ -1403,7 +1403,7 @@ static void __prep_cap(struct cap_msg_args *arg, struct ceph_cap *cap, revoking = cap->implemented & ~cap->issued; retain &= ~revoking; -doutc (cl,"%p %llx.%llx cap %p session %p %s -> %s (revoking %s)\n" , +boutc (cl,"%p %llx.%llx cap %p session %p %s -> %s (revoking %s)\n" , inode,ceph_vinop (inode), cap, cap->session,ceph_cap_string (held),ceph_cap_string (held & retain),ceph_cap_string (revoking));
@@ -1626,7 +1626,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,u64 oldest_flush_tid =0 ;u64 first_tid =1 , last_tid =0 ; -doutc (cl,"%p %llx.%llx session %p\n" , inode,ceph_vinop (inode), +boutc (cl,"%p %llx.%llx session %p\n" , inode,ceph_vinop (inode), session);list_for_each_entry (capsnap, &ci->i_cap_snaps, ci_item) {
@@ -1642,7 +1642,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,/* only flush each capsnap once */ if (capsnap->cap_flush.tid >0 ) { -doutc (cl,"already flushed %p, skipping\n" , capsnap); +boutc (cl,"already flushed %p, skipping\n" , capsnap);continue ; }
@@ -1675,7 +1675,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,int ret;if (!(cap && cap->session == session)) { -doutc (cl,"%p %llx.%llx auth cap %p not mds%d, stop\n" , +boutc (cl,"%p %llx.%llx auth cap %p not mds%d, stop\n" , inode,ceph_vinop (inode), cap, session->s_mds);break ; }
@@ -1697,7 +1697,7 @@ static void __ceph_flush_snaps(struct ceph_inode_info *ci,refcount_inc (&capsnap->nref);spin_unlock (&ci->i_ceph_lock); -doutc (cl,"%p %llx.%llx capsnap %p tid %llu %s\n" , inode, +boutc (cl,"%p %llx.%llx capsnap %p tid %llu %s\n" , inode,ceph_vinop (inode), capsnap, cf->tid,ceph_cap_string (capsnap->dirty));
@@ -1725,23 +1725,23 @@ void ceph_flush_snaps(struct ceph_inode_info *ci,bool need_put = false;int mds; -doutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode)); +boutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode));if (psession) session = *psession; retry:spin_lock (&ci->i_ceph_lock);if (!(ci->i_ceph_flags &CEPH_I_FLUSH_SNAPS )) { -doutc (cl," no capsnap needs flush, doing nothing\n" ); +boutc (cl," no capsnap needs flush, doing nothing\n" ); goto out; }if (!ci->i_auth_cap) { -doutc (cl," no auth cap (migrating?), doing nothing\n" ); +boutc (cl," no auth cap (migrating?), doing nothing\n" ); goto out; } mds = ci->i_auth_cap->session->s_mds;if (session && session->s_mds != mds) { -doutc (cl," oops, wrong session %p mutex\n" , session); +boutc (cl," oops, wrong session %p mutex\n" , session);ceph_put_mds_session (session); session =NULL ; }
@@ -1801,7 +1801,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask,return 0 ; } -doutc (cl,"%p %llx.%llx %s dirty %s -> %s\n" , inode, +boutc (cl,"%p %llx.%llx %s dirty %s -> %s\n" , inode,ceph_vinop (inode),ceph_cap_string (mask),ceph_cap_string (was),ceph_cap_string (was | mask)); ci->i_dirty_caps |= mask;
@@ -1816,7 +1816,7 @@ int __ceph_mark_dirty_caps(struct ceph_inode_info *ci, int mask, ci->i_head_snapc =ceph_get_snap_context ( ci->i_snap_realm->cached_context); } -doutc (cl,"%p %llx.%llx now dirty snapc %p auth cap %p\n" , +boutc (cl,"%p %llx.%llx now dirty snapc %p auth cap %p\n" , inode,ceph_vinop (inode), ci->i_head_snapc, ci->i_auth_cap);BUG_ON (!list_empty (&ci->i_dirty_item));
@@ -1924,13 +1924,13 @@ static u64 __mark_caps_flushing(struct inode *inode,BUG_ON (!ci->i_prealloc_cap_flush); flushing = ci->i_dirty_caps; -doutc (cl,"flushing %s, flushing_caps %s -> %s\n" , +boutc (cl,"flushing %s, flushing_caps %s -> %s\n" ,ceph_cap_string (flushing),ceph_cap_string (ci->i_flushing_caps),ceph_cap_string (ci->i_flushing_caps | flushing)); ci->i_flushing_caps |= flushing; ci->i_dirty_caps =0 ; -doutc (cl,"%p %llx.%llx now !dirty\n" , inode,ceph_vinop (inode)); +boutc (cl,"%p %llx.%llx now !dirty\n" , inode,ceph_vinop (inode));swap (cf, ci->i_prealloc_cap_flush); cf->ci = ci;
@@ -1974,13 +1974,13 @@ static int try_nonblocking_invalidate(struct inode *inode)if (inode->i_data.nrpages ==0 && invalidating_gen == ci->i_rdcache_gen) {/* success. */ -doutc (cl,"%p %llx.%llx success\n" , inode, +boutc (cl,"%p %llx.%llx success\n" , inode,ceph_vinop (inode));/* save any racing async invalidate some trouble */ ci->i_rdcache_revoking = ci->i_rdcache_gen -1 ;return 0 ; } -doutc (cl,"%p %llx.%llx failed\n" , inode,ceph_vinop (inode)); +boutc (cl,"%p %llx.%llx failed\n" , inode,ceph_vinop (inode));return -1 ; }
@@ -2089,7 +2089,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) } } - doutc(cl, "%p %llx.%llx file_want %s used %s dirty %s " + boutc(cl, "%p %llx.%llx file_want %s used %s dirty %s " "flushing %s issued %s revoking %s retain %s %s%s%s%s\n", inode, ceph_vinop(inode), ceph_cap_string(file_wanted), ceph_cap_string(used), ceph_cap_string(ci->i_dirty_caps),
@@ -2113,10 +2113,10 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) (revoking & (CEPH_CAP_FILE_CACHE| CEPH_CAP_FILE_LAZYIO)) && /* or revoking cache */ !tried_invalidate) { -doutc (cl,"trying to invalidate on %p %llx.%llx\n" , +boutc (cl,"trying to invalidate on %p %llx.%llx\n" , inode,ceph_vinop (inode));if (try_nonblocking_invalidate (inode) <0 ) { -doutc (cl,"queuing invalidate\n" ); +boutc (cl,"queuing invalidate\n" ); queue_invalidate = true; ci->i_rdcache_revoking = ci->i_rdcache_gen; }
@@ -2144,7 +2144,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) cap_used &= ~ci->i_auth_cap->issued; revoking = cap->implemented & ~cap->issued; - doutc(cl, " mds%d cap %p used %s issued %s implemented %s revoking %s\n", + boutc(cl, " mds%d cap %p used %s issued %s implemented %s revoking %s\n", cap->mds, cap, ceph_cap_string(cap_used), ceph_cap_string(cap->issued), ceph_cap_string(cap->implemented),
@@ -2153,7 +2153,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)/* completed revocation? going down and there are no caps? */ if (revoking) {if ((revoking & cap_used) ==0 ) { -doutc (cl,"completed revocation of %s\n" , +boutc (cl,"completed revocation of %s\n" ,ceph_cap_string (cap->implemented & ~cap->issued)); goto ack; }
@@ -2175,7 +2175,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags) }if (flags &CHECK_CAPS_FLUSH_FORCE ) { -doutc (cl,"force to flush caps\n" ); +boutc (cl,"force to flush caps\n" ); goto ack; }
@@ -2184,24 +2184,24 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)/* request larger max_size from MDS? */ if (ci->i_wanted_max_size > ci->i_max_size && ci->i_wanted_max_size > ci->i_requested_max_size) { -doutc (cl,"requesting new max_size\n" ); +boutc (cl,"requesting new max_size\n" ); goto ack; }/* approaching file_max? */ if (__ceph_should_report_size (ci)) { -doutc (cl,"i_size approaching max_size\n" ); +boutc (cl,"i_size approaching max_size\n" ); goto ack; } }/* flush anything dirty? */ if (cap == ci->i_auth_cap) {if ((flags &CHECK_CAPS_FLUSH ) && ci->i_dirty_caps) { -doutc (cl,"flushing dirty caps\n" ); +boutc (cl,"flushing dirty caps\n" ); goto ack; }if (ci->i_ceph_flags &CEPH_I_FLUSH_SNAPS ) { -doutc (cl,"flushing snap caps\n" ); +boutc (cl,"flushing snap caps\n" ); goto ack; } }
@@ -2453,7 +2453,7 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)kfree (sessions); } -doutc (cl,"%p %llx.%llx wait on tid %llu %llu\n" , inode, +boutc (cl,"%p %llx.%llx wait on tid %llu %llu\n" , inode,ceph_vinop (inode), req1 ? req1->r_tid :0ULL , req2 ? req2->r_tid :0ULL );if (req1) {
@@ -2480,13 +2480,17 @@ static int flush_mdlog_and_wait_inode_unsafe_requests(struct inode *inode)int ceph_fsync (struct file *file,loff_t start,loff_t end,int datasync) {struct inode *inode = file->f_mapping->host; +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_client *cl =ceph_inode_to_client (inode);u64 flush_tid;int ret, err;int dirty; +struct ceph_journal_info __ji; + +ceph_blog_enter (fsc, &__ji); -doutc (cl,"%p %llx.%llx%s\n" , inode,ceph_vinop (inode), +boutc (cl,"%p %llx.%llx%s\n" , inode,ceph_vinop (inode), datasync ?" datasync" :"" ); ret =file_write_and_wait_range (file, start, end);
@@ -2498,7 +2502,7 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync) goto out; dirty =try_flush_caps (inode, &flush_tid); -doutc (cl,"dirty caps are %s\n" ,ceph_cap_string (dirty)); +boutc (cl,"dirty caps are %s\n" ,ceph_cap_string (dirty)); err =flush_mdlog_and_wait_inode_unsafe_requests (inode);
@@ -2519,8 +2523,9 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)if (err <0 ) ret = err; out: -doutc (cl,"%p %llx.%llx%s result=%d\n" , inode,ceph_vinop (inode), +boutc (cl,"%p %llx.%llx%s result=%d\n" , inode,ceph_vinop (inode), datasync ?" datasync" :"" , ret); +ceph_blog_exit (&__ji);return ret; }
@@ -2532,19 +2537,25 @@ int ceph_fsync(struct file *file, loff_t start, loff_t end, int datasync)*/ int ceph_write_inode (struct inode *inode,struct writeback_control *wbc) { +struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);struct ceph_inode_info *ci =ceph_inode (inode);struct ceph_client *cl =ceph_inode_to_client (inode);u64 flush_tid;int err =0 ;int dirty;int wait = (wbc->sync_mode ==WB_SYNC_ALL && !wbc->for_sync); +struct ceph_journal_info __ji; -doutc (cl,"%p %llx.%llx wait=%d\n" , inode,ceph_vinop (inode), wait); +ceph_blog_enter (fsc, &__ji); + +boutc (cl,"%p %llx.%llx wait=%d\n" , inode,ceph_vinop (inode), wait);ceph_fscache_unpin_writeback (inode, wbc);if (wait) { err =ceph_wait_on_async_create (inode); -if (err) +if (err) { +ceph_blog_exit (&__ji);return err; + } dirty =try_flush_caps (inode, &flush_tid);if (dirty) err = wait_event_interruptible(ci->i_cap_wq,
@@ -2558,6 +2569,7 @@ int ceph_write_inode(struct inode *inode, struct writeback_control *wbc)__cap_delay_requeue_front (mdsc, ci);spin_unlock (&ci->i_ceph_lock); } +ceph_blog_exit (&__ji);return err; }
@@ -2605,7 +2617,7 @@ static void __kick_flushing_caps(struct ceph_mds_client *mdsc,if (!cf->is_capsnap) {struct cap_msg_args arg; -doutc (cl,"%p %llx.%llx cap %p tid %llu %s\n" , +boutc (cl,"%p %llx.%llx cap %p tid %llu %s\n" , inode,ceph_vinop (inode), cap, cf->tid,ceph_cap_string (cf->caps)); __prep_cap(&arg, cap, CEPH_CAP_OP_FLUSH,
@@ -2621,7 +2633,7 @@ static void __kick_flushing_caps(struct ceph_mds_client *mdsc,struct ceph_cap_snap *capsnap = container_of(cf, struct ceph_cap_snap, cap_flush); -doutc (cl,"%p %llx.%llx capsnap %p tid %llu %s\n" , +boutc (cl,"%p %llx.%llx capsnap %p tid %llu %s\n" , inode,ceph_vinop (inode), capsnap, cf->tid,ceph_cap_string (capsnap->dirty));
@@ -2652,7 +2664,7 @@ void ceph_early_kick_flushing_caps(struct ceph_mds_client *mdsc,struct ceph_cap *cap;u64 oldest_flush_tid; -doutc (cl,"mds%d\n" , session->s_mds); +boutc (cl,"mds%d\n" , session->s_mds);spin_lock (&mdsc->cap_dirty_lock); oldest_flush_tid =__get_oldest_flush_tid (mdsc);
@@ -2706,7 +2718,7 @@ void ceph_kick_flushing_caps(struct ceph_mds_client *mdsc,lockdep_assert_held (&session->s_mutex); -doutc (cl,"mds%d\n" , session->s_mds); +boutc (cl,"mds%d\n" , session->s_mds);spin_lock (&mdsc->cap_dirty_lock); oldest_flush_tid =__get_oldest_flush_tid (mdsc);
@@ -2741,7 +2753,7 @@ void ceph_kick_flushing_inode_caps(struct ceph_mds_session *session,lockdep_assert_held (&ci->i_ceph_lock); -doutc (mdsc->fsc->client,"%p %llx.%llx flushing %s\n" , +boutc (mdsc->fsc->client,"%p %llx.%llx flushing %s\n" , inode,ceph_vinop (inode),ceph_cap_string (ci->i_flushing_caps));
@@ -2790,7 +2802,7 @@ void ceph_take_cap_refs(struct ceph_inode_info *ci, int got,if (ci->i_wb_ref ==0 )ihold (inode); ci->i_wb_ref++; -doutc (cl,"%p %llx.%llx wb %d -> %d (?)\n" , inode, +boutc (cl,"%p %llx.%llx wb %d -> %d (?)\n" , inode,ceph_vinop (inode), ci->i_wb_ref-1 , ci->i_wb_ref); } }
@@ -2824,7 +2836,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,int have, implemented;bool snap_rwsem_locked = false; -doutc (cl,"%p %llx.%llx need %s want %s\n" , inode, +boutc (cl,"%p %llx.%llx need %s want %s\n" , inode,ceph_vinop (inode),ceph_cap_string (need),ceph_cap_string (want));
@@ -2833,7 +2845,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,if ((flags &CHECK_FILELOCK ) &&test_bit (CEPH_I_ERROR_FILELOCK_BIT , &ci->i_ceph_flags)) { -doutc (cl,"%p %llx.%llx error filelock\n" , inode, +boutc (cl,"%p %llx.%llx error filelock\n" , inode,ceph_vinop (inode)); ret = -EIO ; goto out_unlock;
@@ -2854,7 +2866,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,if (have & need &CEPH_CAP_FILE_WR ) {if (endoff >=0 && endoff > (loff_t )ci->i_max_size) { -doutc (cl,"%p %llx.%llx endoff %llu > maxsize %llu\n" , +boutc (cl,"%p %llx.%llx endoff %llu > maxsize %llu\n" , inode,ceph_vinop (inode), endoff, ci->i_max_size);if (endoff > ci->i_requested_max_size) ret = ci->i_auth_cap ? -EFBIG : -EUCLEAN ;
@@ -2865,7 +2877,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,* can get a final snapshot value for size+mtime. */ if (__ceph_have_pending_cap_snap (ci)) { -doutc (cl,"%p %llx.%llx cap_snap_pending\n" , inode, +boutc (cl,"%p %llx.%llx cap_snap_pending\n" , inode,ceph_vinop (inode)); goto out_unlock; }
@@ -2884,7 +2896,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,int not = want & ~(have & need);int revoking = implemented & ~have;int exclude = revoking & not; -doutc (cl,"%p %llx.%llx have %s but not %s (revoking %s)\n" , +boutc (cl,"%p %llx.%llx have %s but not %s (revoking %s)\n" , inode,ceph_vinop (inode),ceph_cap_string (have),ceph_cap_string (not),ceph_cap_string (revoking));if (!exclude || !(exclude &CEPH_CAP_FILE_BUFFER )) {
@@ -2926,7 +2938,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,spin_unlock (&s->s_cap_lock); }if (session_readonly) { -doutc (cl,"%p %llx.%llx need %s but mds%d readonly\n" , +boutc (cl,"%p %llx.%llx need %s but mds%d readonly\n" , inode,ceph_vinop (inode),ceph_cap_string (need), ci->i_auth_cap->mds); ret = -EROFS ;
@@ -2934,21 +2946,21 @@ static int try_get_cap_refs(struct inode *inode, int need, int want, }if (ceph_inode_is_shutdown (inode)) { -doutc (cl,"%p %llx.%llx inode is shutdown\n" , +boutc (cl,"%p %llx.%llx inode is shutdown\n" , inode,ceph_vinop (inode)); ret = -ESTALE ; goto out_unlock; } mds_wanted =__ceph_caps_mds_wanted (ci, false);if (need & ~mds_wanted) { -doutc (cl,"%p %llx.%llx need %s > mds_wanted %s\n" , +boutc (cl,"%p %llx.%llx need %s > mds_wanted %s\n" , inode,ceph_vinop (inode),ceph_cap_string (need),ceph_cap_string (mds_wanted)); ret = -EUCLEAN ; goto out_unlock; } -doutc (cl,"%p %llx.%llx have %s need %s\n" , inode, +boutc (cl,"%p %llx.%llx have %s need %s\n" , inode,ceph_vinop (inode),ceph_cap_string (have),ceph_cap_string (need)); }
@@ -2965,7 +2977,7 @@ static int try_get_cap_refs(struct inode *inode, int need, int want,else if (ret ==1 )ceph_update_cap_hit (&mdsc->metric); -doutc (cl,"%p %llx.%llx ret %d got %s\n" , inode, +boutc (cl,"%p %llx.%llx ret %d got %s\n" , inode,ceph_vinop (inode), ret,ceph_cap_string (*got));return ret; }
@@ -2984,7 +2996,7 @@ static void check_max_size(struct inode *inode, loff_t endoff)/* do we need to explicitly request a larger max_size? */ spin_lock (&ci->i_ceph_lock);if (endoff >= ci->i_max_size && endoff > ci->i_wanted_max_size) { -doutc (cl,"write %p %llx.%llx at large endoff %llu, req max_size\n" , +boutc (cl,"write %p %llx.%llx at large endoff %llu, req max_size\n" , inode,ceph_vinop (inode), endoff); ci->i_wanted_max_size = endoff; }
@@ -3206,7 +3218,7 @@ static int ceph_try_drop_cap_snap(struct ceph_inode_info *ci,if (!capsnap->need_flush && !capsnap->writing && !capsnap->dirty_pages) { -doutc (cl,"%p follows %llu\n" , capsnap, capsnap->follows); +boutc (cl,"%p follows %llu\n" , capsnap, capsnap->follows);BUG_ON (capsnap->cap_flush.tid >0 );ceph_put_snap_context (capsnap->context);if (!list_is_last (&capsnap->ci_item, &ci->i_cap_snaps))
@@ -3260,7 +3272,7 @@ static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had, put++; check_flushsnaps = true; } -doutc (cl,"%p %llx.%llx wb %d -> %d (?)\n" , inode, +boutc (cl,"%p %llx.%llx wb %d -> %d (?)\n" , inode,ceph_vinop (inode), ci->i_wb_ref+1 , ci->i_wb_ref); }if (had &CEPH_CAP_FILE_WR ) {
@@ -3301,7 +3313,7 @@ static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had, }spin_unlock (&ci->i_ceph_lock); -doutc (cl,"%p %llx.%llx had %s%s%s\n" , inode,ceph_vinop (inode), +boutc (cl,"%p %llx.%llx had %s%s%s\n" , inode,ceph_vinop (inode),ceph_cap_string (had), last ?" last" :"" , put ?" put" :"" );switch (mode) {
@@ -3371,7 +3383,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr,ceph_put_snap_context (ci->i_head_snapc); ci->i_head_snapc =NULL ; } -doutc (cl,"on %p %llx.%llx head %d/%d -> %d/%d %s\n" , +boutc (cl,"on %p %llx.%llx head %d/%d -> %d/%d %s\n" , inode,ceph_vinop (inode), ci->i_wrbuffer_ref+nr, ci->i_wrbuffer_ref_head+nr, ci->i_wrbuffer_ref, ci->i_wrbuffer_ref_head, last ?" LAST" :"" );
@@ -3404,7 +3416,7 @@ void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, } } } - doutc(cl, "%p %llx.%llx cap_snap %p snap %lld %d/%d -> %d/%d %s%s\n", + boutc(cl, "%p %llx.%llx cap_snap %p snap %lld %d/%d -> %d/%d %s%s\n", inode, ceph_vinop(inode), capsnap, capsnap->context->seq, ci->i_wrbuffer_ref+nr, capsnap->dirty_pages + nr, ci->i_wrbuffer_ref, capsnap->dirty_pages,
@@ -3435,7 +3447,7 @@ static void invalidate_aliases(struct inode *inode)struct ceph_client *cl =ceph_inode_to_client (inode);struct dentry *dn, *prev =NULL ; -doutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode)); +boutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode));d_prune_aliases (inode);/* * For non-directory inode, d_find_alias() only returns
@@ -3520,10 +3532,10 @@ static void handle_cap_grant(struct inode *inode,if (IS_ENCRYPTED (inode) && size) size = extra_info->fscrypt_file_size; -doutc (cl,"%p %llx.%llx cap %p mds%d seq %d %s\n" , inode, +boutc (cl,"%p %llx.%llx cap %p mds%d seq %d %s\n" , inode,ceph_vinop (inode), cap, session->s_mds, seq,ceph_cap_string (newcaps)); -doutc (cl," size %llu max_size %llu, i_size %llu\n" , size, +boutc (cl," size %llu max_size %llu, i_size %llu\n" , size, max_size,i_size_read (inode));
@@ -3584,7 +3596,7 @@ static void handle_cap_grant(struct inode *inode, inode->i_uid =make_kuid (&init_user_ns,le32_to_cpu (grant->uid)); inode->i_gid =make_kgid (&init_user_ns,le32_to_cpu (grant->gid)); ci->i_btime = extra_info->btime; -doutc (cl,"%p %llx.%llx mode 0%o uid.gid %d.%d\n" , inode, +boutc (cl,"%p %llx.%llx mode 0%o uid.gid %d.%d\n" , inode,ceph_vinop (inode), inode->i_mode,from_kuid (&init_user_ns, inode->i_uid),from_kgid (&init_user_ns, inode->i_gid));
@@ -3612,7 +3624,7 @@ static void handle_cap_grant(struct inode *inode,u64 version =le64_to_cpu (grant->xattr_version);if (version > ci->i_xattrs.version) { -doutc (cl," got new xattrs v%llu on %p %llx.%llx len %d\n" , +boutc (cl," got new xattrs v%llu on %p %llx.%llx len %d\n" , version, inode,ceph_vinop (inode), len);if (ci->i_xattrs.blob)ceph_buffer_put (ci->i_xattrs.blob);
@@ -3664,7 +3676,7 @@ static void handle_cap_grant(struct inode *inode,if (ci->i_auth_cap == cap && (newcaps &CEPH_CAP_ANY_FILE_WR )) {if (max_size != ci->i_max_size) { -doutc (cl,"max_size %lld -> %llu\n" , ci->i_max_size, +boutc (cl,"max_size %lld -> %llu\n" , ci->i_max_size, max_size); ci->i_max_size = max_size;if (max_size >= ci->i_wanted_max_size) {
@@ -3679,7 +3691,7 @@ static void handle_cap_grant(struct inode *inode, wanted =__ceph_caps_wanted (ci); used =__ceph_caps_used (ci); dirty =__ceph_caps_dirty (ci); -doutc (cl," my wanted = %s, used = %s, dirty %s\n" , +boutc (cl," my wanted = %s, used = %s, dirty %s\n" ,ceph_cap_string (wanted),ceph_cap_string (used),ceph_cap_string (dirty));
@@ -3702,7 +3714,7 @@ static void handle_cap_grant(struct inode *inode,if (cap->issued & ~newcaps) {int revoking = cap->issued & ~newcaps; -doutc (cl,"revocation: %s -> %s (revoking %s)\n" , +boutc (cl,"revocation: %s -> %s (revoking %s)\n" ,ceph_cap_string (cap->issued),ceph_cap_string (newcaps),ceph_cap_string (revoking)); if (S_ISREG(inode->i_mode) &&
@@ -3724,11 +3736,11 @@ static void handle_cap_grant(struct inode *inode, cap->issued = newcaps; cap->implemented |= newcaps; }else if (cap->issued == newcaps) { -doutc (cl,"caps unchanged: %s -> %s\n" , +boutc (cl,"caps unchanged: %s -> %s\n" ,ceph_cap_string (cap->issued),ceph_cap_string (newcaps)); }else { -doutc (cl,"grant: %s -> %s\n" ,ceph_cap_string (cap->issued), +boutc (cl,"grant: %s -> %s\n" ,ceph_cap_string (cap->issued),ceph_cap_string (newcaps));/* non-auth MDS is revoking the newly grant caps ? */ if (cap == ci->i_auth_cap &&
@@ -3863,7 +3875,7 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, } } - doutc(cl, "%p %llx.%llx mds%d seq %d on %s cleaned %s, flushing %s -> %s\n", + boutc(cl, "%p %llx.%llx mds%d seq %d on %s cleaned %s, flushing %s -> %s\n", inode, ceph_vinop(inode), session->s_mds, seq, ceph_cap_string(dirty), ceph_cap_string(cleaned), ceph_cap_string(ci->i_flushing_caps),
@@ -3887,16 +3899,16 @@ static void handle_cap_flush_ack(struct inode *inode, u64 flush_tid, &list_first_entry (&session->s_cap_flushing, struct ceph_inode_info, i_flushing_item)->netfs.inode; -doutc (cl," mds%d still flushing cap on %p %llx.%llx\n" , +boutc (cl," mds%d still flushing cap on %p %llx.%llx\n" , session->s_mds, inode,ceph_vinop (inode)); } } mdsc->num_cap_flushing--; -doutc (cl," %p %llx.%llx now !flushing\n" , inode, +boutc (cl," %p %llx.%llx now !flushing\n" , inode,ceph_vinop (inode));if (ci->i_dirty_caps ==0 ) { -doutc (cl," %p %llx.%llx now clean\n" , inode, +boutc (cl," %p %llx.%llx now clean\n" , inode,ceph_vinop (inode));BUG_ON (!list_empty (&ci->i_dirty_item)); drop = true;
@@ -3941,7 +3953,7 @@ void __ceph_remove_capsnap(struct inode *inode, struct ceph_cap_snap *capsnap,lockdep_assert_held (&ci->i_ceph_lock); -doutc (cl,"removing capsnap %p, %p %llx.%llx ci %p\n" , capsnap, +boutc (cl,"removing capsnap %p, %p %llx.%llx ci %p\n" , capsnap, inode,ceph_vinop (inode), ci);list_del_init (&capsnap->ci_item);
@@ -3988,14 +4000,14 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid,bool wake_ci = false;bool wake_mdsc = false; -doutc (cl,"%p %llx.%llx ci %p mds%d follows %lld\n" , inode, +boutc (cl,"%p %llx.%llx ci %p mds%d follows %lld\n" , inode,ceph_vinop (inode), ci, session->s_mds, follows);spin_lock (&ci->i_ceph_lock);list_for_each_entry (iter, &ci->i_cap_snaps, ci_item) {if (iter->follows == follows) {if (iter->cap_flush.tid != flush_tid) { -doutc (cl," cap_snap %p follows %lld " +boutc (cl," cap_snap %p follows %lld " "tid %lld != %lld\n" , iter, follows, flush_tid, iter->cap_flush.tid);
@@ -4004,7 +4016,7 @@ static void handle_cap_flushsnap_ack(struct inode *inode, u64 flush_tid, capsnap = iter;break ; }else { -doutc (cl," skipping cap_snap %p follows %lld\n" , +boutc (cl," skipping cap_snap %p follows %lld\n" , iter, iter->follows); } }
@@ -4057,7 +4069,7 @@ static bool handle_cap_trunc(struct inode *inode,if (IS_ENCRYPTED (inode) && size) size = extra_info->fscrypt_file_size; -doutc (cl,"%p %llx.%llx mds%d seq %d to %lld truncate seq %d\n" , +boutc (cl,"%p %llx.%llx mds%d seq %d to %lld truncate seq %d\n" , inode,ceph_vinop (inode), mds, seq, truncate_size, truncate_seq); queue_trunc =ceph_fill_file_size (inode, issued, truncate_seq, truncate_size, size);
@@ -4096,7 +4108,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, target =-1 ; } -doutc (cl," cap %llx.%llx export to peer %d piseq %u pmseq %u\n" , +boutc (cl," cap %llx.%llx export to peer %d piseq %u pmseq %u\n" ,ceph_vinop (inode), target, t_issue_seq, t_mseq); retry:down_read (&mdsc->snap_rwsem);
@@ -4131,7 +4143,7 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,/* already have caps from the target */ if (tcap->cap_id == t_cap_id &&ceph_seq_cmp (tcap->seq, t_issue_seq) <0 ) { -doutc (cl," updating import cap %p mds%d\n" , tcap, +boutc (cl," updating import cap %p mds%d\n" , tcap, target); tcap->cap_id = t_cap_id; tcap->seq = t_issue_seq -1 ;
@@ -4238,7 +4250,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, peer =-1 ; } -doutc (cl," cap %llx.%llx import from peer %d piseq %u pmseq %u\n" , +boutc (cl," cap %llx.%llx import from peer %d piseq %u pmseq %u\n" ,ceph_vinop (inode), peer, piseq, pmseq); retry: cap =__get_cap_for_mds (ci, mds);
@@ -4265,7 +4277,7 @@ static void handle_cap_import(struct ceph_mds_client *mdsc, ocap = peer >=0 ?__get_cap_for_mds (ci, peer) :NULL ;if (ocap && ocap->cap_id == p_cap_id) { -doutc (cl," remove export cap %p mds%d flags %d\n" , +boutc (cl," remove export cap %p mds%d flags %d\n" , ocap, peer, ph->flags); if ((ph->flags & CEPH_CAP_FLAG_AUTH) && (ocap->seq != piseq ||
@@ -4524,7 +4536,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,spin_lock (&ci->i_ceph_lock); cap =__get_cap_for_mds (ceph_inode (inode), session->s_mds);if (!cap) { -doutc (cl," no cap on %p ino %llx.%llx from mds%d\n" , +boutc (cl," no cap on %p ino %llx.%llx from mds%d\n" , inode,ceph_ino (inode),ceph_snap (inode), session->s_mds);spin_unlock (&ci->i_ceph_lock);
@@ -4628,14 +4640,14 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)unsigned long loop_start = jiffies;unsigned long delay =0 ; -doutc (cl,"begin\n" ); +boutc (cl,"begin\n" );spin_lock (&mdsc->cap_delay_lock);while (!list_empty (&mdsc->cap_delay_list)) { ci =list_first_entry (&mdsc->cap_delay_list, struct ceph_inode_info, i_cap_delay_list);if (time_before (loop_start, ci->i_hold_caps_max - delay_max)) { -doutc (cl,"caps added recently. Exiting loop" ); +boutc (cl,"caps added recently. Exiting loop" ); delay = ci->i_hold_caps_max;break ; }
@@ -4647,7 +4659,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc) inode =igrab (&ci->netfs.inode);if (inode) {spin_unlock (&mdsc->cap_delay_lock); -doutc (cl,"on %p %llx.%llx\n" , inode, +boutc (cl,"on %p %llx.%llx\n" , inode,ceph_vinop (inode));ceph_check_caps (ci,0 );iput (inode);
@@ -4663,7 +4675,7 @@ unsigned long ceph_check_delayed_caps(struct ceph_mds_client *mdsc)break ; }spin_unlock (&mdsc->cap_delay_lock); -doutc (cl,"done\n" ); +boutc (cl,"done\n" );return delay; }
@@ -4678,14 +4690,14 @@ static void flush_dirty_session_caps(struct ceph_mds_session *s)struct ceph_inode_info *ci;struct inode *inode; -doutc (cl,"begin\n" ); +boutc (cl,"begin\n" );spin_lock (&mdsc->cap_dirty_lock);while (!list_empty (&s->s_cap_dirty)) { ci = list_first_entry(&s->s_cap_dirty, struct ceph_inode_info, i_dirty_item); inode = &ci->netfs.inode;ihold (inode); -doutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode)); +boutc (cl,"%p %llx.%llx\n" , inode,ceph_vinop (inode));spin_unlock (&mdsc->cap_dirty_lock);ceph_wait_on_async_create (inode);ceph_check_caps (ci,CHECK_CAPS_FLUSH );
@@ -4693,7 +4705,7 @@ static void flush_dirty_session_caps(struct ceph_mds_session *s)spin_lock (&mdsc->cap_dirty_lock); }spin_unlock (&mdsc->cap_dirty_lock); -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }void ceph_flush_dirty_caps (struct ceph_mds_client *mdsc)
@@ -4709,12 +4721,12 @@ static void flush_cap_releases(struct ceph_mds_session *s)struct ceph_mds_client *mdsc = s->s_mdsc;struct ceph_client *cl = mdsc->fsc->client; -doutc (cl,"begin\n" ); +boutc (cl,"begin\n" );spin_lock (&s->s_cap_lock);if (s->s_num_cap_releases)ceph_flush_session_cap_releases (mdsc, s);spin_unlock (&s->s_cap_lock); -doutc (cl,"done\n" ); +boutc (cl,"done\n" ); }
@@ -4822,7 +4834,7 @@ int ceph_drop_caps_for_unlink(struct inode *inode)struct ceph_mds_client *mdsc =ceph_inode_to_fs_client (inode)->mdsc; -doutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode, +boutc (mdsc->fsc->client,"%p %llx.%llx\n" , inode,ceph_vinop (inode));spin_lock (&mdsc->cap_delay_lock);set_bit (CEPH_I_FLUSH_BIT , &ci->i_ceph_flags);
@@ -4865,7 +4877,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, used =__ceph_caps_used (ci); dirty =__ceph_caps_dirty (ci); -doutc (cl,"%p %llx.%llx mds%d used|dirty %s drop %s unless %s\n" , +boutc (cl,"%p %llx.%llx mds%d used|dirty %s drop %s unless %s\n" , inode,ceph_vinop (inode), mds,ceph_cap_string (used|dirty),ceph_cap_string (drop),ceph_cap_string (unless));
@@ -4889,7 +4901,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode,if (force || (cap->issued & drop)) {if (cap->issued & drop) {int wanted =__ceph_caps_wanted (ci); - doutc(cl, "%p %llx.%llx cap %p %s -> %s, " + boutc(cl, "%p %llx.%llx cap %p %s -> %s, " "wanted %s -> %s\n", inode, ceph_vinop(inode), cap, ceph_cap_string(cap->issued),
@@ -4904,7 +4916,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, !(wanted & CEPH_CAP_ANY_FILE_WR)) ci->i_requested_max_size =0 ; }else { -doutc (cl,"%p %llx.%llx cap %p %s (force)\n" , +boutc (cl,"%p %llx.%llx cap %p %s (force)\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (cap->issued)); }
@@ -4921,7 +4933,7 @@ int ceph_encode_inode_release(void **p, struct inode *inode, *p +=sizeof (*rel); ret =1 ; }else { -doutc (cl,"%p %llx.%llx cap %p %s (noop)\n" , +boutc (cl,"%p %llx.%llx cap %p %s (noop)\n" , inode,ceph_vinop (inode), cap,ceph_cap_string (cap->issued)); }
@@ -4972,7 +4984,7 @@ int ceph_encode_dentry_release(void **p, struct dentry *dentry,spin_lock (&dentry->d_lock);if (ret && di->lease_session && di->lease_session->s_mds == mds) {int len = dentry->d_name.len; -doutc (cl,"%p mds%d seq %d\n" , dentry, mds, +boutc (cl,"%p mds%d seq %d\n" , dentry, mds, (int )di->lease_seq); rel->dname_seq =cpu_to_le32 (di->lease_seq);__ceph_mdsc_drop_dentry_lease (dentry);
@@ -5000,7 +5012,7 @@ static int remove_capsnaps(struct ceph_mds_client *mdsc, struct inode *inode)lockdep_assert_held (&ci->i_ceph_lock); -doutc (cl,"removing capsnaps, ci is %p, %p %llx.%llx\n" , +boutc (cl,"removing capsnaps, ci is %p, %p %llx.%llx\n" , ci, inode,ceph_vinop (inode));while (!list_empty (&ci->i_cap_snaps)) {
@@ -5028,7 +5040,7 @@ int ceph_purge_inode_cap(struct inode *inode, struct ceph_cap *cap, bool *invalilockdep_assert_held (&ci->i_ceph_lock); -doutc (cl,"removing cap %p, ci is %p, %p %llx.%llx\n" , +boutc (cl,"removing cap %p, ci is %p, %p %llx.%llx\n" , cap, ci, inode,ceph_vinop (inode)); is_auth = (cap == ci->i_auth_cap);
fs/ceph/snap.c +33 -33
252 lines not on this page · raw message
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 14/15 ceph: convert remaining helper paths to bout
In reply to Alex MarkuzeReplace dout()/doutc() with bout()/boutc() in locks.c, xattr.c, crypto.c, ioctl.c, mdsmap.c, and quota.c.
--- fs/ceph/crypto.c | 14 ++++---- fs/ceph/ioctl.c | 6 ++-- fs/ceph/locks.c | 66 +++++++++++++++++++++++++----------- fs/ceph/mdsmap.c | 8 ++--- fs/ceph/quota.c | 2 +- fs/ceph/xattr.c | 88 +++++++++++++++++++++++++++++++----------------- 6 files changed, 119 insertions(+), 65 deletions(-)
fs/ceph/crypto.c +7 -7
@@ -188,7 +188,7 @@ static struct inode *parse_longname(const struct inode *parent, inode_number = name_end +1 ; ret =kstrtou64 (inode_number,10 , &vino.ino);if (ret) { -doutc (cl,"failed to parse inode number: %s\n" , str); +boutc (cl,"failed to parse inode number: %s\n" , str);return ERR_PTR (ret); }
@@ -198,7 +198,7 @@ static struct inode *parse_longname(const struct inode *parent,/* This can happen if we're not mounting cephfs on the root */ dir =ceph_get_inode (parent->i_sb, vino,NULL );if (IS_ERR (dir)) -doutc (cl,"can't find inode %s (%s)\n" , inode_number, name); +boutc (cl,"can't find inode %s (%s)\n" , inode_number, name); }return dir; }
@@ -432,7 +432,7 @@ int ceph_fscrypt_decrypt_block_inplace(const struct inode *inode, {struct ceph_client *cl =ceph_inode_to_client (inode); -doutc (cl,"%p %llx.%llx len %u offs %u blk %llu\n" , inode, +boutc (cl,"%p %llx.%llx len %u offs %u blk %llu\n" , inode,ceph_vinop (inode), len, offs, lblk_num);return fscrypt_decrypt_block_inplace (inode, page, len, offs, lblk_num); }
@@ -443,7 +443,7 @@ int ceph_fscrypt_encrypt_block_inplace(const struct inode *inode, {struct ceph_client *cl =ceph_inode_to_client (inode); -doutc (cl,"%p %llx.%llx len %u offs %u blk %llu\n" , inode, +boutc (cl,"%p %llx.%llx len %u offs %u blk %llu\n" , inode,ceph_vinop (inode), len, offs, lblk_num);return fscrypt_encrypt_block_inplace (inode, page, len, offs, lblk_num); }
@@ -520,7 +520,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,/* Nothing to do for empty array */ if (ext_cnt ==0 ) { -doutc (cl,"%p %llx.%llx empty array, ret 0\n" , inode, +boutc (cl,"%p %llx.%llx empty array, ret 0\n" , inode,ceph_vinop (inode));return 0 ; }
@@ -544,7 +544,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, } fret =ceph_fscrypt_decrypt_pages (inode, &page[pgidx], off + pgsoff, ext->len); -doutc (cl,"%p %llx.%llx [%d] 0x%llx~0x%llx fret %d\n" , inode, +boutc (cl,"%p %llx.%llx [%d] 0x%llx~0x%llx fret %d\n" , inode,ceph_vinop (inode), i, ext->off, ext->len, fret);if (fret <0 ) {if (ret ==0 )
@@ -553,7 +553,7 @@ int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page, } ret = pgsoff + fret; } -doutc (cl,"ret %d\n" , ret); +boutc (cl,"ret %d\n" , ret);return ret; }
fs/ceph/ioctl.c +3 -3
@@ -259,10 +259,10 @@ static long ceph_ioctl_lazyio(struct file *file)spin_unlock (&ci->i_ceph_lock);if (is_file_already_lazy) { -doutc (cl,"file %p %p %llx.%llx already lazy\n" , file, inode, +boutc (cl,"file %p %p %llx.%llx already lazy\n" , file, inode,ceph_vinop (inode)); }else { -doutc (cl,"file %p %p %llx.%llx marked lazy\n" , file, inode, +boutc (cl,"file %p %p %llx.%llx marked lazy\n" , file, inode,ceph_vinop (inode));ceph_check_caps (ci,0 );
@@ -369,7 +369,7 @@ long ceph_ioctl(struct file *file, unsigned int cmd, unsigned long arg)struct ceph_fs_client *fsc =ceph_inode_to_fs_client (inode);int ret; -doutc (fsc->client,"file %p %p %llx.%llx cmd %s arg %lu\n" , file, +boutc (fsc->client,"file %p %p %llx.%llx cmd %s arg %lu\n" , file, inode,ceph_vinop (inode),ceph_ioctl_cmd_name (cmd), arg);switch (cmd) {case CEPH_IOC_GET_LAYOUT :
fs/ceph/locks.c +47 -19
198 lines not on this page · raw message
fs/ceph/mdsmap.c +4 -4
@@ -236,7 +236,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p, *p = info_end; } -doutc (cl,"%d/%d %lld mds%d.%d %s %s%s\n" , i+1 , n, global_id, +boutc (cl,"%d/%d %lld mds%d.%d %s %s%s\n" , i+1 , n, global_id, mds, inc,ceph_pr_addr (&addr),ceph_mds_state_name (state), laggy ?"(laggy)" :"" );
@@ -246,7 +246,7 @@ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p, }if (state <=0 ) { -doutc (cl,"got incorrect state(%s)\n" , +boutc (cl,"got incorrect state(%s)\n" ,ceph_mds_state_name (state));continue ; }
@@ -410,10 +410,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(struct ceph_mds_client *mdsc, void **p,ceph_decode_64_safe (p, end, m->m_max_xattr_size, bad_ext); } bad_ext: -doutc (cl,"m_enabled: %d, m_damaged: %d, m_num_laggy: %d\n" , +boutc (cl,"m_enabled: %d, m_damaged: %d, m_num_laggy: %d\n" , !!m->m_enabled, !!m->m_damaged, m->m_num_laggy); *p = end; -doutc (cl,"success epoch %u\n" , m->m_epoch); +boutc (cl,"success epoch %u\n" , m->m_epoch);return m; nomem: err = -ENOMEM ;
fs/ceph/quota.c +1 -1
@@ -164,7 +164,7 @@ static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc, }if (IS_ERR (in)) { -doutc (cl,"Can't lookup inode %llx (err: %ld)\n" , realm->ino, +boutc (cl,"Can't lookup inode %llx (err: %ld)\n" , realm->ino,PTR_ERR (in)); qri->timeout = jiffies +secs_to_jiffies (60 );/* XXX */ }else {
fs/ceph/xattr.c +57 -31
279 lines not on this page · raw message
Signature · 1 line
2.34.1
Alex Markuze
maintainerPATCH 15/15 selftests: add Ceph BLOG smoke test and collection helpers
In reply to Alex MarkuzeAdd kselftests: blog_smoke_test.sh (dual-mount isolation, enable/ disable), blog_collect.sh, blog_analyze.sh, and kselftest wiring.
Add F: pattern for tools/testing/selftests/ceph_blog/ to the CephFS MAINTAINERS entry.
--- MAINTAINERS | 1 + tools/testing/selftests/Makefile | 1 + tools/testing/selftests/ceph_blog/Makefile | 7 + .../selftests/ceph_blog/blog_analyze.sh | 124 ++++++ .../selftests/ceph_blog/blog_collect.sh | 116 ++++++ .../selftests/ceph_blog/blog_smoke_test.sh | 363 ++++++++++++++++++ tools/testing/selftests/ceph_blog/config | 2 + 7 files changed, 614 insertions(+) create mode 100644 tools/testing/selftests/ceph_blog/Makefile create mode 100644 tools/testing/selftests/ceph_blog/blog_analyze.sh create mode 100644 tools/testing/selftests/ceph_blog/blog_collect.sh create mode 100644 tools/testing/selftests/ceph_blog/blog_smoke_test.sh create mode 100644 tools/testing/selftests/ceph_blog/config
MAINTAINERS +1 -0
@@ -5909,6 +5909,7 @@ B: https://tracker.ceph.com/ T: git https://github.com/ceph/ceph-client.git F: Documentation/filesystems/ceph.rst F: fs/ceph/ +F: tools/testing/selftests/ceph_blog/ F: tools/testing/selftests/filesystems/ceph/ CERTIFICATE HANDLING
tools/testing/selftests/Makefile +1 -0
@@ -7,6 +7,7 @@ TARGETS += bpf TARGETS += breakpoints TARGETS += cachestat TARGETS += capabilities +TARGETS += ceph_blog TARGETS += cgroup TARGETS += clone3 TARGETS += connector
tools/testing/selftests/ceph_blog/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# SPDX-License-Identifier: GPL-2.0 + +TEST_PROGS := blog_smoke_test.sh +TEST_PROGS += blog_collect.sh +TEST_PROGS += blog_analyze.sh + +include ../lib.mk
tools/testing/selftests/ceph_blog/blog_analyze.sh new file +124 -0
124 lines not on this page · raw message
tools/testing/selftests/ceph_blog/blog_collect.sh new file +116 -0
116 lines not on this page · raw message
tools/testing/selftests/ceph_blog/blog_smoke_test.sh new file +363 -0
363 lines not on this page · raw message
tools/testing/selftests/ceph_blog/config new file +2 -0
@@ -0,0 +1,2 @@ +CONFIG_CEPH_FS=m +CONFIG_DEBUG_FS=y
Signature · 1 line
2.34.1