From patchwork Fri Jun 26 04:55:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Snitzer X-Patchwork-Id: 32507 Received: from hormel.redhat.com (hormel1.redhat.com [209.132.177.33]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5Q4uMRs005121 for ; Fri, 26 Jun 2009 04:56:22 GMT Received: from listman.util.phx.redhat.com (listman.util.phx.redhat.com [10.8.4.110]) by hormel.redhat.com (Postfix) with ESMTP id 0D334618C18; Fri, 26 Jun 2009 00:56:22 -0400 (EDT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.util.phx.redhat.com (8.13.1/8.13.1) with ESMTP id n5Q4uL4T018177 for ; Fri, 26 Jun 2009 00:56:21 -0400 Received: from mx3.redhat.com (mx3.redhat.com [172.16.48.32]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n5Q4uKtC030337 for ; Fri, 26 Jun 2009 00:56:20 -0400 Received: from mail-qy0-f180.google.com (mail-qy0-f180.google.com [209.85.221.180]) by mx3.redhat.com (8.13.8/8.13.8) with ESMTP id n5Q4tJGE027844 for ; Fri, 26 Jun 2009 00:55:20 -0400 Received: by qyk10 with SMTP id 10so1097517qyk.23 for ; Thu, 25 Jun 2009 21:55:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=2DrN8Ei4eYjeZTIGosUtK7+lSdTIVndj1i6/2j5UyiE=; b=HMrUlOIjY4tX5mP0NjRyTEdutvM2BVa0Qjot5NpXdMR3Qo8fKFRHwkkJFiFTaokcrY eoACwiCgimMdqmSFpsJ1VDV0GvVX13lNT4GhwClE7cg5VWdNvHV+D3q0yzhZxkqC1gEH 9ax8m191DC30Xv1lx6s4gC6A48yP1JYXRGpFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=G463j4zSG92YUB/SbEwFVjM7KppxwGUHbYlqLc7FJsWvX4EvC1bm4K/sWFo8hGqel4 dWBNjFrfLbDhxSDRK1JwbmSxTkYmHlViqfm7N98B43emue9AxkJeLRxLHDsF8fxj9Ur/ PEvJgS8FABeHzlRnjAumpKKog01bCSR1h8omA= Received: by 10.224.2.135 with SMTP id 7mr2749175qaj.206.1245992119697; Thu, 25 Jun 2009 21:55:19 -0700 (PDT) Received: from localhost (pool-141-157-169-195.bstnma.east.verizon.net [141.157.169.195]) by mx.google.com with ESMTPS id 5sm6254805qwg.15.2009.06.25.21.55.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 25 Jun 2009 21:55:18 -0700 (PDT) From: Mike Snitzer To: dm-devel@redhat.com Date: Fri, 26 Jun 2009 00:55:15 -0400 Message-Id: <1245992116-28947-1-git-send-email-snitzer@gmail.com> X-RedHat-Spam-Score: 0 X-Scanned-By: MIMEDefang 2.58 on 172.16.52.254 X-Scanned-By: MIMEDefang 2.63 on 172.16.48.32 X-loop: dm-devel@redhat.com Cc: martin.petersen@oracle.com Subject: [dm-devel] [RFC][PATCH 1/2] block: add blk_limits_io_min() and stack io_opt X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.5 Precedence: junk Reply-To: device-mapper development List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com Introduce blk_limits_io_min() and make blk_queue_io_min() call it. blk_stack_limits() doesn't stack io_opt and DM needs it to. --- block/blk-settings.c | 32 +++++++++++++++++++++++++------- include/linux/blkdev.h | 1 + 2 files changed, 26 insertions(+), 7 deletions(-) -- dm-devel mailing list dm-devel@redhat.com https://www.redhat.com/mailman/listinfo/dm-devel Index: linux-2.6/block/blk-settings.c =================================================================== --- linux-2.6.orig/block/blk-settings.c 2009-06-26 00:39:22.000000000 -0400 +++ linux-2.6/block/blk-settings.c 2009-06-26 00:40:35.000000000 -0400 @@ -377,6 +377,29 @@ EXPORT_SYMBOL(blk_queue_alignment_offset); /** + * blk_limits_io_min - set minimum request size for a device + * @limits: the queue limits + * @min: smallest I/O size in bytes + * + * Description: + * Some devices have an internal block size bigger than the reported + * hardware sector size. This function can be used to signal the + * smallest I/O the device can perform without incurring a performance + * penalty. + */ +void blk_limits_io_min(struct queue_limits *limits, unsigned int min) +{ + limits->io_min = min; + + if (limits->io_min < limits->logical_block_size) + limits->io_min = limits->logical_block_size; + + if (limits->io_min < limits->physical_block_size) + limits->io_min = limits->physical_block_size; +} +EXPORT_SYMBOL(blk_limits_io_min); + +/** * blk_queue_io_min - set minimum request size for the queue * @q: the request queue for the device * @min: smallest I/O size in bytes @@ -389,13 +412,7 @@ */ void blk_queue_io_min(struct request_queue *q, unsigned int min) { - q->limits.io_min = min; - - if (q->limits.io_min < q->limits.logical_block_size) - q->limits.io_min = q->limits.logical_block_size; - - if (q->limits.io_min < q->limits.physical_block_size) - q->limits.io_min = q->limits.physical_block_size; + blk_limits_io_min(&q->limits, min); } EXPORT_SYMBOL(blk_queue_io_min); @@ -496,6 +513,7 @@ b->physical_block_size); t->io_min = max(t->io_min, b->io_min); + t->io_opt = min_not_zero(t->io_opt, b->io_opt); t->no_cluster |= b->no_cluster; /* Bottom device offset aligned? */ Index: linux-2.6/include/linux/blkdev.h =================================================================== --- linux-2.6.orig/include/linux/blkdev.h 2009-06-26 00:39:22.000000000 -0400 +++ linux-2.6/include/linux/blkdev.h 2009-06-26 00:40:35.000000000 -0400 @@ -924,6 +924,7 @@ extern void blk_queue_physical_block_size(struct request_queue *, unsigned short); extern void blk_queue_alignment_offset(struct request_queue *q, unsigned int alignment); +extern void blk_limits_io_min(struct queue_limits *limits, unsigned int min); extern void blk_queue_io_min(struct request_queue *q, unsigned int min); extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt); extern void blk_set_default_limits(struct queue_limits *lim);