From: Andreas Dilger <adilger@clusterfs.com>
To: peterc@gelato.unsw.edu.au
Cc: torvalds@transmeta.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Large Block device patch part 3/4
Date: Thu, 3 Oct 2002 00:01:03 -0600 [thread overview]
Message-ID: <20021003060103.GE3000@clusterfs.com> (raw)
In-Reply-To: <15771.54177.488730.544483@lemon.gelato.unsw.EDU.AU>
On Oct 03, 2002 15:20 +1000, peterc@gelato.unsw.edu.au wrote:
> diff -Nru a/drivers/block/cciss.c b/drivers/block/cciss.c
> --- a/drivers/block/cciss.c Thu Oct 3 15:06:13 2002
> +++ b/drivers/block/cciss.c Thu Oct 3 15:06:13 2002
> @@ -405,7 +405,7 @@
> } else {
> driver_geo.heads = 0xff;
> driver_geo.sectors = 0x3f;
> - driver_geo.cylinders = hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
> + driver_geo.cylinders = (int)hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f);
> }
> driver_geo.start= get_start_sect(inode->i_bdev);
> if (copy_to_user((void *) arg, &driver_geo,
Wouldn't this be better off as:
driver_geo.cylinders = (int)(hba[ctlr]->drv[dsk].nr_blocks / (0xff*0x3f));
> diff -Nru a/drivers/md/linear.c b/drivers/md/linear.c
> --- a/drivers/md/linear.c Thu Oct 3 15:06:13 2002
> +++ b/drivers/md/linear.c Thu Oct 3 15:06:13 2002
> @@ -72,10 +72,12 @@
> goto out;
> }
>
> - nb_zone = conf->nr_zones =
> - md_size[mdidx(mddev)] / conf->smallest->size +
> - ((md_size[mdidx(mddev)] % conf->smallest->size) ? 1 : 0);
> -
> + {
> + sector_t sz = md_size[mdidx(mddev)];
> + unsigned round = sector_div(sz, conf->smallest->size);
> + nb_zone = conf->nr_zones = sz + (round ? 1 : 0);
> + }
> +
> conf->hash_table = kmalloc (sizeof (struct linear_hash) * nb_zone,
> GFP_KERNEL);
> if (!conf->hash_table)
Something like the following should work for most cases (i.e. as long as
an individual device isn't larger than 2TB):
round = do_div(sz, conf->smallest_size);
> printk("raid0 : conf->smallest->size is %ld blocks.\n", conf->smallest->size);
> nb_zone = md_size[mdidx(mddev)]/conf->smallest->size +
> - (md_size[mdidx(mddev)] % conf->smallest->size ? 1 : 0);
> - printk("raid0 : nb_zone is %ld.\n", nb_zone);
> + (md_size[mdidx(mddev)] % conf->smallest->size ? 1 : 0);
> + printk("raid0 : nb_zone is %d.\n", nb_zone);
Don't we need something similar here also?
Cheers, Andreas
--
Andreas Dilger
http://www-mddsp.enel.ucalgary.ca/People/adilger/
http://sourceforge.net/projects/ext2resize/
next prev parent reply other threads:[~2002-10-03 5:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-10-03 5:20 [PATCH] Large Block device patch part 3/4 peterc
2002-10-03 6:01 ` Andreas Dilger [this message]
[not found] <15772.7481.604681.575483@wombat.chubb.wattle.id.au>
2002-10-03 16:13 ` Linus Torvalds
[not found] <15772.42409.841005.571964@wombat.chubb.wattle.id.au>
2002-10-03 20:24 ` Linus Torvalds
2002-10-04 1:01 ` Peter Chubb
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=20021003060103.GE3000@clusterfs.com \
--to=adilger@clusterfs.com \
--cc=linux-kernel@vger.kernel.org \
--cc=peterc@gelato.unsw.edu.au \
--cc=torvalds@transmeta.com \
/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;
as well as URLs for NNTP newsgroup(s).