aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-01-18 12:05:58 +0100
committerJan Kara <jack@suse.cz>2023-01-26 16:46:33 +0100
commitde80dae03c436b43017dd5e479486f1f73fa6769 (patch)
tree7a1f36be338ec9338fa87ade34d49d19a9734e81 /fs/udf
parent101ee137d32adc5b53f5c2a61fbda8f70f994845 (diff)
downloadlinux-de80dae03c436b43017dd5e479486f1f73fa6769.tar.gz
udf: Move incrementing of goal block directly into inode_getblk()
inode_getblk() sets goal block for the next allocation to the currently allocated block. This is obviously one less than what the goal block should be which we fixup in udf_get_block(). Just set the right goal block directly in inode_getblk(). Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/udf')
-rw-r--r--fs/udf/inode.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index bcb56674773a0..6f190d0d590c3 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -339,11 +339,6 @@ static int udf_get_block(struct inode *inode, sector_t block,
iinfo = UDF_I(inode);
down_write(&iinfo->i_data_sem);
- if (block == iinfo->i_next_alloc_block + 1) {
- iinfo->i_next_alloc_block++;
- iinfo->i_next_alloc_goal++;
- }
-
/*
* Block beyond EOF and prealloc extents? Just discard preallocation
* as it is not useful and complicates things.
@@ -810,8 +805,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
goto out_free;
}
*new = 1;
- iinfo->i_next_alloc_block = block;
- iinfo->i_next_alloc_goal = newblocknum;
+ iinfo->i_next_alloc_block = block + 1;
+ iinfo->i_next_alloc_goal = newblocknum + 1;
inode->i_ctime = current_time(inode);
if (IS_SYNC(inode))