struct obd_device *obd = ofd_obd(ofd);
struct obd_device *osd_obd = ofd->ofd_osd_exp->exp_obd;
const struct kobj_type *osd_type;
- int i;
osd_type = get_ktype(&ofd->ofd_osd->dd_kobj);
- for (i = 0; osd_type->default_attrs[i]; i++) {
- if (strcmp(osd_type->default_attrs[i]->name,
- "read_cache_enable") == 0) {
- ofd->ofd_read_cache_enable =
- osd_type->default_attrs[i];
- }
-
- if (strcmp(osd_type->default_attrs[i]->name,
- "readcache_max_filesize") == 0) {
- ofd->ofd_read_cache_max_filesize =
- osd_type->default_attrs[i];
- }
-
- if (strcmp(osd_type->default_attrs[i]->name,
- "writethrough_cache_enable") == 0) {
- ofd->ofd_write_cache_enable =
- osd_type->default_attrs[i];
- }
- }
+ ofd->ofd_read_cache_enable =
+ get_attr_by_name(osd_type, "read_cache_enable");
+ ofd->ofd_read_cache_max_filesize =
+ get_attr_by_name(osd_type, "readcache_max_filesize");
+ ofd->ofd_write_cache_enable =
+ get_attr_by_name(osd_type, "writethrough_cache_enable");
if (obd->obd_proc_entry == NULL)
return;