1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

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.
This commit is contained in:
Pawel Jakub Dawidek 2004-09-16 20:38:11 +00:00
parent 656628ee3b
commit fcd57fbe6f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135337

View File

@ -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);