diff options
| author | Andreas Gruenbacher <agruenba@redhat.com> | 2018-11-08 15:14:29 -0500 |
|---|---|---|
| committer | Andreas Gruenbacher <agruenba@redhat.com> | 2018-11-09 05:55:33 -0500 |
| commit | e7445ceddfc220c1aede6d42758a5acb8844e9c3 (patch) | |
| tree | 5b082cfed3a0f01b2b5d0606fd47630715956482 | |
| parent | 10283ea525d30f2e99828978fd04d8427876a7ad (diff) | |
gfs2: Fix metadata read-ahead during truncate (2)
The previous attempt to fix for metadata read-ahead during truncate was
incorrect: for files with a height > 2 (1006989312 bytes with a block
size of 4096 bytes), read-ahead requests were not being issued for some
of the indirect blocks discovered while walking the metadata tree,
leading to significant slow-downs when deleting large files. Fix that.
In addition, only issue read-ahead requests in the first pass through
the meta-data tree, while deallocating data blocks.
Fixes: c3ce5aa9b0 ("gfs2: Fix metadata read-ahead during truncate")
Cc: stable@vger.kernel.org # v4.16+
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
| -rw-r--r-- | fs/gfs2/bmap.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 5f3ea07ef5e2..38d88fcb6988 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
| @@ -1908,10 +1908,16 @@ static int punch_hole(struct gfs2_inode *ip, u64 offset, u64 length) | |||
| 1908 | if (ret < 0) | 1908 | if (ret < 0) |
| 1909 | goto out; | 1909 | goto out; |
| 1910 | 1910 | ||
| 1911 | /* issue read-ahead on metadata */ | 1911 | /* On the first pass, issue read-ahead on metadata. */ |
| 1912 | if (mp.mp_aheight > 1) { | 1912 | if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { |
| 1913 | for (; ret > 1; ret--) { | 1913 | unsigned int height = mp.mp_aheight - 1; |
| 1914 | metapointer_range(&mp, mp.mp_aheight - ret, | 1914 | |
| 1915 | /* No read-ahead for data blocks. */ | ||
| 1916 | if (mp.mp_aheight - 1 == strip_h) | ||
| 1917 | height--; | ||
| 1918 | |||
| 1919 | for (; height >= mp.mp_aheight - ret; height--) { | ||
| 1920 | metapointer_range(&mp, height, | ||
| 1915 | start_list, start_aligned, | 1921 | start_list, start_aligned, |
| 1916 | end_list, end_aligned, | 1922 | end_list, end_aligned, |
| 1917 | &start, &end); | 1923 | &start, &end); |
