* Indirect driver for multi-controller paging.
sz
= (bp
->b_bcount
+511)/512;
off
= bp
->b_blkno
% DMMAX
;
if (bp
->b_blkno
+sz
> nswap
|| off
+sz
> DMMAX
) {
seg
= bp
->b_blkno
/ DMMAX
;
dev
= swdevt
[seg
% nswdev
].sw_dev
;
bp
->b_blkno
= seg
*DMMAX
+ off
;
(*bdevsw
[major(dev
)].d_strategy
)(bp
);
physio(swstrategy
, &rswbuf
, dev
, B_READ
, minphys
);
physio(swstrategy
, &rswbuf
, dev
, B_WRITE
, minphys
);
* System call swapon(name) enables swapping on device name,
* which must be in the swdevsw. Return EBUSY
* if already swapping on this device.
register struct inode
*ip
;
register struct swdevt
*sp
;
if ((ip
->i_mode
&IFMT
) != IFBLK
) {
dev
= (dev_t
)ip
->i_un
.i_rdev
;
if (major(dev
) >= nblkdev
) {
* Search starting at second table entry,
* since first (primary swap area) is freed at boot.
for (sp
= &swdevt
[1]; sp
->sw_dev
; sp
++)
* Swfree(index) frees the index'th portion of the swap map.
* Each of the nswdev devices provides 1/nswdev'th of the swap
* space, which is laid out with blocks of DMMAX pages circularly
swdevt
[index
].sw_freed
= 1;
for (vsbase
= index
*DMMAX
; vsbase
< nswap
; vsbase
+= nswdev
*DMMAX
) {
* Can't free a block starting at 0 in the swapmap
* but need some space for argmap so use 1/2 this
* hunk which needs special treatment anyways.
argdev
= swdevt
[0].sw_dev
;
rminit(argmap
, blk
/2-CLSIZE
, CLSIZE
,
* First of all chunks... initialize the swapmap
* the second half of the hunk.
rminit(swapmap
, blk
/2, blk
/2, "swap", nswapmap
);
rmfree(swapmap
, blk
, vsbase
);