Merge branch 'for-linus-4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[firefly-linux-kernel-4.4.55.git] / fs / btrfs / compression.c
index b524e02d8cfb3a97b6b2c5dba603c0b2116292c3..c473c42d7d6c4d559dbe1587491cd2fb93804145 100644 (file)
@@ -482,13 +482,12 @@ static noinline int add_ra_bio_pages(struct inode *inode,
                        goto next;
                }
 
-               page = __page_cache_alloc(mapping_gfp_mask(mapping) &
-                                                               ~__GFP_FS);
+               page = __page_cache_alloc(mapping_gfp_constraint(mapping,
+                                                                ~__GFP_FS));
                if (!page)
                        break;
 
-               if (add_to_page_cache_lru(page, mapping, pg_index,
-                                                               GFP_NOFS)) {
+               if (add_to_page_cache_lru(page, mapping, pg_index, GFP_NOFS)) {
                        page_cache_release(page);
                        goto next;
                }
@@ -841,6 +840,9 @@ static void free_workspace(int type, struct list_head *workspace)
        btrfs_compress_op[idx]->free_workspace(workspace);
        atomic_dec(alloc_ws);
 wake:
+       /*
+        * Make sure counter is updated before we wake up waiters.
+        */
        smp_mb();
        if (waitqueue_active(ws_wait))
                wake_up(ws_wait);