diff --git a/sys/geom/geom_io.c b/sys/geom/geom_io.c --- a/sys/geom/geom_io.c +++ b/sys/geom/geom_io.c @@ -199,12 +199,12 @@ /* * 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 @@ 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 --- 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 --- a/sys/vm/swap_pager.c +++ b/sys/vm/swap_pager.c @@ -2893,6 +2893,7 @@ 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;