[LU-2016] Layout swapping, MDD part Created: 24/Sep/12 Updated: 05/Aug/20 Resolved: 13/Apr/13 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.4.0 |
| Fix Version/s: | Lustre 2.4.0 |
| Type: | New Feature | Priority: | Minor |
| Reporter: | CEA | Assignee: | Jodi Levi (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | HSM | ||
| Issue Links: |
|
||||||||||||
| Project: | HSM | ||||||||||||
| Rank (Obsolete): | 4118 | ||||||||||||
| Description |
|
Add the possibility to swap the layouts between to files. |
| Comments |
| Comment by Peter Jones [ 24/Sep/12 ] |
|
Jodi will see that this ticket is appropriately assigned |
| Comment by jacques-charles lafoucriere [ 04/Oct/12 ] |
|
Patch is at http://review.whamcloud.com/4189 |
| Comment by Andreas Dilger [ 02/Nov/12 ] |
|
I was thinking that a good sanityt test for the layout swap and layout lock code would be to implement an "lfs swap" command and hook this into the "lfs_migrate" script instead of using "mv". The core "lfs swap"/"lfs_swap" command functionality should be implemented via new llapi helpers: int llapi_fd_layout_swap(int src_fd, int tgt_fd, __u64 flags) { struct ll_layout_swap lls = { .lls_tgt = tgt_fd, .lls_flags = flags }; return ioctl(fd, LL_IOC_LOV_LAYOUT_SWAP, (void *)&lls) } int llapi_file_layout_swap(const char *src_path, const char *tgt_path, __u64 flags) { int src_fd, tgt_fd; src_fd = open(src_path, O_RDONLY); tgt_fd = open(tgt_path, O_RDONLY); /* error handling and such */ return llapi_fd_layout_swap(src_fd, tgt_fd, flags); } Where ll_file_ioctl(LL_IOC_LOV_LAYOUT_SWAP) triggers an MDS RPC to call mdd_swap_layouts(). "lfs swap" wouldn't be 100% atomic yet, since the copy + swap would not yet be safe from other thread modifying the original object during the copy, but it would at least fix the problem of preserving open file handles on the original file and would be a good step toward implementing a full atomic "lfs migrate". A test script for this code could look like:
At some later point (or immediately, if someone is ambitious) lfs_migrate would be implemented with "lfs migrate", which calls lfs_setstripe() internally to process the arguments to create the target object(s), then gets the group lock and does the data copy internally before calling llapi_fd_layout_swap() to do the swap (like an HSM copytool does). At this point, the above "kill -STOP" can be replaced with "kill -0" (just to check that "dd" is still running) and should be able to migrate the file while it is being written. |
| Comment by jacques-charles lafoucriere [ 03/Nov/12 ] |
|
I am implementing lfs swap_layouts in About the open, today I open with O_WRONLY in place of O_RDONLY because swaping is changing file content. |
| Comment by Andreas Dilger [ 13/Apr/13 ] |
|
Change 4189 is landed, can this be closed? |