From patchwork Tue Jul 19 14:02:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hannes Reinecke X-Patchwork-Id: 9237527 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EE7EC60867 for ; Tue, 19 Jul 2016 14:03:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E030627569 for ; Tue, 19 Jul 2016 14:03:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D50D5276AE; Tue, 19 Jul 2016 14:03:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61D8C27569 for ; Tue, 19 Jul 2016 14:03:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754064AbcGSODH (ORCPT ); Tue, 19 Jul 2016 10:03:07 -0400 Received: from mx2.suse.de ([195.135.220.15]:38396 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753789AbcGSODF (ORCPT ); Tue, 19 Jul 2016 10:03:05 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 41124ADD1; Tue, 19 Jul 2016 14:03:03 +0000 (UTC) From: Hannes Reinecke To: Mike Snitzer Cc: dm-devel-redhat.com@suse.de, Damien Le Moal , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Christoph Hellwig , Jens Axboe , Hannes Reinecke Subject: [PATCH 1/3] block: add flag for single-threaded submission Date: Tue, 19 Jul 2016 16:02:56 +0200 Message-Id: <1468936978-9124-2-git-send-email-hare@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1468936978-9124-1-git-send-email-hare@suse.de> References: <1468936978-9124-1-git-send-email-hare@suse.de> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some devices (most notably SMR drives) support only one I/O stream eg for ensuring ordered I/O submission. This patch adds a new block queue flag 'BLK_QUEUE_SINGLE' to support these devices. Signed-off-by: Hannes Reinecke Reviewed-by: Damien Le Moal Tested-by: Damien Le Moal --- block/blk-core.c | 2 ++ include/linux/blkdev.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 4bcf30a..ff08d77 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -320,6 +320,8 @@ inline void __blk_run_queue_uncond(struct request_queue *q) * number of active request_fn invocations such that blk_drain_queue() * can wait until all these request_fn calls have finished. */ + if (blk_queue_single(q) && q->request_fn_active) + return; q->request_fn_active++; q->request_fn(q); q->request_fn_active--; diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index c351444..2f7775a 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -539,6 +539,7 @@ struct request_queue { #define QUEUE_FLAG_WC 23 /* Write back caching */ #define QUEUE_FLAG_FUA 24 /* device supports FUA writes */ #define QUEUE_FLAG_FLUSH_NQ 25 /* flush not queueuable */ +#define QUEUE_FLAG_SINGLE 26 /* single-threaded submission only */ #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ (1 << QUEUE_FLAG_STACKABLE) | \ @@ -628,6 +629,7 @@ static inline void queue_flag_clear(unsigned int flag, struct request_queue *q) #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) #define blk_queue_secdiscard(q) (blk_queue_discard(q) && \ test_bit(QUEUE_FLAG_SECDISCARD, &(q)->queue_flags)) +#define blk_queue_single(q) test_bit(QUEUE_FLAG_SINGLE, &(q)->queue_flags) #define blk_noretry_request(rq) \ ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \