mirror of
https://git.openafs.org/openafs.git
synced 2025-01-21 00:10:15 +00:00
ConvertROtoRW: Use old copyDate for creationDate
When we convert an RO volume to an RW, currently we just copy the copyDate and creationDate from the RO metadata into the RW. But the copyDate and creationDate fields have different meanings for RW and RO volumes: for ROs, the creationDate is merely the last time the data was updated from the RW during a release operation. So, if the copyDate is older than the creationDate, use the copyDate as the new RW creationDate instead. This will probably not match the creationDate of the original RW, but it will be closer to it, and it will more accurately represent the conceptual "created time" of the new RW. Doing this can avoid forcing an unnecessary full dump on a subsequent release of the resultant RW volume, since the creationDate is more accurate. Change-Id: Ibfffbdc4a79a568261e9e116f6991a3af9db5e0c Reviewed-on: http://gerrit.openafs.org/3891 Tested-by: BuildBot <buildbot@rampaginggeek.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
ae11ef7898
commit
f47487db05
@ -1327,6 +1327,19 @@ convertVolumeInfo(FdHandle_t *fdhr, FdHandle_t *fdhw, afs_uint32 vid)
|
|||||||
vd.uniquifier += 5000; /* just in case there are still file copies
|
vd.uniquifier += 5000; /* just in case there are still file copies
|
||||||
from the old RW volume around */
|
from the old RW volume around */
|
||||||
|
|
||||||
|
/* For ROs, the copyDate contains the time that the RO volume was actually
|
||||||
|
* created, and the creationDate just contains the last time the RO was
|
||||||
|
* copied from the RW data. So, make the new RW creationDate more accurate
|
||||||
|
* by setting it to copyDate, if copyDate is older. Since, we know the
|
||||||
|
* volume is at least as old as copyDate. */
|
||||||
|
if (vd.copyDate < vd.creationDate) {
|
||||||
|
vd.creationDate = vd.copyDate;
|
||||||
|
} else {
|
||||||
|
/* If copyDate is newer, just make copyDate and creationDate the same,
|
||||||
|
* for consistency with other RWs */
|
||||||
|
vd.copyDate = vd.creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
p = strrchr(vd.name, '.');
|
p = strrchr(vd.name, '.');
|
||||||
if (p && !strcmp(p, ".readonly")) {
|
if (p && !strcmp(p, ".readonly")) {
|
||||||
memset(p, 0, 9);
|
memset(p, 0, 9);
|
||||||
|
@ -2755,6 +2755,20 @@ convertVolumeInfo(FD_t fdr, FD_t fdw, afs_uint32 vid)
|
|||||||
vd.inUse = 0;
|
vd.inUse = 0;
|
||||||
vd.uniquifier += 5000; /* just in case there are still file copies from
|
vd.uniquifier += 5000; /* just in case there are still file copies from
|
||||||
* the old RW volume around */
|
* the old RW volume around */
|
||||||
|
|
||||||
|
/* For ROs, the copyDate contains the time that the RO volume was actually
|
||||||
|
* created, and the creationDate just contains the last time the RO was
|
||||||
|
* copied from the RW data. So, make the new RW creationDate more accurate
|
||||||
|
* by setting it to copyDate, if copyDate is older. Since, we know the
|
||||||
|
* volume is at least as old as copyDate. */
|
||||||
|
if (vd.copyDate < vd.creationDate) {
|
||||||
|
vd.creationDate = vd.copyDate;
|
||||||
|
} else {
|
||||||
|
/* If copyDate is newer, just make copyDate and creationDate the same,
|
||||||
|
* for consistency with other RWs */
|
||||||
|
vd.copyDate = vd.creationDate;
|
||||||
|
}
|
||||||
|
|
||||||
p = strrchr(vd.name, '.');
|
p = strrchr(vd.name, '.');
|
||||||
if (p && !strcmp(p, ".readonly")) {
|
if (p && !strcmp(p, ".readonly")) {
|
||||||
memset(p, 0, 9);
|
memset(p, 0, 9);
|
||||||
|
Loading…
Reference in New Issue
Block a user