nilfs2: scan dat entries at snapshot creation/deletion time

To accurately count the number of live blocks in a segment, it is
important to take snapshots into account, because snapshots can
protect reclaimable blocks from being cleaned.

This patch uses the previously reserved de_rsv field of the
nilfs_dat_entry structure to store one of the snapshots the
corresponding block belongs to. One block can belong to many
snapshots, but because the snapshots are stored in a sorted linked
list, it is easy to check if a block belongs to any other
snapshot, given the previous and the next snapshot from said linked list.
For example if the current snapshot (in de_ss) is being removed
and neither the previous nor the next snapshot is in the range of
de_start to de_end, then it is guaranteed that the block doesn't
belong to any other snapshot and is reclaimable. On the other hand
if lets say the previous snapshot is in the range of de_start to
de_end, simply set de_ss to the previous snapshot and the block is
not reclaimable.

To implement this every DAT entry is scanned at snapshot
creation/deletion time and updated if needed. To avoid too many
update operations only potentially reclaimable blocks are ever
updated. For example if there are some deleted files and the
checkpoint to which these files belong is turned into a snapshot,
then su_nlive_blks is incremented for these blocks, which reverses
the decrement that happen when the files were deleted. If after
some time this snapshot is deleted, su_nlive_blks is decremented
again to reverse the previous increment.

Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>
nilfs2: add ioctl() to clean snapshot flags from dat entries

temp

Signed-off-by: Andreas Rohner <andreas.rohner@gmx.net>