* UBI Patch: Max Sequence no not updated in scan.c
@ 2007-07-06 9:00 brijesh.singh
2007-07-06 9:22 ` Artem Bityutskiy
2007-07-06 9:46 ` Artem Bityutskiy
0 siblings, 2 replies; 3+ messages in thread
From: brijesh.singh @ 2007-07-06 9:00 UTC (permalink / raw)
To: linux-mtd
Hi,I came across problem of having two leb with same sequence no.This
happens when we continuously write one block again and again and reboot
machine before background thread erases those blocks.
The problem here was,when we find two blocks with same sequence no,we take
the higher one,but we were not updating max seq no,so next block may have
the same seqnum.
This patch solves this problem.
Signed-off-by: Brijesh Singh <brijesh.s.singh@gmail.com>
Index: mtd-2.6/drivers/mtd/ubi/scan.c
===================================================================
--- mtd-2.6.orig/drivers/mtd/ubi/scan.c 2007-07-04 16:58:43.000000000 +0530
+++ mtd-2.6/drivers/mtd/ubi/scan.c 2007-07-06 13:57:53.000000000 +0530
@@ -510,6 +510,9 @@
sv->last_data_size =
ubi32_to_cpu(vid_hdr->data_size);
+ if (si->max_sqnum < sqnum)
+ si->max_sqnum = sqnum;
+
return 0;
} else {
/*
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: UBI Patch: Max Sequence no not updated in scan.c
2007-07-06 9:00 UBI Patch: Max Sequence no not updated in scan.c brijesh.singh
@ 2007-07-06 9:22 ` Artem Bityutskiy
2007-07-06 9:46 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2007-07-06 9:22 UTC (permalink / raw)
To: brijesh.singh; +Cc: linux-mtd
Hi Brijesh,
thanks for the catch.
On Fri, 2007-07-06 at 14:30 +0530, brijesh.singh@calsoftinc.com wrote:
> Hi,I came across problem of having two leb with same sequence no.This
> happens when we continuously write one block again and again and reboot
> machine before background thread erases those blocks.
> The problem here was,when we find two blocks with same sequence no,we take
> the higher one,but we were not updating max seq no,so next block may have
> the same seqnum.
> This patch solves this problem.
Yeah, bu you probably wanted to say "when we find two blocks with same
volume ID and LEB number".
I would rather do the fix it other way - are you OK with that?
Also, it seems I have found one more problem:
What the haeck si->max_sqnum = 0; is doing in add_volume()?
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index 23e30ac..ce26b1b 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -437,6 +437,9 @@ int ubi_scan_add_used(const struct ubi_device *ubi, struct ubi_scan_info *si,
if (IS_ERR(sv) < 0)
return PTR_ERR(sv);
+ if (si->max_sqnum < sqnum)
+ si->max_sqnum = sqnum;
+
/*
* Walk the RB-tree of logical eraseblocks of volume @vol_id to look
* if this is the first instance of this logical eraseblock or not.
@@ -563,9 +566,6 @@ int ubi_scan_add_used(const struct ubi_device *ubi, struct ubi_scan_info *si,
sv->last_data_size = be32_to_cpu(vid_hdr->data_size);
}
- if (si->max_sqnum < sqnum)
- si->max_sqnum = sqnum;
-
sv->leb_count += 1;
rb_link_node(&seb->u.rb, parent, p);
rb_insert_color(&seb->u.rb, &sv->root);
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: UBI Patch: Max Sequence no not updated in scan.c
2007-07-06 9:00 UBI Patch: Max Sequence no not updated in scan.c brijesh.singh
2007-07-06 9:22 ` Artem Bityutskiy
@ 2007-07-06 9:46 ` Artem Bityutskiy
1 sibling, 0 replies; 3+ messages in thread
From: Artem Bityutskiy @ 2007-07-06 9:46 UTC (permalink / raw)
To: brijesh.singh; +Cc: linux-mtd
On Fri, 2007-07-06 at 14:30 +0530, brijesh.singh@calsoftinc.com wrote:
> Hi,I came across problem of having two leb with same sequence no.This
> happens when we continuously write one block again and again and reboot
> machine before background thread erases those blocks.
> The problem here was,when we find two blocks with same sequence no,we take
> the higher one,but we were not updating max seq no,so next block may have
> the same seqnum.
> This patch solves this problem.
I've committed your patch (modified) and one more fix, please, try.
Thanks,
Artem.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-06 9:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-06 9:00 UBI Patch: Max Sequence no not updated in scan.c brijesh.singh
2007-07-06 9:22 ` Artem Bityutskiy
2007-07-06 9:46 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox