summaryrefslogtreecommitdiffstats
path: root/sys/dev/md
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2004-09-16 20:38:11 +0000
committerpjd <pjd@FreeBSD.org>2004-09-16 20:38:11 +0000
commitaea0843869a5fabdaaac0b4138f94c83600248be (patch)
tree2173468eb8f29d35e4f4c3d53691d44d271184ef /sys/dev/md
parent37c2202bdec38f25b0a8863179232534beb683be (diff)
downloadFreeBSD-src-aea0843869a5fabdaaac0b4138f94c83600248be.zip
FreeBSD-src-aea0843869a5fabdaaac0b4138f94c83600248be.tar.gz
There is no need to keep 'npage' value inside our softc structure,
it is only used in one function. While doing so, change its type to vm_ooffset_t. We are still limited for swap-backed devices to 16TB on 32-bit architectures where PAGE_SIZE is 4096 bytes.
Diffstat (limited to 'sys/dev/md')
-rw-r--r--sys/dev/md/md.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/dev/md/md.c b/sys/dev/md/md.c
index 4663005..6d5cfa9 100644
--- a/sys/dev/md/md.c
+++ b/sys/dev/md/md.c
@@ -178,7 +178,6 @@ struct md_s {
/* MD_SWAP related fields */
vm_object_t object;
- unsigned npage;
};
static int mddestroy(struct md_s *sc, struct thread *td);
@@ -1002,8 +1001,9 @@ mddestroy(struct md_s *sc, struct thread *td)
static int
mdcreate_swap(struct md_ioctl *mdio, struct thread *td)
{
- int error;
struct md_s *sc;
+ vm_ooffset_t npage;
+ int error;
GIANT_REQUIRED;
@@ -1032,23 +1032,23 @@ mdcreate_swap(struct md_ioctl *mdio, struct thread *td)
* Allocate an OBJT_SWAP object.
*
* sc_nsect is in units of DEV_BSIZE.
- * sc_npage is in units of PAGE_SIZE.
+ * npage is in units of PAGE_SIZE.
*
* Note the truncation.
*/
sc->secsize = DEV_BSIZE;
- sc->npage = mdio->md_size / (PAGE_SIZE / DEV_BSIZE);
- sc->nsect = sc->npage * (PAGE_SIZE / DEV_BSIZE);
+ npage = mdio->md_size / (PAGE_SIZE / DEV_BSIZE);
+ sc->nsect = npage * (PAGE_SIZE / DEV_BSIZE);
if (mdio->md_fwsectors != 0)
sc->fwsectors = mdio->md_fwsectors;
if (mdio->md_fwheads != 0)
sc->fwheads = mdio->md_fwheads;
- sc->object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE *
- (vm_offset_t)sc->npage, VM_PROT_DEFAULT, 0);
+ sc->object = vm_pager_allocate(OBJT_SWAP, NULL, PAGE_SIZE * npage,
+ VM_PROT_DEFAULT, 0);
sc->flags = mdio->md_options & MD_FORCE;
if (mdio->md_options & MD_RESERVE) {
- if (swap_pager_reserve(sc->object, 0, sc->npage) < 0) {
+ if (swap_pager_reserve(sc->object, 0, npage) < 0) {
vm_object_deallocate(sc->object);
sc->object = NULL;
mddestroy(sc, td);
OpenPOWER on IntegriCloud