From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CFB0C433E1 for ; Thu, 18 Jun 2020 14:44:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 12D5520888 for ; Thu, 18 Jun 2020 14:44:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel-dk.20150623.gappssmtp.com header.i=@kernel-dk.20150623.gappssmtp.com header.b="XjGUImD9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 12D5520888 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.dk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 3AB238D0012; Thu, 18 Jun 2020 10:44:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A6858D0018; Thu, 18 Jun 2020 10:44:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 11F458D0019; Thu, 18 Jun 2020 10:44:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0253.hostedemail.com [216.40.44.253]) by kanga.kvack.org (Postfix) with ESMTP id E9CB68D0018 for ; Thu, 18 Jun 2020 10:44:02 -0400 (EDT) Received: from smtpin21.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id A505C6CA7 for ; Thu, 18 Jun 2020 14:44:02 +0000 (UTC) X-FDA: 76942602324.21.idea97_0504bd326e11 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin21.hostedemail.com (Postfix) with ESMTP id 73451180442CD for ; Thu, 18 Jun 2020 14:44:02 +0000 (UTC) X-HE-Tag: idea97_0504bd326e11 X-Filterd-Recvd-Size: 4695 Received: from mail-pj1-f65.google.com (mail-pj1-f65.google.com [209.85.216.65]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Thu, 18 Jun 2020 14:44:01 +0000 (UTC) Received: by mail-pj1-f65.google.com with SMTP id jz3so2649876pjb.0 for ; Thu, 18 Jun 2020 07:44:01 -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:reply-to :mime-version:content-transfer-encoding; bh=AMBC//GM9TUmKqc/Ee7MUTX4MVxXaivvBIm8XTKWtjI=; b=XjGUImD9rS9VeH3ATYR5UN46KsG/kGd5i8ObOVULAJ3bWbAHLUKz+Nt/bzRQeCC7k+ q4pmWPc7rGRsnlJnmLarBBAj7QbxKCn+OtJBti2v/itk1DKcuvDFfV26CpsOgPwwVj46 oKdSZT+E6O3bgsFXk2UysYjSDRy6zj4yUK78Rv1eqtIwgcAQ5nn/tpiH68Y8GD4/iHUw 3O1/2ihPs06whdoc10VZDpvDnnO0QVgM3L+4vMq/X6KTuGPCEjHx9ydMZTrOPjVK9Bkv Qkf+MhMg3TkdzkCd8QX51qCa7+tmj/0j1O1H3Kj4Zv1sGjsxfa6mxtY9/zGOSIjiER3+ piRw== 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:reply-to:mime-version:content-transfer-encoding; bh=AMBC//GM9TUmKqc/Ee7MUTX4MVxXaivvBIm8XTKWtjI=; b=g3m9aYgusAYeFsf5SIOoliQuQDHTG+qxc/Ix69i4IUb+h2dNOc0Q6qrhuCWIqFlDXX B12PKOKmC+4tI5UqlHW26UMiHOMBhgoDlEPX9zgaBzj/FgvhwgJaYhDEqrKJSVDYnqdB lslnbEQovbdXGZ0fUE+jW7XBf1/ngGx8fOLaqZrx2L3KZH/l5YR/D/v+CrXWI3zaFtZ3 nI3MlWT0MG11txnSt5nH11I+6rvMpoxeCnZUg50BaXzgg7Mj2WsG1oFw69iwL3R0HKt2 yN37fWqY7vX6jBE80XILcAPta/hax+zzLfywjM3AfMH4MRgXubao0QMuf72MivfcInC6 VrHA== X-Gm-Message-State: AOAM532rPJRx/uM6WYFoCRpd/j9lC+pul90YUKwCsQC7+uJnTIVEzT3T SnLoPJlz4ldwwuTcIFhkb30hHg== X-Google-Smtp-Source: ABdhPJxPg9RpVdrGQ4Z6ww3Iq/Db4vGVv54cHwt8FNsBk1NOsUw3hrbUnoL/Xc/AmyjDRE+S7btjoQ== X-Received: by 2002:a17:90b:3004:: with SMTP id hg4mr5050010pjb.208.1592491440947; Thu, 18 Jun 2020 07:44:00 -0700 (PDT) Received: from x1.localdomain ([65.144.74.34]) by smtp.gmail.com with ESMTPSA id g9sm3127197pfm.151.2020.06.18.07.44.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2020 07:44:00 -0700 (PDT) From: Jens Axboe To: io-uring@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, Jens Axboe Subject: [PATCH 01/15] block: provide plug based way of signaling forced no-wait semantics Date: Thu, 18 Jun 2020 08:43:41 -0600 Message-Id: <20200618144355.17324-2-axboe@kernel.dk> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200618144355.17324-1-axboe@kernel.dk> References: <20200618144355.17324-1-axboe@kernel.dk> Reply-To: "[PATCHSET v7 0/15]"@smtpin21.hostedemail.com, Add@smtpin21.hostedemail.com, support@smtpin21.hostedemail.com, for@smtpin21.hostedemail.com, async@smtpin21.hostedemail.com, buffered@smtpin21.hostedemail.com, reads@smtpin21.hostedemail.com MIME-Version: 1.0 X-Rspamd-Queue-Id: 73451180442CD X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam03 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Provide a way for the caller to specify that IO should be marked with REQ_NOWAIT to avoid blocking on allocation. Signed-off-by: Jens Axboe --- block/blk-core.c | 6 ++++++ include/linux/blkdev.h | 1 + 2 files changed, 7 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 03252af8c82c..62a4904db921 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -958,6 +958,7 @@ generic_make_request_checks(struct bio *bio) struct request_queue *q; int nr_sectors =3D bio_sectors(bio); blk_status_t status =3D BLK_STS_IOERR; + struct blk_plug *plug; char b[BDEVNAME_SIZE]; =20 might_sleep(); @@ -971,6 +972,10 @@ generic_make_request_checks(struct bio *bio) goto end_io; } =20 + plug =3D blk_mq_plug(q, bio); + if (plug && plug->nowait) + bio->bi_opf |=3D REQ_NOWAIT; + /* * For a REQ_NOWAIT based request, return -EOPNOTSUPP * if queue is not a request based queue. @@ -1800,6 +1805,7 @@ void blk_start_plug(struct blk_plug *plug) INIT_LIST_HEAD(&plug->cb_list); plug->rq_count =3D 0; plug->multiple_queues =3D false; + plug->nowait =3D false; =20 /* * Store ordering should not be needed here, since a potential diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 8fd900998b4e..6e067dca94cf 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -1189,6 +1189,7 @@ struct blk_plug { struct list_head cb_list; /* md requires an unplug callback */ unsigned short rq_count; bool multiple_queues; + bool nowait; }; #define BLK_MAX_REQUEST_COUNT 16 #define BLK_PLUG_FLUSH_SIZE (128 * 1024) --=20 2.27.0