All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mandeep Singh Baines <msb@chromium.org>
Cc: linux-kernel@vger.kernel.org, jrbarnette@chromium.org,
	Neil Brown <neilb@suse.de>, Jens Axboe <jaxboe@fusionio.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Alasdair G Kergon <agk@redhat.com>,
	dm-devel@redhat.com
Subject: Re: dm: pass up rotational flag
Date: Thu, 26 May 2011 14:23:21 -0400	[thread overview]
Message-ID: <20110526182321.GA26219@redhat.com> (raw)
In-Reply-To: <1306356648-30730-1-git-send-email-msb@chromium.org>

On Wed, May 25 2011 at  4:50pm -0400,
Mandeep Singh Baines <msb@chromium.org> wrote:

> Allow the NONROT flag to be passed through to linear mappings if all
> underlying device are non-rotational. Tools like ureadahead will
> schedule IOs differently based on the rotational flag.
> 
> With this patch, I see boot time go from 7.75 s to 7.46 s on my device.
> 
> Suggested-by: J. Richard Barnette <jrbarnette@chromium.org>
> Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
> Cc: Neil Brown <neilb@suse.de>
> Cc: Mike Snitzer <snitzer@redhat.com>
> Cc: Jens Axboe <jaxboe@fusionio.com>
> Cc: Martin K. Petersen <martin.petersen@oracle.com>
> Cc: Alasdair G Kergon <agk@redhat.com>
> Cc: dm-devel@redhat.com

Thanks for doing this, looks good in general.

Just a few small nits:
 - rename device_nonrot to device_is_nonrot
 - rename dm_table_all_nonrot to dm_table_is_nonrot
 - add missing whitespace in dm_table_set_restrictions
 - move ti declaration outside of dm_table_is_nonrot's while loop
 - dm doesn't use 'true' or 'false' bool returns even though we have
   functions that return bool -- odd but best to keep consistent for now

I'll respond with v2 that folds these changes in and my Signed-off-by
---
 drivers/md/dm-table.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
index 40c6071..a173828 100644
--- a/drivers/md/dm-table.c
+++ b/drivers/md/dm-table.c
@@ -1177,28 +1177,29 @@ static void dm_table_set_integrity(struct dm_table *t)
 			       blk_get_integrity(template_disk));
 }
 
-static int device_nonrot(struct dm_target *ti, struct dm_dev *dev,
-			       sector_t start, sector_t len, void *data)
+static int device_is_nonrot(struct dm_target *ti, struct dm_dev *dev,
+			    sector_t start, sector_t len, void *data)
 {
 	struct request_queue *q = bdev_get_queue(dev->bdev);
 
 	return q && blk_queue_nonrot(q);
 }
 
-static bool dm_table_all_nonrot(struct dm_table *t)
+static bool dm_table_is_nonrot(struct dm_table *t)
 {
+	struct dm_target *ti;
 	unsigned i = 0;
 
 	/* Ensure that all underlying device are non rotational. */
 	while (i < dm_table_get_num_targets(t)) {
-		struct dm_target *ti = dm_table_get_target(t, i++);
+		ti = dm_table_get_target(t, i++);
 
 		if (!ti->type->iterate_devices ||
-		    !ti->type->iterate_devices(ti, device_nonrot, NULL))
-			return false;
+		    !ti->type->iterate_devices(ti, device_is_nonrot, NULL))
+			return 0;
 	}
 
-	return true;
+	return 1;
 }
 
 void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
@@ -1213,7 +1214,8 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
 		queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, q);
 	else
 		queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
-	if (!dm_table_all_nonrot(t))
+
+	if (!dm_table_is_nonrot(t))
 		queue_flag_clear_unlocked(QUEUE_FLAG_NONROT, q);
 	else
 		queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q);

  reply	other threads:[~2011-05-26 18:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 20:50 [PATCH] dm: pass up rotational flag Mandeep Singh Baines
2011-05-26 18:23 ` Mike Snitzer [this message]
2011-05-26 18:29   ` Martin K. Petersen
2011-05-26 18:43     ` Mike Snitzer
2011-05-26 18:48       ` Martin K. Petersen
2011-05-26 19:14     ` Jens Axboe
2011-05-27  2:42       ` Martin K. Petersen
2011-05-27  2:42         ` [PATCH 1/3] block: Introduce blk_set_stacking_limits function Martin K. Petersen
2011-05-27 13:03           ` Mike Snitzer
2011-05-27  2:42         ` [PATCH 2/3] block: Move non-rotational flag to queue limits Martin K. Petersen
2011-05-27 13:02           ` Mike Snitzer
2011-05-31  2:19             ` Martin K. Petersen
2011-05-31 12:49               ` Mike Snitzer
2011-05-31 13:14               ` Jens Axboe
2011-05-31 14:28                 ` Martin K. Petersen
2011-05-31 14:28                   ` Martin K. Petersen
2011-05-31 14:43                   ` Jens Axboe
2011-05-27  2:42         ` [PATCH 3/3] block: Move discard and secure discard flags " Martin K. Petersen
2011-05-27 13:39           ` Mike Snitzer
2011-05-31  2:22             ` Martin K. Petersen
2011-07-13 15:46               ` Mike Snitzer
2011-05-27 16:20           ` Mandeep Singh Baines
2011-05-26 18:35 ` [PATCH v2] dm: pass up non-rotational flag Mike Snitzer

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=20110526182321.GA26219@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=jaxboe@fusionio.com \
    --cc=jrbarnette@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=msb@chromium.org \
    --cc=neilb@suse.de \
    /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 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.