For matches that are "equal" to the specified time, they must match
within the smallest unit specified. For example, "-mtime 24h" would
match anything within 1h of 24h ago, similar to how "-size 100M" will
match anything within 1MB of 100MB.
Test-Parameters: trivial fstype=zfs
Fixes:
355c8a529a3a ("LU-12027 utils: add units to 'lfs find -amctime'")
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ib1eb4e626b712bb75f13b075849f959f203ebbe5
Reviewed-on: https://review.whamcloud.com/34658
Tested-by: Jenkins
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
\fBw\fReeks, or \fBy\fRears ago within a margin of error of 24h,
or smaller if a unit is specified. Multiple units can be specified,
for example \fB8h20m\fR is equivalent to \fB500m\fR. If multipe units
\fBw\fReeks, or \fBy\fRears ago within a margin of error of 24h,
or smaller if a unit is specified. Multiple units can be specified,
for example \fB8h20m\fR is equivalent to \fB500m\fR. If multipe units
-are specified, the margin of error is based on the smallest unit used.
+are specified, the margin of error is based on the smallest unit used, so
+.B -atime 3d
+has a margin of error of one day, while
+.B -atime 72h
+has a margin of error of one hour.
.TP
.BR --blocks | -b
Blocks allocated by the file is \fIn\fR Kibibytes (if no units are given),
.TP
.BR --blocks | -b
Blocks allocated by the file is \fIn\fR Kibibytes (if no units are given),
fp_obds_printed:1;
unsigned int fp_depth;
unsigned int fp_hash_type;
fp_obds_printed:1;
unsigned int fp_depth;
unsigned int fp_hash_type;
- unsigned int fp_time_margin;
+ unsigned int fp_time_margin; /* time margin in seconds */
};
int llapi_ostlist(char *path, struct find_param *param);
};
int llapi_ostlist(char *path, struct find_param *param);
progname, timebuf, strerror(EINVAL));
return LONG_MAX;
}
progname, timebuf, strerror(EINVAL));
return LONG_MAX;
}
- if (*endptr && unit < 24 * 60 * 60)
+
+ if (param->fp_time_margin == 0 ||
+ (*endptr && unit < param->fp_time_margin))
param->fp_time_margin = unit;
t += val * unit;
param->fp_time_margin = unit;
t += val * unit;
* (limit - margin, limit]. */
static int find_value_cmp(unsigned long long file, unsigned long long limit,
int sign, int negopt, unsigned long long margin,
* (limit - margin, limit]. */
static int find_value_cmp(unsigned long long file, unsigned long long limit,
int sign, int negopt, unsigned long long margin,
{
int ret = -1;
if (sign > 0) {
{
int ret = -1;
if (sign > 0) {
- /* Drop the fraction of margin (of days). */
+ /* Drop the fraction of margin (of days or size). */
if (file + margin <= limit)
ret = mds ? 0 : 1;
} else if (sign == 0) {
if (file + margin <= limit)
ret = mds ? 0 : 1;
} else if (sign == 0) {