diff mbox series

[2/6] ext4: Remove redundant max inline_size check in ext4_da_write_inline_data_begin()

Message ID fc7f7b3ad709da48c49ab14a2ce86e00a7defe0e.1642044249.git.riteshh@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series ext4/jbd2: inline_data fixes and some cleanups | expand

Commit Message

Ritesh Harjani Jan. 13, 2022, 3:26 a.m. UTC
ext4_prepare_inline_data() already checks for ext4_get_max_inline_size()
and returns -ENOSPC. So there is no need to check it twice within
ext4_da_write_inline_data_begin(). This patch removes the extra check.

It also makes it more clean.

No functionality change in this patch.

Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
 fs/ext4/inline.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Jan Kara Jan. 13, 2022, 10:58 a.m. UTC | #1
On Thu 13-01-22 08:56:25, Ritesh Harjani wrote:
> ext4_prepare_inline_data() already checks for ext4_get_max_inline_size()
> and returns -ENOSPC. So there is no need to check it twice within
> ext4_da_write_inline_data_begin(). This patch removes the extra check.
> 
> It also makes it more clean.
> 
> No functionality change in this patch.
> 
> Signed-off-by: Ritesh Harjani <riteshh@linux.ibm.com>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/ext4/inline.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index 31741e8a462e..c52b0037983d 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -913,7 +913,7 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
>  				    struct page **pagep,
>  				    void **fsdata)
>  {
> -	int ret, inline_size;
> +	int ret;
>  	handle_t *handle;
>  	struct page *page;
>  	struct ext4_iloc iloc;
> @@ -930,14 +930,9 @@ int ext4_da_write_inline_data_begin(struct address_space *mapping,
>  		goto out;
>  	}
>  
> -	inline_size = ext4_get_max_inline_size(inode);
> -
> -	ret = -ENOSPC;
> -	if (inline_size >= pos + len) {
> -		ret = ext4_prepare_inline_data(handle, inode, pos + len);
> -		if (ret && ret != -ENOSPC)
> -			goto out_journal;
> -	}
> +	ret = ext4_prepare_inline_data(handle, inode, pos + len);
> +	if (ret && ret != -ENOSPC)
> +		goto out_journal;
>  
>  	/*
>  	 * We cannot recurse into the filesystem as the transaction
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
index 31741e8a462e..c52b0037983d 100644
--- a/fs/ext4/inline.c
+++ b/fs/ext4/inline.c
@@ -913,7 +913,7 @@  int ext4_da_write_inline_data_begin(struct address_space *mapping,
 				    struct page **pagep,
 				    void **fsdata)
 {
-	int ret, inline_size;
+	int ret;
 	handle_t *handle;
 	struct page *page;
 	struct ext4_iloc iloc;
@@ -930,14 +930,9 @@  int ext4_da_write_inline_data_begin(struct address_space *mapping,
 		goto out;
 	}
 
-	inline_size = ext4_get_max_inline_size(inode);
-
-	ret = -ENOSPC;
-	if (inline_size >= pos + len) {
-		ret = ext4_prepare_inline_data(handle, inode, pos + len);
-		if (ret && ret != -ENOSPC)
-			goto out_journal;
-	}
+	ret = ext4_prepare_inline_data(handle, inode, pos + len);
+	if (ret && ret != -ENOSPC)
+		goto out_journal;
 
 	/*
 	 * We cannot recurse into the filesystem as the transaction