linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs-utils: add missing block counting
@ 2024-04-24  4:34 Noboru Asai
  2024-04-24  4:54 ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Noboru Asai @ 2024-04-24  4:34 UTC (permalink / raw)
  To: hsiangkao; +Cc: linux-erofs

Add missing block counting when the data to be inlined is not inlined.

Signed-off-by: Noboru Asai <asai@sijam.com>
---
 lib/inode.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/inode.c b/lib/inode.c
index cf22bbe..727dcee 100644
--- a/lib/inode.c
+++ b/lib/inode.c
@@ -840,6 +840,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
 		inode->idata_size = 0;
 		free(inode->idata);
 		inode->idata = NULL;
+		inode->u.i_blocks += 1;
 
 		erofs_droid_blocklist_write_tail_end(inode, erofs_blknr(sbi, pos));
 	}
-- 
2.44.0


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

* Re: [PATCH] erofs-utils: add missing block counting
  2024-04-24  4:34 [PATCH] erofs-utils: add missing block counting Noboru Asai
@ 2024-04-24  4:54 ` Gao Xiang
  2024-04-24  5:33   ` Noboru Asai
  0 siblings, 1 reply; 4+ messages in thread
From: Gao Xiang @ 2024-04-24  4:54 UTC (permalink / raw)
  To: Noboru Asai; +Cc: linux-erofs

Hi Noboru,

On 2024/4/24 12:34, Noboru Asai wrote:
> Add missing block counting when the data to be inlined is not inlined.
> 
> Signed-off-by: Noboru Asai <asai@sijam.com>


Thanks for catching this! Could we fixup this at
erofs_prepare_tail_block()?

since currently it the place to allocate a tail block for this.

Thanks,
Gao Xiang

> ---
>   lib/inode.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/lib/inode.c b/lib/inode.c
> index cf22bbe..727dcee 100644
> --- a/lib/inode.c
> +++ b/lib/inode.c
> @@ -840,6 +840,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
>   		inode->idata_size = 0;
>   		free(inode->idata);
>   		inode->idata = NULL;
> +		inode->u.i_blocks += 1;
>   
>   		erofs_droid_blocklist_write_tail_end(inode, erofs_blknr(sbi, pos));
>   	}

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

* Re: [PATCH] erofs-utils: add missing block counting
  2024-04-24  4:54 ` Gao Xiang
@ 2024-04-24  5:33   ` Noboru Asai
  2024-04-24  5:43     ` Gao Xiang
  0 siblings, 1 reply; 4+ messages in thread
From: Noboru Asai @ 2024-04-24  5:33 UTC (permalink / raw)
  To: Gao Xiang; +Cc: linux-erofs

Hi Gao,

I think that erofs_balloc() and erofs_bh_baloon() function in
erofs_write_tail_end()
also alloc a tail block, Is it not true?

2024年4月24日(水) 13:54 Gao Xiang <hsiangkao@linux.alibaba.com>:
>
> Hi Noboru,
>
> On 2024/4/24 12:34, Noboru Asai wrote:
> > Add missing block counting when the data to be inlined is not inlined.
> >
> > Signed-off-by: Noboru Asai <asai@sijam.com>
>
>
> Thanks for catching this! Could we fixup this at
> erofs_prepare_tail_block()?
>
> since currently it the place to allocate a tail block for this.
>
> Thanks,
> Gao Xiang
>
> > ---
> >   lib/inode.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/lib/inode.c b/lib/inode.c
> > index cf22bbe..727dcee 100644
> > --- a/lib/inode.c
> > +++ b/lib/inode.c
> > @@ -840,6 +840,7 @@ static int erofs_write_tail_end(struct erofs_inode *inode)
> >               inode->idata_size = 0;
> >               free(inode->idata);
> >               inode->idata = NULL;
> > +             inode->u.i_blocks += 1;
> >
> >               erofs_droid_blocklist_write_tail_end(inode, erofs_blknr(sbi, pos));
> >       }

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

* Re: [PATCH] erofs-utils: add missing block counting
  2024-04-24  5:33   ` Noboru Asai
@ 2024-04-24  5:43     ` Gao Xiang
  0 siblings, 0 replies; 4+ messages in thread
From: Gao Xiang @ 2024-04-24  5:43 UTC (permalink / raw)
  To: Noboru Asai; +Cc: linux-erofs



On 2024/4/24 13:33, Noboru Asai wrote:
> Hi Gao,
> 
> I think that erofs_balloc() and erofs_bh_baloon() function in
> erofs_write_tail_end()
> also alloc a tail block, Is it not true?

erofs_prepare_tail_block() is the place to decide the fallback
tail block. But due to some dependency, bh can be allocated in
erofs_write_tail_end() later.

erofs_write_tail_end() is designed for filling tail data, not
decide to get a fallback tail block, anyway.

commit 21d84349e79a ("erofs-utils: rearrange on-disk metadata")
changed the timing due to some dependency as I said before, but
later I need to revisit it.  erofs_prepare_tail_block() is the
original place to decide if a fallback tail block is needed,
that is also true for old versions.

Thanks,
Gao Xiang

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

end of thread, other threads:[~2024-04-24  5:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24  4:34 [PATCH] erofs-utils: add missing block counting Noboru Asai
2024-04-24  4:54 ` Gao Xiang
2024-04-24  5:33   ` Noboru Asai
2024-04-24  5:43     ` Gao Xiang

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).