From: Artem Bityutskiy <dedekind@infradead.org>
To: brijesh.singh@calsoftinc.com
Cc: linux-mtd@lists.infradead.org
Subject: Re: UBI Patch: Max Sequence no not updated in scan.c
Date: Fri, 06 Jul 2007 12:22:18 +0300 [thread overview]
Message-ID: <1183713738.3531.50.camel@sauron> (raw)
In-Reply-To: <31331.172.16.0.34.1183712408.squirrel@webmail.calsoftinc.com>
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 (Битюцкий Артём)
next prev parent reply other threads:[~2007-07-06 9:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-06 9:00 UBI Patch: Max Sequence no not updated in scan.c brijesh.singh
2007-07-06 9:22 ` Artem Bityutskiy [this message]
2007-07-06 9:46 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1183713738.3531.50.camel@sauron \
--to=dedekind@infradead.org \
--cc=brijesh.singh@calsoftinc.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox