Skip to content

Commit 71c9ecd

Browse files
committed
Remove FSMID support
The kernel side was added in 2005 (7d15906a7a159575b1983f7c1fadde4b) and removed again in 2009 (d98152a8b8a4b368ca0e08b84302f2f2). Approved-by: dillon Obtained-from: DragonFlyBSD/DragonFlyBSD@5ca0a96
1 parent ba324ce commit 71c9ecd

File tree

7 files changed

+6
-302
lines changed

7 files changed

+6
-302
lines changed

cpdup.1

+1-30
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
.\" Permission to use and distribute based on the DragonFly copyright.
33
.\" Supplied as-is, USE WITH CAUTION.
44
.\"
5-
.Dd November 24, 2009
5+
.Dd December 28, 2020
66
.Dt CPDUP 1
77
.Os
88
.Sh NAME
@@ -31,8 +31,6 @@
3131
.Op Fl VV
3232
.Op Fl S
3333
.Op Fl R
34-
.Op Fl k
35-
.Op Fl K Ar file
3634
.Op Fl X Ar file
3735
.Op Fl x
3836
.Oo Oo Ar user Ns Li @ Oc Ns Ar host : Oc Ns Ar source_dir
@@ -203,33 +201,6 @@ This option is not intended to be used by humans.
203201
Place the slave into read-only mode.
204202
Can only be used when the source is remote.
205203
Useful for unattended backups via SSH keys.
206-
.It Fl k
207-
Generate and maintain a FSMID checkfile called
208-
.Pa \& .FSMID.CHECK
209-
in each directory on the target.
210-
.Nm
211-
will check the FSMID for each source file or directory against the checkfile
212-
on the target and will not copy the file or recurse through the directory
213-
when a match occurs. Any source file or directory with the same name as the
214-
checkfile will be ignored. The FSMID will be re-checked after the copy
215-
has been completed and
216-
.Nm
217-
will loop on that directory or file until it is sure it has an exact copy.
218-
.Pp
219-
Warning: FSMID is not always supported by a filesystem and may not be
220-
synchronized if a crash occurs.
221-
.Dx
222-
will simulate an FSMID when
223-
it is otherwise not supported by the filesystem, and users should be aware
224-
that simulated FSMIDs may change state in such cases even if the underlying
225-
hierarchy does not due to cache flushes.
226-
Additionally, the FSMID may not reflect changes made to remote filesystems
227-
by other hosts. For example, using these options with NFS mounted sources
228-
will not work well.
229-
.It Fl K Ar file
230-
Works the same as
231-
.Fl k
232-
but allows you to specify the name of the FSMID checkfile.
233204
.It Fl x
234205
Causes
235206
.Nm

src/cpdup.c

+4-55
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,6 @@
4444
*
4545
* - Is able to do incremental mirroring/backups via hardlinks from
4646
* the 'previous' version (supplied with -H path).
47-
*
48-
* $DragonFly: src/bin/cpdup/cpdup.c,v 1.32 2008/11/11 04:36:00 dillon Exp $
4947
*/
5048

5149
/*-
@@ -149,7 +147,6 @@ int NotForRealOpt;
149147
int QuietOpt;
150148
int NoRemoveOpt;
151149
int UseMD5Opt;
152-
int UseFSMIDOpt;
153150
int SummaryOpt;
154151
int CompressOpt;
155152
int SlaveOpt;
@@ -161,7 +158,6 @@ int DstRootPrivs;
161158

162159
const char *UseCpFile;
163160
const char *MD5CacheFile;
164-
const char *FSMIDCacheFile;
165161
const char *UseHLPath;
166162

167163
static int DstBaseLen;
@@ -196,7 +192,7 @@ main(int ac, char **av)
196192

197193
gettimeofday(&start, NULL);
198194
opterr = 0;
199-
while ((opt = getopt(ac, av, ":CdF:fH:hIi:j:K:klM:mnoqRSs:uVvX:x")) != -1) {
195+
while ((opt = getopt(ac, av, ":CdF:fH:hIi:j:lM:mnoqRSs:uVvX:x")) != -1) {
200196
switch (opt) {
201197
case 'C':
202198
CompressOpt = 1;
@@ -228,14 +224,6 @@ main(int ac, char **av)
228224
case 'j':
229225
DeviceOpt = getbool(optarg);
230226
break;
231-
case 'K':
232-
UseFSMIDOpt = 1;
233-
FSMIDCacheFile = optarg;
234-
break;
235-
case 'k':
236-
UseFSMIDOpt = 1;
237-
FSMIDCacheFile = ".FSMID.CHECK";
238-
break;
239227
case 'l':
240228
setlinebuf(stdout);
241229
setlinebuf(stderr);
@@ -333,8 +321,6 @@ main(int ac, char **av)
333321
if (dst && (ptr = SplitRemote(&dst)) != NULL) {
334322
DstHost.host = dst;
335323
dst = ptr;
336-
if (UseFSMIDOpt)
337-
fatal("The FSMID options are not currently supported for remote targets");
338324
if (hc_connect(&DstHost, 0) < 0)
339325
exit(1);
340326
} else {
@@ -381,7 +367,6 @@ main(int ac, char **av)
381367
#ifndef NOMD5
382368
md5_flush();
383369
#endif
384-
fsmid_flush();
385370

386371
if (SummaryOpt && i == 0) {
387372
double duration;
@@ -815,8 +800,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
815800

816801
/*
817802
* Do we need to copy the file/dir/link/whatever? Early termination
818-
* if we do not. Always redo links. Directories are always traversed
819-
* except when the FSMID options are used.
803+
* if we do not. Always traverse directories. Always redo links.
820804
*
821805
* NOTE: st2Valid is true only if dpath != NULL *and* dpath stats good.
822806
*/
@@ -827,24 +811,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
827811
&& FlagsMatch(stat1, &st2)
828812
) {
829813
if (S_ISLNK(stat1->st_mode) || S_ISDIR(stat1->st_mode)) {
830-
/*
831-
* If FSMID tracking is turned on we can avoid recursing through
832-
* an entire directory subtree if the FSMID matches.
833-
*/
834-
#ifdef _ST_FSMID_PRESENT_
835-
if (ForceOpt == 0 &&
836-
(UseFSMIDOpt && (fres = fsmid_check(stat1->st_fsmid, dpath)) == 0)
837-
) {
838-
if (VerboseOpt >= 3) {
839-
if (UseFSMIDOpt) /* always true!?! */
840-
logstd("%-32s fsmid-nochange\n", (dpath ? dpath : spath));
841-
else
842-
logstd("%-32s nochange\n", (dpath ? dpath : spath));
843-
}
844-
r = 0;
845-
goto done;
846-
}
847-
#endif
814+
;
848815
} else {
849816
if (ForceOpt == 0 &&
850817
stat1->st_size == st2.st_size &&
@@ -853,10 +820,6 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
853820
#ifndef NOMD5
854821
&& (UseMD5Opt == 0 || !S_ISREG(stat1->st_mode) ||
855822
(mres = md5_check(spath, dpath)) == 0)
856-
#endif
857-
#ifdef _ST_FSMID_PRESENT_
858-
&& (UseFSMIDOpt == 0 ||
859-
(fres = fsmid_check(stat1->st_fsmid, dpath)) == 0)
860823
#endif
861824
&& (ValidateOpt == 0 || !S_ISREG(stat1->st_mode) ||
862825
validate_check(spath, dpath) == 0)
@@ -888,10 +851,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
888851
(dpath ? dpath : spath));
889852
} else
890853
#endif
891-
if (UseFSMIDOpt) {
892-
logstd("%-32s fsmid-nochange",
893-
(dpath ? dpath : spath));
894-
} else if (ValidateOpt) {
854+
if (ValidateOpt) {
895855
logstd("%-32s nochange (contents validated)",
896856
(dpath ? dpath : spath));
897857
} else {
@@ -935,9 +895,6 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
935895
if (S_ISDIR(stat1->st_mode)) {
936896
int skipdir = 0;
937897

938-
if (fres < 0)
939-
logerr("%-32s/ fsmid-CHECK-FAILED\n", (dpath) ? dpath : spath);
940-
941898
if (dpath) {
942899
if (!st2Valid || S_ISDIR(st2.st_mode) == 0) {
943900
if (st2Valid)
@@ -1128,10 +1085,7 @@ DoCopy(copy_info_t info, struct stat *stat1, int depth)
11281085
#ifndef NOMD5
11291086
if (mres < 0)
11301087
logerr("%-32s md5-CHECK-FAILED\n", (dpath) ? dpath : spath);
1131-
else
11321088
#endif
1133-
if (fres < 0)
1134-
logerr("%-32s fsmid-CHECK-FAILED\n", (dpath) ? dpath : spath);
11351089

11361090
/*
11371091
* Not quite ready to do the copy yet. If UseHLPath is defined,
@@ -1477,14 +1431,9 @@ ScanDir(List *list, struct HostConf *host, const char *path,
14771431
/*
14781432
* Automatically exclude MD5CacheFile that we create on the
14791433
* source from the copy to the destination.
1480-
*
1481-
* Automatically exclude a FSMIDCacheFile on the source that
1482-
* would otherwise overwrite the one we maintain on the target.
14831434
*/
14841435
if (UseMD5Opt)
14851436
AddList(list, MD5CacheFile, 1, NULL);
1486-
if (UseFSMIDOpt)
1487-
AddList(list, FSMIDCacheFile, 1, NULL);
14881437
}
14891438

14901439
if ((dir = hc_opendir(host, path)) == NULL)

src/cpdup.h

-4
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,13 @@ int16_t hc_bswap16(int16_t var);
7373
int32_t hc_bswap32(int32_t var);
7474
int64_t hc_bswap64(int64_t var);
7575

76-
int fsmid_check(int64_t fsmid, const char *dpath);
77-
void fsmid_flush(void);
7876
#ifndef NOMD5
7977
int md5_check(const char *spath, const char *dpath);
8078
void md5_flush(void);
8179
#endif
8280

8381
extern const char *UseCpFile;
8482
extern const char *MD5CacheFile;
85-
extern const char *FSMIDCacheFile;
8683
extern const char *UseHLPath;
8784

8885
extern int AskConfirmation;
@@ -95,7 +92,6 @@ extern int QuietOpt;
9592
extern int NotForRealOpt;
9693
extern int NoRemoveOpt;
9794
extern int UseMD5Opt;
98-
extern int UseFSMIDOpt;
9995
extern int SlaveOpt;
10096
extern int SummaryOpt;
10197
extern int CompressOpt;

0 commit comments

Comments
 (0)