summaryrefslogtreecommitdiff
path: root/fs/gfs2/sys.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 20:33:35 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2021-04-29 20:33:35 +0300
commitf2c80837e27e67e91ad93f41f0849be28b808b14 (patch)
tree892112731da08a2ae97be1f39ede5f88499ea08b /fs/gfs2/sys.c
parent8ae8932c6a330790c6bf22a43a6960118c34dcb5 (diff)
parente5966cf20f0c7e40fd8c208ba1614e1a35a8deee (diff)
downloadlinux-f2c80837e27e67e91ad93f41f0849be28b808b14.tar.xz
Merge tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2
Pull gfs2 updates from Andreas Gruenbacher: - Fix some compiler and kernel-doc warnings - Various minor cleanups and optimizations - Add a new sysfs gfs2 status file with some filesystem wide information * tag 'gfs2-for-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2: gfs2: Fix fall-through warnings for Clang gfs2: Fix a number of kernel-doc warnings gfs2: Make gfs2_setattr_simple static gfs2: Add new sysfs file for gfs2 status gfs2: Silence possible null pointer dereference warning gfs2: Turn gfs2_meta_indirect_buffer into gfs2_meta_buffer gfs2: Replace gfs2_lblk_to_dblk with gfs2_get_extent gfs2: Turn gfs2_extent_map into gfs2_{get,alloc}_extent gfs2: Add new gfs2_iomap_get helper gfs2: Remove unused variable sb_format gfs2: Fix dir.c function parameter descriptions gfs2: Eliminate gh parameter from go_xmote_bh func gfs2: don't create empty buffers for NO_CREATE
Diffstat (limited to 'fs/gfs2/sys.c')
-rw-r--r--fs/gfs2/sys.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index c3e72dba7418..c0a34d9ddee4 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -63,6 +63,71 @@ static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
MAJOR(sdp->sd_vfs->s_dev), MINOR(sdp->sd_vfs->s_dev));
}
+static ssize_t status_show(struct gfs2_sbd *sdp, char *buf)
+{
+ unsigned long f = sdp->sd_flags;
+ ssize_t s;
+
+ s = snprintf(buf, PAGE_SIZE,
+ "Journal Checked: %d\n"
+ "Journal Live: %d\n"
+ "Journal ID: %d\n"
+ "Spectator: %d\n"
+ "Withdrawn: %d\n"
+ "No barriers: %d\n"
+ "No recovery: %d\n"
+ "Demote: %d\n"
+ "No Journal ID: %d\n"
+ "Mounted RO: %d\n"
+ "RO Recovery: %d\n"
+ "Skip DLM Unlock: %d\n"
+ "Force AIL Flush: %d\n"
+ "FS Frozen: %d\n"
+ "Withdrawing: %d\n"
+ "Withdraw In Prog: %d\n"
+ "Remote Withdraw: %d\n"
+ "Withdraw Recovery: %d\n"
+ "sd_log_error: %d\n"
+ "sd_log_flush_lock: %d\n"
+ "sd_log_num_revoke: %u\n"
+ "sd_log_in_flight: %d\n"
+ "sd_log_blks_needed: %d\n"
+ "sd_log_blks_free: %d\n"
+ "sd_log_flush_head: %d\n"
+ "sd_log_flush_tail: %d\n"
+ "sd_log_blks_reserved: %d\n"
+ "sd_log_revokes_available: %d\n",
+ test_bit(SDF_JOURNAL_CHECKED, &f),
+ test_bit(SDF_JOURNAL_LIVE, &f),
+ (sdp->sd_jdesc ? sdp->sd_jdesc->jd_jid : 0),
+ (sdp->sd_args.ar_spectator ? 1 : 0),
+ test_bit(SDF_WITHDRAWN, &f),
+ test_bit(SDF_NOBARRIERS, &f),
+ test_bit(SDF_NORECOVERY, &f),
+ test_bit(SDF_DEMOTE, &f),
+ test_bit(SDF_NOJOURNALID, &f),
+ (sb_rdonly(sdp->sd_vfs) ? 1 : 0),
+ test_bit(SDF_RORECOVERY, &f),
+ test_bit(SDF_SKIP_DLM_UNLOCK, &f),
+ test_bit(SDF_FORCE_AIL_FLUSH, &f),
+ test_bit(SDF_FS_FROZEN, &f),
+ test_bit(SDF_WITHDRAWING, &f),
+ test_bit(SDF_WITHDRAW_IN_PROG, &f),
+ test_bit(SDF_REMOTE_WITHDRAW, &f),
+ test_bit(SDF_WITHDRAW_RECOVERY, &f),
+ sdp->sd_log_error,
+ rwsem_is_locked(&sdp->sd_log_flush_lock),
+ sdp->sd_log_num_revoke,
+ atomic_read(&sdp->sd_log_in_flight),
+ atomic_read(&sdp->sd_log_blks_needed),
+ atomic_read(&sdp->sd_log_blks_free),
+ sdp->sd_log_flush_head,
+ sdp->sd_log_flush_tail,
+ sdp->sd_log_blks_reserved,
+ atomic_read(&sdp->sd_log_revokes_available));
+ return s;
+}
+
static ssize_t fsname_show(struct gfs2_sbd *sdp, char *buf)
{
return snprintf(buf, PAGE_SIZE, "%s\n", sdp->sd_fsname);
@@ -283,6 +348,7 @@ GFS2_ATTR(quota_sync, 0200, NULL, quota_sync_store);
GFS2_ATTR(quota_refresh_user, 0200, NULL, quota_refresh_user_store);
GFS2_ATTR(quota_refresh_group, 0200, NULL, quota_refresh_group_store);
GFS2_ATTR(demote_rq, 0200, NULL, demote_rq_store);
+GFS2_ATTR(status, 0400, status_show, NULL);
static struct attribute *gfs2_attrs[] = {
&gfs2_attr_id.attr,
@@ -295,6 +361,7 @@ static struct attribute *gfs2_attrs[] = {
&gfs2_attr_quota_refresh_user.attr,
&gfs2_attr_quota_refresh_group.attr,
&gfs2_attr_demote_rq.attr,
+ &gfs2_attr_status.attr,
NULL,
};
ATTRIBUTE_GROUPS(gfs2);