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.