[patch 7/7] mm: remove legacy cruft

2007-01-12 Thread Nick Piggin
Remove legacy filemap_nopage and all of the .populate API cruft.

This patch is optional and can be left out (eg. for a cleaner merge with -mm),
and rebased after the previous patches go upstream.

 include/linux/mm.h |9 --
 mm/filemap.c   |  195 -
 mm/fremap.c|   71 ++-
 mm/memory.c|   37 ++
 4 files changed, 21 insertions(+), 291 deletions(-)

Signed-off-by: Nick Piggin <[EMAIL PROTECTED]>

Index: linux-2.6/include/linux/mm.h
===
--- linux-2.6.orig/include/linux/mm.h
+++ linux-2.6/include/linux/mm.h
@@ -228,8 +228,6 @@ struct vm_operations_struct {
void (*close)(struct vm_area_struct * area);
struct page * (*fault)(struct vm_area_struct *vma, struct fault_data * 
fdata);
struct page * (*nopage)(struct vm_area_struct * area, unsigned long 
address, int *type);
-   int (*populate)(struct vm_area_struct * area, unsigned long address, 
unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
-
/* notification that a previously read-only page is about to become
 * writable, if an error is returned it will cause a SIGBUS */
int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
@@ -771,8 +769,6 @@ static inline void unmap_shared_mapping_
 
 extern int vmtruncate(struct inode * inode, loff_t offset);
 extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
-extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, 
unsigned long addr, struct page *page, pgprot_t prot);
-extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, 
unsigned long addr, unsigned long pgoff, pgprot_t prot);
 
 #ifdef CONFIG_MMU
 extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
@@ -1083,10 +1079,6 @@ extern void truncate_inode_pages_range(s
 
 /* generic vm_area_ops exported for stackable file systems */
 extern struct page *filemap_fault(struct vm_area_struct *, struct fault_data 
*);
-extern struct page * __deprecated_for_modules filemap_nopage(
-   struct vm_area_struct *, unsigned long, int *);
-extern int __deprecated_for_modules filemap_populate(struct vm_area_struct *,
-   unsigned long, unsigned long, pgprot_t, unsigned long, int);
 
 /* mm/page-writeback.c */
 int write_one_page(struct page *page, int wait);
Index: linux-2.6/mm/filemap.c
===
--- linux-2.6.orig/mm/filemap.c
+++ linux-2.6/mm/filemap.c
@@ -1496,201 +1496,6 @@ page_not_uptodate:
 }
 EXPORT_SYMBOL(filemap_fault);
 
