[PATCH] BLOCK: Move functions out of buffer code [try #6]
Move some functions out of the buffering code that aren't strictly buffering
specific. This is a precursor to being able to disable the block layer.
(*) Moved some stuff out of fs/buffer.c:
(*) The file sync and general sync stuff moved to fs/sync.c.
(*) The superblock sync stuff moved to fs/super.c.
(*) do_invalidatepage() moved to mm/truncate.c.
(*) try_to_release_page() moved to mm/filemap.c.
(*) Moved some related declarations between header files:
(*) declarations for do_invalidatepage() and try_to_release_page() moved
to linux/mm.h.
(*) __set_page_dirty_buffers() moved to linux/buffer_head.h.
Signed-Off-By: David Howells <dhowells@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
4090959aee
commit
cf9a2ae8d4
30
mm/filemap.c
30
mm/filemap.c
@@ -2491,3 +2491,33 @@ generic_file_direct_IO(int rw, struct kiocb *iocb, const struct iovec *iov,
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* try_to_release_page() - release old fs-specific metadata on a page
|
||||
*
|
||||
* @page: the page which the kernel is trying to free
|
||||
* @gfp_mask: memory allocation flags (and I/O mode)
|
||||
*
|
||||
* The address_space is to try to release any data against the page
|
||||
* (presumably at page->private). If the release was successful, return `1'.
|
||||
* Otherwise return zero.
|
||||
*
|
||||
* The @gfp_mask argument specifies whether I/O may be performed to release
|
||||
* this page (__GFP_IO), and whether the call may block (__GFP_WAIT).
|
||||
*
|
||||
* NOTE: @gfp_mask may go away, and this function may become non-blocking.
|
||||
*/
|
||||
int try_to_release_page(struct page *page, gfp_t gfp_mask)
|
||||
{
|
||||
struct address_space * const mapping = page->mapping;
|
||||
|
||||
BUG_ON(!PageLocked(page));
|
||||
if (PageWriteback(page))
|
||||
return 0;
|
||||
|
||||
if (mapping && mapping->a_ops->releasepage)
|
||||
return mapping->a_ops->releasepage(page, gfp_mask);
|
||||
return try_to_free_buffers(page);
|
||||
}
|
||||
|
||||
EXPORT_SYMBOL(try_to_release_page);
|
||||
|
||||
Reference in New Issue
Block a user