ext4: enable "punch hole" functionality
authorAllison Henderson <achender@linux.vnet.ibm.com>
Wed, 25 May 2011 11:41:50 +0000 (07:41 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 25 May 2011 11:41:50 +0000 (07:41 -0400)
commita4bb6b64e39abc0e41ca077725f2a72c868e7622
tree0d911caa13d445d64cce5ea37f424bf066731ea6
parente861304b8ed83fe43e36d46794d72641c82d4636
ext4: enable "punch hole" functionality

This patch adds new routines: "ext4_punch_hole" "ext4_ext_punch_hole"
and "ext4_ext_check_cache"

fallocate has been modified to call ext4_punch_hole when the punch hole
flag is passed.  At the moment, we only support punching holes in
extents, so this routine is pretty much a wrapper for the ext4_ext_punch_hole
routine.

The ext4_ext_punch_hole routine first completes all outstanding writes
with the associated pages, and then releases them.  The unblock
aligned data is zeroed, and all blocks in between are punched out.

The ext4_ext_check_cache routine is very similar to ext4_ext_in_cache
except it accepts a ext4_ext_cache parameter instead of a ext4_extent
parameter.  This routine is used by ext4_ext_punch_hole to check and
see if a block in a hole that has been cached.  The ext4_ext_cache
parameter is necessary because the members ext4_extent structure are
not large enough to hold a 32 bit value.  The existing
ext4_ext_in_cache routine has become a wrapper to this new function.

[ext4 punch hole patch series 5/5 v7]

Signed-off-by: Allison Henderson <achender@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Reviewed-by: Mingming Cao <cmm@us.ibm.com>
fs/ext4/ext4.h
fs/ext4/extents.c
fs/ext4/inode.c