From patchwork Sat Jul 23 00:02:54 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sage Weil X-Patchwork-Id: 1001432 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6N08HNt032329 for ; Sat, 23 Jul 2011 00:16:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751111Ab1GWAGH (ORCPT ); Fri, 22 Jul 2011 20:06:07 -0400 Received: from cobra.newdream.net ([66.33.216.30]:44319 "EHLO cobra.newdream.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754025Ab1GWAFz (ORCPT ); Fri, 22 Jul 2011 20:05:55 -0400 Received: from localhost.localdomain (ip-64-111-111-107.dreamhost.com [64.111.111.107]) by cobra.newdream.net (Postfix) with ESMTPA id 627D1BC93C; Fri, 22 Jul 2011 17:09:38 -0700 (PDT) From: Sage Weil To: ceph-devel@vger.kernel.org Cc: Josh Durgin Subject: [PATCH 15/23] rbd: set blk_queue request sizes to object size Date: Fri, 22 Jul 2011 17:02:54 -0700 Message-Id: <1311379382-9218-16-git-send-email-sage@newdream.net> X-Mailer: git-send-email 1.7.0 In-Reply-To: <1311379382-9218-1-git-send-email-sage@newdream.net> References: <1311379382-9218-1-git-send-email-sage@newdream.net> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 23 Jul 2011 00:16:10 +0000 (UTC) From: Josh Durgin This improves performance since more requests can be merged. Signed-off-by: Josh Durgin --- drivers/block/rbd.c | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 7392d7a..15f65b5 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -630,6 +630,14 @@ static int rbd_get_num_segments(struct rbd_image_header *header, } /* + * returns the size of an object in the image + */ +static u64 rbd_obj_bytes(struct rbd_image_header *header) +{ + return 1 << header->obj_order; +} + +/* * bio helpers */ @@ -1765,6 +1773,13 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock); if (!q) goto out_disk; + + /* set io sizes to object size */ + blk_queue_max_hw_sectors(q, rbd_obj_bytes(&rbd_dev->header) / 512ULL); + blk_queue_max_segment_size(q, rbd_obj_bytes(&rbd_dev->header)); + blk_queue_io_min(q, rbd_obj_bytes(&rbd_dev->header)); + blk_queue_io_opt(q, rbd_obj_bytes(&rbd_dev->header)); + blk_queue_merge_bvec(q, rbd_merge_bvec); disk->queue = q;