}
run_test 56b "check $LFS getdirstripe"
+test_56c() {
+ local ost_idx=0
+ local ost_name=$(ostname_from_index $ost_idx)
+
+ local old_status=$(ost_dev_status $ost_idx)
+ [[ -z "$old_status" ]] ||
+ { skip_env "OST $ost_name is in $old_status status"; return 0; }
+
+ do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=1
+ sleep_maxage
+
+ local new_status=$(ost_dev_status $ost_idx)
+ [[ "$new_status" = "D" ]] ||
+ error "OST $ost_name is in status of '$new_status', not 'D'"
+
+ do_facet ost1 $LCTL set_param -n obdfilter.$ost_name.degraded=0
+ sleep_maxage
+
+ new_status=$(ost_dev_status $ost_idx)
+ [[ -z "$new_status" ]] ||
+ error "OST $ost_name is in status of '$new_status', not ''"
+}
+run_test 56c "check 'lfs df' showing device status"
+
NUMFILES=3
NUMDIRS=3
setup_56() {
snprintf(abuf, sizeof(tbuf), CDF, avail);
}
- sprintf(rbuf, RDF, (int)(ratio * 100 + 0.5));
- printf(UUF" "CSF" "CSF" "CSF" "RSF" %-s",
- uuid, tbuf, ubuf, abuf, rbuf, mntdir);
- if (type)
- printf("[%s:%d]\n", type, index);
- else
- printf("\n");
-
- break;
- case -ENODATA:
- printf(UUF": inactive device\n", uuid);
- break;
- default:
- printf(UUF": %s\n", uuid, strerror(-rc));
- break;
- }
+ sprintf(rbuf, RDF, (int)(ratio * 100 + 0.5));
+ printf(UUF" "CSF" "CSF" "CSF" "RSF" %-s",
+ uuid, tbuf, ubuf, abuf, rbuf, mntdir);
+ if (type)
+ printf("[%s:%d]", type, index);
+
+ if (stat->os_state) {
+ /*
+ * Each character represents the matching
+ * OS_STATE_* bit.
+ */
+ const char state_names[] = "DRSI";
+ __u32 state;
+ __u32 i;
+
+ printf(" ");
+ for (i = 0, state = stat->os_state;
+ state && i < sizeof(state_names); i++) {
+ if (!(state & (1 << i)))
+ continue;
+ printf("%c", state_names[i]);
+ state ^= 1 << i;
+ }
+ }
- return 0;
+ printf("\n");
+ break;
+ case -ENODATA:
+ printf(UUF": inactive device\n", uuid);
+ break;
+ default:
+ printf(UUF": %s\n", uuid, strerror(-rc));
+ break;
+ }
+
+ return 0;
}
struct ll_stat_type {