*out = *in;
/* For old 2.0 client, the 'lsr_flags' is uninitialized.
- * Set it as 'LU_SEQ_RANGE_MDT' by default.
- * Old 2.0 liblustre client cannot talk with new 2.1 server. */
- if (!(exp->exp_connect_flags & OBD_CONNECT_64BITHASH) &&
- !(exp->exp_connect_flags & OBD_CONNECT_MDS_MDS) &&
- !(exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) &&
+ * Set it as 'LU_SEQ_RANGE_MDT' by default. */
+ if (!(exp_connect_flags(exp) & OBD_CONNECT_64BITHASH) &&
+ !(exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS) &&
+ !(exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT) &&
!exp->exp_libclient)
out->lsr_flags = LU_SEQ_RANGE_MDT;
#define LOV_POOLNAMEF "%.16s"
#define LOV_MIN_STRIPE_BITS 16 /* maximum PAGE_SIZE (ia64), power of 2 */
-#define LOV_MIN_STRIPE_SIZE (1<<LOV_MIN_STRIPE_BITS)
+#define LOV_MIN_STRIPE_SIZE (1 << LOV_MIN_STRIPE_BITS)
#define LOV_MAX_STRIPE_COUNT_OLD 160
/* This calculation is crafted so that input of 4096 will result in 160
* which in turn is equal to old maximal stripe count.
* of exp_imp_reverse
*/
spinlock_t exp_lock;
- /** Compatibility flags for this export */
- __u64 exp_connect_flags;
+ /** Compatibility flags for this export are embedded into
+ * exp_connect_data */
+ struct obd_connect_data exp_connect_data;
enum obd_option exp_flags;
unsigned long exp_failed:1,
exp_in_recovery:1,
#define exp_filter_data u.eu_filter_data
#define exp_ec_data u.eu_ec_data
+static inline __u64 *exp_connect_flags_ptr(struct obd_export *exp)
+{
+ return &exp->exp_connect_data.ocd_connect_flags;
+}
+
+static inline __u64 exp_connect_flags(struct obd_export *exp)
+{
+ return *exp_connect_flags_ptr(exp);
+}
+
+static inline int exp_brw_size(struct obd_export *exp)
+{
+ LASSERT(exp != NULL);
+ if (exp_connect_flags(exp) & OBD_CONNECT_BRW_SIZE)
+ return exp->exp_connect_data.ocd_brw_size;
+
+ return ONE_MB_BRW_SIZE;
+}
+
static inline int exp_expired(struct obd_export *exp, cfs_duration_t age)
{
LASSERT(exp->exp_delayed);
static inline int exp_connect_cancelset(struct obd_export *exp)
{
- LASSERT(exp != NULL);
- return !!(exp->exp_connect_flags & OBD_CONNECT_CANCELSET);
+ LASSERT(exp != NULL);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_CANCELSET);
}
static inline int exp_connect_lru_resize(struct obd_export *exp)
{
- LASSERT(exp != NULL);
- return !!(exp->exp_connect_flags & OBD_CONNECT_LRU_RESIZE);
+ LASSERT(exp != NULL);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_LRU_RESIZE);
}
static inline int exp_connect_rmtclient(struct obd_export *exp)
{
- LASSERT(exp != NULL);
- return !!(exp->exp_connect_flags & OBD_CONNECT_RMT_CLIENT);
+ LASSERT(exp != NULL);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_RMT_CLIENT);
}
static inline int client_is_remote(struct obd_export *exp)
static inline int exp_connect_vbr(struct obd_export *exp)
{
- LASSERT(exp != NULL);
- LASSERT(exp->exp_connection);
- return !!(exp->exp_connect_flags & OBD_CONNECT_VBR);
+ LASSERT(exp != NULL);
+ LASSERT(exp->exp_connection);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_VBR);
}
static inline int exp_connect_som(struct obd_export *exp)
{
- LASSERT(exp != NULL);
- return !!(exp->exp_connect_flags & OBD_CONNECT_SOM);
+ LASSERT(exp != NULL);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_SOM);
}
static inline int exp_connect_umask(struct obd_export *exp)
{
- return !!(exp->exp_connect_flags & OBD_CONNECT_UMASK);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_UMASK);
}
static inline int imp_connect_lru_resize(struct obd_import *imp)
static inline int exp_connect_layout(struct obd_export *exp)
{
- return !!(exp->exp_connect_flags & OBD_CONNECT_LAYOUTLOCK);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_LAYOUTLOCK);
}
static inline bool exp_connect_lvb_type(struct obd_export *exp)
{
LASSERT(exp != NULL);
- if (exp->exp_connect_flags & OBD_CONNECT_LVB_TYPE)
+ if (exp_connect_flags(exp) & OBD_CONNECT_LVB_TYPE)
return true;
else
return false;
* CAVEAT EMPTOR, with multinet (i.e. routers forwarding between networks)
* these limits are system wide and not interface-local. */
#define PTLRPC_MAX_BRW_BITS LNET_MTU_BITS
-#define PTLRPC_MAX_BRW_SIZE (1<<LNET_MTU_BITS)
+#define PTLRPC_MAX_BRW_SIZE (1 << LNET_MTU_BITS)
#define PTLRPC_MAX_BRW_PAGES (PTLRPC_MAX_BRW_SIZE >> CFS_PAGE_SHIFT)
+#define ONE_MB_BRW_SIZE (1 << LNET_MTU_BITS)
+#define MD_MAX_BRW_SIZE (1 << LNET_MTU_BITS)
+#define MD_MAX_BRW_PAGES (MD_MAX_BRW_SIZE >> CFS_PAGE_SHIFT)
+#define DT_MAX_BRW_SIZE (1 << LNET_MTU_BITS)
+#define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS)
+
/* When PAGE_SIZE is a constant, we can check our arithmetic here with cpp! */
#ifdef __KERNEL__
# if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES - 1)) != 0)
#ifndef _OBD_LOV_H__
#define _OBD_LOV_H__
+#define LOV_DEFAULT_STRIPE_SIZE (1 << LNET_MTU_BITS)
+
static inline int lov_stripe_md_size(__u16 stripes)
{
return sizeof(struct lov_stripe_md) + stripes*sizeof(struct lov_oinfo*);
#endif
cfs_atomic_set(&cli->cl_resends, OSC_DEFAULT_RESENDS);
- /* This value may be changed at connect time in
- ptlrpc_connect_interpret. */
- cli->cl_max_pages_per_rpc = min((int)PTLRPC_MAX_BRW_PAGES,
- (int)(1024 * 1024 >> CFS_PAGE_SHIFT));
+ /* This value may be changed at connect time in
+ ptlrpc_connect_interpret. */
+ cli->cl_max_pages_per_rpc = min((int)PTLRPC_MAX_BRW_PAGES,
+ (int)(LNET_MTU >> CFS_PAGE_SHIFT));
if (!strcmp(name, LUSTRE_MDC_NAME)) {
cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
* Converts lock policy from on the wire lock_desc format to local format
*/
void ldlm_convert_policy_to_local(struct obd_export *exp, ldlm_type_t type,
- const ldlm_wire_policy_data_t *wpolicy,
- ldlm_policy_data_t *lpolicy)
+ const ldlm_wire_policy_data_t *wpolicy,
+ ldlm_policy_data_t *lpolicy)
{
- ldlm_policy_wire_to_local_t convert;
- int new_client;
+ ldlm_policy_wire_to_local_t convert;
+ int new_client;
- /** some badnes for 2.0.0 clients, but 2.0.0 isn't supported */
- new_client = (exp->exp_connect_flags & OBD_CONNECT_FULL20) != 0;
- if (new_client)
- convert = ldlm_policy_wire21_to_local[type - LDLM_MIN_TYPE];
- else
- convert = ldlm_policy_wire18_to_local[type - LDLM_MIN_TYPE];
+ /** some badness for 2.0.0 clients, but 2.0.0 isn't supported */
+ new_client = (exp_connect_flags(exp) & OBD_CONNECT_FULL20) != 0;
+ if (new_client)
+ convert = ldlm_policy_wire21_to_local[type - LDLM_MIN_TYPE];
+ else
+ convert = ldlm_policy_wire18_to_local[type - LDLM_MIN_TYPE];
- convert(wpolicy, lpolicy);
+ convert(wpolicy, lpolicy);
}
char *ldlm_it2str(int it)
*/
void ldlm_lock2desc(struct ldlm_lock *lock, struct ldlm_lock_desc *desc)
{
- struct obd_export *exp = lock->l_export?:lock->l_conn_export;
- /* INODEBITS_INTEROP: If the other side does not support
- * inodebits, reply with a plain lock descriptor.
- */
- if ((lock->l_resource->lr_type == LDLM_IBITS) &&
- (exp && !(exp->exp_connect_flags & OBD_CONNECT_IBITS))) {
+ struct obd_export *exp = lock->l_export ?: lock->l_conn_export;
+
+ /* INODEBITS_INTEROP: If the other side does not support
+ * inodebits, reply with a plain lock descriptor. */
+ if ((lock->l_resource->lr_type == LDLM_IBITS) &&
+ (exp && !(exp_connect_flags(exp) & OBD_CONNECT_IBITS))) {
/* Make sure all the right bits are set in this lock we
are going to pass to client */
LASSERTF(lock->l_policy_data.l_inodebits.bits ==
GOTO(out, rc = -EFAULT);
}
- if (req->rq_export->exp_connect_flags & OBD_CONNECT_IBITS) {
+ if (exp_connect_flags(req->rq_export) & OBD_CONNECT_IBITS) {
if (unlikely(dlm_req->lock_desc.l_resource.lr_type ==
LDLM_PLAIN)) {
DEBUG_REQ(D_ERROR, req,
/* INODEBITS_INTEROP: Perform conversion from plain lock to
* inodebits lock if client does not support them. */
- if (!(req->rq_export->exp_connect_flags & OBD_CONNECT_IBITS) &&
+ if (!(exp_connect_flags(req->rq_export) & OBD_CONNECT_IBITS) &&
(dlm_req->lock_desc.l_resource.lr_type == LDLM_PLAIN)) {
dlm_req->lock_desc.l_resource.lr_type = LDLM_IBITS;
dlm_req->lock_desc.l_policy_data.l_inodebits.bits =
GOTO(cleanup, rc = -ENOMEM);
LDLM_DEBUG(lock, "client-side enqueue, new resource");
}
- if (with_policy)
- if (!(type == LDLM_IBITS && !(exp->exp_connect_flags &
- OBD_CONNECT_IBITS)))
- /* We assume lock type cannot change on server*/
- ldlm_convert_policy_to_local(exp,
- lock->l_resource->lr_type,
- &reply->lock_desc.l_policy_data,
- &lock->l_policy_data);
+ if (with_policy)
+ if (!(type == LDLM_IBITS &&
+ !(exp_connect_flags(exp) & OBD_CONNECT_IBITS)))
+ /* We assume lock type cannot change on server*/
+ ldlm_convert_policy_to_local(exp,
+ lock->l_resource->lr_type,
+ &reply->lock_desc.l_policy_data,
+ &lock->l_policy_data);
if (type != LDLM_PLAIN)
LDLM_DEBUG(lock,"client-side enqueue, new policy data");
}
* inodebits lock internally with both bits set.
*/
if (einfo->ei_type == LDLM_IBITS &&
- !(exp->exp_connect_flags & OBD_CONNECT_IBITS))
+ !(exp_connect_flags(exp) &
+ OBD_CONNECT_IBITS))
lock->l_policy_data.l_inodebits.bits =
MDS_INODELOCK_LOOKUP |
MDS_INODELOCK_UPDATE;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p) hash "LPU64"\n",
inode->i_ino, inode->i_generation, inode, hash);
- LASSERT(max_pages > 0 && max_pages <= PTLRPC_MAX_BRW_PAGES);
+ LASSERT(max_pages > 0 && max_pages <= MD_MAX_BRW_PAGES);
OBD_ALLOC(page_pool, sizeof(page) * max_pages);
if (page_pool != NULL) {
/* XXX: Enable OBD_CONNECT_ATTRFID to reduce unnecessary getattr RPC.
* But under CMD case, it caused some lock issues, should be fixed
* with new CMD ibits lock. See bug 12718 */
- if (exp->exp_connect_flags & OBD_CONNECT_ATTRFID) {
+ if (exp_connect_flags(exp) & OBD_CONNECT_ATTRFID) {
struct lookup_intent oit = { .it_op = IT_GETATTR };
struct md_op_data *op_data;
if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
data->ocd_connect_flags |= OBD_CONNECT_RMT_CLIENT_FORCE;
- data->ocd_brw_size = PTLRPC_MAX_BRW_SIZE;
+ data->ocd_brw_size = MD_MAX_BRW_SIZE;
err = obd_connect(NULL, &sbi->ll_md_exp, obd, &sbi->ll_sb_uuid, data, NULL);
if (err == -EBUSY) {
GOTO(out, err);
}
+ sbi->ll_md_exp->exp_connect_data = *data;
+
/* For mount, we only need fs info from MDT0, and also in DNE, it
* can make sure the client can be mounted as long as MDT0 is
* avaible */
* be non-zero, but if accessing an upgraded 2.1 server it will
* have the correct flags filled in.
* XXX: fill in the LMV exp_connect_flags from MDC(s). */
- valid = sbi->ll_md_exp->exp_connect_flags & CLIENT_CONNECT_MDT_REQD;
- if (sbi->ll_md_exp->exp_connect_flags != 0 &&
+ valid = exp_connect_flags(sbi->ll_md_exp) & CLIENT_CONNECT_MDT_REQD;
+ if (exp_connect_flags(sbi->ll_md_exp) != 0 &&
valid != CLIENT_CONNECT_MDT_REQD) {
char *buf;
if (data->ocd_connect_flags & OBD_CONNECT_64BITHASH)
sbi->ll_flags |= LL_SBI_64BIT_HASH;
- if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE)
- sbi->ll_md_brw_size = data->ocd_brw_size;
- else
- sbi->ll_md_brw_size = CFS_PAGE_SIZE;
+ if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE)
+ sbi->ll_md_brw_size = data->ocd_brw_size;
+ else
+ sbi->ll_md_brw_size = CFS_PAGE_SIZE;
if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK) {
LCONSOLE_INFO("Layout lock feature supported.\n");
obd->obd_upcall.onu_owner = &sbi->ll_lco;
obd->obd_upcall.onu_upcall = cl_ocd_update;
- data->ocd_brw_size = PTLRPC_MAX_BRW_SIZE;
+ data->ocd_brw_size = DT_MAX_BRW_SIZE;
err = obd_connect(NULL, &sbi->ll_dt_exp, obd, &sbi->ll_sb_uuid, data,
NULL);
GOTO(out_md, err);
}
+ sbi->ll_dt_exp->exp_connect_data = *data;
+
mutex_lock(&sbi->ll_lco.lco_lock);
sbi->ll_lco.lco_flags = data->ocd_connect_flags;
sbi->ll_lco.lco_md_exp = sbi->ll_md_exp;
#include <lustre_lite.h>
#include "llite_internal.h"
-#define LLOOP_MAX_SEGMENTS PTLRPC_MAX_BRW_PAGES
+#define LLOOP_MAX_SEGMENTS LNET_MAX_IOV
/* Possible states of device */
enum {
* then truncate this to be a full-sized RPC. For 4kB PAGE_SIZE this is
* up to 22MB for 128kB kmalloc and up to 682MB for 4MB kmalloc. */
#define MAX_DIO_SIZE ((MAX_MALLOC / sizeof(struct brw_page) * CFS_PAGE_SIZE) & \
- ~(PTLRPC_MAX_BRW_SIZE - 1))
+ ~(DT_MAX_BRW_SIZE - 1))
static ssize_t ll_direct_IO_26(int rw, struct kiocb *iocb,
const struct iovec *iov, loff_t file_offset,
unsigned long nr_segs)
* the same. Otherwise one of MDTs runs wrong version or
* something like this. --umka
*/
- obd->obd_self_export->exp_connect_flags =
- conn_data->ocd_connect_flags;
+ obd->obd_self_export->exp_connect_data = *conn_data;
}
#if 0
else if (ev == OBD_NOTIFY_DISCON) {
*/
rc = obd_get_info(env, lmv->tgts[0]->ltd_exp, keylen, key,
vallen, val, NULL);
- if (!rc && KEY_IS(KEY_CONN_DATA)) {
- exp->exp_connect_flags =
- ((struct obd_connect_data *)val)->ocd_connect_flags;
- }
+ if (!rc && KEY_IS(KEY_CONN_DATA))
+ exp->exp_connect_data = *(struct obd_connect_data *)val;
RETURN(rc);
} else if (KEY_IS(KEY_TGT_COUNT)) {
*((int *)val) = lmv->desc.ld_tgt_count;
void lod_fix_desc_stripe_size(__u64 *val)
{
- if (*val < PTLRPC_MAX_BRW_SIZE) {
+ if (*val < LOV_DEFAULT_STRIPE_SIZE) {
LCONSOLE_WARN("Increasing default stripe size to min %u\n",
- PTLRPC_MAX_BRW_SIZE);
- *val = PTLRPC_MAX_BRW_SIZE;
+ LOV_DEFAULT_STRIPE_SIZE);
+ *val = LOV_DEFAULT_STRIPE_SIZE;
} else if (*val & (LOV_MIN_STRIPE_SIZE - 1)) {
*val &= ~(LOV_MIN_STRIPE_SIZE - 1);
LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
void lov_fix_desc_stripe_size(__u64 *val)
{
- if (*val < PTLRPC_MAX_BRW_SIZE) {
- LCONSOLE_WARN("Increasing default stripe size to min %u\n",
- PTLRPC_MAX_BRW_SIZE);
- *val = PTLRPC_MAX_BRW_SIZE;
- } else if (*val & (LOV_MIN_STRIPE_SIZE - 1)) {
- *val &= ~(LOV_MIN_STRIPE_SIZE - 1);
- LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
- "multiple of %u)\n",
- *val, LOV_MIN_STRIPE_SIZE);
- }
+ if (*val < LOV_DEFAULT_STRIPE_SIZE) {
+ LCONSOLE_WARN("Increasing default stripe size to min %u\n",
+ LOV_DEFAULT_STRIPE_SIZE);
+ *val = LOV_DEFAULT_STRIPE_SIZE;
+ } else if (*val & (LOV_MIN_STRIPE_SIZE - 1)) {
+ *val &= ~(LOV_MIN_STRIPE_SIZE - 1);
+ LCONSOLE_WARN("Changing default stripe size to "LPU64" (a "
+ "multiple of %u)\n",
+ *val, LOV_MIN_STRIPE_SIZE);
+ }
}
void lov_fix_desc_stripe_count(__u32 *val)
if (!tgt || !tgt->ltd_exp)
GOTO(out, rc = -ESRCH);
- *((__u64*)val) = tgt->ltd_exp->exp_connect_flags;
+ *((__u64 *)val) = exp_connect_flags(tgt->ltd_exp);
GOTO(out, rc = 0);
} else if (KEY_IS(KEY_TGT_COUNT)) {
*((int *)val) = lov->desc.ld_tgt_count;
OBD_FREE_PTR(oqctl);
break;
}
- case LL_IOC_GET_CONNECT_FLAGS: {
- if (cfs_copy_to_user(uarg, &exp->exp_connect_flags,
- sizeof(__u64)))
- GOTO(out, rc = -EFAULT);
- else
- GOTO(out, rc = 0);
- }
+ case LL_IOC_GET_CONNECT_FLAGS: {
+ if (cfs_copy_to_user(uarg,
+ exp_connect_flags_ptr(exp),
+ sizeof(__u64)))
+ GOTO(out, rc = -EFAULT);
+ else
+ GOTO(out, rc = 0);
+ }
default:
CERROR("mdc_ioctl(): unrecognised ioctl %#x\n", cmd);
GOTO(out, rc = -ENOTTY);
repbody->valid |= OBD_MD_FLID;
if (mdt->mdt_opts.mo_mds_capa &&
- info->mti_exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA) {
+ exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA) {
struct mdt_object *root;
struct lustre_capa *capa;
struct lu_attr *la = &ma->ma_attr;
ENTRY;
- if (exp->exp_connect_flags & OBD_CONNECT_LAYOUTLOCK)
- /* the client can deal with 16-bit lmm_stripe_count */
- RETURN_EXIT;
+ if (exp_connect_flags(exp) & OBD_CONNECT_LAYOUTLOCK)
+ /* the client can deal with 16-bit lmm_stripe_count */
+ RETURN_EXIT;
body = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
}
}
#ifdef CONFIG_FS_POSIX_ACL
- else if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) &&
- (reqbody->valid & OBD_MD_FLACL)) {
+ else if ((exp_connect_flags(req->rq_export) & OBD_CONNECT_ACL) &&
+ (reqbody->valid & OBD_MD_FLACL)) {
buffer->lb_buf = req_capsule_server_get(pill, &RMF_ACL);
buffer->lb_len = req_capsule_get_size(pill,
&RMF_ACL, RCL_SERVER);
}
#endif
- if (reqbody->valid & OBD_MD_FLMDSCAPA &&
- info->mti_mdt->mdt_opts.mo_mds_capa &&
- info->mti_exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA) {
+ if (reqbody->valid & OBD_MD_FLMDSCAPA &&
+ info->mti_mdt->mdt_opts.mo_mds_capa &&
+ exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA) {
struct lustre_capa *capa;
capa = req_capsule_server_get(pill, &RMF_CAPA1);
* return directly, client will find body->valid OBD_MD_FLOSSCAPA
* flag not set.
*/
- if (!obj || !info->mti_mdt->mdt_opts.mo_oss_capa ||
- !(info->mti_exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA))
- RETURN(0);
+ if (!obj || !info->mti_mdt->mdt_opts.mo_oss_capa ||
+ !(exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA))
+ RETURN(0);
body = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
LASSERT(body != NULL);
spin_lock(&req->rq_export->exp_lock);
if (*(__u32 *)val)
- req->rq_export->exp_connect_flags |= OBD_CONNECT_RDONLY;
+ *exp_connect_flags_ptr(req->rq_export) |=
+ OBD_CONNECT_RDONLY;
else
- req->rq_export->exp_connect_flags &=~OBD_CONNECT_RDONLY;
+ *exp_connect_flags_ptr(req->rq_export) &=
+ ~OBD_CONNECT_RDONLY;
spin_unlock(&req->rq_export->exp_lock);
} else if (KEY_IS(KEY_CHANGELOG_CLEAR)) {
reply = req_capsule_server_get(info->mti_pill, &RMF_CONNECT_DATA);
exp = req->rq_export;
spin_lock(&exp->exp_lock);
- exp->exp_connect_flags = reply->ocd_connect_flags;
+ *exp_connect_flags_ptr(exp) = reply->ocd_connect_flags;
spin_unlock(&exp->exp_lock);
rc = mdt_init_idmap(info);
if (desc == NULL)
RETURN(-ENOMEM);
- if (!(exp->exp_connect_flags & OBD_CONNECT_BRW_SIZE))
+ if (!(exp_connect_flags(exp) & OBD_CONNECT_BRW_SIZE))
/* old client requires reply size in it's PAGE_SIZE,
- * which is rdpg->rp_count */
+ * which is rdpg->rp_count */
nob = rdpg->rp_count;
for (i = 0, tmpcount = nob; i < rdpg->rp_npages && tmpcount > 0;
}
rdpg->rp_attrs = reqbody->mode;
- if (info->mti_exp->exp_connect_flags & OBD_CONNECT_64BITHASH)
- rdpg->rp_attrs |= LUDA_64BITHASH;
- rdpg->rp_count = min_t(unsigned int, reqbody->nlink,
- PTLRPC_MAX_BRW_SIZE);
+ if (exp_connect_flags(info->mti_exp) & OBD_CONNECT_64BITHASH)
+ rdpg->rp_attrs |= LUDA_64BITHASH;
+ rdpg->rp_count = min_t(unsigned int, reqbody->nlink,
+ exp_brw_size(info->mti_exp));
rdpg->rp_npages = (rdpg->rp_count + CFS_PAGE_SIZE - 1) >>
CFS_PAGE_SHIFT;
OBD_ALLOC(rdpg->rp_pages, rdpg->rp_npages * sizeof rdpg->rp_pages[0]);
if (req_ii->ii_count <= 0)
GOTO(out, rc = -EFAULT);
rdpg->rp_count = min_t(unsigned int, req_ii->ii_count << LU_PAGE_SHIFT,
- PTLRPC_MAX_BRW_SIZE);
+ exp_brw_size(info->mti_exp));
rdpg->rp_npages = (rdpg->rp_count + CFS_PAGE_SIZE -1) >> CFS_PAGE_SHIFT;
/* allocate pages to store the containers */
rc = mdt_unpack_req_pack_rep(info, flags);
}
- if (rc == 0 && flags & MUTABOR &&
- req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY)
- /* should it be rq_status? */
- rc = -EROFS;
+ if (rc == 0 && flags & MUTABOR &&
+ exp_connect_flags(req->rq_export) & OBD_CONNECT_RDONLY)
+ /* should it be rq_status? */
+ rc = -EROFS;
if (rc == 0 && flags & HABEO_CLAVIS) {
struct ldlm_request *dlm_req;
rc = mdt_unpack_req_pack_rep(info, flv->it_flags);
if (rc == 0) {
struct ptlrpc_request *req = mdt_info_req(info);
- if (flv->it_flags & MUTABOR &&
- req->rq_export->exp_connect_flags & OBD_CONNECT_RDONLY)
- RETURN(-EROFS);
+ if (flv->it_flags & MUTABOR &&
+ exp_connect_flags(req->rq_export) & OBD_CONNECT_RDONLY)
+ RETURN(-EROFS);
}
if (rc == 0 && flv->it_act != NULL) {
/* execute policy */
* Compute the compatibility flags for a connection request based on
* features mutually supported by client and server.
*
- * The obd_export::exp_connect_flags field in \a exp must not be updated
- * here, otherwise a partially initialized value may be exposed. After
- * the connection request is successfully processed, the top-level MDT
- * connect request handler atomically updates the export connect flags
- * from the obd_connect_data::ocd_connect_flags field of the reply.
- * \see mdt_connect().
+ * The obd_export::exp_connect_data.ocd_connect_flags field in \a exp
+ * must not be updated here, otherwise a partially initialized value may
+ * be exposed. After the connection request is successfully processed,
+ * the top-level MDT connect request handler atomically updates the export
+ * connect flags from the obd_connect_data::ocd_connect_flags field of the
+ * reply. \see mdt_connect().
*
* \param exp the obd_export associated with this client/target pair
* \param mdt the target device for the connection
if (data->ocd_connect_flags & OBD_CONNECT_BRW_SIZE) {
data->ocd_brw_size = min(data->ocd_brw_size,
- (__u32)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT));
+ (__u32)MD_MAX_BRW_SIZE);
if (data->ocd_brw_size == 0) {
CERROR("%s: cli %s/%p ocd_connect_flags: "LPX64
" ocd_version: %x ocd_grant: %d "
}
}
- /* NB: Disregard the rule against updating exp_connect_flags in this
- * case, since tgt_client_new() needs to know if this is a lightweight
- * connection, and it is safe to expose this flag before connection
- * processing completes. */
+ /* NB: Disregard the rule against updating
+ * exp_connect_data.ocd_connect_flags in this case, since
+ * tgt_client_new() needs to know if this is a lightweight
+ * connection, and it is safe to expose this flag before
+ * connection processing completes. */
if (data->ocd_connect_flags & OBD_CONNECT_LIGHTWEIGHT) {
spin_lock(&exp->exp_lock);
- exp->exp_connect_flags |= OBD_CONNECT_LIGHTWEIGHT;
+ *exp_connect_flags_ptr(exp) |= OBD_CONNECT_LIGHTWEIGHT;
spin_unlock(&exp->exp_lock);
}
data->ocd_version = LUSTRE_VERSION_CODE;
+ exp->exp_connect_data = *data;
exp->exp_mdt_data.med_ibits_known = data->ocd_ibits_known;
if ((data->ocd_connect_flags & OBD_CONNECT_FID) == 0) {
static inline __u64 mdt_conn_flags(struct mdt_thread_info *info)
{
- LASSERT(info->mti_exp);
- return info->mti_exp->exp_connect_flags;
+ LASSERT(info->mti_exp);
+ return exp_connect_flags(info->mti_exp);
}
static inline void mdt_object_get(const struct lu_env *env,
int mdt_capa_keys_init(const struct lu_env *env, struct mdt_device *mdt);
static inline void mdt_set_capainfo(struct mdt_thread_info *info, int offset,
- const struct lu_fid *fid,
- struct lustre_capa *capa)
+ const struct lu_fid *fid,
+ struct lustre_capa *capa)
{
- struct md_capainfo *ci;
+ struct md_capainfo *ci;
LASSERT(offset >= 0 && offset < MD_CAPAINFO_MAX);
- if (!info->mti_mdt->mdt_opts.mo_mds_capa ||
- !(info->mti_exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA))
- return;
-
- ci = md_capainfo(info->mti_env);
- LASSERT(ci);
- ci->mc_fid[offset] = *fid;
- ci->mc_capa[offset] = capa;
+ if (!info->mti_mdt->mdt_opts.mo_mds_capa ||
+ !(exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA))
+ return;
+
+ ci = md_capainfo(info->mti_env);
+ LASSERT(ci);
+ ci->mc_fid[offset] = *fid;
+ ci->mc_capa[offset] = capa;
}
static inline void mdt_dump_capainfo(struct mdt_thread_info *info)
repbody->valid |= OBD_MD_FLCOOKIE;
}
- if (info->mti_mdt->mdt_opts.mo_oss_capa &&
- info->mti_exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA &&
- repbody->valid & OBD_MD_FLEASIZE) {
+ if (info->mti_mdt->mdt_opts.mo_oss_capa &&
+ exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA &&
+ repbody->valid & OBD_MD_FLEASIZE) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
cfs_list_for_each_entry(exp, &obd->obd_exports, exp_obd_chain) {
if (exp == obd->obd_self_export)
continue;
- if (exp->exp_connect_flags & OBD_CONNECT_MDS_MDS)
- continue;
+ if (exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS)
+ continue;
/* Some clients are already connected, skip the change */
LCONSOLE_INFO("%s is already connected, SOM will be %s on "
"the next mount\n", exp->exp_client_uuid.uuid,
if (exp->exp_nid_stats && exp->exp_nid_stats->nid_stats != NULL)
lprocfs_counter_incr(exp->exp_nid_stats->nid_stats, opcode);
if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
- (exp->exp_connect_flags & OBD_CONNECT_JOBSTATS))
+ (exp_connect_flags(exp) & OBD_CONNECT_JOBSTATS))
lprocfs_job_stats_log(exp->exp_obd,
lustre_msg_get_jobid(req->rq_reqmsg),
opcode, 1);
}
}
#ifdef CONFIG_FS_POSIX_ACL
- else if (exp->exp_connect_flags & OBD_CONNECT_ACL) {
+ else if (exp_connect_flags(exp) & OBD_CONNECT_ACL) {
const struct lu_env *env = info->mti_env;
struct md_object *next = mdt_object_child(o);
struct lu_buf *buf = &info->mti_buf;
}
#endif
- if (info->mti_mdt->mdt_opts.mo_mds_capa &&
- exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA) {
+ if (info->mti_mdt->mdt_opts.mo_mds_capa &&
+ exp_connect_flags(exp) & OBD_CONNECT_MDS_CAPA) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA1);
RETURN(rc);
repbody->valid |= OBD_MD_FLMDSCAPA;
}
- if (info->mti_mdt->mdt_opts.mo_oss_capa &&
- exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA &&
- S_ISREG(lu_object_attr(&o->mot_obj.mo_lu))) {
+ if (info->mti_mdt->mdt_opts.mo_oss_capa &&
+ exp_connect_flags(exp) & OBD_CONNECT_OSS_CAPA &&
+ S_ISREG(lu_object_attr(&o->mot_obj.mo_lu))) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
* If we are following a symlink, don't open; and do not return open
* handle for special nodes as client required.
*/
- if (islnk || (!isreg && !isdir &&
- (req->rq_export->exp_connect_flags & OBD_CONNECT_NODEVOH))) {
- lustre_msg_set_transno(req->rq_repmsg, 0);
- RETURN(0);
- }
+ if (islnk || (!isreg && !isdir &&
+ (exp_connect_flags(req->rq_export) & OBD_CONNECT_NODEVOH))) {
+ lustre_msg_set_transno(req->rq_repmsg, 0);
+ RETURN(0);
+ }
/*
* We need to return the existing object's fid back, so it is done here,
lcd->lcd_last_data = mti->mti_opdata;
}
- if ((mti->mti_exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0) {
+ if (exp_connect_flags(mti->mti_exp) & OBD_CONNECT_LIGHTWEIGHT) {
/* Although lightweight (LW) connections have no slot in
* last_rcvd, we still want to maintain the in-memory
* lsd_client_data structure in order to properly handle reply
if (repbody->valid & OBD_MD_FLMDSCAPA)
RETURN(rc);
- if (rc == 0 && info->mti_mdt->mdt_opts.mo_mds_capa &&
- info->mti_exp->exp_connect_flags & OBD_CONNECT_MDS_CAPA) {
+ if (rc == 0 && info->mti_mdt->mdt_opts.mo_mds_capa &&
+ exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA1);
mdt_pack_attr2body(info, repbody, &ma->ma_attr, mdt_object_fid(mo));
- if (info->mti_mdt->mdt_opts.mo_oss_capa &&
- info->mti_exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA &&
- S_ISREG(lu_object_attr(&mo->mot_obj.mo_lu)) &&
- (ma->ma_attr.la_valid & LA_SIZE) && !som_au) {
+ if (info->mti_mdt->mdt_opts.mo_oss_capa &&
+ exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA &&
+ S_ISREG(lu_object_attr(&mo->mot_obj.mo_lu)) &&
+ (ma->ma_attr.la_valid & LA_SIZE) && !som_au) {
struct lustre_capa *capa;
capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
if (!xattr_name)
RETURN(-EFAULT);
- if (!(req->rq_export->exp_connect_flags & OBD_CONNECT_XATTR) &&
- !strncmp(xattr_name, user_string, sizeof(user_string) - 1))
- RETURN(-EOPNOTSUPP);
+ if (!(exp_connect_flags(req->rq_export) & OBD_CONNECT_XATTR) &&
+ !strncmp(xattr_name, user_string, sizeof(user_string) - 1))
+ RETURN(-EOPNOTSUPP);
size = mo_xattr_get(info->mti_env,
mdt_object_child(info->mti_object),
if (strncmp(xattr_name, XATTR_USER_PREFIX,
sizeof(XATTR_USER_PREFIX) - 1) == 0) {
- if (!(req->rq_export->exp_connect_flags & OBD_CONNECT_XATTR))
- GOTO(out, rc = -EOPNOTSUPP);
+ if (!(exp_connect_flags(req->rq_export) & OBD_CONNECT_XATTR))
+ GOTO(out, rc = -EOPNOTSUPP);
if (strcmp(xattr_name, XATTR_NAME_LOV) == 0)
GOTO(out, rc = -EACCES);
if (strcmp(xattr_name, XATTR_NAME_LMA) == 0)
mgs_counter_incr(lexp, LPROC_MGS_CONNECT);
- if (data != NULL) {
- data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
- lexp->exp_connect_flags = data->ocd_connect_flags;
- data->ocd_version = LUSTRE_VERSION_CODE;
- }
+ if (data != NULL) {
+ data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
+ data->ocd_version = LUSTRE_VERSION_CODE;
+ lexp->exp_connect_data = *data;
+ }
rc = mgs_export_stats_init(obd, lexp, localdata);
}
static int mgs_reconnect(const struct lu_env *env,
- struct obd_export *exp, struct obd_device *obd,
- struct obd_uuid *cluuid, struct obd_connect_data *data,
- void *localdata)
+ struct obd_export *exp, struct obd_device *obd,
+ struct obd_uuid *cluuid, struct obd_connect_data *data,
+ void *localdata)
{
- ENTRY;
+ ENTRY;
- if (exp == NULL || obd == NULL || cluuid == NULL)
- RETURN(-EINVAL);
+ if (exp == NULL || obd == NULL || cluuid == NULL)
+ RETURN(-EINVAL);
- mgs_counter_incr(exp, LPROC_MGS_CONNECT);
+ mgs_counter_incr(exp, LPROC_MGS_CONNECT);
- if (data != NULL) {
- data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
- exp->exp_connect_flags = data->ocd_connect_flags;
- data->ocd_version = LUSTRE_VERSION_CODE;
- }
+ if (data != NULL) {
+ data->ocd_connect_flags &= MGS_CONNECT_SUPPORTED;
+ data->ocd_version = LUSTRE_VERSION_CODE;
+ exp->exp_connect_data = *data;
+ }
- RETURN(mgs_export_stats_init(obd, exp, localdata));
+ RETURN(mgs_export_stats_init(obd, exp, localdata));
}
static int mgs_disconnect(struct obd_export *exp)
if (new_fsc == NULL)
RETURN(-ENOMEM);
- CFS_INIT_LIST_HEAD(&new_fsc->mfc_export_list);
- CFS_INIT_LIST_HEAD(&new_fsc->mfc_fsdb_list);
- new_fsc->mfc_fsdb = fsdb;
- new_fsc->mfc_export = class_export_get(exp);
- new_fsc->mfc_ir_capable =
- !!(exp->exp_connect_flags & OBD_CONNECT_IMP_RECOV);
-
- rc = -EEXIST;
+ CFS_INIT_LIST_HEAD(&new_fsc->mfc_export_list);
+ CFS_INIT_LIST_HEAD(&new_fsc->mfc_fsdb_list);
+ new_fsc->mfc_fsdb = fsdb;
+ new_fsc->mfc_export = class_export_get(exp);
+ new_fsc->mfc_ir_capable = !!(exp_connect_flags(exp) &
+ OBD_CONNECT_IMP_RECOV);
+
+ rc = -EEXIST;
mutex_lock(&fsdb->fsdb_mutex);
/* tend to find it in export list because this list is shorter. */
* obd_stale_clients counter,
* lightweight exports are not counted */
if (exp->exp_failed &&
- (exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) == 0)
+ (exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT) == 0)
exp->exp_obd->obd_stale_clients++;
}
spin_unlock(&obd->obd_recovery_task_lock);
if (!filter->fo_fl_oss_capa)
RETURN(0);
- if (!(exp->exp_connect_flags & OBD_CONNECT_OSS_CAPA))
+ if (!(exp_connect_flags(exp) & OBD_CONNECT_OSS_CAPA))
RETURN(0);
if (capa == NULL) {
#include "ofd_internal.h"
-#define OFD_GRANT_CHUNK (2ULL * PTLRPC_MAX_BRW_SIZE)
-#define OFD_GRANT_SHRINK_LIMIT (16ULL * OFD_GRANT_CHUNK)
+#define OFD_GRANT_CHUNK (2ULL * DT_MAX_BRW_SIZE)
+#define OFD_GRANT_CHUNK_EXP(rexp) (2ULL * exp_brw_size((rexp)))
+#define OFD_GRANT_SHRINK_LIMIT(rexp) (16ULL * OFD_GRANT_CHUNK_EXP((rexp)))
static inline obd_size ofd_grant_from_cli(struct obd_export *exp,
struct ofd_device *ofd, obd_size val)
if (exp && ofd_grant_compat(exp, ofd))
/* Try to grant enough space to send a full-size RPC */
- return PTLRPC_MAX_BRW_SIZE <<
+ return exp_brw_size(exp) <<
(ofd->ofd_blockbits - COMPAT_BSIZE_SHIFT);
return OFD_GRANT_CHUNK;
}
long grant_shrink;
LASSERT_SPIN_LOCKED(&ofd->ofd_grant_lock);
-
+ LASSERT(exp);
if (left_space >= ofd->ofd_tot_granted_clients *
- OFD_GRANT_SHRINK_LIMIT)
+ OFD_GRANT_SHRINK_LIMIT(exp))
return;
grant_shrink = ofd_grant_from_cli(exp, ofd, oa->o_grant);
if (!grant)
RETURN(0);
- /* Allow >OFD_GRANT_CHUNK size when clients reconnect due to a
+ /* Allow >OFD_GRANT_CHUNK_EXP size when clients reconnect due to a
* server reboot. */
if ((grant > grant_chunk) && (!obd->obd_recovering))
grant = grant_chunk;
int force = 0; /* can use cached data */
/* don't grant space to client with read-only access */
- if ((exp->exp_connect_flags & OBD_CONNECT_RDONLY) ||
+ if ((exp_connect_flags(exp) & OBD_CONNECT_RDONLY) ||
ofd_grant_prohibit(exp, ofd))
return 0;
char *jobid, long amount)
{
if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
- (exp->exp_connect_flags & OBD_CONNECT_JOBSTATS))
+ (exp_connect_flags(exp) & OBD_CONNECT_JOBSTATS))
lprocfs_job_stats_log(exp->exp_obd, jobid, opcode, amount);
if (exp->exp_nid_stats != NULL &&
static inline int ofd_grant_param_supp(struct obd_export *exp)
{
- return !!(exp->exp_connect_flags & OBD_CONNECT_GRANT_PARAM);
+ return !!(exp_connect_flags(exp) & OBD_CONNECT_GRANT_PARAM);
}
/* Blocksize used for client not supporting OBD_CONNECT_GRANT_PARAM.
fed->fed_group = data->ocd_group;
data->ocd_connect_flags &= OST_CONNECT_SUPPORTED;
- exp->exp_connect_flags = data->ocd_connect_flags;
+ exp->exp_connect_data = *data;
data->ocd_version = LUSTRE_VERSION_CODE;
/* Kindly make sure the SKIP_ORPHAN flag is from MDS. */
data->ocd_grant_extent = ofd->ofd_dt_conf.ddp_grant_frag >> 10;
}
- if (exp->exp_connect_flags & OBD_CONNECT_GRANT)
+ if (exp_connect_flags(exp) & OBD_CONNECT_GRANT)
data->ocd_grant = ofd_grant_connect(env, exp, data->ocd_grant);
if (data->ocd_connect_flags & OBD_CONNECT_INDEX) {
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)(PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT));
+ (__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 "
ofd_grant_discard(exp);
ofd_fmd_cleanup(exp);
- if (exp->exp_connect_flags & OBD_CONNECT_GRANT_SHRINK) {
+ if (exp_connect_flags(exp) & OBD_CONNECT_GRANT_SHRINK) {
if (ofd->ofd_tot_granted_clients > 0)
ofd->ofd_tot_granted_clients --;
}
/* The QoS code on the MDS does not care about space reserved for
* precreate, so take it out. */
- if (exp->exp_connect_flags & OBD_CONNECT_MDS) {
+ if (exp_connect_flags(exp) & OBD_CONNECT_MDS) {
struct filter_export_data *fed;
fed = &obd->obd_self_export->exp_filter_data;
}
LASSERT(exp != NULL);
- skip_orphan = !!(exp->exp_connect_flags & OBD_CONNECT_SKIP_ORPHAN);
+ skip_orphan = !!(exp_connect_flags(exp) & OBD_CONNECT_SKIP_ORPHAN);
last = ofd_seq_last_oid(oseq);
LCONSOLE_INFO("%s: deleting orphan objects from "LPX64":"LPU64
LASSERT(ofd);
LASSERT(info->fti_exp);
- if ((info->fti_exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
+ if (exp_connect_flags(info->fti_exp) & OBD_CONNECT_LIGHTWEIGHT)
lw_client = true;
fed = &info->fti_exp->exp_filter_data;
CDEBUG(D_INODE, "mode: %o\n", body->oa.o_mode);
lustre_get_wire_obdo(aa->aa_oi->oi_oa, &body->oa);
- /* This should really be sent by the OST */
- aa->aa_oi->oi_oa->o_blksize = PTLRPC_MAX_BRW_SIZE;
- aa->aa_oi->oi_oa->o_valid |= OBD_MD_FLBLKSZ;
+ /* This should really be sent by the OST */
+ aa->aa_oi->oi_oa->o_blksize = DT_MAX_BRW_SIZE;
+ aa->aa_oi->oi_oa->o_valid |= OBD_MD_FLBLKSZ;
} else {
CDEBUG(D_INFO, "can't unpack ost_body\n");
rc = -EPROTO;
CDEBUG(D_INODE, "mode: %o\n", body->oa.o_mode);
lustre_get_wire_obdo(oinfo->oi_oa, &body->oa);
- /* This should really be sent by the OST */
- oinfo->oi_oa->o_blksize = PTLRPC_MAX_BRW_SIZE;
- oinfo->oi_oa->o_valid |= OBD_MD_FLBLKSZ;
+ /* This should really be sent by the OST */
+ oinfo->oi_oa->o_blksize = exp_brw_size(exp);
+ oinfo->oi_oa->o_valid |= OBD_MD_FLBLKSZ;
EXIT;
out:
lustre_get_wire_obdo(oa, &body->oa);
- /* This should really be sent by the OST */
- oa->o_blksize = PTLRPC_MAX_BRW_SIZE;
- oa->o_valid |= OBD_MD_FLBLKSZ;
+ /* This should really be sent by the OST */
+ oa->o_blksize = exp_brw_size(exp);
+ oa->o_valid |= OBD_MD_FLBLKSZ;
/* XXX LOV STACKING: the lsm that is passed to us from LOV does not
* have valid lsm_oinfo data structs, so don't go touching that.
RETURN(rc);
}
-#define GRANT_SHRINK_LIMIT PTLRPC_MAX_BRW_SIZE
static int osc_should_shrink_grant(struct client_obd *client)
{
cfs_time_t time = cfs_time_current();
OBD_CONNECT_GRANT_SHRINK) == 0)
return 0;
- if (cfs_time_aftereq(time, next_shrink - 5 * CFS_TICK)) {
- if (client->cl_import->imp_state == LUSTRE_IMP_FULL &&
- client->cl_avail_grant > GRANT_SHRINK_LIMIT)
- return 1;
- else
- osc_update_next_shrink(client);
- }
+ if (cfs_time_aftereq(time, next_shrink - 5 * CFS_TICK)) {
+ int brw_size = exp_brw_size(
+ client->cl_import->imp_obd->obd_self_export);
+
+ if (client->cl_import->imp_state == LUSTRE_IMP_FULL &&
+ client->cl_avail_grant > brw_size)
+ return 1;
+ else
+ osc_update_next_shrink(client);
+ }
return 0;
}
OBD_CONNECT_RMT_CLIENT_FORCE | \
OBD_CONNECT_OSS_CAPA); \
spin_lock(&exp->exp_lock); \
- exp->exp_connect_flags = reply->ocd_connect_flags; \
+ *exp_connect_flags_ptr(exp) = reply->ocd_connect_flags; \
spin_unlock(&exp->exp_lock); \
} while (0)
reply->ocd_connect_flags &= ~OBD_CONNECT_OSS_CAPA;
spin_lock(&exp->exp_lock);
- exp->exp_connect_flags = reply->ocd_connect_flags;
+ *exp_connect_flags_ptr(exp) = reply->ocd_connect_flags;
spin_unlock(&exp->exp_lock);
}
break;
RETURN(rc);
if (req && req->rq_reqmsg && req->rq_export &&
- (req->rq_export->exp_connect_flags & OBD_CONNECT_JOBSTATS))
+ (exp_connect_flags(req->rq_export) & OBD_CONNECT_JOBSTATS))
oti->oti_jobid = lustre_msg_get_jobid(req->rq_reqmsg);
switch (lustre_msg_get_opc(req->rq_reqmsg)) {
imp->imp_obd->obd_name);
GOTO(out, rc = -ENODEV);
}
- old_connect_flags = exp->exp_connect_flags;
- exp->exp_connect_flags = ocd->ocd_connect_flags;
- imp->imp_obd->obd_self_export->exp_connect_flags =
- ocd->ocd_connect_flags;
+ old_connect_flags = exp_connect_flags(exp);
+ exp->exp_connect_data = *ocd;
+ imp->imp_obd->obd_self_export->exp_connect_data = *ocd;
class_export_put(exp);
obd_import_event(imp->imp_obd, imp, IMP_EVENT_OCD);
imp->imp_connect_op == MGS_CONNECT)
cli->cl_max_pages_per_rpc = 1;
- /* Reset ns_connect_flags only for initial connect. It might be
- * changed in while using FS and if we reset it in reconnect
- * this leads to losing user settings done before such as
- * disable lru_resize, etc. */
- if (old_connect_flags != exp->exp_connect_flags ||
- aa->pcaa_initial_connect) {
+ /* Reset ns_connect_flags only for initial connect. It might be
+ * changed in while using FS and if we reset it in reconnect
+ * this leads to losing user settings done before such as
+ * disable lru_resize, etc. */
+ if (old_connect_flags != exp_connect_flags(exp) ||
+ aa->pcaa_initial_connect) {
CDEBUG(D_HA, "%s: Resetting ns_connect_flags to server "
"flags: "LPX64"\n", imp->imp_obd->obd_name,
ocd->ocd_connect_flags);
/* minimum qunit size, 1K inode for metadata pool and 1MB for data pool */
#define LQUOTA_LEAST_QUNIT(type) \
- (type == LQUOTA_RES_MD ? (1 << 10) : toqb(PTLRPC_MAX_BRW_SIZE))
+ (type == LQUOTA_RES_MD ? (1 << 10) : toqb(OFD_MAX_BRW_SIZE))
#define LQUOTA_OVER_FL(type) \
(type == USRQUOTA ? QUOTA_FL_OVER_USRQUOTA : QUOTA_FL_OVER_GRPQUOTA)
fid = global ? &qqi->qqi_fid : &qqi->qqi_slv_fid;
/* let's do a 1MB bulk */
- npages = min_t(unsigned int, PTLRPC_MAX_BRW_SIZE, 1 << 20);
+ npages = min_t(unsigned int, OFD_MAX_BRW_SIZE, 1 << 20);
npages /= CFS_PAGE_SIZE;
/* allocate pages for bulk index read */
OBD_FREE_PTR(ccb);
}
- if ((exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
+ if (exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
/* report failure to force synchronous operation */
return -EPERM;
mutex_init(&ted->ted_lcd_lock);
- if ((exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
+ if (exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
RETURN(0);
/* the bitmap operations can handle cl_idx > sizeof(long) * 8, so
LASSERTF(idx >= 0, "%d\n", idx);
if (!strcmp(ted->ted_lcd->lcd_uuid, tgt->lut_obd->obd_uuid.uuid) ||
- (exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
+ exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
RETURN(0);
if (test_and_set_bit(idx, tgt->lut_client_bitmap)) {
/* XXX if lcd_uuid were a real obd_uuid, I could use obd_uuid_equals */
if (!strcmp((char *)ted->ted_lcd->lcd_uuid,
(char *)tgt->lut_obd->obd_uuid.uuid) ||
- (exp->exp_connect_flags & OBD_CONNECT_LIGHTWEIGHT) != 0)
+ exp_connect_flags(exp) & OBD_CONNECT_LIGHTWEIGHT)
RETURN(0);
CDEBUG(D_INFO, "%s: del client at idx %u, off %lld, UUID '%s'\n",