CIFS: Clarify SMB1 code for POSIX Lock
[linux-2.6-microblaze.git] / mm / swap_state.c
index 272ea21..c56aa9a 100644 (file)
@@ -114,8 +114,6 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry,
        SetPageSwapCache(page);
 
        do {
-               unsigned long nr_shadows = 0;
-
                xas_lock_irq(&xas);
                xas_create_range(&xas);
                if (xas_error(&xas))
@@ -124,7 +122,6 @@ int add_to_swap_cache(struct page *page, swp_entry_t entry,
                        VM_BUG_ON_PAGE(xas.xa_index != idx + i, page);
                        old = xas_load(&xas);
                        if (xa_is_value(old)) {
-                               nr_shadows++;
                                if (shadowp)
                                        *shadowp = old;
                        }
@@ -260,7 +257,6 @@ void clear_shadow_from_swap_cache(int type, unsigned long begin,
        void *old;
 
        for (;;) {
-               unsigned long nr_shadows = 0;
                swp_entry_t entry = swp_entry(type, curr);
                struct address_space *address_space = swap_address_space(entry);
                XA_STATE(xas, &address_space->i_pages, curr);
@@ -270,7 +266,6 @@ void clear_shadow_from_swap_cache(int type, unsigned long begin,
                        if (!xa_is_value(old))
                                continue;
                        xas_store(&xas, NULL);
-                       nr_shadows++;
                }
                xa_unlock_irq(&address_space->i_pages);
 
@@ -291,7 +286,7 @@ void clear_shadow_from_swap_cache(int type, unsigned long begin,
  * try_to_free_swap() _with_ the lock.
  *                                     - Marcelo
  */
-static inline void free_swap_cache(struct page *page)
+void free_swap_cache(struct page *page)
 {
        if (PageSwapCache(page) && !page_mapped(page) && trylock_page(page)) {
                try_to_free_swap(page);
@@ -698,7 +693,12 @@ int init_swap_address_space(unsigned int type, unsigned long nr_pages)
 
 void exit_swap_address_space(unsigned int type)
 {
-       kvfree(swapper_spaces[type]);
+       int i;
+       struct address_space *spaces = swapper_spaces[type];
+
+       for (i = 0; i < nr_swapper_spaces[type]; i++)
+               VM_WARN_ON_ONCE(!mapping_empty(&spaces[i]));
+       kvfree(spaces);
        nr_swapper_spaces[type] = 0;
        swapper_spaces[type] = NULL;
 }
@@ -721,7 +721,6 @@ static void swap_ra_info(struct vm_fault *vmf,
 {
        struct vm_area_struct *vma = vmf->vma;
        unsigned long ra_val;
-       swp_entry_t entry;
        unsigned long faddr, pfn, fpfn;
        unsigned long start, end;
        pte_t *pte, *orig_pte;
@@ -739,11 +738,6 @@ static void swap_ra_info(struct vm_fault *vmf,
 
        faddr = vmf->address;
        orig_pte = pte = pte_offset_map(vmf->pmd, faddr);
-       entry = pte_to_swp_entry(*pte);
-       if ((unlikely(non_swap_entry(entry)))) {
-               pte_unmap(orig_pte);
-               return;
-       }
 
        fpfn = PFN_DOWN(faddr);
        ra_val = GET_SWAP_RA_VAL(vma);