From: Dave Chinner <david@fromorbit.com>
To: Brian Foster <bfoster@redhat.com>
Cc: xfs@oss.sgi.com
Subject: Re: [PATCH 5/6] xfs: add log attributes for log lsn and grant head data
Date: Thu, 26 Jun 2014 14:52:56 +1000 [thread overview]
Message-ID: <20140626045256.GY4453@dastard> (raw)
In-Reply-To: <1402060414-22075-6-git-send-email-bfoster@redhat.com>
On Fri, Jun 06, 2014 at 09:13:33AM -0400, Brian Foster wrote:
> Create log attributes to export the current runtime state of the log to
> sysfs. Note that the filesystem should be frozen for consistency across
> attributes.
>
> The following per-mount attributes are created: log_head_lsn,
> log_tail_lsn, reserve_grant_head and write_grant_head. These represent
> the physical log head, tail and reserve and write grant heads
> respectively. Attribute values are exported in the following format:
>
> "cycle:[block,byte]"
>
> ... where cycle represents the log cycle and [block,bytes] represents
> either the basic block or byte offset of the log, depending on the
> attribute. Log sequence number (LSN) values are encoded in basic blocks
> and grant heads are encoded in bytes. All values are in decimal format.
>
> Signed-off-by: Brian Foster <bfoster@redhat.com>
> ---
> fs/xfs/xfs_sysfs.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 66 insertions(+)
>
> diff --git a/fs/xfs/xfs_sysfs.c b/fs/xfs/xfs_sysfs.c
> index f837527..fbd82d5 100644
> --- a/fs/xfs/xfs_sysfs.c
> +++ b/fs/xfs/xfs_sysfs.c
> @@ -23,6 +23,9 @@
> #include "xfs_trans_resv.h"
> #include "xfs_ag.h"
> #include "xfs_mount.h"
> +#include "xfs_log_format.h"
> +#include "xfs_log.h"
> +#include "xfs_log_priv.h"
>
> struct xfs_sysfs_attr {
> struct attribute attr;
> @@ -57,7 +60,70 @@ struct kobj_type xfs_mp_ktype = {
>
> /* xlog */
>
> +STATIC ssize_t
> +log_head_lsn_show(
> + char *buf,
> + void *data)
> +{
> + struct xlog *log = data;
> + int ret;
> +
> + spin_lock(&log->l_icloglock);
> + ret = snprintf(buf, PAGE_SIZE, "%d:%d\n", log->l_curr_cycle,
> + log->l_curr_block);
> + spin_unlock(&log->l_icloglock);
I'd keep the snprintf() outside the iclog lock, just so sampling
perturbs behaviour as little as possible. i.e. use cycle/block
locals as per all the others.
Otherwise, looks good.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2014-06-26 4:53 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 13:13 [PATCH 0/6] xfs sysfs support Brian Foster
2014-06-06 13:13 ` [PATCH 1/6] xfs: fix a couple error sequence jumps in xfs_mountfs() Brian Foster
2014-06-26 4:10 ` Dave Chinner
2014-06-06 13:13 ` [PATCH 2/6] xfs: add a sysfs kset Brian Foster
2014-06-26 4:13 ` Dave Chinner
2014-06-06 13:13 ` [PATCH 3/6] xfs: add xfs_mount sysfs kobject Brian Foster
2014-06-26 4:29 ` Dave Chinner
2014-06-06 13:13 ` [PATCH 4/6] xfs: add xlog sysfs kobject and attribute handlers Brian Foster
2014-06-26 4:47 ` Dave Chinner
2014-06-26 12:28 ` Brian Foster
2014-06-26 13:41 ` Brian Foster
2014-06-06 13:13 ` [PATCH 5/6] xfs: add log attributes for log lsn and grant head data Brian Foster
2014-06-26 4:52 ` Dave Chinner [this message]
2014-06-26 12:29 ` Brian Foster
2014-06-06 13:13 ` [PATCH 6/6] xfs: document log sysfs attributes in testing ABI Brian Foster
2014-06-26 5:03 ` Dave Chinner
2014-06-26 12:30 ` Brian Foster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140626045256.GY4453@dastard \
--to=david@fromorbit.com \
--cc=bfoster@redhat.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox