]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext4: make punch hole code path work with bigalloc
authorLukas Czerner <lczerner@redhat.com>
Tue, 28 May 2013 03:33:35 +0000 (23:33 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 28 May 2013 03:33:35 +0000 (23:33 -0400)
commitd23142c6271c499d913d0d5e668b5a4eb6dafcb0
tree71cd768dc0d4dfc9034187393f6084042f775b57
parent61801325f790ea15ba0630a7a26bd80a0741813f
ext4: make punch hole code path work with bigalloc

Currently punch hole is disabled in file systems with bigalloc
feature enabled. However the recent changes in punch hole patch should
make it easier to support punching holes on bigalloc enabled file
systems.

This commit changes partial_cluster handling in ext4_remove_blocks(),
ext4_ext_rm_leaf() and ext4_ext_remove_space(). Currently
partial_cluster is unsigned long long type and it makes sure that we
will free the partial cluster if all extents has been released from that
cluster. However it has been specifically designed only for truncate.

With punch hole we can be freeing just some extents in the cluster
leaving the rest untouched. So we have to make sure that we will notice
cluster which still has some extents. To do this I've changed
partial_cluster to be signed long long type. The only scenario where
this could be a problem is when cluster_size == block size, however in
that case there would not be any partial clusters so we're safe. For
bigger clusters the signed type is enough. Now we use the negative value
in partial_cluster to mark such cluster used, hence we know that we must
not free it even if all other extents has been freed from such cluster.

This scenario can be described in simple diagram:

|FFF...FF..FF.UUU|
 ^----------^
  punch hole

. - free space
| - cluster boundary
F - freed extent
U - used extent

Also update respective tracepoints to use signed long long type for
partial_cluster.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/extents.c
include/trace/events/ext4.h