|
The llapi_mv() functionality could benefit from on LU-2016 (MDD layout swap) and LU-2017 (MDC layout swap). Once layout swap is available, {{llapi_mv()} would be able to mknod() a new file on the new MDT and then swap the layout from the old inode to the new one, and delete the old inode.
One complexity of using layout swap for moving the node instead of swapping the objects is that "llapi_swap_layouts()" will not preserve the open file handles or layout lock on the old resource/FID. While applications doing IO on the objects would still be able to read/write the original objects, their open file handle and layout lock would now point to an open-unlinked inode, and likely cause the objects to be unlinked when the file descriptor is closed (due to nlink == 0 on the old inode).
That means the lfs_mv() should only migrate inodes that it knows to be unused. How it does this on the client needs to be figured out, though it presumably would get some kind of error back from the MDS. It isn't possible to just refuse to swap the layout on a file that is open, since that will always be the case for normal layout swap with a temporary open-unlinked file (see LU-2441). Possibly flags could be passed to the layout swap in the case of inode migration to have the MDS return -EBUSY if the "source" inode is in use.
|