Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752571Ab3FXGsQ (ORCPT ); Mon, 24 Jun 2013 02:48:16 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:40962 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751473Ab3FXGsP (ORCPT ); Mon, 24 Jun 2013 02:48:15 -0400 MIME-Version: 1.0 In-Reply-To: <03D226D6-9598-473F-90FC-03A389E2A625@dilger.ca> References: <1371967642-3116-1-git-send-email-linkinjeon@gmail.com> <03D226D6-9598-473F-90FC-03A389E2A625@dilger.ca> Date: Mon, 24 Jun 2013 15:48:14 +0900 Message-ID: Subject: Re: [PATCH 0/3] ext4: introduce two new ioctls From: Namjae Jeon To: Andreas Dilger Cc: "tytso@mit.edu" , "adilger.kernel@dilger.ca" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-ext4@vger.kernel.org" , "a.sangwan@samsung.com" , Namjae Jeon Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2562 Lines: 63 2013/6/24, Andreas Dilger : > On 2013-06-23, at 0:07, Namjae Jeon wrote: > >> From: Namjae Jeon >> >> 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-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/