From patchwork Thu Oct 25 21:16:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 10656623 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BEF7B14BB for ; Thu, 25 Oct 2018 21:16:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B43552C463 for ; Thu, 25 Oct 2018 21:16:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8BC72C64C; Thu, 25 Oct 2018 21:16:58 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,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 428292C463 for ; Thu, 25 Oct 2018 21:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727265AbeJZFvQ (ORCPT ); Fri, 26 Oct 2018 01:51:16 -0400 Received: from mail-it1-f195.google.com ([209.85.166.195]:39732 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726787AbeJZFvP (ORCPT ); Fri, 26 Oct 2018 01:51:15 -0400 Received: by mail-it1-f195.google.com with SMTP id m15so3638044itl.4 for ; Thu, 25 Oct 2018 14:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=CTndW+ydMvjIYJPp2VM7s8ScaVMNyi9JLS8YD+G2YV8=; b=Z2wogridZpYlV9D08IE7twqDvFrZ7LMkNQN7pLGanoXmfAIkfLeVmP54OvxI5Q/NeR Cvi9Q+1Otcz6bX1RvfWLxEsly0hupKiS2Hb/h5DMKVTLpC7g4uiYD9KrVn/qAQBzDsOg WTllg1sE+UQUzrnphA2FSaDmejAz2VFKIgbC7Z3dVoD6zurzydx7REfZYlgto5prgCsr N3Hw0uLcLHP3ZseDSoejIhOfrJuSUSufm+0wMJCSNdfZjBuxvbsNrRjF0qm6t+tmFAZ5 R4JE/nBVSL1FY0n6GNk4txgb9HjRndm09tSUwH8WhxU7NsPiWgScr6qnZkxfZCM2+9PK HwJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=CTndW+ydMvjIYJPp2VM7s8ScaVMNyi9JLS8YD+G2YV8=; b=WZh+YH00iVbg7Sw8TBCoW6p69kkM10TwKXfO7DKOT6CjH6KynqCnN48TV5XKLiMoyi QbpX/4itAwlJM+WDf1N3692eJaG3QIBkb27hXZrQ/ez4Na7fo+/9QtSJ35IKexVt+8Pn MVrAUe5xJDQK2YRqBWjP+5ia6/0ekuedsXIW6Pkh9P/zQAALhlPNtzpo7cFDGBwukRS/ o/aGkp1Z9bCoQwnQVKgrLDnyTCOBUcFiBmmoemyKBosf04SRrL0yepbp+/t5g5C5Vr71 7qVvK+P1Sfg/ckbOGKQex+exssrn3Je3Lojl5nkxS744CkO3ORDZTFIyaYAAgffkVn4+ fcnA== X-Gm-Message-State: AGRZ1gKryDoaVIKikg7K8iN8mS1OHTUxIvgQk5VZBG6WXPJgg5tIA2xq TbQr/WamLDwQwWKYKt/6avhquK1aPRdS5A== X-Google-Smtp-Source: AJdET5d918N+mGfbQQrotwG1pgdy0KGRXY6RNw85MVjlfS3TwHJ8TKqmdnbqnLaLK9RV/5JTVMdLoA== X-Received: by 2002:a24:b047:: with SMTP id b7-v6mr1879795itj.87.1540502215774; Thu, 25 Oct 2018 14:16:55 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id l23-v6sm2831890ioj.40.2018.10.25.14.16.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Oct 2018 14:16:53 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Jens Axboe Subject: [PATCH 13/14] block: add REQ_HIPRI and inherit it from IOCB_HIPRI Date: Thu, 25 Oct 2018 15:16:25 -0600 Message-Id: <20181025211626.12692-14-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025211626.12692-1-axboe@kernel.dk> References: <20181025211626.12692-1-axboe@kernel.dk> 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 We use IOCB_HIPRI to poll for IO in the caller instead of scheduling. This information is not available for (or after) IO submission. The driver may make different queue choices based on the type of IO, so make the fact that we will poll for this IO known to the lower layers as well. Signed-off-by: Jens Axboe Reviewed-by: Hannes Reinecke --- fs/block_dev.c | 2 ++ fs/direct-io.c | 2 ++ fs/iomap.c | 9 ++++++++- include/linux/blk_types.h | 4 +++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 38b8ce05cbc7..8bb8090c57a7 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -232,6 +232,8 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter, bio.bi_opf = dio_bio_write_op(iocb); task_io_account_write(ret); } + if (iocb->ki_flags & IOCB_HIPRI) + bio.bi_opf |= REQ_HIPRI; qc = submit_bio(&bio); for (;;) { diff --git a/fs/direct-io.c b/fs/direct-io.c index 093fb54cd316..ffb46b7aa5f7 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -1265,6 +1265,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, } else { dio->op = REQ_OP_READ; } + if (iocb->ki_flags & IOCB_HIPRI) + dio->op_flags |= REQ_HIPRI; /* * For AIO O_(D)SYNC writes we need to defer completions to a workqueue diff --git a/fs/iomap.c b/fs/iomap.c index ec15cf2ec696..50ad8c8d1dcb 100644 --- a/fs/iomap.c +++ b/fs/iomap.c @@ -1554,6 +1554,7 @@ iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos, unsigned len) { struct page *page = ZERO_PAGE(0); + int flags = REQ_SYNC | REQ_IDLE; struct bio *bio; bio = bio_alloc(GFP_KERNEL, 1); @@ -1562,9 +1563,12 @@ iomap_dio_zero(struct iomap_dio *dio, struct iomap *iomap, loff_t pos, bio->bi_private = dio; bio->bi_end_io = iomap_dio_bio_end_io; + if (dio->iocb->ki_flags & IOCB_HIPRI) + flags |= REQ_HIPRI; + get_page(page); __bio_add_page(bio, page, len, 0); - bio_set_op_attrs(bio, REQ_OP_WRITE, REQ_SYNC | REQ_IDLE); + bio_set_op_attrs(bio, REQ_OP_WRITE, flags); atomic_inc(&dio->ref); return submit_bio(bio); @@ -1663,6 +1667,9 @@ iomap_dio_bio_actor(struct inode *inode, loff_t pos, loff_t length, bio_set_pages_dirty(bio); } + if (dio->iocb->ki_flags & IOCB_HIPRI) + bio->bi_opf |= REQ_HIPRI; + iov_iter_advance(dio->submit.iter, n); dio->size += n; diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index 093a818c5b68..d6c2558d6b73 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -322,6 +322,8 @@ enum req_flag_bits { /* command specific flags for REQ_OP_WRITE_ZEROES: */ __REQ_NOUNMAP, /* do not free blocks when zeroing */ + __REQ_HIPRI, + /* for driver use */ __REQ_DRV, __REQ_SWAP, /* swapping request. */ @@ -342,8 +344,8 @@ enum req_flag_bits { #define REQ_RAHEAD (1ULL << __REQ_RAHEAD) #define REQ_BACKGROUND (1ULL << __REQ_BACKGROUND) #define REQ_NOWAIT (1ULL << __REQ_NOWAIT) - #define REQ_NOUNMAP (1ULL << __REQ_NOUNMAP) +#define REQ_HIPRI (1ULL << __REQ_HIPRI) #define REQ_DRV (1ULL << __REQ_DRV) #define REQ_SWAP (1ULL << __REQ_SWAP)