if (!llapi_is_lustre_mnt(&mnt))
continue;
+ if ((want & WANT_INDEX) && (idx++ != index))
+ continue;
+
mntlen = strlen(mnt.mnt_dir);
ptr = strrchr(mnt.mnt_fsname, '/');
if (!ptr && !len) {
}
ptr++;
- if ((want & WANT_INDEX) && (idx++ != index))
- continue;
-
/* Check the fsname for a match, if given */
if (!(want & WANT_FSNAME) && fsname != NULL &&
(strlen(fsname) > 0) && (strcmp(ptr, fsname) != 0))
/* Given a path, find the corresponding Lustre fsname */
int llapi_search_fsname(const char *pathname, char *fsname)
{
+ char *path = (char*)pathname, buf[PATH_MAX + 1];
+
+ if (pathname[0] != '/') { /* Need a absolute path */
+ memset(buf, '\0', sizeof(buf));
+ if (realpath(pathname, buf) == NULL) {
+ llapi_err(LLAPI_MSG_ERROR, "pathname '%s' cannot expand",
+ pathname);
+ return -EINVAL;
+ }
+ path = buf;
+ }
return get_root_path(WANT_FSNAME | WANT_ERROR, fsname, NULL,
- (char *)pathname, -1);
+ path, -1);
}
/* return the first file matching this pattern */
*/
int llapi_uuid_match(char *real_uuid, char *search_uuid)
{
- int cmplen = strlen(real_uuid) - 5;
+ int cmplen = strlen(real_uuid);
+ int searchlen = strlen(search_uuid);
- if ((strlen(search_uuid) > cmplen) && isxdigit(search_uuid[cmplen])) {
- /* OST00000003 doesn't match OST0000 */
- llapi_err(LLAPI_MSG_ERROR, "Bad UUID format '%s'", search_uuid);
+ if (cmplen > 5 && strcmp(real_uuid + cmplen - 5, "_UUID") == 0)
+ cmplen -= 5;
+ if (searchlen > 5 && strcmp(search_uuid + searchlen - 5, "_UUID") == 0)
+ searchlen -= 5;
+
+ /* The UUIDs may legitimately be different lengths, if
+ * the system was upgraded from an older version. */
+ if (cmplen != searchlen)
return 0;
- }
return (strncmp(search_uuid, real_uuid, cmplen) == 0);
}
i < param->lmd->lmd_lmm.lmm_stripe_count; i++) {
for (j = 0; j < param->num_obds; j++) {
if (param->obdindexes[j] ==
- lmm_objects[i].l_ost_idx)
+ lmm_objects[i].l_ost_idx) {
+ if (param->exclude_obd)
+ goto decided;
goto obd_matches;
+ }
}
}
- if (i == param->lmd->lmd_lmm.lmm_stripe_count)
+ if (i == param->lmd->lmd_lmm.lmm_stripe_count) {
+ if (param->exclude_obd)
+ goto obd_matches;
goto decided;
+ }
}
}
The regular stat is almost of the same speed as some new
'glimpse-size-ioctl'. */
if (!decision && S_ISREG(st->st_mode) &&
- (param->lmd->lmd_lmm.lmm_stripe_count || param->size)) {
+ param->lmd->lmd_lmm.lmm_stripe_count &&
+ (param->size ||param->atime || param->mtime || param->ctime)) {
if (param->obdindex != OBD_NOT_FOUND) {
/* Check whether the obd is active or not, if it is
* not active, just print the object affected by this