mm: dump page when hitting a VM_BUG_ON using VM_BUG_ON_PAGE
[linux-2.6-block.git] / mm / filemap.c
index ae4846ff48494e9ac5e733a5d5339b61763a49f5..7a7f3e0db7384515b6e266029ef930e5c775ec0d 100644 (file)
@@ -409,9 +409,9 @@ int replace_page_cache_page(struct page *old, struct page *new, gfp_t gfp_mask)
 {
        int error;
 
-       VM_BUG_ON(!PageLocked(old));
-       VM_BUG_ON(!PageLocked(new));
-       VM_BUG_ON(new->mapping);
+       VM_BUG_ON_PAGE(!PageLocked(old), old);
+       VM_BUG_ON_PAGE(!PageLocked(new), new);
+       VM_BUG_ON_PAGE(new->mapping, new);
 
        error = radix_tree_preload(gfp_mask & ~__GFP_HIGHMEM);
        if (!error) {
@@ -461,8 +461,8 @@ int add_to_page_cache_locked(struct page *page, struct address_space *mapping,
 {
        int error;
 
-       VM_BUG_ON(!PageLocked(page));
-       VM_BUG_ON(PageSwapBacked(page));
+       VM_BUG_ON_PAGE(!PageLocked(page), page);
+       VM_BUG_ON_PAGE(PageSwapBacked(page), page);
 
        error = mem_cgroup_cache_charge(page, current->mm,
                                        gfp_mask & GFP_RECLAIM_MASK);
@@ -607,7 +607,7 @@ EXPORT_SYMBOL_GPL(add_page_wait_queue);
  */
 void unlock_page(struct page *page)
 {
-       VM_BUG_ON(!PageLocked(page));
+       VM_BUG_ON_PAGE(!PageLocked(page), page);
        clear_bit_unlock(PG_locked, &page->flags);
        smp_mb__after_clear_bit();
        wake_up_page(page, PG_locked);
@@ -760,7 +760,7 @@ repeat:
                        page_cache_release(page);
                        goto repeat;
                }
-               VM_BUG_ON(page->index != offset);
+               VM_BUG_ON_PAGE(page->index != offset, page);
        }
        return page;
 }
@@ -1090,7 +1090,6 @@ static void shrink_readahead_size_eio(struct file *filp,
  * @filp:      the file to read
  * @ppos:      current file position
  * @desc:      read_descriptor
- * @actor:     read method
  *
  * This is a generic file read routine, and uses the
  * mapping->a_ops->readpage() function for the actual low-level stuff.
@@ -1099,7 +1098,7 @@ static void shrink_readahead_size_eio(struct file *filp,
  * of the logic when it comes to error handling etc.
  */
 static void do_generic_file_read(struct file *filp, loff_t *ppos,
-               read_descriptor_t *desc, read_actor_t actor)
+               read_descriptor_t *desc)
 {
        struct address_space *mapping = filp->f_mapping;
        struct inode *inode = mapping->host;
@@ -1200,13 +1199,14 @@ page_ok:
                 * Ok, we have the page, and it's up-to-date, so
                 * now we can copy it to user space...
                 *
-                * The actor routine returns how many bytes were actually used..
+                * The file_read_actor routine returns how many bytes were
+                * actually used..
                 * NOTE! This may not be the same as how much of a user buffer
                 * we filled up (we may be padding etc), so we can only update
                 * "pos" here (the actor routine has to update the user buffer
                 * pointers and the remaining count).
                 */
-               ret = actor(desc, page, offset, nr);
+               ret = file_read_actor(desc, page, offset, nr);
                offset += ret;
                index += offset >> PAGE_CACHE_SHIFT;
                offset &= ~PAGE_CACHE_MASK;
@@ -1479,7 +1479,7 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
                if (desc.count == 0)
                        continue;
                desc.error = 0;
-               do_generic_file_read(filp, ppos, &desc, file_read_actor);
+               do_generic_file_read(filp, ppos, &desc);
                retval += desc.written;
                if (desc.error) {
                        retval = retval ?: desc.error;
@@ -1656,7 +1656,7 @@ retry_find:
                put_page(page);
                goto retry_find;
        }
-       VM_BUG_ON(page->index != offset);
+       VM_BUG_ON_PAGE(page->index != offset, page);
 
        /*
         * We have a locked page in the page cache, now we need to check