aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-09-03 18:54:35 -0400
committerLinus Torvalds <torvalds@evo.osdl.org>2005-09-05 03:05:41 -0400
commit6eb396dc4a9781c5e7951143ab56ce5710687ab3 (patch)
tree48b165c8934a0f3852344725fee060740dcdfa48 /mm
parent53092a7402f227151a681b0c92ec8598c5618b1a (diff)
[PATCH] swap: swap unsigned int consistency
The swap header's unsigned int last_page determines the range of swap pages, but swap_info has been using int or unsigned long in some cases: use unsigned int throughout (except, in several places a local unsigned long is useful to avoid overflows when adding). Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index d4da84ee3925..6cc6dfb4d27b 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -84,7 +84,7 @@ void swap_unplug_io_fn(struct backing_dev_info *unused_bdi, struct page *page)
84 up_read(&swap_unplug_sem); 84 up_read(&swap_unplug_sem);
85} 85}
86 86
87static inline int scan_swap_map(struct swap_info_struct *si) 87static inline unsigned long scan_swap_map(struct swap_info_struct *si)
88{ 88{
89 unsigned long offset; 89 unsigned long offset;
90 /* 90 /*
@@ -531,10 +531,11 @@ static int unuse_mm(struct mm_struct *mm,
531 * Scan swap_map from current position to next entry still in use. 531 * Scan swap_map from current position to next entry still in use.
532 * Recycle to start on reaching the end, returning 0 when empty. 532 * Recycle to start on reaching the end, returning 0 when empty.
533 */ 533 */
534static int find_next_to_unuse(struct swap_info_struct *si, int prev) 534static unsigned int find_next_to_unuse(struct swap_info_struct *si,
535 unsigned int prev)
535{ 536{
536 int max = si->max; 537 unsigned int max = si->max;
537 int i = prev; 538 unsigned int i = prev;
538 int count; 539 int count;
539 540
540 /* 541 /*
@@ -577,7 +578,7 @@ static int try_to_unuse(unsigned int type)
577 unsigned short swcount; 578 unsigned short swcount;
578 struct page *page; 579 struct page *page;
579 swp_entry_t entry; 580 swp_entry_t entry;
580 int i = 0; 581 unsigned int i = 0;
581 int retval = 0; 582 int retval = 0;
582 int reset_overflow = 0; 583 int reset_overflow = 0;
583 int shmem; 584 int shmem;
@@ -1216,7 +1217,7 @@ static int swap_show(struct seq_file *swap, void *v)
1216 1217
1217 file = ptr->swap_file; 1218 file = ptr->swap_file;
1218 len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\"); 1219 len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\");
1219 seq_printf(swap, "%*s%s\t%d\t%ld\t%d\n", 1220 seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
1220 len < 40 ? 40 - len : 1, " ", 1221 len < 40 ? 40 - len : 1, " ",
1221 S_ISBLK(file->f_dentry->d_inode->i_mode) ? 1222 S_ISBLK(file->f_dentry->d_inode->i_mode) ?
1222 "partition" : "file\t", 1223 "partition" : "file\t",
@@ -1275,8 +1276,8 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1275 static int least_priority; 1276 static int least_priority;
1276 union swap_header *swap_header = NULL; 1277 union swap_header *swap_header = NULL;
1277 int swap_header_version; 1278 int swap_header_version;
1278 int nr_good_pages = 0; 1279 unsigned int nr_good_pages = 0;
1279 int nr_extents; 1280 int nr_extents = 0;
1280 sector_t span; 1281 sector_t span;
1281 unsigned long maxpages = 1; 1282 unsigned long maxpages = 1;
1282 int swapfilesize; 1283 int swapfilesize;
@@ -1509,7 +1510,7 @@ asmlinkage long sys_swapon(const char __user * specialfile, int swap_flags)
1509 nr_swap_pages += nr_good_pages; 1510 nr_swap_pages += nr_good_pages;
1510 total_swap_pages += nr_good_pages; 1511 total_swap_pages += nr_good_pages;
1511 1512
1512 printk(KERN_INFO "Adding %dk swap on %s. " 1513 printk(KERN_INFO "Adding %uk swap on %s. "
1513 "Priority:%d extents:%d across:%lluk\n", 1514 "Priority:%d extents:%d across:%lluk\n",
1514 nr_good_pages<<(PAGE_SHIFT-10), name, p->prio, 1515 nr_good_pages<<(PAGE_SHIFT-10), name, p->prio,
1515 nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10)); 1516 nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10));