The patch titled

     swap: swap unsigned int consistency

has been added to the -mm tree.  Its filename is

     swap-swap-unsigned-int-consistency.patch

Patches currently in -mm which might be from [EMAIL PROTECTED] are

swap-update-swapfile-i_sem-comment.patch
swap-correct-swapfile-nr_good_pages.patch
swap-move-destroy_swap_extents-calls.patch
swap-swap-extent-list-is-ordered.patch
swap-show-span-of-swap-extents.patch
swap-swap-unsigned-int-consistency.patch
swap-freeing-update-swap_listnext.patch
swap-get_swap_page-drop-swap_list_lock.patch
swap-scan_swap_map-restyled.patch
swap-scan_swap_map-drop-swap_device_lock.patch
swap-scan_swap_map-latency-breaks.patch
swap-swap_lock-replace-listdevice.patch
swap-update-swsusp-use-of-swap_info.patch



From: Hugh Dickins <[EMAIL PROTECTED]>

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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 include/linux/swap.h |    6 +++---
 mm/swapfile.c        |   17 +++++++++--------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff -puN include/linux/swap.h~swap-swap-unsigned-int-consistency 
include/linux/swap.h
--- devel/include/linux/swap.h~swap-swap-unsigned-int-consistency       
2005-07-08 22:34:48.000000000 -0700
+++ devel-akpm/include/linux/swap.h     2005-07-08 22:34:48.000000000 -0700
@@ -129,10 +129,10 @@ struct swap_info_struct {
        unsigned int highest_bit;
        unsigned int cluster_next;
        unsigned int cluster_nr;
+       unsigned int pages;
+       unsigned int max;
+       unsigned int inuse_pages;
        int prio;                       /* swap priority */
-       int pages;
-       unsigned long max;
-       unsigned long inuse_pages;
        int next;                       /* next entry on swap list */
 };
 
diff -puN mm/swapfile.c~swap-swap-unsigned-int-consistency mm/swapfile.c
--- devel/mm/swapfile.c~swap-swap-unsigned-int-consistency      2005-07-08 
22:34:48.000000000 -0700
+++ devel-akpm/mm/swapfile.c    2005-07-08 22:34:48.000000000 -0700
@@ -84,7 +84,7 @@ void swap_unplug_io_fn(struct backing_de
        up_read(&swap_unplug_sem);
 }
 
-static inline int scan_swap_map(struct swap_info_struct *si)
+static inline unsigned long scan_swap_map(struct swap_info_struct *si)
 {
        unsigned long offset;
        /* 
@@ -531,10 +531,11 @@ static int unuse_mm(struct mm_struct *mm
  * Scan swap_map from current position to next entry still in use.
  * Recycle to start on reaching the end, returning 0 when empty.
  */
-static int find_next_to_unuse(struct swap_info_struct *si, int prev)
+static unsigned int find_next_to_unuse(struct swap_info_struct *si,
+                                       unsigned int prev)
 {
-       int max = si->max;
-       int i = prev;
+       unsigned int max = si->max;
+       unsigned int i = prev;
        int count;
 
        /*
@@ -577,7 +578,7 @@ static int try_to_unuse(unsigned int typ
        unsigned short swcount;
        struct page *page;
        swp_entry_t entry;
-       int i = 0;
+       unsigned int i = 0;
        int retval = 0;
        int reset_overflow = 0;
        int shmem;
@@ -1216,7 +1217,7 @@ static int swap_show(struct seq_file *sw
 
        file = ptr->swap_file;
        len = seq_path(swap, file->f_vfsmnt, file->f_dentry, " \t\n\\");
-       seq_printf(swap, "%*s%s\t%d\t%ld\t%d\n",
+       seq_printf(swap, "%*s%s\t%u\t%u\t%d\n",
                       len < 40 ? 40 - len : 1, " ",
                       S_ISBLK(file->f_dentry->d_inode->i_mode) ?
                                "partition" : "file\t",
@@ -1275,7 +1276,7 @@ asmlinkage long sys_swapon(const char __
        static int least_priority;
        union swap_header *swap_header = NULL;
        int swap_header_version;
-       int nr_good_pages = 0;
+       unsigned int nr_good_pages = 0;
        int nr_extents;
        sector_t span;
        unsigned long maxpages = 1;
@@ -1509,7 +1510,7 @@ asmlinkage long sys_swapon(const char __
        nr_swap_pages += nr_good_pages;
        total_swap_pages += nr_good_pages;
 
-       printk(KERN_INFO "Adding %dk swap on %s.  "
+       printk(KERN_INFO "Adding %uk swap on %s.  "
                        "Priority:%d extents:%d across:%lluk\n",
                nr_good_pages<<(PAGE_SHIFT-10), name, p->prio,
                nr_extents, (unsigned long long)span<<(PAGE_SHIFT-10));
_
-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to