xfs
[Top] [All Lists]

[PATCH 03/15] xfs: plug directory buffer readahead

To: xfs@xxxxxxxxxxx
Subject: [PATCH 03/15] xfs: plug directory buffer readahead
From: Dave Chinner <david@xxxxxxxxxxxxx>
Date: Thu, 27 Jun 2013 16:04:47 +1000
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1372313099-8121-1-git-send-email-david@xxxxxxxxxxxxx>
References: <1372313099-8121-1-git-send-email-david@xxxxxxxxxxxxx>
From: Dave Chinner <dchinner@xxxxxxxxxx>

Similar to bulkstat inode chunk readahead, we need to plug directory
data buffer readahead during getdents to ensure that we can merge
adjacent readahead requests and sort out of order requests optimally
before they are dispatched. This improves the readahead efficiency
and reduces the IO load it generates as the IO patterns are
significantly better for both contiguous and fragmented directories.

Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx>
Reviewed-by: Mark Tinguely <tinguely@xxxxxxx>
---
 fs/xfs/xfs_dir2_leaf.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/fs/xfs/xfs_dir2_leaf.c b/fs/xfs/xfs_dir2_leaf.c
index da71a18..bb22aac 100644
--- a/fs/xfs/xfs_dir2_leaf.c
+++ b/fs/xfs/xfs_dir2_leaf.c
@@ -1108,6 +1108,7 @@ xfs_dir2_leaf_readbuf(
        struct xfs_mount        *mp = dp->i_mount;
        struct xfs_buf          *bp = *bpp;
        struct xfs_bmbt_irec    *map = mip->map;
+       struct blk_plug         plug;
        int                     error = 0;
        int                     length;
        int                     i;
@@ -1236,6 +1237,7 @@ xfs_dir2_leaf_readbuf(
        /*
         * Do we need more readahead?
         */
+       blk_start_plug(&plug);
        for (mip->ra_index = mip->ra_offset = i = 0;
             mip->ra_want > mip->ra_current && i < mip->map_blocks;
             i += mp->m_dirblkfsbs) {
@@ -1287,6 +1289,7 @@ xfs_dir2_leaf_readbuf(
                        }
                }
        }
+       blk_finish_plug(&plug);
 
 out:
        *bpp = bp;
-- 
1.7.10.4

<Prev in Thread] Current Thread [Next in Thread>