swapfile.c (c60aa176c6de82703f064082b909496fc4fee956) | swapfile.c (858a29900ea2d639759e697be901a60b759cdcfb) |
---|---|
1/* 2 * linux/mm/swapfile.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * Swap reorganised 29.12.95, Stephen Tweedie 6 */ 7 8#include <linux/mm.h> --- 82 unchanged lines hidden (view full) --- 91 */ 92static int discard_swap(struct swap_info_struct *si) 93{ 94 struct swap_extent *se; 95 int err = 0; 96 97 list_for_each_entry(se, &si->extent_list, list) { 98 sector_t start_block = se->start_block << (PAGE_SHIFT - 9); | 1/* 2 * linux/mm/swapfile.c 3 * 4 * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds 5 * Swap reorganised 29.12.95, Stephen Tweedie 6 */ 7 8#include <linux/mm.h> --- 82 unchanged lines hidden (view full) --- 91 */ 92static int discard_swap(struct swap_info_struct *si) 93{ 94 struct swap_extent *se; 95 int err = 0; 96 97 list_for_each_entry(se, &si->extent_list, list) { 98 sector_t start_block = se->start_block << (PAGE_SHIFT - 9); |
99 pgoff_t nr_blocks = se->nr_pages << (PAGE_SHIFT - 9); | 99 sector_t nr_blocks = (sector_t)se->nr_pages << (PAGE_SHIFT - 9); |
100 101 if (se->start_page == 0) { 102 /* Do not discard the swap header page! */ 103 start_block += 1 << (PAGE_SHIFT - 9); 104 nr_blocks -= 1 << (PAGE_SHIFT - 9); 105 if (!nr_blocks) 106 continue; 107 } --- 20 unchanged lines hidden (view full) --- 128 129 while (nr_pages) { 130 struct list_head *lh; 131 132 if (se->start_page <= start_page && 133 start_page < se->start_page + se->nr_pages) { 134 pgoff_t offset = start_page - se->start_page; 135 sector_t start_block = se->start_block + offset; | 100 101 if (se->start_page == 0) { 102 /* Do not discard the swap header page! */ 103 start_block += 1 << (PAGE_SHIFT - 9); 104 nr_blocks -= 1 << (PAGE_SHIFT - 9); 105 if (!nr_blocks) 106 continue; 107 } --- 20 unchanged lines hidden (view full) --- 128 129 while (nr_pages) { 130 struct list_head *lh; 131 132 if (se->start_page <= start_page && 133 start_page < se->start_page + se->nr_pages) { 134 pgoff_t offset = start_page - se->start_page; 135 sector_t start_block = se->start_block + offset; |
136 pgoff_t nr_blocks = se->nr_pages - offset; | 136 sector_t nr_blocks = se->nr_pages - offset; |
137 138 if (nr_blocks > nr_pages) 139 nr_blocks = nr_pages; 140 start_page += nr_blocks; 141 nr_pages -= nr_blocks; 142 143 if (!found_extent++) 144 si->curr_swap_extent = se; --- 1897 unchanged lines hidden --- | 137 138 if (nr_blocks > nr_pages) 139 nr_blocks = nr_pages; 140 start_page += nr_blocks; 141 nr_pages -= nr_blocks; 142 143 if (!found_extent++) 144 si->curr_swap_extent = se; --- 1897 unchanged lines hidden --- |