Index: linux-2.6/include/linux/fs.h =================================================================== --- linux-2.6.orig/include/linux/fs.h 2007-04-10 19:29:45.000000000 -0700 +++ linux-2.6/include/linux/fs.h 2007-04-10 19:30:24.000000000 -0700 @@ -435,6 +435,7 @@ struct address_space { struct inode *host; /* owner: inode, block_device */ struct radix_tree_root page_tree; /* radix tree of all pages */ rwlock_t tree_lock; /* and rwlock protecting it */ + unsigned int order; /* Page size in this address space */ unsigned int i_mmap_writable;/* count VM_SHARED mappings */ struct prio_tree_root i_mmap; /* tree of private and shared mappings */ struct list_head i_mmap_nonlinear;/*list VM_NONLINEAR mappings */ Index: linux-2.6/include/linux/pagemap.h =================================================================== --- linux-2.6.orig/include/linux/pagemap.h 2007-04-10 19:37:33.000000000 -0700 +++ linux-2.6/include/linux/pagemap.h 2007-04-10 19:38:24.000000000 -0700 @@ -52,9 +52,9 @@ static inline void mapping_set_gfp_mask( void release_pages(struct page **pages, int nr, int cold); #ifdef CONFIG_NUMA -extern struct page *__page_cache_alloc(gfp_t gfp); +extern struct page *__page_cache_alloc(gfp_t gfp, int order); #else -static inline struct page *__page_cache_alloc(gfp_t gfp) +static inline struct page *__page_cache_alloc(gfp_t gfp, int order) { return alloc_pages(gfp, 0); } @@ -62,12 +62,12 @@ static inline struct page *__page_cache_ static inline struct page *page_cache_alloc(struct address_space *x) { - return __page_cache_alloc(mapping_gfp_mask(x)); + return __page_cache_alloc(mapping_gfp_mask(x), x->order); } static inline struct page *page_cache_alloc_cold(struct address_space *x) { - return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD); + return __page_cache_alloc(mapping_gfp_mask(x)|__GFP_COLD, x->order); } typedef int filler_t(void *, struct page *); Index: linux-2.6/mm/filemap.c =================================================================== --- linux-2.6.orig/mm/filemap.c 2007-04-10 19:31:37.000000000 -0700 +++ linux-2.6/mm/filemap.c 2007-04-10 19:47:01.000000000 -0700 @@ -467,13 +467,13 @@ int add_to_page_cache_lru(struct page *p } #ifdef CONFIG_NUMA -struct page *__page_cache_alloc(gfp_t gfp) +struct page *__page_cache_alloc(gfp_t gfp, int order) { if (cpuset_do_page_mem_spread()) { int n = cpuset_mem_spread_node(); - return alloc_pages_node(n, gfp, 0); + return alloc_pages_node(n, gfp, order); } - return alloc_pages(gfp, 0); + return alloc_pages(gfp, order); } EXPORT_SYMBOL(__page_cache_alloc); #endif @@ -872,29 +872,31 @@ void do_generic_mapping_read(struct addr struct page *cached_page; int error; struct file_ra_state ra = *_ra; + int page_cache_shift = PAGE_CACHE_SHIFT + mapping->order; + int page_cache_mask = (PAGE_SIZE << mapping->order) - 1; cached_page = NULL; - index = *ppos >> PAGE_CACHE_SHIFT; + index = *ppos >> page_cache_shift; next_index = index; prev_index = ra.prev_page; - last_index = (*ppos + desc->count + PAGE_CACHE_SIZE-1) >> PAGE_CACHE_SHIFT; - offset = *ppos & ~PAGE_CACHE_MASK; + last_index = (*ppos + desc->count + page_cache_mask) >> page_cache_shift; + offset = *ppos & ~page_cache_mask; isize = i_size_read(inode); if (!isize) goto out; - end_index = (isize - 1) >> PAGE_CACHE_SHIFT; + end_index = (isize - 1) >> page_cache_shift; for (;;) { struct page *page; unsigned long nr, ret; /* nr is the maximum number of bytes to copy from this page */ - nr = PAGE_CACHE_SIZE; + nr = PAGE_SIZE << mapping->order; if (index >= end_index) { if (index > end_index) goto out; - nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1; + nr = ((isize - 1) & ~page_cache_mask) + 1; if (nr <= offset) { goto out; } @@ -943,8 +945,8 @@ page_ok: */ ret = actor(desc, page, offset, nr); offset += ret; - index += offset >> PAGE_CACHE_SHIFT; - offset &= ~PAGE_CACHE_MASK; + index += offset >> page_cache_shift; + offset &= ~page_cache_mask; page_cache_release(page); if (ret == nr && desc->count) @@ -1008,16 +1010,16 @@ readpage: * another truncate extends the file - this is desired though). */ isize = i_size_read(inode); - end_index = (isize - 1) >> PAGE_CACHE_SHIFT; + end_index = (isize - 1) >> page_cache_shift; if (unlikely(!isize || index > end_index)) { page_cache_release(page); goto out; } /* nr is the maximum number of bytes to copy from this page */ - nr = PAGE_CACHE_SIZE; + nr = PAGE_CACHE_SIZE << mapping->order; if (index == end_index) { - nr = ((isize - 1) & ~PAGE_CACHE_MASK) + 1; + nr = ((isize - 1) & ~page_mask_mask) + 1; if (nr <= offset) { page_cache_release(page); goto out; @@ -1060,7 +1062,7 @@ no_cached_page: out: *_ra = ra; - *ppos = ((loff_t) index << PAGE_CACHE_SHIFT) + offset; + *ppos = ((loff_t) index << page_cache_shift) + offset; if (cached_page) page_cache_release(cached_page); if (filp)