[Top] [All Lists]

Unifying XFS_IOC_SWAPEXT and EXT4_IOC_MOV_EXT (was Re: [PATCH 2/3] xfs:

To: 'Dave Chinner' <david@xxxxxxxxxxxxx>, 'Theodore Ts'o' <tytso@xxxxxxx>, 'Dmitry Monakhov' <dmonakhov@xxxxxxxxxx>, 'Christoph Hellwig' <hch@xxxxxxxxxxxxx>, 'linux-ext4' <linux-ext4@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, 'Luk?? Czerner' <lczerner@xxxxxxxxxx>, 'Brian Foster' <bfoster@xxxxxxxxxx>, 'Ashish Sangwan' <a.sangwan@xxxxxxxxxxx>, xfs@xxxxxxxxxxx
Subject: Unifying XFS_IOC_SWAPEXT and EXT4_IOC_MOV_EXT (was Re: [PATCH 2/3] xfs: Add support IOC_MOV_DATA ioctl)
From: Namjae Jeon <namjae.jeon@xxxxxxxxxxx>
Date: Wed, 24 Sep 2014 16:53:49 +0900
Delivered-to: xfs@xxxxxxxxxxx
Dlp-filter: Pass
Thread-index: Ac/Xy52Ab6BrJjpeQYusNfdax1wxOA==
> FWIW, what we ideally need for these sorts of defrag programs is
> per-file freezing. i.e. we freeze the file to be defragged, then do
> the copy in userspace, swap/move the copied range and then unfreeze
> it once complete.  That guarantees that the file is not modified in
> any way while userspace is doing the defrag...
I am trying to unify xfs_swap extent and ext4 move extent so that both of these 
could be called via new ioctl mov_data. Both ioctl have different interface
because  both xfs and ext4 have different way of avoiding change in source file
while defrag is running. XFS uses xfs_bstat_t while ext4 performs copying of
data within kernel space after taking mutex lock.
To make them use same approach, we should use something like file sealing as
suggessted by you.
First of all, I am trying to find proper way of sealing file as suggested by
you. I am considering to use S_IMMUTABLE flag set to avoid file modification
during defrag. I am thinking of first syncing  dirty pages, then truncating
page cache pages of inode and lastly setting immutable flag of inode.
This will block further attempts of modifying the file by opening new file
pointer but already open file pointer can still change it.
Although immutable file mean file can not be modified, there is no immutable
check condition in write path and mmap path.
I am wondering it is just missing to add immutable check condition or there
is other reason I am not aware.

> Cheers,
> Dave.
> --
> Dave Chinner
> david@xxxxxxxxxxxxx

<Prev in Thread] Current Thread [Next in Thread>
  • Unifying XFS_IOC_SWAPEXT and EXT4_IOC_MOV_EXT (was Re: [PATCH 2/3] xfs: Add support IOC_MOV_DATA ioctl), Namjae Jeon <=