2 * Copyright (c) 2007, Hartmut Reuter,
3 * RZG, Max-Planck-Institut f. Plasmaphysik.
11 #if defined(AFS_NAMEI_ENV) && !defined(AFS_NT40_ENV)
12 #include <sys/types.h>
14 #ifdef AFS_PTHREAD_ENV
16 #else /* AFS_PTHREAD_ENV */
17 #include <afs/afs_assert.h>
18 #endif /* AFS_PTHREAD_ENV */
42 #include <afs/afsint.h>
46 #include <afs/afssyscalls.h>
47 #include <afs/ihandle.h>
48 #include <afs/vnode.h>
49 #include <afs/volume.h>
50 #include <afs/partition.h>
51 #include <afs/viceinode.h>
56 #include "volser_internal.h"
57 #ifdef AFS_RXOSD_SUPPORT
60 #include "../vol/vol_osd_prototypes.h"
65 #define CHANGEPARENT 4
67 #define NAMEI_VNODEMASK 0x03ffffff
68 #define NAMEI_TAGMASK 0x7
69 #define NAMEI_TAGSHIFT 26
70 #define NAMEI_UNIQMASK 0xffffffff
71 #define NAMEI_UNIQSHIFT 32
80 struct rx_call * call;
86 ExtractVnodes(struct Msg *m, Volume *vol, afs_int32 class,
87 struct VnodeExtract **list,
88 afs_uint32 *length, afs_uint32 where,
89 struct VnodeDiskObject *vd,
90 afs_uint32 *parent, struct VnodeDiskObject *parentvd)
93 char buf[SIZEOF_LARGEDISKVNODE];
94 struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)&buf;
96 StreamHandle_t *stream = 0;
97 struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
98 struct VnodeExtract *e;
106 fdP = IH_OPEN(vol->vnodeIndex[class].handle);
108 sprintf(m->line, "Couldn't open %s Index of volume %u\n",
109 class ? "small":"large", V_id(vol));
110 rx_Write(m->call, m->line, strlen(m->line));
114 size = FDH_SIZE(fdP);
115 *list = (struct VnodeExtract *) malloc(size / vcp->diskSize
116 * sizeof(struct VnodeExtract));
121 memset(*list, 0, size / vcp->diskSize * sizeof(struct VnodeExtract));
122 stream = FDH_FDOPEN(fdP, "r");
124 sprintf(m->line, "Couldn't stream open %s Index of volume %u\n",
125 class ? "small":"large", V_id(vol));
126 rx_Write(m->call, m->line, strlen(m->line));
130 code = STREAM_ASEEK(stream, vcp->diskSize);
134 offset = vcp->diskSize;
136 while (!STREAM_EOF(stream)) {
137 afs_int32 vN = (offset >> (vcp->logSize -1)) - 1 + class;
138 if (STREAM_READ(vnode, vcp->diskSize, 1, stream) == 1) {
139 if (vnode->type != vNull) {
141 e->parent = vnode->parent;
142 if (vN == where && class == vLarge) {
143 memcpy(vd, vnode, vcp->diskSize);
144 *parent = vnode->parent;
148 offset += vcp->diskSize;
151 *length = (e - *list);
152 if (class == vLarge) {
154 offset = (*parent + 1 - class) << (vcp->logSize -1);
155 code = STREAM_ASEEK(stream, offset);
156 if (STREAM_READ(vnode, vcp->diskSize, 1, stream) == 1)
157 memcpy(parentvd, vnode, vcp->diskSize);
161 sprintf(m->line, "SplitVolume: extract didn't see directory %u\n", where);
162 rx_Write(m->call, m->line, strlen(m->line));
167 sprintf(m->line, "Volume %u has %u %s vnodes in volume %u\n",
168 V_parentId(vol), *length, class? "small":"large",
170 rx_Write(m->call, m->line, strlen(m->line));
175 STREAM_CLOSE(stream);
186 FindVnodes(struct Msg *m, afs_uint32 where,
187 struct VnodeExtract *list, afs_int32 length,
188 struct VnodeExtract *dlist, afs_int32 dlength,
189 afs_uint32 *needed, afs_int32 class)
191 afs_int32 i, j, found = 0;
192 afs_int32 parent = 0;
195 for (i=0; i<length; i++) {
196 if (list[i].vN == where) { /* dir to be replaced by mount point */
197 list[i].flag |= NEEDED;
198 parent = list[i].parent;
202 if (list[i].parent == where) { /* all 1st generation children */
203 list[i].flag |= (NEEDED + CHANGEPARENT);
207 if (list[0].vN & 1) { /* only for directories */
210 "SplitVolume: directory %u where to start new volume not found\n",
212 rx_Write(m->call, m->line, strlen(m->line));
216 for (i=0; i<length; i++) {
217 if (list[i].vN == parent) { /* dir where to create mount point */
218 list[i].flag |= PARENT;
224 sprintf(m->line, "SplitVolume: parent directory %u not found\n",
226 rx_Write(m->call, m->line, strlen(m->line));
233 for (i=0; i<dlength; i++) {
234 if (!(dlist[i].flag & NEEDED)) /* dirs to remain in old volume */
236 for (j=0; j<length; j++) {
237 if (list[j].parent == dlist[i].vN && !(list[j].flag & NEEDED)) {
238 list[j].flag |= NEEDED;
246 sprintf(m->line, "%u %s vnodes will go into the new volume\n",
247 *needed, class ? "small" : "large");
248 rx_Write(m->call, m->line, strlen(m->line));
254 copyDir(struct Msg *m, IHandle_t *inh, IHandle_t *outh)
256 FdHandle_t *infdP, *outfdP;
261 infdP = IH_OPEN(inh);
263 sprintf(m->line, "Couldn't open input directory %u.%u.%u\n",
264 infdP->fd_ih->ih_vid,
265 (afs_uint32)(infdP->fd_ih->ih_ino & NAMEI_VNODEMASK),
266 (afs_uint32)(infdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT));
267 rx_Write(m->call, m->line, strlen(m->line));
270 outfdP = IH_OPEN(outh);
272 sprintf(m->line, "Couldn't open output directory %u.%u.%u\n",
273 outfdP->fd_ih->ih_vid,
274 (afs_uint32)(outfdP->fd_ih->ih_ino & NAMEI_VNODEMASK),
275 (afs_uint32)(outfdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT));
276 rx_Write(m->call, m->line, strlen(m->line));
277 FDH_REALLYCLOSE(infdP);
282 size = FDH_SIZE(infdP);
285 tlen = size > 2048 ? 2048 : size;
286 if (FDH_PREAD(infdP, tbuf, tlen, offset) != tlen) {
287 sprintf(m->line, "Couldn't read directory %u.%u.%u\n",
288 infdP->fd_ih->ih_vid,
289 (afs_uint32)(infdP->fd_ih->ih_ino & NAMEI_VNODEMASK),
290 (afs_uint32)(infdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT));
291 rx_Write(m->call, m->line, strlen(m->line));
292 FDH_REALLYCLOSE(infdP);
293 FDH_REALLYCLOSE(outfdP);
297 if (FDH_PWRITE(outfdP, tbuf, tlen, offset) != tlen) {
298 sprintf(m->line, "Couldn't write directory %u.%u.%u\n",
299 outfdP->fd_ih->ih_vid,
300 (afs_uint32)(outfdP->fd_ih->ih_ino & NAMEI_VNODEMASK),
301 (afs_uint32)(outfdP->fd_ih->ih_ino >> NAMEI_UNIQSHIFT));
302 rx_Write(m->call, m->line, strlen(m->line));
303 FDH_REALLYCLOSE(infdP);
304 FDH_REALLYCLOSE(outfdP);
313 FDH_REALLYCLOSE(infdP);
317 afs_int32 copyVnodes(struct Msg *m, Volume *vol, Volume *newvol,
319 struct VnodeExtract *list, afs_int32 length,
320 afs_int32 where, afs_uint64 *blocks,
321 struct VnodeDiskObject *parVnode)
323 afs_int32 i, code = 0;
324 char buf[SIZEOF_LARGEDISKVNODE];
325 struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)&buf;
327 FdHandle_t *newfdP = 0;
328 struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
329 struct VnodeExtract *e;
334 fdP = IH_OPEN(vol->vnodeIndex[class].handle);
336 Log("Couldn't open %s Index of volume %u\n",
337 class ? "small":"large", V_id(vol));
341 newfdP = IH_OPEN(newvol->vnodeIndex[class].handle);
343 Log("Couldn't open %s Index of volume %u\n",
344 class ? "small":"large", V_id(newvol));
348 size = FDH_SIZE(fdP);
350 for (i=0; i<length; i++) {
354 offset = (e->vN + 1 - class) << (vcp->logSize -1);
355 if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
356 Log("Couldn't read in %s Index of volume %u at offset %"
357 AFS_UINT64_FMT "\n", class ? "small":"large",
362 if (e->flag & PARENT) {
364 * do a preventive copy on write for later update
368 #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
370 V_pref(vol,nearInode)
373 newino = IH_CREATE(V_linkHandle(vol), V_device(vol),
374 VPartitionPath(V_partition(vol)),
375 nearInode, V_parentId(vol),
376 e->vN, vnode->uniquifier,
378 IH_INIT(newh, V_device(vol), V_parentId(vol), newino);
379 ino = VNDISK_GET_INO(vnode);
380 IH_INIT(h, V_device(vol), V_parentId(vol), ino);
381 code = copyDir(m, h, newh);
384 /* Now update the vnode and write it back to disk */
385 VNDISK_SET_INO(vnode, newino);
387 if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
388 Log("Couldn't write in %s Index of volume %u at offset %"
389 AFS_UINT64_FMT "\n", class ? "small":"large",
394 memcpy(parVnode, vnode, sizeof(struct VnodeDiskObject));
396 if (e->flag & NEEDED && e->vN != where) {
397 VNDISK_GET_LEN(size, vnode);
398 *blocks += (size + 0x3ff) >> 10;
399 ino = VNDISK_GET_INO(vnode);
403 #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
404 V_pref(vol,nearInode)
406 IH_INIT(h, vol->device, V_parentId(vol), ino);
407 if (e->parent == where)
409 newino = IH_CREATE(V_linkHandle(newvol), V_device(newvol),
410 VPartitionPath(V_partition(newvol)),
411 nearInode, V_parentId(newvol),
412 e->vN, vnode->uniquifier,
414 if (!VALID_INO(newino)) {
415 Log("IH_CREATE failed for %u.%u.%u\n",
416 V_id(newvol), e->vN, vnode->uniquifier);
421 IH_INIT(newh, newvol->device, V_parentId(newvol), newino);
422 code = namei_replace_file_by_hardlink(newh, h);
423 VNDISK_SET_INO(vnode, newino);
424 #ifdef AFS_RXOSD_SUPPORT
426 code = osd_split_objects(vol, newvol, vnode, e->vN);
427 #endif /* AFS_RXOSD_SUPPORT */
431 if (e->flag & CHANGEPARENT)
432 vnode->parent = 1; /* in new root-directory */
434 if (FDH_PWRITE(newfdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
435 Log("Couldn't write in %s Index of volume %u to offset %"
436 AFS_UINT64_FMT "\n", class ? "small":"large",
437 V_id(newvol), offset);
445 * Now copy the root directory from old to new volume
447 if (class == vLarge) {
449 char buf2[SIZEOF_LARGEDISKVNODE];
450 struct VnodeDiskObject *vnode2 = (struct VnodeDiskObject *)&buf2;
451 afs_uint64 newoffset;
453 newoffset = vcp->diskSize;
454 if (FDH_PREAD(newfdP, vnode2, vcp->diskSize, newoffset) != vcp->diskSize) {
455 Log("splitvolume: couldn't read in large Index of new volume %u at offset %u\n",
456 V_id(newvol), vcp->diskSize);
460 offset = (where + 1 - class) << (vcp->logSize -1);
461 if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
462 Log("Couldn't read in large Index of old volume %u at offset %"
463 AFS_UINT64_FMT "\n", V_id(vol), offset);
467 VNDISK_GET_LEN(size, vnode);
468 *blocks += (size + 0x3ff) >> 10;
469 ino = VNDISK_GET_INO(vnode);
470 IH_INIT(h, vol->device, V_parentId(vol), ino);
471 newino = VNDISK_GET_INO(vnode2);
472 IH_INIT(newh, newvol->device, V_parentId(newvol), newino);
473 code = copyDir(m, h, newh);
475 Log("splitvolume: copyDir failed for new root from "
476 "%u.%u.%u to %u.1.1\n",
477 V_id(vol), where, vnode->uniquifier, V_id(newvol));
481 VNDISK_SET_INO(vnode, newino);
482 vnode->uniquifier = 1;
484 vnode->parent = vnode2->parent;
485 vnode->serverModifyTime = vnode2->serverModifyTime;
486 if (FDH_PWRITE(newfdP, vnode, vcp->diskSize, newoffset) != vcp->diskSize) {
487 Log("splitvolume: couldn't write in large Index of %u at offset %u\n",
488 V_id(newvol), vcp->diskSize);
501 findName(Volume *vol, struct VnodeDiskObject *vd, afs_uint32 vN,
502 afs_uint32 un, char *name,afs_int32 length)
508 ino = VNDISK_GET_INO(vd);
509 SetSalvageDirHandle(&dir, V_id(vol), V_device(vol), ino);
511 code = InverseLookup(&dir, vN, un, name, length);
517 createMountpoint(Volume *vol, Volume *newvol, struct VnodeDiskObject *parent,
518 afs_uint32 vN, struct VnodeDiskObject *vd, char *name)
524 struct VnodeDiskObject vnode;
525 FdHandle_t *fdP, *fdP2;
528 afs_int32 class = vSmall;
529 struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
530 #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
539 FT_GetTimeOfDay(&now, 0);
540 fdP = IH_OPEN(vol->vnodeIndex[vSmall].handle);
542 Log("split volume: error opening small vnode index of %u\n", V_id(vol));
545 offset = vcp->diskSize;
547 rc = FDH_PREAD(fdP, &vnode, vcp->diskSize, offset);
548 if (rc != vcp->diskSize) {
550 Log("split volume: error reading small vnode index of %u\n", V_id(vol));
555 if (rc < vcp->diskSize)
558 if (vnode.type == vNull)
560 offset += vcp->diskSize;
562 memset(&vnode, 0, sizeof(vnode));
563 vnode.type = vSymlink;
564 V_nextVnodeUnique(vol)++;
565 vnode.uniquifier = V_nextVnodeUnique(vol);
566 vnode.author = vd->author;
567 vnode.owner = vd->owner;
568 vnode.group = vd->group;
569 vnode.modeBits = 0644;
570 vnode.unixModifyTime = now.tv_sec;
571 vnode.serverModifyTime = now.tv_sec;
572 vnode.dataVersion = 1;
576 newvN = (offset >> (VnodeClassInfo[class].logSize - 1)) - 1 + class;
577 #if defined(NEARINODE_HINT) && !defined(AFS_NAMEI_ENV)
578 V_pref(vol,nearInode)
580 newino = IH_CREATE(V_linkHandle(vol), V_device(vol),
581 VPartitionPath(V_partition(vol)), nearInode,
582 V_parentId(vol), newvN, vnode.uniquifier, 1);
584 IH_INIT(h, V_device(vol), V_parentId(vol), newino);
587 Log("split volume: couldn't open inode for mountpoint %u.%u.%u\n",
588 V_id(vol), newvN, vnode.uniquifier);
591 sprintf(symlink, "#%s", V_name(newvol));
592 size = strlen(symlink) + 1;
593 if (FDH_PWRITE(fdP2, symlink, size, 0) != size) {
594 Log("split volume: couldn't write mountpoint %u.%u.%u\n",
595 V_id(vol), newvN, vnode.uniquifier);
598 FDH_REALLYCLOSE(fdP2);
600 VNDISK_SET_INO(&vnode, newino);
601 VNDISK_SET_LEN(&vnode, size);
602 #ifndef AFS_RXOSD_SUPPORT
603 vnode.vnodeMagic = SMALLVNODEMAGIC;
605 if (FDH_PWRITE(fdP, &vnode, vcp->diskSize, offset) != vcp->diskSize) {
606 Log("split volume: couldn't write vnode for mountpoint %u.%u.%u\n",
607 V_id(vol), newvN, vnode.uniquifier);
610 FDH_REALLYCLOSE(fdP);
612 fid.Volume = V_id(vol);
614 fid.Unique = vnode.uniquifier;
617 * Now update the parent directory.
620 ino = VNDISK_GET_INO(parent);
621 SetSalvageDirHandle(&dir, V_id(vol), V_device(vol), ino);
623 code = Delete(&dir, name);
625 Log("splitvolume: couldn't delete directory entry for %s in %u.%u.%u, code = %d\n",
626 name, V_id(vol), vN, parent->uniquifier, code);
629 code = Create(&dir, name, &fid);
633 vcp = &VnodeClassInfo[class];
634 fdP = IH_OPEN(vol->vnodeIndex[class].handle);
635 offset = (vN + 1 - class) << (vcp->logSize -1);
636 parent->dataVersion++;
637 if (FDH_PWRITE(fdP, parent, vcp->diskSize, offset) != vcp->diskSize) {
638 Log("split volume: couldn't write vnode for parent directory %u.%u.%u\n",
639 V_id(vol), vN, parent->uniquifier);
642 FDH_REALLYCLOSE(fdP);
647 deleteVnodes(Volume *vol, afs_int32 class,
648 struct VnodeExtract *list, afs_int32 length,
651 afs_int32 i, code = 0;
652 char buf[SIZEOF_LARGEDISKVNODE];
653 struct VnodeDiskObject *vnode = (struct VnodeDiskObject *)&buf;
655 struct VnodeClassInfo *vcp = &VnodeClassInfo[class];
656 struct VnodeExtract *e;
661 fdP = IH_OPEN(vol->vnodeIndex[class].handle);
663 Log("Couldn't open %s Index of volume %u\n",
664 class ? "small":"large", V_id(vol));
669 for (i=0; i<length; i++) {
671 if (e->flag & NEEDED) {
672 offset = (e->vN + 1 - class) << (vcp->logSize -1);
673 if (FDH_PREAD(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
674 Log("Couldn't read in %s Index of volume %u at offset %"
675 AFS_UINT64_FMT "\n", class ? "small":"large", V_id(vol),
680 VNDISK_GET_LEN(size, vnode);
681 *blocks += (size + 0x3ff) >> 10;
682 ino = VNDISK_GET_INO(vnode);
685 IH_INIT(h, vol->device, V_parentId(vol), ino);
686 IH_DEC(h, ino, V_parentId(vol));
687 #ifdef AFS_RXOSD_SUPPORT
689 code = osdRemove(vol, vnode, e->vN);
690 #endif /* AFS_RXOSD_SUPPORT */
692 memset(vnode, 0, vcp->diskSize);
694 if (FDH_PWRITE(fdP, vnode, vcp->diskSize, offset) != vcp->diskSize) {
695 Log("Couldn't write in %s Index of volume %u to offset %"
696 AFS_UINT64_FMT "\n", class ? "small":"large",
708 split_volume(struct rx_call *call, Volume *vol, Volume *newvol,
709 afs_uint32 where, afs_int32 verbose)
712 struct VnodeExtract *dirList = 0;
713 struct VnodeExtract *fileList = 0;
714 afs_uint64 blocks = 0;
715 afs_uint32 filesNeeded, dirsNeeded;
717 char buf[SIZEOF_LARGEDISKVNODE];
718 char buf2[SIZEOF_LARGEDISKVNODE];
719 struct VnodeDiskObject *rootVnode = (struct VnodeDiskObject *)&buf;
720 struct VnodeDiskObject *parVnode = (struct VnodeDiskObject *)&buf2;
725 m = (struct Msg *) malloc(sizeof(struct Msg));
726 memset(m, 0, sizeof(struct Msg));
728 m->verbose = verbose;
731 * First step: planning
733 * Find out which directories will belong to the new volume
738 "1st step: extract vnode essence from large vnode file\n");
739 rx_Write(m->call, m->line, strlen(m->line));
742 code = ExtractVnodes(m, vol, vLarge, &dirList, &dl, where, rootVnode,
746 "ExtractVnodes failed for %u for directories with code %d\n",
748 rx_Write(m->call, m->line, strlen(m->line));
753 sprintf(m->line, "2nd step: look for name of vnode %u in directory %u.%u.%u\n",
754 where, V_id(vol), parent, parVnode->uniquifier);
755 rx_Write(m->call, m->line, strlen(m->line));
757 code = findName(vol, parVnode, where, rootVnode->uniquifier,
761 "splitvolume: could'nt find name of %u in directory %u.%u.%u.\n",
762 where, V_id(vol), parent, parVnode->uniquifier);
763 rx_Write(m->call, m->line, strlen(m->line));
767 sprintf(m->line, "name of %u is %s\n", where, name);
768 rx_Write(m->call, m->line, strlen(m->line));
772 sprintf(m->line, "3rd step: find all directory vnodes belonging to the subtree under %u \"%s\"\n",
774 rx_Write(m->call, m->line, strlen(m->line));
776 code = FindVnodes(m, where, dirList, dl, dirList, dl, &dirsNeeded, 1);
779 "FindVnodes for directories failed with code %d\n", code);
780 rx_Write(m->call, m->line, strlen(m->line));
785 sprintf(m->line, "4th step extract vnode essence from small vnode file\n");
786 rx_Write(m->call, m->line, strlen(m->line));
788 code = ExtractVnodes(m, vol, vSmall, &fileList, &fl, where, 0, 0, 0);
791 "ExtractVnodes failed for %u for files with code %d\n",
793 rx_Write(m->call, m->line, strlen(m->line));
797 sprintf(m->line, "5th step: find all small vnodes belonging to the subtree under %u \"%s\"\n",
799 rx_Write(m->call, m->line, strlen(m->line));
801 FindVnodes(m, where, fileList, fl, dirList, dl, &filesNeeded, 0);
804 * Third step: create hard links for all files needed
808 V_destroyMe(newvol) = DESTROY_ME;
809 V_inService(newvol) = 0;
811 sprintf(m->line, "6th step: create hard links in the AFSIDat tree between files of the old and new volume\n");
812 rx_Write(m->call, m->line, strlen(m->line));
814 code = copyVnodes(m, vol, newvol, 1, fileList, fl, where, &blocks, 0);
816 sprintf(m->line, "copyVnodes for files failed with code %d\n", code);
817 rx_Write(m->call, m->line, strlen(m->line));
822 * Forth step: create hard links for all directories and copy
823 * split directory to new root directory
827 sprintf(m->line, "7th step: create hard links in the AFSIDat tree between directories of the old and new volume and make dir %u to new volume's root directory.\n",
829 rx_Write(m->call, m->line, strlen(m->line));
831 code = copyVnodes(m, vol, newvol, 0, dirList, dl, where, &blocks, parVnode);
833 sprintf(m->line, "copyVnodes for directories failed with code %d\n", code);
834 rx_Write(m->call, m->line, strlen(m->line));
839 * Finalize new volume
843 sprintf(m->line, "8th step: write new volume's metadata to disk\n");
844 rx_Write(m->call, m->line, strlen(m->line));
847 V_diskused(newvol) = blocks;
848 #ifdef AFS_RXOSD_SUPPORT
849 V_osdFlag(newvol) = V_osdFlag(vol);
851 V_filecount(newvol) = filesNeeded + dirsNeeded;
852 V_destroyMe(newvol) = 0;
853 V_maxquota(newvol) = V_maxquota(vol);
854 V_uniquifier(newvol) = V_uniquifier(vol);
855 V_inService(newvol) = 1;
856 VUpdateVolume(&code, newvol);
859 * Sixth step: change directory entry in old volume:
860 * rename old tree and create mount point for new volume.
863 sprintf(m->line, "9th step: create mountpoint \"%s\" for new volume in old volume's directory %u.\n", name, parent);
864 rx_Write(m->call, m->line, strlen(m->line));
867 code = createMountpoint(vol, newvol, parVnode, parent, rootVnode, name);
869 sprintf(m->line, "createMountpoint failed with code %d\n", code);
870 rx_Write(m->call, m->line, strlen(m->line));
874 * Now both volumes should be ready and consistent, but the old volume
875 * contains still the vnodes and data we transferred into the new one.
876 * Delete orphaned vnodes and data.
881 sprintf(m->line, "10th step: delete large vnodes belonging to subtree in the old volume.\n");
882 rx_Write(m->call, m->line, strlen(m->line));
884 deleteVnodes(vol, vLarge, dirList, dl, &blocks);
886 sprintf(m->line, "11th step: delete small vnodes belonging to subtree in the old volume.\n");
887 rx_Write(m->call, m->line, strlen(m->line));
889 deleteVnodes(vol, vSmall, fileList, fl, &blocks);
890 V_diskused(vol) -= blocks;
891 V_filecount(vol) -= (filesNeeded + dirsNeeded + 1);
892 VUpdateVolume(&code, vol);
894 sprintf(m->line, "Finished!\n");
895 rx_Write(m->call, m->line, strlen(m->line));
900 rx_Write(m->call, m->line, 4);