Merge tag 'vfio-v4.21-rc1' of git://github.com/awilliam/linux-vfio
[linux-2.6-block.git] / mm / shmem.c
index 921f80488bb3fdd03cc7ce64a5a5a6d0f015b794..6ece1e2fe76eb6b6670fc95fc9cf50d294e821cc 100644 (file)
@@ -109,12 +109,14 @@ struct shmem_falloc {
 #ifdef CONFIG_TMPFS
 static unsigned long shmem_default_max_blocks(void)
 {
-       return totalram_pages / 2;
+       return totalram_pages() / 2;
 }
 
 static unsigned long shmem_default_max_inodes(void)
 {
-       return min(totalram_pages - totalhigh_pages, totalram_pages / 2);
+       unsigned long nr_pages = totalram_pages();
+
+       return min(nr_pages - totalhigh_pages(), nr_pages / 2);
 }
 #endif
 
@@ -661,9 +663,7 @@ static int shmem_free_swap(struct address_space *mapping,
 {
        void *old;
 
-       xa_lock_irq(&mapping->i_pages);
-       old = __xa_cmpxchg(&mapping->i_pages, index, radswap, NULL, 0);
-       xa_unlock_irq(&mapping->i_pages);
+       old = xa_cmpxchg_irq(&mapping->i_pages, index, radswap, NULL, 0);
        if (old != radswap)
                return -ENOENT;
        free_swap_and_cache(radix_to_swp_entry(radswap));
@@ -760,7 +760,7 @@ void shmem_unlock_mapping(struct address_space *mapping)
                        break;
                index = indices[pvec.nr - 1] + 1;
                pagevec_remove_exceptionals(&pvec);
-               check_move_unevictable_pages(pvec.pages, pvec.nr);
+               check_move_unevictable_pages(&pvec);
                pagevec_release(&pvec);
                cond_resched();
        }
@@ -3303,7 +3303,7 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo,
                        size = memparse(value,&rest);
                        if (*rest == '%') {
                                size <<= PAGE_SHIFT;
-                               size *= totalram_pages;
+                               size *= totalram_pages();
                                do_div(size, 100);
                                rest++;
                        }