2014-02-03 04:20:07

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

Namjae Jeon <[email protected]> writes:

> From: Namjae Jeon <[email protected]>
>
> Add i_disksize to represent uninitialized allocated size.
> And mmu_private represent initialized allocated size.

Don't we need to update ->i_disksize after cont_write_begin()?
--
OGAWA Hirofumi <[email protected]>


2014-02-04 10:20:35

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

2014-02-03, OGAWA Hirofumi <[email protected]>:
> Namjae Jeon <[email protected]> writes:
>
>> From: Namjae Jeon <[email protected]>
>>
>> Add i_disksize to represent uninitialized allocated size.
>> And mmu_private represent initialized allocated size.
>
> Don't we need to update ->i_disksize after cont_write_begin()?
We don't need to update i_disksize after cont_write_begin.
It is taken care by the fat_get_block after the allocation.
For all write paths we align the mmu_private and i_disksize from
fat_fill_inode and fat_get_block.

Thanks.
> --
> OGAWA Hirofumi <[email protected]>
>

2014-02-04 14:51:00

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

Namjae Jeon <[email protected]> writes:

> 2014-02-03, OGAWA Hirofumi <[email protected]>:
>> Namjae Jeon <[email protected]> writes:
>>
>>> From: Namjae Jeon <[email protected]>
>>>
>>> Add i_disksize to represent uninitialized allocated size.
>>> And mmu_private represent initialized allocated size.
>>
>> Don't we need to update ->i_disksize after cont_write_begin()?
> We don't need to update i_disksize after cont_write_begin.
> It is taken care by the fat_get_block after the allocation.
> For all write paths we align the mmu_private and i_disksize from
> fat_fill_inode and fat_get_block.

fat_fill_inode() just set i_disksize to i_size. So, it is not aligned by
cluster size or block size.

E.g. ->mmu_private = 500. Then, cont_write_begin() can set ->mmu_private
to 512 on some case. In this case, fat_get_block() will not be called,
because no new allocation.

If this is true, it would be possible to have ->mmu_private == 512 and
->i_disksize == 500.

I'm missing something?

Thanks.
--
OGAWA Hirofumi <[email protected]>

2014-02-04 14:52:41

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

OGAWA Hirofumi <[email protected]> writes:

>>> Don't we need to update ->i_disksize after cont_write_begin()?
>> We don't need to update i_disksize after cont_write_begin.
>> It is taken care by the fat_get_block after the allocation.
>> For all write paths we align the mmu_private and i_disksize from
>> fat_fill_inode and fat_get_block.
>
> fat_fill_inode() just set i_disksize to i_size. So, it is not aligned by
> cluster size or block size.
>
> E.g. ->mmu_private = 500. Then, cont_write_begin() can set ->mmu_private
> to 512 on some case. In this case, fat_get_block() will not be called,
> because no new allocation.
>
> If this is true, it would be possible to have ->mmu_private == 512 and
> ->i_disksize == 500.
>
> I'm missing something?

BTW, even if above was right, I'm not checking whether updating
->i_disksize after cont_write_begin() is right fix or not.
--
OGAWA Hirofumi <[email protected]>

2014-02-06 06:41:14

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

2014-02-04, OGAWA Hirofumi <[email protected]>:
> OGAWA Hirofumi <[email protected]> writes:
>
>>>> Don't we need to update ->i_disksize after cont_write_begin()?
>>> We don't need to update i_disksize after cont_write_begin.
>>> It is taken care by the fat_get_block after the allocation.
>>> For all write paths we align the mmu_private and i_disksize from
>>> fat_fill_inode and fat_get_block.
>>
>> fat_fill_inode() just set i_disksize to i_size. So, it is not aligned by
>> cluster size or block size.
>>
>> E.g. ->mmu_private = 500. Then, cont_write_begin() can set ->mmu_private
>> to 512 on some case. In this case, fat_get_block() will not be called,
>> because no new allocation.
>>
>> If this is true, it would be possible to have ->mmu_private == 512 and
>> ->i_disksize == 500.
>>
>> I'm missing something?
>
> BTW, even if above was right, I'm not checking whether updating
> ->i_disksize after cont_write_begin() is right fix or not.
I understand your concern. these can be mismatched.
But, when checking your doubt, I can not find any side effect.
I think that there is no issue regardless of alignment of two value,
in the cont_write_begin.
Could you please share any point I am missing ?
If you suggest checking point or test method, I can check more and
share the result.

