* [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
@ 2015-12-26 2:46 Yunlei He
2015-12-26 2:55 ` He YunLei
0 siblings, 1 reply; 6+ messages in thread
From: Yunlei He @ 2015-12-26 2:46 UTC (permalink / raw)
To: linux-f2fs-devel, jaegeuk, chao2.yu
This patch add a mismatch check between segment and section in
sanity_check_raw_super.
Signed-off-by: Yunlei He <heyunlei@huawei.com>
---
fs/f2fs/super.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index c3070c1..b51a690 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
return 1;
}
+ /* check seg # corresponding to sec # */
+ if (le32_to_cpu(raw_super->segment_count)
+ * le32_to_cpu(raw_super->segs_per_sec)
+ != le32_to_cpu(raw_super->section_count)) {
+ f2fs_msg(sb, KERN_INFO,
+ "Mismatch seg num (%u) and sec num (%u) \n",
+ le32_to_cpu(raw_super->segment_count),
+ le32_to_cpu(raw_super->section_count));
+ return 1;
+ }
+
/* Currently, support 512/1024/2048/4096 bytes sector size */
if (le32_to_cpu(raw_super->log_sectorsize) >
F2FS_MAX_LOG_SECTOR_SIZE ||
--
1.9.1
------------------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
2015-12-26 2:46 [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super Yunlei He
@ 2015-12-26 2:55 ` He YunLei
2015-12-28 23:10 ` Jaegeuk Kim
0 siblings, 1 reply; 6+ messages in thread
From: He YunLei @ 2015-12-26 2:55 UTC (permalink / raw)
To: Yunlei He; +Cc: jaegeuk, linux-f2fs-devel
On 2015/12/26 10:46, Yunlei He wrote:
> This patch add a mismatch check between segment and section in
> sanity_check_raw_super.
>
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> ---
> fs/f2fs/super.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index c3070c1..b51a690 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
> return 1;
> }
>
> + /* check seg # corresponding to sec # */
> + if (le32_to_cpu(raw_super->segment_count)
> + * le32_to_cpu(raw_super->segs_per_sec)
I am sorry that here is :
/ le32_to_cpu(raw_super->segs_per_sec)
> + != le32_to_cpu(raw_super->section_count)) {
> + f2fs_msg(sb, KERN_INFO,
> + "Mismatch seg num (%u) and sec num (%u) \n",
> + le32_to_cpu(raw_super->segment_count),
> + le32_to_cpu(raw_super->section_count));
> + return 1;
> + }
> +
> /* Currently, support 512/1024/2048/4096 bytes sector size */
> if (le32_to_cpu(raw_super->log_sectorsize) >
> F2FS_MAX_LOG_SECTOR_SIZE ||
>
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
2015-12-26 2:55 ` He YunLei
@ 2015-12-28 23:10 ` Jaegeuk Kim
2015-12-29 0:58 ` He YunLei
0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-28 23:10 UTC (permalink / raw)
To: He YunLei; +Cc: linux-f2fs-devel
Hi Yunlei,
On Sat, Dec 26, 2015 at 10:55:45AM +0800, He YunLei wrote:
> On 2015/12/26 10:46, Yunlei He wrote:
> >This patch add a mismatch check between segment and section in
> >sanity_check_raw_super.
> >
> >Signed-off-by: Yunlei He <heyunlei@huawei.com>
> >---
> > fs/f2fs/super.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> >diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> >index c3070c1..b51a690 100644
> >--- a/fs/f2fs/super.c
> >+++ b/fs/f2fs/super.c
> >@@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
> > return 1;
> > }
> >
> >+ /* check seg # corresponding to sec # */
> >+ if (le32_to_cpu(raw_super->segment_count)
raw_super->segment_count_main ?
Thanks,
> >+ * le32_to_cpu(raw_super->segs_per_sec)
>
> I am sorry that here is :
> / le32_to_cpu(raw_super->segs_per_sec)
> >+ != le32_to_cpu(raw_super->section_count)) {
> >+ f2fs_msg(sb, KERN_INFO,
> >+ "Mismatch seg num (%u) and sec num (%u) \n",
> >+ le32_to_cpu(raw_super->segment_count),
> >+ le32_to_cpu(raw_super->section_count));
> >+ return 1;
> >+ }
> >+
> > /* Currently, support 512/1024/2048/4096 bytes sector size */
> > if (le32_to_cpu(raw_super->log_sectorsize) >
> > F2FS_MAX_LOG_SECTOR_SIZE ||
> >
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
2015-12-28 23:10 ` Jaegeuk Kim
@ 2015-12-29 0:58 ` He YunLei
2015-12-29 1:46 ` Jaegeuk Kim
0 siblings, 1 reply; 6+ messages in thread
From: He YunLei @ 2015-12-29 0:58 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On 2015/12/29 7:10, Jaegeuk Kim wrote:
> Hi Yunlei,
>
> On Sat, Dec 26, 2015 at 10:55:45AM +0800, He YunLei wrote:
>> On 2015/12/26 10:46, Yunlei He wrote:
>>> This patch add a mismatch check between segment and section in
>>> sanity_check_raw_super.
>>>
>>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>>> ---
>>> fs/f2fs/super.c | 11 +++++++++++
>>> 1 file changed, 11 insertions(+)
>>>
>>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>>> index c3070c1..b51a690 100644
>>> --- a/fs/f2fs/super.c
>>> +++ b/fs/f2fs/super.c
>>> @@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
>>> return 1;
>>> }
>>>
>>> + /* check seg # corresponding to sec # */
>>> + if (le32_to_cpu(raw_super->segment_count)
>
> raw_super->segment_count_main ?
>
> Thanks,
yes, you are right, mistake also in f2fs_msg.
>
>>> + * le32_to_cpu(raw_super->segs_per_sec)
>>
>> I am sorry that here is :
>> / le32_to_cpu(raw_super->segs_per_sec)
>>> + != le32_to_cpu(raw_super->section_count)) {
>>> + f2fs_msg(sb, KERN_INFO,
>>> + "Mismatch seg num (%u) and sec num (%u) \n",
>>> + le32_to_cpu(raw_super->segment_count),
here is also need change:
le32_to_cpu(raw_super->segment_count_main),
Thanks,
>>> + le32_to_cpu(raw_super->section_count));
>>> + return 1;
>>> + }
>>> +
>>> /* Currently, support 512/1024/2048/4096 bytes sector size */
>>> if (le32_to_cpu(raw_super->log_sectorsize) >
>>> F2FS_MAX_LOG_SECTOR_SIZE ||
>>>
>
> .
>
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
2015-12-29 0:58 ` He YunLei
@ 2015-12-29 1:46 ` Jaegeuk Kim
2015-12-31 1:02 ` He YunLei
0 siblings, 1 reply; 6+ messages in thread
From: Jaegeuk Kim @ 2015-12-29 1:46 UTC (permalink / raw)
To: He YunLei; +Cc: linux-f2fs-devel
Hi Yunlei,
Could you send a v2 for this?
Thanks,
On Tue, Dec 29, 2015 at 08:58:24AM +0800, He YunLei wrote:
> On 2015/12/29 7:10, Jaegeuk Kim wrote:
> >Hi Yunlei,
> >
> >On Sat, Dec 26, 2015 at 10:55:45AM +0800, He YunLei wrote:
> >>On 2015/12/26 10:46, Yunlei He wrote:
> >>>This patch add a mismatch check between segment and section in
> >>>sanity_check_raw_super.
> >>>
> >>>Signed-off-by: Yunlei He <heyunlei@huawei.com>
> >>>---
> >>> fs/f2fs/super.c | 11 +++++++++++
> >>> 1 file changed, 11 insertions(+)
> >>>
> >>>diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> >>>index c3070c1..b51a690 100644
> >>>--- a/fs/f2fs/super.c
> >>>+++ b/fs/f2fs/super.c
> >>>@@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
> >>> return 1;
> >>> }
> >>>
> >>>+ /* check seg # corresponding to sec # */
> >>>+ if (le32_to_cpu(raw_super->segment_count)
> >
> > raw_super->segment_count_main ?
> >
> >Thanks,
>
> yes, you are right, mistake also in f2fs_msg.
>
> >
> >>>+ * le32_to_cpu(raw_super->segs_per_sec)
> >>
> >>I am sorry that here is :
> >> / le32_to_cpu(raw_super->segs_per_sec)
> >>>+ != le32_to_cpu(raw_super->section_count)) {
> >>>+ f2fs_msg(sb, KERN_INFO,
> >>>+ "Mismatch seg num (%u) and sec num (%u) \n",
> >>>+ le32_to_cpu(raw_super->segment_count),
> here is also need change:
> le32_to_cpu(raw_super->segment_count_main),
> Thanks,
> >>>+ le32_to_cpu(raw_super->section_count));
> >>>+ return 1;
> >>>+ }
> >>>+
> >>> /* Currently, support 512/1024/2048/4096 bytes sector size */
> >>> if (le32_to_cpu(raw_super->log_sectorsize) >
> >>> F2FS_MAX_LOG_SECTOR_SIZE ||
> >>>
> >
> >.
> >
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super
2015-12-29 1:46 ` Jaegeuk Kim
@ 2015-12-31 1:02 ` He YunLei
0 siblings, 0 replies; 6+ messages in thread
From: He YunLei @ 2015-12-31 1:02 UTC (permalink / raw)
To: Jaegeuk Kim; +Cc: linux-f2fs-devel
On 2015/12/29 9:46, Jaegeuk Kim wrote:
> Hi Yunlei,
>
> Could you send a v2 for this?
>
> Thanks,
Hi Kim,
OK! I have sent it.
Thanks,
>
> On Tue, Dec 29, 2015 at 08:58:24AM +0800, He YunLei wrote:
>> On 2015/12/29 7:10, Jaegeuk Kim wrote:
>>> Hi Yunlei,
>>>
>>> On Sat, Dec 26, 2015 at 10:55:45AM +0800, He YunLei wrote:
>>>> On 2015/12/26 10:46, Yunlei He wrote:
>>>>> This patch add a mismatch check between segment and section in
>>>>> sanity_check_raw_super.
>>>>>
>>>>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>>>>> ---
>>>>> fs/f2fs/super.c | 11 +++++++++++
>>>>> 1 file changed, 11 insertions(+)
>>>>>
>>>>> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
>>>>> index c3070c1..b51a690 100644
>>>>> --- a/fs/f2fs/super.c
>>>>> +++ b/fs/f2fs/super.c
>>>>> @@ -1036,6 +1036,17 @@ static int sanity_check_raw_super(struct super_block *sb,
>>>>> return 1;
>>>>> }
>>>>>
>>>>> + /* check seg # corresponding to sec # */
>>>>> + if (le32_to_cpu(raw_super->segment_count)
>>>
>>> raw_super->segment_count_main ?
>>>
>>> Thanks,
>>
>> yes, you are right, mistake also in f2fs_msg.
>>
>>>
>>>>> + * le32_to_cpu(raw_super->segs_per_sec)
>>>>
>>>> I am sorry that here is :
>>>> / le32_to_cpu(raw_super->segs_per_sec)
>>>>> + != le32_to_cpu(raw_super->section_count)) {
>>>>> + f2fs_msg(sb, KERN_INFO,
>>>>> + "Mismatch seg num (%u) and sec num (%u) \n",
>>>>> + le32_to_cpu(raw_super->segment_count),
>> here is also need change:
>> le32_to_cpu(raw_super->segment_count_main),
>> Thanks,
>>>>> + le32_to_cpu(raw_super->section_count));
>>>>> + return 1;
>>>>> + }
>>>>> +
>>>>> /* Currently, support 512/1024/2048/4096 bytes sector size */
>>>>> if (le32_to_cpu(raw_super->log_sectorsize) >
>>>>> F2FS_MAX_LOG_SECTOR_SIZE ||
>>>>>
>>>
>>> .
>>>
>
> .
>
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-31 1:02 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-26 2:46 [PATCH] f2fs: add a segment and section num check in sanity_check_raw_super Yunlei He
2015-12-26 2:55 ` He YunLei
2015-12-28 23:10 ` Jaegeuk Kim
2015-12-29 0:58 ` He YunLei
2015-12-29 1:46 ` Jaegeuk Kim
2015-12-31 1:02 ` He YunLei
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.