Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp5078125imd; Tue, 30 Oct 2018 11:36:30 -0700 (PDT) X-Google-Smtp-Source: AJdET5etAdSo3qVAWSfxgQ/XSuOIynS/wxBK8CHD2QFvTAN8HTReLOLZ0yfxWFjbae4I+Ue9RPTX X-Received: by 2002:a63:2f07:: with SMTP id v7mr15369pgv.368.1540924589997; Tue, 30 Oct 2018 11:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540924589; cv=none; d=google.com; s=arc-20160816; b=MTiaH9VvPTRZhFvVLO5zFWQ0KWBY+qCUJRymqtNLYT9VYs+JeK/X8dXbc8q4OYvCqp Tma0fQU8z+1HwPoeRpa6RrfAPeAVFs7GdObd2zIL1ckZCwf8N4DWHQDSvy9rrSG7cuJo BmNvV8SMve9cOzt292m0DteZO01Qb/IZff4rE+QampxLYfprOitCaO3THhWUbkAjEE4H KY+9kjymDIn8Gyb3C0c7XPLuOWOlTsHcV0Udw2/I2MdtvfKKKXVvf6D2/DEtdMJ7I3Gi HJmkqPdWwum7rkJxvbS2qfUcVR5m++q/fEwuM2F7GGoN0/0pppSbk4eGi30kGPqShiR8 uPiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=Q05dSOPfwm/UowrXt9AMeUMp3mZmjRCMcDVjG5ZA724=; b=GnQAShnLfpbpSRL+oNPd/xxySNLI7FtjyfMNvnBDAsxQgz1rLZfoAWOQlR+vrKwKCu aKKiw48VNNtarnVMbTNONAJnfMVjaTBVdI+Q1Pmnria11he6LazlgS7nUULD8mqdi6Ez ffpQZsZiHBQAaI9MHVv7tW5Ov5JGgOHvryDQFH2B6zapI3u0cLhHHpyGR11BT6NERxuX cWVUhea8rUeQ9+n5UZ+kuHFWReb7POgf1bJLJwVTb9NBx8475mpTQUmQp/9qb9ey0q86 JolNYSFT8eTeZr/DbPulLDW0xEnuW8cueamsz9raajOC0w0uFEHFv2fmiOBhj8gFFwg+ Tdpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=PGNr4zA6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w13-v6si24203757pgj.229.2018.10.30.11.36.09; Tue, 30 Oct 2018 11:36:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=PGNr4zA6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728344AbeJaD2C (ORCPT + 99 others); Tue, 30 Oct 2018 23:28:02 -0400 Received: from mail-it1-f196.google.com ([209.85.166.196]:38759 "EHLO mail-it1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727876AbeJaD2C (ORCPT ); Tue, 30 Oct 2018 23:28:02 -0400 Received: by mail-it1-f196.google.com with SMTP id j9so3072407itl.3 for ; Tue, 30 Oct 2018 11:33:26 -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=Q05dSOPfwm/UowrXt9AMeUMp3mZmjRCMcDVjG5ZA724=; b=PGNr4zA6ebujuKlxOULXkMmbfq/R4beWrMw0Nu0fvrEeiA5Igow5iNHLwpY4+BzyuK 2Mw1k6TX/N3b47omYHlIDk1NlwWLJEgIYORpyDa3NwnB1J//92Y4tSJAhaLetXfAQPPu ZYcpGtPPKuFNmPSSQzA+wC/nzPBVocGc9KVRdgOGB6Kmj0GsFEiRESXyODL+7GxD4B+K FmrZJ5bTVm0QGKQ1dYN9mrH5Bf/HAUq4hQJ0Gjmcd4AQUzAWUZR8VndwB9MkNGSmYc9u ZmYrhx5TR2M0C3DubfvEAagYyAFAC9ByKjQUJ4/9YCvXCvg1w0+hFs32d4YehDSBYQc/ Cizg== 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=Q05dSOPfwm/UowrXt9AMeUMp3mZmjRCMcDVjG5ZA724=; b=MAdEJLU0OdbLTcEYwxpj6GbzWT28nDKgrgo9PZ3dE5hH6ed5yj+wFGAfvR3VQ8BiyX 1R6McD4BPyfscu/9qzOyj7duvdxg/oxL9gcil+wmeR/+KLVkmlfTw8aARYtpVNLnJi7j OC58JvQNxFxVHQ5CyGTy3w3iqp5zvWoP2SvJ/ZpJnmsal9EBFNB9pQE2Pb9RJubqk/v8 mf740YZqZsmlImG2vLyuW4sN66tZyQ9vIOz8fQpSDvFyjDfnwPJzc4JkGLOfMXt+PwJZ yODcEzDV7zUToNNg8yTrogGyk551i+yXivl9fAZf9evewuZ31tU+LfE3Lh1/GzoKbYbT pWPQ== X-Gm-Message-State: AGRZ1gLn+7o0PxEvv5UZ36yjBosrj5qWhTs6gK4ra87s5D0Ym4x6lRo6 XD1xg0oD5rz9TGQjjOTQvDzLZw== X-Received: by 2002:a24:8247:: with SMTP id t68-v6mr24622itd.68.1540924406008; Tue, 30 Oct 2018 11:33:26 -0700 (PDT) Received: from localhost.localdomain ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id o20-v6sm4895739itc.34.2018.10.30.11.33.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Oct 2018 11:33:24 -0700 (PDT) From: Jens Axboe To: linux-block@vger.kernel.org, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Jens Axboe Subject: [PATCH 15/16] block: add REQ_HIPRI and inherit it from IOCB_HIPRI Date: Tue, 30 Oct 2018 12:32:51 -0600 Message-Id: <20181030183252.17857-16-axboe@kernel.dk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181030183252.17857-1-axboe@kernel.dk> References: <20181030183252.17857-1-axboe@kernel.dk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Reviewed-by: Hannes Reinecke Signed-off-by: Jens Axboe --- 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) -- 2.17.1