All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lsblk: add read-ahead column.
@ 2012-07-24 14:34 Milan Broz
  2012-07-26  9:45 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Milan Broz @ 2012-07-24 14:34 UTC (permalink / raw)
  To: util-linux; +Cc: Milan Broz


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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lsblk: add read-ahead column.
  2012-07-24 14:34 [PATCH] lsblk: add read-ahead column Milan Broz
@ 2012-07-26  9:45 ` Karel Zak
  0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2012-07-26  9:45 UTC (permalink / raw)
  To: Milan Broz; +Cc: util-linux

On Tue, Jul 24, 2012 at 04:34:33PM +0200, Milan Broz wrote:
>  misc-utils/lsblk.c |    8 ++++++++
>  1 file changed, 8 insertions(+)

Applied, thanks.

> @@ -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;

So -t output has been changed... I have added to the man page:

  The default output as well as default output from options like
  --topology and --fs is subject to change, so whenever possible you
  should  avoid using  default  outputs  in  your scripts.  Always
  explicitly  define  expected columns by '--output columns' in
  environment where a stable output is required.

it seems that we need this in all our new utils (findmnt, lslocks,
partx, ...) where is --output option. I think it's good idea to force
users to write robust scripts :-)

Comments?

    Karel


-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-26  9:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-24 14:34 [PATCH] lsblk: add read-ahead column Milan Broz
2012-07-26  9:45 ` Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.