]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ext4: Add new ext4_discard_partial_page_buffers routines
authorAllison Henderson <achender@linux.vnet.ibm.com>
Mon, 22 Aug 2011 18:58:53 +0000 (14:58 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 22 Aug 2011 18:58:53 +0000 (14:58 -0400)
commitb870200df773427c1ca0726f8c44da87088ea04e
tree6b0d1d22ccef19cef5a9c749fb72e447c2af185c
parent6adbd7b95949eb5eb81b74c5e982d5ae7d799c58
ext4: Add new ext4_discard_partial_page_buffers routines

This patch adds two new routines: ext4_discard_partial_page_buffers()
and ext4_discard_partial_page_buffers_no_lock().

The ext4_discard_partial_page_buffers() function is a wrapper
function to ext4_discard_partial_page_buffers_no_lock().
The wrapper function locks the page and passes it to
ext4_discard_partial_page_buffers_no_lock().
Calling functions that already have the page locked can call
ext4_discard_partial_page_buffers_no_lock() directly.

The ext4_discard_partial_page_buffers_no_lock() function
zeros a specified range in a page, and unmaps the
corresponding buffer heads.  This function is meant to
be used to update a page and its buffer heads to be zeroed
and unmaped when the corresponding blocks have been released
or will be released.

This routine is used in the following scenarios:
* A hole is punched and the non page aligned regions
  of the head and tail of the hole need to be discarded

* The file is truncated and the partial page beyond EOF needs
  to be discarded

* The end of a hole is in the same page as EOF.  After the
  page is flushed, the partial page beyond EOF needs to be
  discarded.

* A write operation begins or ends inside a hole and the partial
  page appearing before or after the write needs to be discarded

* A write operation extends EOF and the partial page beyond EOF
  needs to be discarded

This function takes a flag EXT4_DSCRD_PARTIAL_PG_ZERO_UNMAPED
which is used when a write operation begins or ends in a hole.
When the EXT4_DSCRD_PARTIAL_PG_ZERO_UNMAPED flag is used, only
buffer heads that are already unmapped will have the corresponding
regions of the page zeroed.

Signed-off-by: Allison Henderson <achender@linux.vnet.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/ext4.h
fs/ext4/inode.c