Thanks OGAWA.
> --
> OGAWA Hirofumi <[email protected]>
>

2014-02-06 12:18:24

by OGAWA Hirofumi

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

Namjae Jeon <[email protected]> writes:

>>> fat_fill_inode() just set i_disksize to i_size. So, it is not aligned by
>>> cluster size or block size.
>>>
>>> E.g. ->mmu_private = 500. Then, cont_write_begin() can set ->mmu_private
>>> to 512 on some case. In this case, fat_get_block() will not be called,
>>> because no new allocation.
>>>
>>> If this is true, it would be possible to have ->mmu_private == 512 and
>>> ->i_disksize == 500.
>>>
>>> I'm missing something?
>>
>> BTW, even if above was right, I'm not checking whether updating
>> ->i_disksize after cont_write_begin() is right fix or not.
> I understand your concern. these can be mismatched. But, when
> checking your doubt, I can not find any side effect. I think that
> there is no issue regardless of alignment of two value, in the
> cont_write_begin. Could you please share any point I am missing ? If
> you suggest checking point or test method, I can check more and share
> the result.

I'm not checking whether it is wrong or not. But, like you said,
->mmu_private > ->i_disksize is wrong in theory.

Although, it might have no real problem.

So, how about to set ->i_disksize to aligned by blocksize at first
(i.e. when initializing the inode)?

This may change the behavior when ->mmu_private is not aligned to
blocksize in current patchset. But, in theory, it is right state
(between ->mmu_private and ->i_disksize is uninitialized). I guess, we
can do it with small adjustments, and keep state valid in theory too.

This is just a my guess, so it might be wrong though. I guess, worth to
try to consider.

Thanks.
--
OGAWA Hirofumi <[email protected]>

2014-02-07 04:23:50

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH v3 1/6] fat: add i_disksize to represent uninitialized size

2014-02-06, OGAWA Hirofumi <[email protected]>:
> Namjae Jeon <[email protected]> writes:
>
>>>> fat_fill_inode() just set i_disksize to i_size. So, it is not aligned
>>>> by
>>>> cluster size or block size.
>>>>
>>>> E.g. ->mmu_private = 500. Then, cont_write_begin() can set
>>>> ->mmu_private
>>>> to 512 on some case. In this case, fat_get_block() will not be called,
>>>> because no new allocation.
>>>>
>>>> If this is true, it would be possible to have ->mmu_private == 512 and
>>>> ->i_disksize == 500.
>>>>
>>>> I'm missing something?
>>>
>>> BTW, even if above was right, I'm not checking whether updating
>>> ->i_disksize after cont_write_begin() is right fix or not.
>> I understand your concern. these can be mismatched. But, when
>> checking your doubt, I can not find any side effect. I think that
>> there is no issue regardless of alignment of two value, in the
>> cont_write_begin. Could you please share any point I am missing ? If
>> you suggest checking point or test method, I can check more and share
>> the result.
>
> I'm not checking whether it is wrong or not. But, like you said,
> ->mmu_private > ->i_disksize is wrong in theory.
>
> Although, it might have no real problem.
>
> So, how about to set ->i_disksize to aligned by blocksize at first
> (i.e. when initializing the inode)?
Yes, It is good idea.
>
> This may change the behavior when ->mmu_private is not aligned to
> blocksize in current patchset. But, in theory, it is right state
> (between ->mmu_private and ->i_disksize is uninitialized). I guess, we
> can do it with small adjustments, and keep state valid in theory too.
Right.
>
> This is just a my guess, so it might be wrong though. I guess, worth to
> try to consider.
Okay, I will include it in next patch-set after checking.

Thanks for your review!
>
> Thanks.
> --
> OGAWA Hirofumi <[email protected]>
>