Skip to content
Snippets Groups Projects
Commit 55343c0b authored by wangchao's avatar wangchao
Browse files

b=2510

r=adilger
Fix "lfs find --obd" to limit the output as it should.
parent 8ff5eec2
No related merge requests found
...@@ -219,6 +219,10 @@ static int get_obd_uuids(DIR *dir, char *dname, struct find_param *param) ...@@ -219,6 +219,10 @@ static int get_obd_uuids(DIR *dir, char *dname, struct find_param *param)
break; break;
} }
} }
if (param->obdindex == OBD_NOT_FOUND) {
printf("unknown obduuid: %s\n", param->obduuid);
return EINVAL;
}
} else if (!param->quiet) { } else if (!param->quiet) {
printf("OBDS:\n"); printf("OBDS:\n");
for (i = 0, uuidp = param->uuids; i < obdcount; i++, uuidp++) for (i = 0, uuidp = param->uuids; i < obdcount; i++, uuidp++)
...@@ -231,21 +235,23 @@ static int get_obd_uuids(DIR *dir, char *dname, struct find_param *param) ...@@ -231,21 +235,23 @@ static int get_obd_uuids(DIR *dir, char *dname, struct find_param *param)
void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname, void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
int obdindex, int quiet, int header, int body) int obdindex, int quiet, int header, int body)
{ {
int i; int i, obdstripe = 0;
if (obdindex != OBD_NOT_FOUND) { if (obdindex != OBD_NOT_FOUND) {
for (i = 0; i < lum->lmm_stripe_count; i++) { for (i = 0; i < lum->lmm_stripe_count; i++) {
if (obdindex == lum->lmm_objects[i].l_ost_idx) { if (obdindex == lum->lmm_objects[i].l_ost_idx) {
printf("%s/%s\n", dname, fname); printf("%s/%s\n", dname, fname);
obdstripe = 1;
break; break;
} }
} }
} else if (!quiet) { } else if (!quiet) {
printf("%s/%s\n", dname, fname); printf("%s/%s\n", dname, fname);
obdstripe = 1;
} }
if (header) { if (header && (obdstripe == 1)) {
printf("lmm_magic: 0x%80X\n", lum->lmm_magic); printf("lmm_magic: 0x%08X\n", lum->lmm_magic);
printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr); printf("lmm_object_gr: "LPX64"\n", lum->lmm_object_gr);
printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id); printf("lmm_object_id: "LPX64"\n", lum->lmm_object_id);
printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count); printf("lmm_stripe_count: %u\n", (int)lum->lmm_stripe_count);
...@@ -256,15 +262,17 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname, ...@@ -256,15 +262,17 @@ void lov_dump_user_lmm_v1(struct lov_user_md_v1 *lum, char *dname, char *fname,
if (body) { if (body) {
long long oid; long long oid;
if (!quiet) if ((!quiet) && (obdstripe == 1))
printf("\tobdidx\t\t objid\t\tobjid\t\t group\n"); printf("\tobdidx\t\t objid\t\tobjid\t\t group\n");
for (i = 0; i < lum->lmm_stripe_count; i++) { for (i = 0; i < lum->lmm_stripe_count; i++) {
int idx = lum->lmm_objects[i].l_ost_idx; int idx = lum->lmm_objects[i].l_ost_idx;
oid = lum->lmm_objects[i].l_object_id; oid = lum->lmm_objects[i].l_object_id;
printf("\t%6u\t%14llu\t%#13llx\t%14lld%s\n", idx, oid, if ((obdindex == OBD_NOT_FOUND) || (obdindex == idx))
oid, (long long)lum->lmm_objects[i].l_object_gr, printf("\t%6u\t%14llu\t%#13llx\t%14lld%s\n",
obdindex == idx ? " *" : ""); idx, oid, oid,
(long long)lum->lmm_objects[i].l_object_gr,
obdindex == idx ? " *" : "");
} }
printf("\n"); printf("\n");
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment