From owner-dev-commits-src-main@freebsd.org Tue Sep 28 18:24:06 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6DC4B6A9D73; Tue, 28 Sep 2021 18:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HJnvp2flgz4dGD; Tue, 28 Sep 2021 18:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 30A64FDC; Tue, 28 Sep 2021 18:24:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 18SIO6hQ055974; Tue, 28 Sep 2021 18:24:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 18SIO61S055973; Tue, 28 Sep 2021 18:24:06 GMT (envelope-from git) Date: Tue, 28 Sep 2021 18:24:06 GMT Message-Id: <202109281824.18SIO61S055973@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: c6213beff4f5 - main - Add flag BIO_SWAP to mark IOs that are associated with swap. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c6213beff4f51d6c9cc4e41682538d203249359e Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Sep 2021 18:24:06 -0000 The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=c6213beff4f51d6c9cc4e41682538d203249359e commit c6213beff4f51d6c9cc4e41682538d203249359e Author: Gleb Smirnoff AuthorDate: 2021-09-28 18:11:50 +0000 Commit: Gleb Smirnoff CommitDate: 2021-09-28 18:23:51 +0000 Add flag BIO_SWAP to mark IOs that are associated with swap. Submitted by: jtl Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D24400 --- sys/geom/geom_io.c | 8 ++++---- sys/sys/bio.h | 3 ++- sys/vm/swap_pager.c | 1 + 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c index 31213f0f2b22..c4e9be02bf44 100644 --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -199,12 +199,12 @@ g_clone_bio(struct bio *bp) /* * BIO_ORDERED flag may be used by disk drivers to enforce * ordering restrictions, so this flag needs to be cloned. - * BIO_UNMAPPED and BIO_VLIST should be inherited, to properly - * indicate which way the buffer is passed. + * BIO_UNMAPPED, BIO_VLIST, and BIO_SWAP should be inherited, + * to properly indicate which way the buffer is passed. * Other bio flags are not suitable for cloning. */ bp2->bio_flags = bp->bio_flags & - (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST); + (BIO_ORDERED | BIO_UNMAPPED | BIO_VLIST | BIO_SWAP); bp2->bio_length = bp->bio_length; bp2->bio_offset = bp->bio_offset; bp2->bio_data = bp->bio_data; @@ -238,7 +238,7 @@ g_duplicate_bio(struct bio *bp) struct bio *bp2; bp2 = uma_zalloc(biozone, M_WAITOK | M_ZERO); - bp2->bio_flags = bp->bio_flags & (BIO_UNMAPPED | BIO_VLIST); + bp2->bio_flags = bp->bio_flags & (BIO_UNMAPPED | BIO_VLIST | BIO_SWAP); bp2->bio_parent = bp; bp2->bio_cmd = bp->bio_cmd; bp2->bio_length = bp->bio_length; diff --git a/sys/sys/bio.h b/sys/sys/bio.h index 5fdf0ecbb917..fba1b9dce68f 100644 --- a/sys/sys/bio.h +++ b/sys/sys/bio.h @@ -67,8 +67,9 @@ #define BIO_UNMAPPED 0x10 #define BIO_TRANSIENT_MAPPING 0x20 #define BIO_VLIST 0x40 +#define BIO_SWAP 0x200 /* Swap-related I/O */ -#define PRINT_BIO_FLAGS "\20\7vlist\6transient_mapping\5unmapped" \ +#define PRINT_BIO_FLAGS "\20\12swap\7vlist\6transient_mapping\5unmapped" \ "\4ordered\3onqueue\2done\1error" #define BIO_SPEEDUP_WRITE 0x4000 /* Resource shortage at upper layers */ diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c index 6d64ff883966..08a5ead438ba 100644 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2893,6 +2893,7 @@ swapgeom_strategy(struct buf *bp, struct swdevt *sp) bio->bio_offset = (bp->b_blkno - sp->sw_first) * PAGE_SIZE; bio->bio_length = bp->b_bcount; bio->bio_done = swapgeom_done; + bio->bio_flags |= BIO_SWAP; if (!buf_mapped(bp)) { bio->bio_ma = bp->b_pages; bio->bio_data = unmapped_buf;