diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2023-10-31 00:07:38 +0100 |
---|---|---|
committer | Andreas Gruenbacher <agruenba@redhat.com> | 2023-11-06 17:23:48 +0100 |
commit | 04e5d5785cde5d9320a6352e7cc01cfdb394d042 (patch) | |
tree | b9d67f3c8f19d98b9991c814e97af9e3002cedaa | |
parent | f64262f3f331b8940a928b110e1f7eb749c4dc22 (diff) | |
download | linux-gfs2-alloc.tar.gz |
-rw-r--r-- | fs/gfs2/bmap.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index 896ec9da0ba51c..ac2d2aa8a0fac3 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c @@ -931,6 +931,12 @@ gfs2_alloc_data_blocks(struct inode *inode, struct metapath *mp, int ret; if (!ap->count) { + /* + * XXX When we were unstuffing, the file isn't empty, and we + * are reading from the first block, don't do another + * allocation here because the first block would then end up in + * a separate extent! + */ ret = gfs2_alloc_blocks(ip, ap); if (ret) return ret; @@ -1377,6 +1383,7 @@ gfs2_iomap_write_alloc(struct inode *inode, ind_blocks = max_indirect_blocks(inode, mp->mp_fheight, start, data_blocks); unstuff_block = gfs2_is_stuffed(ip) && i_size_read(inode) && start > 0; ap.target = unstuff_block + data_blocks + ind_blocks; + /* XXX Also set ap.min_target reasonably? */ ret = gfs2_quota_lock_check(ip, &ap); if (ret) goto out; |