Comment # 2 on bug 1131931 from
ocfs2-tools related code:
do_file_defrag
 + struct ocfs2_move_extents me = {
 |       .me_start = 0,
 |       .me_len = buf->st_size,
 |       .me_flags = OCFS2_MOVE_EXT_FL_AUTO_DEFRAG
 |  };
 |
 + fd = open64(file, O_RDWR, 0400);
 |
 + ioctl(fd, OCFS2_IOC_MOVE_EXT, &me) //return errno: ENOSPC
      //errno ENOSPC response with "No space left on device".


kernel related code:
ocfs2_defrag_extent()
{
    ... ...
    ret = __ocfs2_claim_clusters(handle, context->data_ac, 1, *len,
                     &new_phys_cpos, &new_len)
    ... ...
    if (new_len != *len) {
        if (!partial) {
            context->range->me_flags &= ~OCFS2_MOVE_EXT_FL_COMPLETE;
            ret = -ENOSPC;
            need_free = 1;
            goto out_commit;
        }
    }
    ... ...
}

------------
This bug has a workround (without remount). when defragfs reports -ENNOSPC, use
dd to create some new files to consume la-window. After ocfs2 switch to another
la-window, re-run defrag may succeed.

```
tw-xfs1:~ # defragfs.ocfs2 /mnt/test_from_dd1
defragfs.ocfs2 1.8.7
[ERROR]Move extent failed:"/mnt/test_from_dd1" - No space left on device
[ERROR]"/mnt/test_from_dd1":No space left on device
tw-xfs1:~ #

tw-xfs1:~ # dd if=/dev/zero of=/mnt/zhm.1 bs=4k count=200
200+0 records in
200+0 records out
819200 bytes (819 kB, 800 KiB) copied, 0.0166738 s, 49.1 MB/s

tw-xfs1:~ # dd if=/dev/zero of=/mnt/zhm.2 bs=1M count=20
20+0 records in
20+0 records out
20971520 bytes (21 MB, 20 MiB) copied, 0.118353 s, 177 MB/s

tw-xfs1:~ # defragfs.ocfs2 /mnt/test_from_dd1
defragfs.ocfs2 1.8.7
/mnt/test_from_dd1: Succeeded
```


You are receiving this mail because: