From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org,
Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: Re: [PATCH] block: export SSD/non-rotational queue flag through sysfs
Date: Mon, 05 Jan 2009 13:08:06 -0600 [thread overview]
Message-ID: <1231182486.3324.54.camel@localhost.localdomain> (raw)
In-Reply-To: <200901052002.15984.bzolnier@gmail.com>
On Mon, 2009-01-05 at 20:02 +0100, Bartlomiej Zolnierkiewicz wrote:
> On Monday 05 January 2009, Jens Axboe wrote:
> > On Mon, Jan 05 2009, Bartlomiej Zolnierkiewicz wrote:
> > > From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> > > Subject: [PATCH] block: export SSD/non-rotational queue flag through sysfs
> > >
> > > For some devices (i.e. CFA ATA) we can't reliably detect whether
> > > the device is of rotational or non-rotational type so we need to
> > > leave the final decision about this setting to the user-space.
> >
> > I agree with that, was actually planning on doing that myself.
> >
> > > @@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
> > > queue_flag_set(QUEUE_FLAG_NOMERGES, q);
> > > else
> > > queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
> > > -
> > > spin_unlock_irq(q->queue_lock);
> > > +
> > > return ret;
> > > }
> > >
> >
> > Hmm?
>
> This is just a "bonus". :)
>
> > > @@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
> > > .show = queue_hw_sector_size_show,
> > > };
> > >
> > > +static struct queue_sysfs_entry queue_nonrot_entry = {
> > > + .attr = {.name = "nonrot", .mode = S_IRUGO | S_IWUSR },
> > > + .show = queue_nonrot_show,
> > > + .store = queue_nonrot_store,
> > > +};
> > > +
> >
> > Lets please use a better name for export reasons, non-rotational is a
> > lot better. Nobody will know what nonrot means :-)
>
> Yeah...
>
> From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> Subject: [PATCH v2] block: export SSD/non-rotational queue flag through sysfs
>
> For some devices (i.e. CFA ATA) we can't reliably detect whether
> the device is of rotational or non-rotational type so we need to
> leave the final decision about this setting to the user-space.
>
> As a bonus do a minor CodingStyle fixup in queue_nomerges_store().
>
> Suggested-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
> ---
> block/blk-sysfs.c | 30 +++++++++++++++++++++++++++++-
> 1 file changed, 29 insertions(+), 1 deletion(-)
>
> Index: b/block/blk-sysfs.c
> ===================================================================
> --- a/block/blk-sysfs.c
> +++ b/block/blk-sysfs.c
> @@ -130,6 +130,27 @@ static ssize_t queue_max_hw_sectors_show
> return queue_var_show(max_hw_sectors_kb, (page));
> }
>
> +static ssize_t queue_nonrot_show(struct request_queue *q, char *page)
> +{
> + return queue_var_show(blk_queue_nonrot(q), page);
> +}
> +
> +static ssize_t queue_nonrot_store(struct request_queue *q, const char *page,
> + size_t count)
> +{
> + unsigned long nm;
> + ssize_t ret = queue_var_store(&nm, page, count);
> +
> + spin_lock_irq(q->queue_lock);
> + if (nm)
> + queue_flag_set(QUEUE_FLAG_NONROT, q);
> + else
> + queue_flag_clear(QUEUE_FLAG_NONROT, q);
> + spin_unlock_irq(q->queue_lock);
> +
> + return ret;
> +}
> +
> static ssize_t queue_nomerges_show(struct request_queue *q, char *page)
> {
> return queue_var_show(blk_queue_nomerges(q), page);
> @@ -146,8 +167,8 @@ static ssize_t queue_nomerges_store(stru
> queue_flag_set(QUEUE_FLAG_NOMERGES, q);
> else
> queue_flag_clear(QUEUE_FLAG_NOMERGES, q);
> -
> spin_unlock_irq(q->queue_lock);
> +
> return ret;
> }
>
> @@ -210,6 +231,12 @@ static struct queue_sysfs_entry queue_hw
> .show = queue_hw_sector_size_show,
> };
>
> +static struct queue_sysfs_entry queue_nonrot_entry = {
> + .attr = {.name = "non-rotational", .mode = S_IRUGO | S_IWUSR },
> + .show = queue_nonrot_show,
> + .store = queue_nonrot_store,
> +};
> +
> static struct queue_sysfs_entry queue_nomerges_entry = {
> .attr = {.name = "nomerges", .mode = S_IRUGO | S_IWUSR },
> .show = queue_nomerges_show,
> @@ -229,6 +256,7 @@ static struct attribute *default_attrs[]
> &queue_max_sectors_entry.attr,
> &queue_iosched_entry.attr,
> &queue_hw_sector_size_entry.attr,
> + &queue_nonrot_entry.attr,
> &queue_nomerges_entry.attr,
> &queue_rq_affinity_entry.attr,
> NULL,
Almost all block devices might find this useful. Ought not this flag to
be in the block layer appearing under /sys/block/<dev>?
James
next prev parent reply other threads:[~2009-01-05 19:08 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-05 18:52 [PATCH] block: export SSD/non-rotational queue flag through sysfs Bartlomiej Zolnierkiewicz
2009-01-05 18:54 ` Jens Axboe
2009-01-05 19:02 ` Bartlomiej Zolnierkiewicz
2009-01-05 19:08 ` James Bottomley [this message]
2009-01-05 19:10 ` Jens Axboe
2009-01-05 19:08 ` Jens Axboe
2009-01-05 21:47 ` Kay Sievers
2009-01-06 7:35 ` Jens Axboe
2009-01-07 10:39 ` Michael Tokarev
2009-01-07 11:19 ` Jens Axboe
2009-01-07 15:34 ` James Bottomley
2009-01-15 5:37 ` Tejun Heo
2009-01-15 15:07 ` Greg Freemyer
2009-01-15 15:46 ` Tejun Heo
2009-01-15 16:06 ` James Bottomley
2009-01-15 18:55 ` Grant Grundler
2009-01-15 19:00 ` James Bottomley
2009-01-15 22:45 ` Grant Grundler
2009-01-15 23:17 ` James Bottomley
2009-01-15 23:50 ` Hugh Dickins
2009-01-15 23:57 ` Michael Tokarev
2009-01-16 0:36 ` James Bottomley
2009-01-16 3:52 ` Dongjun Shin
2009-01-16 6:48 ` Jens Axboe
2009-01-16 6:48 ` Jens Axboe
2009-02-03 12:32 ` Pierre Ossman
2009-01-16 6:43 ` Jens Axboe
2009-01-05 18:58 ` Alan Cox
[not found] <fa.+H1UnEqOmFht/vMPmVy8ellbQi0@ifi.uio.no>
[not found] ` <fa.RLz5WOGorLui5GRkc963Ww1kXqg@ifi.uio.no>
[not found] ` <fa.x4ejZ7Kj7ZZRu88Sond1Cap6XxY@ifi.uio.no>
2009-01-05 22:18 ` Sitsofe Wheeler
2009-01-06 1:25 ` Stefan Richter
2009-01-06 19:46 ` Hugh Dickins
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=1231182486.3324.54.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=bzolnier@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@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