diff options
author | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 1999-10-09 00:00:47 +0000 |
commit | d6434e1042f3b0a6dfe1b1f615af369486f9b1fa (patch) | |
tree | e2be02f33984c48ec019c654051d27964e42c441 /mm/page_io.c | |
parent | 609d1e803baf519487233b765eb487f9ec227a18 (diff) |
Merge with 2.3.19.
Diffstat (limited to 'mm/page_io.c')
-rw-r--r-- | mm/page_io.c | 82 |
1 files changed, 14 insertions, 68 deletions
diff --git a/mm/page_io.c b/mm/page_io.c index 0f7e6d199..72e8cb95a 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -18,8 +18,6 @@ #include <asm/pgtable.h> -static DECLARE_WAIT_QUEUE_HEAD(lock_queue); - /* * Reads or writes a swap page. * wait=1: start I/O and wait for completion. wait=0: start asynchronous I/O. @@ -35,7 +33,7 @@ static DECLARE_WAIT_QUEUE_HEAD(lock_queue); * that shared pages stay shared while being swapped. */ -static void rw_swap_page_base(int rw, unsigned long entry, struct page *page, int wait, int dolock) +static void rw_swap_page_base(int rw, unsigned long entry, struct page *page, int wait) { unsigned long type, offset; struct swap_info_struct * p; @@ -90,7 +88,6 @@ static void rw_swap_page_base(int rw, unsigned long entry, struct page *page, in } else kstat.pswpout++; - get_page(page); if (p->swap_device) { zones[0] = offset; zones_used = 1; @@ -99,58 +96,26 @@ static void rw_swap_page_base(int rw, unsigned long entry, struct page *page, in } else if (p->swap_file) { struct inode *swapf = p->swap_file->d_inode; int i; - if (swapf->i_op->get_block == NULL - && swapf->i_op->smap != NULL){ - /* - With MS-DOS, we use msdos_smap which returns - a sector number (not a cluster or block number). - It is a patch to enable the UMSDOS project. - Other people are working on better solution. - - It sounds like ll_rw_swap_file defined - its operation size (sector size) based on - PAGE_SIZE and the number of blocks to read. - So using get_block or smap should work even if - smap will require more blocks. - */ - int j; - unsigned int block = offset << 3; - - for (i=0, j=0; j< PAGE_SIZE ; i++, j += 512){ - if (!(zones[i] = swapf->i_op->smap(swapf,block++))) { - printk("rw_swap_page: bad swap file\n"); - return; - } + int j; + unsigned int block = offset + << (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits); + + block_size = swapf->i_sb->s_blocksize; + for (i=0, j=0; j< PAGE_SIZE ; i++, j += block_size) + if (!(zones[i] = bmap(swapf,block++))) { + printk("rw_swap_page: bad swap file\n"); + return; } - block_size = 512; - }else{ - int j; - unsigned int block = offset - << (PAGE_SHIFT - swapf->i_sb->s_blocksize_bits); - - block_size = swapf->i_sb->s_blocksize; - for (i=0, j=0; j< PAGE_SIZE ; i++, j += block_size) - if (!(zones[i] = bmap(swapf,block++))) { - printk("rw_swap_page: bad swap file\n"); - return; - } - zones_used = i; - dev = swapf->i_dev; - } + zones_used = i; + dev = swapf->i_dev; } else { printk(KERN_ERR "rw_swap_page: no swap file or device\n"); - put_page(page); return; } if (!wait) { set_bit(PG_decr_after, &page->flags); atomic_inc(&nr_async_pages); } - if (dolock) { - set_bit(PG_free_swap_after, &page->flags); - p->swap_map[offset]++; - } - set_bit(PG_free_after, &page->flags); /* block_size == PAGE_SIZE/zones_used */ brw_page(rw, page, dev, zones, block_size, 0); @@ -192,29 +157,10 @@ void rw_swap_page(int rw, struct page *page, int wait) PAGE_BUG(page); if (page->inode != &swapper_inode) PAGE_BUG(page); - rw_swap_page_base(rw, entry, page, wait, 1); -} - -/* - * Setting up a new swap file needs a simple wrapper just to read the - * swap signature. SysV shared memory also needs a simple wrapper. - */ -void rw_swap_page_nocache(int rw, unsigned long entry, char *buf) -{ - struct page *page = mem_map + MAP_NR(buf); - - if (TryLockPage(page)) - PAGE_BUG(page); - if (PageSwapCache(page)) - PAGE_BUG(page); - if (page->inode) - PAGE_BUG(page); - page->offset = entry; - rw_swap_page_base(rw, entry, page, 1, 1); + rw_swap_page_base(rw, entry, page, wait); } /* - * shmfs needs a version that doesn't put the page in the page cache! * The swap lock map insists that pages be in the page cache! * Therefore we can't use it. Later when we can remove the need for the * lock map and we can reduce the number of functions exported. @@ -227,5 +173,5 @@ void rw_swap_page_nolock(int rw, unsigned long entry, char *buf, int wait) PAGE_BUG(page); if (PageSwapCache(page)) PAGE_BUG(page); - rw_swap_page_base(rw, entry, page, wait, 0); + rw_swap_page_base(rw, entry, page, wait); } |