You can then migrate files using hacksm_migrate, and view their state
using hacksm_ls
+
+The "store" for hacksm is just a directory with files named by device
+and inode number. When a file is migrated the data is moved to the
+store and a dmapi hole is punched in the original file. This mimicks
+the behaviour of real HSM daemons. When the hacksmd daemon gets a data
+event (indicating that someone wants to read or write the data in the
+file) then the data is restored from the "store" and the file can then
+be read normally.
exit(1);
}
if (h.state == HSM_STATE_START) {
+ if (h.migrate_time + 60 > time(NULL)) {
+ printf("Not migrating recent partially migrated file\n");
+ goto respond;
+ }
printf("Continuing migration of partly migrated file\n");
hsm_store_unlink(h.device, h.inode);
} else {
strncpy(h.magic, HSM_MAGIC, sizeof(h.magic));
h.size = st.st_size;
+ h.migrate_time = time(NULL);
h.device = st.st_dev;
h.inode = st.st_ino;
h.state = HSM_STATE_START;
goto respond;
}
+
/* we now release the right to let any reads that
are pending to continue before we destroy the data */
ret = dm_release_right(dmapi.sid, hanp, hlen, token);
ret = dm_get_dmattr(dmapi.sid, hanp, hlen, token, &attrname,
sizeof(h), &h, &rlen);
if (ret != 0) {
- printf("Abandoning partial migrate - attribute gone\n", h.state);
+ printf("Abandoning partial migrate - attribute gone\n");
goto respond;
}