From: Josh Wu <josh.wu@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size
Date: Fri, 19 Jul 2013 17:43:25 +0800 [thread overview]
Message-ID: <51E90A3D.6000007@atmel.com> (raw)
In-Reply-To: <20130718082445.2BBA0380DF1@gemini.denx.de>
Dear Wolfgang Denk,
Thank you for the quick reply.
On 7/18/2013 4:24 PM, Wolfgang Denk wrote:
> Dear Josh Wu,
>
> In message <1374134870-10154-1-git-send-email-josh.wu@atmel.com> you wrote:
>> Tested in at91sam9x5ek and sama5d3x-ek in mmc fat.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>> When I debugging this issue, I also find the thread talking about this:
>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/158698
>> But finally no patch is send for this bug. So I send this and cc all the
>> people in that thread. Hope it can be merged in 2013.07.
> Definitely not. This needs thurough testing before it can go
> mainline.
got it.
>
>
>> - __u32 startsect;
>> + __u32 startsect, nr_sectors;
>>
>> if (clustnum > 0)
>> startsect = mydata->data_begin +
>> @@ -571,7 +571,11 @@ set_cluster(fsdata *mydata, __u32 clustnum, __u8 *buffer,
>>
>> debug("clustnum: %d, startsect: %d\n", clustnum, startsect);
>>
>> - if (disk_write(startsect, size / mydata->sect_size, buffer) < 0) {
>> + nr_sectors = size / mydata->sect_size;
>> + if (nr_sectors == 0)
>> + nr_sectors = 1;
> Why would this be needed? The case of a partial write is covered
> further down below in the code, in the "if (size % mydata->sect_size)"
> part...
The call of disk_write() will pass the sector size as 0. That will cause
the mmc driver stalled.
And after a search, the fix patch is already sent by Ruud Commandeur and
merge in mainline:
"mmc write bug fix"
commit a586c0aa211fb79ecaa06aee3299bfdd81329876
Author: Ruud Commandeur <RCommandeur@clb.nl>
Date: Wed May 22 13:19:43 2013 +0200
So please forget this patch. Since it is fixed in mmc driver layer. I
will test it in my board.
Sorry for the noise.
>
>
>
> Best regards,
>
> Wolfgang Denk
>
Best Regards,
Josh Wu
next prev parent reply other threads:[~2013-07-19 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-18 8:07 [U-Boot] [PATCH] fs: fat: fix bug when write size is less than a sector size Josh Wu
2013-07-18 8:24 ` Wolfgang Denk
2013-07-19 9:43 ` Josh Wu [this message]
2013-07-19 11:20 ` Wolfgang Denk
2013-07-23 10:16 ` Josh Wu
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=51E90A3D.6000007@atmel.com \
--to=josh.wu@atmel.com \
--cc=u-boot@lists.denx.de \
/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