#define OSC_DEFAULT_RESENDS 10
/* possible values for lut_sync_lock_cancel */
-enum {
- NEVER_SYNC_ON_CANCEL = 0,
- BLOCKING_SYNC_ON_CANCEL = 1,
- ALWAYS_SYNC_ON_CANCEL = 2,
- NUM_SYNC_ON_CANCEL_STATES
+enum tgt_sync_lock_cancel {
+ SYNC_LOCK_CANCEL_NEVER = 0,
+ SYNC_LOCK_CANCEL_BLOCKING = 1,
+ SYNC_LOCK_CANCEL_ALWAYS = 2,
};
/*
static inline void mdt_enable_slc(struct mdt_device *mdt)
{
- if (mdt->mdt_lut.lut_sync_lock_cancel == NEVER_SYNC_ON_CANCEL)
- mdt->mdt_lut.lut_sync_lock_cancel = BLOCKING_SYNC_ON_CANCEL;
+ if (mdt->mdt_lut.lut_sync_lock_cancel == SYNC_LOCK_CANCEL_NEVER)
+ mdt->mdt_lut.lut_sync_lock_cancel = SYNC_LOCK_CANCEL_BLOCKING;
}
static inline void mdt_disable_slc(struct mdt_device *mdt)
{
- if (mdt->mdt_lut.lut_sync_lock_cancel == BLOCKING_SYNC_ON_CANCEL)
- mdt->mdt_lut.lut_sync_lock_cancel = NEVER_SYNC_ON_CANCEL;
+ if (mdt->mdt_lut.lut_sync_lock_cancel == SYNC_LOCK_CANCEL_BLOCKING)
+ mdt->mdt_lut.lut_sync_lock_cancel = SYNC_LOCK_CANCEL_NEVER;
}
static int mdt_obd_disconnect(struct obd_export *exp)
static inline bool mdt_slc_is_enabled(struct mdt_device *mdt)
{
- return mdt->mdt_lut.lut_sync_lock_cancel == BLOCKING_SYNC_ON_CANCEL;
+ return mdt->mdt_lut.lut_sync_lock_cancel == SYNC_LOCK_CANCEL_BLOCKING;
}
extern mdl_mode_t mdt_mdl_lock_modes[];
static inline void ofd_slc_set(struct ofd_device *ofd)
{
if (ofd->ofd_sync_journal == 1)
- ofd->ofd_lut.lut_sync_lock_cancel = NEVER_SYNC_ON_CANCEL;
- else if (ofd->ofd_lut.lut_sync_lock_cancel == NEVER_SYNC_ON_CANCEL)
- ofd->ofd_lut.lut_sync_lock_cancel = ALWAYS_SYNC_ON_CANCEL;
+ ofd->ofd_lut.lut_sync_lock_cancel = SYNC_LOCK_CANCEL_NEVER;
+ else if (ofd->ofd_lut.lut_sync_lock_cancel == SYNC_LOCK_CANCEL_NEVER)
+ ofd->ofd_lut.lut_sync_lock_cancel = SYNC_LOCK_CANCEL_ALWAYS;
}
static inline int ofd_validate_seq(struct obd_export *exp, __u64 seq)
if (flag == LDLM_CB_CANCELING &&
(lock->l_granted_mode & (LCK_EX | LCK_PW | LCK_GROUP)) &&
- (tgt->lut_sync_lock_cancel == ALWAYS_SYNC_ON_CANCEL ||
- (tgt->lut_sync_lock_cancel == BLOCKING_SYNC_ON_CANCEL &&
+ (tgt->lut_sync_lock_cancel == SYNC_LOCK_CANCEL_ALWAYS ||
+ (tgt->lut_sync_lock_cancel == SYNC_LOCK_CANCEL_BLOCKING &&
ldlm_is_cbpending(lock))) &&
((exp_connect_flags(lock->l_export) & OBD_CONNECT_MDS_MDS) ||
lock->l_resource->lr_type == LDLM_EXTENT)) {
/* This must be longer than the longest string below */
#define SYNC_STATES_MAXLEN 16
-static char *sync_on_cancel_states[] = {"never",
- "blocking",
- "always" };
+static char *sync_lock_cancel_states[] = {
+ [SYNC_LOCK_CANCEL_NEVER] = "never",
+ [SYNC_LOCK_CANCEL_BLOCKING] = "blocking",
+ [SYNC_LOCK_CANCEL_ALWAYS] = "always",
+};
/**
* Show policy for handling dirty data under a lock being cancelled.
struct lu_target *tgt = obd->u.obt.obt_lut;
return sprintf(buf, "%s\n",
- sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
+ sync_lock_cancel_states[tgt->lut_sync_lock_cancel]);
}
EXPORT_SYMBOL(sync_lock_cancel_show);
obd_kset.kobj);
struct lu_target *tgt = obd->u.obt.obt_lut;
int val = -1;
- int i;
+ enum tgt_sync_lock_cancel slc;
if (count == 0 || count >= SYNC_STATES_MAXLEN)
return -EINVAL;
- for (i = 0 ; i < NUM_SYNC_ON_CANCEL_STATES; i++) {
- if (strcmp(buffer, sync_on_cancel_states[i]) == 0) {
- val = i;
+ for (slc = 0; slc < ARRAY_SIZE(sync_lock_cancel_states); slc++) {
+ if (strcmp(buffer, sync_lock_cancel_states[slc]) == 0) {
+ val = slc;
break;
}
}
sptlrpc_rule_set_init(&lut->lut_sptlrpc_rset);
spin_lock_init(&lut->lut_flags_lock);
- lut->lut_sync_lock_cancel = NEVER_SYNC_ON_CANCEL;
+ lut->lut_sync_lock_cancel = SYNC_LOCK_CANCEL_NEVER;
spin_lock_init(&lut->lut_slc_locks_guard);
INIT_LIST_HEAD(&lut->lut_slc_locks);