xfs_zone_gc.c
Source contains an unconditional loopRemoves an entry from a linked list
SHA-2564e1f60a4be51c05e745dd5c057dc911512f3dd3909780e4d812bde1bd74c43f5
MaleculeO(Er)H(Db₂)
Evidence
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2023-2025 Christoph Hellwig.
4 * Copyright (c) 2024-2025, Western Digital Corporation or its affiliates.
5 */
6#include "xfs_platform.h"
7#include "xfs_shared.h"
8#include "xfs_format.h"
9#include "xfs_log_format.h"
10#include "xfs_trans_resv.h"
11#include "xfs_mount.h"
12#include "xfs_inode.h"
13#include "xfs_btree.h"
14#include "xfs_trans.h"
15#include "xfs_icache.h"
16#include "xfs_rmap.h"
17#include "xfs_rtbitmap.h"
18#include "xfs_rtrmap_btree.h"
19#include "xfs_errortag.h"
20#include "xfs_error.h"
21#include "xfs_zone_alloc.h"
22#include "xfs_zone_priv.h"
23#include "xfs_zones.h"
24#include "xfs_trace.h"
25
26/*
27 * Implement Garbage Collection (GC) of partially used zoned.
28 *
29 * To support the purely sequential writes in each zone, zoned XFS needs to be
30 * able to move data remaining in a zone out of it to reset the zone to prepare
31 * for writing to it again.
32 *
33 * This is done by the GC thread implemented in this file. To support that a
34 * number of zones (XFS_GC_ZONES) is reserved from the user visible capacity to
35 * write the …
39:21… found the rmap for the victim zone is queried, and after
40 * a bit of sorting to reduce fragmentation, the still live extents are read
41 * into memo …
50:55… ed and all transactions
51 * referencing the rmap have been committed to disk.
52 */
53
54/*
55 * Size of each GC scratch allocation, and the number of buffer …
727:22… ictim_rtg->rtg_gccount);
728 xfs_rtgroup_rele(chunk->victim_rtg);
729 list_del(&chunk->entry);
730 xfs_open_zone_put(chunk->oz);
731 xfs_irele(chunk->ip);
⋯5 lines
1184 if (!oz) {
1185 xfs_warn(mp, "unable to allocate a zone for gc");
1186 error = -EIO;
1187 goto out;
1188 }
⋯4 lines
1193 data = xfs_zone_gc_data_alloc(mp);
1194 if (!data) {
1195 error = -ENOMEM;
1196 goto out_put_gc_zone;
1197 }
⋯4 lines