Whamcloud - gitweb
Branch HEAD
[fs/lustre-release.git] / lustre / kernel_patches / patches / grab_cache_page_nowait_gfp-rh-2.4.patch
1 Index: linux-2.4.20/mm/filemap.c
2 ===================================================================
3 --- linux-2.4.20.orig/mm/filemap.c      2004-12-17 17:51:44.000000000 -0500
4 +++ linux-2.4.20/mm/filemap.c   2004-12-17 17:56:54.000000000 -0500
5 @@ -1153,6 +1153,14 @@
6   */
7  struct page *grab_cache_page_nowait(struct address_space *mapping, unsigned long index)
8  {
9 +       return grab_cache_page_nowait_gfp(mapping, index, mapping->gfp_mask);
10 +}
11 +
12 +
13 +struct page *grab_cache_page_nowait_gfp(struct address_space *mapping,
14 +                                       unsigned long index, 
15 +                                       unsigned int gfp_mask)
16 +{
17         struct page *page, **hash;
18  
19         hash = page_hash(mapping, index);
20 @@ -1177,7 +1185,7 @@
21                 }
22         }
23  
24 -       page = page_cache_alloc(mapping);
25 +       page = alloc_pages(gfp_mask, 0);
26         if ( unlikely(!page) )
27                 return NULL;    /* Failed to allocate a page */
28  
29 Index: linux-2.4.20/mm/page_alloc.c
30 ===================================================================
31 --- linux-2.4.20.orig/mm/page_alloc.c   2004-12-17 17:51:30.000000000 -0500
32 +++ linux-2.4.20/mm/page_alloc.c        2004-12-17 18:26:45.000000000 -0500
33 @@ -547,6 +547,8 @@
34                                  */
35                                 return NULL;
36                         }
37 +               } else if (!(gfp_mask & __GFP_HIGH)) {
38 +                       return NULL;
39                 }
40         }
41  
42 Index: linux-2.4.20/kernel/ksyms.c
43 ===================================================================
44 --- linux-2.4.20.orig/kernel/ksyms.c    2004-12-17 17:51:46.000000000 -0500
45 +++ linux-2.4.20/kernel/ksyms.c 2004-12-17 17:52:59.000000000 -0500
46 @@ -300,6 +300,7 @@
47  EXPORT_SYMBOL(__find_lock_page);
48  EXPORT_SYMBOL(find_or_create_page);
49  EXPORT_SYMBOL(grab_cache_page_nowait);
50 +EXPORT_SYMBOL(grab_cache_page_nowait_gfp);
51  EXPORT_SYMBOL(read_cache_page);
52  EXPORT_SYMBOL(set_page_dirty);
53  EXPORT_SYMBOL(vfs_readlink);
54 Index: linux-2.4.20/include/linux/pagemap.h
55 ===================================================================
56 --- linux-2.4.20.orig/include/linux/pagemap.h   2004-05-27 14:25:05.000000000 -0400
57 +++ linux-2.4.20/include/linux/pagemap.h        2004-12-17 18:11:09.000000000 -0500
58 @@ -110,6 +110,7 @@
59  
60  
61  extern struct page * grab_cache_page_nowait (struct address_space *, unsigned long);
62 +extern struct page * grab_cache_page_nowait_gfp (struct address_space *, unsigned long, unsigned int);
63  
64  typedef int filler_t(void *, struct page*);
65