util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Milan Broz <mbroz@redhat.com>
To: util-linux@vger.kernel.org
Cc: Milan Broz <mbroz@redhat.com>
Subject: [PATCH] lsblk: add read-ahead column.
Date: Tue, 24 Jul 2012 16:34:33 +0200	[thread overview]
Message-ID: <1343140473-15035-1-git-send-email-mbroz@redhat.com> (raw)


Signed-off-by: Milan Broz <mbroz@redhat.com>
---
 misc-utils/lsblk.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index b459728..cb2b768 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -73,6 +73,7 @@ enum {
 	COL_UUID,
 	COL_PARTLABEL,
 	COL_PARTUUID,
+	COL_RA,
 	COL_RO,
 	COL_RM,
 	COL_MODEL,
@@ -117,6 +118,7 @@ static struct colinfo infos[] = {
 	[COL_PARTLABEL] = { "PARTLABEL", 0.1, 0, N_("partition LABEL") },
 	[COL_PARTUUID]  = { "PARTUUID",  36,  0, N_("partition UUID") },
 
+	[COL_RA]     = { "RA",      4, TT_FL_RIGHT, N_("read-ahead of the device") },
 	[COL_RO]     = { "RO",      1, TT_FL_RIGHT, N_("read-only device") },
 	[COL_RM]     = { "RM",      1, TT_FL_RIGHT, N_("removable device") },
 	[COL_ROTA]   = { "ROTA",    1, TT_FL_RIGHT, N_("rotational device") },
@@ -643,6 +645,11 @@ static void set_tt_data(struct blkdev_cxt *cxt, int col, int id, struct tt_line
 		if (cxt->uuid)
 			tt_line_set_data(ln, col, xstrdup(cxt->partuuid));
 		break;
+	case COL_RA:
+		p = sysfs_strdup(&cxt->sysfs, "queue/read_ahead_kb");
+		if (p)
+			tt_line_set_data(ln, col, p);
+		break;
 	case COL_RO:
 		tt_line_set_data(ln, col, is_readonly_device(cxt) ?
 					xstrdup("1") : xstrdup("0"));
@@ -1333,6 +1340,7 @@ int main(int argc, char *argv[])
 			columns[ncolumns++] = COL_ROTA;
 			columns[ncolumns++] = COL_SCHED;
 			columns[ncolumns++] = COL_RQ_SIZE;
+			columns[ncolumns++] = COL_RA;
 			break;
 		case 'V':
 			printf(_("%s from %s\n"), program_invocation_short_name,
-- 
1.7.10.4


             reply	other threads:[~2012-07-24 14:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-24 14:34 Milan Broz [this message]
2012-07-26  9:45 ` [PATCH] lsblk: add read-ahead column Karel Zak

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=1343140473-15035-1-git-send-email-mbroz@redhat.com \
    --to=mbroz@redhat.com \
    --cc=util-linux@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).