xfs
[Top] [All Lists]

Re: REVIEW: xfs_reno #2

To: David Chinner <dgc@xxxxxxx>
Subject: Re: REVIEW: xfs_reno #2
From: Ruben Porras <ruben.porras@xxxxxxxxxxx>
Date: Thu, 06 Mar 2008 17:11:46 +0100
Cc: Barry Naujok <bnaujok@xxxxxxx>, "xfs@xxxxxxxxxxx" <xfs@xxxxxxxxxxx>
In-reply-to: <20071120013651.GR995458@xxxxxxx>
References: <op.tznnweh23jf8g2@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <20071120013651.GR995458@xxxxxxx>
Sender: xfs-bounce@xxxxxxxxxxx
Am Dienstag, den 20.11.2007, 12:36 +1100 schrieb David Chinner:
> On Thu, Oct 04, 2007 at 02:25:16PM +1000, Barry Naujok wrote:
> > To make this better, ideally we need some form of
> > "swap inodes" function in the kernel, where the entire
> > contents of the inode themselves are swapped. This form
> > can handle any inode and without any of the dir/file/attr/etc
> > copy/swap mechanisms we have in xfs_reno.
> 
> Something like the attached patch?
> 
> This is proof-of-concept. I've compiled it but I haven't tested
> it. Your mission, Barry, should you choose to accept it, it to

Hello again,

I have this week again time to at xfs_reno and xfs_swapino and
xfs_swap_extents functions. I adapted xfs_reno to use these ioctl
instead of the user space dir/file/attr/..., and I move successfully
files and directories (see the problem description later).

Then I run into two problems, one processing directories, and one
processing symlinks, where I do not now how to proceed, and I would like
to have advice.

Firsts, directories:

At this moment it is not possible to use xfs_swap_extents to for
directories:

(extract from xfs_dfrag.c)

        if (VN_CACHED(tvp) != 0) {
                xfs_inval_cached_trace(tip, 0, -1, 0, -1);
                error = xfs_flushinval_pages(tip, 0, -1,
                                FI_REMAPF_LOCKED);
                if (error)
                        goto error0;
        }

        /* Verify O_DIRECT for ftmp */
        if (VN_CACHED(tvp) != 0) {
                error = XFS_ERROR(EINVAL);
                goto error0;
        }

But it is not posible to do an open(2) on a directory with O_DIRECT. I
was unable to find out if this restriction comes from the kernel or from
the glibc, neither why open on dirs with O_DIRECT needs to be forbidden
(hints would be appreciated ;), but changing this snippet to 

        /* There is no O_DIRECT for directories */
        if (VN_CACHED(tvp) != 0 && VN_ISDIR(tvp) == 0) {
                error = XFS_ERROR(EINVAL);
                goto error0;
        }

does the trick. Can we do that?

Second, symlinks:

xfs_swapino and xfs_swap_extents, require the file descriptors of the
related files. However, it is not possible to get from user space the fd
of a symlink, because open(2) follow always the symlinks. I would change
this functions to accept xfs_inode as parameters instead of file
descriptors, and get them in xfs_reno with stat und lstat, but I would
like to get your opinion before changing the ioctls.

Attached the modified xfs_reno.c (process_slink not working).

Regards.

Attachment: xfs_reno.c
Description: Text Data

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