/* This must be longer than the longest string below */
#define SYNC_STATES_MAXLEN 16
+
+static int ofd_brw_size_seq_show(struct seq_file *m, void *data)
+{
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ int rc;
+
+ rc = seq_printf(m, "%u\n", ofd->ofd_brw_size / ONE_MB_BRW_SIZE);
+ return rc;
+}
+
+static ssize_t
+ofd_brw_size_seq_write(struct file *file, const char __user *buffer,
+ size_t count, loff_t *off)
+{
+ struct seq_file *m = file->private_data;
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+ int val;
+ int rc;
+
+ rc = lprocfs_write_helper(buffer, count, &val);
+ if (rc)
+ return rc;
+
+ if (val < 0)
+ return -EINVAL;
+
+ val = val * ONE_MB_BRW_SIZE;
+ if (val <= 0 || val > DT_MAX_BRW_SIZE)
+ return -ERANGE;
+
+ spin_lock(&ofd->ofd_flags_lock);
+ ofd->ofd_brw_size = val;
+ spin_unlock(&ofd->ofd_flags_lock);
+
+ return count;
+}
+LPROC_SEQ_FOPS(ofd_brw_size);
+
static char *sync_on_cancel_states[] = {"never",
"blocking",
"always" };
.fops = &ofd_degraded_fops },
{ .name = "sync_journal",
.fops = &ofd_syncjournal_fops },
+ { .name = "brw_size",
+ .fops = &ofd_brw_size_fops },
{ .name = "sync_on_lock_cancel",
.fops = &ofd_sync_lock_cancel_fops },
{ .name = "instance",
else if (data->ocd_connect_flags & OBD_CONNECT_SKIP_ORPHAN)
RETURN(-EPROTO);
+ /* Determine optimal brw size before calculating grant */
+ if (OBD_FAIL_CHECK(OBD_FAIL_OST_BRW_SIZE)) {
+ data->ocd_brw_size = 65536;
+ } else if (OCD_HAS_FLAG(data, BRW_SIZE)) {
+ data->ocd_brw_size = min(data->ocd_brw_size, ofd->ofd_brw_size);
+ if (data->ocd_brw_size == 0) {
+ CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64
+ " ocd_version: %x ocd_grant: %d ocd_index: %u "
+ "ocd_brw_size is unexpectedly zero, "
+ "network data corruption?"
+ "Refusing connection of this client\n",
+ exp->exp_obd->obd_name,
+ exp->exp_client_uuid.uuid,
+ exp, data->ocd_connect_flags, data->ocd_version,
+ data->ocd_grant, data->ocd_index);
+ RETURN(-EPROTO);
+ }
+ }
+
if (OCD_HAS_FLAG(data, GRANT_PARAM)) {
/* client is reporting its page size, for future use */
exp->exp_filter_data.fed_pagebits = data->ocd_grant_blkbits;
data->ocd_grant_max_blks = ofd->ofd_dt_conf.ddp_max_extent_blks;
}
- if (OCD_HAS_FLAG(data, GRANT))
+ if (OCD_HAS_FLAG(data, GRANT)) {
+ /* Save connect_data we have so far because ofd_grant_connect()
+ * uses it to calculate grant. */
+ exp->exp_connect_data = *data;
ofd_grant_connect(env, exp, data, new_connection);
+ }
if (data->ocd_connect_flags & OBD_CONNECT_INDEX) {
struct lr_server_data *lsd = &ofd->ofd_lut.lut_lsd;
tgt_server_data_update(env, &ofd->ofd_lut, 0);
}
}
- if (OBD_FAIL_CHECK(OBD_FAIL_OST_BRW_SIZE)) {
- data->ocd_brw_size = 65536;
- } else if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) {
- data->ocd_brw_size = min(data->ocd_brw_size,
- (__u32)DT_MAX_BRW_SIZE);
- if (data->ocd_brw_size == 0) {
- CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64
- " ocd_version: %x ocd_grant: %d ocd_index: %u "
- "ocd_brw_size is unexpectedly zero, "
- "network data corruption?"
- "Refusing connection of this client\n",
- exp->exp_obd->obd_name,
- exp->exp_client_uuid.uuid,
- exp, data->ocd_connect_flags, data->ocd_version,
- data->ocd_grant, data->ocd_index);
- RETURN(-EPROTO);
- }
- }
if (data->ocd_connect_flags & OBD_CONNECT_CKSUM) {
__u32 cksum_types = data->ocd_cksum_types;