2013/6/24, Andreas Dilger <adilger@xxxxxxxxx>: > On 2013-06-23, at 0:07, Namjae Jeon <linkinjeon@xxxxxxxxx> wrote: > >> From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx> >> >> This patch series introduces 2 new ioctls for ext4. >> >> Truncate_block_range ioctl truncates blocks from source file. > Hi. Andreas. > How is this different from fallocate(FALLOC_FL_PUNCH_HOLE)? That is already > in existing kernels, and portable across multiple filesystems. Dave chinner already answered it. > >> Transfer_block_range ioctl transfers data blocks from source file >> and append them at the end of destination file. > > There is already a similar ioctl for defragmenting files. Is it possible to > use that, or does it have different semantics? For defrag ioctl: struct move_extent { __u32 reserved; /* should be zero */ __u32 donor_fd; /* donor file descriptor */ __u64 orig_start; /* logical start offset in block for orig */ __u64 donor_start; /* logical start offset in block for donor */ __u64 len; /* block length to be moved */ __u64 moved_len; /* moved block length */ }; For this ioctl to work, there are some pre conditions: 1) Contiguous blocks for donor_fd are allocated in user space using fallocate. 2) orig_start and donor_start should be same. The fundamental difference between these 2 ioctls is that in defrag ioctl data is copied, (page by page?) from the extents of source file to the newly allocated extents of donor file. However, in transfer block range ioctl the extents are transfered from the source file and appended at the end of donor file. There is only metadata movement. Thanks. > >> Ioctl1: EXT4_IOC_TRUNCATE_BLOCK_RANGE: >> This ioctl truncates a range of data blocks from file. >> It is useful to remove easily and quickly the garbage data >> at the middle of file. >> >> e.g. we have a movie file and there is long advertisement in movie file. >> user want to remove only advertisement range. > > While this works in theory, there is very little chance that the movie data > will align exactly to filesystem block boundaries. > > Cheers, Andreas > >> 1) Movie file (8GB), There is the adverisement of 500MB size. >> ____________________________________________________________________ -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html