xfs
[Top] [All Lists]

RE: [PATCH 3/3] ext4: Add support IOC_MOV_DATA ioctl

To: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Subject: RE: [PATCH 3/3] ext4: Add support IOC_MOV_DATA ioctl
From: Dmitry Monakhov <dmonakhov@xxxxxxxxxx>
Date: Fri, 18 Jul 2014 14:38:12 +0400
Cc: 'Dave Chinner' <david@xxxxxxxxxxxxx>, 'Theodore Ts'o' <tytso@xxxxxxx>, 'linux-ext4' <linux-ext4@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, 'Brian Foster' <bfoster@xxxxxxxxxx>, 'Christoph Hellwig' <hch@xxxxxxxxxxxxx>, 'Ashish Sangwan' <a.sangwan@xxxxxxxxxxx>, xfs@xxxxxxxxxxx, 'LukÃÅ Czerner' <lczerner@xxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=guFA6SYiEyq39rRxLslRmbZF5JnAvamJsBCHSRjg7MY=; b=JpZonRlEDlnUm+mvN1kg3f7YHNiZ9ol4VUOS0iXrn/8HWkrKAFfWgXWZlEYF5kSlrR muyo3wyTg+2i2RiGUV4TMExuDhATD+kKL4GrZG0xIBzHh8oXxfKAebor9IpdTjoVgQdv 53SKQ2ACUolzNZVBH859YPxeyrXk3T0IUnHoNdBdzlC9fpHmMN6bk50/KnueFVfu21t5 SHIQfc37cDAfvXWhkBI5K6N7FF+LlhLeythNcrkRnDm8R/LWUsAoOVsugWqWjKAD7Aa8 SBFaGzfWzyDClWJG0tXNT5hHrFoBL0Y9+dLPZTFWa9HXtgHop5Sx2ss3k8RlAxxDEWfb Q8EA==
In-reply-to: <002901cfa265$636d2e50$2a478af0$@samsung.com>
References: <004001cf9aa4$2670e280$7352a780$@samsung.com> <alpine.LFD.2.00.1407081558280.2180@xxxxxxxxxxxxxxxxxxxxx> <87tx6ktiay.fsf@xxxxxxxxxx> <002901cfa265$636d2e50$2a478af0$@samsung.com>
Sender: Dmitry Monakhov <rjevskiy@xxxxxxxxx>
User-agent: Notmuch/0.6.1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-redhat-linux-gnu)
On Fri, 18 Jul 2014 17:50:55 +0900, Namjae Jeon <namjae.jeon@xxxxxxxxxxx> wrote:
> > On Tue, 8 Jul 2014 16:02:28 +0200 (CEST), LukÃÅ Czerner 
> > <lczerner@xxxxxxxxxx> wrote:
> > Non-text part: MULTIPART/MIXED
> > > On Tue, 8 Jul 2014, Namjae Jeon wrote:
> > >
> > > > Date: Tue, 08 Jul 2014 21:00:02 +0900
> > > > From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
> > > > To: Dave Chinner <david@xxxxxxxxxxxxx>, Theodore Ts'o <tytso@xxxxxxx>
> > > > Cc: linux-ext4 <linux-ext4@xxxxxxxxxxxxxxx>, 
> > > > linux-fsdevel@xxxxxxxxxxxxxxx,
> > > >     linux-kernel@xxxxxxxxxxxxxxx, LukÃÅ Czerner <lczerner@xxxxxxxxxx>,
> > > >     Brian Foster <bfoster@xxxxxxxxxx>, Christoph Hellwig 
> > > > <hch@xxxxxxxxxxxxx>,
> > > >     Ashish Sangwan <a.sangwan@xxxxxxxxxxx>, xfs@xxxxxxxxxxx
> > > > Subject: [PATCH 3/3] ext4: Add support IOC_MOV_DATA ioctl
> > > >
> > > > This patch implements fs ioctl's IOC_MOV_DATA for Ext4.
> > >
> > > Hmm isn't this basically what ext4_move_extents() does ? eg.
> > > EXT4_IOC_MOVE_EXT ?
> > >
> > > I guess that the intention here is to do the move, without actually
> > > moving the data right ? But nevertheless maybe some code can be
> > > shared with ext4_move_extents() ?
> > It definitely can be shared, because it has specific case for unwritten
> > data see move_extent_per_page().
> If I understand correctly, mov_extent_per_page calls mext_replace_branches to
> _replace_ extents from 1 inode to other inode. Please correct me if I
> > > am wrong.
You are right.
> ioc_mov_data will not replace extents, but it will actually _move_ extents 
> into
> hole from donor to receiver, leaving a hole at the place from where extents 
> are
> moved.
So we can refer ext4_move_extents as SWAP, and ioc_mov_data as ASSING.
And both tasks looks very similar, except the way how holes are
interpreted. I think it is reasonable to allow ext4_move_extents()
to interpret holes similar to ioc_mov_data. 
> Could you elaborate more how it can be shared for unwritten data case ?
If we found unwritten extent we do not have to copy data, just swap to
extents between inodes.
> 
> > But I think we can observe another way to unify this two things.
> > An idea inspired by the fact that ioc_move_data works only for
> > regular inodes, where orig_offset == donor_offset. 
> Could you elaborate this point?
At this moment offset for both inodes should be equal. This is pure
artificial restriction. At this moment I'm working on patch which
remove this restriction. 
> 
> > This is showstopper
> > for  my utility e4defrag2 ( new version of e4defrag which is able defragment
> > pack small files as described here :
> > http://lists.openwall.net/linux-ext4/2014/04/28/3)
> > 
> > Proposed API is very similar to ext4_ext_migrate:
> > Args:
> >   orig_file: inode which we want to defragment
> >   donor_file: a file which will be used as a donor of blocks
> > 1) fallocate big donor_file
> > 2) a) Create tmp inode wich nlink = 0
> >    b) move extents required extents from  donor to tmp_donor_inode
> >    c) return file descriptor (tmp_fd) to that tmp_donor_inode
> > 4) Mark orig_file's inode with EXT4_STATE_EXT_MIGRATE state
> > 5) Copy data from orig_file to tmp_fd
> > 6) IOC_SWAP_EX: atomically swap  orig_file->i_data and tmp_fd->i_data
> >    if EXT4_STATE_EXT_MIGRATE was not cleared.
> > 
> > This approach can works not only for regular file w/o journaling
> > enabled, but also for journaled ones, and directories.
> > 
> > 
> > 
> > 
> > >
> > > -Lukas
> > >
> 

<Prev in Thread] Current Thread [Next in Thread>