xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate
authorNamjae Jeon <namjae.jeon@samsung.com>
Wed, 25 Mar 2015 04:08:56 +0000 (15:08 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 25 Mar 2015 04:08:56 +0000 (15:08 +1100)
commita904b1ca5751faf5ece8600e18cd3b674afcca1b
tree2b757182d3b07c4df47b45571f579cb93af8bc9b
parentdd46c787788d5bf5b974729d43e4c405814a4c7d
xfs: Add support FALLOC_FL_INSERT_RANGE for fallocate

This patch implements fallocate's FALLOC_FL_INSERT_RANGE for XFS.

1) Make sure that both offset and len are block size aligned.
2) Update the i_size of inode by len bytes.
3) Compute the file's logical block number against offset. If the computed
   block number is not the starting block of the extent, split the extent
   such that the block number is the starting block of the extent.
4) Shift all the extents which are lying bewteen [offset, last allocated extent]
   towards right by len bytes. This step will make a hole of len bytes
   at offset.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_bmap.c
fs/xfs/libxfs/xfs_bmap.h
fs/xfs/xfs_bmap_util.c
fs/xfs/xfs_bmap_util.h
fs/xfs/xfs_file.c
fs/xfs/xfs_trace.h