All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Jan Kara <jack@suse.cz>
Subject: [PATCH 03/22] udf: Move incrementing of goal block directly into inode_getblk()
Date: Tue, 24 Jan 2023 13:17:49 +0100	[thread overview]
Message-ID: <20230124121814.25951-3-jack@suse.cz> (raw)
In-Reply-To: <20230124120835.21728-1-jack@suse.cz>

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>
---
 fs/udf/inode.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 2b3fc897d1b3..ff414fff354a 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.
@@ -812,8 +807,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))
-- 
2.35.3


  parent reply	other threads:[~2023-01-24 12:18 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 12:17 [PATCH 0/22] udf: Fix couple of preallocation related bugs Jan Kara
2023-01-24 12:17 ` [PATCH 01/22] udf: Unify types in anchor block detection Jan Kara
2023-01-24 12:17 ` [PATCH 02/22] udf: Drop VARCONV support Jan Kara
2023-01-24 12:17 ` Jan Kara [this message]
2023-01-24 12:17 ` [PATCH 04/22] udf: Factor out block mapping into udf_map_block() Jan Kara
2023-01-24 12:17 ` [PATCH 05/22] udf: Use udf_bread() in udf_get_pblock_virt15() Jan Kara
2023-01-24 12:17 ` [PATCH 06/22] udf: Use udf_bread() in udf_load_vat() Jan Kara
2023-01-24 12:17 ` [PATCH 07/22] udf: Do not call udf_block_map() on ICB files Jan Kara
2023-01-24 12:17 ` [PATCH 08/22] udf: Convert udf_symlink_filler() to use udf_bread() Jan Kara
2023-01-24 12:17 ` [PATCH 09/22] udf: Fold udf_block_map() into udf_map_block() Jan Kara
2023-01-24 12:17 ` [PATCH 10/22] udf: Pass mapping request into inode_getblk() Jan Kara
2023-01-24 12:17 ` [PATCH 11/22] udf: Add flag to disable block preallocation Jan Kara
2023-01-24 12:17 ` [PATCH 12/22] udf: Use udf_map_block() in udf_getblk() Jan Kara
2023-01-24 12:17 ` [PATCH 13/22] udf: Fold udf_getblk() into udf_bread() Jan Kara
2023-01-24 12:18 ` [PATCH 14/22] udf: Protect rename against modification of moved directory Jan Kara
2023-01-24 12:18 ` [PATCH 15/22] udf: Push i_data_sem locking into udf_expand_file_adinicb() Jan Kara
2023-01-24 12:18 ` [PATCH 16/22] udf: Push i_data_sem locking into udf_extend_file() Jan Kara
2023-01-24 12:18 ` [PATCH 17/22] udf: Simplify error handling in udf_file_write_iter() Jan Kara
2023-01-24 12:18 ` [PATCH 18/22] udf: Protect truncate and file type conversion with invalidate_lock Jan Kara
2023-01-24 12:18 ` [PATCH 19/22] udf: Allocate blocks on write page fault Jan Kara
2023-01-24 12:18 ` [PATCH 20/22] udf: Do not allocate blocks on page writeback Jan Kara
2023-01-24 12:18 ` [PATCH 21/22] udf: Fix file corruption when appending just after end of preallocated extent Jan Kara
2023-01-24 12:18 ` [PATCH 22/22] udf: Fix off-by-one error when discarding preallocation Jan Kara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230124121814.25951-3-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.