]> git.hungrycats.org Git - linux/commitdiff
wip: cand42 += nocow_ro_drains counter
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 11 Sep 2026 17:01:56 +0000 (13:01 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 11 Sep 2026 17:01:56 +0000 (13:01 -0400)
fs/btrfs/block-group.c
fs/btrfs/fs.h
fs/btrfs/sysfs.c

index 339681c0811151210f4416460f5aa5ab2f35305d..02a8f06e0b08ab2b857f00c779fad83236b97ccf 100644 (file)
@@ -5767,6 +5767,7 @@ static int btrfs_bg_drain_nocow_writes(struct btrfs_block_group *bg)
                       !atomic_read(&fs_info->nocow_write_inflight));
        if (!pending)
                return 0;
+       atomic64_inc(&fs_info->stripe_run_stats.nocow_ro_drains);
        ret = btrfs_start_delalloc_roots(fs_info, LONG_MAX, false);
        if (ret < 0)
                return ret;
index 8eb2491e84218cde9242d20dcba549b1b5cc73c8..5aa6f0a08f81a9f665e284e1606000e10e3e640c 100644 (file)
@@ -860,6 +860,8 @@ struct btrfs_fs_info {
                atomic64_t strand_scan_bytes;
                /* rescans requested by a freed run to credit its stripes back */
                atomic64_t strand_rescan_marks;
+               /* read-only transitions that flushed pending NOCOW writes first */
+               atomic64_t nocow_ro_drains;
        } stripe_run_stats;
        /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
        u32 stripe_rmw_opt;
index c8b7e5f3777ff2caad17d7f01a22beef7d99b79c..58ed8cca316db141d6db291c91637cf353dbe3c5 100644 (file)
@@ -1293,11 +1293,13 @@ static ssize_t btrfs_stripe_run_stats_show(struct kobject *kobj,
                "nocow_run_opened %lld\n"
                "claim_refused_live_run %lld\n"
                "strand_scan_bytes %lld\n"
-               "strand_rescan_marks %lld\n",
+               "strand_rescan_marks %lld\n"
+               "nocow_ro_drains %lld\n",
                atomic64_read(&fs_info->stripe_run_stats.nocow_run_opened),
                atomic64_read(&fs_info->stripe_run_stats.claim_refused_live_run),
                atomic64_read(&fs_info->stripe_run_stats.strand_scan_bytes),
-               atomic64_read(&fs_info->stripe_run_stats.strand_rescan_marks));
+               atomic64_read(&fs_info->stripe_run_stats.strand_rescan_marks),
+               atomic64_read(&fs_info->stripe_run_stats.nocow_ro_drains));
 }
 BTRFS_ATTR(, stripe_run_stats, btrfs_stripe_run_stats_show);