]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
xfs: move stat accounting to xfs_bmapi_convert_delalloc
authorChristoph Hellwig <hch@lst.de>
Fri, 15 Feb 2019 16:02:49 +0000 (08:02 -0800)
committerDarrick J. Wong <darrick.wong@oracle.com>
Sun, 17 Feb 2019 19:55:54 +0000 (11:55 -0800)
This way we can actually count how many bytes got converted and how many
calls we need, unlike in the caller which doesn't have the detailed
view.

Note that this includes a slight change in behavior as the
xs_xstrat_quick is now bumped for every allocation instead of just the
one covering the requested writeback offset, which makes a lot more
sense.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/xfs_iomap.c

index e245b5dfee9d6873b1ef377bd6fb70b12f8bd85e..e4f29ebdf4d2300f2ec509064ab5f3ac2ecbb339 100644 (file)
@@ -4516,6 +4516,9 @@ xfs_bmapi_convert_delalloc(
        if (WARN_ON_ONCE(!bma.got.br_startblock && !XFS_IS_REALTIME_INODE(ip)))
                goto out_finish;
 
+       XFS_STATS_ADD(mp, xs_xstrat_bytes, XFS_FSB_TO_B(mp, bma.length));
+       XFS_STATS_INC(mp, xs_xstrat_quick);
+
        ASSERT(!isnullstartblock(bma.got.br_startblock));
        *imap = bma.got;
        *seq = READ_ONCE(ifp->if_seq);
index 39be741cac5a69fb6ec69dcf59288896002a39d3..15da53b5fb531ec0c3e64262a88e545b8e80816e 100644 (file)
@@ -707,9 +707,6 @@ xfs_iomap_write_allocate(
        map_start_fsb = imap->br_startoff;
        map_count_fsb = imap->br_blockcount;
 
-       XFS_STATS_ADD(mp, xs_xstrat_bytes,
-                     XFS_FSB_TO_B(mp, imap->br_blockcount));
-
        while (true) {
                /*
                 * Allocate in a loop because it may take several attempts to
@@ -741,7 +738,6 @@ xfs_iomap_write_allocate(
                if ((offset_fsb >= imap->br_startoff) &&
                    (offset_fsb < (imap->br_startoff +
                                   imap->br_blockcount))) {
-                       XFS_STATS_INC(mp, xs_xstrat_quick);
                        xfs_trim_extent(imap, map_start_fsb, map_count_fsb);
                        ASSERT(offset_fsb >= imap->br_startoff &&
                               offset_fsb < imap->br_startoff + imap->br_blockcount);