mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-21 13:58:41 +07:00
d9b9c89304
- support for rbd object-map and fast-diff features (myself). This will speed up reads, discards and things like snap diffs on sparse images. - ceph.snap.btime vxattr to expose snapshot creation time (David Disseldorp). This will be used to integrate with "Restore Previous Versions" feature added in Windows 7 for folks who reexport ceph through SMB. - security xattrs for ceph (Zheng Yan). Only selinux is supported for now due to the limitations of ->dentry_init_security(). - support for MSG_ADDR2, FS_BTIME and FS_CHANGE_ATTR features (Jeff Layton). This is actually a single feature bit which was missing because of the filesystem pieces. With this in, the kernel client will finally be reported as "luminous" by "ceph features" -- it is still being reported as "jewel" even though all required Luminous features were implemented in 4.13. - stop NULL-terminating ceph vxattrs (Jeff Layton). The convention with xattrs is to not terminate and this was causing inconsistencies with ceph-fuse. - change filesystem time granularity from 1 us to 1 ns, again fixing an inconsistency with ceph-fuse (Luis Henriques). On top of this there are some additional dentry name handling and cap flushing fixes from Zheng. Finally, Jeff is formally taking over for Zheng as the filesystem maintainer. -----BEGIN PGP SIGNATURE----- iQFHBAABCAAxFiEEydHwtzie9C7TfviiSn/eOAIR84sFAl0u+X8THGlkcnlvbW92 QGdtYWlsLmNvbQAKCRBKf944AhHzi9byB/9fIxzoxtDMvixtJabuGSJRtlijDlWF GlO6yIWCXl/8v8easR2PCF75U/xv0+QFQmze8PVi8u4Xz589P247NnEuyEZ9n84i aCavARho6QLZPEL+B04NaqoHBl+ORKQTA6eKGhyKwRp/rn83z5Ubuw2tN7krHT3b kCY61FuTQGxNY2o/WKv/iLwINYr7H23hCf0WwyyKH1bp7OegiQ14Ebn1NtfS3sMx hS6h8Ya826vmUW0bCSS/9kzKYBCjksTig0HphUOHq6BoZJs++0b7GukIulRyuLfD J9Gr9HGPoDCVzdmFfpn2FSlxdmqfO9amUSagd0ftLQfFlPlrpoULi0GW =Bgxr -----END PGP SIGNATURE----- Merge tag 'ceph-for-5.3-rc1' of git://github.com/ceph/ceph-client Pull ceph updates from Ilya Dryomov: "Lots of exciting things this time! - support for rbd object-map and fast-diff features (myself). This will speed up reads, discards and things like snap diffs on sparse images. - ceph.snap.btime vxattr to expose snapshot creation time (David Disseldorp). This will be used to integrate with "Restore Previous Versions" feature added in Windows 7 for folks who reexport ceph through SMB. - security xattrs for ceph (Zheng Yan). Only selinux is supported for now due to the limitations of ->dentry_init_security(). - support for MSG_ADDR2, FS_BTIME and FS_CHANGE_ATTR features (Jeff Layton). This is actually a single feature bit which was missing because of the filesystem pieces. With this in, the kernel client will finally be reported as "luminous" by "ceph features" -- it is still being reported as "jewel" even though all required Luminous features were implemented in 4.13. - stop NULL-terminating ceph vxattrs (Jeff Layton). The convention with xattrs is to not terminate and this was causing inconsistencies with ceph-fuse. - change filesystem time granularity from 1 us to 1 ns, again fixing an inconsistency with ceph-fuse (Luis Henriques). On top of this there are some additional dentry name handling and cap flushing fixes from Zheng. Finally, Jeff is formally taking over for Zheng as the filesystem maintainer" * tag 'ceph-for-5.3-rc1' of git://github.com/ceph/ceph-client: (71 commits) ceph: fix end offset in truncate_inode_pages_range call ceph: use generic_delete_inode() for ->drop_inode ceph: use ceph_evict_inode to cleanup inode's resource ceph: initialize superblock s_time_gran to 1 MAINTAINERS: take over for Zheng as CephFS kernel client maintainer rbd: setallochint only if object doesn't exist rbd: support for object-map and fast-diff rbd: call rbd_dev_mapping_set() from rbd_dev_image_probe() libceph: export osd_req_op_data() macro libceph: change ceph_osdc_call() to take page vector for response libceph: bump CEPH_MSG_MAX_DATA_LEN (again) rbd: new exclusive lock wait/wake code rbd: quiescing lock should wait for image requests rbd: lock should be quiesced on reacquire rbd: introduce copyup state machine rbd: rename rbd_obj_setup_*() to rbd_obj_init_*() rbd: move OSD request allocation into object request state machines rbd: factor out __rbd_osd_setup_discard_ops() rbd: factor out rbd_osd_setup_copyup() rbd: introduce obj_req->osd_reqs list ...
305 lines
7.5 KiB
C
305 lines
7.5 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/ceph/ceph_debug.h>
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/module.h>
|
|
#include <linux/ctype.h>
|
|
#include <linux/debugfs.h>
|
|
#include <linux/seq_file.h>
|
|
|
|
#include <linux/ceph/libceph.h>
|
|
#include <linux/ceph/mon_client.h>
|
|
#include <linux/ceph/auth.h>
|
|
#include <linux/ceph/debugfs.h>
|
|
|
|
#include "super.h"
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
#include "mds_client.h"
|
|
|
|
static int mdsmap_show(struct seq_file *s, void *p)
|
|
{
|
|
int i;
|
|
struct ceph_fs_client *fsc = s->private;
|
|
struct ceph_mdsmap *mdsmap;
|
|
|
|
if (!fsc->mdsc || !fsc->mdsc->mdsmap)
|
|
return 0;
|
|
mdsmap = fsc->mdsc->mdsmap;
|
|
seq_printf(s, "epoch %d\n", mdsmap->m_epoch);
|
|
seq_printf(s, "root %d\n", mdsmap->m_root);
|
|
seq_printf(s, "max_mds %d\n", mdsmap->m_max_mds);
|
|
seq_printf(s, "session_timeout %d\n", mdsmap->m_session_timeout);
|
|
seq_printf(s, "session_autoclose %d\n", mdsmap->m_session_autoclose);
|
|
for (i = 0; i < mdsmap->m_num_mds; i++) {
|
|
struct ceph_entity_addr *addr = &mdsmap->m_info[i].addr;
|
|
int state = mdsmap->m_info[i].state;
|
|
seq_printf(s, "\tmds%d\t%s\t(%s)\n", i,
|
|
ceph_pr_addr(addr),
|
|
ceph_mds_state_name(state));
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* mdsc debugfs
|
|
*/
|
|
static int mdsc_show(struct seq_file *s, void *p)
|
|
{
|
|
struct ceph_fs_client *fsc = s->private;
|
|
struct ceph_mds_client *mdsc = fsc->mdsc;
|
|
struct ceph_mds_request *req;
|
|
struct rb_node *rp;
|
|
int pathlen = 0;
|
|
u64 pathbase;
|
|
char *path;
|
|
|
|
mutex_lock(&mdsc->mutex);
|
|
for (rp = rb_first(&mdsc->request_tree); rp; rp = rb_next(rp)) {
|
|
req = rb_entry(rp, struct ceph_mds_request, r_node);
|
|
|
|
if (req->r_request && req->r_session)
|
|
seq_printf(s, "%lld\tmds%d\t", req->r_tid,
|
|
req->r_session->s_mds);
|
|
else if (!req->r_request)
|
|
seq_printf(s, "%lld\t(no request)\t", req->r_tid);
|
|
else
|
|
seq_printf(s, "%lld\t(no session)\t", req->r_tid);
|
|
|
|
seq_printf(s, "%s", ceph_mds_op_name(req->r_op));
|
|
|
|
if (test_bit(CEPH_MDS_R_GOT_UNSAFE, &req->r_req_flags))
|
|
seq_puts(s, "\t(unsafe)");
|
|
else
|
|
seq_puts(s, "\t");
|
|
|
|
if (req->r_inode) {
|
|
seq_printf(s, " #%llx", ceph_ino(req->r_inode));
|
|
} else if (req->r_dentry) {
|
|
path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
|
|
&pathbase, 0);
|
|
if (IS_ERR(path))
|
|
path = NULL;
|
|
spin_lock(&req->r_dentry->d_lock);
|
|
seq_printf(s, " #%llx/%pd (%s)",
|
|
ceph_ino(d_inode(req->r_dentry->d_parent)),
|
|
req->r_dentry,
|
|
path ? path : "");
|
|
spin_unlock(&req->r_dentry->d_lock);
|
|
ceph_mdsc_free_path(path, pathlen);
|
|
} else if (req->r_path1) {
|
|
seq_printf(s, " #%llx/%s", req->r_ino1.ino,
|
|
req->r_path1);
|
|
} else {
|
|
seq_printf(s, " #%llx", req->r_ino1.ino);
|
|
}
|
|
|
|
if (req->r_old_dentry) {
|
|
path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen,
|
|
&pathbase, 0);
|
|
if (IS_ERR(path))
|
|
path = NULL;
|
|
spin_lock(&req->r_old_dentry->d_lock);
|
|
seq_printf(s, " #%llx/%pd (%s)",
|
|
req->r_old_dentry_dir ?
|
|
ceph_ino(req->r_old_dentry_dir) : 0,
|
|
req->r_old_dentry,
|
|
path ? path : "");
|
|
spin_unlock(&req->r_old_dentry->d_lock);
|
|
ceph_mdsc_free_path(path, pathlen);
|
|
} else if (req->r_path2 && req->r_op != CEPH_MDS_OP_SYMLINK) {
|
|
if (req->r_ino2.ino)
|
|
seq_printf(s, " #%llx/%s", req->r_ino2.ino,
|
|
req->r_path2);
|
|
else
|
|
seq_printf(s, " %s", req->r_path2);
|
|
}
|
|
|
|
seq_puts(s, "\n");
|
|
}
|
|
mutex_unlock(&mdsc->mutex);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int caps_show_cb(struct inode *inode, struct ceph_cap *cap, void *p)
|
|
{
|
|
struct seq_file *s = p;
|
|
|
|
seq_printf(s, "0x%-17lx%-17s%-17s\n", inode->i_ino,
|
|
ceph_cap_string(cap->issued),
|
|
ceph_cap_string(cap->implemented));
|
|
return 0;
|
|
}
|
|
|
|
static int caps_show(struct seq_file *s, void *p)
|
|
{
|
|
struct ceph_fs_client *fsc = s->private;
|
|
struct ceph_mds_client *mdsc = fsc->mdsc;
|
|
int total, avail, used, reserved, min, i;
|
|
|
|
ceph_reservation_status(fsc, &total, &avail, &used, &reserved, &min);
|
|
seq_printf(s, "total\t\t%d\n"
|
|
"avail\t\t%d\n"
|
|
"used\t\t%d\n"
|
|
"reserved\t%d\n"
|
|
"min\t\t%d\n\n",
|
|
total, avail, used, reserved, min);
|
|
seq_printf(s, "ino issued implemented\n");
|
|
seq_printf(s, "-----------------------------------------------\n");
|
|
|
|
mutex_lock(&mdsc->mutex);
|
|
for (i = 0; i < mdsc->max_sessions; i++) {
|
|
struct ceph_mds_session *session;
|
|
|
|
session = __ceph_lookup_mds_session(mdsc, i);
|
|
if (!session)
|
|
continue;
|
|
mutex_unlock(&mdsc->mutex);
|
|
mutex_lock(&session->s_mutex);
|
|
ceph_iterate_session_caps(session, caps_show_cb, s);
|
|
mutex_unlock(&session->s_mutex);
|
|
ceph_put_mds_session(session);
|
|
mutex_lock(&mdsc->mutex);
|
|
}
|
|
mutex_unlock(&mdsc->mutex);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int mds_sessions_show(struct seq_file *s, void *ptr)
|
|
{
|
|
struct ceph_fs_client *fsc = s->private;
|
|
struct ceph_mds_client *mdsc = fsc->mdsc;
|
|
struct ceph_auth_client *ac = fsc->client->monc.auth;
|
|
struct ceph_options *opt = fsc->client->options;
|
|
int mds = -1;
|
|
|
|
mutex_lock(&mdsc->mutex);
|
|
|
|
/* The 'num' portion of an 'entity name' */
|
|
seq_printf(s, "global_id %llu\n", ac->global_id);
|
|
|
|
/* The -o name mount argument */
|
|
seq_printf(s, "name \"%s\"\n", opt->name ? opt->name : "");
|
|
|
|
/* The list of MDS session rank+state */
|
|
for (mds = 0; mds < mdsc->max_sessions; mds++) {
|
|
struct ceph_mds_session *session =
|
|
__ceph_lookup_mds_session(mdsc, mds);
|
|
if (!session) {
|
|
continue;
|
|
}
|
|
mutex_unlock(&mdsc->mutex);
|
|
seq_printf(s, "mds.%d %s\n",
|
|
session->s_mds,
|
|
ceph_session_state_name(session->s_state));
|
|
|
|
ceph_put_mds_session(session);
|
|
mutex_lock(&mdsc->mutex);
|
|
}
|
|
mutex_unlock(&mdsc->mutex);
|
|
|
|
return 0;
|
|
}
|
|
|
|
CEPH_DEFINE_SHOW_FUNC(mdsmap_show)
|
|
CEPH_DEFINE_SHOW_FUNC(mdsc_show)
|
|
CEPH_DEFINE_SHOW_FUNC(caps_show)
|
|
CEPH_DEFINE_SHOW_FUNC(mds_sessions_show)
|
|
|
|
|
|
/*
|
|
* debugfs
|
|
*/
|
|
static int congestion_kb_set(void *data, u64 val)
|
|
{
|
|
struct ceph_fs_client *fsc = (struct ceph_fs_client *)data;
|
|
|
|
fsc->mount_options->congestion_kb = (int)val;
|
|
return 0;
|
|
}
|
|
|
|
static int congestion_kb_get(void *data, u64 *val)
|
|
{
|
|
struct ceph_fs_client *fsc = (struct ceph_fs_client *)data;
|
|
|
|
*val = (u64)fsc->mount_options->congestion_kb;
|
|
return 0;
|
|
}
|
|
|
|
DEFINE_SIMPLE_ATTRIBUTE(congestion_kb_fops, congestion_kb_get,
|
|
congestion_kb_set, "%llu\n");
|
|
|
|
|
|
void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
|
|
{
|
|
dout("ceph_fs_debugfs_cleanup\n");
|
|
debugfs_remove(fsc->debugfs_bdi);
|
|
debugfs_remove(fsc->debugfs_congestion_kb);
|
|
debugfs_remove(fsc->debugfs_mdsmap);
|
|
debugfs_remove(fsc->debugfs_mds_sessions);
|
|
debugfs_remove(fsc->debugfs_caps);
|
|
debugfs_remove(fsc->debugfs_mdsc);
|
|
}
|
|
|
|
void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
|
|
{
|
|
char name[100];
|
|
|
|
dout("ceph_fs_debugfs_init\n");
|
|
fsc->debugfs_congestion_kb =
|
|
debugfs_create_file("writeback_congestion_kb",
|
|
0600,
|
|
fsc->client->debugfs_dir,
|
|
fsc,
|
|
&congestion_kb_fops);
|
|
|
|
snprintf(name, sizeof(name), "../../bdi/%s",
|
|
dev_name(fsc->sb->s_bdi->dev));
|
|
fsc->debugfs_bdi =
|
|
debugfs_create_symlink("bdi",
|
|
fsc->client->debugfs_dir,
|
|
name);
|
|
|
|
fsc->debugfs_mdsmap = debugfs_create_file("mdsmap",
|
|
0400,
|
|
fsc->client->debugfs_dir,
|
|
fsc,
|
|
&mdsmap_show_fops);
|
|
|
|
fsc->debugfs_mds_sessions = debugfs_create_file("mds_sessions",
|
|
0400,
|
|
fsc->client->debugfs_dir,
|
|
fsc,
|
|
&mds_sessions_show_fops);
|
|
|
|
fsc->debugfs_mdsc = debugfs_create_file("mdsc",
|
|
0400,
|
|
fsc->client->debugfs_dir,
|
|
fsc,
|
|
&mdsc_show_fops);
|
|
|
|
fsc->debugfs_caps = debugfs_create_file("caps",
|
|
0400,
|
|
fsc->client->debugfs_dir,
|
|
fsc,
|
|
&caps_show_fops);
|
|
}
|
|
|
|
|
|
#else /* CONFIG_DEBUG_FS */
|
|
|
|
void ceph_fs_debugfs_init(struct ceph_fs_client *fsc)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
void ceph_fs_debugfs_cleanup(struct ceph_fs_client *fsc)
|
|
{
|
|
}
|
|
|
|
#endif /* CONFIG_DEBUG_FS */
|