From patchwork Fri Sep 24 17:18:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 12516203 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F249C433EF for ; Fri, 24 Sep 2021 17:18:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E36086128A for ; Fri, 24 Sep 2021 17:18:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E36086128A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 86F546B0075; Fri, 24 Sep 2021 13:18:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 81E786B0078; Fri, 24 Sep 2021 13:18:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 70E5D900002; Fri, 24 Sep 2021 13:18:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0246.hostedemail.com [216.40.44.246]) by kanga.kvack.org (Postfix) with ESMTP id 64E2D6B0075 for ; Fri, 24 Sep 2021 13:18:40 -0400 (EDT) Received: from smtpin34.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 236EA18027F8D for ; Fri, 24 Sep 2021 17:18:40 +0000 (UTC) X-FDA: 78623126400.34.0B9A732 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf16.hostedemail.com (Postfix) with ESMTP id B9799F00008E for ; Fri, 24 Sep 2021 17:18:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632503919; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X6DQnexwniQ/NKSS0cOEbgPfeH+oSvyPP6EWb64AW6A=; b=aa/OIEapE4cegS3uCH9XI1d5VvEVDVoidX2KDxKDvMHndjZr+EqVUD6WOdxll2G+5wMw9E y/KUvvXzhHtTBNgToXnQpg2Zdt4gzN9/54Hh3o2QOa4E16Z9jOWodGyCCNEripVG3cvGwR cm9GFXBTruOJ7y1bMOAGjLv1g06UUe4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-542-x1QTI5CYO5S4aviDytbwsg-1; Fri, 24 Sep 2021 13:18:37 -0400 X-MC-Unique: x1QTI5CYO5S4aviDytbwsg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1EBCA84A5E1; Fri, 24 Sep 2021 17:18:36 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.44]) by smtp.corp.redhat.com (Postfix) with ESMTP id 90BDA5D9DD; Fri, 24 Sep 2021 17:18:33 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH v3 4/9] Introduce IOCB_SWAP kiocb flag to trigger REQ_SWAP From: David Howells To: willy@infradead.org, hch@lst.de, trond.myklebust@primarydata.com Cc: "Darrick J. Wong" , linux-xfs@vger.kernel.org, linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dhowells@redhat.com, dhowells@redhat.com, darrick.wong@oracle.com, viro@zeniv.linux.org.uk, jlayton@kernel.org, torvalds@linux-foundation.org, linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 24 Sep 2021 18:18:32 +0100 Message-ID: <163250391274.2330363.16176856646027970865.stgit@warthog.procyon.org.uk> In-Reply-To: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> References: <163250387273.2330363.13240781819520072222.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: B9799F00008E X-Stat-Signature: ryszygxshbgecwq4rtsyawbuq76jwa64 Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b="aa/OIEap"; spf=none (imf16.hostedemail.com: domain of dhowells@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-HE-Tag: 1632503919-510113 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: Introduce an IOCB_SWAP flag for the kiocb struct such that the REQ_SWAP will get set on lower level operation structures in generic code. Signed-off-by: David Howells cc: Matthew Wilcox cc: Christoph Hellwig cc: Darrick J. Wong cc: linux-xfs@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-mm@kvack.org --- fs/direct-io.c | 2 ++ include/linux/bio.h | 2 ++ include/linux/fs.h | 1 + 3 files changed, 5 insertions(+) diff --git a/fs/direct-io.c b/fs/direct-io.c index b2e86e739d7a..76eec0a68fa4 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c @@ -1216,6 +1216,8 @@ do_blockdev_direct_IO(struct kiocb *iocb, struct inode *inode, } if (iocb->ki_flags & IOCB_HIPRI) dio->op_flags |= REQ_HIPRI; + if (iocb->ki_flags & IOCB_SWAP) + dio->op_flags |= REQ_SWAP; /* * For AIO O_(D)SYNC writes we need to defer completions to a workqueue diff --git a/include/linux/bio.h b/include/linux/bio.h index 00952e92eae1..b01133727494 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -787,6 +787,8 @@ static inline void bio_set_polled(struct bio *bio, struct kiocb *kiocb) bio->bi_opf |= REQ_HIPRI; if (!is_sync_kiocb(kiocb)) bio->bi_opf |= REQ_NOWAIT; + if (kiocb->ki_flags & IOCB_SWAP) + bio->bi_opf |= REQ_SWAP; } struct bio *blk_next_bio(struct bio *bio, unsigned int nr_pages, gfp_t gfp); diff --git a/include/linux/fs.h b/include/linux/fs.h index c909ca6c0eb6..c20f4423e2f1 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -321,6 +321,7 @@ enum rw_hint { #define IOCB_NOIO (1 << 20) /* can use bio alloc cache */ #define IOCB_ALLOC_CACHE (1 << 21) +#define IOCB_SWAP (1 << 22) /* Operation on a swapfile */ struct kiocb { struct file *ki_filp;