linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks
@ 2020-03-11 20:51 Eric Whitney
  2020-03-12  9:56 ` Ritesh Harjani
  2020-03-12 15:00 ` Theodore Y. Ts'o
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Whitney @ 2020-03-11 20:51 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Eric Whitney

We can use the variable allocated_clusters rather than map_from_clusters
to control reserved block/cluster accounting in ext4_ext_map_blocks.
This eliminates a variable and associated code and improves readability
a little.

Signed-off-by: Eric Whitney <enwlinux@gmail.com>
---
 fs/ext4/extents.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index bc96529d1509..b12c9e52746c 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -4181,7 +4181,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	unsigned int allocated_clusters = 0;
 	struct ext4_allocation_request ar;
 	ext4_lblk_t cluster_offset;
-	bool map_from_cluster = false;
 
 	ext_debug("blocks %u/%u requested for inode %lu\n",
 		  map->m_lblk, map->m_len, inode->i_ino);
@@ -4296,7 +4295,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	    get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
 		ar.len = allocated = map->m_len;
 		newblock = map->m_pblk;
-		map_from_cluster = true;
 		goto got_allocated_blocks;
 	}
 
@@ -4317,7 +4315,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	    get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
 		ar.len = allocated = map->m_len;
 		newblock = map->m_pblk;
-		map_from_cluster = true;
 		goto got_allocated_blocks;
 	}
 
@@ -4418,7 +4415,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
 	 * clusters discovered to be delayed allocated.  Once allocated, a
 	 * cluster is not included in the reserved count.
 	 */
-	if (test_opt(inode->i_sb, DELALLOC) && !map_from_cluster) {
+	if (test_opt(inode->i_sb, DELALLOC) && allocated_clusters) {
 		if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
 			/*
 			 * When allocating delayed allocated clusters, simply
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks
  2020-03-11 20:51 [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks Eric Whitney
@ 2020-03-12  9:56 ` Ritesh Harjani
  2020-03-12 15:00 ` Theodore Y. Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2020-03-12  9:56 UTC (permalink / raw)
  To: Eric Whitney, linux-ext4; +Cc: tytso



On 3/12/20 2:21 AM, Eric Whitney wrote:
> We can use the variable allocated_clusters rather than map_from_clusters
> to control reserved block/cluster accounting in ext4_ext_map_blocks.
> This eliminates a variable and associated code and improves readability
> a little.
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>

No objections there.

Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>


> ---
>   fs/ext4/extents.c | 5 +----
>   1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
> index bc96529d1509..b12c9e52746c 100644
> --- a/fs/ext4/extents.c
> +++ b/fs/ext4/extents.c
> @@ -4181,7 +4181,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
>   	unsigned int allocated_clusters = 0;
>   	struct ext4_allocation_request ar;
>   	ext4_lblk_t cluster_offset;
> -	bool map_from_cluster = false;
> 
>   	ext_debug("blocks %u/%u requested for inode %lu\n",
>   		  map->m_lblk, map->m_len, inode->i_ino);
> @@ -4296,7 +4295,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
>   	    get_implied_cluster_alloc(inode->i_sb, map, ex, path)) {
>   		ar.len = allocated = map->m_len;
>   		newblock = map->m_pblk;
> -		map_from_cluster = true;
>   		goto got_allocated_blocks;
>   	}
> 
> @@ -4317,7 +4315,6 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
>   	    get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) {
>   		ar.len = allocated = map->m_len;
>   		newblock = map->m_pblk;
> -		map_from_cluster = true;
>   		goto got_allocated_blocks;
>   	}
> 
> @@ -4418,7 +4415,7 @@ int ext4_ext_map_blocks(handle_t *handle, struct inode *inode,
>   	 * clusters discovered to be delayed allocated.  Once allocated, a
>   	 * cluster is not included in the reserved count.
>   	 */
> -	if (test_opt(inode->i_sb, DELALLOC) && !map_from_cluster) {
> +	if (test_opt(inode->i_sb, DELALLOC) && allocated_clusters) {
>   		if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) {
>   			/*
>   			 * When allocating delayed allocated clusters, simply
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks
  2020-03-11 20:51 [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks Eric Whitney
  2020-03-12  9:56 ` Ritesh Harjani
@ 2020-03-12 15:00 ` Theodore Y. Ts'o
  1 sibling, 0 replies; 3+ messages in thread
From: Theodore Y. Ts'o @ 2020-03-12 15:00 UTC (permalink / raw)
  To: Eric Whitney; +Cc: linux-ext4

On Wed, Mar 11, 2020 at 04:51:25PM -0400, Eric Whitney wrote:
> We can use the variable allocated_clusters rather than map_from_clusters
> to control reserved block/cluster accounting in ext4_ext_map_blocks.
> This eliminates a variable and associated code and improves readability
> a little.
> 
> Signed-off-by: Eric Whitney <enwlinux@gmail.com>

Applied, thanks.

							- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-03-12 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 20:51 [PATCH] ext4: remove map_from_cluster from ext4_ext_map_blocks Eric Whitney
2020-03-12  9:56 ` Ritesh Harjani
2020-03-12 15:00 ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).