ChangeSet 1.2231.1.15, 2005/03/28 19:20:20-08:00, [EMAIL PROTECTED]

        [PATCH] unused 'size' assignment in filemap_nopage
        
        filemap_nopage has the following code:
        
        retry_all:
                size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> 
PAGE_CACHE_SHIFT;
                if (pgoff >= size)
                        goto outside_data_content;
        
                /* If we don't want any read-ahead, don't bother */
                if (VM_RandomReadHint(area))
                        goto no_cached_page;
        
                /*
                 * The "size" of the file, as far as mmap is concerned, isn't 
bigger
                 * than the mapping
                 */
                if (size > endoff)
                        size = endoff;
        
        After this, size is not referenced.  So, either this potential 
reassignment
        of size is superfluous, or we are missing some other code later on in 
the
        function.  If it is the former, I've attached a patch which will remove 
the
        code.
        
        (akpm: and endoff can go away too.  That was the unused variable which 
gcc has
        been warning about for ages.  Also, gratuitous whitespace fiddling).
        
        
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 filemap.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)


diff -Nru a/mm/filemap.c b/mm/filemap.c
--- a/mm/filemap.c      2005-03-28 21:09:43 -08:00
+++ b/mm/filemap.c      2005-03-28 21:09:43 -08:00
@@ -1167,7 +1167,8 @@
  * it in the page cache, and handles the special cases reasonably without
  * having a lot of duplicated code.
  */
-struct page * filemap_nopage(struct vm_area_struct * area, unsigned long 
address, int *type)
+struct page *filemap_nopage(struct vm_area_struct *area,
+                               unsigned long address, int *type)
 {
        int error;
        struct file *file = area->vm_file;
@@ -1175,11 +1176,10 @@
        struct file_ra_state *ra = &file->f_ra;
        struct inode *inode = mapping->host;
        struct page *page;
-       unsigned long size, pgoff, endoff;
+       unsigned long size, pgoff;
        int did_readaround = 0, majmin = VM_FAULT_MINOR;
 
-       pgoff = ((address - area->vm_start) >> PAGE_CACHE_SHIFT) + 
area->vm_pgoff;
-       endoff = ((area->vm_end - area->vm_start) >> PAGE_CACHE_SHIFT) + 
area->vm_pgoff;
+       pgoff = ((address-area->vm_start) >> PAGE_CACHE_SHIFT) + area->vm_pgoff;
 
 retry_all:
        size = (i_size_read(inode) + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
@@ -1189,13 +1189,6 @@
        /* If we don't want any read-ahead, don't bother */
        if (VM_RandomReadHint(area))
                goto no_cached_page;
-
-       /*
-        * The "size" of the file, as far as mmap is concerned, isn't bigger
-        * than the mapping
-        */
-       if (size > endoff)
-               size = endoff;
 
        /*
         * The readahead code wants to be told about each and every page
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to