page_io.c (e5451c8f8330e03ad3cfa16048b4daf961af434f) | page_io.c (1170532bb49f9468aedabdc1d5a560e2521a2bcc) |
---|---|
1/* 2 * linux/mm/page_io.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * 6 * Swap reorganised 29.12.95, 7 * Asynchronous swapping added 30.12.95. Stephen Tweedie 8 * Removed race in async swapping. 14.4.1996. Bruno Haible --- 42 unchanged lines hidden (view full) --- 51 * We failed to write the page out to swap-space. 52 * Re-dirty the page in order to avoid it being reclaimed. 53 * Also print a dire warning that things will go BAD (tm) 54 * very quickly. 55 * 56 * Also clear PG_reclaim to avoid rotate_reclaimable_page() 57 */ 58 set_page_dirty(page); | 1/* 2 * linux/mm/page_io.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * 6 * Swap reorganised 29.12.95, 7 * Asynchronous swapping added 30.12.95. Stephen Tweedie 8 * Removed race in async swapping. 14.4.1996. Bruno Haible --- 42 unchanged lines hidden (view full) --- 51 * We failed to write the page out to swap-space. 52 * Re-dirty the page in order to avoid it being reclaimed. 53 * Also print a dire warning that things will go BAD (tm) 54 * very quickly. 55 * 56 * Also clear PG_reclaim to avoid rotate_reclaimable_page() 57 */ 58 set_page_dirty(page); |
59 printk(KERN_ALERT "Write-error on swap-device (%u:%u:%Lu)\n", 60 imajor(bio->bi_bdev->bd_inode), 61 iminor(bio->bi_bdev->bd_inode), 62 (unsigned long long)bio->bi_iter.bi_sector); | 59 pr_alert("Write-error on swap-device (%u:%u:%llu)\n", 60 imajor(bio->bi_bdev->bd_inode), 61 iminor(bio->bi_bdev->bd_inode), 62 (unsigned long long)bio->bi_iter.bi_sector); |
63 ClearPageReclaim(page); 64 } 65 end_page_writeback(page); 66 bio_put(bio); 67} 68 69static void end_swap_bio_read(struct bio *bio) 70{ 71 struct page *page = bio->bi_io_vec[0].bv_page; 72 73 if (bio->bi_error) { 74 SetPageError(page); 75 ClearPageUptodate(page); | 63 ClearPageReclaim(page); 64 } 65 end_page_writeback(page); 66 bio_put(bio); 67} 68 69static void end_swap_bio_read(struct bio *bio) 70{ 71 struct page *page = bio->bi_io_vec[0].bv_page; 72 73 if (bio->bi_error) { 74 SetPageError(page); 75 ClearPageUptodate(page); |
76 printk(KERN_ALERT "Read-error on swap-device (%u:%u:%Lu)\n", 77 imajor(bio->bi_bdev->bd_inode), 78 iminor(bio->bi_bdev->bd_inode), 79 (unsigned long long)bio->bi_iter.bi_sector); | 76 pr_alert("Read-error on swap-device (%u:%u:%llu)\n", 77 imajor(bio->bi_bdev->bd_inode), 78 iminor(bio->bi_bdev->bd_inode), 79 (unsigned long long)bio->bi_iter.bi_sector); |
80 goto out; 81 } 82 83 SetPageUptodate(page); 84 85 /* 86 * There is no guarantee that the page is in swap cache - the software 87 * suspend code (at least) uses end_swap_bio_read() against a non- --- 123 unchanged lines hidden (view full) --- 211 if (page_no == 0) 212 page_no = 1; /* force Empty message */ 213 sis->max = page_no; 214 sis->pages = page_no - 1; 215 sis->highest_bit = page_no - 1; 216out: 217 return ret; 218bad_bmap: | 80 goto out; 81 } 82 83 SetPageUptodate(page); 84 85 /* 86 * There is no guarantee that the page is in swap cache - the software 87 * suspend code (at least) uses end_swap_bio_read() against a non- --- 123 unchanged lines hidden (view full) --- 211 if (page_no == 0) 212 page_no = 1; /* force Empty message */ 213 sis->max = page_no; 214 sis->pages = page_no - 1; 215 sis->highest_bit = page_no - 1; 216out: 217 return ret; 218bad_bmap: |
219 printk(KERN_ERR "swapon: swapfile has holes\n"); | 219 pr_err("swapon: swapfile has holes\n"); |
220 ret = -EINVAL; 221 goto out; 222} 223 224/* 225 * We may have stale swap cache pages in memory: notice 226 * them here and get rid of the unnecessary final write. 227 */ --- 57 unchanged lines hidden (view full) --- 285 * Mark the page dirty and avoid 286 * rotate_reclaimable_page but rate-limit the 287 * messages but do not flag PageError like 288 * the normal direct-to-bio case as it could 289 * be temporary. 290 */ 291 set_page_dirty(page); 292 ClearPageReclaim(page); | 220 ret = -EINVAL; 221 goto out; 222} 223 224/* 225 * We may have stale swap cache pages in memory: notice 226 * them here and get rid of the unnecessary final write. 227 */ --- 57 unchanged lines hidden (view full) --- 285 * Mark the page dirty and avoid 286 * rotate_reclaimable_page but rate-limit the 287 * messages but do not flag PageError like 288 * the normal direct-to-bio case as it could 289 * be temporary. 290 */ 291 set_page_dirty(page); 292 ClearPageReclaim(page); |
293 pr_err_ratelimited("Write error on dio swapfile (%Lu)\n", 294 page_file_offset(page)); | 293 pr_err_ratelimited("Write error on dio swapfile (%llu)\n", 294 page_file_offset(page)); |
295 } 296 end_page_writeback(page); 297 return ret; 298 } 299 300 ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc); 301 if (!ret) { 302 count_vm_event(PSWPOUT); --- 75 unchanged lines hidden --- | 295 } 296 end_page_writeback(page); 297 return ret; 298 } 299 300 ret = bdev_write_page(sis->bdev, swap_page_sector(page), page, wbc); 301 if (!ret) { 302 count_vm_event(PSWPOUT); --- 75 unchanged lines hidden --- |