aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 15:07:01 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 15:07:01 -0400
commit56f29d7fe452890eeeb7f2b0138b2d95b9745fb6 (patch)
tree01b6b70297c53c9beb8d11eb186fbad9c166b1a2 /mm/filemap.c
parente823aff2d6eb43083abcc75a32ddfb167c324089 (diff)
parent059af497c23492cb1ddcbba11c09dad385960bc0 (diff)
Merge branch 'block' of git://brick.kernel.dk/data/git/linux-2.6-block
* 'block' of git://brick.kernel.dk/data/git/linux-2.6-block: (67 commits) [PATCH] blk_queue_start_tag() shared map race fix [PATCH] Update axboe@suse.de email address [PATCH] fix creating zero sized bio mempools in low memory system [PATCH] CONFIG_BLOCK: blk_congestion_wait() fix [PATCH] CONFIG_BLOCK internal.h cleanups [PATCH] BLOCK: Make USB storage depend on SCSI rather than selecting it [try #6] [PATCH] BLOCK: Make it possible to disable the block layer [try #6] [PATCH] BLOCK: Remove no-longer necessary linux/buffer_head.h inclusions [try #6] [PATCH] BLOCK: Remove no-longer necessary linux/mpage.h inclusions [try #6] [PATCH] BLOCK: Move the msdos device ioctl compat stuff to the msdos driver [try #6] [PATCH] BLOCK: Move the Ext3 device ioctl compat stuff to the Ext3 driver [try #6] [PATCH] BLOCK: Move the Ext2 device ioctl compat stuff to the Ext2 driver [try #6] [PATCH] BLOCK: Move the ReiserFS device ioctl compat stuff to the ReiserFS driver [try #6] [PATCH] BLOCK: Move common FS-specific ioctls to linux/fs.h [try #6] [PATCH] BLOCK: Move the loop device ioctl compat stuff to the loop driver [try #6] [PATCH] BLOCK: Move __invalidate_device() to block_dev.c [try #6] [PATCH] BLOCK: Dissociate generic_writepages() from mpage stuff [try #6] [PATCH] BLOCK: Remove dependence on existence of blockdev_superblock [try #6] [PATCH] BLOCK: Move extern declarations out of fs/*.c into header files [try #6] [PATCH] BLOCK: Don't call block_sync_page() from AFS [try #6] ...
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 3277f3b23524..c4fe97f5ace0 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2020,6 +2020,7 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes)) 2020 if (unlikely(*pos + *count > inode->i_sb->s_maxbytes))
2021 *count = inode->i_sb->s_maxbytes - *pos; 2021 *count = inode->i_sb->s_maxbytes - *pos;
2022 } else { 2022 } else {
2023#ifdef CONFIG_BLOCK
2023 loff_t isize; 2024 loff_t isize;
2024 if (bdev_read_only(I_BDEV(inode))) 2025 if (bdev_read_only(I_BDEV(inode)))
2025 return -EPERM; 2026 return -EPERM;
@@ -2031,6 +2032,9 @@ inline int generic_write_checks(struct file *file, loff_t *pos, size_t *count, i
2031 2032
2032 if (*pos + *count > isize) 2033 if (*pos + *count > isize)
2033 *count = isize - *pos; 2034 *count = isize - *pos;
2035#else
2036 return -EPERM;
2037#endif
2034 } 2038 }
2035 return 0; 2039 return 0;
2036} 2040}
@@ -2491,3 +2495,33 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
2491 } 2495 }
2492 return retval; 2496 return retval;
2493} 2497}
2498
2499/**
2500 * try_to_release_page() - release old fs-specific metadata on a page
2501 *
2502 * @page: the page which the kernel is trying to free
2503 * @gfp_mask: memory allocation flags (and I/O mode)
2504 *
2505 * The address_space is to try to release any data against the page
2506 * (presumably at page->private). If the release was successful, return `1'.
2507 * Otherwise return zero.
2508 *
2509 * The @gfp_mask argument specifies whether I/O may be performed to release
2510 * this page (__GFP_IO), and whether the call may block (__GFP_WAIT).
2511 *
2512 * NOTE: @gfp_mask may go away, and this function may become non-blocking.
2513 */
2514int try_to_release_page(struct page *page, gfp_t gfp_mask)
2515{
2516 struct address_space * const mapping = page->mapping;
2517
2518 BUG_ON(!PageLocked(page));
2519 if (PageWriteback(page))
2520 return 0;
2521
2522 if (mapping && mapping->a_ops->releasepage)
2523 return mapping->a_ops->releasepage(page, gfp_mask);
2524 return try_to_free_buffers(page);
2525}
2526
2527EXPORT_SYMBOL(try_to_release_page);