From: Conrad Meyer <cemeyer@uw.edu>
To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5] fs: FAT: Add support for DOS 1.x formatted volumes
Date: Sun, 13 Apr 2014 19:35:23 -0400 [thread overview]
Message-ID: <20140413193523.02dceabe@m> (raw)
In-Reply-To: <87vbucvpus.fsf@devron.myhome.or.jp>
On Mon, 14 Apr 2014 07:14:51 +0900
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:
> Conrad Meyer <cse.cem@gmail.com> writes:
>
> > + sbi->sec_per_clus = fdefaults->sec_per_clus;
> > + sbi->cluster_size = sb->s_blocksize *
> > sbi->sec_per_clus;
> > + sbi->cluster_bits = ffs(sbi->cluster_size) - 1;
> > + sbi->fats = 2;
> > + sbi->fat_start = 1;
> > + sbi->fat_length = fdefaults->fat_length;
> > +
> > + sbi->dir_per_block = sb->s_blocksize /
> > sizeof(struct msdos_dir_entry);
> > + sbi->dir_per_block_bits =
> > ffs(sbi->dir_per_block) - 1;
> > + sbi->dir_start = sbi->fat_start + sbi->fats *
> > sbi->fat_length;
> > + sbi->dir_entries = fdefaults->dir_entries;
> > +
> > + rootdir_sectors = sbi->dir_entries
> > + * sizeof(struct msdos_dir_entry) /
> > sb->s_blocksize;
> > + sbi->data_start = sbi->dir_start +
> > rootdir_sectors;
> > + total_sectors = fdefaults->nr_sectors;
> > + total_clusters = (total_sectors -
> > sbi->data_start) / sbi->sec_per_clus;
> > + sbi->fat_bits = (total_clusters > MAX_FAT12) ?
> > 16 : 12; +
> > + /* some OSes set FAT_STATE_DIRTY and clean it on
> > unmount. */
> > + sbi->dirty = b->fat16.state & FAT_STATE_DIRTY;
> > +
> > + /* check that FAT table does not overflow */
> > + fat_clusters = calc_fat_clusters(sb);
> > + total_clusters = min(total_clusters,
> > fat_clusters - FAT_START_ENT);
>
> Ah, you meant this duplicated one.
>
> Let's use structure like fat_boot_sector (but more cpu
> friendly) on stack or something, instead of modify bh
> (BPB). Modifying bh in bdev is visible via /dev/foo, this
> is why I want to avoid to modify.
>
> With this, we can share almost all codes on both of
> read_bpb() and static_bpb(), and avoids to modify bdev
> buffer? And those 2 helpers only has small chunk of code,
> and provide the required parameters?
>
> Thanks.
Hi,
I think I understand the idea, sounds good to me. Working to
clean up now.
Thanks again,
Conrad
prev parent reply other threads:[~2014-04-13 23:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-13 14:10 [PATCH v5] fs: FAT: Add support for DOS 1.x formatted volumes Conrad Meyer
2014-04-13 22:14 ` OGAWA Hirofumi
2014-04-13 23:35 ` Conrad Meyer [this message]
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=20140413193523.02dceabe@m \
--to=cemeyer@uw.edu \
--cc=hirofumi@mail.parknet.co.jp \
--cc=linux-kernel@vger.kernel.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