git: bae517022c9a - main - swap_pager: enhance meta_transfer comments

From: Doug Moore <dougm_at_FreeBSD.org>
Date: Mon, 16 Sep 2024 05:33:25 UTC
The branch main has been updated by dougm:

URL: https://cgit.FreeBSD.org/src/commit/?id=bae517022c9a5945cb059cc59b0eb322e561d7c0

commit bae517022c9a5945cb059cc59b0eb322e561d7c0
Author:     Doug Moore <dougm@FreeBSD.org>
AuthorDate: 2024-09-16 05:31:11 +0000
Commit:     Doug Moore <dougm@FreeBSD.org>
CommitDate: 2024-09-16 05:31:11 +0000

    swap_pager: enhance meta_transfer comments
    
    Clarify comments about what happens to source blocks in
    swp_pager_meta_transfer.  No functional changes.
    
    Reviewed by:    alc
    Differential Revision:  https://reviews.freebsd.org/D46682
---
 sys/vm/swap_pager.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/sys/vm/swap_pager.c b/sys/vm/swap_pager.c
index 64ae4ad78786..44fe4f34bb39 100644
--- a/sys/vm/swap_pager.c
+++ b/sys/vm/swap_pager.c
@@ -2190,8 +2190,8 @@ allocated:
  * SWP_PAGER_META_TRANSFER() - transfer a range of blocks in the srcobject's
  * swap metadata into dstobject.
  *
- *	This routine will free swap metadata structures as they are cleaned
- *	out.
+ *	Blocks in src that correspond to holes in dst are transferred.  Blocks
+ *	in src that correspond to blocks in dst are freed.
  */
 static void
 swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject,
@@ -2235,8 +2235,10 @@ swp_pager_meta_transfer(vm_object_t srcobject, vm_object_t dstobject,
 				 */
 				d[i] = blk;
 				d_mask |= 1 << i;
-			} else if (blk != SWAPBLK_NONE)
+			} else if (blk != SWAPBLK_NONE) {
+				/* Dst has a block at pindex, so free block. */
 				swp_pager_update_freerange(&range, sb->d[i]);
+			}
 			sb->d[i] = SWAPBLK_NONE;
 		}
 		if (swp_pager_swblk_empty(sb, 0, start) &&