#define SBI_DEFAULT_READ_AHEAD_PER_FILE_MAX MiB_TO_PAGES(256UL)
/* default read-ahead full files smaller than limit on the second read */
-#define SBI_DEFAULT_READ_AHEAD_WHOLE_MAX MiB_TO_PAGES(2UL)
+#define SBI_DEFAULT_READ_AHEAD_WHOLE_MAX MiB_TO_PAGES(4UL)
/* default range pages */
#define SBI_DEFAULT_RA_RANGE_PAGES MiB_TO_PAGES(1ULL)
sbi->ll_dt_exp->exp_connect_data = *data;
- /* Don't change value if it was specified in the config log */
- if (sbi->ll_ra_info.ra_max_read_ahead_whole_pages == -1) {
- sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
- max_t(unsigned long, SBI_DEFAULT_READ_AHEAD_WHOLE_MAX,
- (data->ocd_brw_size >> PAGE_SHIFT));
- if (sbi->ll_ra_info.ra_max_read_ahead_whole_pages >
- sbi->ll_ra_info.ra_max_pages_per_file)
- sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
- sbi->ll_ra_info.ra_max_pages_per_file;
- }
-
err = client_fid_init(sbi->ll_dt_exp->exp_obd, sbi->ll_dt_exp,
LUSTRE_SEQ_METADATA);
if (err) {
OBD_FREE_PTR(data);
OBD_FREE_PTR(osfs);
+ /* Don't change value if it was specified in the config log */
+ if (sbi->ll_ra_info.ra_max_read_ahead_whole_pages == -1) {
+ u32 max_pages_per_rpc;
+
+ size = sizeof(max_pages_per_rpc);
+ err = obd_get_info(NULL, sbi->ll_dt_exp,
+ sizeof(KEY_MAX_PAGES_PER_RPC),
+ KEY_MAX_PAGES_PER_RPC, &size,
+ &max_pages_per_rpc);
+ if (err)
+ max_pages_per_rpc = 0;
+ sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
+ max_t(u32, SBI_DEFAULT_READ_AHEAD_WHOLE_MAX,
+ max_pages_per_rpc);
+ if (sbi->ll_ra_info.ra_max_read_ahead_whole_pages >
+ sbi->ll_ra_info.ra_max_pages_per_file)
+ sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
+ sbi->ll_ra_info.ra_max_pages_per_file;
+ }
+
if (sbi->ll_dt_obd) {
err = sysfs_create_link(&sbi->ll_kset.kobj,
&sbi->ll_dt_obd->obd_kset.kobj,
*((u32 *)val) = lov_mds_md_size(def_stripe_count, LOV_MAGIC_V3);
} else if (KEY_IS(KEY_TGT_COUNT)) {
*((int *)val) = lov->desc.ld_tgt_count;
+ } else if (KEY_IS(KEY_MAX_PAGES_PER_RPC)) {
+ struct lov_tgt_desc *tgt;
+ struct client_obd *cli;
+ struct obd_import *imp;
+ u32 result = 0;
+ u32 i;
+
+ for (i = 0; i < lov->desc.ld_tgt_count; i++) {
+ tgt = lov->lov_tgts[i];
+
+ /* OST was disconnected */
+ if (tgt == NULL || tgt->ltd_exp == NULL)
+ continue;
+
+ cli = &tgt->ltd_obd->u.cli;
+ imp = cli->cl_import;
+
+ if (imp == NULL || imp->imp_state != LUSTRE_IMP_FULL)
+ continue;
+
+ if (result == 0)
+ result = cli->cl_max_pages_per_rpc;
+ else
+ result = min_t(u32, cli->cl_max_pages_per_rpc,
+ result);
+ }
+
+ *((u32 *)val) = result;
} else {
rc = -EINVAL;
}