-/*
- * filemap_nopage and filemap_populate are legacy exports that are not used
- * in tree. Scheduled for removal.
- */
-struct page *filemap_nopage(struct vm_area_struct *area,
-   unsigned long address, int *type)
-{
-   struct page *page;
-   struct fault_data fdata;
-   fdata.address = address;
-   fdata.pgoff = ((address - area->vm_start) >> PAGE_CACHE_SHIFT)
-   + area->vm_pgoff;
-   fdata.flags = 0;
-
-   page = filemap_fault(area, );
-   if (type)
-   *type = fdata.type;
-
-   return page;
-}
-EXPORT_SYMBOL(filemap_nopage);
-
-static struct page * filemap_getpage(struct file *file, unsigned long pgoff,
-   int nonblock)
-{
-   struct address_space *mapping = file->f_mapping;
-   struct page *page;
-   int error;
-
-   /*
-* Do we have something in the page cache already?
-*/
-retry_find:
-   page = find_get_page(mapping, pgoff);
-   if (!page) {
-   if (nonblock)
-   return NULL;
-   goto no_cached_page;
-   }
-
-   /*
-* Ok, found a page in the page cache, now we need to check
-* that it's up-to-date.
-*/
-   if (!PageUptodate(page)) {
-   if (nonblock) {
-   page_cache_release(page);
-   return NULL;
-   }
-   goto page_not_uptodate;
-   }
-
-success:
-   /*
-* Found the page and have a reference on it.
-*/
-   mark_page_accessed(page);
-   return page;
-
-no_cached_page:
-   error = page_cache_read(file, pgoff);
-
-   /*
-* The page we want has now been added to the page cache.
-* In the unlikely event that someone removed it in the
-* meantime, we'll just come back here and read it again.
-*/
-   if (error >= 0)
-   goto retry_find;
-
-   /*
-* An error return from page_cache_read can result if the
-* system is low on memory, or a problem occurs while trying
-* to schedule I/O.
-*/
-   return NULL;
-
-page_not_uptodate:
-   lock_page(page);
-
-   /* Did it get truncated 

[patch 7/7] mm: remove legacy cruft

2007-01-12 Thread Nick Piggin
Remove legacy filemap_nopage and all of the .populate API cruft.

This patch is optional and can be left out (eg. for a cleaner merge with -mm),
and rebased after the previous patches go upstream.

 include/linux/mm.h |9 --
 mm/filemap.c   |  195 -
 mm/fremap.c|   71 ++-
 mm/memory.c|   37 ++
 4 files changed, 21 insertions(+), 291 deletions(-)

Signed-off-by: Nick Piggin [EMAIL PROTECTED]

Index: linux-2.6/include/linux/mm.h
===
--- linux-2.6.orig/include/linux/mm.h
+++ linux-2.6/include/linux/mm.h
@@ -228,8 +228,6 @@ struct vm_operations_struct {
void (*close)(struct vm_area_struct * area);
struct page * (*fault)(struct vm_area_struct *vma, struct fault_data * 
fdata);
struct page * (*nopage)(struct vm_area_struct * area, unsigned long 
address, int *type);
-   int (*populate)(struct vm_area_struct * area, unsigned long address, 
unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
-
/* notification that a previously read-only page is about to become
 * writable, if an error is returned it will cause a SIGBUS */
int (*page_mkwrite)(struct vm_area_struct *vma, struct page *page);
@@ -771,8 +769,6 @@ static inline void unmap_shared_mapping_
 
 extern int vmtruncate(struct inode * inode, loff_t offset);
 extern int vmtruncate_range(struct inode * inode, loff_t offset, loff_t end);
-extern int install_page(struct mm_struct *mm, struct vm_area_struct *vma, 
unsigned long addr, struct page *page, pgprot_t prot);
-extern int install_file_pte(struct mm_struct *mm, struct vm_area_struct *vma, 
unsigned long addr, unsigned long pgoff, pgprot_t prot);
 
 #ifdef CONFIG_MMU
 extern int __handle_mm_fault(struct mm_struct *mm,struct vm_area_struct *vma,
@@ -1083,10 +1079,6 @@ extern void truncate_inode_pages_range(s
 
 /* generic vm_area_ops exported for stackable file systems */
 extern struct page *filemap_fault(struct vm_area_struct *, struct fault_data 
*);
-extern struct page * __deprecated_for_modules filemap_nopage(
-   struct vm_area_struct *, unsigned long, int *);
-extern int __deprecated_for_modules filemap_populate(struct vm_area_struct *,
-   unsigned long, unsigned long, pgprot_t, unsigned long, int);
 
 /* mm/page-writeback.c */
 int write_one_page(struct page *page, int wait);
Index: linux-2.6/mm/filemap.c
===
--- linux-2.6.orig/mm/filemap.c
+++ linux-2.6/mm/filemap.c
@@ -1496,201 +1496,6 @@ page_not_uptodate:
 }
 EXPORT_SYMBOL(filemap_fault);
 
-/*
- * filemap_nopage and filemap_populate are legacy exports that are not used
- * in tree. Scheduled for removal.
- */
-struct page *filemap_nopage(struct vm_area_struct *area,
-   unsigned long address, int *type)
-{
-   struct page *page;
-   struct fault_data fdata;
-   fdata.address = address;
-   fdata.pgoff = ((address - area-vm_start)  PAGE_CACHE_SHIFT)
-   + area-vm_pgoff;
-   fdata.flags = 0;
-
-   page = filemap_fault(area, fdata);
-   if (type)
-   *type = fdata.type;
-
-   return page;
-}
-EXPORT_SYMBOL(filemap_nopage);
-
-static struct page * filemap_getpage(struct file *file, unsigned long pgoff,
-   int nonblock)
-{
-   struct address_space *mapping = file-f_mapping;
-   struct page *page;
-   int error;
-
-   /*
-* Do we have something in the page cache already?
-*/
-retry_find:
-   page = find_get_page(mapping, pgoff);
-   if (!page) {
-   if (nonblock)
-   return NULL;
-   goto no_cached_page;
-   }
-
-   /*
-* Ok, found a page in the page cache, now we need to check
-* that it's up-to-date.
-*/
-   if (!PageUptodate(page)) {
-   if (nonblock) {
-   page_cache_release(page);
-   return NULL;
-   }
-   goto page_not_uptodate;
-   }
-
-success:
-   /*
-* Found the page and have a reference on it.
-*/
-   mark_page_accessed(page);
-   return page;
-
-no_cached_page:
-   error = page_cache_read(file, pgoff);
-
-   /*
-* The page we want has now been added to the page cache.
-* In the unlikely event that someone removed it in the
-* meantime, we'll just come back here and read it again.
-*/
-   if (error = 0)
-   goto retry_find;
-
-   /*
-* An error return from page_cache_read can result if the
-* system is low on memory, or a problem occurs while trying
-* to schedule I/O.
-*/
-   return NULL;
-
-page_not_uptodate:
-   lock_page(page);
-
-   /* Did it get truncated