linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Namjae Jeon <namjae.jeon@samsung.com>
To: 'Dmitry Monakhov' <dmonakhov@openvz.org>
Cc: "'Theodore Ts'o'" <tytso@mit.edu>,
	"'Brian Foster'" <bfoster@redhat.com>,
	linux-kernel@vger.kernel.org, xfs@oss.sgi.com,
	"'Christoph Hellwig'" <hch@infradead.org>,
	"'Ashish Sangwan'" <a.sangwan@samsung.com>,
	linux-fsdevel@vger.kernel.org,
	"'Lukáš Czerner'" <lczerner@redhat.com>,
	'linux-ext4' <linux-ext4@vger.kernel.org>
Subject: RE: [PATCH 3/3] ext4: Add support IOC_MOV_DATA ioctl
Date: Fri, 18 Jul 2014 17:50:55 +0900	[thread overview]
Message-ID: <002901cfa265$636d2e50$2a478af0$@samsung.com> (raw)
In-Reply-To: <87tx6ktiay.fsf@openvz.org>

> On Tue, 8 Jul 2014 16:02:28 +0200 (CEST), Lukáš Czerner <lczerner@redhat.com> 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@samsung.com>
> > > To: Dave Chinner <david@fromorbit.com>, Theodore Ts'o <tytso@mit.edu>
> > > Cc: linux-ext4 <linux-ext4@vger.kernel.org>, linux-fsdevel@vger.kernel.org,
> > >     linux-kernel@vger.kernel.org, Lukáš Czerner <lczerner@redhat.com>,
> > >     Brian Foster <bfoster@redhat.com>, Christoph Hellwig <hch@infradead.org>,
> > >     Ashish Sangwan <a.sangwan@samsung.com>, xfs@oss.sgi.com
> > > 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.
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.
Could you elaborate more how it can be shared for unwritten data case ?

> 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? 

> 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
> >

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

  reply	other threads:[~2014-07-18  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 12:00 [PATCH 3/3] ext4: Add support IOC_MOV_DATA ioctl Namjae Jeon
2014-07-08 14:02 ` Lukáš Czerner
2014-07-09  6:35   ` Namjae Jeon
2014-07-14  9:12   ` Dmitry Monakhov
2014-07-18  8:50     ` Namjae Jeon [this message]
2014-07-18 10:38       ` Dmitry Monakhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002901cfa265$636d2e50$2a478af0$@samsung.com' \
    --to=namjae.jeon@samsung.com \
    --cc=a.sangwan@samsung.com \
    --cc=bfoster@redhat.com \
    --cc=dmonakhov@openvz.org \
    --cc=hch@infradead.org \
    --cc=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tytso@mit.edu \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).