OBD_ALLOC(ptr, CFS_BITMAP_SIZE(size));
if (ptr == NULL)
- RETURN(ptr);
+ return ptr;
ptr->size = size;
- RETURN (ptr);
+ return ptr;
}
#define CFS_FREE_BITMAP(ptr) OBD_FREE(ptr, CFS_BITMAP_SIZE(ptr->size))
#define LERRCHKSUM(hexnum) (((hexnum) & 0xf) ^ ((hexnum) >> 4 & 0xf) ^ \
((hexnum) >> 8 & 0xf))
-
-/*
- * Some (nomina odiosa sunt) platforms define NULL as naked 0. This confuses
- * Lustre RETURN(NULL) macro.
- */
-#if defined(NULL)
-#undef NULL
-#endif
-
-#define NULL ((void *)0)
-
#define LUSTRE_SRV_LNET_PID LUSTRE_LNET_PID
-
#include <linux/list.h>
#ifndef cfs_for_each_possible_cpu
} while (0)
-/*
- * if rc == NULL, we need to code as RETURN((void *)NULL), otherwise
- * there will be a warning in osx.
- */
-#if defined(__GNUC__)
-
-long libcfs_log_return(struct libcfs_debug_msg_data *, long rc);
-#if BITS_PER_LONG > 32
-#define RETURN(rc) \
-do { \
- if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) { \
- LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL); \
- return (typeof(rc))libcfs_log_return(&msgdata, \
- (long)(rc)); \
- } \
- \
- return (rc); \
-} while (0)
-#else /* BITS_PER_LONG == 32 */
-/* We need an on-stack variable, because we cannot case a 32-bit pointer
- * directly to (long long) without generating a complier warning/error, yet
- * casting directly to (long) will truncate 64-bit return values. The log
- * values will print as 32-bit values, but they always have been. LU-1436
- */
-#define RETURN(rc) \
-do { \
- if (cfs_cdebug_show(D_TRACE, DEBUG_SUBSYSTEM)) { \
- typeof(rc) __rc = (rc); \
- LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, D_TRACE, NULL); \
- libcfs_log_return(&msgdata, (long_ptr_t)__rc); \
- return __rc; \
- } \
- \
- return (rc); \
-} while (0)
-#endif /* BITS_PER_LONG > 32 */
-
-#elif defined(_MSC_VER)
-#define RETURN(rc) \
-do { \
- CDEBUG(D_TRACE, "Process leaving.\n"); \
- return (rc); \
-} while (0)
-#else
-# error "Unkown compiler"
-#endif /* __GNUC__ */
-
extern int libcfs_debug_msg(struct libcfs_debug_msg_data *msgdata,
const char *format1, ...)
__attribute__ ((format (printf, 2, 3)));
}
ksocknal_connsock_decref(conn);
- RETURN (rc);
+ return rc;
}
void
/* must called with lnet_eq_wait_lock hold */
if (LNET_SEQ_GT(eq->eq_deq_seq, new_event->sequence))
- RETURN(0);
+ return 0;
/* We've got a new event... */
*ev = *new_event;
}
eq->eq_deq_seq = new_event->sequence + 1;
- RETURN(rc);
+ return rc;
}
/**
LASSERT (the_lnet.ln_refcount > 0);
if (neq < 1)
- RETURN(-ENOENT);
+ return -ENOENT;
lnet_eq_wait_lock();
if (eq == NULL) {
lnet_eq_wait_unlock();
- RETURN(-ENOENT);
+ return -ENOENT;
}
rc = lnet_eq_dequeue_event(eq, event);
if (rc != 0) {
lnet_eq_wait_unlock();
*which = i;
- RETURN(rc);
+ return rc;
}
}
}
lnet_eq_wait_unlock();
- RETURN(0);
+ return 0;
}
rc = LNetInit();
if (rc != 0) {
CERROR("LNetInit: error %d\n", rc);
- RETURN(rc);
+ return rc;
}
rc = libcfs_register_ioctl(&lnet_ioctl_handler);
(void) kthread_run(lnet_configure, NULL, "lnet_initd");
}
- RETURN(0);
+ return 0;
}
void
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_SEQ_QUERY,
LUSTRE_MDS_VERSION, SEQ_QUERY);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* Init operation code */
op = req_capsule_client_get(&req->rq_pill, &RMF_SEQ_OPC);
* setup (lcs_exp != NULL) */
if (seq->lcs_exp == NULL) {
mutex_unlock(&seq->lcs_mutex);
- RETURN(-EINPROGRESS);
+ return -EINPROGRESS;
}
rc = seq_client_rpc(seq, &seq->lcs_space,
SEQ_ALLOC_SUPER, "super");
}
mutex_unlock(&seq->lcs_mutex);
- RETURN(rc);
+ return rc;
}
/* Request sequence-controller node to allocate new meta-sequence. */
} while (rc == -EINPROGRESS || rc == -EAGAIN);
}
- RETURN(rc);
+ return rc;
}
/* Allocate new sequence for client. */
if (rc) {
CERROR("%s: Can't allocate new meta-sequence,"
"rc %d\n", seq->lcs_name, rc);
- RETURN(rc);
+ return rc;
} else {
CDEBUG(D_INFO, "%s: New range - "DRANGE"\n",
seq->lcs_name, PRANGE(&seq->lcs_space));
CDEBUG(D_INFO, "%s: Allocated sequence ["LPX64"]\n", seq->lcs_name,
*seqnr);
- RETURN(rc);
+ return rc;
}
static int seq_fid_alloc_prep(struct lu_client_seq *seq,
"rc %d\n", seq->lcs_name, rc);
seq_fid_alloc_fini(seq);
mutex_unlock(&seq->lcs_mutex);
- RETURN(rc);
+ return rc;
}
CDEBUG(D_INFO, "%s: Switch to sequence "
mutex_unlock(&seq->lcs_mutex);
CDEBUG(D_INFO, "%s: Allocated FID "DFID"\n", seq->lcs_name, PFID(fid));
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(seq_client_alloc_fid);
CERROR("%s: LProcFS failed in seq-init\n",
seq->lcs_name);
rc = PTR_ERR(seq->lcs_proc_dir);
- RETURN(rc);
+ return rc;
}
rc = lprocfs_add_vars(seq->lcs_proc_dir,
GOTO(out_cleanup, rc);
}
- RETURN(0);
+ return 0;
out_cleanup:
seq_client_proc_fini(seq);
rc = seq_client_proc_init(seq);
if (rc)
seq_client_fini(seq);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(seq_client_init);
OBD_ALLOC_PTR(cli->cl_seq);
if (cli->cl_seq == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
if (prefix == NULL)
if (rc)
GOTO(out_free_seq, rc);
- RETURN(rc);
+ return rc;
out_free_seq:
OBD_FREE_PTR(cli->cl_seq);
cli->cl_seq = NULL;
cli->cl_seq = NULL;
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(client_fid_fini);
(long long unsigned *)&tmp.lsr_start,
(long long unsigned *)&tmp.lsr_end);
if (rc != 2 || !range_is_sane(&tmp) || range_is_zero(&tmp))
- RETURN(-EINVAL);
+ return -EINVAL;
*range = tmp;
- RETURN(0);
+ return 0;
}
/* Client side procfs stuff */
mutex_unlock(&seq->lcs_mutex);
- RETURN(count);
+ return count;
}
static int
rc = seq_printf(m, "["LPX64" - "LPX64"]:%x:%s\n", PRANGE(&seq->lcs_space));
mutex_unlock(&seq->lcs_mutex);
- RETURN(rc);
+ return rc;
}
static ssize_t
rc = lprocfs_write_helper(buffer, count, &val);
if (rc)
- RETURN(rc);
+ return rc;
mutex_lock(&seq->lcs_mutex);
if (seq->lcs_type == LUSTRE_SEQ_DATA)
mutex_unlock(&seq->lcs_mutex);
- RETURN(count);
+ return count;
}
static int
rc = seq_printf(m, LPU64"\n", seq->lcs_width);
mutex_unlock(&seq->lcs_mutex);
- RETURN(rc);
+ return rc;
}
static int
rc = seq_printf(m, DFID"\n", PFID(&seq->lcs_fid));
mutex_unlock(&seq->lcs_mutex);
- RETURN(rc);
+ return rc;
}
static int
} else {
rc = seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
}
- RETURN(rc);
+ return rc;
}
LPROC_SEQ_FOPS(lprocfs_fid_space);
OBD_ALLOC_PTR(cache);
if (cache == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&cache->fci_entries_head);
INIT_LIST_HEAD(&cache->fci_lru);
CDEBUG(D_INFO, "%s: FLD cache - Size: %d, Threshold: %d\n",
cache->fci_name, cache_size, cache_threshold);
- RETURN(cache);
+ return cache;
}
/**
LASSERT(cache != NULL);
if (cache->fci_cache_count < cache->fci_cache_size)
- RETURN(0);
+ return 0;
curr = cache->fci_lru.prev;
CDEBUG(D_INFO, "%s: FLD cache - Shrunk by "
"%d entries\n", cache->fci_name, num);
- RETURN(0);
+ return 0;
}
/**
OBD_ALLOC_PTR(f_new);
if (!f_new)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
f_new->fce_range = *range;
- RETURN(f_new);
+ return f_new;
}
/**
/* Add new entry to cache and lru list. */
fld_cache_entry_add(cache, f_new, prev);
out:
- RETURN(0);
+ return 0;
}
int fld_cache_insert(struct fld_cache *cache,
flde = fld_cache_entry_create(range);
if (IS_ERR(flde))
- RETURN(PTR_ERR(flde));
+ return PTR_ERR(flde);
write_lock(&cache->fci_lock);
rc = fld_cache_insert_nolock(cache, flde);
if (rc)
OBD_FREE_PTR(flde);
- RETURN(rc);
+ return rc;
}
void fld_cache_delete_nolock(struct fld_cache *cache,
}
}
- RETURN(got);
+ return got;
}
/**
read_lock(&cache->fci_lock);
got = fld_cache_entry_lookup_nolock(cache, range);
read_unlock(&cache->fci_lock);
- RETURN(got);
+ return got;
}
/**
cache->fci_stat.fst_cache++;
read_unlock(&cache->fci_lock);
- RETURN(0);
+ return 0;
}
}
read_unlock(&cache->fci_lock);
- RETURN(-ENOENT);
+ return -ENOENT;
}
client_obd_list_lock(&cli->cl_loi_list_lock);
rc = list_empty(&mcw->mcw_entry);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- RETURN(rc);
+ return rc;
};
static void fld_enter_request(struct client_obd *cli)
list_for_each_entry(target, &fld->lcf_targets, ft_chain) {
if (target->ft_idx == hash)
- RETURN(target);
+ return target;
}
CERROR("%s: Can't find target by hash %d (seq "LPX64"). "
* LBUG() to catch this situation.
*/
LBUG();
- RETURN(NULL);
+ return NULL;
}
struct lu_fld_hash fld_hash[] = {
target->ft_idx, seq);
}
- RETURN(target);
+ return target;
}
/*
CERROR("%s: Attempt to add target %s (idx "LPU64") "
"on fly - skip it\n", fld->lcf_name, name,
tar->ft_idx);
- RETURN(0);
+ return 0;
} else {
CDEBUG(D_INFO, "%s: Adding target %s (idx "
LPU64")\n", fld->lcf_name, name, tar->ft_idx);
OBD_ALLOC_PTR(target);
if (target == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
spin_lock(&fld->lcf_lock);
list_for_each_entry(tmp, &fld->lcf_targets, ft_chain) {
OBD_FREE_PTR(target);
CERROR("Target %s exists in FLD and known as %s:#"LPU64"\n",
name, fld_target_name(tmp), tmp->ft_idx);
- RETURN(-EEXIST);
+ return -EEXIST;
}
}
fld->lcf_count++;
spin_unlock(&fld->lcf_lock);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(fld_client_add_target);
class_export_put(target->ft_exp);
OBD_FREE_PTR(target);
- RETURN(0);
+ return 0;
}
}
spin_unlock(&fld->lcf_lock);
- RETURN(-ENOENT);
+ return -ENOENT;
}
EXPORT_SYMBOL(fld_client_del_target);
CERROR("%s: LProcFS failed in fld-init\n",
fld->lcf_name);
rc = PTR_ERR(fld->lcf_proc_dir);
- RETURN(rc);
+ return rc;
}
rc = lprocfs_add_vars(fld->lcf_proc_dir,
GOTO(out_cleanup, rc);
}
- RETURN(0);
+ return 0;
out_cleanup:
fld_client_proc_fini(fld);
if (!hash_is_sane(hash)) {
CERROR("%s: Wrong hash function %#x\n",
fld->lcf_name, hash);
- RETURN(-EINVAL);
+ return -EINVAL;
}
fld->lcf_count = 0;
req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, LUSTRE_MDS_VERSION,
FLD_QUERY);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC);
*op = fld_op;
rc = fld_cache_lookup(fld->lcf_cache, seq, &res);
if (rc == 0) {
*mds = res.lsr_index;
- RETURN(0);
+ return 0;
}
/* Can not find it in the cache */
fld_cache_insert(fld->lcf_cache, &res);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(fld_client_lookup);
seq_printf(m, "%s\n", fld_target_name(target));
spin_unlock(&fld->lcf_lock);
- RETURN(0);
+ return 0;
}
static int
seq_printf(m, "%s\n", fld->lcf_hash->fh_name);
spin_unlock(&fld->lcf_lock);
- RETURN(0);
+ return 0;
}
static ssize_t
fld->lcf_name, hash->fh_name);
}
- RETURN(count);
+ return count;
}
static ssize_t
CDEBUG(D_INFO, "%s: Lookup cache is flushed\n", fld->lcf_name);
- RETURN(count);
+ return count;
}
static int fld_proc_cache_flush_open(struct inode *inode, struct file *file)
for (i = 0; i < bufcount; i++)
len += cfs_size_round(buflens[i]);
- RETURN(cfs_size_round(len));
+ return cfs_size_round(len);
}
OBD_ALLOC(lcfg, lustre_cfg_len(bufs->lcfg_bufcount,
bufs->lcfg_buflen));
if (!lcfg)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
lcfg->lcfg_version = LUSTRE_CFG_VERSION;
lcfg->lcfg_command = cmd;
lcfg->lcfg_buflens[i] = bufs->lcfg_buflen[i];
LOGL((char *)bufs->lcfg_buf[i], bufs->lcfg_buflen[i], ptr);
}
- RETURN(lcfg);
+ return lcfg;
}
static inline void lustre_cfg_free(struct lustre_cfg *lcfg)
struct lustre_cfg *lcfg = (struct lustre_cfg *)buf;
if (!lcfg)
- RETURN(-EINVAL);
+ return -EINVAL;
/* check that the first bits of the struct are valid */
if (len < LCFG_HDR_SIZE(0))
- RETURN(-EINVAL);
+ return -EINVAL;
if (lcfg->lcfg_version != LUSTRE_CFG_VERSION)
- RETURN(-EINVAL);
+ return -EINVAL;
if (lcfg->lcfg_bufcount >= LUSTRE_CFG_MAX_BUFCOUNT)
- RETURN(-EINVAL);
+ return -EINVAL;
/* check that the buflens are valid */
if (len < LCFG_HDR_SIZE(lcfg->lcfg_bufcount))
- RETURN(-EINVAL);
+ return -EINVAL;
/* make sure all the pointers point inside the data */
if (len < lustre_cfg_len(lcfg->lcfg_bufcount, lcfg->lcfg_buflens))
- RETURN(-EINVAL);
+ return -EINVAL;
- RETURN(0);
+ return 0;
}
#include <lustre/lustre_user.h>
if (fid_is_igif(fid)) {
ino = lu_igif_ino(fid);
- RETURN(ino);
+ return ino;
}
seq = fid_seq(fid);
ino = (seq << 24) + ((seq >> 24) & 0xffffff0000ULL) + fid_oid(fid);
- RETURN(ino ? ino : fid_oid(fid));
+ return ino ? ino : fid_oid(fid);
}
static inline __u32 fid_hash(const struct lu_fid *f, int bits)
if (fid_is_igif(fid)) {
ino = lu_igif_ino(fid);
- RETURN(ino);
+ return ino;
}
seq = fid_seq(fid) - FID_SEQ_START;
(seq >> (64 - (40-8)) & 0xffffff00) +
(fid_oid(fid) & 0xff000fff) + ((fid_oid(fid) & 0x00fff000) << 8);
- RETURN(ino ? ino : fid_oid(fid));
+ return ino ? ino : fid_oid(fid);
}
static inline int lu_fid_diff(struct lu_fid *fid1, struct lu_fid *fid2)
rc = llog_handle2ops(handle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_destroy == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_destroy(env, handle);
- RETURN(rc);
+ return rc;
}
static inline int llog_next_block(const struct lu_env *env,
rc = llog_handle2ops(loghandle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_next_block == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_next_block(env, loghandle, cur_idx, next_idx,
cur_offset, buf, len);
- RETURN(rc);
+ return rc;
}
static inline int llog_prev_block(const struct lu_env *env,
rc = llog_handle2ops(loghandle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_prev_block == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_prev_block(env, loghandle, prev_idx, buf, len);
- RETURN(rc);
+ return rc;
}
static inline int llog_connect(struct llog_ctxt *ctxt,
rc = llog_obd2ops(ctxt, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_connect == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_connect(ctxt, logid, gen, uuid);
- RETURN(rc);
+ return rc;
}
/* llog.c */
do { \
if (!(obd)) { \
CERROR("NULL device\n"); \
- RETURN(-ENODEV); \
+ return -ENODEV; \
} \
} while (0)
if (!(obd)->obd_set_up || (obd)->obd_stopping) { \
CERROR("Device %d not setup\n", \
(obd)->obd_minor); \
- RETURN(-ENODEV); \
+ return -ENODEV; \
} \
} while (0)
if (err) \
CERROR("md_" #op ": dev %s/%d no operation\n", \
obd->obd_name, obd->obd_minor); \
- RETURN(err); \
+ return err; \
} \
} while (0)
do { \
if ((exp) == NULL) { \
CERROR("obd_" #op ": NULL export\n"); \
- RETURN(-ENODEV); \
+ return -ENODEV; \
} \
if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
CERROR("obd_" #op ": cleaned up obd\n"); \
- RETURN(-EOPNOTSUPP); \
+ return -EOPNOTSUPP; \
} \
if (!OBT((exp)->exp_obd) || !MDP((exp)->exp_obd, op)) { \
CERROR("obd_" #op ": dev %s/%d no operation\n", \
(exp)->exp_obd->obd_name, \
(exp)->exp_obd->obd_minor); \
- RETURN(-EOPNOTSUPP); \
+ return -EOPNOTSUPP; \
} \
} while (0)
if (err) \
CERROR("obd_" #op ": dev %d no operation\n", \
obd->obd_minor); \
- RETURN(err); \
+ return err; \
} \
} while (0)
do { \
if ((exp) == NULL) { \
CERROR("obd_" #op ": NULL export\n"); \
- RETURN(-ENODEV); \
+ return -ENODEV; \
} \
if ((exp)->exp_obd == NULL || !OBT((exp)->exp_obd)) { \
CERROR("obd_" #op ": cleaned up obd\n"); \
- RETURN(-EOPNOTSUPP); \
+ return -EOPNOTSUPP; \
} \
if (!OBT((exp)->exp_obd) || !OBP((exp)->exp_obd, op)) { \
CERROR("obd_" #op ": dev %d no operation\n", \
(exp)->exp_obd->obd_minor); \
- RETURN(-EOPNOTSUPP); \
+ return -EOPNOTSUPP; \
} \
} while (0)
if (err) \
CERROR("lop_" #op ": dev %d no operation\n", \
ctxt->loc_obd->obd_minor); \
- RETURN(err); \
+ return err; \
} \
} while (0)
rc = OBP(exp->exp_obd, get_info)(env, exp, keylen, key, vallen, val,
lsm);
- RETURN(rc);
+ return rc;
}
static inline int obd_set_info_async(const struct lu_env *env,
rc = OBP(exp->exp_obd, set_info_async)(env, exp, keylen, key, vallen,
val, set);
- RETURN(rc);
+ return rc;
}
/*
OBD_COUNTER_INCREMENT(obd, setup);
rc = OBP(obd, setup)(obd, cfg);
}
- RETURN(rc);
+ return rc;
}
static inline int obd_precleanup(struct obd_device *obd,
OBD_COUNTER_INCREMENT(obd, precleanup);
rc = OBP(obd, precleanup)(obd, cleanup_stage);
- RETURN(rc);
+ return rc;
}
static inline int obd_cleanup(struct obd_device *obd)
OBD_COUNTER_INCREMENT(obd, cleanup);
rc = OBP(obd, cleanup)(obd);
- RETURN(rc);
+ return rc;
}
static inline void obd_cleanup_client_import(struct obd_device *obd)
OBD_COUNTER_INCREMENT(obd, process_config);
obd->obd_process_conf = 0;
- RETURN(rc);
+ return rc;
}
/* Pack an in-memory MD struct for storage on disk.
EXP_COUNTER_INCREMENT(exp, packmd);
rc = OBP(exp->exp_obd, packmd)(exp, disk_tgt, mem_src);
- RETURN(rc);
+ return rc;
}
static inline int obd_size_diskmd(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, unpackmd);
rc = OBP(exp->exp_obd, unpackmd)(exp, mem_tgt, disk_src, disk_len);
- RETURN(rc);
+ return rc;
}
/* helper functions */
OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);
rc = OBP(exp->exp_obd, precreate)(exp);
- RETURN(rc);
+ return rc;
}
static inline int obd_create_async(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, create_async);
rc = OBP(exp->exp_obd, create_async)(exp, oinfo, ea, oti);
- RETURN(rc);
+ return rc;
}
static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, create);
rc = OBP(exp->exp_obd, create)(env, exp, obdo, ea, oti);
- RETURN(rc);
+ return rc;
}
static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, destroy);
rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa);
- RETURN(rc);
+ return rc;
}
static inline int obd_getattr(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, getattr);
rc = OBP(exp->exp_obd, getattr)(env, exp, oinfo);
- RETURN(rc);
+ return rc;
}
static inline int obd_getattr_async(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, getattr_async);
rc = OBP(exp->exp_obd, getattr_async)(exp, oinfo, set);
- RETURN(rc);
+ return rc;
}
static inline int obd_setattr(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, setattr);
rc = OBP(exp->exp_obd, setattr)(env, exp, oinfo, oti);
- RETURN(rc);
+ return rc;
}
/* This performs all the requests set init/wait/destroy actions. */
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = OBP(exp->exp_obd, setattr_async)(exp, oinfo, oti, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
/* This adds all the requests into @set if @set != NULL, otherwise
EXP_COUNTER_INCREMENT(exp, setattr_async);
rc = OBP(exp->exp_obd, setattr_async)(exp, oinfo, oti, set);
- RETURN(rc);
+ return rc;
}
static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,
OBD_COUNTER_INCREMENT(obd, add_conn);
rc = OBP(obd, add_conn)(imp, uuid, priority);
- RETURN(rc);
+ return rc;
}
static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid)
OBD_COUNTER_INCREMENT(obd, del_conn);
rc = OBP(obd, del_conn)(imp, uuid);
- RETURN(rc);
+ return rc;
}
static inline struct obd_uuid *obd_get_uuid(struct obd_export *exp)
EXP_COUNTER_INCREMENT(exp, get_uuid);
uuid = OBP(exp->exp_obd, get_uuid)(exp);
- RETURN(uuid);
+ return uuid;
}
/** Create a new /a exp on device /a obd for the uuid /a cluuid
/* check that only subset is granted */
LASSERT(ergo(data != NULL, (data->ocd_connect_flags & ocf) ==
data->ocd_connect_flags));
- RETURN(rc);
+ return rc;
}
static inline int obd_reconnect(const struct lu_env *env,
/* check that only subset is granted */
LASSERT(ergo(d != NULL,
(d->ocd_connect_flags & ocf) == d->ocd_connect_flags));
- RETURN(rc);
+ return rc;
}
static inline int obd_disconnect(struct obd_export *exp)
EXP_COUNTER_INCREMENT(exp, disconnect);
rc = OBP(exp->exp_obd, disconnect)(exp);
- RETURN(rc);
+ return rc;
}
static inline int obd_fid_init(struct obd_device *obd, struct obd_export *exp,
OBD_COUNTER_INCREMENT(obd, fid_init);
rc = OBP(obd, fid_init)(obd, exp, type);
- RETURN(rc);
+ return rc;
}
static inline int obd_fid_fini(struct obd_device *obd)
OBD_COUNTER_INCREMENT(obd, fid_fini);
rc = OBP(obd, fid_fini)(obd);
- RETURN(rc);
+ return rc;
}
static inline int obd_fid_alloc(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, fid_alloc);
rc = OBP(exp->exp_obd, fid_alloc)(exp, fid, op_data);
- RETURN(rc);
+ return rc;
}
static inline int obd_ping(const struct lu_env *env, struct obd_export *exp)
EXP_COUNTER_INCREMENT(exp, ping);
rc = OBP(exp->exp_obd, ping)(env, exp);
- RETURN(rc);
+ return rc;
}
static inline int obd_pool_new(struct obd_device *obd, char *poolname)
OBD_COUNTER_INCREMENT(obd, pool_new);
rc = OBP(obd, pool_new)(obd, poolname);
- RETURN(rc);
+ return rc;
}
static inline int obd_pool_del(struct obd_device *obd, char *poolname)
OBD_COUNTER_INCREMENT(obd, pool_del);
rc = OBP(obd, pool_del)(obd, poolname);
- RETURN(rc);
+ return rc;
}
static inline int obd_pool_add(struct obd_device *obd, char *poolname, char *ostname)
OBD_COUNTER_INCREMENT(obd, pool_add);
rc = OBP(obd, pool_add)(obd, poolname, ostname);
- RETURN(rc);
+ return rc;
}
static inline int obd_pool_rem(struct obd_device *obd, char *poolname, char *ostname)
OBD_COUNTER_INCREMENT(obd, pool_rem);
rc = OBP(obd, pool_rem)(obd, poolname, ostname);
- RETURN(rc);
+ return rc;
}
static inline void obd_getref(struct obd_device *obd)
if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
OBP((exp)->exp_obd, init_export))
rc = OBP(exp->exp_obd, init_export)(exp);
- RETURN(rc);
+ return rc;
}
static inline int obd_destroy_export(struct obd_export *exp)
if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&
OBP((exp)->exp_obd, destroy_export))
OBP(exp->exp_obd, destroy_export)(exp);
- RETURN(0);
+ return 0;
}
static inline int obd_extent_calc(struct obd_export *exp,
EXP_CHECK_DT_OP(exp, extent_calc);
rc = OBP(exp->exp_obd, extent_calc)(exp, md, cmd, offset);
- RETURN(rc);
+ return rc;
}
static inline struct dentry *
struct obd_device *obd;
if (exp == NULL || exp->exp_obd == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
obd = exp->exp_obd;
OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
if (oinfo->oi_cb_up)
oinfo->oi_cb_up(oinfo, 0);
}
- RETURN(rc);
+ return rc;
}
static inline int obd_statfs_rqset(struct obd_export *exp,
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oinfo.oi_osfs = osfs;
oinfo.oi_flags = flags;
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
/* @max_age is the oldest time in jiffies that we accept using a cached data.
struct obd_device *obd = exp->exp_obd;
if (obd == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
OBD_CHECK_DT_OP(obd, statfs, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(obd, statfs);
memcpy(osfs, &obd->obd_osfs, sizeof(*osfs));
spin_unlock(&obd->obd_osfs_lock);
}
- RETURN(rc);
+ return rc;
}
static inline int obd_sync_rqset(struct obd_export *exp, struct obd_info *oinfo,
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = OBP(exp->exp_obd, sync)(NULL, exp, oinfo, start, end, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
static inline int obd_sync(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, sync);
rc = OBP(exp->exp_obd, sync)(env, exp, oinfo, start, end, set);
- RETURN(rc);
+ return rc;
}
static inline int obd_punch_rqset(struct obd_export *exp,
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = OBP(exp->exp_obd, punch)(NULL, exp, oinfo, oti, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
static inline int obd_punch(const struct lu_env *env, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, punch);
rc = OBP(exp->exp_obd, punch)(env, exp, oinfo, oti, rqset);
- RETURN(rc);
+ return rc;
}
static inline int obd_brw(int cmd, struct obd_export *exp,
}
rc = OBP(exp->exp_obd, brw)(cmd, exp, oinfo, oa_bufs, pg, oti);
- RETURN(rc);
+ return rc;
}
static inline int obd_preprw(const struct lu_env *env, int cmd,
rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
pages, local, oti, capa);
- RETURN(rc);
+ return rc;
}
static inline int obd_commitrw(const struct lu_env *env, int cmd,
rc = OBP(exp->exp_obd, commitrw)(env, cmd, exp, oa, objcount, obj,
rnb, pages, local, oti, rc);
- RETURN(rc);
+ return rc;
}
static inline int obd_merge_lvb(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, merge_lvb);
rc = OBP(exp->exp_obd, merge_lvb)(exp, lsm, lvb, kms_only);
- RETURN(rc);
+ return rc;
}
static inline int obd_adjust_kms(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, adjust_kms);
rc = OBP(exp->exp_obd, adjust_kms)(exp, lsm, size, shrink);
- RETURN(rc);
+ return rc;
}
static inline int obd_iocontrol(unsigned int cmd, struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, iocontrol);
rc = OBP(exp->exp_obd, iocontrol)(cmd, exp, len, karg, uarg);
- RETURN(rc);
+ return rc;
}
static inline int obd_enqueue_rqset(struct obd_export *exp,
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
if (rc == 0)
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
static inline int obd_enqueue(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, enqueue);
rc = OBP(exp->exp_obd, enqueue)(exp, oinfo, einfo, set);
- RETURN(rc);
+ return rc;
}
static inline int obd_change_cbdata(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, change_cbdata);
rc = OBP(exp->exp_obd, change_cbdata)(exp, lsm, it, data);
- RETURN(rc);
+ return rc;
}
static inline int obd_find_cbdata(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, find_cbdata);
rc = OBP(exp->exp_obd, find_cbdata)(exp, lsm, it, data);
- RETURN(rc);
+ return rc;
}
static inline int obd_cancel(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, cancel);
rc = OBP(exp->exp_obd, cancel)(exp, ea, mode, lockh);
- RETURN(rc);
+ return rc;
}
static inline int obd_cancel_unused(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, cancel_unused);
rc = OBP(exp->exp_obd, cancel_unused)(exp, ea, flags, opaque);
- RETURN(rc);
+ return rc;
}
static inline int obd_pin(struct obd_export *exp, const struct lu_fid *fid,
EXP_COUNTER_INCREMENT(exp, pin);
rc = OBP(exp->exp_obd, pin)(exp, fid, oc, handle, flag);
- RETURN(rc);
+ return rc;
}
static inline int obd_unpin(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, unpin);
rc = OBP(exp->exp_obd, unpin)(exp, handle, flag);
- RETURN(rc);
+ return rc;
}
EXP_COUNTER_INCREMENT(exp, llog_connect);
rc = OBP(exp->exp_obd, llog_connect)(exp, body);
- RETURN(rc);
+ return rc;
}
by this point, and it needs to get them to execute mds_postrecov. */
if (!obd->obd_set_up && !obd->obd_async_recov) {
CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (!OBP(obd, notify)) {
CDEBUG(D_HA, "obd %s has no notify handler\n", obd->obd_name);
- RETURN(-ENOSYS);
+ return -ENOSYS;
}
OBD_COUNTER_INCREMENT(obd, notify);
rc = OBP(obd, notify)(obd, watched, ev, data);
- RETURN(rc);
+ return rc;
}
static inline int obd_notify_observer(struct obd_device *observer,
EXP_COUNTER_INCREMENT(exp, quotacheck);
rc = OBP(exp->exp_obd, quotacheck)(exp->exp_obd, exp, oqctl);
- RETURN(rc);
+ return rc;
}
static inline int obd_quotactl(struct obd_export *exp,
EXP_COUNTER_INCREMENT(exp, quotactl);
rc = OBP(exp->exp_obd, quotactl)(exp->exp_obd, exp, oqctl);
- RETURN(rc);
+ return rc;
}
static inline int obd_health_check(const struct lu_env *env,
/* don't use EXP_CHECK_DT_OP, because NULL method is normal here */
if (obd == NULL || !OBT(obd)) {
CERROR("cleaned up obd\n");
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
}
if (!obd->obd_set_up || obd->obd_stopping)
- RETURN(0);
+ return 0;
if (!OBP(obd, health_check))
- RETURN(0);
+ return 0;
rc = OBP(obd, health_check)(env, obd);
- RETURN(rc);
+ return rc;
}
static inline int obd_register_observer(struct obd_device *obd,
down_write(&obd->obd_observer_link_sem);
if (obd->obd_observer && observer) {
up_write(&obd->obd_observer_link_sem);
- RETURN(-EALREADY);
+ return -EALREADY;
}
obd->obd_observer = observer;
up_write(&obd->obd_observer_link_sem);
- RETURN(0);
+ return 0;
}
static inline int obd_pin_observer(struct obd_device *obd,
if (!obd->obd_observer) {
*observer = NULL;
up_read(&obd->obd_observer_link_sem);
- RETURN(-ENOENT);
+ return -ENOENT;
}
*observer = obd->obd_observer;
- RETURN(0);
+ return 0;
}
static inline int obd_unpin_observer(struct obd_device *obd)
{
up_read(&obd->obd_observer_link_sem);
- RETURN(0);
+ return 0;
}
#if 0
OBD_COUNTER_INCREMENT(exp->exp_obd, register_page_removal_cb);
rc = OBP(exp->exp_obd, register_page_removal_cb)(exp, cb, pin_cb);
- RETURN(rc);
+ return rc;
}
static inline int obd_unregister_page_removal_cb(struct obd_export *exp,
OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_page_removal_cb);
rc = OBP(exp->exp_obd, unregister_page_removal_cb)(exp, cb);
- RETURN(rc);
+ return rc;
}
static inline int obd_register_lock_cancel_cb(struct obd_export *exp,
OBD_COUNTER_INCREMENT(exp->exp_obd, register_lock_cancel_cb);
rc = OBP(exp->exp_obd, register_lock_cancel_cb)(exp, cb);
- RETURN(rc);
+ return rc;
}
static inline int obd_unregister_lock_cancel_cb(struct obd_export *exp,
OBD_COUNTER_INCREMENT(exp->exp_obd, unregister_lock_cancel_cb);
rc = OBP(exp->exp_obd, unregister_lock_cancel_cb)(exp, cb);
- RETURN(rc);
+ return rc;
}
#endif
EXP_CHECK_MD_OP(exp, getstatus);
EXP_MD_COUNTER_INCREMENT(exp, getstatus);
rc = MDP(exp->exp_obd, getstatus)(exp, fid, pc);
- RETURN(rc);
+ return rc;
}
static inline int md_getattr(struct obd_export *exp, struct md_op_data *op_data,
EXP_CHECK_MD_OP(exp, getattr);
EXP_MD_COUNTER_INCREMENT(exp, getattr);
rc = MDP(exp->exp_obd, getattr)(exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static inline int md_null_inode(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, null_inode);
EXP_MD_COUNTER_INCREMENT(exp, null_inode);
rc = MDP(exp->exp_obd, null_inode)(exp, fid);
- RETURN(rc);
+ return rc;
}
static inline int md_find_cbdata(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, find_cbdata);
EXP_MD_COUNTER_INCREMENT(exp, find_cbdata);
rc = MDP(exp->exp_obd, find_cbdata)(exp, fid, it, data);
- RETURN(rc);
+ return rc;
}
static inline int md_close(struct obd_export *exp, struct md_op_data *op_data,
EXP_CHECK_MD_OP(exp, close);
EXP_MD_COUNTER_INCREMENT(exp, close);
rc = MDP(exp->exp_obd, close)(exp, op_data, mod, request);
- RETURN(rc);
+ return rc;
}
static inline int md_create(struct obd_export *exp, struct md_op_data *op_data,
EXP_MD_COUNTER_INCREMENT(exp, create);
rc = MDP(exp->exp_obd, create)(exp, op_data, data, datalen, mode,
uid, gid, cap_effective, rdev, request);
- RETURN(rc);
+ return rc;
}
static inline int md_done_writing(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, done_writing);
EXP_MD_COUNTER_INCREMENT(exp, done_writing);
rc = MDP(exp->exp_obd, done_writing)(exp, op_data, mod);
- RETURN(rc);
+ return rc;
}
static inline int md_enqueue(struct obd_export *exp,
EXP_MD_COUNTER_INCREMENT(exp, enqueue);
rc = MDP(exp->exp_obd, enqueue)(exp, einfo, it, op_data, lockh,
lmm, lmmsize, req, extra_lock_flags);
- RETURN(rc);
+ return rc;
}
static inline int md_getattr_name(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, getattr_name);
EXP_MD_COUNTER_INCREMENT(exp, getattr_name);
rc = MDP(exp->exp_obd, getattr_name)(exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static inline int md_intent_lock(struct obd_export *exp,
rc = MDP(exp->exp_obd, intent_lock)(exp, op_data, lmm, lmmsize,
it, lookup_flags, reqp, cb_blocking,
extra_lock_flags);
- RETURN(rc);
+ return rc;
}
static inline int md_link(struct obd_export *exp, struct md_op_data *op_data,
EXP_CHECK_MD_OP(exp, link);
EXP_MD_COUNTER_INCREMENT(exp, link);
rc = MDP(exp->exp_obd, link)(exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static inline int md_rename(struct obd_export *exp, struct md_op_data *op_data,
EXP_MD_COUNTER_INCREMENT(exp, rename);
rc = MDP(exp->exp_obd, rename)(exp, op_data, old, oldlen, new,
newlen, request);
- RETURN(rc);
+ return rc;
}
static inline int md_is_subdir(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, is_subdir);
EXP_MD_COUNTER_INCREMENT(exp, is_subdir);
rc = MDP(exp->exp_obd, is_subdir)(exp, pfid, cfid, request);
- RETURN(rc);
+ return rc;
}
static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
EXP_MD_COUNTER_INCREMENT(exp, setattr);
rc = MDP(exp->exp_obd, setattr)(exp, op_data, ea, ealen,
ea2, ea2len, request, mod);
- RETURN(rc);
+ return rc;
}
static inline int md_sync(struct obd_export *exp, const struct lu_fid *fid,
EXP_CHECK_MD_OP(exp, sync);
EXP_MD_COUNTER_INCREMENT(exp, sync);
rc = MDP(exp->exp_obd, sync)(exp, fid, oc, request);
- RETURN(rc);
+ return rc;
}
static inline int md_readpage(struct obd_export *exp, struct md_op_data *opdata,
EXP_CHECK_MD_OP(exp, readpage);
EXP_MD_COUNTER_INCREMENT(exp, readpage);
rc = MDP(exp->exp_obd, readpage)(exp, opdata, pages, request);
- RETURN(rc);
+ return rc;
}
static inline int md_unlink(struct obd_export *exp, struct md_op_data *op_data,
EXP_CHECK_MD_OP(exp, unlink);
EXP_MD_COUNTER_INCREMENT(exp, unlink);
rc = MDP(exp->exp_obd, unlink)(exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static inline int md_get_lustre_md(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, get_lustre_md);
EXP_MD_COUNTER_INCREMENT(exp, get_lustre_md);
- RETURN(MDP(exp->exp_obd, get_lustre_md)(exp, req, dt_exp, md_exp, md));
+ return MDP(exp->exp_obd, get_lustre_md)(exp, req, dt_exp, md_exp, md);
}
static inline int md_free_lustre_md(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, free_lustre_md);
EXP_MD_COUNTER_INCREMENT(exp, free_lustre_md);
- RETURN(MDP(exp->exp_obd, free_lustre_md)(exp, md));
+ return MDP(exp->exp_obd, free_lustre_md)(exp, md);
}
static inline int md_setxattr(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, setxattr);
EXP_MD_COUNTER_INCREMENT(exp, setxattr);
- RETURN(MDP(exp->exp_obd, setxattr)(exp, fid, oc, valid, name, input,
+ return MDP(exp->exp_obd, setxattr)(exp, fid, oc, valid, name, input,
input_size, output_size, flags,
- suppgid, request));
+ suppgid, request);
}
static inline int md_getxattr(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, getxattr);
EXP_MD_COUNTER_INCREMENT(exp, getxattr);
- RETURN(MDP(exp->exp_obd, getxattr)(exp, fid, oc, valid, name, input,
+ return MDP(exp->exp_obd, getxattr)(exp, fid, oc, valid, name, input,
input_size, output_size, flags,
- request));
+ request);
}
static inline int md_set_open_replay_data(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, set_open_replay_data);
EXP_MD_COUNTER_INCREMENT(exp, set_open_replay_data);
- RETURN(MDP(exp->exp_obd, set_open_replay_data)(exp, och, open_req));
+ return MDP(exp->exp_obd, set_open_replay_data)(exp, och, open_req);
}
static inline int md_clear_open_replay_data(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, clear_open_replay_data);
EXP_MD_COUNTER_INCREMENT(exp, clear_open_replay_data);
- RETURN(MDP(exp->exp_obd, clear_open_replay_data)(exp, och));
+ return MDP(exp->exp_obd, clear_open_replay_data)(exp, och);
}
static inline int md_set_lock_data(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, set_lock_data);
EXP_MD_COUNTER_INCREMENT(exp, set_lock_data);
- RETURN(MDP(exp->exp_obd, set_lock_data)(exp, lockh, data, bits));
+ return MDP(exp->exp_obd, set_lock_data)(exp, lockh, data, bits);
}
static inline int md_cancel_unused(struct obd_export *exp,
rc = MDP(exp->exp_obd, cancel_unused)(exp, fid, policy, mode,
flags, opaque);
- RETURN(rc);
+ return rc;
}
static inline ldlm_mode_t md_lock_match(struct obd_export *exp, __u64 flags,
{
EXP_CHECK_MD_OP(exp, lock_match);
EXP_MD_COUNTER_INCREMENT(exp, lock_match);
- RETURN(MDP(exp->exp_obd, lock_match)(exp, flags, fid, type,
- policy, mode, lockh));
+ return MDP(exp->exp_obd, lock_match)(exp, flags, fid, type,
+ policy, mode, lockh);
}
static inline int md_init_ea_size(struct obd_export *exp, int easize,
{
EXP_CHECK_MD_OP(exp, init_ea_size);
EXP_MD_COUNTER_INCREMENT(exp, init_ea_size);
- RETURN(MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize,
- cookiesize));
+ return MDP(exp->exp_obd, init_ea_size)(exp, easize, def_asize,
+ cookiesize);
}
static inline int md_get_remote_perm(struct obd_export *exp,
{
EXP_CHECK_MD_OP(exp, get_remote_perm);
EXP_MD_COUNTER_INCREMENT(exp, get_remote_perm);
- RETURN(MDP(exp->exp_obd, get_remote_perm)(exp, fid, oc, suppgid,
- request));
+ return MDP(exp->exp_obd, get_remote_perm)(exp, fid, oc, suppgid,
+ request);
}
static inline int md_renew_capa(struct obd_export *exp, struct obd_capa *ocapa,
EXP_CHECK_MD_OP(exp, renew_capa);
EXP_MD_COUNTER_INCREMENT(exp, renew_capa);
rc = MDP(exp->exp_obd, renew_capa)(exp, ocapa, cb);
- RETURN(rc);
+ return rc;
}
static inline int md_unpack_capa(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, unpack_capa);
EXP_MD_COUNTER_INCREMENT(exp, unpack_capa);
rc = MDP(exp->exp_obd, unpack_capa)(exp, req, field, oc);
- RETURN(rc);
+ return rc;
}
static inline int md_intent_getattr_async(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, intent_getattr_async);
EXP_MD_COUNTER_INCREMENT(exp, intent_getattr_async);
rc = MDP(exp->exp_obd, intent_getattr_async)(exp, minfo, einfo);
- RETURN(rc);
+ return rc;
}
static inline int md_revalidate_lock(struct obd_export *exp,
EXP_CHECK_MD_OP(exp, revalidate_lock);
EXP_MD_COUNTER_INCREMENT(exp, revalidate_lock);
rc = MDP(exp->exp_obd, revalidate_lock)(exp, it, fid, bits);
- RETURN(rc);
+ return rc;
}
cio->cui_glimpse = 0;
if (lock == NULL)
- RETURN(0);
+ return 0;
if (IS_ERR(lock))
- RETURN(PTR_ERR(lock));
+ return PTR_ERR(lock);
LASSERT(agl == 0);
result = cl_wait(env, lock);
}
}
- RETURN(result);
+ return result;
}
static int cl_io_get(struct inode *inode, struct lu_env **envout,
goto again;
cl_env_put(env, &refcheck);
}
- RETURN(result);
+ return result;
}
int cl_local_size(struct inode *inode)
int refcheck;
if (!cl_i2info(inode)->lli_has_smd)
- RETURN(0);
+ return 0;
result = cl_io_get(inode, &env, &io, &refcheck);
if (result <= 0)
- RETURN(result);
+ return result;
clob = io->ci_obj;
result = cl_io_init(env, io, CIT_MISC, clob);
}
cl_io_fini(env, io);
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
lu_device_get(next);
lu_ref_add(&next->ld_reference, "lu-stack", &lu_site_init);
}
- RETURN(rc);
+ return rc;
}
struct lu_device *ccc_device_fini(const struct lu_env *env,
OBD_ALLOC_PTR(vdv);
if (vdv == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
lud = &vdv->cdv_cl.cd_lu_dev;
cl_device_init(&vdv->cdv_cl, t);
ccc_device_free(env, lud);
lud = ERR_PTR(rc);
}
- RETURN(lud);
+ return lud;
}
struct lu_device *ccc_device_free(const struct lu_env *env,
*/
if (lvb->lvb_size > 0 && lvb->lvb_blocks == 0)
lvb->lvb_blocks = dirty_cnt(inode);
- RETURN(0);
+ return 0;
}
}
} else
result = 0;
- RETURN(result);
+ return result;
}
int ccc_fail(const struct lu_env *env, const struct cl_page_slice *slice)
struct cl_io *unused)
{
/* transient page should always be sent. */
- RETURN(0);
+ return 0;
}
/*****************************************************************************
result = lock->cll_state >= CLS_ENQUEUED;
else
result = 1;
- RETURN(result);
+ return result;
}
/**
descr->cld_enq_flags = enqflags;
cl_io_lock_add(env, io, &cio->cui_link);
- RETURN(0);
+ return 0;
}
void ccc_io_update_iov(const struct lu_env *env,
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
io = ccc_env_thread_io(env);
io->ci_obj = cl_i2info(inode)->lli_clob;
if (unlikely(io->ci_need_restart))
goto again;
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
/*****************************************************************************
__u64 cl_fid_build_ino(const struct lu_fid *fid, int api32)
{
if (BITS_PER_LONG == 32 || api32)
- RETURN(fid_flatten32(fid));
+ return fid_flatten32(fid);
else
- RETURN(fid_flatten(fid));
+ return fid_flatten(fid);
}
/**
if (fid_is_igif(fid)) {
gen = lu_igif_gen(fid);
- RETURN(gen);
+ return gen;
}
gen = (fid_flatten(fid) >> 32);
- RETURN(gen);
+ return gen;
}
/* lsm is unreliable after hsm implementation as layout can be changed at
rc = obd_get_info(NULL, dt_exp, sizeof(KEY_LOVDESC), KEY_LOVDESC,
&valsize, &desc, NULL);
if (rc)
- RETURN(rc);
+ return rc;
stripes = min(desc.ld_tgt_count, (__u32)LOV_MAX_STRIPE_COUNT);
lsm.lsm_stripe_count = stripes;
easize, cookiesize);
rc = md_init_ea_size(md_exp, easize, def_easize, cookiesize);
- RETURN(rc);
+ return rc;
}
/**
watched->obd_name);
result = -EINVAL;
}
- RETURN(result);
+ return result;
}
#define GROUPLOCK_SCOPE "grouplock"
static struct interval_node *interval_first(struct interval_node *node)
{
if (!node)
- RETURN(NULL);
+ return NULL;
while (node->in_left)
node = node->in_left;
- RETURN(node);
+ return node;
}
static struct interval_node *interval_last(struct interval_node *node)
{
if (!node)
- RETURN(NULL);
+ return NULL;
while (node->in_right)
node = node->in_right;
- RETURN(node);
+ return node;
}
static struct interval_node *interval_next(struct interval_node *node)
{
if (!node)
- RETURN(NULL);
+ return NULL;
if (node->in_right)
- RETURN(interval_first(node->in_right));
+ return interval_first(node->in_right);
while (node->in_parent && node_is_right_child(node))
node = node->in_parent;
- RETURN(node->in_parent);
+ return node->in_parent;
}
static struct interval_node *interval_prev(struct interval_node *node)
{
if (!node)
- RETURN(NULL);
+ return NULL;
if (node->in_left)
- RETURN(interval_last(node->in_left));
+ return interval_last(node->in_left);
while (node->in_parent && node_is_left_child(node))
node = node->in_parent;
- RETURN(node->in_parent);
+ return node->in_parent;
}
enum interval_iter interval_iterate(struct interval_node *root,
break;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(interval_iterate);
break;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(interval_iterate_reverse);
walk = walk->in_right;
}
- RETURN(walk);
+ return walk;
}
EXPORT_SYMBOL(interval_find);
while (*p) {
parent = *p;
if (node_equal(parent, node))
- RETURN(parent);
+ return parent;
/* max_high field must be updated after each iteration */
if (parent->in_max_high < interval_high(node))
interval_insert_color(node, root);
node->in_intree = 1;
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(interval_insert);
continue;
if (lck->l_policy_data.l_extent.end >= old_kms)
- RETURN(old_kms);
+ return old_kms;
/* This extent _has_ to be smaller than old_kms (checked above)
* so kms can only ever be smaller or the same as old_kms. */
}
LASSERTF(kms <= old_kms, "kms "LPU64" old_kms "LPU64"\n", kms, old_kms);
- RETURN(kms);
+ return kms;
}
EXPORT_SYMBOL(ldlm_extent_shift_kms);
LASSERT(lock->l_resource->lr_type == LDLM_EXTENT);
OBD_SLAB_ALLOC_PTR_GFP(node, ldlm_interval_slab, __GFP_IO);
if (node == NULL)
- RETURN(NULL);
+ return NULL;
INIT_LIST_HEAD(&node->li_group);
ldlm_interval_attach(node, lock);
- RETURN(node);
+ return node;
}
void ldlm_interval_free(struct ldlm_interval *node)
continue;
if (!first_enq)
- RETURN(LDLM_ITER_CONTINUE);
+ return LDLM_ITER_CONTINUE;
if (*flags & LDLM_FL_BLOCK_NOWAIT) {
ldlm_flock_destroy(req, mode, *flags);
*err = -EAGAIN;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
if (*flags & LDLM_FL_TEST_LOCK) {
req->l_policy_data.l_flock.end =
lock->l_policy_data.l_flock.end;
*flags |= LDLM_FL_LOCK_CHANGED;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
/* add lock to blocking list before deadlock
if (rc) {
ldlm_flock_destroy(req, mode, *flags);
*err = rc;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
if (ldlm_flock_deadlock(req, lock)) {
ldlm_flock_blocking_unlink(req);
ldlm_flock_destroy(req, mode, *flags);
*err = -EDEADLK;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
ldlm_resource_add_lock(res, &res->lr_waiting, req);
*flags |= LDLM_FL_BLOCK_GRANTED;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
}
ldlm_flock_destroy(req, mode, *flags);
req->l_req_mode = LCK_NL;
*flags |= LDLM_FL_LOCK_CHANGED;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
/* In case we had slept on this lock request take it off of the
ldlm_flock_destroy(req, lock->l_granted_mode,
*flags);
*err = -ENOLCK;
- RETURN(LDLM_ITER_STOP);
+ return LDLM_ITER_STOP;
}
goto reprocess;
}
ldlm_flock_destroy(req, mode, *flags);
ldlm_resource_dump(D_INFO, res);
- RETURN(LDLM_ITER_CONTINUE);
+ return LDLM_ITER_CONTINUE;
}
struct ldlm_flock_wait_data {
/* Need to wake up the waiter if we were evicted */
wake_up(&lock->l_waitq);
- RETURN(0);
+ return 0;
}
LASSERT(flags != LDLM_FL_WAIT_NOREPROC);
goto granted;
/* CP AST RPC: lock get granted, wake it up */
wake_up(&lock->l_waitq);
- RETURN(0);
+ return 0;
}
LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, "
if (rc) {
LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)",
rc);
- RETURN(rc);
+ return rc;
}
granted:
if (lock->l_flags & LDLM_FL_DESTROYED) {
LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed");
- RETURN(0);
+ return 0;
}
if (lock->l_flags & LDLM_FL_FAILED) {
LDLM_DEBUG(lock, "client-side enqueue waking up: failed");
- RETURN(-EIO);
+ return -EIO;
}
if (rc) {
LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)",
rc);
- RETURN(rc);
+ return rc;
}
LDLM_DEBUG(lock, "client-side enqueue granted");
ldlm_process_flock_lock(lock, &noreproc, 1, &err, NULL);
}
unlock_res_and_lock(lock);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_flock_completion_ast);
lock_res_and_lock(lock);
ldlm_flock_blocking_unlink(lock);
unlock_res_and_lock(lock);
- RETURN(0);
+ return 0;
}
void ldlm_flock_policy_wire18_to_local(const ldlm_wire_policy_data_t *wpolicy,
&ldlm_export_flock_ops,
CFS_HASH_DEFAULT | CFS_HASH_NBLK_CHANGE);
if (!exp->exp_flock_hash)
- RETURN(-ENOMEM);
+ return -ENOMEM;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_init_flock_export);
if (!create && !priority) {
CDEBUG(D_HA, "Nothing to do\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
ptlrpc_conn = ptlrpc_uuid_to_connection(uuid);
if (!ptlrpc_conn) {
CDEBUG(D_HA, "can't find connection %s\n", uuid->uuid);
- RETURN (-ENOENT);
+ return -ENOENT;
}
if (create) {
}
spin_unlock(&imp->imp_lock);
- RETURN(0);
+ return 0;
out_free:
if (imp_conn)
OBD_FREE(imp_conn, sizeof(*imp_conn));
out_put:
ptlrpc_connection_put(ptlrpc_conn);
- RETURN(rc);
+ return rc;
}
int import_set_conn_priority(struct obd_import *imp, struct obd_uuid *uuid)
spin_unlock(&imp->imp_lock);
if (rc == -ENOENT)
CERROR("connection %s not found\n", uuid->uuid);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(client_import_del_conn);
}
}
spin_unlock(&imp->imp_lock);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(client_import_find_conn);
} else {
CERROR("unknown client OBD type \"%s\", can't setup\n",
name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("requires a TARGET UUID\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (LUSTRE_CFG_BUFLEN(lcfg, 1) > 37) {
CERROR("client UUID must be less than 38 characters\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (LUSTRE_CFG_BUFLEN(lcfg, 2) < 1) {
CERROR("setup requires a SERVER UUID\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (LUSTRE_CFG_BUFLEN(lcfg, 2) > 37) {
CERROR("target UUID must be less than 38 characters\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
init_rwsem(&cli->cl_sem);
cli->cl_qchk_stat = CL_NOT_QUOTACHECKED;
- RETURN(rc);
+ return rc;
err_import:
class_destroy_import(imp);
err_ldlm:
ldlm_put_ref();
err:
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(client_obd_setup);
LASSERT(obddev->u.cli.cl_import == NULL);
ldlm_put_ref();
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(client_obd_cleanup);
if (!obd) {
CERROR("invalid export for disconnect: exp %p cookie "LPX64"\n",
exp, exp ? exp->exp_handle.h_cookie : -1);
- RETURN(-EINVAL);
+ return -EINVAL;
}
cli = &obd->u.cli;
up_write(&cli->cl_sem);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(client_disconnect_export);
!exp_connect_lru_resize(req->rq_export))) {
lustre_msg_set_slv(req->rq_repmsg, 0);
lustre_msg_set_limit(req->rq_repmsg, 0);
- RETURN(0);
+ return 0;
}
/* OBD is alive here as export is alive, which we checked above. */
lustre_msg_set_limit(req->rq_repmsg, obd->obd_pool_limit);
read_unlock(&obd->obd_pool_lock);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(target_pack_pool_reply);
if (lock->l_flags & LDLM_FL_NS_SRV) {
LASSERT(list_empty(&lock->l_lru));
- RETURN(0);
+ return 0;
}
spin_lock(&ns->ns_lock);
OBD_SLAB_ALLOC_PTR_GFP(lock, ldlm_lock_slab, __GFP_IO);
if (lock == NULL)
- RETURN(NULL);
+ return NULL;
spin_lock_init(&lock->l_lock);
lock->l_resource = resource;
#endif
INIT_LIST_HEAD(&lock->l_exp_list);
- RETURN(lock);
+ return lock;
}
/**
sizeof(lock->l_resource->lr_name)) == 0) {
/* Nothing to do */
unlock_res_and_lock(lock);
- RETURN(0);
+ return 0;
}
LASSERT(new_resid->name[0] != 0);
newres = ldlm_resource_get(ns, NULL, new_resid, type, 1);
if (newres == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lu_ref_add(&newres->lr_reference, "lock", lock);
/*
lu_ref_del(&oldres->lr_reference, "lock", lock);
ldlm_resource_putref(oldres);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_lock_change_resource);
lock = class_handle2object(handle->cookie);
if (lock == NULL)
- RETURN(NULL);
+ return NULL;
/* It's unlikely but possible that someone marked the lock as
* destroyed after we did handle2object on it */
if (flags == 0 && ((lock->l_flags & LDLM_FL_DESTROYED)== 0)) {
lu_ref_add(&lock->l_reference, "handle", current);
- RETURN(lock);
+ return lock;
}
lock_res_and_lock(lock);
unlock_res_and_lock(lock);
CDEBUG(D_INFO, "lock already destroyed: lock %p\n", lock);
LDLM_LOCK_PUT(lock);
- RETURN(NULL);
+ return NULL;
}
if (flags && (lock->l_flags & flags)) {
unlock_res_and_lock(lock);
LDLM_LOCK_PUT(lock);
- RETURN(NULL);
+ return NULL;
}
if (flags)
lock->l_flags |= flags;
unlock_res_and_lock(lock);
- RETURN(lock);
+ return lock;
}
EXPORT_SYMBOL(__ldlm_handle2lock);
/** @} ldlm_handles */
res = ldlm_resource_get(ns, NULL, res_id, type, 0);
if (res == NULL) {
LASSERT(old_lock == NULL);
- RETURN(0);
+ return 0;
}
LDLM_RESOURCE_ADDREF(res);
lustre_swab_ost_lvb);
if (unlikely(lvb == NULL)) {
LDLM_ERROR(lock, "no LVB");
- RETURN(-EPROTO);
+ return -EPROTO;
}
memcpy(data, lvb, size);
lustre_swab_ost_lvb_v1);
if (unlikely(lvb == NULL)) {
LDLM_ERROR(lock, "no LVB");
- RETURN(-EPROTO);
+ return -EPROTO;
}
memcpy(data, lvb, size);
} else {
LDLM_ERROR(lock, "Replied unexpected ost LVB size %d",
size);
- RETURN(-EINVAL);
+ return -EINVAL;
}
break;
case LVB_T_LQUOTA:
lustre_swab_lquota_lvb);
if (unlikely(lvb == NULL)) {
LDLM_ERROR(lock, "no LVB");
- RETURN(-EPROTO);
+ return -EPROTO;
}
memcpy(data, lvb, size);
} else {
LDLM_ERROR(lock, "Replied unexpected lquota LVB size %d",
size);
- RETURN(-EINVAL);
+ return -EINVAL;
}
break;
case LVB_T_LAYOUT:
lvb = req_capsule_server_get(pill, &RMF_DLM_LVB);
if (unlikely(lvb == NULL)) {
LDLM_ERROR(lock, "no LVB");
- RETURN(-EPROTO);
+ return -EPROTO;
}
memcpy(data, lvb, size);
default:
LDLM_ERROR(lock, "Unknown LVB type: %d\n", lock->l_lvb_type);
dump_stack();
- RETURN(-EINVAL);
+ return -EINVAL;
}
- RETURN(0);
+ return 0;
}
/**
res = ldlm_resource_get(ns, NULL, res_id, type, 1);
if (res == NULL)
- RETURN(NULL);
+ return NULL;
lock = ldlm_lock_new(res);
if (lock == NULL)
- RETURN(NULL);
+ return NULL;
lock->l_req_mode = mode;
lock->l_ast_data = data;
if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_NEW_LOCK))
GOTO(out, 0);
- RETURN(lock);
+ return lock;
out:
ldlm_lock_destroy(lock);
LDLM_LOCK_RELEASE(lock);
}
*flags |= LDLM_FL_LOCK_CHANGED;
- RETURN(0);
+ return 0;
} else if (rc != ELDLM_OK ||
(rc == ELDLM_OK && (*flags & LDLM_FL_INTENT_ONLY))) {
ldlm_lock_destroy(lock);
- RETURN(rc);
+ return rc;
}
}
struct ldlm_lock *lock;
if (list_empty(arg->list))
- RETURN(-ENOENT);
+ return -ENOENT;
lock = list_entry(arg->list->next, struct ldlm_lock, l_bl_ast);
lock->l_blocking_lock = NULL;
LDLM_LOCK_RELEASE(lock);
- RETURN(rc);
+ return rc;
}
/**
ldlm_completion_callback completion_callback;
if (list_empty(arg->list))
- RETURN(-ENOENT);
+ return -ENOENT;
lock = list_entry(arg->list->next, struct ldlm_lock, l_cp_ast);
rc = completion_callback(lock, 0, (void *)arg);
LDLM_LOCK_RELEASE(lock);
- RETURN(rc);
+ return rc;
}
/**
struct ldlm_lock *lock;
if (list_empty(arg->list))
- RETURN(-ENOENT);
+ return -ENOENT;
lock = list_entry(arg->list->next, struct ldlm_lock, l_rk_ast);
list_del_init(&lock->l_rk_ast);
rc = lock->l_blocking_ast(lock, &desc, (void*)arg, LDLM_CB_BLOCKING);
LDLM_LOCK_RELEASE(lock);
- RETURN(rc);
+ return rc;
}
/**
int rc = 0;
if (list_empty(arg->list))
- RETURN(-ENOENT);
+ return -ENOENT;
gl_work = list_entry(arg->list->next, struct ldlm_glimpse_work,
gl_list);
if ((gl_work->gl_flags & LDLM_GL_WORK_NOFREE) == 0)
OBD_FREE_PTR(gl_work);
- RETURN(rc);
+ return rc;
}
/**
int rc;
if (list_empty(rpc_list))
- RETURN(0);
+ return 0;
OBD_ALLOC_PTR(arg);
if (arg == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
atomic_set(&arg->restart, 0);
arg->list = rpc_list;
rc = 0;
LDLM_LOCK_PUT(lock);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_lock_set_data);
/* Just return if mode is unchanged. */
if (new_mode == lock->l_granted_mode) {
*flags |= LDLM_FL_BLOCK_GRANTED;
- RETURN(lock->l_resource);
+ return lock->l_resource;
}
/* I can't check the type of lock here because the bitlock of lock
OBD_SLAB_ALLOC_PTR_GFP(node, ldlm_interval_slab, __GFP_IO);
if (node == NULL)
/* Actually, this causes EDEADLOCK to be returned */
- RETURN(NULL);
+ return NULL;
LASSERTF((new_mode == LCK_PW && lock->l_granted_mode == LCK_PR),
"new_mode %u, granted %u\n", new_mode, lock->l_granted_mode);
ldlm_run_ast_work(ns, &rpc_list, LDLM_WORK_CP_AST);
if (node)
OBD_SLAB_FREE(node, ldlm_interval_slab, sizeof(*node));
- RETURN(res);
+ return res;
}
EXPORT_SYMBOL(ldlm_lock_convert);
int ldlm_del_waiting_lock(struct ldlm_lock *lock)
{
- RETURN(0);
+ return 0;
}
int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout)
{
- RETURN(0);
+ return 0;
}
if (!(cancel_flags & LCF_ASYNC))
wait_for_completion(&blwi->blwi_comp);
- RETURN(0);
+ return 0;
}
static inline void init_blwi(struct ldlm_bl_work_item *blwi,
ldlm_cancel_flags_t cancel_flags)
{
if (cancels && count == 0)
- RETURN(0);
+ return 0;
if (cancel_flags & LCF_ASYNC) {
struct ldlm_bl_work_item *blwi;
OBD_ALLOC(blwi, sizeof(*blwi));
if (blwi == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
init_blwi(blwi, ns, ld, cancels, count, lock, cancel_flags);
- RETURN(__ldlm_bl_to_thread(blwi, cancel_flags));
+ return __ldlm_bl_to_thread(blwi, cancel_flags);
} else {
/* if it is synchronous call do minimum mem alloc, as it could
* be triggered from kernel shrinker
memset(&blwi, 0, sizeof(blwi));
init_blwi(&blwi, ns, ld, cancels, count, lock, cancel_flags);
- RETURN(__ldlm_bl_to_thread(&blwi, cancel_flags));
+ return __ldlm_bl_to_thread(&blwi, cancel_flags);
}
}
key = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY);
if (key == NULL) {
DEBUG_REQ(D_IOCTL, req, "no set_info key");
- RETURN(-EFAULT);
+ return -EFAULT;
}
keylen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_KEY,
RCL_CLIENT);
val = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_VAL);
if (val == NULL) {
DEBUG_REQ(D_IOCTL, req, "no set_info val");
- RETURN(-EFAULT);
+ return -EFAULT;
}
vallen = req_capsule_get_size(&req->rq_pill, &RMF_SETINFO_VAL,
RCL_CLIENT);
oqctl = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
if (oqctl == NULL) {
CERROR("Can't unpack obd_quotactl\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
oqctl->qc_stat = ptlrpc_status_ntoh(oqctl->qc_stat);
/* do nothing for sec context finalize */
if (lustre_msg_get_opc(req->rq_reqmsg) == SEC_CTX_FINI)
- RETURN(0);
+ return 0;
req_capsule_init(&req->rq_pill, req, RCL_SERVER);
rc = ldlm_callback_reply(req, -ENOTCONN);
ldlm_callback_errmsg(req, "Operate on unconnected server",
rc, NULL);
- RETURN(0);
+ return 0;
}
LASSERT(req->rq_export != NULL);
switch (lustre_msg_get_opc(req->rq_reqmsg)) {
case LDLM_BL_CALLBACK:
if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_BL_CALLBACK_NET))
- RETURN(0);
+ return 0;
break;
case LDLM_CP_CALLBACK:
if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_CP_CALLBACK_NET))
- RETURN(0);
+ return 0;
break;
case LDLM_GL_CALLBACK:
if (OBD_FAIL_CHECK(OBD_FAIL_LDLM_GL_CALLBACK_NET))
- RETURN(0);
+ return 0;
break;
case LDLM_SET_INFO:
rc = ldlm_handle_setinfo(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case OBD_LOG_CANCEL: /* remove this eventually - for 1.4.0 compat */
CERROR("shouldn't be handling OBD_LOG_CANCEL on DLM thread\n");
req_capsule_set(&req->rq_pill, &RQF_LOG_CANCEL);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_NET))
- RETURN(0);
+ return 0;
rc = llog_origin_handle_cancel(req);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOG_CANCEL_REP))
- RETURN(0);
+ return 0;
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case LLOG_ORIGIN_HANDLE_CREATE:
req_capsule_set(&req->rq_pill, &RQF_LLOG_ORIGIN_HANDLE_CREATE);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
- RETURN(0);
+ return 0;
rc = llog_origin_handle_open(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case LLOG_ORIGIN_HANDLE_NEXT_BLOCK:
req_capsule_set(&req->rq_pill,
&RQF_LLOG_ORIGIN_HANDLE_NEXT_BLOCK);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
- RETURN(0);
+ return 0;
rc = llog_origin_handle_next_block(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case LLOG_ORIGIN_HANDLE_READ_HEADER:
req_capsule_set(&req->rq_pill,
&RQF_LLOG_ORIGIN_HANDLE_READ_HEADER);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
- RETURN(0);
+ return 0;
rc = llog_origin_handle_read_header(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case LLOG_ORIGIN_HANDLE_CLOSE:
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_LOGD_NET))
- RETURN(0);
+ return 0;
rc = llog_origin_handle_close(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
case OBD_QC_CALLBACK:
req_capsule_set(&req->rq_pill, &RQF_QC_CALLBACK);
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_QC_CALLBACK_NET))
- RETURN(0);
+ return 0;
rc = ldlm_handle_qc_callback(req);
ldlm_callback_reply(req, rc);
- RETURN(0);
+ return 0;
default:
CERROR("unknown opcode %u\n",
lustre_msg_get_opc(req->rq_reqmsg));
ldlm_callback_reply(req, -EPROTO);
- RETURN(0);
+ return 0;
}
ns = req->rq_export->exp_obd->obd_namespace;
rc = ldlm_callback_reply(req, -EPROTO);
ldlm_callback_errmsg(req, "Operate without parameter", rc,
NULL);
- RETURN(0);
+ return 0;
}
/* Force a known safe race, send a cancel to the server for a lock
rc = ldlm_callback_reply(req, -EINVAL);
ldlm_callback_errmsg(req, "Operate with invalid parameter", rc,
&dlm_req->lock_handle[0]);
- RETURN(0);
+ return 0;
}
if ((lock->l_flags & LDLM_FL_FAIL_LOC) &&
rc = ldlm_callback_reply(req, -EINVAL);
ldlm_callback_errmsg(req, "Operate on stale lock", rc,
&dlm_req->lock_handle[0]);
- RETURN(0);
+ return 0;
}
/* BL_AST locks are not needed in LRU.
* Let ldlm_cancel_lru() be fast. */
LBUG(); /* checked above */
}
- RETURN(0);
+ return 0;
}
atomic_dec(&blp->blp_busy_threads);
atomic_dec(&blp->blp_num_threads);
complete(&blp->blp_comp);
- RETURN(0);
+ return 0;
}
}
mutex_unlock(&ldlm_ref_mutex);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_get_ref);
CFS_HASH_NBLK_CHANGE);
if (!exp->exp_lock_hash)
- RETURN(-ENOMEM);
+ return -ENOMEM;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_init_export);
int i;
if (ldlm_state != NULL)
- RETURN(-EALREADY);
+ return -EALREADY;
OBD_ALLOC(ldlm_state, sizeof(*ldlm_state));
if (ldlm_state == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
#ifdef LPROCFS
rc = ldlm_proc_setup();
CERROR("Failed to initialize LDLM pools: %d\n", rc);
GOTO(out, rc);
}
- RETURN(0);
+ return 0;
out:
ldlm_cleanup();
- RETURN(rc);
+ return rc;
}
static int ldlm_cleanup(void)
CERROR("ldlm still has namespaces; clean these up first.\n");
ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
ldlm_dump_all_namespaces(LDLM_NAMESPACE_CLIENT, D_DLMTRACE);
- RETURN(-EBUSY);
+ return -EBUSY;
}
ldlm_pools_fini();
OBD_FREE(ldlm_state, sizeof(*ldlm_state));
ldlm_state = NULL;
- RETURN(0);
+ return 0;
}
int ldlm_init(void)
recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
if (recalc_interval_sec < pl->pl_recalc_period)
- RETURN(0);
+ return 0;
spin_lock(&pl->pl_lock);
recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
if (recalc_interval_sec < pl->pl_recalc_period) {
spin_unlock(&pl->pl_lock);
- RETURN(0);
+ return 0;
}
/*
* Recalc SLV after last period. This should be done
lprocfs_counter_add(pl->pl_stats, LDLM_POOL_TIMING_STAT,
recalc_interval_sec);
spin_unlock(&pl->pl_lock);
- RETURN(0);
+ return 0;
}
/**
* and can't cancel anything. Let's catch this race.
*/
if (atomic_read(&pl->pl_granted) == 0)
- RETURN(0);
+ return 0;
spin_lock(&pl->pl_lock);
recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
if (recalc_interval_sec < pl->pl_recalc_period)
- RETURN(0);
+ return 0;
spin_lock(&pl->pl_lock);
/*
recalc_interval_sec = cfs_time_current_sec() - pl->pl_recalc_time;
if (recalc_interval_sec < pl->pl_recalc_period) {
spin_unlock(&pl->pl_lock);
- RETURN(0);
+ return 0;
}
/*
* Do not cancel locks in case lru resize is disabled for this ns.
*/
if (!ns_connect_lru_resize(ldlm_pl2ns(pl)))
- RETURN(0);
+ return 0;
/*
* In the time of canceling locks on client we do not need to maintain
* It may be called when SLV has changed much, this is why we do not
* take into account pl->pl_recalc_time here.
*/
- RETURN(ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LCF_ASYNC,
- LDLM_CANCEL_LRUR));
+ return ldlm_cancel_lru(ldlm_pl2ns(pl), 0, LCF_ASYNC, LDLM_CANCEL_LRUR);
}
/**
* Do not cancel locks in case lru resize is disabled for this ns.
*/
if (!ns_connect_lru_resize(ns))
- RETURN(0);
+ return 0;
/*
* Make sure that pool knows last SLV and Limit from obd.
OBD_ALLOC(var_name, MAX_STRING_SIZE + 1);
if (!var_name)
- RETURN(-ENOMEM);
+ return -ENOMEM;
parent_ns_proc = ns->ns_proc_dir_entry;
if (parent_ns_proc == NULL) {
pl->pl_client_lock_volume = 0;
rc = ldlm_pool_proc_init(pl);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_DLMTRACE, "Lock pool %s is initialized\n", pl->pl_name);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_pool_init);
task_t *task;
if (ldlm_pools_thread != NULL)
- RETURN(-EALREADY);
+ return -EALREADY;
OBD_ALLOC_PTR(ldlm_pools_thread);
if (ldlm_pools_thread == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
init_completion(&ldlm_pools_comp);
init_waitqueue_head(&ldlm_pools_thread->t_ctl_waitq);
CERROR("Can't start pool thread, error %ld\n", PTR_ERR(task));
OBD_FREE(ldlm_pools_thread, sizeof(*ldlm_pools_thread));
ldlm_pools_thread = NULL;
- RETURN(PTR_ERR(task));
+ return PTR_ERR(task);
}
l_wait_event(ldlm_pools_thread->t_ctl_waitq,
thread_is_running(ldlm_pools_thread), &lwi);
- RETURN(0);
+ return 0;
}
static void ldlm_pools_thread_stop(void)
set_shrinker(DEFAULT_SEEKS,
ldlm_pools_cli_shrink);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_pools_init);
static cfs_time_t next_dump = 0, last_dump = 0;
if (ptlrpc_check_suspend())
- RETURN(0);
+ return 0;
LCONSOLE_WARN("lock timed out (enqueued at "CFS_TIME_T", "
CFS_DURATION_T"s ago)\n",
if (last_dump == 0)
libcfs_debug_dumplog();
}
- RETURN(0);
+ return 0;
}
obd = lock->l_conn_export->exp_obd;
cfs_time_sub(cfs_time_current_sec(), lock->l_last_activity),
obd2cli_tgt(obd), imp->imp_connection->c_remote_uuid.uuid);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_expired_completion_wait);
{
if (flags == LDLM_FL_WAIT_NOREPROC) {
LDLM_DEBUG(lock, "client-side enqueue waiting on pending lock");
- RETURN(0);
+ return 0;
}
if (!(flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED |
LDLM_FL_BLOCK_CONV))) {
wake_up(&lock->l_waitq);
- RETURN(ldlm_completion_tail(lock));
+ return ldlm_completion_tail(lock);
}
LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, "
"going forward");
ldlm_reprocess_all(lock->l_resource);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_completion_ast_async);
if (!(flags & (LDLM_FL_BLOCK_WAIT | LDLM_FL_BLOCK_GRANTED |
LDLM_FL_BLOCK_CONV))) {
wake_up(&lock->l_waitq);
- RETURN(0);
+ return 0;
}
LDLM_DEBUG(lock, "client-side enqueue returned a blocked lock, "
if (rc) {
LDLM_DEBUG(lock, "client-side enqueue waking up: failed (%d)",
rc);
- RETURN(rc);
+ return rc;
}
- RETURN(ldlm_completion_tail(lock));
+ return ldlm_completion_tail(lock);
}
EXPORT_SYMBOL(ldlm_completion_ast);
LDLM_DEBUG(lock, "Lock still has references, will be "
"cancelled later");
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_blocking_ast_nocheck);
{
if (flag == LDLM_CB_CANCELING) {
/* Don't need to do anything here. */
- RETURN(0);
+ return 0;
}
lock_res_and_lock(lock);
* early, if so. */
if (lock->l_blocking_ast != ldlm_blocking_ast) {
unlock_res_and_lock(lock);
- RETURN(0);
+ return 0;
}
- RETURN(ldlm_blocking_ast_nocheck(lock));
+ return ldlm_blocking_ast_nocheck(lock);
}
EXPORT_SYMBOL(ldlm_blocking_ast);
/* ldlm_cli_enqueue is holding a reference on this lock. */
if (!lock) {
LASSERT(type == LDLM_FLOCK);
- RETURN(-ENOLCK);
+ return -ENOLCK;
}
LASSERTF(ergo(lvb_len != 0, lvb_len == lock->l_lvb_len),
rc = ptlrpc_request_pack(req, version, opc);
if (rc) {
ldlm_lock_list_put(cancels, l_bl_ast, count);
- RETURN(rc);
+ return rc;
}
if (ns_connect_cancelset(ns)) {
} else {
ldlm_lock_list_put(cancels, l_bl_ast, count);
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_prep_elc_req);
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_ENQUEUE);
if (req == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, lvb_len);
ptlrpc_request_set_replen(req);
- RETURN(req);
+ return req;
}
EXPORT_SYMBOL(ldlm_enqueue_pack);
einfo->ei_mode, &cbs, einfo->ei_cbdata,
lvb_len, lvb_type);
if (lock == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* for the local lock, add the reference */
ldlm_lock_addref_internal(lock, einfo->ei_mode);
ldlm_lock2handle(lock, lockh);
if (req == NULL) {
failed_lock_cleanup(ns, lock, einfo->ei_mode);
LDLM_LOCK_RELEASE(lock);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
req_passed_in = 0;
if (reqp)
if (async) {
LASSERT(reqp != NULL);
- RETURN(0);
+ return 0;
}
LDLM_DEBUG(lock, "sending request");
*reqp = NULL;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_cli_enqueue);
}
LDLM_DEBUG(lock, "client-side local convert handler END");
LDLM_LOCK_PUT(lock);
- RETURN(rc);
+ return rc;
}
/* FIXME: one of ldlm_cli_convert or the server side should reject attempted
lock = ldlm_handle2lock(lockh);
if (!lock) {
LBUG();
- RETURN(-EINVAL);
+ return -EINVAL;
}
*flags = 0;
if (lock->l_conn_export == NULL)
- RETURN(ldlm_cli_convert_local(lock, new_mode, flags));
+ return ldlm_cli_convert_local(lock, new_mode, flags);
LDLM_DEBUG(lock, "client-side convert");
LDLM_CONVERT);
if (req == NULL) {
LDLM_LOCK_PUT(lock);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
body = req_capsule_client_get(&req->rq_pill, &RMF_DLM_REQ);
ldlm_reprocess_all(lock->l_resource);
}
- RETURN(rc);
+ return rc;
}
/**
CFS_FAIL_TIMEOUT(OBD_FAIL_LDLM_PAUSE_CANCEL, cfs_fail_val);
if (CFS_FAIL_CHECK(OBD_FAIL_LDLM_CANCEL_RACE))
- RETURN(count);
+ return count;
free = ldlm_format_handles_avail(class_exp2cliimp(exp),
&RQF_LDLM_CANCEL, RCL_CLIENT, 0);
if (imp == NULL || imp->imp_invalid) {
CDEBUG(D_DLMTRACE,
"skipping cancel on invalid import %p\n", imp);
- RETURN(count);
+ return count;
}
req = ptlrpc_request_alloc(imp, &RQF_LDLM_CANCEL);
/*
* Do nothing for corner cases.
*/
- RETURN(0);
+ return 0;
}
/* In some cases RPC may contain SLV and limit zeroed out. This
"(SLV: "LPU64", Limit: %u)",
lustre_msg_get_slv(req->rq_repmsg),
lustre_msg_get_limit(req->rq_repmsg));
- RETURN(0);
+ return 0;
}
new_limit = lustre_msg_get_limit(req->rq_repmsg);
obd->obd_pool_limit = new_limit;
write_unlock(&obd->obd_pool_lock);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_cli_update_pool);
lock = ldlm_handle2lock_long(lockh, LDLM_FL_CANCELING);
if (lock == NULL) {
LDLM_DEBUG_NOLOCK("lock is already being destroyed\n");
- RETURN(0);
+ return 0;
}
rc = ldlm_cli_cancel_local(lock);
if (rc == LDLM_FL_LOCAL_ONLY) {
LDLM_LOCK_RELEASE(lock);
- RETURN(0);
+ return 0;
}
/* Even if the lock is marked as LDLM_FL_BL_AST, this is a LDLM_CANCEL
* RPC which goes to canceld portal, so we can cancel other LRU locks
LCF_BL_AST, flags);
}
ldlm_cli_cancel_list(&cancels, count, NULL, cancel_flags);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_cli_cancel);
ldlm_cli_cancel_list(&head, bl_ast, NULL, 0);
}
- RETURN(count);
+ return count;
}
EXPORT_SYMBOL(ldlm_cli_cancel_list_local);
}
unlock_res_and_lock(lock);
- RETURN(result);
+ return result;
}
/**
unused--;
}
spin_unlock(&ns->ns_lock);
- RETURN(added);
+ return added;
}
int ldlm_cancel_lru_local(struct ldlm_namespace *ns, struct list_head *cancels,
count = ldlm_prepare_lru_list(ns, &cancels, nr, 0, flags);
rc = ldlm_bl_to_thread_list(ns, NULL, &cancels, count, cancel_flags);
if (rc == 0)
- RETURN(count);
+ return count;
- RETURN(0);
+ return 0;
}
/**
}
unlock_res(res);
- RETURN(ldlm_cli_cancel_list_local(cancels, count, cancel_flags));
+ return ldlm_cli_cancel_list_local(cancels, count, cancel_flags);
}
EXPORT_SYMBOL(ldlm_cancel_resource_local);
int res = 0;
if (list_empty(cancels) || count == 0)
- RETURN(0);
+ return 0;
/* XXX: requests (both batched and not) could be sent in parallel.
* Usually it is enough to have just 1 RPC, but it is possible that
ldlm_lock_list_put(cancels, l_bl_ast, res);
}
LASSERT(count == 0);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_cli_cancel_list);
if (res == NULL) {
/* This is not a problem. */
CDEBUG(D_INFO, "No resource "LPU64"\n", res_id->name[0]);
- RETURN(0);
+ return 0;
}
LDLM_RESOURCE_ADDREF(res);
LDLM_RESOURCE_DELREF(res);
ldlm_resource_putref(res);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ldlm_cli_cancel_unused_resource);
};
if (ns == NULL)
- RETURN(ELDLM_OK);
+ return ELDLM_OK;
if (res_id != NULL) {
- RETURN(ldlm_cli_cancel_unused_resource(ns, res_id, NULL,
+ return ldlm_cli_cancel_unused_resource(ns, res_id, NULL,
LCK_MINMODE, flags,
- opaque));
+ opaque);
} else {
cfs_hash_for_each_nolock(ns->ns_rs_hash,
ldlm_cli_hash_cancel_unused, &arg);
- RETURN(ELDLM_OK);
+ return ELDLM_OK;
}
}
EXPORT_SYMBOL(ldlm_cli_cancel_unused);
int rc = LDLM_ITER_CONTINUE;
if (!res)
- RETURN(LDLM_ITER_CONTINUE);
+ return LDLM_ITER_CONTINUE;
lock_res(res);
list_for_each_safe(tmp, next, &res->lr_granted) {
}
out:
unlock_res(res);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_resource_foreach);
res = ldlm_resource_get(ns, NULL, res_id, 0, 0);
if (res == NULL)
- RETURN(0);
+ return 0;
LDLM_RESOURCE_ADDREF(res);
rc = ldlm_resource_foreach(res, iter, data);
LDLM_RESOURCE_DELREF(res);
ldlm_resource_putref(res);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_resource_iterate);
if (rc != ELDLM_OK)
ptlrpc_connect_import(req->rq_import);
- RETURN(rc);
+ return rc;
}
static int replay_one_lock(struct obd_import *imp, struct ldlm_lock *lock)
/* Bug 11974: Do not replay a lock which is actively being canceled */
if (lock->l_flags & LDLM_FL_CANCELING) {
LDLM_DEBUG(lock, "Not replaying canceled lock:");
- RETURN(0);
+ return 0;
}
/* If this is reply-less callback lock, we cannot replay it, since
if (lock->l_flags & LDLM_FL_CANCEL_ON_BLOCK) {
LDLM_DEBUG(lock, "Not replaying reply-less lock:");
ldlm_lock_cancel(lock);
- RETURN(0);
+ return 0;
}
/*
req = ptlrpc_request_alloc_pack(imp, &RQF_LDLM_ENQUEUE,
LUSTRE_DLM_VERSION, LDLM_ENQUEUE);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* We're part of recovery, so don't wait for it. */
req->rq_send_state = LUSTRE_IMP_REPLAY_LOCKS;
req->rq_interpret_reply = (ptlrpc_interpterer_t)replay_lock_interpret;
ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
- RETURN(0);
+ return 0;
}
/**
/* don't replay locks if import failed recovery */
if (imp->imp_vbr_failed)
- RETURN(0);
+ return 0;
/* ensure this doesn't fall to 0 before all have been queued */
atomic_inc(&imp->imp_replay_inflight);
atomic_dec(&imp->imp_replay_inflight);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ldlm_replay_locks);
{
ldlm_dump_all_namespaces(LDLM_NAMESPACE_SERVER, D_DLMTRACE);
ldlm_dump_all_namespaces(LDLM_NAMESPACE_CLIENT, D_DLMTRACE);
- RETURN(count);
+ return count;
}
LPROC_SEQ_FOPS_WR_ONLY(ldlm, dump_ns);
rc = lprocfs_add_vars(ldlm_type_proc_dir, list, NULL);
- RETURN(0);
+ return 0;
err_ns:
lprocfs_remove(&ldlm_ns_proc_dir);
ldlm_svc_proc_dir = NULL;
ldlm_type_proc_dir = NULL;
ldlm_ns_proc_dir = NULL;
- RETURN(rc);
+ return rc;
}
void ldlm_proc_cleanup(void)
rc = ldlm_get_ref();
if (rc) {
CERROR("ldlm_get_ref failed: %d\n", rc);
- RETURN(NULL);
+ return NULL;
}
for (idx = 0;;idx++) {
}
ldlm_namespace_register(ns, client);
- RETURN(ns);
+ return ns;
out_proc:
ldlm_namespace_proc_unregister(ns);
ldlm_namespace_cleanup(ns, 0);
OBD_FREE_PTR(ns);
out_ref:
ldlm_put_ref();
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(ldlm_namespace_new);
"with %d resources in use, (rc=%d)\n",
ldlm_ns_name(ns),
atomic_read(&ns->ns_bref), rc);
- RETURN(ELDLM_NAMESPACE_EXISTS);
+ return ELDLM_NAMESPACE_EXISTS;
}
CDEBUG(D_DLMTRACE, "dlm namespace %s free done waiting\n",
ldlm_ns_name(ns));
}
- RETURN(ELDLM_OK);
+ return ELDLM_OK;
}
/**
EXPORT_SYMBOL(libcfs_debug_set_level);
-long libcfs_log_return(struct libcfs_debug_msg_data *msgdata, long rc)
-{
- libcfs_debug_msg(msgdata, "Process leaving (rc=%lu : %ld : %lx)\n",
- rc, rc, rc);
- return rc;
-}
-EXPORT_SYMBOL(libcfs_log_return);
-
void libcfs_log_goto(struct libcfs_debug_msg_data *msgdata, const char *label,
long_ptr_t rc)
{
CFS_HASH_NAME_LEN : CFS_HASH_BIGNAME_LEN;
LIBCFS_ALLOC(hs, offsetof(cfs_hash_t, hs_name[len]));
if (hs == NULL)
- RETURN(NULL);
+ return NULL;
strncpy(hs->hs_name, name, len);
hs->hs_name[len - 1] = '\0';
return hs;
LIBCFS_FREE(hs, offsetof(cfs_hash_t, hs_name[len]));
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(cfs_hash_create);
cfs_hash_unlock(hs, 0);
cfs_hash_for_each_exit(hs);
- RETURN(count);
+ return count;
}
typedef struct {
if (cfs_hash_with_no_lock(hs) ||
cfs_hash_with_rehash_key(hs) ||
!cfs_hash_with_no_itemref(hs))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (CFS_HOP(hs, get) == NULL ||
(CFS_HOP(hs, put) == NULL &&
CFS_HOP(hs, put_locked) == NULL))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
cfs_hash_for_each_enter(hs);
cfs_hash_for_each_relax(hs, func, data);
cfs_hash_for_each_exit(hs);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(cfs_hash_for_each_nolock);
hs->hs_name, i++);
}
cfs_hash_for_each_exit(hs);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(cfs_hash_for_each_empty);
struct kkuc_reg *reg, *next;
if (kkuc_groups[group].next == NULL)
- RETURN(0);
+ return 0;
if (uid == 0) {
/* Broadcast a shutdown message */
}
up_write(&kg_sem);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(libcfs_kkuc_group_rem);
if (one_success)
rc = 0;
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(libcfs_kkuc_group_put);
if (group > KUC_GRP_MAX) {
CDEBUG(D_WARNING, "Kernelcomm: bad group %d\n", group);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* no link for this group */
if (kkuc_groups[group].next == NULL)
- RETURN(0);
+ return 0;
down_read(&kg_sem);
list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
}
up_read(&kg_sem);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(libcfs_kkuc_group_foreach);
buffer = kmalloc(buf_len, GFP_USER);
if (!buffer)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mm = get_task_mm(current);
if (!mm) {
kfree(buffer);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* Avoid deadlocks on mmap_sem if called from sys_mmap_pgoff(),
err = copy_from_user(buf, (void *)arg, sizeof(*hdr));
if (err)
- RETURN(err);
+ return err;
if (hdr->ioc_version != LIBCFS_IOCTL_VERSION) {
CERROR("PORTALS: version mismatch kernel vs application\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr->ioc_len + buf >= end) {
CERROR("PORTALS: user buffer exceeds kernel buffer\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr->ioc_len < sizeof(struct libcfs_ioctl_data)) {
CERROR("PORTALS: user buffer too small for ioctl\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
err = copy_from_user(buf, (void *)arg, hdr->ioc_len);
if (err)
- RETURN(err);
+ return err;
if (libcfs_ioctl_is_invalid(data)) {
CERROR("PORTALS: ioctl not correctly formatted\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (data->ioc_inllen1)
data->ioc_inlbuf2 = &data->ioc_bulk[0] +
cfs_size_round(data->ioc_inllen1);
- RETURN(0);
+ return 0;
}
int libcfs_ioctl_popdata(void *arg, void *data, int size)
}
*(struct libcfs_device_userstate **)args = ldu;
- RETURN(0);
+ return 0;
}
/* called when closing /dev/device */
}
module_put(THIS_MODULE);
- RETURN(0);
+ return 0;
}
static struct rw_semaphore ioctl_list_sem;
switch (cmd) {
case IOC_LIBCFS_CLEAR_DEBUG:
libcfs_debug_clear_buffer();
- RETURN(0);
+ return 0;
/*
* case IOC_LIBCFS_PANIC:
* Handled in arch/cfs_module.c
case IOC_LIBCFS_MARK_DEBUG:
if (data->ioc_inlbuf1 == NULL ||
data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
libcfs_debug_mark_buffer(data->ioc_inlbuf1);
- RETURN(0);
+ return 0;
#if LWT_SUPPORT
case IOC_LIBCFS_LWT_CONTROL:
err = lwt_control ((data->ioc_flags & 1) != 0,
ping(data);
symbol_put(kping_client);
}
- RETURN(0);
+ return 0;
}
default: {
}
}
- RETURN(err);
+ return err;
}
static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
LIBCFS_ALLOC_GFP(buf, 1024, GFP_IOFS);
if (buf == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* 'cmd' and permissions get checked in our arch-specific caller */
if (libcfs_ioctl_getdata(buf, buf + 800, (void *)arg)) {
out:
LIBCFS_FREE(buf, 1024);
- RETURN(err);
+ return err;
}
rc = cfs_gettok(&src, ' ', &res);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
rc = parse_nidrange(&res, nidlist);
if (rc == 0) {
cfs_free_nidlist(nidlist);
- RETURN(0);
+ return 0;
}
}
- RETURN(1);
+ return 1;
}
/*
if (nr->nr_netnum != LNET_NETNUM(LNET_NIDNET(nid)))
continue;
if (nr->nr_all)
- RETURN(1);
+ return 1;
list_for_each_entry(ar, &nr->nr_addrranges, ar_link)
if (nr->nr_netstrfns->nf_match_addr(LNET_NIDADDR(nid),
&ar->ar_numaddr_ranges))
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
new = alloc_entry(cache, key, args);
if (!new) {
CERROR("fail to alloc entry\n");
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
}
goto find_again;
} else {
/* Now we know it's good */
out:
spin_unlock(&cache->uc_lock);
- RETURN(entry);
+ return entry;
}
EXPORT_SYMBOL(upcall_cache_get_entry);
cache->uc_name, key);
/* haven't found, it's possible */
spin_unlock(&cache->uc_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (err) {
wake_up_all(&entry->ue_waitq);
put_entry(cache, entry);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(upcall_cache_downcall);
LIBCFS_ALLOC(cache, sizeof(*cache));
if (!cache)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
spin_lock_init(&cache->uc_lock);
rwlock_init(&cache->uc_upcall_rwlock);
cache->uc_acquire_expire = 30;
cache->uc_ops = ops;
- RETURN(cache);
+ return cache;
}
EXPORT_SYMBOL(upcall_cache_init);
unsigned int len, const char *str, const struct qstr *name)
{
if (len != name->len)
- RETURN(1);
+ return 1;
if (memcmp(str, name->name, len))
- RETURN(1);
+ return 1;
CDEBUG(D_DENTRY, "found name %.*s(%p) flags %#x refc %d\n",
name->len, name->name, dentry, dentry->d_flags,
/* mountpoint is always valid */
if (d_mountpoint((struct dentry *)dentry))
- RETURN(0);
+ return 0;
if (d_lustre_invalid(dentry))
- RETURN(1);
+ return 1;
- RETURN(0);
+ return 0;
}
static inline int return_if_equal(struct ldlm_lock *lock, void *data)
rc = md_find_cbdata(sbi->ll_md_exp, ll_inode2fid(inode),
return_if_equal, NULL);
if (rc != 0)
- RETURN(rc);
+ return rc;
lsm = ccc_inode_lsm_get(inode);
if (lsm == NULL)
- RETURN(rc);
+ return rc;
rc = obd_find_cbdata(sbi->ll_dt_exp, lsm, return_if_equal, NULL);
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
}
/**
#endif
if (d_lustre_invalid((struct dentry *)de))
- RETURN(1);
- RETURN(0);
+ return 1;
+ return 0;
}
static int ll_set_dd(struct dentry *de)
OBD_FREE_PTR(lld);
spin_unlock(&de->d_lock);
} else {
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
}
- RETURN(0);
+ return 0;
}
int ll_dops_init(struct dentry *de, int block, int init_sa)
int rc = 0;
if (!request)
- RETURN(0);
+ return 0;
if (it_disposition(it, DISP_LOOKUP_NEG))
- RETURN(-ENOENT);
+ return -ENOENT;
rc = ll_prep_inode(&de->d_inode, request, NULL, it);
- RETURN(rc);
+ return rc;
}
void ll_lookup_finish_locks(struct lookup_intent *it, struct dentry *dentry)
away this negative dentry and actually do the request to
kernel to create whatever needs to be created (if possible)*/
if (it && (it->it_op & IT_CREAT))
- RETURN(0);
+ return 0;
if (d_lustre_invalid(de))
- RETURN(0);
+ return 0;
ibits = MDS_INODELOCK_UPDATE;
rc = ll_have_md_lock(parent, &ibits, LCK_MINMODE);
LASSERT(it);
if (it->it_op == IT_LOOKUP && !d_lustre_invalid(de))
- RETURN(1);
+ return 1;
if (it->it_op == IT_OPEN) {
struct inode *inode = de->d_inode;
if it would be, we'll reopen the open request to
MDS later during file open path */
mutex_unlock(&lli->lli_och_mutex);
- RETURN(1);
+ return 1;
} else {
mutex_unlock(&lli->lli_och_mutex);
}
de->d_name.name, de->d_name.len,
0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
if (!IS_POSIXACL(parent) || !exp_connect_umask(exp))
it->it_create_mode &= ~current_umask();
mark:
if (it != NULL && it->it_op == IT_GETATTR && rc > 0)
ll_statahead_mark(parent, de);
- RETURN(rc);
+ return rc;
/*
* This part is here to combat evil-evil race in real_lookup on 2.6
LUSTRE_OPC_CREATE :
LUSTRE_OPC_ANY), NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
rc = md_intent_lock(exp, op_data, NULL, 0, it, 0, &req,
ll_md_blocking_ast, 0);
if (!(flags & (LOOKUP_PARENT|LOOKUP_OPEN|LOOKUP_CREATE)) &&
ll_need_statahead(parent, dentry) > 0) {
if (flags & LOOKUP_RCU)
- RETURN(-ECHILD);
+ return -ECHILD;
if (dentry->d_inode == NULL)
unplug = 1;
ll_statahead_mark(parent, dentry);
}
- RETURN(1);
+ return 1;
}
ctx->pos = pos;
ll_dir_chain_fini(&chain);
- RETURN(rc);
+ return rc;
}
static int ll_readdir(struct file *filp, struct dir_context *ctx)
if (!rc)
ll_stats_ops_tally(sbi, LPROC_LL_READDIR, 1);
- RETURN(rc);
+ return rc;
}
int ll_send_mgc_param(struct obd_export *mgc, char *string)
" %#08x != %#08x nor %#08x\n",
lump->lmm_magic, LOV_USER_MAGIC_V1,
LOV_USER_MAGIC_V3);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
} else {
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
if (lump != NULL && lump->lmm_magic == cpu_to_le32(LMV_USER_MAGIC))
op_data->op_cli_flags |= CLI_SET_MEA;
if (param != NULL)
OBD_FREE(param, MGS_PARAM_MAXLEN);
}
- RETURN(rc);
+ return rc;
}
int ll_dir_getstripe(struct inode *inode, struct lov_mds_md **lmmp,
rc = ll_get_max_mdsize(sbi, &lmmsize);
if (rc)
- RETURN(rc);
+ return rc;
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL,
0, lmmsize, LUSTRE_OPC_ANY,
NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA;
rc = md_getattr(sbi->ll_md_exp, op_data, &req);
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0,
0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_flags |= MF_GET_MDT_IDX;
rc = md_getattr(sbi->ll_md_exp, op_data, NULL);
ll_finish_md_op_data(op_data);
if (rc < 0) {
CDEBUG(D_INFO, "md_getattr_name: %d\n", rc);
- RETURN(rc);
+ return rc;
}
return mdtidx;
}
rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk),
&hpk, NULL);
- RETURN(rc);
+ return rc;
}
/**
rc = obd_iocontrol(LL_IOC_HSM_PROGRESS, sbi->ll_md_exp, sizeof(hpk),
&hpk, NULL);
- RETURN(rc);
+ return rc;
}
case Q_SETINFO:
if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EPERM);
+ return -EPERM;
break;
case Q_GETQUOTA:
if (((type == USRQUOTA &&
!in_egroup_p(make_kgid(&init_user_ns, id)))) &&
(!cfs_capable(CFS_CAP_SYS_ADMIN) ||
sbi->ll_flags & LL_SBI_RMT_CLIENT))
- RETURN(-EPERM);
+ return -EPERM;
break;
case Q_GETINFO:
break;
default:
CERROR("unsupported quotactl op: %#x\n", cmd);
- RETURN(-ENOTTY);
+ return -ENOTTY;
}
if (valid != QC_GENERAL) {
if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (cmd == Q_GETINFO)
qctl->qc_cmd = Q_GETOINFO;
else if (cmd == Q_GETQUOTA)
qctl->qc_cmd = Q_GETOQUOTA;
else
- RETURN(-EINVAL);
+ return -EINVAL;
switch (valid) {
case QC_MDTIDX:
}
if (rc)
- RETURN(rc);
+ return rc;
qctl->qc_cmd = cmd;
} else {
OBD_ALLOC_PTR(oqctl);
if (oqctl == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
QCTL_COPY(oqctl, qctl);
rc = obd_quotactl(sbi->ll_md_exp, oqctl);
obd_quotactl(sbi->ll_md_exp, oqctl);
}
OBD_FREE_PTR(oqctl);
- RETURN(rc);
+ return rc;
}
/* If QIF_SPACE is not set, client should collect the
* space usage from OSSs by itself */
OBD_FREE_PTR(oqctl);
}
- RETURN(rc);
+ return rc;
}
static char *
switch(cmd) {
case FSFILT_IOC_GETFLAGS:
case FSFILT_IOC_SETFLAGS:
- RETURN(ll_iocontrol(inode, file, cmd, arg));
+ return ll_iocontrol(inode, file, cmd, arg);
case FSFILT_IOC_GETVERSION_OLD:
case FSFILT_IOC_GETVERSION:
- RETURN(put_user(inode->i_generation, (int *)arg));
+ return put_user(inode->i_generation, (int *)arg);
/* We need to special case any other ioctls we want to handle,
* to send them to the MDS/OST as appropriate and to properly
* network encode the arg field.
mdtidx = ll_get_mdt_idx(inode);
if (mdtidx < 0)
- RETURN(mdtidx);
+ return mdtidx;
if (put_user((int)mdtidx, (int*)arg))
- RETURN(-EFAULT);
+ return -EFAULT;
return 0;
}
rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
if (rc)
- RETURN(rc);
+ return rc;
data = (void *)buf;
filename = data->ioc_inlbuf1;
rc = obd_ioctl_getdata(&buf, &len, (void *)arg);
if (rc)
- RETURN(rc);
+ return rc;
data = (void *)buf;
if (data->ioc_inlbuf1 == NULL || data->ioc_inlbuf2 == NULL ||
rc = ll_dir_setdirstripe(inode, lum, filename);
lmv_out_free:
obd_ioctl_freedata(buf, len);
- RETURN(rc);
+ return rc;
}
case LL_IOC_LOV_SETSTRIPE: {
sizeof(lumv3p->lmm_objects[0]));
/* first try with v1 which is smaller than v3 */
if (copy_from_user(lumv1, lumv1p, sizeof(*lumv1)))
- RETURN(-EFAULT);
+ return -EFAULT;
if ((lumv1->lmm_magic == LOV_USER_MAGIC_V3) ) {
if (copy_from_user(&lumv3, lumv3p, sizeof(lumv3)))
- RETURN(-EFAULT);
+ return -EFAULT;
}
if (inode->i_sb->s_root == file->f_dentry)
/* in v1 and v3 cases lumv1 points to data */
rc = ll_dir_setstripe(inode, lumv1, set_default);
- RETURN(rc);
+ return rc;
}
case LL_IOC_LMV_GETSTRIPE: {
struct lmv_user_md *lump = (struct lmv_user_md *)arg;
int mdtindex;
if (copy_from_user(&lum, lump, sizeof(struct lmv_user_md)))
- RETURN(-EFAULT);
+ return -EFAULT;
if (lum.lum_magic != LMV_MAGIC_V1)
- RETURN(-EINVAL);
+ return -EINVAL;
lum_size = lmv_user_md_size(1, LMV_MAGIC_V1);
OBD_ALLOC(tmp, lum_size);
free_lmv:
if (tmp)
OBD_FREE(tmp, lum_size);
- RETURN(rc);
+ return rc;
}
case LL_IOC_REMOVE_ENTRY: {
char *filename = NULL;
filename = ll_getname((const char *)arg);
if (IS_ERR(filename))
- RETURN(PTR_ERR(filename));
+ return PTR_ERR(filename);
namelen = strlen(filename);
if (namelen < 1)
out_rmdir:
if (filename)
ll_putname(filename);
- RETURN(rc);
+ return rc;
}
case LL_IOC_LOV_SWAP_LAYOUTS:
- RETURN(-EPERM);
+ return -EPERM;
case LL_IOC_OBD_STATFS:
- RETURN(ll_obd_statfs(inode, (void *)arg));
+ return ll_obd_statfs(inode, (void *)arg);
case LL_IOC_LOV_GETSTRIPE:
case LL_IOC_MDC_GETINFO:
case IOC_MDC_GETFILEINFO:
cmd == IOC_MDC_GETFILESTRIPE) {
filename = ll_getname((const char *)arg);
if (IS_ERR(filename))
- RETURN(PTR_ERR(filename));
+ return PTR_ERR(filename);
rc = ll_lov_getstripe_ea_info(inode, filename, &lmm,
&lmmsize, &request);
rc = ll_get_max_mdsize(sbi, &lmmsize);
if (rc)
- RETURN(rc);
+ return rc;
OBD_ALLOC_LARGE(lmm, lmmsize);
if (lmm == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(lmm, lum, lmmsize))
GOTO(free_lmm, rc = -EFAULT);
return rc;
}
case OBD_IOC_LLOG_CATINFO: {
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
}
case OBD_IOC_QUOTACHECK: {
struct obd_quotactl *oqctl;
if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EPERM);
+ return -EPERM;
OBD_ALLOC_PTR(oqctl);
if (!oqctl)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oqctl->qc_type = arg;
rc = obd_quotacheck(sbi->ll_md_exp, oqctl);
if (rc < 0) {
if (!cfs_capable(CFS_CAP_SYS_ADMIN) ||
sbi->ll_flags & LL_SBI_RMT_CLIENT)
- RETURN(-EPERM);
+ return -EPERM;
OBD_ALLOC_PTR(check);
if (!check)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = obd_iocontrol(cmd, sbi->ll_md_exp, 0, (void *)check,
NULL);
}
out_poll:
OBD_FREE_PTR(check);
- RETURN(rc);
+ return rc;
}
#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(2, 7, 50, 0)
case LL_IOC_QUOTACTL_18: {
OBD_ALLOC_PTR(qctl_18);
if (!qctl_18)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC_PTR(qctl_20);
if (!qctl_20)
OBD_FREE_PTR(qctl_20);
out_quotactl_18:
OBD_FREE_PTR(qctl_18);
- RETURN(rc);
+ return rc;
}
#else
#warning "remove old LL_IOC_QUOTACTL_18 compatibility code"
OBD_ALLOC_PTR(qctl);
if (!qctl)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(qctl, (void *)arg, sizeof(*qctl)))
GOTO(out_quotactl, rc = -EFAULT);
out_quotactl:
OBD_FREE_PTR(qctl);
- RETURN(rc);
+ return rc;
}
case OBD_IOC_GETDTNAME:
case OBD_IOC_GETMDNAME:
- RETURN(ll_get_obd_name(inode, cmd, arg));
+ return ll_get_obd_name(inode, cmd, arg);
case LL_IOC_FLUSHCTX:
- RETURN(ll_flush_ctx(inode));
+ return ll_flush_ctx(inode);
#ifdef CONFIG_FS_POSIX_ACL
case LL_IOC_RMTACL: {
if (sbi->ll_flags & LL_SBI_RMT_CLIENT &&
rc = rct_add(&sbi->ll_rct, current_pid(), arg);
if (!rc)
fd->fd_flags |= LL_FILE_RMTACL;
- RETURN(rc);
+ return rc;
} else
- RETURN(0);
+ return 0;
}
#endif
case LL_IOC_GETOBDCOUNT: {
struct obd_export *exp;
if (copy_from_user(&count, (int *)arg, sizeof(int)))
- RETURN(-EFAULT);
+ return -EFAULT;
/* get ost count when count is zero, get mdt count otherwise */
exp = count ? sbi->ll_md_exp : sbi->ll_dt_exp;
KEY_TGT_COUNT, &vallen, &count, NULL);
if (rc) {
CERROR("get target count failed: %d\n", rc);
- RETURN(rc);
+ return rc;
}
if (copy_to_user((int *)arg, &count, sizeof(int)))
- RETURN(-EFAULT);
+ return -EFAULT;
- RETURN(0);
+ return 0;
}
case LL_IOC_PATH2FID:
if (copy_to_user((void *)arg, ll_inode2fid(inode),
sizeof(struct lu_fid)))
- RETURN(-EFAULT);
- RETURN(0);
+ return -EFAULT;
+ return 0;
case LL_IOC_GET_CONNECT_FLAGS: {
- RETURN(obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg));
+ return obd_iocontrol(cmd, sbi->ll_md_exp, 0, NULL, (void*)arg);
}
case OBD_IOC_CHANGELOG_SEND:
case OBD_IOC_CHANGELOG_CLEAR:
rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
sizeof(struct ioc_changelog));
- RETURN(rc);
+ return rc;
case OBD_IOC_FID2PATH:
- RETURN(ll_fid2path(inode, (void *)arg));
+ return ll_fid2path(inode, (void *)arg);
case LL_IOC_HSM_REQUEST: {
struct hsm_user_request *hur;
int totalsize;
OBD_ALLOC_PTR(hur);
if (hur == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* We don't know the true size yet; copy the fixed-size part */
if (copy_from_user(hur, (void *)arg, sizeof(*hur))) {
OBD_FREE_PTR(hur);
- RETURN(-EFAULT);
+ return -EFAULT;
}
/* Compute the whole struct size */
OBD_FREE_PTR(hur);
OBD_ALLOC_LARGE(hur, totalsize);
if (hur == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* Copy the whole struct */
if (copy_from_user(hur, (void *)arg, totalsize)) {
OBD_FREE_LARGE(hur, totalsize);
- RETURN(-EFAULT);
+ return -EFAULT;
}
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), totalsize,
OBD_FREE_LARGE(hur, totalsize);
- RETURN(rc);
+ return rc;
}
case LL_IOC_HSM_PROGRESS: {
struct hsm_progress_kernel hpk;
struct hsm_progress hp;
if (copy_from_user(&hp, (void *)arg, sizeof(hp)))
- RETURN(-EFAULT);
+ return -EFAULT;
hpk.hpk_fid = hp.hp_fid;
hpk.hpk_cookie = hp.hp_cookie;
* reported to Lustre root */
rc = obd_iocontrol(cmd, sbi->ll_md_exp, sizeof(hpk), &hpk,
NULL);
- RETURN(rc);
+ return rc;
}
case LL_IOC_HSM_CT_START:
rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void *)arg,
sizeof(struct lustre_kernelcomm));
- RETURN(rc);
+ return rc;
case LL_IOC_HSM_COPY_START: {
struct hsm_copy *copy;
OBD_ALLOC_PTR(copy);
if (copy == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
OBD_FREE_PTR(copy);
- RETURN(-EFAULT);
+ return -EFAULT;
}
rc = ll_ioc_copy_start(inode->i_sb, copy);
rc = -EFAULT;
OBD_FREE_PTR(copy);
- RETURN(rc);
+ return rc;
}
case LL_IOC_HSM_COPY_END: {
struct hsm_copy *copy;
OBD_ALLOC_PTR(copy);
if (copy == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(copy, (char *)arg, sizeof(*copy))) {
OBD_FREE_PTR(copy);
- RETURN(-EFAULT);
+ return -EFAULT;
}
rc = ll_ioc_copy_end(inode->i_sb, copy);
rc = -EFAULT;
OBD_FREE_PTR(copy);
- RETURN(rc);
+ return rc;
}
default:
- RETURN(obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL,
- (void *)arg));
+ return obd_iocontrol(cmd, sbi->ll_dt_exp, 0, NULL, (void *)arg);
}
}
int ll_dir_open(struct inode *inode, struct file *file)
{
- RETURN(ll_file_open(inode, file));
+ return ll_file_open(inode, file);
}
int ll_dir_release(struct inode *inode, struct file *file)
{
- RETURN(ll_file_release(inode, file));
+ return ll_file_release(inode, file);
}
struct file_operations ll_dir_operations = {
if (*och_usecount) { /* There are still users of this handle, so
skip freeing it. */
mutex_unlock(&lli->lli_och_mutex);
- RETURN(0);
+ return 0;
}
och=*och_p;
*och_p = NULL;
inode, och);
}
- RETURN(rc);
+ return rc;
}
int ll_md_close(struct obd_export *md_exp, struct inode *inode,
ll_file_data_put(fd);
ll_capa_close(inode);
- RETURN(rc);
+ return rc;
}
/* While this returns an error code, fput() the caller does not, so we need
if (inode->i_sb->s_root == file->f_dentry) {
LUSTRE_FPRIVATE(file) = NULL;
ll_file_data_put(fd);
- RETURN(0);
+ return 0;
}
if (!S_ISDIR(inode->i_mode)) {
if (CFS_FAIL_TIMEOUT_MS(OBD_FAIL_PTLRPC_DUMP_LOG, cfs_fail_val))
libcfs_debug_dumplog();
- RETURN(rc);
+ return rc;
}
static int ll_intent_file_open(struct file *file, void *lmm,
int rc;
if (!parent)
- RETURN(-ENOENT);
+ return -ENOENT;
/* Usually we come here only for NFSD, and we want open lock.
But we can also get here with pre 2.6.15 patchless kernels, and in
file->f_dentry->d_inode, name, len,
O_RDWR, opc, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
itp->it_flags |= MDS_OPEN_BY_FID;
rc = md_intent_lock(sbi->ll_md_exp, op_data, lmm, lmmsize, itp,
it_clear_disposition(itp, DISP_ENQ_COMPLETE);
ll_intent_drop_lock(itp);
- RETURN(rc);
+ return rc;
}
/**
rc = ll_och_fill(ll_i2sbi(inode)->ll_md_exp, lli, it, och);
if (rc)
- RETURN(rc);
+ return rc;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if ((it->it_flags & FMODE_WRITE) &&
LUSTRE_FPRIVATE(file) = fd;
ll_readahead_init(inode, &fd->fd_ras);
fd->fd_omode = it->it_flags;
- RETURN(0);
+ return 0;
}
/* Open a file, and (for the very first open) create objects on the OSTs at
if (inode->i_sb->s_root == file->f_dentry) {
LUSTRE_FPRIVATE(file) = fd;
- RETURN(0);
+ return 0;
}
if (!it || !it->d.lustre.it_disposition) {
OBD_MD_FLATIME | OBD_MD_FLMTIME |
OBD_MD_FLCTIME | OBD_MD_FLSIZE |
OBD_MD_FLDATAVERSION);
- RETURN(rc);
+ return rc;
}
/**
(unsigned long)ll_inode_blksize(inode));
}
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
}
int ll_merge_lvb(const struct lu_env *env, struct inode *inode)
}
ll_inode_size_unlock(inode);
- RETURN(rc);
+ return rc;
}
int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
result = ll_file_get_iov_count(iov, &nr_segs, &count);
if (result)
- RETURN(result);
+ return result;
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
args = vvp_env_args(env, IO_NORMAL);
args->u.normal.via_iov = (struct iovec *)iov;
result = ll_file_io_generic(env, args, iocb->ki_filp, CIT_READ,
&iocb->ki_pos, count);
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
static ssize_t ll_file_read(struct file *file, char *buf, size_t count,
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
local_iov = &vvp_env_info(env)->vti_local_iov;
kiocb = &vvp_env_info(env)->vti_kiocb;
*ppos = kiocb->ki_pos;
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
/*
result = ll_file_get_iov_count(iov, &nr_segs, &count);
if (result)
- RETURN(result);
+ return result;
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
args = vvp_env_args(env, IO_NORMAL);
args->u.normal.via_iov = (struct iovec *)iov;
result = ll_file_io_generic(env, args, iocb->ki_filp, CIT_WRITE,
&iocb->ki_pos, count);
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
local_iov = &vvp_env_info(env)->vti_local_iov;
kiocb = &vvp_env_info(env)->vti_kiocb;
*ppos = kiocb->ki_pos;
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
args = vvp_env_args(env, IO_SPLICE);
args->u.splice.via_pipe = pipe;
result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
cl_env_put(env, &refcheck);
- RETURN(result);
+ return result;
}
static int ll_lov_recreate(struct inode *inode, struct ost_id *oi,
OBDO_ALLOC(oa);
if (oa == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lsm = ccc_inode_lsm_get(inode);
if (!lsm_has_objects(lsm))
struct ost_id oi;
if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- RETURN(-EPERM);
+ return -EPERM;
if (copy_from_user(&ucreat, (struct ll_recreate_obj *)arg,
sizeof(ucreat)))
- RETURN(-EFAULT);
+ return -EFAULT;
ostid_set_seq_mdt0(&oi);
ostid_set_id(&oi, ucreat.lrc_id);
- RETURN(ll_lov_recreate(inode, &oi, ucreat.lrc_ost_idx));
+ return ll_lov_recreate(inode, &oi, ucreat.lrc_ost_idx);
}
static int ll_lov_recreate_fid(struct inode *inode, unsigned long arg)
obd_count ost_idx;
if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- RETURN(-EPERM);
+ return -EPERM;
if (copy_from_user(&fid, (struct lu_fid *)arg, sizeof(fid)))
- RETURN(-EFAULT);
+ return -EFAULT;
fid_to_ostid(&fid, &oi);
ost_idx = (fid_seq(&fid) >> 16) & 0xffff;
- RETURN(ll_lov_recreate(inode, &oi, ost_idx));
+ return ll_lov_recreate(inode, &oi, ost_idx);
}
int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
ccc_inode_lsm_put(inode, lsm);
CDEBUG(D_IOCTL, "stripe already exists for ino %lu\n",
inode->i_ino);
- RETURN(-EEXIST);
+ return -EEXIST;
}
ll_inode_size_lock(inode);
ll_inode_size_unlock(inode);
ll_intent_release(&oit);
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
out_req_free:
ptlrpc_req_finished((struct ptlrpc_request *) oit.d.lustre.it_data);
goto out;
rc = ll_get_max_mdsize(sbi, &lmmsize);
if (rc)
- RETURN(rc);
+ return rc;
op_data = ll_prep_md_op_data(NULL, inode, NULL, filename,
strlen(filename), lmmsize,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_valid = OBD_MD_FLEASIZE | OBD_MD_FLDIREA;
rc = md_getattr_name(sbi->ll_md_exp, op_data, &req);
int rc;
if (!cfs_capable(CFS_CAP_SYS_ADMIN))
- RETURN(-EPERM);
+ return -EPERM;
OBD_ALLOC_LARGE(lump, lum_size);
if (lump == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(lump, (struct lov_user_md *)arg, lum_size)) {
OBD_FREE_LARGE(lump, lum_size);
- RETURN(-EFAULT);
+ return -EFAULT;
}
rc = ll_lov_setstripe_ea_info(inode, file, flags, lump, lum_size);
OBD_FREE_LARGE(lump, lum_size);
- RETURN(rc);
+ return rc;
}
static int ll_lov_setstripe(struct inode *inode, struct file *file,
/* first try with v1 which is smaller than v3 */
lum_size = sizeof(struct lov_user_md_v1);
if (copy_from_user(lumv1, lumv1p, lum_size))
- RETURN(-EFAULT);
+ return -EFAULT;
if (lumv1->lmm_magic == LOV_USER_MAGIC_V3) {
lum_size = sizeof(struct lov_user_md_v3);
if (copy_from_user(&lumv3, lumv3p, lum_size))
- RETURN(-EFAULT);
+ return -EFAULT;
}
rc = ll_lov_setstripe_ea_info(inode, file, flags, lumv1, lum_size);
0, lsm, (void *)arg);
ccc_inode_lsm_put(inode, lsm);
}
- RETURN(rc);
+ return rc;
}
static int ll_lov_getstripe(struct inode *inode, unsigned long arg)
rc = obd_iocontrol(LL_IOC_LOV_GETSTRIPE, ll_i2dtexp(inode), 0,
lsm, (void *)arg);
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
}
int ll_get_grouplock(struct inode *inode, struct file *file, unsigned long arg)
int rc;
if (ll_file_nolock(file))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
spin_lock(&lli->lli_lock);
if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
CWARN("group lock already existed with gid %lu\n",
fd->fd_grouplock.cg_gid);
spin_unlock(&lli->lli_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
LASSERT(fd->fd_grouplock.cg_lock == NULL);
spin_unlock(&lli->lli_lock);
rc = cl_get_grouplock(cl_i2info(inode)->lli_clob,
arg, (file->f_flags & O_NONBLOCK), &grouplock);
if (rc)
- RETURN(rc);
+ return rc;
spin_lock(&lli->lli_lock);
if (fd->fd_flags & LL_FILE_GROUP_LOCKED) {
spin_unlock(&lli->lli_lock);
CERROR("another thread just won the race\n");
cl_put_grouplock(&grouplock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
fd->fd_flags |= LL_FILE_GROUP_LOCKED;
spin_unlock(&lli->lli_lock);
CDEBUG(D_INFO, "group lock %lu obtained\n", arg);
- RETURN(0);
+ return 0;
}
int ll_put_grouplock(struct inode *inode, struct file *file, unsigned long arg)
if (!(fd->fd_flags & LL_FILE_GROUP_LOCKED)) {
spin_unlock(&lli->lli_lock);
CWARN("no group lock held\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
LASSERT(fd->fd_grouplock.cg_lock != NULL);
CWARN("group lock %lu doesn't match current id %lu\n",
arg, fd->fd_grouplock.cg_gid);
spin_unlock(&lli->lli_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
grouplock = fd->fd_grouplock;
cl_put_grouplock(&grouplock);
CDEBUG(D_INFO, "group lock %lu released\n", arg);
- RETURN(0);
+ return 0;
}
/**
/* Root ? Do nothing. */
if (dentry->d_inode->i_sb->s_root == dentry)
- RETURN(0);
+ return 0;
/* No open handle to close? Move away */
if (!it_disposition(it, DISP_OPEN_OPEN))
- RETURN(0);
+ return 0;
LASSERT(it_open_error(DISP_OPEN_OPEN, it) == 0);
ptlrpc_req_finished(it->d.lustre.it_data);
it_clear_disposition(it, DISP_ENQ_OPEN_REF);
}
- RETURN(rc);
+ return rc;
}
/**
out:
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
}
int ll_fid2path(struct inode *inode, void *arg)
if (!cfs_capable(CFS_CAP_DAC_READ_SEARCH) &&
!(ll_i2sbi(inode)->ll_flags & LL_SBI_USER_FID2PATH))
- RETURN(-EPERM);
+ return -EPERM;
/* Need to get the buflen */
OBD_ALLOC_PTR(gfin);
if (gfin == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(gfin, arg, sizeof(*gfin))) {
OBD_FREE_PTR(gfin);
- RETURN(-EFAULT);
+ return -EFAULT;
}
outsize = sizeof(*gfout) + gfin->gf_pathlen;
OBD_ALLOC(gfout, outsize);
if (gfout == NULL) {
OBD_FREE_PTR(gfin);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
memcpy(gfout, gfin, sizeof(*gfout));
OBD_FREE_PTR(gfin);
gf_free:
OBD_FREE(gfout, outsize);
- RETURN(rc);
+ return rc;
}
static int ll_ioctl_fiemap(struct inode *inode, unsigned long arg)
* required fiemap buffer */
if (get_user(extent_count,
&((struct ll_user_fiemap __user *)arg)->fm_extent_count))
- RETURN(-EFAULT);
+ return -EFAULT;
num_bytes = sizeof(*fiemap_s) + (extent_count *
sizeof(struct ll_fiemap_extent));
OBD_ALLOC_LARGE(fiemap_s, num_bytes);
if (fiemap_s == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* get the fiemap value */
if (copy_from_user(fiemap_s, (struct ll_user_fiemap __user *)arg,
error:
OBD_FREE_LARGE(fiemap_s, num_bytes);
- RETURN(rc);
+ return rc;
}
/*
OBD_FREE_PTR(obdo);
out:
ccc_inode_lsm_put(inode, lsm);
- RETURN(rc);
+ return rc;
}
struct ll_swap_stack {
OBD_ALLOC_PTR(llss);
if (llss == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
llss->inode1 = file1->f_dentry->d_inode;
llss->inode2 = file2->f_dentry->d_inode;
if (llss != NULL)
OBD_FREE_PTR(llss);
- RETURN(rc);
+ return rc;
}
long ll_file_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
/* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */
if (_IOC_TYPE(cmd) == 'T' || _IOC_TYPE(cmd) == 't') /* tty ioctls */
- RETURN(-ENOTTY);
+ return -ENOTTY;
switch(cmd) {
case LL_IOC_GETFLAGS:
* not abused, and to handle any flag side effects.
*/
if (get_user(flags, (int *) arg))
- RETURN(-EFAULT);
+ return -EFAULT;
if (cmd == LL_IOC_SETFLAGS) {
if ((flags & LL_FILE_IGNORE_LOCK) &&
!(file->f_flags & O_DIRECT)) {
CERROR("%s: unable to disable locking on "
"non-O_DIRECT file\n", current->comm);
- RETURN(-EINVAL);
+ return -EINVAL;
}
fd->fd_flags |= flags;
} else {
fd->fd_flags &= ~flags;
}
- RETURN(0);
+ return 0;
case LL_IOC_LOV_SETSTRIPE:
- RETURN(ll_lov_setstripe(inode, file, arg));
+ return ll_lov_setstripe(inode, file, arg);
case LL_IOC_LOV_SETEA:
- RETURN(ll_lov_setea(inode, file, arg));
+ return ll_lov_setea(inode, file, arg);
case LL_IOC_LOV_SWAP_LAYOUTS: {
struct file *file2;
struct lustre_swap_layouts lsl;
if (copy_from_user(&lsl, (char *)arg,
sizeof(struct lustre_swap_layouts)))
- RETURN(-EFAULT);
+ return -EFAULT;
if ((file->f_flags & O_ACCMODE) == 0) /* O_RDONLY */
- RETURN(-EPERM);
+ return -EPERM;
file2 = fget(lsl.sl_fd);
if (file2 == NULL)
- RETURN(-EBADF);
+ return -EBADF;
rc = -EPERM;
if ((file2->f_flags & O_ACCMODE) != 0) /* O_WRONLY or O_RDWR */
rc = ll_swap_layouts(file, file2, &lsl);
fput(file2);
- RETURN(rc);
+ return rc;
}
case LL_IOC_LOV_GETSTRIPE:
- RETURN(ll_lov_getstripe(inode, arg));
+ return ll_lov_getstripe(inode, arg);
case LL_IOC_RECREATE_OBJ:
- RETURN(ll_lov_recreate_obj(inode, arg));
+ return ll_lov_recreate_obj(inode, arg);
case LL_IOC_RECREATE_FID:
- RETURN(ll_lov_recreate_fid(inode, arg));
+ return ll_lov_recreate_fid(inode, arg);
case FSFILT_IOC_FIEMAP:
- RETURN(ll_ioctl_fiemap(inode, arg));
+ return ll_ioctl_fiemap(inode, arg);
case FSFILT_IOC_GETFLAGS:
case FSFILT_IOC_SETFLAGS:
- RETURN(ll_iocontrol(inode, file, cmd, arg));
+ return ll_iocontrol(inode, file, cmd, arg);
case FSFILT_IOC_GETVERSION_OLD:
case FSFILT_IOC_GETVERSION:
- RETURN(put_user(inode->i_generation, (int *)arg));
+ return put_user(inode->i_generation, (int *)arg);
case LL_IOC_GROUP_LOCK:
- RETURN(ll_get_grouplock(inode, file, arg));
+ return ll_get_grouplock(inode, file, arg);
case LL_IOC_GROUP_UNLOCK:
- RETURN(ll_put_grouplock(inode, file, arg));
+ return ll_put_grouplock(inode, file, arg);
case IOC_OBD_STATFS:
- RETURN(ll_obd_statfs(inode, (void *)arg));
+ return ll_obd_statfs(inode, (void *)arg);
/* We need to special case any other ioctls we want to handle,
* to send them to the MDS/OST as appropriate and to properly
case FSFILT_IOC_SETVERSION:
*/
case LL_IOC_FLUSHCTX:
- RETURN(ll_flush_ctx(inode));
+ return ll_flush_ctx(inode);
case LL_IOC_PATH2FID: {
if (copy_to_user((void *)arg, ll_inode2fid(inode),
sizeof(struct lu_fid)))
- RETURN(-EFAULT);
+ return -EFAULT;
- RETURN(0);
+ return 0;
}
case OBD_IOC_FID2PATH:
- RETURN(ll_fid2path(inode, (void *)arg));
+ return ll_fid2path(inode, (void *)arg);
case LL_IOC_DATA_VERSION: {
struct ioc_data_version idv;
int rc;
if (copy_from_user(&idv, (char *)arg, sizeof(idv)))
- RETURN(-EFAULT);
+ return -EFAULT;
rc = ll_data_version(inode, &idv.idv_version,
!(idv.idv_flags & LL_DV_NOFLUSH));
if (rc == 0 && copy_to_user((char *) arg, &idv, sizeof(idv)))
- RETURN(-EFAULT);
+ return -EFAULT;
- RETURN(rc);
+ return rc;
}
case LL_IOC_GET_MDTIDX: {
mdtidx = ll_get_mdt_idx(inode);
if (mdtidx < 0)
- RETURN(mdtidx);
+ return mdtidx;
if (put_user((int)mdtidx, (int*)arg))
- RETURN(-EFAULT);
+ return -EFAULT;
- RETURN(0);
+ return 0;
}
case OBD_IOC_GETDTNAME:
case OBD_IOC_GETMDNAME:
- RETURN(ll_get_obd_name(inode, cmd, arg));
+ return ll_get_obd_name(inode, cmd, arg);
case LL_IOC_HSM_STATE_GET: {
struct md_op_data *op_data;
struct hsm_user_state *hus;
OBD_ALLOC_PTR(hus);
if (hus == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, hus);
if (IS_ERR(op_data)) {
OBD_FREE_PTR(hus);
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
}
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
ll_finish_md_op_data(op_data);
OBD_FREE_PTR(hus);
- RETURN(rc);
+ return rc;
}
case LL_IOC_HSM_STATE_SET: {
struct md_op_data *op_data;
OBD_ALLOC_PTR(hss);
if (hss == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(hss, (char *)arg, sizeof(*hss))) {
OBD_FREE_PTR(hss);
- RETURN(-EFAULT);
+ return -EFAULT;
}
/* Non-root users are forbidden to set or clear flags which are
if (((hss->hss_setmask | hss->hss_clearmask) & ~HSM_USER_MASK)
&& !cfs_capable(CFS_CAP_SYS_ADMIN)) {
OBD_FREE_PTR(hss);
- RETURN(-EPERM);
+ return -EPERM;
}
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, hss);
if (IS_ERR(op_data)) {
OBD_FREE_PTR(hss);
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
}
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
ll_finish_md_op_data(op_data);
OBD_FREE_PTR(hss);
- RETURN(rc);
+ return rc;
}
case LL_IOC_HSM_ACTION: {
struct md_op_data *op_data;
OBD_ALLOC_PTR(hca);
if (hca == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, hca);
if (IS_ERR(op_data)) {
OBD_FREE_PTR(hca);
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
}
rc = obd_iocontrol(cmd, ll_i2mdexp(inode), sizeof(*op_data),
ll_finish_md_op_data(op_data);
OBD_FREE_PTR(hca);
- RETURN(rc);
+ return rc;
}
default: {
int err;
if (LLIOC_STOP ==
ll_iocontrol_call(inode, file, cmd, arg, &err))
- RETURN(err);
+ return err;
- RETURN(obd_iocontrol(cmd, ll_i2dtexp(inode), 0, NULL,
- (void *)arg));
+ return obd_iocontrol(cmd, ll_i2dtexp(inode), 0, NULL,
+ (void *)arg);
}
}
}
if (origin == SEEK_END || origin == SEEK_HOLE || origin == SEEK_DATA) {
retval = ll_glimpse_size(inode);
if (retval != 0)
- RETURN(retval);
+ return retval;
eof = i_size_read(inode);
}
retval = generic_file_llseek_size(file, offset, origin,
ll_file_maxbytes(inode), eof);
- RETURN(retval);
+ return retval;
}
int ll_flush(struct file *file, fl_owner_t id)
if (mode != CL_FSYNC_NONE && mode != CL_FSYNC_LOCAL &&
mode != CL_FSYNC_DISCARD && mode != CL_FSYNC_ALL)
- RETURN(-EINVAL);
+ return -EINVAL;
env = cl_env_nested_get(&nest);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
capa = ll_osscapa_get(inode, CAPA_OPC_OSS_WRITE);
capa_put(capa);
- RETURN(result);
+ return result;
}
/*
}
mutex_unlock(&inode->i_mutex);
- RETURN(rc);
+ return rc;
}
int ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
flock.l_flock.start = file_lock->fl_start;
flock.l_flock.end = file_lock->fl_end;
} else {
- RETURN(-EINVAL);
+ return -EINVAL;
}
flock.l_flock.pid = file_lock->fl_pid;
default:
CDEBUG(D_INFO, "Unknown fcntl lock type: %d\n",
file_lock->fl_type);
- RETURN (-ENOTSUPP);
+ return -ENOTSUPP;
}
switch (cmd) {
break;
default:
CERROR("unknown fcntl lock command: %d\n", cmd);
- RETURN (-EINVAL);
+ return -EINVAL;
}
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
CDEBUG(D_DLMTRACE, "inode=%lu, pid=%u, flags=%#x, mode=%u, "
"start="LPU64", end="LPU64"\n", inode->i_ino, flock.l_flock.pid,
ll_finish_md_op_data(op_data);
- RETURN(rc);
+ return rc;
}
int ll_file_noflock(struct file *file, int cmd, struct file_lock *file_lock)
{
- RETURN(-ENOSYS);
+ return -ENOSYS;
}
/**
int i;
if (!inode)
- RETURN(0);
+ return 0;
fid = &ll_i2info(inode)->lli_fid;
CDEBUG(D_INFO, "trying to match res "DFID" mode %s\n", PFID(fid),
}
}
}
- RETURN(*bits == 0);
+ return *bits == 0;
}
ldlm_mode_t ll_take_md_lock(struct inode *inode, __u64 bits,
rc = md_lock_match(ll_i2mdexp(inode), LDLM_FL_BLOCK_GRANTED|flags,
fid, LDLM_IBITS, &policy,
LCK_CR|LCK_CW|LCK_PR|LCK_PW, lockh);
- RETURN(rc);
+ return rc;
}
static int ll_inode_revalidate_fini(struct inode *inode, int rc)
dentry->d_inode, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
oit.it_create_mode |= M_CHECK_STALE;
rc = md_intent_lock(exp, op_data, NULL, 0,
if (S_ISREG(inode->i_mode)) {
rc = ll_get_max_mdsize(sbi, &ealen);
if (rc)
- RETURN(rc);
+ return rc;
valid |= OBD_MD_FLEASIZE | OBD_MD_FLMODEASIZE;
}
0, ealen, LUSTRE_OPC_ANY,
NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_valid = valid;
/* Once OBD_CONNECT_ATTRFID is not supported, we can't find one
ll_finish_md_op_data(op_data);
if (rc) {
rc = ll_inode_revalidate_fini(inode, rc);
- RETURN(rc);
+ return rc;
}
rc = ll_prep_inode(&inode, req, NULL, NULL);
rc = __ll_inode_revalidate_it(dentry, it, ibits);
if (rc != 0)
- RETURN(rc);
+ return rc;
/* if object isn't regular file, don't validate size */
if (!S_ISREG(inode->i_mode)) {
} else {
rc = ll_glimpse_size(inode);
}
- RETURN(rc);
+ return rc;
}
int ll_getattr_it(struct vfsmount *mnt, struct dentry *de,
acl = posix_acl_dup(lli->lli_posix_acl);
spin_unlock(&lli->lli_lock);
- RETURN(acl);
+ return acl;
}
rc = __ll_inode_revalidate_it(inode->i_sb->s_root, &it,
MDS_INODELOCK_LOOKUP);
if (rc)
- RETURN(rc);
+ return rc;
}
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), inode mode %x mask %o\n",
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_INODE_PERM, 1);
rc = generic_permission(inode, mask);
- RETURN(rc);
+ return rc;
}
#define READ_METHOD aio_read
if (cb == NULL || cmd == NULL ||
count > LLIOC_MAX_CMD || count < 0)
- RETURN(NULL);
+ return NULL;
size = sizeof(*in_data) + count * sizeof(unsigned int);
OBD_ALLOC(in_data, size);
if (in_data == NULL)
- RETURN(NULL);
+ return NULL;
memset(in_data, 0, sizeof(*in_data));
in_data->iocd_size = size;
list_add_tail(&in_data->iocd_list, &llioc.ioc_head);
up_write(&llioc.ioc_sem);
- RETURN(in_data);
+ return in_data;
}
void ll_iocontrol_unregister(void *magic)
int result;
if (lli->lli_clob == NULL)
- RETURN(0);
+ return 0;
env = cl_env_nested_get(&nest);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
result = cl_conf_set(env, lli->lli_clob, conf);
cl_env_nested_put(&nest, env);
ldlm_lock_allow_match(lock);
}
}
- RETURN(result);
+ return result;
}
/* Fetch layout from MDT with getxattr request, if it's not ready yet */
lock->l_lvb_data, lock->l_lvb_len);
if ((lock->l_lvb_data != NULL) && (lock->l_flags & LDLM_FL_LVB_READY))
- RETURN(0);
+ return 0;
/* if layout lock was granted right away, the layout is returned
* within DLM_LVB of dlm reply; otherwise if the lock was ever
lmmsize, 0, &req);
capa_put(oc);
if (rc < 0)
- RETURN(rc);
+ return rc;
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (body == NULL || body->eadatasize > lmmsize)
CDEBUG(D_INODE, "file: "DFID" waiting layout return: %d.\n",
PFID(&lli->lli_fid), rc);
}
- RETURN(rc);
+ return rc;
}
/**
*gen = lli->lli_layout_gen;
if (!(sbi->ll_flags & LL_SBI_LAYOUT_LOCK))
- RETURN(0);
+ return 0;
/* sanity checks */
LASSERT(fid_is_sane(ll_inode2fid(inode)));
if (mode != 0) { /* hit cached lock */
rc = ll_layout_lock_set(&lockh, mode, inode, gen, false);
if (rc == 0)
- RETURN(0);
+ return 0;
/* better hold lli_layout_mutex to try again otherwise
* it will have starvation problem. */
goto again;
mutex_unlock(&lli->lli_layout_mutex);
- RETURN(rc);
+ return rc;
}
op_data = ll_prep_md_op_data(NULL, inode, inode, NULL,
0, 0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data)) {
mutex_unlock(&lli->lli_layout_mutex);
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
}
/* have to enqueue one */
}
mutex_unlock(&lli->lli_layout_mutex);
- RETURN(rc);
+ return rc;
}
thread_set_flags(&ll_capa_thread, SVC_STOPPED);
wake_up(&ll_capa_thread.t_ctl_waitq);
- RETURN(0);
+ return 0;
}
void ll_capa_timer_callback(unsigned long unused)
if (IS_ERR(task)) {
CERROR("cannot start expired capa thread: rc %ld\n",
PTR_ERR(task));
- RETURN(PTR_ERR(task));
+ return PTR_ERR(task);
}
wait_event(ll_capa_thread.t_ctl_waitq,
thread_is_running(&ll_capa_thread));
- RETURN(0);
+ return 0;
}
void ll_capa_thread_stop(void)
int found = 0;
if ((ll_i2sbi(inode)->ll_flags & LL_SBI_OSS_CAPA) == 0)
- RETURN(NULL);
+ return NULL;
LASSERT(opc == CAPA_OPC_OSS_WRITE || opc == CAPA_OPC_OSS_RW ||
opc == CAPA_OPC_OSS_TRUNC);
}
spin_unlock(&capa_lock);
- RETURN(ocapa);
+ return ocapa;
}
EXPORT_SYMBOL(ll_osscapa_get);
LASSERT(inode != NULL);
if ((ll_i2sbi(inode)->ll_flags & LL_SBI_MDS_CAPA) == 0)
- RETURN(NULL);
+ return NULL;
spin_lock(&capa_lock);
ocapa = capa_get(lli->lli_mds_capa);
atomic_set(&ll_capa_debug, 0);
}
- RETURN(ocapa);
+ return ocapa;
}
static struct obd_capa *do_add_mds_capa(struct inode *inode,
capa_put(ocapa);
iput(inode);
- RETURN(rc);
+ return rc;
}
spin_lock(&ocapa->c_lock);
OBDO_ALLOC(oa);
if (!oa) {
CERROR("can't allocate memory for Size-on-MDS update.\n");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
old_flags = op_data->op_flags;
ptlrpc_req_finished(request);
OBDO_FREE(oa);
- RETURN(rc);
+ return rc;
}
/**
CDEBUG(D_INFO, "ll_close exiting\n");
complete(&lcq->lcq_comp);
- RETURN(0);
+ return 0;
}
int ll_close_thread_start(struct ll_close_queue **lcq_ret)
OBD_ALLOC(sbi, sizeof(*sbi));
if (!sbi)
- RETURN(NULL);
+ return NULL;
spin_lock_init(&sbi->ll_lock);
mutex_init(&sbi->ll_lco.lco_lock);
atomic_set(&sbi->ll_agl_total, 0);
sbi->ll_flags |= LL_SBI_AGL_ENABLED;
- RETURN(sbi);
+ return sbi;
}
void ll_free_sbi(struct super_block *sb)
obd = class_name2obd(md);
if (!obd) {
CERROR("MD %s: not setup or attached\n", md);
- RETURN(-EINVAL);
+ return -EINVAL;
}
OBD_ALLOC_PTR(data);
if (data == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC_PTR(osfs);
if (osfs == NULL) {
OBD_FREE_PTR(data);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (proc_lustre_fs_root) {
if (osfs != NULL)
OBD_FREE_PTR(osfs);
- RETURN(err);
+ return err;
out_root:
if (root)
iput(root);
if (rc)
CERROR("Get max mdsize error rc %d \n", rc);
- RETURN(rc);
+ return rc;
}
void ll_dump_inode(struct inode *inode)
CDEBUG(D_SUPER, "option: %s, data %s\n", opt, data);
if (strncmp(opt, data, strlen(opt)))
- RETURN(NULL);
+ return NULL;
if ((value = strchr(data, '=')) == NULL)
- RETURN(NULL);
+ return NULL;
value++;
OBD_ALLOC(retval, strlen(value) + 1);
if (!retval) {
CERROR("out of memory!\n");
- RETURN(NULL);
+ return NULL;
}
memcpy(retval, value, strlen(value)+1);
CDEBUG(D_SUPER, "Assigned option: %s, value %s\n", opt, retval);
- RETURN(retval);
+ return retval;
}
static inline int ll_set_opt(const char *opt, char *data, int fl)
char *s1 = options, *s2;
if (!options)
- RETURN(0);
+ return 0;
CDEBUG(D_CONFIG, "Parsing opts %s\n", options);
}
LCONSOLE_ERROR_MSG(0x152, "Unknown option '%s', won't mount.\n",
s1);
- RETURN(-EINVAL);
+ return -EINVAL;
next:
/* Find next opt */
break;
s1 = s2 + 1;
}
- RETURN(0);
+ return 0;
}
void ll_lli_init(struct ll_inode_info *lli)
OBD_ALLOC_PTR(cfg);
if (cfg == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
try_module_get(THIS_MODULE);
if (!sbi) {
module_put(THIS_MODULE);
OBD_FREE_PTR(cfg);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
err = ll_options(lsi->lsi_lmd->lmd_opts, &sbi->ll_flags);
LCONSOLE_WARN("Mounted %s\n", profilenm);
OBD_FREE_PTR(cfg);
- RETURN(err);
+ return err;
} /* ll_fill_super */
void ll_put_super(struct super_block *sb)
op_data = ll_prep_md_op_data(op_data, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
rc = md_setattr(sbi->ll_md_exp, op_data, NULL, 0, NULL, 0,
&request, mod);
} else if (rc != -EPERM && rc != -EACCES && rc != -ETXTBSY) {
CERROR("md_setattr fails: rc = %d\n", rc);
}
- RETURN(rc);
+ return rc;
}
rc = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
sbi->ll_md_exp, &md);
if (rc) {
ptlrpc_req_finished(request);
- RETURN(rc);
+ return rc;
}
ia_valid = op_data->op_attr.ia_valid;
ll_update_inode(inode, &md);
ptlrpc_req_finished(request);
- RETURN(rc);
+ return rc;
}
/* Close IO epoch and send Size-on-MDS attribute update. */
LASSERT(op_data != NULL);
if (!S_ISREG(inode->i_mode))
- RETURN(0);
+ return 0;
CDEBUG(D_INODE, "Epoch "LPU64" closed on "DFID" for truncate\n",
op_data->op_ioepoch, PFID(&lli->lli_fid));
CERROR("inode %lu mdc truncate failed: rc = %d\n",
inode->i_ino, rc);
}
- RETURN(rc);
+ return rc;
}
static int ll_setattr_ost(struct inode *inode, struct iattr *attr)
/* Check new size against VFS/VM file size limit and rlimit */
rc = inode_newsize_ok(inode, attr->ia_size);
if (rc)
- RETURN(rc);
+ return rc;
/* The maximum Lustre file size is variable, based on the
* OST maximum object size and number of stripes. This
CDEBUG(D_INODE,"file "DFID" too large %llu > "LPU64"\n",
PFID(&lli->lli_fid), attr->ia_size,
ll_file_maxbytes(inode));
- RETURN(-EFBIG);
+ return -EFBIG;
}
attr->ia_valid |= ATTR_MTIME | ATTR_CTIME;
if (attr->ia_valid & TIMES_SET_FLAGS) {
if ((!uid_eq(current_fsuid(), inode->i_uid)) &&
!cfs_capable(CFS_CAP_FOWNER))
- RETURN(-EPERM);
+ return -EPERM;
}
/* We mark all of the fields "set" so MDS/OST does not re-set them */
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (!S_ISDIR(inode->i_mode)) {
if (attr->ia_valid & ATTR_SIZE)
rc = obd_statfs(NULL, sbi->ll_md_exp, osfs, max_age, flags);
if (rc) {
CERROR("md_statfs fails: rc = %d\n", rc);
- RETURN(rc);
+ return rc;
}
osfs->os_type = sb->s_magic;
rc = obd_statfs_rqset(sbi->ll_dt_exp, &obd_osfs, max_age, flags);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
- RETURN(rc);
+ return rc;
}
CDEBUG(D_SUPER, "OSC blocks "LPU64"/"LPU64" objects "LPU64"/"LPU64"\n",
osfs->os_ffree = obd_osfs.os_ffree;
}
- RETURN(rc);
+ return rc;
}
int ll_statfs(struct dentry *de, struct kstatfs *sfs)
{
0, 0, LUSTRE_OPC_ANY,
NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_valid = OBD_MD_FLFLAGS;
rc = md_getattr(sbi->ll_md_exp, op_data, &req);
ll_finish_md_op_data(op_data);
if (rc) {
CERROR("failure %d inode %lu\n", rc, inode->i_ino);
- RETURN(-abs(rc));
+ return -abs(rc);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
ptlrpc_req_finished(req);
- RETURN(put_user(flags, (int *)arg));
+ return put_user(flags, (int *)arg);
}
case FSFILT_IOC_SETFLAGS: {
struct lov_stripe_md *lsm;
struct md_op_data *op_data;
if (get_user(flags, (int *)arg))
- RETURN(-EFAULT);
+ return -EFAULT;
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
((struct ll_iattr *)&op_data->op_attr)->ia_attr_flags = flags;
op_data->op_attr.ia_valid |= ATTR_ATTR_FLAG;
ll_finish_md_op_data(op_data);
ptlrpc_req_finished(req);
if (rc)
- RETURN(rc);
+ return rc;
inode->i_flags = ll_ext_to_inode_flags(flags);
lsm = ccc_inode_lsm_get(inode);
if (!lsm_has_objects(lsm)) {
ccc_inode_lsm_put(inode, lsm);
- RETURN(0);
+ return 0;
}
OBDO_ALLOC(oinfo.oi_oa);
if (!oinfo.oi_oa) {
ccc_inode_lsm_put(inode, lsm);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
oinfo.oi_md = lsm;
oinfo.oi_oa->o_oi = lsm->lsm_oi;
if (rc && rc != -EPERM && rc != -EACCES)
CERROR("osc_setattr_async fails: rc = %d\n", rc);
- RETURN(rc);
+ return rc;
}
default:
- RETURN(-ENOSYS);
+ return -ENOSYS;
}
- RETURN(0);
+ return 0;
}
int ll_flush_ctx(struct inode *inode)
rc = md_get_lustre_md(sbi->ll_md_exp, req, sbi->ll_dt_exp,
sbi->ll_md_exp, &md);
if (rc)
- RETURN(rc);
+ return rc;
if (*inode) {
ll_update_inode(*inode, &md);
if (md.lsm != NULL)
obd_free_memmd(sbi->ll_dt_exp, &md.lsm);
md_free_lustre_md(sbi->ll_md_exp, &md);
- RETURN(rc);
+ return rc;
}
int ll_obd_statfs(struct inode *inode, void *arg)
if (sbi->ll_flags & LL_SBI_USER_FID2PATH)
seq_puts(seq, ",user_fid2path");
- RETURN(0);
+ return 0;
}
/**
else if (cmd == OBD_IOC_GETMDNAME)
obd = class_exp2obd(sbi->ll_md_exp);
else
- RETURN(-EINVAL);
+ return -EINVAL;
if (!obd)
- RETURN(-ENOENT);
+ return -ENOENT;
if (copy_to_user((void *)arg, obd->obd_name,
strlen(obd->obd_name) + 1))
- RETURN(-EFAULT);
+ return -EFAULT;
- RETURN(0);
+ return 0;
}
/**
break;
}
}
- RETURN(ret);
+ return ret;
}
/**
*env_ret = NULL;
if (ll_file_nolock(file))
- RETURN(ERR_PTR(-EOPNOTSUPP));
+ return ERR_PTR(-EOPNOTSUPP);
/*
* page fault can be called when lustre IO is
*/
env = cl_env_nested_get(nest);
if (IS_ERR(env))
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
*env_ret = env;
io = ll_fault_io_init(vma, &env, &nest, vmf->pgoff, &ra_flags);
if (IS_ERR(io))
- RETURN(to_fault_error(PTR_ERR(io)));
+ return to_fault_error(PTR_ERR(io));
result = io->ci_result;
if (result == 0) {
CDEBUG(D_MMAP, "%s fault %d/%d\n",
current->comm, fault_ret, result);
- RETURN(fault_ret);
+ return fault_ret;
}
static int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
last - first + 1, 0);
}
- RETURN(rc);
+ return rc;
}
static struct vm_operations_struct ll_file_vm_ops = {
int rc;
if (ll_file_nolock(file))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_MAP, 1);
rc = generic_file_mmap(file, vma);
rc = ll_glimpse_size(inode);
}
- RETURN(rc);
+ return rc;
}
inode = ilookup5(sb, hash, ll_nfs_test_inode, (void *)fid);
if (inode)
- RETURN(inode);
+ return inode;
rc = ll_get_max_mdsize(sbi, &eadatalen);
if (rc)
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
/* Because inode is NULL, ll_prep_md_op_data can not
* be used here. So we allocate op_data ourselves */
if (rc) {
CERROR("can't get object attrs, fid "DFID", rc %d\n",
PFID(fid), rc);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
rc = ll_prep_inode(&inode, req, sb, NULL);
ptlrpc_req_finished(req);
if (rc)
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
- RETURN(inode);
+ return inode;
}
struct lustre_nfs_fid {
CDEBUG(D_INFO, "Get dentry for fid: "DFID"\n", PFID(fid));
if (!fid_is_sane(fid))
- RETURN(ERR_PTR(-ESTALE));
+ return ERR_PTR(-ESTALE);
inode = search_inode_for_lustre(sb, fid);
if (IS_ERR(inode))
- RETURN(ERR_CAST(inode));
+ return ERR_CAST(inode);
if (is_bad_inode(inode)) {
/* we didn't find the right inode.. */
iput(inode);
- RETURN(ERR_PTR(-ESTALE));
+ return ERR_PTR(-ESTALE);
}
/**
result = d_obtain_alias(inode);
if (IS_ERR(result))
- RETURN(result);
+ return result;
ll_dops_init(result, 1, 0);
- RETURN(result);
+ return result;
}
#define LUSTRE_NFS_FID 0x97
(int)sizeof(struct lustre_nfs_fid));
if (*plen < sizeof(struct lustre_nfs_fid) / 4)
- RETURN(255);
+ return 255;
nfs_fid->lnf_child = *ll_inode2fid(inode);
nfs_fid->lnf_parent = *ll_inode2fid(parent);
*plen = sizeof(struct lustre_nfs_fid) / 4;
- RETURN(LUSTRE_NFS_FID);
+ return LUSTRE_NFS_FID;
}
static int ll_nfs_get_name_filldir(void *cookie, const char *name, int namelen,
struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
if (fh_type != LUSTRE_NFS_FID)
- RETURN(ERR_PTR(-EPROTO));
+ return ERR_PTR(-EPROTO);
- RETURN(ll_iget_for_nfs(sb, &nfs_fid->lnf_child, &nfs_fid->lnf_parent));
+ return ll_iget_for_nfs(sb, &nfs_fid->lnf_child, &nfs_fid->lnf_parent);
}
static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
if (fh_type != LUSTRE_NFS_FID)
- RETURN(ERR_PTR(-EPROTO));
+ return ERR_PTR(-EPROTO);
- RETURN(ll_iget_for_nfs(sb, &nfs_fid->lnf_parent, NULL));
+ return ll_iget_for_nfs(sb, &nfs_fid->lnf_parent, NULL);
}
static struct dentry *ll_get_parent(struct dentry *dchild)
rc = ll_get_max_mdsize(sbi, &lmmsize);
if (rc != 0)
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
op_data = ll_prep_md_op_data(NULL, dir, NULL, dotdot,
strlen(dotdot), lmmsize,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN((void *)op_data);
+ return (void *)op_data;
rc = md_getattr_name(sbi->ll_md_exp, op_data, &req);
ll_finish_md_op_data(op_data);
if (rc) {
CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
LASSERT(body->valid & OBD_MD_FLID);
result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL);
ptlrpc_req_finished(req);
- RETURN(result);
+ return result;
}
struct export_operations lustre_export_operations = {
buffer = lprocfs_find_named_value(buffer, "max_cached_mb:", &count);
rc = lprocfs_write_frac_helper(buffer, count, &pages_number, mult);
if (rc)
- RETURN(rc);
+ return rc;
if (pages_number < 0 || pages_number > totalram_pages) {
CERROR("%s: can't set max cache more than %lu MB\n",
ll_get_fsname(sb, NULL, 0),
totalram_pages >> (20 - PAGE_CACHE_SHIFT));
- RETURN(-ERANGE);
+ return -ERANGE;
}
if (sbi->ll_dt_exp == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
spin_lock(&sbi->ll_lock);
diff = pages_number - cache->ccc_lru_max;
if (IS_ERR(sbi->ll_proc_root)) {
err = PTR_ERR(sbi->ll_proc_root);
sbi->ll_proc_root = NULL;
- RETURN(err);
+ return err;
}
rc = lprocfs_seq_create(sbi->ll_proc_root, "dump_page_cache", 0444,
lprocfs_free_stats(&sbi->ll_ra_stats);
lprocfs_free_stats(&sbi->ll_stats);
}
- RETURN(err);
+ return err;
}
void lprocfs_unregister_mountpoint(struct ll_sb_info *sbi)
{
ldlm_lock_decref(lockh, mode);
- RETURN(0);
+ return 0;
}
CDEBUG(D_VFSTRACE, "got inode: %p for "DFID"\n",
inode, PFID(&md->body->fid1));
}
- RETURN(inode);
+ return inode;
}
static void ll_invalidate_negative_children(struct inode *dir)
rc = ldlm_cli_cancel(&lockh, LCF_ASYNC);
if (rc < 0) {
CDEBUG(D_INODE, "ldlm_cli_cancel: %d\n", rc);
- RETURN(rc);
+ return rc;
}
break;
case LDLM_CB_CANCELING: {
LBUG();
}
- RETURN(0);
+ return 0;
}
__u32 ll_i2suppgid(struct inode *i)
if (!it_disposition(it, DISP_LOOKUP_NEG)) {
rc = ll_prep_inode(&inode, request, (*de)->d_sb, it);
if (rc)
- RETURN(rc);
+ return rc;
ll_set_lock_data(ll_i2sbi(parent)->ll_md_exp, inode, it, &bits);
}
}
- RETURN(0);
+ return 0;
}
static struct dentry *ll_lookup_it(struct inode *parent, struct dentry *dentry,
int rc;
if (dentry->d_name.len > ll_i2sbi(parent)->ll_namelen)
- RETURN(ERR_PTR(-ENAMETOOLONG));
+ return ERR_PTR(-ENAMETOOLONG);
CDEBUG(D_VFSTRACE, "VFS Op:name=%.*s,dir=%lu/%u(%p),intent=%s\n",
dentry->d_name.len, dentry->d_name.name, parent->i_ino,
rc = ll_inode_revalidate_it(parent->i_sb->s_root, it,
MDS_INODELOCK_LOOKUP);
if (rc)
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
if (it->it_op == IT_GETATTR) {
dentry->d_name.len, lookup_flags, opc,
NULL);
if (IS_ERR(op_data))
- RETURN((void *)op_data);
+ return (void *)op_data;
/* enforce umask if acl disabled or MDS doesn't support umask */
if (!IS_POSIXACL(parent) || !exp_connect_umask(ll_i2mdexp(parent)))
OBD_ALLOC(it, sizeof(*it));
if (!it)
- RETURN(-ENOMEM);
+ return -ENOMEM;
it->it_op = IT_OPEN;
if (mode) {
ll_intent_release(it);
OBD_FREE(it, sizeof(*it));
- RETURN(rc);
+ return rc;
}
rc = it_open_error(DISP_OPEN_CREATE, it);
if (rc)
- RETURN(rc);
+ return rc;
inode = ll_create_node(dir, dentry->d_name.name, dentry->d_name.len,
NULL, 0, mode, 0, it);
if (IS_ERR(inode))
- RETURN(PTR_ERR(inode));
+ return PTR_ERR(inode);
if (filename_is_volatile(dentry->d_name.name, dentry->d_name.len, NULL))
ll_i2info(inode)->lli_volatile = true;
d_instantiate(dentry, inode);
- RETURN(0);
+ return 0;
}
static void ll_update_times(struct ptlrpc_request *request,
if (!err)
ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKNOD, 1);
- RETURN(err);
+ return err;
}
/*
if (!err)
ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_SYMLINK, 1);
- RETURN(err);
+ return err;
}
static int ll_link_generic(struct inode *src, struct inode *dir,
op_data = ll_prep_md_op_data(NULL, src, dir, name->name, name->len,
0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
err = md_link(sbi->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
ll_stats_ops_tally(sbi, LPROC_LL_LINK, 1);
out:
ptlrpc_req_finished(request);
- RETURN(err);
+ return err;
}
static int ll_mkdir_generic(struct inode *dir, struct qstr *name,
if (!err)
ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_MKDIR, 1);
- RETURN(err);
+ return err;
}
/* Try to find the child dentry by its name.
name->len, name->name, dir->i_ino, dir->i_generation, dir);
if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
- RETURN(-EBUSY);
+ return -EBUSY;
op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name, name->len,
S_IFDIR, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
ll_get_child_fid(dir, name, &op_data->op_fid3);
op_data->op_fid2 = op_data->op_fid3;
}
ptlrpc_req_finished(request);
- RETURN(rc);
+ return rc;
}
/**
op_data = ll_prep_md_op_data(NULL, dir, NULL, name, strlen(name),
S_IFDIR, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_cli_flags |= CLI_RM_ENTRY;
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
}
ptlrpc_req_finished(request);
- RETURN(rc);
+ return rc;
}
int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
/* req is swabbed so this is safe */
body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
if (!(body->valid & OBD_MD_FLEASIZE))
- RETURN(0);
+ return 0;
if (body->eadatasize == 0) {
CERROR("OBD_MD_FLEASIZE set but eadatasize zero\n");
* just check it as vfs_unlink does.
*/
if (unlikely(ll_d_mountpoint(dparent, dchild, name)))
- RETURN(-EBUSY);
+ return -EBUSY;
op_data = ll_prep_md_op_data(NULL, dir, NULL, name->name,
name->len, 0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
ll_get_child_fid(dir, name, &op_data->op_fid3);
op_data->op_fid2 = op_data->op_fid3;
rc = ll_objects_destroy(request, dir);
out:
ptlrpc_req_finished(request);
- RETURN(rc);
+ return rc;
}
static int ll_rename_generic(struct inode *src, struct dentry *src_dparent,
if (unlikely(ll_d_mountpoint(src_dparent, src_dchild, src_name) ||
ll_d_mountpoint(tgt_dparent, tgt_dchild, tgt_name)))
- RETURN(-EBUSY);
+ return -EBUSY;
op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
ll_get_child_fid(src, src_name, &op_data->op_fid3);
ll_get_child_fid(tgt, tgt_name, &op_data->op_fid4);
ptlrpc_req_finished(request);
- RETURN(err);
+ return err;
}
static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode,
int found = 0, rc;
if (!lli->lli_remote_perms)
- RETURN(-ENOENT);
+ return -ENOENT;
head = lli->lli_remote_perms +
remote_perm_hashfunc(from_kuid(&init_user_ns, current_uid()));
perm->rp_uid, perm->rp_gid, perm->rp_fsuid,
perm->rp_fsgid, current->uid, current->gid,
current->fsuid, current->fsgid);
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
#endif
perm_hash = alloc_rmtperm_hash();
if (perm_hash == NULL) {
CERROR("alloc lli_remote_perms failed!\n");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
}
lrp = alloc_ll_remote_perm();
if (!lrp) {
CERROR("alloc memory for ll_remote_perm failed!\n");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
spin_lock(&lli->lli_lock);
goto again;
lrp, lrp->lrp_uid, lrp->lrp_gid, lrp->lrp_fsuid, lrp->lrp_fsgid,
lrp->lrp_access_perm);
- RETURN(0);
+ return 0;
}
int lustre_check_remote_perm(struct inode *inode, int mask)
req = NULL;
} while (1);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
#if 0 /* NB: remote perms can't be freed in ll_mdc_blocking_ast of UPDATE lock,
} else {
result = PTR_ERR(lcc);
}
- RETURN(result);
+ return result;
}
int ll_commit_write(struct file *file, struct page *vmpage, unsigned from,
lu_ref_del(&page->cp_reference, "prepare_write", current);
cl_page_put(env, page);
ll_cl_fini(lcc);
- RETURN(result);
+ return result;
}
struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt)
}
out:
- RETURN(ret);
+ return ret;
}
void ll_ra_count_put(struct ll_sb_info *sbi, unsigned long len)
}
lu_ref_del(&page->cp_reference, "ra", current);
cl_page_put(env, page);
- RETURN(rc);
+ return rc;
}
/**
ll_ra_stats_inc(mapping, which);
CDEBUG(D_READA, "%s\n", msg);
}
- RETURN(rc);
+ return rc;
}
#define RIA_DEBUG(ria) \
cl_object_attr_unlock(clob);
if (ret != 0)
- RETURN(ret);
+ return ret;
kms = attr->cat_kms;
if (kms == 0) {
ll_ra_stats_inc(mapping, RA_STAT_ZERO_LEN);
- RETURN(0);
+ return 0;
}
spin_lock(&ras->ras_lock);
if (end == 0) {
ll_ra_stats_inc(mapping, RA_STAT_ZERO_WINDOW);
- RETURN(0);
+ return 0;
}
len = ria_page_count(ria);
if (len == 0)
- RETURN(0);
+ return 0;
reserved = ll_ra_count_get(ll_i2sbi(inode), ria, len);
if (reserved < len)
spin_unlock(&ras->ras_lock);
}
- RETURN(ret);
+ return ret;
}
static void ras_set_start(struct inode *inode, struct ll_readahead_state *ras,
end = i_size_read(inode);
mapping->writeback_index = (end >> PAGE_CACHE_SHIFT) + 1;
}
- RETURN(result);
+ return result;
}
int ll_readpage(struct file *file, struct page *vmpage)
unlock_page(vmpage);
result = PTR_ERR(lcc);
}
- RETURN(result);
+ return result;
}
*/
vvp_write_pending(obj, cpg);
#endif
- RETURN(__set_page_dirty_nobuffers(vmpage));
+ return __set_page_dirty_nobuffers(vmpage);
}
#define MAX_DIRECTIO_SIZE 2*1024*1024*1024UL
cl_2queue_discard(env, io, queue);
cl_2queue_disown(env, io, queue);
cl_2queue_fini(env, queue);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ll_direct_rw_pages);
int refcheck;
if (!lli->lli_has_smd)
- RETURN(-EBADF);
+ return -EBADF;
/* FIXME: io smaller than PAGE_SIZE is broken on ia64 ??? */
if ((file_offset & ~CFS_PAGE_MASK) || (count & ~CFS_PAGE_MASK))
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size=%lu (max %lu), "
"offset=%lld=%llx, pages %lu (max %lu)\n",
for (seg = 0; seg < nr_segs; seg++) {
if (((unsigned long)iov[seg].iov_base & ~CFS_PAGE_MASK) ||
(iov[seg].iov_len & ~CFS_PAGE_MASK))
- RETURN(-EINVAL);
+ return -EINVAL;
}
env = cl_env_get(&refcheck);
}
cl_env_put(env, &refcheck);
- RETURN(tot_bytes ? : result);
+ return tot_bytes ? : result;
}
static int ll_write_begin(struct file *file, struct address_space *mapping,
page = grab_cache_page_write_begin(mapping, index, flags);
if (!page)
- RETURN(-ENOMEM);
+ return -ENOMEM;
*pagep = page;
unlock_page(page);
page_cache_release(page);
}
- RETURN(rc);
+ return rc;
}
static int ll_write_end(struct file *file, struct address_space *mapping,
entry_size = sizeof(struct ll_sa_entry) + (len & ~3) + 4;
OBD_ALLOC(entry, entry_size);
if (unlikely(entry == NULL))
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
CDEBUG(D_READA, "alloc sa entry %.*s(%p) index "LPU64"\n",
len, name, entry, index);
atomic_inc(&sai->sai_cache_count);
- RETURN(entry);
+ return entry;
}
/*
OBD_ALLOC_PTR(sai);
if (!sai)
- RETURN(NULL);
+ return NULL;
atomic_set(&sai->sai_refcount, 1);
}
atomic_set(&sai->sai_cache_count, 0);
- RETURN(sai);
+ return sai;
}
static inline struct ll_statahead_info *
rc = sa_args_init(dir, NULL, entry, &minfo, &einfo, capas);
if (rc)
- RETURN(rc);
+ return rc;
rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
if (!rc) {
sa_args_fini(minfo, einfo);
}
- RETURN(rc);
+ return rc;
}
/**
int rc;
if (unlikely(inode == NULL))
- RETURN(1);
+ return 1;
if (d_mountpoint(dentry))
- RETURN(1);
+ return 1;
if (unlikely(dentry == dentry->d_sb->s_root))
- RETURN(1);
+ return 1;
entry->se_inode = igrab(inode);
rc = md_revalidate_lock(ll_i2mdexp(dir), &it, ll_inode2fid(inode),NULL);
if (rc == 1) {
entry->se_handle = it.d.lustre.it_lock_handle;
ll_intent_release(&it);
- RETURN(1);
+ return 1;
}
rc = sa_args_init(dir, inode, entry, &minfo, &einfo, capas);
if (rc) {
entry->se_inode = NULL;
iput(inode);
- RETURN(rc);
+ return rc;
}
rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
sa_args_fini(minfo, einfo);
}
- RETURN(rc);
+ return rc;
}
static void ll_statahead_one(struct dentry *parent, const char* entry_name,
ll_sai_put(sai);
CDEBUG(D_READA, "agl thread stopped: [pid %d] [parent %.*s]\n",
current_pid(), parent->d_name.len, parent->d_name.name);
- RETURN(0);
+ return 0;
}
static void ll_start_agl(struct dentry *parent, struct ll_statahead_info *sai)
list_empty(&sai->sai_entries_stated))) {
/* to release resource */
ll_stop_statahead(dir, lli->lli_opendir_key);
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
if ((*dentryp)->d_name.name[0] == '.') {
* "sai_ls_all" enabled as above.
*/
sai->sai_miss_hidden++;
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
}
entry = ll_sa_entry_get_byname(sai, &(*dentryp)->d_name);
if (entry == NULL || only_unplug) {
ll_sai_unplug(sai, entry);
- RETURN(entry ? 1 : -EAGAIN);
+ return entry ? 1 : -EAGAIN;
}
/* if statahead is busy in readdir, help it do post-work */
&lwi);
if (rc < 0) {
ll_sai_unplug(sai, entry);
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
}
inode->i_ino,
inode->i_generation);
ll_sai_unplug(sai, entry);
- RETURN(-ESTALE);
+ return -ESTALE;
} else {
iput(inode);
}
}
ll_sai_unplug(sai, entry);
- RETURN(rc);
+ return rc;
}
/* I am the "lli_opendir_pid" owner, only me can set "lli_sai". */
thread_set_flags(&sai->sai_agl_thread, SVC_STOPPED);
ll_sai_put(sai);
LASSERT(lli->lli_sai == NULL);
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
l_wait_event(thread->t_ctl_waitq,
* We don't stat-ahead for the first dirent since we are already in
* lookup.
*/
- RETURN(-EAGAIN);
+ return -EAGAIN;
out:
if (sai != NULL)
CDEBUG(D_INODE, "using cached symlink %s%.*s, len = %d\n",
print_limit < symlen ? "..." : "", print_limit,
(*symname) + symlen - print_limit, symlen);
- RETURN(0);
+ return 0;
}
op_data = ll_prep_md_op_data(NULL, inode, NULL, NULL, 0, symlen,
LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
- RETURN(PTR_ERR(op_data));
+ return PTR_ERR(op_data);
op_data->op_valid = OBD_MD_LINKNAME;
rc = md_getattr(sbi->ll_md_exp, op_data, request);
memcpy(lli->lli_symlink_name, *symname, symlen);
*symname = lli->lli_symlink_name;
}
- RETURN(0);
+ return 0;
failed:
- RETURN (rc);
+ return rc;
}
static int ll_readlink(struct dentry *dentry, char *buffer, int buflen)
out:
ptlrpc_req_finished(request);
ll_inode_size_unlock(inode);
- RETURN(rc);
+ return rc;
}
static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd)
/* symname may contain a pointer to the request message buffer,
* we delay request releasing until ll_put_link then.
*/
- RETURN(request);
+ return request;
}
static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void *cookie)
cl_env_put(env, &refcheck);
} else
rc = PTR_ERR(env);
- RETURN(rc);
+ return rc;
}
int cl_sb_fini(struct super_block *sb)
* automatically when last device is destroyed).
*/
lu_types_stop();
- RETURN(result);
+ return result;
}
/****************************************************************************
LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE);
if (!cl_is_normalio(env, io))
- RETURN(0);
+ return 0;
if (vio->cui_iov == NULL) /* nfs or loop back device write */
- RETURN(0);
+ return 0;
/* No MM (e.g. NFS)? No vmas too. */
if (mm == NULL)
- RETURN(0);
+ return 0;
for (seg = 0; seg < vio->cui_nrsegs; seg++) {
const struct iovec *iv = &vio->cui_iov[seg];
descr->cld_end);
if (result < 0)
- RETURN(result);
+ return result;
if (vma->vm_end - addr >= count)
break;
}
up_read(&mm->mmap_sem);
}
- RETURN(0);
+ return 0;
}
static int vvp_io_rw_lock(const struct lu_env *env, struct cl_io *io,
result = vvp_mmap_locks(env, cio, io);
if (result == 0)
result = ccc_io_one_lock(env, io, ast_flags, mode, start, end);
- RETURN(result);
+ return result;
}
static int vvp_io_read_lock(const struct lu_env *env,
io->u.ci_rd.rd.crw_count - 1);
else
result = 0;
- RETURN(result);
+ return result;
}
static int vvp_io_fault_lock(const struct lu_env *env,
cio->cui_fd, pos, result, WRITE);
result = 0;
}
- RETURN(result);
+ return result;
}
static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
rc == -ENODATA ? "without a lock" :
"match failed", rc);
if (rc != -ENODATA)
- RETURN(rc);
+ return rc;
}
if (cp->cpg_defer_uptodate) {
ll_readahead(env, io, ras,
vmpage->mapping, &queue->c2_qin, fd->fd_flags);
- RETURN(0);
+ return 0;
}
static int vvp_page_sync_io(const struct lu_env *env, struct cl_io *io,
pg, cp, from, to);
} else
CL_PAGE_HEADER(D_PAGE, env, pg, "uptodate\n");
- RETURN(result);
+ return result;
}
static int vvp_io_commit_write(const struct lu_env *env,
cl_page_discard(env, io, pg);
}
ll_inode_size_unlock(inode);
- RETURN(result);
+ return result;
}
static const struct cl_io_operations vvp_io_ops = {
PFID(lu_object_fid(&obj->co_lu)), result);
}
- RETURN(result);
+ return result;
}
static struct vvp_io *cl2vvp_io(const struct lu_env *env,
{
struct ccc_object *cob = cl2ccc(slice->cls_obj);
- RETURN(atomic_read(&cob->cob_mmap_cnt) > 0 ? ~0UL >> 2 : 0);
+ return atomic_read(&cob->cob_mmap_cnt) > 0 ? ~0UL >> 2 : 0;
}
static const struct cl_lock_operations vvp_lock_ops = {
struct cl_io *unused)
{
/* Skip the page already marked as PG_uptodate. */
- RETURN(PageUptodate(cl2vm_page(slice)) ? -EALREADY : 0);
+ return PageUptodate(cl2vm_page(slice)) ? -EALREADY : 0;
}
static int vvp_page_prep_write(const struct lu_env *env,
LBUG();
}
unlock_page(vmpage);
- RETURN(result);
+ return result;
}
static int vvp_page_print(const struct lu_env *env,
xattr_type = get_xattr_type(name);
rc = xattr_type_filter(sbi, xattr_type);
if (rc)
- RETURN(rc);
+ return rc;
/* b10667: ignore lustre special xattr for now */
if ((xattr_type == XATTR_TRUSTED_T && strcmp(name, "trusted.lov") == 0) ||
(xattr_type == XATTR_LUSTRE_T && strcmp(name, "lustre.lov") == 0))
- RETURN(0);
+ return 0;
/* b15587: ignore security.capability xattr for now */
if ((xattr_type == XATTR_SECURITY_T &&
strcmp(name, "security.capability") == 0))
- RETURN(0);
+ return 0;
/* LU-549: Disable security.selinux when selinux is disabled */
if (xattr_type == XATTR_SECURITY_T && !selinux_is_enabled() &&
strcmp(name, "security.selinux") == 0)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
#ifdef CONFIG_FS_POSIX_ACL
if (sbi->ll_flags & LL_SBI_RMT_CLIENT &&
if (rce == NULL ||
(rce->rce_ops != RMT_LSETFACL &&
rce->rce_ops != RMT_RSETFACL))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (rce->rce_ops == RMT_LSETFACL) {
struct eacl_entry *ee;
size, ee->ee_acl);
if (IS_ERR(acl)) {
ee_free(ee);
- RETURN(PTR_ERR(acl));
+ return PTR_ERR(acl);
}
size = CFS_ACL_XATTR_SIZE(\
le32_to_cpu(acl->a_count), \
(posix_acl_xattr_header *)value,
size, &new_value);
if (unlikely(size < 0))
- RETURN(size);
+ return size;
pv = (const char *)new_value;
} else
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
valid |= rce_ops2valid(rce->rce_ops);
}
"it is not supported on the server\n");
sbi->ll_flags &= ~LL_SBI_USER_XATTR;
}
- RETURN(rc);
+ return rc;
}
ptlrpc_req_finished(req);
- RETURN(0);
+ return 0;
}
int ll_setxattr(struct dentry *dentry, const char *name,
xattr_type = get_xattr_type(name);
rc = xattr_type_filter(sbi, xattr_type);
if (rc)
- RETURN(rc);
+ return rc;
/* b15587: ignore security.capability xattr for now */
if ((xattr_type == XATTR_SECURITY_T &&
strcmp(name, "security.capability") == 0))
- RETURN(-ENODATA);
+ return -ENODATA;
/* LU-549: Disable security.selinux when selinux is disabled */
if (xattr_type == XATTR_SECURITY_T && !selinux_is_enabled() &&
strcmp(name, "security.selinux") == 0)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
#ifdef CONFIG_FS_POSIX_ACL
if (sbi->ll_flags & LL_SBI_RMT_CLIENT &&
rce->rce_ops != RMT_LGETFACL &&
rce->rce_ops != RMT_RSETFACL &&
rce->rce_ops != RMT_RGETFACL))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
}
/* posix acl is under protection of LOOKUP lock. when calling to this,
spin_unlock(&lli->lli_lock);
if (!acl)
- RETURN(-ENODATA);
+ return -ENODATA;
rc = posix_acl_to_xattr(&init_user_ns, acl, buffer, size);
posix_acl_release(acl);
- RETURN(rc);
+ return rc;
}
if (xattr_type == XATTR_ACL_DEFAULT_T && !S_ISDIR(inode->i_mode))
- RETURN(-ENODATA);
+ return -ENODATA;
#endif
do_getxattr:
"it is not supported on the server\n");
sbi->ll_flags &= ~LL_SBI_USER_XATTR;
}
- RETURN(rc);
+ return rc;
}
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (rc) {
CERROR("Error while looking for mds number. Seq "LPX64
", err = %d\n", fid_seq(fid), rc);
- RETURN(rc);
+ return rc;
}
CDEBUG(D_INODE, "FLD lookup got mds #%x for fid="DFID"\n",
PFID(fid));
rc = -EINVAL;
}
- RETURN(rc);
+ return rc;
}
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
if (body == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
LASSERT((body->valid & OBD_MD_MDS));
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
/* If it is ready to open the file by FID, do not need
* allocate FID at all, otherwise it will confuse MDT */
op_data->op_fid3 = op_data->op_fid2;
rc = lmv_fid_alloc(exp, &op_data->op_fid2, op_data);
if (rc != 0)
- RETURN(rc);
+ return rc;
}
CDEBUG(D_INODE, "OPEN_INTENT with fid1="DFID", fid2="DFID","
rc = md_intent_lock(tgt->ltd_exp, op_data, lmm, lmmsize, it, flags,
reqp, cb_blocking, extra_lock_flags);
if (rc != 0)
- RETURN(rc);
+ return rc;
/*
* Nothing is found, do not access body->fid1 as it is zero and thus
* pointless.
if ((it->d.lustre.it_disposition & DISP_LOOKUP_NEG) &&
!(it->d.lustre.it_disposition & DISP_OPEN_CREATE) &&
!(it->d.lustre.it_disposition & DISP_OPEN_OPEN))
- RETURN(rc);
+ return rc;
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
if (body == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
/*
* Not cross-ref case, just get out of here.
*/
if (likely(!(body->valid & OBD_MD_MDS)))
- RETURN(0);
+ return 0;
/*
* Okay, MDS has returned success. Probably name has been resolved in
"%*s: %d\n", LL_IT2STR(it), PFID(&op_data->op_fid2),
PFID(&op_data->op_fid1), op_data->op_namelen,
op_data->op_name, rc);
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
/*
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
if (!fid_is_sane(&op_data->op_fid2))
fid_zero(&op_data->op_fid2);
flags, reqp, cb_blocking, extra_lock_flags);
if (rc < 0 || *reqp == NULL)
- RETURN(rc);
+ return rc;
/*
* MDS has returned success. Probably name has been resolved in
*/
body = req_capsule_server_get(&(*reqp)->rq_pill, &RMF_MDT_BODY);
if (body == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
/* Not cross-ref case, just get out of here. */
if (likely(!(body->valid & OBD_MD_MDS)))
- RETURN(0);
+ return 0;
rc = lmv_intent_remote(exp, lmm, lmmsize, it, NULL, flags, reqp,
cb_blocking, extra_lock_flags);
- RETURN(rc);
+ return rc;
}
int lmv_intent_lock(struct obd_export *exp, struct md_op_data *op_data,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
if (it->it_op & (IT_LOOKUP | IT_GETATTR | IT_LAYOUT))
rc = lmv_intent_lookup(exp, op_data, lmm, lmmsize, it,
extra_lock_flags);
else
LBUG();
- RETURN(rc);
+ return rc;
}
CERROR("unexpected notification of %s %s!\n",
watched->obd_type->typ_name,
watched->obd_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
uuid = &watched->u.cli.cl_target_uuid;
CERROR("%sactivation of %s failed: %d\n",
ev == OBD_NOTIFY_ACTIVE ? "" : "de",
uuid->uuid, rc);
- RETURN(rc);
+ return rc;
}
} else if (ev == OBD_NOTIFY_OCD) {
conn_data = &watched->u.cli.cl_import->imp_connect_data;
if (obd->obd_observer)
rc = obd_notify(obd->obd_observer, watched, ev, data);
- RETURN(rc);
+ return rc;
}
/**
lmv->refcount++;
if (lmv->refcount > 1) {
*exp = NULL;
- RETURN(0);
+ return 0;
}
rc = class_connect(&conn, obd, cluuid);
if (rc) {
CERROR("class_connection() returned %d\n", rc);
- RETURN(rc);
+ return rc;
}
*exp = class_conn2export(&conn);
obd->obd_proc_private = NULL;
}
- RETURN(rc);
+ return rc;
}
static void lmv_set_timeouts(struct obd_device *obd)
change = 1;
}
if (change == 0)
- RETURN(0);
+ return 0;
if (lmv->connected == 0)
- RETURN(0);
+ return 0;
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
if (lmv->tgts[i] == NULL ||
break;
}
}
- RETURN(rc);
+ return rc;
}
#define MAX_STRING_SIZE 128
&obd->obd_uuid);
if (!mdc_obd) {
CERROR("target %s not attached\n", tgt->ltd_uuid.uuid);
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_CONFIG, "connect to %s(%s) - %s, %s FOR %s\n",
if (!mdc_obd->obd_set_up) {
CERROR("target %s is not set up\n", tgt->ltd_uuid.uuid);
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = obd_connect(NULL, &mdc_exp, mdc_obd, &lmv_mdc_uuid,
&lmv->conn_data, NULL);
if (rc) {
CERROR("target %s connect error %d\n", tgt->ltd_uuid.uuid, rc);
- RETURN(rc);
+ return rc;
}
/*
*/
rc = obd_fid_init(mdc_obd, mdc_exp, LUSTRE_SEQ_METADATA);
if (rc)
- RETURN(rc);
+ return rc;
target.ft_srv = NULL;
target.ft_exp = mdc_exp;
obd_disconnect(mdc_exp);
CERROR("target %s register_observer error %d\n",
tgt->ltd_uuid.uuid, rc);
- RETURN(rc);
+ return rc;
}
if (obd->obd_observer) {
(void *)(tgt - lmv->tgts[0]));
if (rc) {
obd_disconnect(mdc_exp);
- RETURN(rc);
+ return rc;
}
}
obd->obd_proc_private = NULL;
}
}
- RETURN(0);
+ return 0;
}
static void lmv_del_target(struct lmv_obd *lmv, int index)
lmv_init_unlock(lmv);
CERROR("%s: Target %s not attached: rc = %d\n",
obd->obd_name, uuidp->uuid, -EINVAL);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
" rc = %d\n", obd->obd_name,
obd_uuid2str(&tgt->ltd_uuid), index, -EEXIST);
lmv_init_unlock(lmv);
- RETURN(-EEXIST);
+ return -EEXIST;
}
if (index >= lmv->tgts_size) {
OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
if (newtgts == NULL) {
lmv_init_unlock(lmv);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (lmv->tgts_size) {
OBD_ALLOC_PTR(tgt);
if (!tgt) {
lmv_init_unlock(lmv);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mutex_init(&tgt->ltd_fid_mutex);
}
lmv_init_unlock(lmv);
- RETURN(rc);
+ return rc;
}
int lmv_check_connect(struct obd_device *obd)
int easize;
if (lmv->connected)
- RETURN(0);
+ return 0;
lmv_init_lock(lmv);
if (lmv->connected) {
lmv_init_unlock(lmv);
- RETURN(0);
+ return 0;
}
if (lmv->desc.ld_tgt_count == 0) {
lmv_init_unlock(lmv);
CERROR("%s: no targets configured.\n", obd->obd_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_CONFIG, "Time to connect %s to %s\n",
easize = lmv_get_easize(lmv);
lmv_init_ea_size(obd->obd_self_export, easize, 0, 0);
lmv_init_unlock(lmv);
- RETURN(0);
+ return 0;
out_disc:
while (i-- > 0) {
}
class_disconnect(lmv->exp);
lmv_init_unlock(lmv);
- RETURN(rc);
+ return rc;
}
static int lmv_disconnect_mdc(struct obd_device *obd, struct lmv_tgt_desc *tgt)
lmv_activate_target(lmv, tgt, 0);
tgt->ltd_exp = NULL;
- RETURN(0);
+ return 0;
}
static int lmv_disconnect(struct obd_export *exp)
rc = class_disconnect(exp);
if (lmv->refcount == 0)
lmv->connected = 0;
- RETURN(rc);
+ return rc;
}
static int lmv_fid2path(struct obd_export *exp, int len, void *karg, void *uarg)
gf = (struct getinfo_fid2path *)karg;
tgt = lmv_find_target(lmv, &gf->gf_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
repeat_fid2path:
rc = obd_iocontrol(OBD_IOC_FID2PATH, tgt->ltd_exp, len, gf, uarg);
out_fid2path:
if (remote_gf != NULL)
OBD_FREE(remote_gf, remote_gf_size);
- RETURN(rc);
+ return rc;
}
static int lmv_hsm_req_count(struct lmv_obd *lmv,
* and will unregister automatically.
*/
rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
- RETURN(rc);
+ return rc;
}
static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
obd_iocontrol(cmd,
lmv->tgts[j]->ltd_exp,
len, lk, uarg);
- RETURN(rc);
+ return rc;
}
/* else: transient error.
* kuc will register to the missing MDT
if (!any_set)
/* no registration done: return error */
- RETURN(-ENOTCONN);
+ return -ENOTCONN;
/* at least one registration done, with no failure */
filp = fget(lk->lk_wfd);
if (filp == NULL) {
- RETURN(-EBADF);
+ return -EBADF;
}
rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, lk->lk_data);
if (rc != 0 && filp != NULL)
fput(filp);
- RETURN(rc);
+ return rc;
}
int count = lmv->desc.ld_tgt_count;
if (count == 0)
- RETURN(-ENOTTY);
+ return -ENOTTY;
switch (cmd) {
case IOC_OBD_STATFS: {
memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
if ((index >= count))
- RETURN(-ENODEV);
+ return -ENODEV;
if (lmv->tgts[index] == NULL ||
lmv->tgts[index]->ltd_active == 0)
- RETURN(-ENODATA);
+ return -ENODATA;
mdc_obd = class_exp2obd(lmv->tgts[index]->ltd_exp);
if (!mdc_obd)
- RETURN(-EINVAL);
+ return -EINVAL;
/* copy UUID */
if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(mdc_obd),
min((int) data->ioc_plen2,
(int) sizeof(struct obd_uuid))))
- RETURN(-EFAULT);
+ return -EFAULT;
rc = obd_statfs(NULL, lmv->tgts[index]->ltd_exp, &stat_buf,
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
0);
if (rc)
- RETURN(rc);
+ return rc;
if (copy_to_user(data->ioc_pbuf1, &stat_buf,
min((int) data->ioc_plen1,
(int) sizeof(stat_buf))))
- RETURN(-EFAULT);
+ return -EFAULT;
break;
}
case OBD_IOC_QUOTACTL: {
if (qctl->qc_valid == QC_MDTIDX) {
if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
- RETURN(-EINVAL);
+ return -EINVAL;
tgt = lmv->tgts[qctl->qc_idx];
if (tgt == NULL || tgt->ltd_exp == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
} else if (qctl->qc_valid == QC_UUID) {
for (i = 0; i < count; i++) {
tgt = lmv->tgts[i];
continue;
if (tgt->ltd_exp == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
break;
}
} else {
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (i >= count)
- RETURN(-EAGAIN);
+ return -EAGAIN;
LASSERT(tgt && tgt->ltd_exp);
OBD_ALLOC_PTR(oqctl);
if (!oqctl)
- RETURN(-ENOMEM);
+ return -ENOMEM;
QCTL_COPY(oqctl, qctl);
rc = obd_quotactl(tgt->ltd_exp, oqctl);
struct ioc_changelog *icc = karg;
if (icc->icc_mdtindex >= count)
- RETURN(-ENODEV);
+ return -ENODEV;
if (lmv->tgts[icc->icc_mdtindex] == NULL ||
lmv->tgts[icc->icc_mdtindex]->ltd_exp == NULL ||
lmv->tgts[icc->icc_mdtindex]->ltd_active == 0)
- RETURN(-ENODEV);
+ return -ENODEV;
rc = obd_iocontrol(cmd, lmv->tgts[icc->icc_mdtindex]->ltd_exp,
sizeof(*icc), icc, NULL);
break;
}
case LL_IOC_GET_CONNECT_FLAGS: {
if (lmv->tgts[0] == NULL)
- RETURN(-ENODATA);
+ return -ENODATA;
rc = obd_iocontrol(cmd, lmv->tgts[0]->ltd_exp, len, karg, uarg);
break;
}
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
if (tgt->ltd_exp == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
break;
tgt = lmv_find_target(lmv, &hpk->hpk_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
break;
}
unsigned int reqcount = hur->hur_request.hr_itemcount;
if (reqcount == 0)
- RETURN(0);
+ return 0;
/* if the request is about a single fid
* or if there is a single MDS, no need to split
tgt = lmv_find_target(lmv,
&hur->hur_user_item[0].hui_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = obd_iocontrol(cmd, tgt->ltd_exp, len, karg, uarg);
} else {
/* split fid list to their respective MDS */
+ hur->hur_request.hr_data_len;
OBD_ALLOC_LARGE(req, reqlen);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lmv_hsm_req_build(lmv, hur, lmv->tgts[i], req);
tgt1 = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt1))
- RETURN(PTR_ERR(tgt1));
+ return PTR_ERR(tgt1);
tgt2 = lmv_find_target(lmv, &op_data->op_fid2);
if (IS_ERR(tgt2))
- RETURN(PTR_ERR(tgt2));
+ return PTR_ERR(tgt2);
if ((tgt1->ltd_exp == NULL) || (tgt2->ltd_exp == NULL))
- RETURN(-EINVAL);
+ return -EINVAL;
/* only files on same MDT can have their layouts swapped */
if (tgt1->ltd_idx != tgt2->ltd_idx)
- RETURN(-EPERM);
+ return -EPERM;
rc = obd_iocontrol(cmd, tgt1->ltd_exp, len, karg, uarg);
break;
err = obd_iocontrol(cmd, lmv->tgts[i]->ltd_exp, len,
karg, uarg);
if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) {
- RETURN(err);
+ return err;
} else if (err) {
if (lmv->tgts[i]->ltd_active) {
CERROR("error: iocontrol MDC %s on MDT"
if (!set && !rc)
rc = -EIO;
}
- RETURN(rc);
+ return rc;
}
#if 0
if (lmv->desc.ld_tgt_count == 1) {
*mds = 0;
- RETURN(0);
+ return 0;
}
/**
" rc = %d\n", obd->obd_name,
lum->lum_stripe_offset,
lmv->desc.ld_tgt_count, -ERANGE);
- RETURN(-ERANGE);
+ return -ERANGE;
}
*mds = lum->lum_stripe_offset;
- RETURN(0);
+ return 0;
}
}
/* Allocate new fid on target according to operation type and parent
* home mds. */
*mds = op_data->op_mds;
- RETURN(0);
+ return 0;
}
int __lmv_fid_alloc(struct lmv_obd *lmv, struct lu_fid *fid,
tgt = lmv_get_target(lmv, mds);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
/*
* New seq alloc and FLD setup should be atomic. Otherwise we may find
if (rc) {
CERROR("Can't get target for allocating fid, "
"rc %d\n", rc);
- RETURN(rc);
+ return rc;
}
rc = __lmv_fid_alloc(lmv, fid, mds);
if (rc) {
CERROR("Can't alloc new fid, rc %d\n", rc);
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
static int lmv_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("LMV setup requires a descriptor\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
desc = (struct lmv_desc *)lustre_cfg_buf(lcfg, 1);
if (sizeof(*desc) > LUSTRE_CFG_BUFLEN(lcfg, 1)) {
CERROR("Lmv descriptor size wrong: %d > %d\n",
(int)sizeof(*desc), LUSTRE_CFG_BUFLEN(lcfg, 1));
- RETURN(-EINVAL);
+ return -EINVAL;
}
OBD_ALLOC(lmv->tgts, sizeof(*lmv->tgts) * 32);
if (lmv->tgts == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lmv->tgts_size = 32;
obd_str2uuid(&lmv->desc.ld_uuid, desc->ld_uuid.uuid);
GOTO(out, rc);
}
- RETURN(0);
+ return 0;
out:
return rc;
OBD_FREE(lmv->tgts, sizeof(*lmv->tgts) * lmv->tgts_size);
lmv->tgts_size = 0;
}
- RETURN(0);
+ return 0;
}
static int lmv_process_config(struct obd_device *obd, obd_count len, void *buf)
GOTO(out, rc = -EINVAL);
}
out:
- RETURN(rc);
+ return rc;
}
static int lmv_statfs(const struct lu_env *env, struct obd_export *exp,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
OBD_ALLOC(temp, sizeof(*temp));
if (temp == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
if (lmv->tgts[i] == NULL || lmv->tgts[i]->ltd_exp == NULL)
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
rc = md_getstatus(lmv->tgts[0]->ltd_exp, fid, pc);
- RETURN(rc);
+ return rc;
}
static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_getxattr(tgt->ltd_exp, fid, oc, valid, name, input,
input_size, output_size, flags, request);
- RETURN(rc);
+ return rc;
}
static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_setxattr(tgt->ltd_exp, fid, oc, valid, name, input,
input_size, output_size, flags, suppgid,
request);
- RETURN(rc);
+ return rc;
}
static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
if (op_data->op_flags & MF_GET_MDT_IDX) {
op_data->op_mds = tgt->ltd_idx;
- RETURN(0);
+ return 0;
}
rc = md_getattr(tgt->ltd_exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static int lmv_null_inode(struct obd_export *exp, const struct lu_fid *fid)
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "CBDATA for "DFID"\n", PFID(fid));
md_null_inode(lmv->tgts[i]->ltd_exp, fid);
}
- RETURN(0);
+ return 0;
}
static int lmv_find_cbdata(struct obd_export *exp, const struct lu_fid *fid,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "CBDATA for "DFID"\n", PFID(fid));
continue;
rc = md_find_cbdata(lmv->tgts[i]->ltd_exp, fid, it, data);
if (rc)
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
CDEBUG(D_INODE, "CLOSE "DFID"\n", PFID(&op_data->op_fid1));
rc = md_close(tgt->ltd_exp, op_data, mod, request);
- RETURN(rc);
+ return rc;
}
struct lmv_tgt_desc
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
if (!lmv->desc.ld_active_tgt_count)
- RETURN(-EIO);
+ return -EIO;
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = lmv_fid_alloc(exp, &op_data->op_fid2, op_data);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "CREATE '%*s' on "DFID" -> mds #%x\n",
op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1),
if (rc == 0) {
if (*request == NULL)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "Created - "DFID"\n", PFID(&op_data->op_fid2));
}
- RETURN(rc);
+ return rc;
}
static int lmv_done_writing(struct obd_export *exp,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_done_writing(tgt->ltd_exp, op_data, mod);
- RETURN(rc);
+ return rc;
}
static int
LASSERT(body != NULL);
if (!(body->valid & OBD_MD_MDS))
- RETURN(0);
+ return 0;
CDEBUG(D_INODE, "REMOTE_ENQUEUE '%s' on "DFID" -> "DFID"\n",
LL_IT2STR(it), PFID(&op_data->op_fid1), PFID(&body->fid1));
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "ENQUEUE '%s' on "DFID"\n",
LL_IT2STR(it), PFID(&op_data->op_fid1));
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
CDEBUG(D_INODE, "ENQUEUE '%s' on "DFID" -> mds #%d\n",
LL_IT2STR(it), PFID(&op_data->op_fid1), tgt->ltd_idx);
rc = lmv_enqueue_remote(exp, einfo, it, op_data, lockh,
lmm, lmmsize, extra_lock_flags);
}
- RETURN(rc);
+ return rc;
}
static int
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
CDEBUG(D_INODE, "GETATTR_NAME for %*s on "DFID" -> mds #%d\n",
op_data->op_namelen, op_data->op_name, PFID(&op_data->op_fid1),
rc = md_getattr_name(tgt->ltd_exp, op_data, request);
if (rc != 0)
- RETURN(rc);
+ return rc;
body = req_capsule_server_get(&(*request)->rq_pill,
&RMF_MDT_BODY);
tgt = lmv_find_target(lmv, &rid);
if (IS_ERR(tgt)) {
ptlrpc_req_finished(*request);
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
}
op_data->op_fid1 = rid;
*request = req;
}
- RETURN(rc);
+ return rc;
}
#define md_op_data_fid(op_data, fl) \
int rc = 0;
if (!fid_is_sane(fid))
- RETURN(0);
+ return 0;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
if (tgt->ltd_idx != op_tgt) {
CDEBUG(D_INODE, "EARLY_CANCEL on "DFID"\n", PFID(fid));
rc = 0;
}
- RETURN(rc);
+ return rc;
}
/*
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
LASSERT(op_data->op_namelen != 0);
op_data->op_cap = cfs_curproc_cap_pack();
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
/*
* Cancel UPDATE lock on child (fid1).
rc = lmv_early_cancel(exp, op_data, tgt->ltd_idx, LCK_EX,
MDS_INODELOCK_UPDATE, MF_MDC_CANCEL_FID1);
if (rc != 0)
- RETURN(rc);
+ return rc;
rc = md_link(tgt->ltd_exp, op_data, request);
- RETURN(rc);
+ return rc;
}
static int lmv_rename(struct obd_export *exp, struct md_op_data *op_data,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
op_data->op_cap = cfs_curproc_cap_pack();
src_tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(src_tgt))
- RETURN(PTR_ERR(src_tgt));
+ return PTR_ERR(src_tgt);
tgt_tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid2);
if (IS_ERR(tgt_tgt))
- RETURN(PTR_ERR(tgt_tgt));
+ return PTR_ERR(tgt_tgt);
/*
* LOOKUP lock on src child (fid3) should also be cancelled for
* src_tgt in mdc_rename.
if (rc == 0)
rc = md_rename(src_tgt->ltd_exp, op_data, old, oldlen,
new, newlen, request);
- RETURN(rc);
+ return rc;
}
static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "SETATTR for "DFID", valid 0x%x\n",
PFID(&op_data->op_fid1), op_data->op_attr.ia_valid);
op_data->op_flags |= MF_MDC_CANCEL_FID1;
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_setattr(tgt->ltd_exp, op_data, ea, ealen, ea2,
ea2len, request, mod);
- RETURN(rc);
+ return rc;
}
static int lmv_sync(struct obd_export *exp, const struct lu_fid *fid,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_sync(tgt->ltd_exp, fid, oc, request);
- RETURN(rc);
+ return rc;
}
/*
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "READPAGE at "LPX64" from "DFID"\n",
offset, PFID(&op_data->op_fid1));
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_readpage(tgt->ltd_exp, op_data, pages, request);
if (rc != 0)
- RETURN(rc);
+ return rc;
ncfspgs = ((*request)->rq_bulk->bd_nob_transferred + PAGE_CACHE_SIZE - 1)
>> PAGE_CACHE_SHIFT;
lmv_adjust_dirpages(pages, ncfspgs, nlupgs);
- RETURN(rc);
+ return rc;
}
static int lmv_unlink(struct obd_export *exp, struct md_op_data *op_data,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
retry:
/* Send unlink requests to the MDT where the child is located */
if (likely(!fid_is_zero(&op_data->op_fid2)))
else
tgt = lmv_locate_mds(lmv, op_data, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
op_data->op_fsuid = from_kuid(&init_user_ns, current_fsuid());
op_data->op_fsgid = from_kgid(&init_user_ns, current_fsgid());
MDS_INODELOCK_FULL, MF_MDC_CANCEL_FID3);
if (rc != 0)
- RETURN(rc);
+ return rc;
CDEBUG(D_INODE, "unlink with fid="DFID"/"DFID" -> mds #%d\n",
PFID(&op_data->op_fid1), PFID(&op_data->op_fid2), tgt->ltd_idx);
rc = md_unlink(tgt->ltd_exp, op_data, request);
if (rc != 0 && rc != -EREMOTE)
- RETURN(rc);
+ return rc;
body = req_capsule_server_get(&(*request)->rq_pill, &RMF_MDT_BODY);
if (body == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
/* Not cross-ref case, just get out of here. */
if (likely(!(body->valid & OBD_MD_MDS)))
- RETURN(0);
+ return 0;
CDEBUG(D_INODE, "%s: try unlink to another MDT for "DFID"\n",
exp->exp_obd->obd_name, PFID(&body->fid1));
default:
break;
}
- RETURN(rc);
+ return rc;
}
static int lmv_get_info(const struct lu_env *env, struct obd_export *exp,
if (obd == NULL) {
CDEBUG(D_IOCTL, "Invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
+ return -EINVAL;
}
lmv = &obd->u.lmv;
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
LASSERT(*vallen == sizeof(__u32));
for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
if (!obd_get_info(env, tgt->ltd_exp, keylen, key,
vallen, val, NULL))
- RETURN(0);
+ return 0;
}
- RETURN(-EINVAL);
+ return -EINVAL;
} else if (KEY_IS(KEY_MAX_EASIZE) || KEY_IS(KEY_CONN_DATA)) {
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
/*
* Forwarding this request to first MDS, it should know LOV
vallen, val, NULL);
if (!rc && KEY_IS(KEY_CONN_DATA))
exp->exp_connect_data = *(struct obd_connect_data *)val;
- RETURN(rc);
+ return rc;
} else if (KEY_IS(KEY_TGT_COUNT)) {
*((int *)val) = lmv->desc.ld_tgt_count;
- RETURN(0);
+ return 0;
}
CDEBUG(D_IOCTL, "Invalid key\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
int lmv_set_info_async(const struct lu_env *env, struct obd_export *exp,
if (obd == NULL) {
CDEBUG(D_IOCTL, "Invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
+ return -EINVAL;
}
lmv = &obd->u.lmv;
rc = err;
}
- RETURN(rc);
+ return rc;
}
- RETURN(-EINVAL);
+ return -EINVAL;
}
int lmv_packmd(struct obd_export *exp, struct lov_mds_md **lmmp,
mea_size = lmv_get_easize(lmv);
if (!lmmp)
- RETURN(mea_size);
+ return mea_size;
if (*lmmp && !lsm) {
OBD_FREE_LARGE(*lmmp, mea_size);
*lmmp = NULL;
- RETURN(0);
+ return 0;
}
if (*lmmp == NULL) {
OBD_ALLOC_LARGE(*lmmp, mea_size);
if (*lmmp == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (!lsm)
- RETURN(mea_size);
+ return mea_size;
lsmp = (struct lmv_stripe_md *)lsm;
meap = (struct lmv_stripe_md *)*lmmp;
if (lsmp->mea_magic != MEA_MAGIC_LAST_CHAR &&
lsmp->mea_magic != MEA_MAGIC_ALL_CHARS)
- RETURN(-EINVAL);
+ return -EINVAL;
meap->mea_magic = cpu_to_le32(lsmp->mea_magic);
meap->mea_count = cpu_to_le32(lsmp->mea_count);
fid_cpu_to_le(&meap->mea_ids[i], &lsmp->mea_ids[i]);
}
- RETURN(mea_size);
+ return mea_size;
}
int lmv_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
if (*lsmp != NULL && lmm == NULL) {
OBD_FREE_LARGE(*tmea, mea_size);
*lsmp = NULL;
- RETURN(0);
+ return 0;
}
LASSERT(mea_size == lmm_size);
OBD_ALLOC_LARGE(*tmea, mea_size);
if (*tmea == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (!lmm)
- RETURN(mea_size);
+ return mea_size;
if (mea->mea_magic == MEA_MAGIC_LAST_CHAR ||
mea->mea_magic == MEA_MAGIC_ALL_CHARS ||
(*tmea)->mea_ids[i] = mea->mea_ids[i];
fid_le_to_cpu(&(*tmea)->mea_ids[i], &(*tmea)->mea_ids[i]);
}
- RETURN(mea_size);
+ return mea_size;
}
static int lmv_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
if (!rc)
rc = err;
}
- RETURN(rc);
+ return rc;
}
int lmv_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data,
int rc;
rc = md_set_lock_data(lmv->tgts[0]->ltd_exp, lockh, data, bits);
- RETURN(rc);
+ return rc;
}
ldlm_mode_t lmv_lock_match(struct obd_export *exp, __u64 flags,
rc = md_lock_match(lmv->tgts[i]->ltd_exp, flags, fid,
type, policy, mode, lockh);
if (rc)
- RETURN(rc);
+ return rc;
}
- RETURN(0);
+ return 0;
}
int lmv_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
if (md->mea)
obd_free_memmd(exp, (void *)&md->mea);
- RETURN(md_free_lustre_md(lmv->tgts[0]->ltd_exp, md));
+ return md_free_lustre_md(lmv->tgts[0]->ltd_exp, md);
}
int lmv_set_open_replay_data(struct obd_export *exp,
tgt = lmv_find_target(lmv, &och->och_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
- RETURN(md_set_open_replay_data(tgt->ltd_exp, och, open_req));
+ return md_set_open_replay_data(tgt->ltd_exp, och, open_req);
}
int lmv_clear_open_replay_data(struct obd_export *exp,
tgt = lmv_find_target(lmv, &och->och_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
- RETURN(md_clear_open_replay_data(tgt->ltd_exp, och));
+ return md_clear_open_replay_data(tgt->ltd_exp, och);
}
static int lmv_get_remote_perm(struct obd_export *exp,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_get_remote_perm(tgt->ltd_exp, fid, oc, suppgid, request);
- RETURN(rc);
+ return rc;
}
static int lmv_renew_capa(struct obd_export *exp, struct obd_capa *oc,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, &oc->c_capa.lc_fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_renew_capa(tgt->ltd_exp, oc, cb);
- RETURN(rc);
+ return rc;
}
int lmv_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, &op_data->op_fid1);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_intent_getattr_async(tgt->ltd_exp, minfo, einfo);
- RETURN(rc);
+ return rc;
}
int lmv_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
rc = lmv_check_connect(obd);
if (rc)
- RETURN(rc);
+ return rc;
tgt = lmv_find_target(lmv, fid);
if (IS_ERR(tgt))
- RETURN(PTR_ERR(tgt));
+ return PTR_ERR(tgt);
rc = md_revalidate_lock(tgt->ltd_exp, it, fid, bits);
- RETURN(rc);
+ return rc;
}
/**
if (!lmv->desc.ld_tgt_count || !tgt->ltd_active) {
CERROR("master lmv inactive\n");
- RETURN(-EIO);
+ return -EIO;
}
if (oqctl->qc_cmd != Q_GETOQUOTA) {
rc = obd_quotactl(tgt->ltd_exp, oqctl);
- RETURN(rc);
+ return rc;
}
curspace = curinodes = 0;
oqctl->qc_dqblk.dqb_curspace = curspace;
oqctl->qc_dqblk.dqb_curinodes = curinodes;
- RETURN(rc);
+ return rc;
}
int lmv_quotacheck(struct obd_device *unused, struct obd_export *exp,
tgt = lmv->tgts[i];
if (tgt == NULL || tgt->ltd_exp == NULL || !tgt->ltd_active) {
CERROR("lmv idx %d inactive\n", i);
- RETURN(-EIO);
+ return -EIO;
}
err = obd_quotacheck(tgt->ltd_exp, oqctl);
rc = err;
}
- RETURN(rc);
+ return rc;
}
struct obd_ops lmv_obd_ops = {
LASSERT(ld->ld_lov != NULL);
if (ld->ld_target == NULL)
- RETURN(NULL);
+ return NULL;
lov_foreach_target(ld, i) {
struct lovsub_device *lsd;
ld->ld_target[i] = NULL;
}
}
- RETURN(NULL);
+ return NULL;
}
static int lov_device_init(const struct lu_env *env, struct lu_device *d,
LASSERT(d->ld_site != NULL);
if (ld->ld_target == NULL)
- RETURN(rc);
+ return rc;
lov_foreach_target(ld, i) {
struct lovsub_device *lsd;
else
ld->ld_flags |= LOV_DEV_INITIALIZED;
- RETURN(rc);
+ return rc;
}
static int lov_req_init(const struct lu_env *env, struct cl_device *dev,
result = 0;
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
static const struct cl_device_operations lov_cl_ops = {
emerg = lov_emerg_alloc(tgt_size);
if (IS_ERR(emerg))
- RETURN(PTR_ERR(emerg));
+ return PTR_ERR(emerg);
OBD_ALLOC(newd, tgt_size * sz);
if (newd != NULL) {
result = -ENOMEM;
}
}
- RETURN(result);
+ return result;
}
static int lov_cl_add_target(const struct lu_env *env, struct lu_device *dev,
if (!tgt->ltd_obd->obd_set_up) {
CERROR("Target %s not set up\n", obd_uuid2str(&tgt->ltd_uuid));
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = lov_expand_targets(env, ld);
}
}
obd_putref(obd);
- RETURN(rc);
+ return rc;
}
static int lov_process_config(const struct lu_env *env,
}
}
obd_putref(obd);
- RETURN(rc);
+ return rc;
}
static const struct lu_device_operations lov_lu_ops = {
OBD_ALLOC_PTR(ld);
if (ld == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
cl_device_init(&ld->ld_cl, t);
d = lov2lu_dev(ld);
rc = lov_setup(obd, cfg);
if (rc) {
lov_device_free(env, d);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
ld->ld_lov = &obd->u.lov;
- RETURN(d);
+ return d;
}
static const struct lu_device_type_operations lov_device_type_ops = {
}
if (result != 0)
lov_io_sub_fini(env, lio, sub);
- RETURN(result);
+ return result;
}
struct lov_io_sub *lov_sub_get(const struct lu_env *env,
lov_sub_enter(sub);
else
sub = ERR_PTR(rc);
- RETURN(sub);
+ return sub;
}
void lov_sub_put(struct lov_io_sub *sub)
lu_object_locate(page->cp_child->cp_obj->co_lu.lo_header,
&lovsub_device_type));
LASSERT(subobj != NULL);
- RETURN(subobj->lso_index);
+ return subobj->lso_index;
}
struct lov_io_sub *lov_page_subio(const struct lu_env *env, struct lov_io *lio,
LASSERT(lio->lis_nr_subios > 0);
stripe = lov_page_stripe(page);
- RETURN(lov_sub_get(env, lio, stripe));
+ return lov_sub_get(env, lio, stripe);
}
result = 0;
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
static void lov_io_slice_init(struct lov_io *lio,
else
break;
}
- RETURN(rc);
+ return rc;
}
static int lov_io_rw_iter_init(const struct lu_env *env,
* XXX The following call should be optimized: we know, that
* [lio->lis_pos, lio->lis_endpos) intersects with exactly one stripe.
*/
- RETURN(lov_io_iter_init(env, ios));
+ return lov_io_iter_init(env, ios);
}
static int lov_io_call(const struct lu_env *env, struct lov_io *lio,
if (parent->ci_result == 0)
parent->ci_result = sub->sub_io->ci_result;
}
- RETURN(rc);
+ return rc;
}
static int lov_io_lock(const struct lu_env *env, const struct cl_io_slice *ios)
{
- RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_lock));
+ return lov_io_call(env, cl2lov_io(env, ios), cl_io_lock);
}
static int lov_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
{
- RETURN(lov_io_call(env, cl2lov_io(env, ios), cl_io_start));
+ return lov_io_call(env, cl2lov_io(env, ios), cl_io_start);
}
static int lov_io_end_wrapper(const struct lu_env *env, struct cl_io *io)
cl_io_end(env, io);
else
io->ci_state = CIS_IO_FINISHED;
- RETURN(0);
+ return 0;
}
static int lov_io_iter_fini_wrapper(const struct lu_env *env, struct cl_io *io)
{
cl_io_iter_fini(env, io);
- RETURN(0);
+ return 0;
}
static int lov_io_unlock_wrapper(const struct lu_env *env, struct cl_io *io)
{
cl_io_unlock(env, io);
- RETURN(0);
+ return 0;
}
static void lov_io_end(const struct lu_env *env, const struct cl_io_slice *ios)
rc = cl_io_submit_rw(sub->sub_env, sub->sub_io,
crt, queue);
lov_sub_put(sub);
- RETURN(rc);
+ return rc;
}
LASSERT(lio->lis_subs != NULL);
OBD_ALLOC_LARGE(stripes_qin,
sizeof(*stripes_qin) * lio->lis_nr_subios);
if (stripes_qin == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
for (stripe = 0; stripe < lio->lis_nr_subios; stripe++)
cl_page_list_init(&stripes_qin[stripe]);
mutex_unlock(&ld->ld_mutex);
}
- RETURN(rc);
+ return rc;
#undef QIN
}
lov_sub_put(sub);
} else
result = PTR_ERR(sub);
- RETURN(result);
+ return result;
}
static int lov_io_commit_write(const struct lu_env *env,
lov_sub_put(sub);
} else
result = PTR_ERR(sub);
- RETURN(result);
+ return result;
}
static int lov_io_fault_start(const struct lu_env *env,
sub = lov_sub_get(env, lio, lov_page_stripe(fio->ft_page));
sub->sub_io->u.ci_fault.ft_nob = fio->ft_nob;
lov_sub_put(sub);
- RETURN(lov_io_start(env, ios));
+ return lov_io_start(env, ios);
}
static void lov_io_fsync_end(const struct lu_env *env,
atomic_inc(&lov->lo_active_ios);
}
}
- RETURN(io->ci_result);
+ return io->ci_result;
}
int lov_io_init_empty(const struct lu_env *env, struct cl_object *obj,
}
io->ci_result = result < 0 ? result : 0;
- RETURN(result != 0);
+ return result != 0;
}
int lov_io_init_released(const struct lu_env *env, struct cl_object *obj,
}
io->ci_result = result < 0 ? result : 0;
- RETURN(result != 0);
+ return result != 0;
}
/** @} lov */
OBD_SLAB_FREE_PTR(link, lov_lock_link_kmem);
} else
sublock = ERR_PTR(-ENOMEM);
- RETURN(sublock);
+ return sublock;
}
static void lov_sublock_unlock(const struct lu_env *env,
}
}
}
- RETURN(result);
+ return result;
}
/**
if (result_rank < rc_rank)
result = rc;
- RETURN(result);
+ return result;
}
/**
LASSERT(nr > 0);
OBD_ALLOC_LARGE(lck->lls_sub, nr * sizeof lck->lls_sub[0]);
if (lck->lls_sub == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lck->lls_nr = nr;
/*
* because enqueue will create them anyway. Main duty of this function
* is to fill in sub-lock descriptions in a race free manner.
*/
- RETURN(result);
+ return result;
}
static int lov_sublock_release(const struct lu_env *env, struct lov_lock *lck,
* sub-lock is destroyed.
*/
}
- RETURN(rc);
+ return rc;
}
static void lov_sublock_hold(const struct lu_env *env, struct lov_lock *lck,
cl_lock_mutex_put(env, lock);
result = cl_lock_enqueue_wait(env, sublock, 0);
cl_lock_mutex_get(env, lock);
- RETURN(result ?: CLO_REPEAT);
+ return result ?: CLO_REPEAT;
}
/**
if ((result == CLO_WAIT) && (sublock->cll_state <= CLS_HELD) &&
(enqflags & CEF_ASYNC) && (!last || (enqflags & CEF_AGL)))
result = 0;
- RETURN(result);
+ return result;
}
/**
break;
}
cl_lock_closure_fini(closure);
- RETURN(result ?: minstate >= CLS_ENQUEUED ? 0 : CLO_WAIT);
+ return result ?: minstate >= CLS_ENQUEUED ? 0 : CLO_WAIT;
}
static int lov_lock_unuse(const struct lu_env *env,
result = -ESTALE;
}
cl_lock_closure_fini(closure);
- RETURN(result);
+ return result;
}
if (result == 0 && reenqueued != 0)
goto again;
cl_lock_closure_fini(closure);
- RETURN(result ?: minstate >= CLS_HELD ? 0 : CLO_WAIT);
+ return result ?: minstate >= CLS_HELD ? 0 : CLO_WAIT;
}
static int lov_lock_use(const struct lu_env *env,
result = -ESTALE;
}
cl_lock_closure_fini(closure);
- RETURN(result);
+ return result;
}
#if 0
PDESCR(&lov->lls_orig), PDESCR(&lov->lls_sub[0].sub_got),
lov->lls_sub[0].sub_stripe, lov->lls_nr, lov_r0(obj)->lo_nr,
result);
- RETURN(result);
+ return result;
}
void lov_lock_unlink(const struct lu_env *env,
list_for_each_entry(scan, &sub->lss_parents, lll_list) {
if (scan->lll_super == lck)
- RETURN(scan);
+ return scan;
}
- RETURN(NULL);
+ return NULL;
}
/**
result = lov_lock_sub_init(env, lck, io);
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
static void lov_empty_lock_fini(const struct lu_env *env,
lck->lls_orig = lock->cll_descr;
result = 0;
}
- RETURN(result);
+ return result;
}
static struct cl_lock_closure *lov_closure_get(const struct lu_env *env,
/* Note that rc is always 1 if llog_obd_add was successful */
cookies += rc;
}
- RETURN(cookies);
+ return cookies;
}
static int lov_llog_origin_connect(struct llog_ctxt *ctxt,
}
obd_putref(obd);
- RETURN(err);
+ return err;
}
/* the replicators commit callback */
}
}
obd_putref(obd);
- RETURN(rc);
+ return rc;
}
static struct llog_operations lov_mds_ost_orig_logops = {
rc = llog_setup(NULL, obd, olg, LLOG_MDS_OST_ORIG_CTXT, disk_obd,
&lov_mds_ost_orig_logops);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_setup(NULL, obd, olg, LLOG_SIZE_REPL_CTXT, disk_obd,
&lov_size_repl_logops);
llog_cleanup(NULL, ctxt);
/* lov->tgt llogs are cleaned during osc_cleanup. */
- RETURN(0);
+ return 0;
}
lvb->lvb_mtime = current_mtime;
lvb->lvb_atime = current_atime;
lvb->lvb_ctime = current_ctime;
- RETURN(rc);
+ return rc;
}
/** Merge the lock value block(&lvb) attributes from each of the stripes in a
CDEBUG(D_INODE, "merged for ID "DOSTID" s="LPU64" m="LPU64" a="LPU64
" c="LPU64" b="LPU64"\n", POSTID(&lsm->lsm_oi), lvb->lvb_size,
lvb->lvb_mtime, lvb->lvb_atime, lvb->lvb_ctime, lvb->lvb_blocks);
- RETURN(rc);
+ return rc;
}
/* Must be called under the lov_stripe_lock() */
loi->loi_kms, kms);
loi_kms_set(loi, loi->loi_lvb.lvb_size = kms);
}
- RETURN(0);
+ return 0;
}
if (size > 0)
if (kms > loi->loi_kms)
loi_kms_set(loi, kms);
- RETURN(0);
+ return 0;
}
void lov_merge_attrs(struct obdo *tgt, struct obdo *src, obd_valid valid,
int rc;
if (!lov->lov_tgts[index])
- RETURN(-EINVAL);
+ return -EINVAL;
tgt_uuid = &lov->lov_tgts[index]->ltd_uuid;
tgt_obd = lov->lov_tgts[index]->ltd_obd;
if (!tgt_obd->obd_set_up) {
CERROR("Target %s not set up\n", obd_uuid2str(tgt_uuid));
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* override the sp_me from lov */
if (rc) {
CERROR("Target %s register_observer error %d\n",
obd_uuid2str(tgt_uuid), rc);
- RETURN(rc);
+ return rc;
}
if (imp->imp_invalid) {
CDEBUG(D_CONFIG, "not connecting OSC %s; administratively "
"disabled\n", obd_uuid2str(tgt_uuid));
- RETURN(0);
+ return 0;
}
rc = obd_connect(NULL, &lov->lov_tgts[index]->ltd_exp, tgt_obd,
if (rc || !lov->lov_tgts[index]->ltd_exp) {
CERROR("Target %s connect error %d\n",
obd_uuid2str(tgt_uuid), rc);
- RETURN(-ENODEV);
+ return -ENODEV;
}
lov->lov_tgts[index]->ltd_reap = 0;
}
}
- RETURN(0);
+ return 0;
}
static int lov_connect(const struct lu_env *env,
rc = class_connect(&conn, obd, cluuid);
if (rc)
- RETURN(rc);
+ return rc;
*exp = class_conn2export(&conn);
}
obd_putref(obd);
- RETURN(0);
+ return 0;
}
static int lov_disconnect_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
}
tgt->ltd_exp = NULL;
- RETURN(0);
+ return 0;
}
static int lov_disconnect(struct obd_export *exp)
out:
rc = class_disconnect(exp); /* bz 9811 */
- RETURN(rc);
+ return rc;
}
/* Error codes:
out:
obd_putref(obd);
- RETURN(index);
+ return index;
}
static int lov_notify(struct obd_device *obd, struct obd_device *watched,
down_read(&lov->lov_notify_lock);
if (!lov->lov_connects) {
up_read(&lov->lov_notify_lock);
- RETURN(rc);
+ return rc;
}
if (ev == OBD_NOTIFY_ACTIVE || ev == OBD_NOTIFY_INACTIVE ||
CERROR("unexpected notification of %s %s!\n",
watched->obd_type->typ_name,
watched->obd_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
uuid = &watched->u.cli.cl_target_uuid;
up_read(&lov->lov_notify_lock);
CERROR("event(%d) of %s failed: %d\n", ev,
obd_uuid2str(uuid), rc);
- RETURN(rc);
+ return rc;
}
/* active event should be pass lov target index as data */
data = &rc;
}
up_read(&lov->lov_notify_lock);
- RETURN(rc);
+ return rc;
}
static int lov_add_target(struct obd_device *obd, struct obd_uuid *uuidp,
if (gen <= 0) {
CERROR("request to add OBD %s with invalid generation: %d\n",
uuidp->uuid, gen);
- RETURN(-EINVAL);
+ return -EINVAL;
}
tgt_obd = class_find_client_obd(uuidp, LUSTRE_OSC_NAME,
&obd->obd_uuid);
if (tgt_obd == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
mutex_lock(&lov->lov_lock);
CERROR("UUID %s already assigned at LOV target index %d\n",
obd_uuid2str(&tgt->ltd_uuid), index);
mutex_unlock(&lov->lov_lock);
- RETURN(-EEXIST);
+ return -EEXIST;
}
if (index >= lov->lov_tgt_size) {
OBD_ALLOC(newtgts, sizeof(*newtgts) * newsize);
if (newtgts == NULL) {
mutex_unlock(&lov->lov_lock);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (lov->lov_tgt_size) {
OBD_ALLOC_PTR(tgt);
if (!tgt) {
mutex_unlock(&lov->lov_lock);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
rc = lov_ost_pool_add(&lov->lov_packed, index, lov->lov_tgt_size);
if (rc) {
mutex_unlock(&lov->lov_lock);
OBD_FREE_PTR(tgt);
- RETURN(rc);
+ return rc;
}
tgt->ltd_uuid = *uuidp;
/* lov_connect hasn't been called yet. We'll do the
lov_connect_obd on this target when that fn first runs,
because we don't know the connect flags yet. */
- RETURN(0);
+ return 0;
}
obd_getref(obd);
lov_del_target(obd, index, 0, 0);
}
obd_putref(obd);
- RETURN(rc);
+ return rc;
}
/* Schedule a target for deletion */
if (index >= count) {
CERROR("LOV target index %d >= number of LOV OBDs %d.\n",
index, count);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* to make sure there's no ongoing lov_notify() now */
obd_putref(obd);
up_write(&lov->lov_notify_lock);
- RETURN(rc);
+ return rc;
}
static void __lov_del_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("LOV setup requires a descriptor\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
desc = (struct lov_desc *)lustre_cfg_buf(lcfg, 1);
if (sizeof(*desc) > LUSTRE_CFG_BUFLEN(lcfg, 1)) {
CERROR("descriptor size wrong: %d > %d\n",
(int)sizeof(*desc), LUSTRE_CFG_BUFLEN(lcfg, 1));
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (desc->ld_magic != LOV_DESC_MAGIC) {
} else {
CERROR("%s: Bad lov desc magic: %#x\n",
obd->obd_name, desc->ld_magic);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
obd->obd_proc_entry,
NULL, NULL);
- RETURN(0);
+ return 0;
out:
return rc;
CERROR("failed to cleanup llogging subsystems\n");
break;
}
- RETURN(rc);
+ return rc;
}
static int lov_cleanup(struct obd_device *obd)
lov->lov_tgt_size);
lov->lov_tgt_size = 0;
}
- RETURN(0);
+ return 0;
}
int lov_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg,
}
}
out:
- RETURN(rc);
+ return rc;
}
static int lov_recreate(struct obd_export *exp, struct obdo *src_oa,
OBD_ALLOC(obj_mdp, sizeof(*obj_mdp));
if (obj_mdp == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
ost_idx = src_oa->o_nlink;
lsm = *ea;
src_oa, &obj_mdp, oti);
out:
OBD_FREE(obj_mdp, sizeof(*obj_mdp));
- RETURN(rc);
+ return rc;
}
/* the LOV expects oa->o_id to be set to the LOV object id */
LASSERT(ea != NULL);
if (exp == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
if ((src_oa->o_valid & OBD_MD_FLFLAGS) &&
src_oa->o_flags == OBD_FL_DELORPHAN) {
lov = &exp->exp_obd->u.lov;
if (!lov->desc.ld_active_tgt_count)
- RETURN(-EIO);
+ return -EIO;
obd_getref(exp->exp_obd);
/* Recreate a specific object id at the given OST index */
}
obd_putref(exp->exp_obd);
- RETURN(rc);
+ return rc;
}
#define ASSERT_LSM_MAGIC(lsmp) \
ASSERT_LSM_MAGIC(lsm);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
if (oa->o_valid & OBD_MD_FLCOOKIE) {
LASSERT(oti);
err = lov_fini_destroy_set(set);
out:
obd_putref(exp->exp_obd);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
static int lov_getattr(const struct lu_env *env, struct obd_export *exp,
ASSERT_LSM_MAGIC(oinfo->oi_md);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_getattr_set(exp, oinfo, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
rc = lov_fini_getattr_set(set);
if (err)
rc = err;
- RETURN(rc);
+ return rc;
}
static int lov_getattr_interpret(struct ptlrpc_request_set *rqset,
if (rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_getattr_set(lovset);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
static int lov_getattr_async(struct obd_export *exp, struct obd_info *oinfo,
ASSERT_LSM_MAGIC(oinfo->oi_md);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_getattr_set(exp, oinfo, &lovset);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INFO, "objid "DOSTID": %ux%u byte stripes\n",
POSTID(&oinfo->oi_md->lsm_oi), oinfo->oi_md->lsm_stripe_count,
LASSERT (rqset->set_interpret == NULL);
rqset->set_interpret = lov_getattr_interpret;
rqset->set_arg = (void *)lovset;
- RETURN(rc);
+ return rc;
}
out:
if (rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_getattr_set(lovset);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
static int lov_setattr(const struct lu_env *env, struct obd_export *exp,
ASSERT_LSM_MAGIC(oinfo->oi_md);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
/* for now, we only expect the following updates here */
LASSERT(!(oinfo->oi_oa->o_valid & ~(OBD_MD_FLID | OBD_MD_FLTYPE |
lov = &exp->exp_obd->u.lov;
rc = lov_prep_setattr_set(exp, oinfo, oti, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
err = lov_fini_setattr_set(set);
if (!rc)
rc = err;
- RETURN(rc);
+ return rc;
}
static int lov_setattr_interpret(struct ptlrpc_request_set *rqset,
if (rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_setattr_set(lovset);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
/* If @oti is given, the request goes from MDS and responses from OSTs are not
}
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_setattr_set(exp, oinfo, oti, &set);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INFO, "objid "DOSTID": %ux%u byte stripes\n",
POSTID(&oinfo->oi_md->lsm_oi),
if (rc)
atomic_set(&set->set_completes, 0);
err = lov_fini_setattr_set(set);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
LASSERT(rqset->set_interpret == NULL);
rqset->set_interpret = lov_setattr_interpret;
rqset->set_arg = (void *)set;
- RETURN(0);
+ return 0;
}
static int lov_punch_interpret(struct ptlrpc_request_set *rqset,
if (rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_punch_set(lovset);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
/* FIXME: maybe we'll just make one node the authoritative attribute node, then
ASSERT_LSM_MAGIC(oinfo->oi_md);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_punch_set(exp, oinfo, oti, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
if (rc || list_empty(&rqset->set_requests)) {
int err;
err = lov_fini_punch_set(set);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
LASSERT(rqset->set_interpret == NULL);
rqset->set_interpret = lov_punch_interpret;
rqset->set_arg = (void *)set;
- RETURN(0);
+ return 0;
}
static int lov_sync_interpret(struct ptlrpc_request_set *rqset,
if (rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_sync_set(lovset);
- RETURN(rc ?: err);
+ return rc ?: err;
}
static int lov_sync(const struct lu_env *env, struct obd_export *exp,
LASSERT(rqset != NULL);
if (!exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_sync_set(exp, oinfo, start, end, &set);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_INFO, "fsync objid "DOSTID" ["LPX64", "LPX64"]\n",
POSTID(&set->set_oi->oi_oa->o_oi), start, end);
if (rc || list_empty(&rqset->set_requests)) {
int err = lov_fini_sync_set(set);
- RETURN(rc ?: err);
+ return rc ?: err;
}
LASSERT(rqset->set_interpret == NULL);
rqset->set_interpret = lov_sync_interpret;
rqset->set_arg = (void *)set;
- RETURN(0);
+ return 0;
}
static int lov_brw_check(struct lov_obd *lov, struct obd_info *lov_oinfo,
if (cmd == OBD_BRW_CHECK) {
rc = lov_brw_check(lov, oinfo, oa_bufs, pga);
- RETURN(rc);
+ return rc;
}
rc = lov_prep_brw_set(exp, oinfo, oa_bufs, pga, oti, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
struct obd_export *sub_exp;
err = lov_fini_brw_set(set);
if (!rc)
rc = err;
- RETURN(rc);
+ return rc;
}
static int lov_enqueue_interpret(struct ptlrpc_request_set *rqset,
struct lov_request_set *lovset = (struct lov_request_set *)data;
rc = lov_fini_enqueue_set(lovset, lovset->set_ei->ei_mode, rc, rqset);
- RETURN(rc);
+ return rc;
}
static int lov_enqueue(struct obd_export *exp, struct obd_info *oinfo,
LASSERT((oinfo->oi_flags & LDLM_FL_REPLAY) == 0);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
rc = lov_prep_enqueue_set(exp, oinfo, einfo, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
LASSERT(rqset->set_interpret == NULL);
rqset->set_interpret = lov_enqueue_interpret;
rqset->set_arg = (void *)set;
- RETURN(rc);
+ return rc;
}
out:
rc = lov_fini_enqueue_set(set, mode, rc, rqset);
- RETURN(rc);
+ return rc;
}
static int lov_change_cbdata(struct obd_export *exp,
ASSERT_LSM_MAGIC(lsm);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
for (i = 0; i < lsm->lsm_stripe_count; i++) {
rc = obd_change_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp,
&submd, it, data);
}
- RETURN(rc);
+ return rc;
}
/* find any ldlm lock of the inode in lov
ASSERT_LSM_MAGIC(lsm);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
for (i = 0; i < lsm->lsm_stripe_count; i++) {
rc = obd_find_cbdata(lov->lov_tgts[loi->loi_ost_idx]->ltd_exp,
&submd, it, data);
if (rc != 0)
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
static int lov_cancel(struct obd_export *exp, struct lov_stripe_md *lsm,
ASSERT_LSM_MAGIC(lsm);
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
LASSERT(lockh);
lov = &exp->exp_obd->u.lov;
rc = lov_prep_cancel_set(exp, &oinfo, lsm, mode, lockh, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each(pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
}
lov_fini_cancel_set(set);
- RETURN(err);
+ return err;
}
static int lov_cancel_unused(struct obd_export *exp,
int rc = 0, i;
if (!exp || !exp->exp_obd)
- RETURN(-ENODEV);
+ return -ENODEV;
lov = &exp->exp_obd->u.lov;
if (lsm == NULL) {
if (!rc)
rc = err;
}
- RETURN(rc);
+ return rc;
}
ASSERT_LSM_MAGIC(lsm);
rc = err;
}
}
- RETURN(rc);
+ return rc;
}
int lov_statfs_interpret(struct ptlrpc_request_set *rqset, void *data, int rc)
atomic_set(&lovset->set_completes, 0);
err = lov_fini_statfs_set(lovset);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
static int lov_statfs_async(struct obd_export *exp, struct obd_info *oinfo,
lov = &obd->u.lov;
rc = lov_prep_statfs_set(obd, oinfo, &set);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each (pos, &set->set_list) {
req = list_entry(pos, struct lov_request, rq_link);
if (rc)
atomic_set(&set->set_completes, 0);
err = lov_fini_statfs_set(set);
- RETURN(rc ? rc : err);
+ return rc ? rc : err;
}
LASSERT(rqset->set_interpret == NULL);
rqset->set_interpret = lov_statfs_interpret;
rqset->set_arg = (void *)set;
- RETURN(0);
+ return 0;
}
static int lov_statfs(const struct lu_env *env, struct obd_export *exp,
* statfs requests */
set = ptlrpc_prep_set();
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oinfo.oi_osfs = osfs;
oinfo.oi_flags = flags;
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
static int lov_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
if ((index >= count))
- RETURN(-ENODEV);
+ return -ENODEV;
if (!lov->lov_tgts[index])
/* Try again with the next index */
- RETURN(-EAGAIN);
+ return -EAGAIN;
if (!lov->lov_tgts[index]->ltd_active)
- RETURN(-ENODATA);
+ return -ENODATA;
osc_obd = class_exp2obd(lov->lov_tgts[index]->ltd_exp);
if (!osc_obd)
- RETURN(-EINVAL);
+ return -EINVAL;
/* copy UUID */
if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(osc_obd),
min((int) data->ioc_plen2,
(int) sizeof(struct obd_uuid))))
- RETURN(-EFAULT);
+ return -EFAULT;
flags = uarg ? *(__u32*)uarg : 0;
/* got statfs data */
cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
flags);
if (rc)
- RETURN(rc);
+ return rc;
if (copy_to_user(data->ioc_pbuf1, &stat_buf,
min((int) data->ioc_plen1,
(int) sizeof(stat_buf))))
- RETURN(-EFAULT);
+ return -EFAULT;
break;
}
case OBD_IOC_LOV_GET_CONFIG: {
len = 0;
if (obd_ioctl_getdata(&buf, &len, (void *)uarg))
- RETURN(-EINVAL);
+ return -EINVAL;
data = (struct obd_ioctl_data *)buf;
if (sizeof(*desc) > data->ioc_inllen1) {
obd_ioctl_freedata(buf, len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (sizeof(uuidp->uuid) * count > data->ioc_inllen2) {
obd_ioctl_freedata(buf, len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (sizeof(__u32) * count > data->ioc_inllen3) {
obd_ioctl_freedata(buf, len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
desc = (struct lov_desc *)data->ioc_inlbuf1;
if (qctl->qc_valid == QC_OSTIDX) {
if (qctl->qc_idx < 0 || count <= qctl->qc_idx)
- RETURN(-EINVAL);
+ return -EINVAL;
tgt = lov->lov_tgts[qctl->qc_idx];
if (!tgt || !tgt->ltd_exp)
- RETURN(-EINVAL);
+ return -EINVAL;
} else if (qctl->qc_valid == QC_UUID) {
for (i = 0; i < count; i++) {
tgt = lov->lov_tgts[i];
continue;
if (tgt->ltd_exp == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
break;
}
} else {
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (i >= count)
- RETURN(-EAGAIN);
+ return -EAGAIN;
LASSERT(tgt && tgt->ltd_exp);
OBD_ALLOC_PTR(oqctl);
if (!oqctl)
- RETURN(-ENOMEM);
+ return -ENOMEM;
QCTL_COPY(oqctl, qctl);
rc = obd_quotactl(tgt->ltd_exp, oqctl);
int set = 0;
if (count == 0)
- RETURN(-ENOTTY);
+ return -ENOTTY;
for (i = 0; i < count; i++) {
int err;
err = obd_iocontrol(cmd, lov->lov_tgts[i]->ltd_exp,
len, karg, uarg);
if (err == -ENODATA && cmd == OBD_IOC_POLL_QUOTACHECK) {
- RETURN(err);
+ return err;
} else if (err) {
if (lov->lov_tgts[i]->ltd_active) {
CDEBUG(err == -ENOTTY ?
}
}
- RETURN(rc);
+ return rc;
}
#define FIEMAP_BUFFER_SIZE 4096
int i, rc;
if (!vallen || !val)
- RETURN(-EFAULT);
+ return -EFAULT;
obd_getref(obddev);
out:
obd_putref(obddev);
- RETURN(rc);
+ return rc;
}
static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
no_set = 1;
set = ptlrpc_prep_set();
if (!set)
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
obd_getref(obddev);
rc = err;
ptlrpc_set_destroy(set);
}
- RETURN(rc);
+ return rc;
}
static int lov_extent_calc(struct obd_export *exp, struct lov_stripe_md *lsm,
LBUG();
}
- RETURN(0);
+ return 0;
}
void lov_stripe_lock(struct lov_stripe_md *md)
oqctl->qc_cmd != LUSTRE_Q_SETQUOTA &&
oqctl->qc_cmd != Q_FINVALIDATE) {
CERROR("bad quota opc %x for lov obd", oqctl->qc_cmd);
- RETURN(-EFAULT);
+ return -EFAULT;
}
/* for lov tgt */
oqctl->qc_dqblk.dqb_curspace = curspace;
oqctl->qc_dqblk.dqb_bhardlimit = bhardlimit;
}
- RETURN(rc);
+ return rc;
}
static int lov_quotacheck(struct obd_device *obd, struct obd_export *exp,
out:
obd_putref(obd);
- RETURN(rc);
+ return rc;
}
struct obd_ops lov_obd_ops = {
lu_kmem_fini(lov_caches);
}
- RETURN(rc);
+ return rc;
}
static void /*__exit*/ lov_exit(void)
o = lu_object_find_at(env, cl2lu_dev(dev), fid, &conf->coc_lu);
LASSERT(ergo(!IS_ERR(o), o->lo_dev->ld_type == &lovsub_device_type));
- RETURN(lu2cl(o));
+ return lu2cl(o);
}
static int lov_init_sub(const struct lu_env *env, struct lov_object *lov,
} else
result = -ENOMEM;
out:
- RETURN(result);
+ return result;
}
static int lov_init_released(const struct lu_env *env,
}
}
cl_object_prune(env, &lov->lo_cl);
- RETURN(0);
+ return 0;
}
static void lov_fini_empty(const struct lu_env *env, struct lov_object *lov,
if (attr->cat_mtime < lov_attr->cat_mtime)
attr->cat_mtime = lov_attr->cat_mtime;
}
- RETURN(result);
+ return result;
}
const static struct lov_layout_operations lov_dispatch[] = {
l_wait_event(lov->lo_waitq,
atomic_read(&lov->lo_active_ios) == 0, &lwi);
}
- RETURN(0);
+ return 0;
}
static int lov_layout_change(const struct lu_env *unused,
env = cl_env_get(&refcheck);
if (IS_ERR(env)) {
cl_env_reexit(cookie);
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
}
old_ops = &lov_dispatch[lov->lo_type];
cl_env_put(env, &refcheck);
cl_env_reexit(cookie);
- RETURN(result);
+ return result;
}
/*****************************************************************************
result = ops->llo_init(env, dev, lov, cconf, set);
if (result == 0)
ops->llo_install(env, lov, set);
- RETURN(result);
+ return result;
}
static int lov_conf_set(const struct lu_env *env, struct cl_object *obj,
out:
lov_conf_unlock(lov);
- RETURN(result);
+ return result;
}
static void lov_object_delete(const struct lu_env *env, struct lu_object *obj)
obj->lo_ops = &lov_lu_obj_ops;
} else
obj = NULL;
- RETURN(obj);
+ return obj;
}
struct lov_stripe_md *lov_lsm_addref(struct lov_object *lov)
}
lov_conf_thaw(lov);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lov_read_and_clear_async_rc);
int magic = lsm->lsm_magic;
if (ost_size == 0)
- RETURN(0);
+ return 0;
LASSERT(lsm_op_find(magic) != NULL);
lsm_op_find(magic)->lsm_stripe_by_index(lsm, &stripeno, NULL, &swidth);
else
lov_size = (ost_size - 1) * swidth + (stripeno + 1) * ssize;
- RETURN(lov_size);
+ return lov_size;
}
/* we have an offset in file backed by an lov and want to find out where
(lmm_magic != LOV_MAGIC_V3)) {
CERROR("bad mem LOV MAGIC: 0x%08X != 0x%08X nor 0x%08X\n",
lmm_magic, LOV_MAGIC_V1, LOV_MAGIC_V3);
- RETURN(-EINVAL);
+ return -EINVAL;
}
lmm_size = lov_mds_md_size(stripe_count, lmm_magic);
if (!lmmp)
- RETURN(lmm_size);
+ return lmm_size;
if (*lmmp && !lsm) {
stripe_count = le16_to_cpu((*lmmp)->lmm_stripe_count);
lmm_size = lov_mds_md_size(stripe_count, lmm_magic);
OBD_FREE_LARGE(*lmmp, lmm_size);
*lmmp = NULL;
- RETURN(0);
+ return 0;
}
if (!*lmmp) {
OBD_ALLOC_LARGE(*lmmp, lmm_size);
if (!*lmmp)
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
CDEBUG(D_INFO, "lov_packmd: LOV_MAGIC 0x%08X, lmm_size = %d \n",
lmmv1->lmm_magic = cpu_to_le32(LOV_MAGIC_V1);
if (!lsm)
- RETURN(lmm_size);
+ return lmm_size;
/* lmmv1 and lmmv3 point to the same struct and have the
* same first fields
cplen = strlcpy(lmmv3->lmm_pool_name, lsm->lsm_pool_name,
sizeof(lmmv3->lmm_pool_name));
if (cplen >= sizeof(lmmv3->lmm_pool_name))
- RETURN(-E2BIG);
+ return -E2BIG;
lmm_objects = lmmv3->lmm_objects;
} else {
lmm_objects = lmmv1->lmm_objects;
lmm_objects[i].l_ost_idx = cpu_to_le32(loi->loi_ost_idx);
}
- RETURN(lmm_size);
+ return lmm_size;
}
/* Find the max stripecount we should use */
*lsmp = lsm_alloc_plain(stripe_count, &lsm_size);
if (!*lsmp) {
CERROR("can't allocate lsmp stripe_count %d\n", stripe_count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
atomic_set(&(*lsmp)->lsm_refc, 1);
for (i = 0; i < stripe_count; i++)
loi_init((*lsmp)->lsm_oinfo[i]);
- RETURN(lsm_size);
+ return lsm_size;
}
int lov_free_memmd(struct lov_stripe_md **lsmp)
if (lmm) {
rc = lov_verify_lmm(lmm, lmm_bytes, &stripe_count);
if (rc)
- RETURN(rc);
+ return rc;
magic = le32_to_cpu(lmm->lmm_magic);
} else {
magic = LOV_MAGIC;
if (!lsmp) {
/* XXX LOV STACKING call into osc for sizes */
LBUG();
- RETURN(lov_stripe_md_size(stripe_count));
+ return lov_stripe_md_size(stripe_count);
}
/* If we are passed an allocated struct but nothing to unpack, free */
if (*lsmp && !lmm) {
lov_free_memmd(lsmp);
- RETURN(0);
+ return 0;
}
pattern = le32_to_cpu(lmm->lmm_pattern);
lsm_size = lov_alloc_memmd(lsmp, stripe_count, pattern, magic);
if (lsm_size < 0)
- RETURN(lsm_size);
+ return lsm_size;
/* If we are passed a pointer but nothing to unpack, we only alloc */
if (!lmm)
- RETURN(lsm_size);
+ return lsm_size;
LASSERT(lsm_op_find(magic) != NULL);
rc = lsm_op_find(magic)->lsm_unpackmd(lov, *lsmp, lmm);
if (rc) {
lov_free_memmd(lsmp);
- RETURN(rc);
+ return rc;
}
- RETURN(lsm_size);
+ return lsm_size;
}
static int __lov_setstripe(struct obd_export *exp, int max_lmm_size,
rc = lov_lum_swab_if_needed(lumv3, &lmm_magic, lump);
if (rc)
- RETURN(rc);
+ return rc;
/* in the rest of the tests, as *lumv1 and lumv3 have the same
* fields, we use lumv1 to avoid code duplication */
if (lov_pattern(lumv1->lmm_pattern) != LOV_PATTERN_RAID0) {
CDEBUG(D_IOCTL, "bad userland stripe pattern: %#x\n",
lumv1->lmm_pattern);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* 64kB is the largest common page size we see (ia64), and matches the
(typeof(lumv1->lmm_stripe_offset))(-1))) {
CDEBUG(D_IOCTL, "stripe offset %u > number of OSTs %u\n",
lumv1->lmm_stripe_offset, lov->desc.ld_tgt_count);
- RETURN(-EINVAL);
+ return -EINVAL;
}
stripe_count = lov_get_stripecnt(lov, lmm_magic,
lumv1->lmm_stripe_count);
lumv3->lmm_stripe_offset, pool);
if (rc < 0) {
lov_pool_putref(pool);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
rc = 0;
}
- RETURN(rc);
+ return rc;
}
/* Configure object striping information on a new file.
rc = __lov_setstripe(exp, max_lmm_size, lsmp, lump);
set_fs(seg);
- RETURN(rc);
+ return rc;
}
int lov_setea(struct obd_export *exp, struct lov_stripe_md **lsmp,
rc = obd_get_info(NULL, oexp, sizeof(KEY_LAST_ID), KEY_LAST_ID,
&len, &last_id, NULL);
if (rc)
- RETURN(rc);
+ return rc;
if (ostid_id(&lmm_objects[i].l_ost_oi) > last_id) {
CERROR("Setting EA for object > than last id on"
" ost idx %d "DOSTID" > "LPD64" \n",
lmm_objects[i].l_ost_idx,
POSTID(&lmm_objects[i].l_ost_oi), last_id);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
rc = lov_setstripe(exp, 0, lsmp, lump);
if (rc)
- RETURN(rc);
+ return rc;
for (i = 0; i < lump->lmm_stripe_count; i++) {
(*lsmp)->lsm_oinfo[i]->loi_ost_idx =
lmm_objects[i].l_ost_idx;
(*lsmp)->lsm_oinfo[i]->loi_oi = lmm_objects[i].l_ost_oi;
}
- RETURN(0);
+ return 0;
}
mm_segment_t seg;
if (!lsm)
- RETURN(-ENODATA);
+ return -ENODATA;
/*
* "Switch to kernel segment" to allow copying from kernel space by
obd_free_diskmd(exp, &lmmk);
out_set:
set_fs(seg);
- RETURN(rc);
+ return rc;
}
lov_sub_put(sub);
} else
LBUG(); /* Arrgh */
- RETURN(0);
+ return 0;
}
static void lov_page_assume(const struct lu_env *env,
rc = PTR_ERR(sub);
CL_PAGE_DEBUG(D_ERROR, env, slice->cpl_page, "rc = %d\n", rc);
}
- RETURN(rc);
+ return rc;
}
static int lov_page_print(const struct lu_env *env,
memset(addr, 0, cl_page_size(obj));
kunmap(vmpage);
cl_page_export(env, page, 1);
- RETURN(0);
+ return 0;
}
OBD_ALLOC(op->op_array, op->op_size * sizeof(op->op_array[0]));
if (op->op_array == NULL) {
op->op_size = 0;
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
return 0;
}
}
up_write(&op->op_rw_sem);
- RETURN(-EINVAL);
+ return -EINVAL;
}
int lov_ost_pool_free(struct ost_pool *op)
{
if (op->op_size == 0)
- RETURN(0);
+ return 0;
down_write(&op->op_rw_sem);
op->op_size = 0;
up_write(&op->op_rw_sem);
- RETURN(0);
+ return 0;
}
lov = &(obd->u.lov);
if (strlen(poolname) > LOV_MAXPOOLNAME)
- RETURN(-ENAMETOOLONG);
+ return -ENAMETOOLONG;
OBD_ALLOC_PTR(new_pool);
if (new_pool == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
strncpy(new_pool->pool_name, poolname, LOV_MAXPOOLNAME);
new_pool->pool_name[LOV_MAXPOOLNAME] = '\0';
CDEBUG(D_CONFIG, LOV_POOLNAMEF" is pool #%d\n",
poolname, lov->lov_pool_count);
- RETURN(0);
+ return 0;
out_err:
spin_lock(&obd->obd_dev_lock);
/* lookup and kill hash reference */
pool = cfs_hash_del_key(lov->lov_pools_hash_body, poolname);
if (pool == NULL)
- RETURN(-ENOENT);
+ return -ENOENT;
if (pool->pool_proc_entry != NULL) {
CDEBUG(D_INFO, "proc entry %p\n", pool->pool_proc_entry);
/* release last reference */
lov_pool_putref(pool);
- RETURN(0);
+ return 0;
}
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
if (pool == NULL)
- RETURN(-ENOENT);
+ return -ENOENT;
obd_str2uuid(&ost_uuid, ostname);
pool = cfs_hash_lookup(lov->lov_pools_hash_body, poolname);
if (pool == NULL)
- RETURN(-ENOENT);
+ return -ENOENT;
obd_str2uuid(&ost_uuid, ostname);
rc = 0;
/* FIXME in raid1 regime, should return 0 */
- RETURN(rc);
+ return rc;
}
void lov_set_add_req(struct lov_request *req, struct lov_request_set *set)
req->rq_idx, &oi->oi_md->lsm_oi, rc);
lov_stripe_unlock(oi->oi_md);
lov_update_set(set, req, rc);
- RETURN(rc);
+ return rc;
}
/* The callback for osc_enqueue that updates lov info for every OSC request. */
/* enqueue/match success, just return */
if (completes && completes == atomic_read(&set->set_success))
- RETURN(0);
+ return 0;
/* cancel enqueued/matched locks */
list_for_each_entry(req, &set->set_list, rq_link) {
}
if (set->set_lockh)
lov_llh_put(set->set_lockh);
- RETURN(rc);
+ return rc;
}
int lov_fini_enqueue_set(struct lov_request_set *set, __u32 mode, int rc,
int ret = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
/* Do enqueue_done only for sync requests and if any request
* succeeded. */
lov_put_reqset(set);
- RETURN(rc ? rc : ret);
+ return rc ? rc : ret;
}
static void lov_llh_addref(void *llhp)
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(0);
+ return 0;
out_set:
lov_fini_enqueue_set(set, einfo->ei_mode, rc, NULL);
- RETURN(rc);
+ return rc;
}
int lov_fini_match_set(struct lov_request_set *set, __u32 mode, int flags)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
rc = enqueue_done(set, mode);
if ((set->set_count == atomic_read(&set->set_success)) &&
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
int lov_prep_match_set(struct obd_export *exp, struct obd_info *oinfo,
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_match_set(set, mode, 0);
- RETURN(rc);
+ return rc;
}
int lov_fini_cancel_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (set->set_lockh)
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
int lov_prep_cancel_set(struct obd_export *exp, struct obd_info *oinfo,
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_cancel_set(set);
- RETURN(rc);
+ return rc;
}
static int common_attr_done(struct lov_request_set *set)
{
LASSERT(set->set_oi != NULL);
if (set->set_oi->oi_oa == NULL)
- RETURN(0);
+ return 0;
if (!atomic_read(&set->set_success))
- RETURN(-EIO);
+ return -EIO;
OBDO_ALLOC(tmp_oa);
if (tmp_oa == NULL)
out:
if (tmp_oa)
OBDO_FREE(tmp_oa);
- RETURN(rc);
+ return rc;
}
loi->loi_lvb.lvb_blocks = req->rq_oi.oi_oa->o_blocks;
}
- RETURN(0);
+ return 0;
}
int lov_fini_brw_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
rc = brw_done(set);
}
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
int lov_prep_brw_set(struct obd_export *exp, struct obd_info *oinfo,
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
else
lov_fini_brw_set(set);
- RETURN(rc);
+ return rc;
}
int lov_fini_getattr_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes))
rc = common_attr_done(set);
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
/* The callback for osc_getattr_async that finilizes a request info when a
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_getattr_set(set);
- RETURN(rc);
+ return rc;
}
int lov_fini_destroy_set(struct lov_request_set *set)
{
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
/* FIXME update qos data here */
lov_put_reqset(set);
- RETURN(0);
+ return 0;
}
int lov_prep_destroy_set(struct obd_export *exp, struct obd_info *oinfo,
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_destroy_set(set);
- RETURN(rc);
+ return rc;
}
int lov_fini_setattr_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
rc = common_attr_done(set);
}
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
int lov_update_setattr_set(struct lov_request_set *set,
req->rq_oi.oi_oa->o_atime;
}
- RETURN(rc);
+ return rc;
}
/* The callback for osc_setattr_async that finilizes a request info when a
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_setattr_set(set);
- RETURN(rc);
+ return rc;
}
int lov_fini_punch_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
rc = -EIO;
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
int lov_update_punch_set(struct lov_request_set *set,
lov_stripe_unlock(lsm);
}
- RETURN(rc);
+ return rc;
}
/* The callback for osc_punch that finilizes a request info when a response
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_oi = oinfo;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_punch_set(set);
- RETURN(rc);
+ return rc;
}
int lov_fini_sync_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
LASSERT(set->set_exp);
if (atomic_read(&set->set_completes)) {
if (!atomic_read(&set->set_success))
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
/* The callback for osc_sync that finilizes a request info when a
OBD_ALLOC_PTR(set);
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_exp = exp;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_sync_set(set);
- RETURN(rc);
+ return rc;
}
#define LOV_U64_MAX ((__u64)~0ULL)
memcpy(&obd->obd_osfs, osfs, sizeof(*osfs));
obd->obd_osfs_age = cfs_time_current_64();
spin_unlock(&obd->obd_osfs_lock);
- RETURN(0);
+ return 0;
}
- RETURN(-EIO);
+ return -EIO;
}
int lov_fini_statfs_set(struct lov_request_set *set)
int rc = 0;
if (set == NULL)
- RETURN(0);
+ return 0;
if (atomic_read(&set->set_completes)) {
rc = lov_fini_statfs(set->set_obd, set->set_oi->oi_osfs,
atomic_read(&set->set_success));
}
lov_put_reqset(set);
- RETURN(rc);
+ return rc;
}
void lov_update_statfs(struct obd_statfs *osfs, struct obd_statfs *lov_sfs,
atomic_read(&set->set_success));
}
- RETURN(0);
+ return 0;
}
int lov_prep_statfs_set(struct obd_device *obd, struct obd_info *oinfo,
OBD_ALLOC(set, sizeof(*set));
if (set == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lov_init_set(set);
set->set_obd = obd;
if (!set->set_count)
GOTO(out_set, rc = -EIO);
*reqset = set;
- RETURN(rc);
+ return rc;
out_set:
lov_fini_statfs_set(set);
- RETURN(rc);
+ return rc;
}
rc = ldt->ldt_ops->ldto_device_init(env, next, ldt->ldt_name, NULL);
if (rc) {
next->ld_site = NULL;
- RETURN(rc);
+ return rc;
}
lu_device_get(next);
lu_ref_add(&next->ld_reference, "lu-stack", &lu_site_init);
lsd->acid_next = lu2cl_dev(next);
- RETURN(rc);
+ return rc;
}
static struct lu_device *lovsub_device_fini(const struct lu_env *env,
next = cl2lu_dev(lsd->acid_next);
lsd->acid_super = NULL;
lsd->acid_next = NULL;
- RETURN(next);
+ return next;
}
static struct lu_device *lovsub_device_free(const struct lu_env *env,
} else
dumbbell = 0;
- RETURN(dumbbell);
+ return dumbbell;
}
/**
lovsub_parent_unlock(env, lov);
result = result ?: rc;
}
- RETURN(result);
+ return result;
}
static int lovsub_lock_closure(const struct lu_env *env,
if (result != 0)
break;
}
- RETURN(result);
+ return result;
}
/**
parent = lov->lls_cl.cls_lock;
if (parent->cll_error)
- RETURN(0);
+ return 0;
result = 0;
switch (parent->cll_state) {
break;
}
- RETURN(result);
+ return result;
}
/**
result = 0;
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
/** @} lov */
result = 0;
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
struct lov_object *lov = cl2lovsub(obj)->lso_super;
lov_r0(lov)->lo_attr_valid = 0;
- RETURN(0);
+ return 0;
}
static int lovsub_object_glimpse(const struct lu_env *env,
{
struct lovsub_object *los = cl2lovsub(obj);
- RETURN(cl_object_glimpse(env, &los->lso_super->lo_cl, lvb));
+ return cl_object_glimpse(env, &los->lso_super->lo_cl, lvb);
}
obj->lo_ops = &lovsub_lu_obj_ops;
} else
obj = NULL;
- RETURN(obj);
+ return obj;
}
/** @} lov */
struct lovsub_page *lsb = cl_object_page_slice(obj, page);
cl_page_slice_add(page, &lsb->lsb_cl, obj, &lovsub_page_ops);
- RETURN(0);
+ return 0;
}
/** @} lov */
CERROR("different operations for type %s\n",
fs_ops->fs_type);
/* unlock fsfilt_types list */
- RETURN(-EEXIST);
+ return -EEXIST;
}
} else {
try_module_get(THIS_MODULE);
if (rc) {
CERROR("Can't find %s interface\n", name);
- RETURN(ERR_PTR(rc < 0 ? rc : -rc));
+ return ERR_PTR(rc < 0 ? rc : -rc);
/* unlock fsfilt_types list */
}
}
dchild_old = ll_lookup_one_len(oldname, dir, strlen(oldname));
if (IS_ERR(dchild_old))
- RETURN(PTR_ERR(dchild_old));
+ return PTR_ERR(dchild_old);
if (!dchild_old->d_inode)
GOTO(put_old, err = -ENOENT);
dput(dchild_new);
put_old:
dput(dchild_old);
- RETURN(err);
+ return err;
}
EXPORT_SYMBOL(lustre_rename);
__s64 ret = 0;
if (lc == NULL || header == NULL)
- RETURN(0);
+ return 0;
switch (field) {
case LPROCFS_FIELDS_FLAGS_CONFIG:
break;
};
- RETURN(ret);
+ return ret;
}
EXPORT_SYMBOL(lprocfs_read_helper);
#endif /* LPROCFS */
rc = lprocfs_write_helper(buffer, count, &fd);
if (rc)
- RETURN(rc);
+ return rc;
if (fd < 0)
- RETURN(-ERANGE);
+ return -ERANGE;
CWARN("message to fd %d\n", fd);
len = sizeof(*lh) + sizeof(*hal) + MTI_NAME_MAXLEN +
}
OBD_FREE(lh, len);
if (rc < 0)
- RETURN(rc);
- RETURN(count);
+ return rc;
+ return count;
}
struct file_operations mdc_kuc_fops = {
client_obd_list_lock(&cli->cl_loi_list_lock);
rc = list_empty(&mcw->mcw_entry);
client_obd_list_unlock(&cli->cl_loi_list_lock);
- RETURN(rc);
+ return rc;
};
/* We record requests in flight in cli->cl_r_in_flight here.
*bits = 0;
if (!*lockh)
- RETURN(0);
+ return 0;
lock = ldlm_handle2lock((struct lustre_handle *)lockh);
unlock_res_and_lock(lock);
LDLM_LOCK_PUT(lock);
- RETURN(0);
+ return 0;
}
ldlm_mode_t mdc_lock_match(struct obd_export *exp, __u64 flags,
fid_build_reg_res_name(fid, &res_id);
rc = ldlm_lock_match(class_exp2obd(exp)->obd_namespace, flags,
&res_id, type, policy, mode, lockh, 0);
- RETURN(rc);
+ return rc;
}
int mdc_cancel_unused(struct obd_export *exp,
fid_build_reg_res_name(fid, &res_id);
rc = ldlm_cli_cancel_unused_resource(obd->obd_namespace, &res_id,
policy, mode, flags, opaque);
- RETURN(rc);
+ return rc;
}
int mdc_null_inode(struct obd_export *exp,
res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
if(res == NULL)
- RETURN(0);
+ return 0;
lock_res(res);
res->lr_lvb_inode = NULL;
unlock_res(res);
ldlm_resource_putref(res);
- RETURN(0);
+ return 0;
}
/* find any ldlm lock of the inode in mdc
rc = ldlm_resource_iterate(class_exp2obd(exp)->obd_namespace, &res_id,
it, data);
if (rc == LDLM_ITER_STOP)
- RETURN(1);
+ return 1;
else if (rc == LDLM_ITER_CONTINUE)
- RETURN(0);
- RETURN(rc);
+ return 0;
+ return rc;
}
static inline void mdc_clear_replay_flag(struct ptlrpc_request *req, int rc)
&RQF_LDLM_INTENT_OPEN);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
}
/* parent capability */
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_UNLINK);
if (req == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
/* pack the intent */
req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
obddev->u.cli.cl_max_mds_cookiesize);
ptlrpc_request_set_replen(req);
- RETURN(req);
+ return req;
}
static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_GETATTR);
if (req == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
/* pack the intent */
req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
sizeof(struct mdt_remote_perm));
ptlrpc_request_set_replen(req);
- RETURN(req);
+ return req;
}
static struct ptlrpc_request *mdc_intent_layout_pack(struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_INTENT_LAYOUT);
if (req == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, 0);
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
/* pack the intent */
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER,
obd->u.cli.cl_max_mds_easize);
ptlrpc_request_set_replen(req);
- RETURN(req);
+ return req;
}
static struct ptlrpc_request *
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_LDLM_ENQUEUE);
if (req == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
rc = ldlm_prep_enqueue_req(exp, req, NULL, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, lvb_len);
ptlrpc_request_set_replen(req);
- RETURN(req);
+ return req;
}
static int mdc_finish_enqueue(struct obd_export *exp,
body = req_capsule_server_get(pill, &RMF_MDT_BODY);
if (body == NULL) {
CERROR ("Can't swab mdt_body\n");
- RETURN (-EPROTO);
+ return -EPROTO;
}
if (it_disposition(it, DISP_OPEN_OPEN) &&
eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD,
body->eadatasize);
if (eadata == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
/* save lvb data and length in case this is for layout
* lock */
perm = req_capsule_server_swab_get(pill, &RMF_ACL,
lustre_swab_mdt_remote_perm);
if (perm == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (body->valid & OBD_MD_FLMDSCAPA) {
struct lustre_capa *capa, *p;
capa = req_capsule_server_get(pill, &RMF_CAPA1);
if (capa == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
if (it->it_op & IT_OPEN) {
/* client fid capa will be checked in replay */
capa = req_capsule_server_get(pill, &RMF_CAPA2);
if (capa == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
} else if (it->it_op & IT_LAYOUT) {
/* maybe the lock was granted right away and layout
lvb_data = req_capsule_server_sized_get(pill,
&RMF_DLM_LVB, lvb_len);
if (lvb_data == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
}
OBD_ALLOC_LARGE(lmm, lvb_len);
if (lmm == NULL) {
LDLM_LOCK_PUT(lock);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
memcpy(lmm, lvb_data, lvb_len);
if (lock != NULL)
LDLM_LOCK_PUT(lock);
- RETURN(rc);
+ return rc;
}
/* We always reserve enough space in the reply packet for a stripe MD, because
req = mdc_enqueue_pack(exp, 0);
} else if (it->it_op & IT_LAYOUT) {
if (!imp_connect_lvb_type(class_exp2cliimp(exp)))
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
req = mdc_intent_layout_pack(exp, it, op_data);
lvb_type = LVB_T_LAYOUT;
} else {
LBUG();
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (IS_ERR(req))
- RETURN(PTR_ERR(req));
+ return PTR_ERR(req);
if (req != NULL && it && it->it_op & IT_CREAT)
/* ask ptlrpc not to resend on EINPROGRESS since we have our own
mdc_put_rpc_lock(obddev->u.cli.cl_rpc_lock, it);
mdc_clear_replay_flag(req, 0);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
}
current FLocks upon exit) that can't be trashed */
if ((rc == -EINTR) || (rc == -ETIMEDOUT))
goto resend;
- RETURN(rc);
+ return rc;
}
mdc_exit_request(&obddev->u.cli);
CERROR("ldlm_cli_enqueue: %d\n", rc);
mdc_clear_replay_flag(req, rc);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
lockrep = req_capsule_server_get(&req->rq_pill, &RMF_DLM_REP);
goto resend;
} else {
CDEBUG(D_HA, "resend cross eviction\n");
- RETURN(-EIO);
+ return -EIO;
}
}
}
ptlrpc_req_finished(req);
}
- RETURN(rc);
+ return rc;
}
static int mdc_finish_intent_lock(struct obd_export *exp,
/* The server failed before it even started executing the
* intent, i.e. because it couldn't unpack the request. */
LASSERT(it->d.lustre.it_status != 0);
- RETURN(it->d.lustre.it_status);
+ return it->d.lustre.it_status;
}
rc = it_open_error(DISP_IT_EXECD, it);
if (rc)
- RETURN(rc);
+ return rc;
mdt_body = req_capsule_server_get(&request->rq_pill, &RMF_MDT_BODY);
LASSERT(mdt_body != NULL); /* mdc_enqueue checked */
CDEBUG(D_DENTRY, "Found stale data "DFID"("DFID")/"DFID
"\n", PFID(&op_data->op_fid2),
PFID(&op_data->op_fid2), PFID(&mdt_body->fid1));
- RETURN(-ESTALE);
+ return -ESTALE;
}
}
rc = it_open_error(DISP_LOOKUP_EXECD, it);
if (rc)
- RETURN(rc);
+ return rc;
/* keep requests around for the multiple phases of the call
* this shows the DISP_XX must guarantee we make it into the call
CDEBUG(D_DENTRY,"D_IT dentry %.*s intent: %s status %d disp %x rc %d\n",
op_data->op_namelen, op_data->op_name, ldlm_it2str(it->it_op),
it->d.lustre.it_status, it->d.lustre.it_disposition, rc);
- RETURN(rc);
+ return rc;
}
int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
it->d.lustre.it_lock_mode = 0;
}
- RETURN(!!mode);
+ return !!mode;
}
/*
/* Only return failure if it was not GETATTR by cfid
(from inode_revalidate) */
if (rc || op_data->op_namelen != 0)
- RETURN(rc);
+ return rc;
}
/* lookup_it may be called only after revalidate_it has run, because
rc = mdc_fid_alloc(exp, &op_data->op_fid2, op_data);
if (rc < 0) {
CERROR("Can't alloc new fid, rc %d\n", rc);
- RETURN(rc);
+ return rc;
}
}
rc = mdc_enqueue(exp, &einfo, it, op_data, &lockh,
lmm, lmmsize, NULL, extra_lock_flags);
if (rc < 0)
- RETURN(rc);
+ return rc;
} else if (!fid_is_sane(&op_data->op_fid2) ||
!(it->it_create_mode & M_CHECK_STALE)) {
/* DISP_ENQ_COMPLETE set means there is extra reference on
}
*reqp = it->d.lustre.it_data;
rc = mdc_finish_intent_lock(exp, *reqp, op_data, it, &lockh);
- RETURN(rc);
+ return rc;
}
static int mdc_intent_getattr_async_interpret(const struct lu_env *env,
fid_build_reg_res_name(&op_data->op_fid1, &res_id);
req = mdc_intent_getattr_pack(exp, it, op_data);
if (!req)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = mdc_enter_request(&obddev->u.cli);
if (rc != 0) {
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
rc = ldlm_cli_enqueue(exp, &req, einfo, &res_id, &policy, &flags, NULL,
if (rc < 0) {
mdc_exit_request(&obddev->u.cli);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
CLASSERT(sizeof(*ga) <= sizeof(req->rq_async_args));
req->rq_interpret_reply = mdc_intent_getattr_async_interpret;
ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
- RETURN(0);
+ return 0;
}
* when we still want to cancel locks in advance and just cancel them
* locally, without sending any RPC. */
if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns))
- RETURN(0);
+ return 0;
fid_build_reg_res_name(fid, &res_id);
res = ldlm_resource_get(exp->exp_obd->obd_namespace,
NULL, &res_id, 0, 0);
if (res == NULL)
- RETURN(0);
+ return 0;
LDLM_RESOURCE_ADDREF(res);
/* Initialize ibits lock policy. */
policy.l_inodebits.bits = bits;
mode, 0, 0, NULL);
LDLM_RESOURCE_DELREF(res);
ldlm_resource_putref(res);
- RETURN(count);
+ return count;
}
int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
&RQF_MDS_REINT_SETATTR);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
if ((op_data->op_flags & (MF_SOM_CHANGE | MF_EPOCH_OPEN)) == 0)
rc = mdc_prep_elc_req(exp, req, MDS_REINT, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
rpc_lock = obd->u.cli.cl_rpc_lock;
obd_mod_put(*mod);
req->rq_commit_cb(req);
}
- RETURN(rc);
+ return rc;
}
int mdc_create(struct obd_export *exp, struct md_op_data *op_data,
rc = mdc_fid_alloc(exp, &op_data->op_fid2, op_data);
if (rc < 0) {
CERROR("Can't alloc new fid, rc %d\n", rc);
- RETURN(rc);
+ return rc;
}
}
&RQF_MDS_REINT_CREATE_RMT_ACL);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
rc = mdc_prep_elc_req(exp, req, MDS_REINT, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
/*
goto rebuild;
} else {
CDEBUG(D_HA, "resend cross eviction\n");
- RETURN(-EIO);
+ return -EIO;
}
} else if (rc == 0) {
struct mdt_body *body;
}
*request = req;
- RETURN(rc);
+ return rc;
}
int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
&RQF_MDS_REINT_UNLINK);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
rc = mdc_prep_elc_req(exp, req, MDS_REINT, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_unlink_pack(req, op_data);
rc = mdc_reint(req, obd->u.cli.cl_rpc_lock, LUSTRE_IMP_FULL);
if (rc == -ERESTARTSYS)
rc = 0;
- RETURN(rc);
+ return rc;
}
int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_REINT_LINK);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa2);
rc = mdc_prep_elc_req(exp, req, MDS_REINT, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_link_pack(req, op_data);
if (rc == -ERESTARTSYS)
rc = 0;
- RETURN(rc);
+ return rc;
}
int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
&RQF_MDS_REINT_RENAME);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = mdc_prep_elc_req(exp, req, MDS_REINT, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
if (exp_connect_cancelset(exp) && req)
if (rc == -ERESTARTSYS)
rc = 0;
- RETURN(rc);
+ return rc;
}
/* swabbed already in mdc_enqueue */
capa = req_capsule_server_get(&req->rq_pill, field);
if (capa == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
c = alloc_capa(CAPA_SITE_CLIENT);
if (IS_ERR(c)) {
CDEBUG(D_INFO, "alloc capa failed!\n");
- RETURN(PTR_ERR(c));
+ return PTR_ERR(c);
} else {
c->c_capa = *capa;
*oc = c;
- RETURN(0);
+ return 0;
}
}
req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_GETSTATUS,
LUSTRE_MDS_VERSION, MDS_GETSTATUS);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_pack_body(req, NULL, NULL, 0, 0, -1, 0);
lustre_msg_add_flags(req->rq_reqmsg, msg_flags);
/* Request message already built. */
rc = ptlrpc_queue_wait(req);
if (rc != 0)
- RETURN(rc);
+ return rc;
/* sanity check for the reply */
body = req_capsule_server_get(pill, &RMF_MDT_BODY);
if (body == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
CDEBUG(D_NET, "mode: %o\n", body->mode);
eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD,
body->eadatasize);
if (eadata == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (body->valid & OBD_MD_FLRMTPERM) {
perm = req_capsule_server_swab_get(pill, &RMF_ACL,
lustre_swab_mdt_remote_perm);
if (perm == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (body->valid & OBD_MD_FLMDSCAPA) {
struct lustre_capa *capa;
capa = req_capsule_server_get(pill, &RMF_CAPA1);
if (capa == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
}
- RETURN(0);
+ return 0;
}
int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data,
/* Single MDS without an LMV case */
if (op_data->op_flags & MF_GET_MDT_IDX) {
op_data->op_mds = 0;
- RETURN(0);
+ return 0;
}
*request = NULL;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_GETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_GETATTR_NAME);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR_NAME);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
static int mdc_is_subdir(struct obd_export *exp,
&RQF_MDS_IS_SUBDIR, LUSTRE_MDS_VERSION,
MDS_IS_SUBDIR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_is_subdir_pack(req, pfid, cfid, 0);
ptlrpc_request_set_replen(req);
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
*request = NULL;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), fmt);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, oc);
if (xattr_name) {
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, opcode);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
if (opcode == MDS_REINT) {
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
int rc;
if (!body->aclsize)
- RETURN(0);
+ return 0;
buf = req_capsule_server_sized_get(pill, &RMF_ACL, body->aclsize);
if (!buf)
- RETURN(-EPROTO);
+ return -EPROTO;
acl = posix_acl_from_xattr(&init_user_ns, buf, body->aclsize);
if (IS_ERR(acl)) {
rc = PTR_ERR(acl);
CERROR("convert xattr to acl: %d\n", rc);
- RETURN(rc);
+ return rc;
}
rc = posix_acl_valid(acl);
if (rc) {
CERROR("validate acl: %d\n", rc);
posix_acl_release(acl);
- RETURN(rc);
+ return rc;
}
md->posix_acl = acl;
- RETURN(0);
+ return 0;
}
#else
#define mdc_unpack_acl(req, md) 0
if (md->body->eadatasize == 0) {
CDEBUG(D_INFO, "OBD_MD_FLDIREA is set, "
"but eadatasize 0\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (md->body->valid & OBD_MD_MEA) {
lmvsize = md->body->eadatasize;
int mdc_free_lustre_md(struct obd_export *exp, struct lustre_md *md)
{
- RETURN(0);
+ return 0;
}
/**
struct obd_import *imp = open_req->rq_import;
if (!open_req->rq_replay)
- RETURN(0);
+ return 0;
rec = req_capsule_client_get(&open_req->rq_pill, &RMF_REC_REINT);
body = req_capsule_server_get(&open_req->rq_pill, &RMF_MDT_BODY);
if (mod == NULL) {
DEBUG_REQ(D_ERROR, open_req,
"Can't allocate md_open_data");
- RETURN(0);
+ return 0;
}
/**
}
DEBUG_REQ(D_RPCTRACE, open_req, "Set up open replay data");
- RETURN(0);
+ return 0;
}
int mdc_clear_open_replay_data(struct obd_export *exp,
* lookup and ll_file_open().
**/
if (mod == NULL)
- RETURN(0);
+ return 0;
LASSERT(mod != LP_POISON);
och->och_mod = NULL;
obd_mod_put(mod);
- RETURN(0);
+ return 0;
}
/* Prepares the request for the replay by the given reply */
*request = NULL;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_CLOSE);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_CLOSE);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
/* To avoid a livelock (bug 7034), we need to send CLOSE RPCs to a
}
*request = req;
mdc_close_handle_reply(req, op_data, rc);
- RETURN(rc);
+ return rc;
}
int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_DONE_WRITING);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_DONE_WRITING);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
if (mod != NULL) {
mdc_close_handle_reply(req, op_data, rc);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
restart_bulk:
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_READPAGE);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_READPAGE);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
req->rq_request_portal = MDS_READPAGE_PORTAL;
MDS_BULK_PORTAL);
if (desc == NULL) {
ptlrpc_request_free(req);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* NB req now owns desc and will free it when it gets freed */
if (rc) {
ptlrpc_req_finished(req);
if (rc != -ETIMEDOUT)
- RETURN(rc);
+ return rc;
resends++;
if (!client_should_resend(resends, &exp->exp_obd->u.cli)) {
CERROR("too many resend retries, returning error\n");
- RETURN(-EIO);
+ return -EIO;
}
lwi = LWI_TIMEOUT_INTR(cfs_time_seconds(resends), NULL, NULL, NULL);
l_wait_event(waitq, 0, &lwi);
req->rq_bulk->bd_nob_transferred);
if (rc < 0) {
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
if (req->rq_bulk->bd_nob_transferred & ~LU_PAGE_MASK) {
req->rq_bulk->bd_nob_transferred,
PAGE_CACHE_SIZE * op_data->op_npages);
ptlrpc_req_finished(req);
- RETURN(-EPROTO);
+ return -EPROTO;
}
*request = req;
- RETURN(0);
+ return 0;
}
static int mdc_statfs(const struct lu_env *env,
imp = class_import_get(obd->u.cli.cl_import);
up_read(&obd->u.cli.cl_sem);
if (!imp)
- RETURN(-ENODEV);
+ return -ENODEV;
req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_STATFS,
LUSTRE_MDS_VERSION, MDS_STATFS);
int rc;
if (gf->gf_pathlen > PATH_MAX)
- RETURN(-ENAMETOOLONG);
+ return -ENAMETOOLONG;
if (gf->gf_pathlen < 2)
- RETURN(-EOVERFLOW);
+ return -EOVERFLOW;
/* Key is KEY_FID2PATH + getinfo_fid2path description */
keylen = cfs_size_round(sizeof(KEY_FID2PATH)) + sizeof(*gf);
OBD_ALLOC(key, keylen);
if (key == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
memcpy(key, KEY_FID2PATH, sizeof(KEY_FID2PATH));
memcpy(key + cfs_size_round(sizeof(KEY_FID2PATH)), gf, sizeof(*gf));
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_HSM_ACTION);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_ACTION);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_HSM_STATE_GET);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_GET);
if (rc != 0) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_MDS_HSM_STATE_SET);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_SET);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_REQUEST);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
CERROR("%s: not a changelog rec %x/%d: rc = %d\n",
cs->cs_obd->obd_name, rec->cr_hdr.lrh_type,
rec->cr.cr_type, rc);
- RETURN(rc);
+ return rc;
}
if (rec->cr.cr_index < cs->cs_startrec) {
/* Skip entries earlier than what we are interested in */
CDEBUG(D_CHANGELOG, "rec="LPU64" start="LPU64"\n",
rec->cr.cr_index, cs->cs_startrec);
- RETURN(0);
+ return 0;
}
CDEBUG(D_CHANGELOG, LPU64" %02d%-5s "LPU64" 0x%x t="DFID" p="DFID
rc = libcfs_kkuc_msg_put(cs->cs_fp, lh);
CDEBUG(D_CHANGELOG, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len,rc);
- RETURN(rc);
+ return rc;
}
static int mdc_changelog_send_thread(void *csdata)
&RQF_MDS_QUOTACHECK, LUSTRE_MDS_VERSION,
MDS_QUOTACHECK);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
*body = *oqctl;
if (rc)
cli->cl_qchk_stat = rc;
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int mdc_quota_poll_check(struct obd_export *exp,
/* the client is not the previous one */
if (rc == CL_NOT_QUOTACHECKED)
rc = -EINTR;
- RETURN(rc);
+ return rc;
}
static int mdc_quotactl(struct obd_device *unused, struct obd_export *exp,
&RQF_MDS_QUOTACTL, LUSTRE_MDS_VERSION,
MDS_QUOTACTL);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oqc = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
*oqc = *oqctl;
}
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int mdc_ioc_swap_layouts(struct obd_export *exp,
&RQF_MDS_SWAP_LAYOUTS);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
rc = mdc_prep_elc_req(exp, req, MDS_SWAP_LAYOUTS, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_swap_layouts_pack(req, op_data);
OBD_ALLOC_PTR(oqctl);
if (!oqctl)
- RETURN(-ENOMEM);
+ return -ENOMEM;
QCTL_COPY(oqctl, qctl);
rc = obd_quotactl(exp, oqctl);
req = ptlrpc_request_alloc(imp, &RQF_MDS_GET_INFO);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_capsule_set_size(&req->rq_pill, &RMF_GETINFO_KEY,
RCL_CLIENT, keylen);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GET_INFO);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
tmp = req_capsule_client_get(&req->rq_pill, &RMF_GETINFO_KEY);
}
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static void lustre_swab_hai(struct hsm_action_item *h)
if (len < sizeof(*lh) + sizeof(*hal)) {
CERROR("Short HSM message %d < %d\n", len,
(int) (sizeof(*lh) + sizeof(*hal)));
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (lh->kuc_magic == __swab16(KUC_MAGIC)) {
lustre_swab_kuch(lh);
lustre_swab_hal(hal);
} else if (lh->kuc_magic != KUC_MAGIC) {
CERROR("Bad magic %x!=%x\n", lh->kuc_magic, KUC_MAGIC);
- RETURN(-EPROTO);
+ return -EPROTO;
}
CDEBUG(D_HSM, " Received message mg=%x t=%d m=%d l=%d actions=%d "
/* Broadcast to HSM listeners */
rc = libcfs_kkuc_group_put(KUC_GRP_HSM, lh);
- RETURN(rc);
+ return rc;
}
/**
if (KEY_IS(KEY_READ_ONLY)) {
if (vallen != sizeof(int))
- RETURN(-EINVAL);
+ return -EINVAL;
spin_lock(&imp->imp_lock);
if (*((int *)val)) {
rc = do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
keylen, key, vallen, val, set);
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_SPTLRPC_CONF)) {
sptlrpc_conf_client_adapt(exp->exp_obd);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_FLUSH_CTX)) {
sptlrpc_import_flush_my_ctx(imp);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_MDS_CONN)) {
/* mds-mds import */
spin_unlock(&imp->imp_lock);
imp->imp_client->cli_request_portal = MDS_MDS_PORTAL;
CDEBUG(D_OTHER, "%s: timeout / 2\n", exp->exp_obd->obd_name);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_CHANGELOG_CLEAR)) {
rc = do_set_info_async(imp, MDS_SET_INFO, LUSTRE_MDS_VERSION,
keylen, key, vallen, val, set);
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_HSM_COPYTOOL_SEND)) {
rc = mdc_hsm_copytool_send(vallen, val);
- RETURN(rc);
+ return rc;
}
CERROR("Unknown key %s\n", (char *)key);
- RETURN(-EINVAL);
+ return -EINVAL;
}
int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
int mdsize, *max_easize;
if (*vallen != sizeof(int))
- RETURN(-EINVAL);
+ return -EINVAL;
mdsize = *(int*)val;
if (mdsize > exp->exp_obd->u.cli.cl_max_mds_easize)
exp->exp_obd->u.cli.cl_max_mds_easize = mdsize;
max_easize = val;
*max_easize = exp->exp_obd->u.cli.cl_max_mds_easize;
- RETURN(0);
+ return 0;
} else if (KEY_IS(KEY_CONN_DATA)) {
struct obd_import *imp = class_exp2cliimp(exp);
struct obd_connect_data *data = val;
if (*vallen != sizeof(*data))
- RETURN(-EINVAL);
+ return -EINVAL;
*data = imp->imp_connect_data;
- RETURN(0);
+ return 0;
} else if (KEY_IS(KEY_TGT_COUNT)) {
*((int *)val) = 1;
- RETURN(0);
+ return 0;
}
rc = mdc_get_info_rpc(exp, keylen, key, *vallen, val);
- RETURN(rc);
+ return rc;
}
static int mdc_pin(struct obd_export *exp, const struct lu_fid *fid,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_PIN);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, oc);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_PIN);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, fid, oc, 0, 0, -1, flags);
}
handle->och_mod->mod_open_req = req; /* will be dropped by unpin */
- RETURN(0);
+ return 0;
err_out:
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int mdc_unpin(struct obd_export *exp, struct obd_client_handle *handle,
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_UNPIN,
LUSTRE_MDS_VERSION, MDS_UNPIN);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
body = req_capsule_client_get(&req->rq_pill, &RMF_MDT_BODY);
body->handle = handle->och_fh;
ptlrpc_req_finished(handle->och_mod->mod_open_req);
obd_mod_put(handle->och_mod);
- RETURN(rc);
+ return rc;
}
int mdc_sync(struct obd_export *exp, const struct lu_fid *fid,
*request = NULL;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_SYNC);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, oc);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_SYNC);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, fid, oc, 0, 0, -1, 0);
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
static int mdc_import_event(struct obd_device *obd, struct obd_import *imp,
CERROR("Unknown import event %x\n", event);
LBUG();
}
- RETURN(rc);
+ return rc;
}
int mdc_fid_alloc(struct obd_export *exp, struct lu_fid *fid,
struct client_obd *cli = &exp->exp_obd->u.cli;
struct lu_client_seq *seq = cli->cl_seq;
- RETURN(seq_client_alloc_fid(NULL, seq, fid));
+ return seq_client_alloc_fid(NULL, seq, fid);
}
struct obd_uuid *mdc_get_uuid(struct obd_export *exp) {
static int mdc_cancel_for_recovery(struct ldlm_lock *lock)
{
if (lock->l_resource->lr_type != LDLM_IBITS)
- RETURN(0);
+ return 0;
/* FIXME: if we ever get into a situation where there are too many
* opened files with open locks on a single node, then we really
* should replay these open locks to reget it */
if (lock->l_policy_data.l_inodebits.bits & MDS_INODELOCK_OPEN)
- RETURN(0);
+ return 0;
- RETURN(1);
+ return 1;
}
static int mdc_resource_inode_free(struct ldlm_resource *res)
OBD_ALLOC(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
if (!cli->cl_rpc_lock)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_init_rpc_lock(cli->cl_rpc_lock);
ptlrpcd_addref();
CERROR("failed to setup llogging subsystems\n");
}
- RETURN(rc);
+ return rc;
err_close_lock:
OBD_FREE(cli->cl_close_lock, sizeof (*cli->cl_close_lock));
err_rpc_lock:
OBD_FREE(cli->cl_rpc_lock, sizeof (*cli->cl_rpc_lock));
ptlrpcd_decref();
- RETURN(rc);
+ return rc;
}
/* Initialize the default and maximum LOV EA and cookie sizes. This allows
if (cli->cl_max_mds_cookiesize < cookiesize)
cli->cl_max_mds_cookiesize = cookiesize;
- RETURN(0);
+ return 0;
}
static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
CERROR("failed to cleanup llogging subsystems\n");
break;
}
- RETURN(rc);
+ return rc;
}
static int mdc_cleanup(struct obd_device *obd)
rc = llog_setup(NULL, obd, olg, LLOG_CHANGELOG_REPL_CTXT, tgt,
&llog_client_ops);
if (rc)
- RETURN(rc);
+ return rc;
ctxt = llog_group_get_ctxt(olg, LLOG_CHANGELOG_REPL_CTXT);
llog_initiator_connect(ctxt);
llog_ctxt_put(ctxt);
- RETURN(0);
+ return 0;
}
static int mdc_llog_finish(struct obd_device *obd, int count)
if (ctxt)
llog_cleanup(NULL, ctxt);
- RETURN(0);
+ return 0;
}
static int mdc_process_config(struct obd_device *obd, obd_count len, void *buf)
*request = NULL;
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_MDS_GETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
mdc_set_capa_size(req, &RMF_CAPA1, oc);
rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
mdc_pack_body(req, fid, oc, OBD_MD_FLRMTPERM, 0, suppgid, 0);
ptlrpc_req_finished(req);
else
*request = req;
- RETURN(rc);
+ return rc;
}
static int mdc_interpret_renew_capa(const struct lu_env *env,
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_GETATTR,
LUSTRE_MDS_VERSION, MDS_GETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* NB, OBD_MD_FLOSSCAPA is set here, but it doesn't necessarily mean the
* capa to renew is oss capa.
ra->ra_cb = cb;
req->rq_interpret_reply = mdc_interpret_renew_capa;
ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
- RETURN(0);
+ return 0;
}
static int mdc_connect(const struct lu_env *env,
rc = class_register_type(&mdc_obd_ops, &mdc_md_ops, lvars.module_vars,
LUSTRE_MDC_NAME, NULL);
- RETURN(rc);
+ return rc;
}
static void /*__exit*/ mdc_exit(void)
GOTO(err_cleanup, rc);
}
- RETURN(rc);
+ return rc;
err_cleanup:
client_obd_cleanup(obd);
err_decref:
ptlrpcd_decref();
- RETURN(rc);
+ return rc;
}
static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
CERROR("failed to cleanup llogging subsystems\n");
break;
}
- RETURN(rc);
+ return rc;
}
static int mgc_cleanup(struct obd_device *obd)
ptlrpcd_decref();
rc = client_obd_cleanup(obd);
- RETURN(rc);
+ return rc;
}
static int mgc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
rc = llog_setup(NULL, obd, olg, LLOG_CONFIG_REPL_CTXT, tgt,
&llog_client_ops);
if (rc < 0)
- RETURN(rc);
+ return rc;
ctxt = llog_group_get_ctxt(olg, LLOG_CONFIG_REPL_CTXT);
llog_initiator_connect(ctxt);
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
static int mgc_llog_finish(struct obd_device *obd, int count)
if (ctxt)
llog_cleanup(NULL, ctxt);
- RETURN(0);
+ return 0;
}
struct obd_ops mgc_obd_ops = {
atomic_inc(&cld->cld_refcount);
CDEBUG(D_INFO, "log %s refs %d\n", cld->cld_logname,
atomic_read(&cld->cld_refcount));
- RETURN(0);
+ return 0;
}
/* Drop a reference to a config log. When no longer referenced,
LASSERT(found->cld_stopping == 0 || cld_is_sptlrpc(found) == 0);
}
spin_unlock(&config_list_lock);
- RETURN(found);
+ return found;
}
static
OBD_ALLOC(cld, sizeof(*cld) + strlen(logname) + 1);
if (!cld)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
strcpy(cld->cld_logname, logname);
if (cfg)
if (rc) {
config_log_put(cld);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
if (cld_is_sptlrpc(cld)) {
CERROR("failed processing sptlrpc log: %d\n", rc);
}
- RETURN(cld);
+ return cld;
}
static struct config_llog_data *config_recover_log_add(struct obd_device *obd,
ptr = strrchr(logname, '-');
if (ptr == NULL || ptr - logname > 8) {
CERROR("logname %s is too long\n", logname);
- RETURN(-EINVAL);
+ return -EINVAL;
}
memcpy(seclogname, logname, ptr - logname);
CONFIG_T_SPTLRPC, NULL, NULL);
if (IS_ERR(sptlrpc_cld)) {
CERROR("can't create sptlrpc log: %s\n", seclogname);
- RETURN(PTR_ERR(sptlrpc_cld));
+ return PTR_ERR(sptlrpc_cld);
}
}
if (IS_ERR(cld)) {
CERROR("can't create log: %s\n", logname);
config_log_put(sptlrpc_cld);
- RETURN(PTR_ERR(cld));
+ return PTR_ERR(cld);
}
cld->cld_sptlrpc = sptlrpc_cld;
recover_cld = config_recover_log_add(obd, seclogname, cfg, sb);
if (IS_ERR(recover_cld)) {
config_log_put(cld);
- RETURN(PTR_ERR(recover_cld));
+ return PTR_ERR(recover_cld);
}
cld->cld_recover = recover_cld;
}
- RETURN(0);
+ return 0;
}
DEFINE_MUTEX(llog_process_lock);
cld = config_log_find(logname, cfg);
if (cld == NULL)
- RETURN(-ENOENT);
+ return -ENOENT;
mutex_lock(&cld->cld_lock);
/*
mutex_unlock(&cld->cld_lock);
/* drop the ref from the find */
config_log_put(cld);
- RETURN(rc);
+ return rc;
}
cld->cld_stopping = 1;
CDEBUG(D_MGC, "end config log %s (%d)\n", logname ? logname : "client",
rc);
- RETURN(rc);
+ return rc;
}
int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)
}
spin_unlock(&config_list_lock);
- RETURN(0);
+ return 0;
}
/* reenqueue any lost locks */
complete(&rq_exit);
CDEBUG(D_MGC, "Ending requeue thread\n");
- RETURN(rc);
+ return rc;
}
/* Add a cld to the list to requeue. Start the requeue thread if needed.
up(&cli->cl_mgc_sem);
CERROR("%s: No fstype %s: rc = %ld\n", lsi->lsi_fstype,
obd->obd_name, PTR_ERR(obd->obd_fsops));
- RETURN(PTR_ERR(obd->obd_fsops));
+ return PTR_ERR(obd->obd_fsops);
}
cli->cl_mgc_vfsmnt = mnt;
CDEBUG(D_MGC, "MGC using disk labelled=%s\n", label);
/* We keep the cl_mgc_sem until mgc_fs_cleanup */
- RETURN(0);
+ return 0;
err_ops:
fsfilt_put_ops(obd->obd_fsops);
obd->obd_fsops = NULL;
cli->cl_mgc_vfsmnt = NULL;
up(&cli->cl_mgc_sem);
- RETURN(err);
+ return err;
}
static int mgc_fs_cleanup(struct obd_device *obd)
up(&cli->cl_mgc_sem);
- RETURN(rc);
+ return rc;
}
static atomic_t mgc_count = ATOMIC_INIT(0);
CERROR("failed to cleanup llogging subsystems\n");
break;
}
- RETURN(rc);
+ return rc;
}
static int mgc_cleanup(struct obd_device *obd)
ptlrpcd_decref();
rc = client_obd_cleanup(obd);
- RETURN(rc);
+ return rc;
}
static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
rc = 0;
}
- RETURN(rc);
+ return rc;
err_cleanup:
client_obd_cleanup(obd);
err_decref:
ptlrpcd_decref();
- RETURN(rc);
+ return rc;
}
/* based on ll_mdc_blocking_ast */
LBUG();
}
- RETURN(rc);
+ return rc;
}
/* Not sure where this should go... */
&RQF_MGS_SET_INFO, LUSTRE_MGS_VERSION,
MGS_SET_INFO);
if (!req)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_msp = req_capsule_client_get(&req->rq_pill, &RMF_MGS_SEND_PARAM);
if (!req_msp) {
ptlrpc_req_finished(req);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
memcpy(req_msp, msp, sizeof(*req_msp));
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
/* Take a config lock so we can get cancel notifications */
&RQF_LDLM_ENQUEUE, LUSTRE_DLM_VERSION,
LDLM_ENQUEUE);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER, 0);
ptlrpc_request_set_replen(req);
/* A failed enqueue should still call the mgc_blocking_ast,
where it will be requeued if needed ("grant failed"). */
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int mgc_cancel(struct obd_export *exp, struct lov_stripe_md *md,
{
ldlm_lock_decref(lockh, mode);
- RETURN(0);
+ return 0;
}
static void mgc_notify_active(struct obd_device *unused)
&RQF_MGS_TARGET_REG, LUSTRE_MGS_VERSION,
MGS_TARGET_REG);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_mti = req_capsule_client_get(&req->rq_pill, &RMF_MGS_TARGET_INFO);
if (!req_mti) {
ptlrpc_req_finished(req);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
memcpy(req_mti, mti, sizeof(*req_mti));
}
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
int mgc_set_info_async(const struct lu_env *env, struct obd_export *exp,
struct obd_import *imp = class_exp2cliimp(exp);
int value;
if (vallen != sizeof(int))
- RETURN(-EINVAL);
+ return -EINVAL;
value = *(int *)val;
CDEBUG(D_MGC, "InitRecov %s %d/d%d:i%d:r%d:or%d:%s\n",
imp->imp_obd->obd_name, value,
if ((imp->imp_state != LUSTRE_IMP_FULL &&
imp->imp_state != LUSTRE_IMP_NEW) || value > 1)
ptlrpc_reconnect_import(imp);
- RETURN(0);
+ return 0;
}
/* FIXME move this to mgc_process_config */
if (KEY_IS(KEY_REGISTER_TARGET)) {
struct mgs_target_info *mti;
if (vallen != sizeof(struct mgs_target_info))
- RETURN(-EINVAL);
+ return -EINVAL;
mti = (struct mgs_target_info *)val;
CDEBUG(D_MGC, "register_target %s %#x\n",
mti->mti_svname, mti->mti_flags);
rc = mgc_target_register(exp, mti);
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_SET_FS)) {
struct super_block *sb = (struct super_block *)val;
struct lustre_sb_info *lsi;
if (vallen != sizeof(struct super_block))
- RETURN(-EINVAL);
+ return -EINVAL;
lsi = s2lsi(sb);
rc = mgc_fs_setup(exp->exp_obd, sb, lsi->lsi_srv_mnt);
if (rc) {
CERROR("set_fs got %d\n", rc);
}
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_CLEAR_FS)) {
if (vallen != 0)
- RETURN(-EINVAL);
+ return -EINVAL;
rc = mgc_fs_cleanup(exp->exp_obd);
if (rc) {
CERROR("clear_fs got %d\n", rc);
}
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_SET_INFO)) {
struct mgs_send_param *msp;
msp = (struct mgs_send_param *)val;
rc = mgc_set_mgs_param(exp, msp);
- RETURN(rc);
+ return rc;
}
if (KEY_IS(KEY_MGSSEC)) {
struct client_obd *cli = &exp->exp_obd->u.cli;
*/
if (vallen == 0) {
if (cli->cl_flvr_mgc.sf_rpc != SPTLRPC_FLVR_INVALID)
- RETURN(0);
+ return 0;
val = "null";
vallen = 4;
}
if (rc) {
CERROR("invalid sptlrpc flavor %s to MGS\n",
(char *) val);
- RETURN(rc);
+ return rc;
}
/*
(char *) val, str);
rc = -EPERM;
}
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
static int mgc_get_info(const struct lu_env *env, struct obd_export *exp,
CERROR("Unknown import event %#x\n", event);
LBUG();
}
- RETURN(rc);
+ return rc;
}
static int mgc_llog_init(struct obd_device *obd, struct obd_llog_group *olg,
llog_initiator_connect(ctxt);
llog_ctxt_put(ctxt);
- RETURN(0);
+ return 0;
out:
ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt)
llog_cleanup(NULL, ctxt);
- RETURN(rc);
+ return rc;
}
static int mgc_llog_finish(struct obd_device *obd, int count)
ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt)
llog_cleanup(NULL, ctxt);
- RETURN(0);
+ return 0;
}
enum {
OBD_ALLOC(inst, PAGE_CACHE_SIZE);
if (inst == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (!IS_SERVER(lsi)) {
pos = snprintf(inst, PAGE_CACHE_SIZE, "%p", cfg->cfg_instance);
PAGE_CACHE_SIZE);
if (rc) {
OBD_FREE(inst, PAGE_CACHE_SIZE);
- RETURN(-EINVAL);
+ return -EINVAL;
}
pos = strlen(inst);
}
}
OBD_FREE(inst, PAGE_CACHE_SIZE);
- RETURN(rc);
+ return rc;
}
/**
* read it up here.
*/
if (cld_is_sptlrpc(cld) && local_only)
- RETURN(0);
+ return 0;
if (cld->cld_cfg.cfg_sb)
lsi = s2lsi(cld->cld_cfg.cfg_sb);
ctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
if (!ctxt) {
CERROR("missing llog context\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
OBD_ALLOC_PTR(saved_ctxt);
if (saved_ctxt == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lctxt = llog_get_context(mgc, LLOG_CONFIG_ORIG_CTXT);
strlen("-sptlrpc"));
}
- RETURN(rc);
+ return rc;
}
/** Get a config log from the MGS and process it.
mutex_lock(&cld->cld_lock);
if (cld->cld_stopping) {
mutex_unlock(&cld->cld_lock);
- RETURN(0);
+ return 0;
}
OBD_FAIL_TIMEOUT(OBD_FAIL_MGC_PAUSE_PROCESS_LOG, 20);
CERROR("Can't drop cfg lock: %d\n", rcl);
}
- RETURN(rc);
+ return rc;
}
}
}
out:
- RETURN(rc);
+ return rc;
}
struct obd_ops mgc_obd_ops = {
ext_acl_xattr_header *new;
if (unlikely(size < 0))
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
else if (!size)
count = 0;
else
esize = CFS_ACL_XATTR_SIZE(count, ext_acl_xattr);
OBD_ALLOC(new, esize);
if (unlikely(new == NULL))
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
new->a_count = cpu_to_le32(count);
for (i = 0; i < count; i++) {
new->a_entries[i].e_stat = cpu_to_le32(ES_UNK);
}
- RETURN(new);
+ return new;
}
EXPORT_SYMBOL(lustre_posix_acl_xattr_2ext);
posix_acl_xattr_header *new;
if (unlikely(size < 0))
- RETURN(-EINVAL);
+ return -EINVAL;
else if (!size)
- RETURN(0);
+ return 0;
OBD_ALLOC(new, size);
if (unlikely(new == NULL))
- RETURN(-ENOMEM);
+ return -ENOMEM;
new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
count = CFS_ACL_XATTR_COUNT(size, posix_acl_xattr);
posix_size = CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
OBD_ALLOC(new, posix_size);
if (unlikely(new == NULL))
- RETURN(-ENOMEM);
+ return -ENOMEM;
new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
for (i = 0, j = 0; i < ext_count; i++) {
int ori_posix_count;
if (unlikely(size < 0))
- RETURN(-EINVAL);
+ return -EINVAL;
else if (!size)
ori_posix_count = 0;
else
CFS_ACL_XATTR_SIZE(posix_count, posix_acl_xattr);
OBD_ALLOC(new, posix_size);
if (unlikely(new == NULL))
- RETURN(-ENOMEM);
+ return -ENOMEM;
new->a_version = cpu_to_le32(CFS_ACL_XATTR_VERSION);
/* 1. process the unchanged ACL entries
ext_acl_xattr_entry *ee, eae;
if (unlikely(size < 0))
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
else if (!size)
posix_count = 0;
else
OBD_ALLOC(new, ext_size);
if (unlikely(new == NULL))
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
for (i = 0, j = 0; i < posix_count; i++) {
lustre_posix_acl_le_to_cpu(&pae, &posix_header->a_entries[i]);
tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
if (IS_ERR(tfm)) {
CERROR("failed to load transform for aes\n");
- RETURN(PTR_ERR(tfm));
+ return PTR_ERR(tfm);
}
min = ll_crypto_tfm_alg_min_keysize(tfm);
tfm = ll_crypto_alloc_blkcipher(alg, 0, 0 );
if (IS_ERR(tfm)) {
CERROR("failed to load transform for aes\n");
- RETURN(PTR_ERR(tfm));
+ return PTR_ERR(tfm);
}
min = ll_crypto_tfm_alg_min_keysize(tfm);
}
if (result == 0)
io->ci_state = CIS_INIT;
- RETURN(result);
+ return result;
}
/**
io->u.ci_rw.crw_nonblock, io->u.ci_wr.wr_append);
io->u.ci_rw.crw_pos = pos;
io->u.ci_rw.crw_count = count;
- RETURN(cl_io_init(env, io, iot, io->ci_obj));
+ return cl_io_init(env, io, iot, io->ci_obj);
}
EXPORT_SYMBOL(cl_io_rw_init);
list_for_each_entry(scan, queue, cill_linkage) {
if (cl_lock_descr_match(&scan->cill_descr, need))
- RETURN(+1);
+ return +1;
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(cl_queue_match);
CDEBUG(D_VFSTRACE, "lock: %d: [%lu, %lu]\n",
scan->cill_descr.cld_mode, scan->cill_descr.cld_start,
scan->cill_descr.cld_end);
- RETURN(+1);
+ return +1;
}
- RETURN(0);
+ return 0;
}
result = 0;
} else
result = PTR_ERR(lock);
- RETURN(result);
+ return result;
}
static void cl_lock_link_fini(const struct lu_env *env, struct cl_io *io,
break;
}
}
- RETURN(result);
+ return result;
}
/**
cl_io_unlock(env, io);
else
io->ci_state = CIS_LOCKED;
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_lock);
}
if (result == 0)
io->ci_state = CIS_IT_STARTED;
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_iter_init);
list_add(&link->cill_linkage, &io->ci_lockset.cls_todo);
result = 0;
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_lock_add);
} else
result = -ENOMEM;
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_lock_alloc_add);
}
if (result >= 0)
result = 0;
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_start);
*/
cl_page_list_disown(env, io, &queue->c2_qin);
cl_2queue_fini(env, queue);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_read_page);
break;
}
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_prepare_write);
}
}
LINVRNT(result <= 0);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_commit_write);
* If ->cio_submit() failed, no pages were sent.
*/
LASSERT(ergo(result != 0, list_empty(&queue->c2_qout.pl_pages)));
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_io_submit_rw);
} while (result == 0 && io->ci_continue);
if (result == 0)
result = io->ci_result;
- RETURN(result < 0 ? result : 0);
+ return result < 0 ? result : 0;
}
EXPORT_SYMBOL(cl_io_loop);
else
cl_page_list_del(env, plist, page);
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_page_list_own);
if (result != 0)
break;
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_page_list_unmap);
{
while (io->ci_parent != NULL)
io = io->ci_parent;
- RETURN(io);
+ return io;
}
EXPORT_SYMBOL(cl_io_top);
}
page = page->cp_child;
} while (page != NULL && result == 0);
- RETURN(result);
+ return result;
}
/**
}
} else
req = ERR_PTR(-ENOMEM);
- RETURN(req);
+ return req;
}
EXPORT_SYMBOL(cl_req_alloc);
break;
}
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_req_prep);
}
POISON(anchor, 0x5a, sizeof *anchor);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(cl_sync_io_wait);
}
} else
lock = ERR_PTR(-ENOMEM);
- RETURN(lock);
+ return lock;
}
/**
list_for_each_entry(slice, &lock->cll_layers, cls_linkage) {
if (slice->cls_ops->clo_fits_into != NULL &&
!slice->cls_ops->clo_fits_into(env, slice, need, io))
- RETURN(0);
+ return 0;
}
- RETURN(1);
+ return 1;
}
static struct cl_lock *cl_lock_lookup(const struct lu_env *env,
if (matched) {
cl_lock_get_trust(lock);
CS_LOCK_INC(obj, hit);
- RETURN(lock);
+ return lock;
}
}
- RETURN(NULL);
+ return NULL;
}
/**
}
}
}
- RETURN(lock);
+ return lock;
}
/**
list_for_each_entry(slice, &lock->cll_layers, cls_linkage) {
if (slice->cls_obj->co_lu.lo_dev->ld_type == dtype)
- RETURN(slice);
+ return slice;
}
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(cl_lock_at);
cl_lock_mutex_tail(env, lock);
} else
result = -EBUSY;
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_lock_mutex_try);
/* Restore old blocked signals */
cfs_restore_sigs(blocked);
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_lock_state_wait);
LASSERT(lock->cll_state == CLS_CACHED);
if (lock->cll_error)
- RETURN(lock->cll_error);
+ return lock->cll_error;
result = -ENOSYS;
state = cl_lock_intransit(env, lock);
}
cl_lock_extransit(env, lock, state);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_use_try);
}
}
LASSERT(result != -ENOSYS);
- RETURN(result);
+ return result;
}
/**
LBUG();
}
} while (result == CLO_REPEAT);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_enqueue_try);
cl_lock_mutex_get(env, lock);
LASSERT(rc <= 0);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(cl_lock_enqueue_wait);
LASSERT(ergo(result == 0 && !(enqflags & CEF_AGL),
lock->cll_state == CLS_ENQUEUED ||
lock->cll_state == CLS_HELD));
- RETURN(result);
+ return result;
}
/**
cl_lock_lockdep_release(env, lock);
LASSERT(ergo(result == 0, lock->cll_state == CLS_ENQUEUED ||
lock->cll_state == CLS_HELD));
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_enqueue);
if (lock->cll_users > 1) {
cl_lock_user_del(env, lock);
- RETURN(0);
+ return 0;
}
/* Only if the lock is in CLS_HELD or CLS_ENQUEUED state, it can hold
* underlying resources. */
if (!(lock->cll_state == CLS_HELD || lock->cll_state == CLS_ENQUEUED)) {
cl_lock_user_del(env, lock);
- RETURN(0);
+ return 0;
}
/*
state = CLS_NEW;
cl_lock_extransit(env, lock, state);
}
- RETURN(result ?: lock->cll_error);
+ return result ?: lock->cll_error;
}
EXPORT_SYMBOL(cl_unuse_try);
cl_lock_state_set(env, lock, CLS_HELD);
}
} while (result == CLO_REPEAT);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_wait_try);
cl_lock_trace(D_DLMTRACE, env, "wait lock", lock);
cl_lock_mutex_put(env, lock);
LASSERT(ergo(result == 0, lock->cll_state == CLS_HELD));
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_wait);
pound = ~0UL;
}
}
- RETURN(pound);
+ return pound;
}
EXPORT_SYMBOL(cl_lock_weigh);
if (slice->cls_ops->clo_modify != NULL) {
result = slice->cls_ops->clo_modify(env, slice, desc);
if (result != 0)
- RETURN(result);
+ return result;
}
}
CL_LOCK_DEBUG(D_DLMTRACE, env, lock, " -> "DDESCR"@"DFID"\n",
spin_lock(&hdr->coh_lock_guard);
lock->cll_descr = *desc;
spin_unlock(&hdr->coh_lock_guard);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(cl_lock_modify);
}
if (result != 0)
cl_lock_disclosure(env, closure);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_lock_closure_build);
}
result = CLO_REPEAT;
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_lock_enclosure);
}
}
spin_unlock(&head->coh_lock_guard);
- RETURN(lock);
+ return lock;
}
EXPORT_SYMBOL(cl_lock_at_pgoff);
} while (res != CLP_GANG_OKAY);
out:
cl_io_fini(env, io);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_lock_discard_pages);
cl_lock_mutex_put(env, lock);
cl_lock_put(env, lock);
}
- RETURN(lock);
+ return lock;
}
/**
lock = cl_lock_hold_mutex(env, io, need, scope, source);
if (!IS_ERR(lock))
cl_lock_mutex_put(env, lock);
- RETURN(lock);
+ return lock;
}
EXPORT_SYMBOL(cl_lock_hold);
lock = ERR_PTR(rc);
}
} while (rc == 0);
- RETURN(lock);
+ return lock;
}
EXPORT_SYMBOL(cl_lock_request);
INIT_LIST_HEAD(&h->coh_locks);
h->coh_page_bufsize = ALIGN(sizeof(struct cl_page), 8);
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_object_header_init);
}
}
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_object_attr_get);
}
}
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_object_attr_set);
"ctime: "LPU64" blocks: "LPU64"\n",
lvb->lvb_size, lvb->lvb_mtime, lvb->lvb_atime,
lvb->lvb_ctime, lvb->lvb_blocks);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_object_glimpse);
break;
}
}
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_conf_set);
do {
list_for_each_entry(slice, &page->cp_layers, cpl_linkage) {
if (slice->cpl_obj->co_lu.lo_dev->ld_type == dtype)
- RETURN(slice);
+ return slice;
}
page = page->cp_child;
} while (page != NULL);
- RETURN(NULL);
+ return NULL;
}
/**
}
if (tree_lock)
spin_unlock(&hdr->coh_page_guard);
- RETURN(res);
+ return res;
}
EXPORT_SYMBOL(cl_page_gang_lookup);
} else {
page = ERR_PTR(-ENOMEM);
}
- RETURN(page);
+ return page;
}
/**
if (page != NULL) {
CS_PAGE_INC(o, hit);
- RETURN(page);
+ return page;
}
/* allocate and initialize cl_page */
page = cl_page_alloc(env, o, idx, vmpage, type);
if (IS_ERR(page))
- RETURN(page);
+ return page;
if (type == CPT_TRANSIENT) {
if (parent) {
page->cp_parent = parent;
parent->cp_child = page;
}
- RETURN(page);
+ return page;
}
/*
cl_page_delete0(env, ghost, 0);
cl_page_free(env, ghost);
}
- RETURN(page);
+ return page;
}
struct cl_page *cl_page_find(const struct lu_env *env, struct cl_object *o,
do {
list_for_each_entry(slice, &page->cp_layers, cpl_linkage) {
if (slice->cpl_ops->cpo_vmpage != NULL)
- RETURN(slice->cpl_ops->cpo_vmpage(env, slice));
+ return slice->cpl_ops->cpo_vmpage(env, slice);
}
page = page->cp_child;
} while (page != NULL);
*/
top = (struct cl_page *)vmpage->private;
if (top == NULL)
- RETURN(NULL);
+ return NULL;
for (page = top; page != NULL; page = page->cp_child) {
if (cl_object_same(page->cp_obj, obj)) {
}
}
LASSERT(ergo(page, page->cp_type == CPT_CACHEABLE));
- RETURN(page);
+ return page;
}
EXPORT_SYMBOL(cl_vmpage_page);
{
PINVRNT(env, page, cl_object_same(page->cp_obj, io->ci_obj));
- RETURN(CL_PAGE_INVOKE(env, page, op,
+ return CL_PAGE_INVOKE(env, page, op,
(const struct lu_env *,
const struct cl_page_slice *, struct cl_io *),
- io));
+ io);
}
static void cl_page_invoid(const struct lu_env *env,
int cl_page_is_owned(const struct cl_page *pg, const struct cl_io *io)
{
LINVRNT(cl_object_same(pg->cp_obj, io->ci_obj));
- RETURN(pg->cp_state == CPS_OWNED && pg->cp_owner == io);
+ return pg->cp_state == CPS_OWNED && pg->cp_owner == io;
}
EXPORT_SYMBOL(cl_page_is_owned);
}
}
PINVRNT(env, pg, ergo(result == 0, cl_page_invariant(pg)));
- RETURN(result);
+ return result;
}
/**
*/
result = slice->cpl_ops->cpo_is_vmlocked(env, slice);
PASSERT(env, pg, result == -EBUSY || result == -ENODATA);
- RETURN(result == -EBUSY);
+ return result == -EBUSY;
}
EXPORT_SYMBOL(cl_page_is_vmlocked);
static enum cl_page_state cl_req_type_state(enum cl_req_type crt)
{
- RETURN(crt == CRT_WRITE ? CPS_PAGEOUT : CPS_PAGEIN);
+ return crt == CRT_WRITE ? CPS_PAGEOUT : CPS_PAGEIN;
}
static void cl_page_io_start(const struct lu_env *env,
PINVRNT(env, pg, crt < CRT_NR);
if (crt >= CRT_NR)
- RETURN(-EINVAL);
+ return -EINVAL;
result = CL_PAGE_INVOKE(env, pg, CL_PAGE_OP(io[crt].cpo_make_ready),
(const struct lu_env *,
const struct cl_page_slice *));
cl_page_io_start(env, pg, crt);
}
CL_PAGE_HEADER(D_TRACE, env, pg, "%d %d\n", crt, result);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_page_make_ready);
PINVRNT(env, pg, cl_page_invariant(pg));
if (crt >= CRT_NR)
- RETURN(-EINVAL);
+ return -EINVAL;
list_for_each_entry(scan, &pg->cp_layers, cpl_linkage) {
if (scan->cpl_ops->io[crt].cpo_cache_add == NULL)
break;
}
CL_PAGE_HEADER(D_TRACE, env, pg, "%d %d\n", crt, result);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_page_cache_add);
result = cl_page_invoke(env, io, pg, CL_PAGE_OP(cpo_flush));
CL_PAGE_HEADER(D_TRACE, env, pg, "%d\n", result);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_page_flush);
const struct cl_page_slice *, struct cl_io *),
io);
PASSERT(env, page, rc != 0);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(cl_page_is_under_lock);
result = cl_io_init(env, io, CIT_MISC, obj);
if (result != 0) {
cl_io_fini(env, io);
- RETURN(io->ci_result);
+ return io->ci_result;
}
do {
} while (result != CLP_GANG_OKAY);
cl_io_fini(env, io);
- RETURN(result);
+ return result;
}
EXPORT_SYMBOL(cl_pages_prune);
memset(jobid, 0, JOBSTATS_JOBID_SIZE);
/* Jobstats isn't enabled */
if (strcmp(obd_jobid_var, JOBSTATS_DISABLE) == 0)
- RETURN(0);
+ return 0;
/* Use process name + fsuid as jobid */
if (strcmp(obd_jobid_var, JOBSTATS_PROCNAME_UID) == 0) {
snprintf(jobid, JOBSTATS_JOBID_SIZE, "%s.%u",
current_comm(),
from_kuid(&init_user_ns, current_fsuid()));
- RETURN(0);
+ return 0;
}
rc = cfs_get_environ(obd_jobid_var, jobid, &jobid_len);
obd_jobid_var, rc);
}
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lustre_get_jobid);
rc = dev;
out:
- RETURN(rc);
+ return rc;
}
int class_handle_ioctl(unsigned int cmd, unsigned long arg)
CDEBUG(D_IOCTL, "cmd = %x\n", cmd);
if (obd_ioctl_getdata(&buf, &len, (void *)arg)) {
CERROR("OBD ioctl: data error\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
data = (struct obd_ioctl_data *)buf;
out:
if (buf)
obd_ioctl_freedata(buf, len);
- RETURN(err);
+ return err;
} /* class_handle_ioctl */
extern struct miscdevice obd_psdev;
LPROCFS_STATS_FLAG_IRQ_SAFE);
if (obd_memory == NULL) {
CERROR("kmalloc of 'obd_memory' failed\n");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
lprocfs_counter_init(obd_memory, OBD_MEMORY_STAT,
dto = dt_locate(env, dt, fid);
if (IS_ERR(dto))
- RETURN(dto);
+ return dto;
LASSERT(dto != NULL);
if (dt_object_exists(dto))
- RETURN(dto);
+ return dto;
th = dt_trans_create(env, dt);
if (IS_ERR(th))
out:
if (rc) {
lu_object_put(env, &dto->do_lu);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
- RETURN(dto);
+ return dto;
}
EXPORT_SYMBOL(dt_find_or_create);
nob = rdpg->rp_count;
if (nob <= 0)
- RETURN(-EFAULT);
+ return -EFAULT;
/* Iterate through index and fill containers from @rdpg */
iops = &obj->do_index_ops->dio_it;
LASSERT(iops != NULL);
it = iops->init(env, obj, rdpg->rp_attrs, BYPASS_CAPA);
if (IS_ERR(it))
- RETURN(PTR_ERR(it));
+ return PTR_ERR(it);
rc = iops->load(env, it, rdpg->rp_hash);
if (rc == 0) {
if (rc >= 0)
rc = min_t(unsigned int, nlupgs * LU_PAGE_SIZE, rdpg->rp_count);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(dt_index_walk);
/* rp_count shouldn't be null and should be a multiple of the container
* size */
if (rdpg->rp_count <= 0 && (rdpg->rp_count & (LU_PAGE_SIZE - 1)) != 0)
- RETURN(-EFAULT);
+ return -EFAULT;
if (fid_seq(&ii->ii_fid) >= FID_SEQ_NORMAL)
/* we don't support directory transfer via OBD_IDX_READ for the
* time being */
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (!fid_is_quota(&ii->ii_fid))
/* block access to all local files except quota files */
- RETURN(-EPERM);
+ return -EPERM;
/* lookup index object subject to the transfer */
obj = dt_locate(env, dev, &ii->ii_fid);
if (IS_ERR(obj))
- RETURN(PTR_ERR(obj));
+ return PTR_ERR(obj);
if (dt_object_exists(obj) == 0)
GOTO(out, rc = -ENOENT);
if (class_search_type(name)) {
CDEBUG(D_IOCTL, "Type %s already registered\n", name);
- RETURN(-EEXIST);
+ return -EEXIST;
}
rc = -ENOMEM;
OBD_ALLOC(type, sizeof(*type));
if (type == NULL)
- RETURN(rc);
+ return rc;
OBD_ALLOC_PTR(type->typ_dt_ops);
OBD_ALLOC_PTR(type->typ_md_ops);
list_add(&type->typ_chain, &obd_types);
spin_unlock(&obd_types_lock);
- RETURN (0);
+ return 0;
failed:
if (type->typ_name != NULL)
if (type->typ_dt_ops != NULL)
OBD_FREE_PTR(type->typ_dt_ops);
OBD_FREE(type, sizeof(*type));
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_register_type);
if (!type) {
CERROR("unknown obd type\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (type->typ_refcnt) {
/* Remove ops, but leave the name for debugging */
OBD_FREE_PTR(type->typ_dt_ops);
OBD_FREE_PTR(type->typ_md_ops);
- RETURN(-EBUSY);
+ return -EBUSY;
}
if (type->typ_procroot) {
if (type->typ_md_ops != NULL)
OBD_FREE_PTR(type->typ_md_ops);
OBD_FREE(type, sizeof(*type));
- RETURN(0);
+ return 0;
} /* class_unregister_type */
EXPORT_SYMBOL(class_unregister_type);
if (strlen(name) >= MAX_OBD_NAME) {
CERROR("name/uuid must be < %u bytes long\n", MAX_OBD_NAME);
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
}
type = class_get_type(type_name);
if (type == NULL){
CERROR("OBD: unknown type: %s\n", type_name);
- RETURN(ERR_PTR(-ENODEV));
+ return ERR_PTR(-ENODEV);
}
newdev = obd_device_alloc();
CDEBUG(D_IOCTL, "Adding new device %s (%p)\n",
result->obd_name, result);
- RETURN(result);
+ return result;
out:
obd_device_free(newdev);
out_type:
if (!capa_cachep)
GOTO(out, -ENOMEM);
- RETURN(0);
+ return 0;
out:
obd_cleanup_caches();
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (!conn) {
CDEBUG(D_CACHE, "looking for null handle\n");
- RETURN(NULL);
+ return NULL;
}
if (conn->cookie == -1) { /* this means assign a new connection */
CDEBUG(D_CACHE, "want a new connection\n");
- RETURN(NULL);
+ return NULL;
}
CDEBUG(D_INFO, "looking for export cookie "LPX64"\n", conn->cookie);
export = class_handle2object(conn->cookie);
- RETURN(export);
+ return export;
}
EXPORT_SYMBOL(class_conn2export);
export->exp_obd->obd_num_exports++;
spin_unlock(&obd->obd_dev_lock);
cfs_hash_putref(hash);
- RETURN(export);
+ return export;
exit_unlock:
spin_unlock(&obd->obd_dev_lock);
export = class_new_export(obd, cluuid);
if (IS_ERR(export))
- RETURN(PTR_ERR(export));
+ return PTR_ERR(export);
conn->cookie = export->exp_handle.h_cookie;
class_export_put(export);
CDEBUG(D_IOCTL, "connect: client %s, cookie "LPX64"\n",
cluuid->uuid, conn->cookie);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(class_connect);
if (export == NULL) {
CWARN("attempting to free NULL export %p\n", export);
- RETURN(-EINVAL);
+ return -EINVAL;
}
spin_lock(&export->exp_lock);
class_unlink_export(export);
no_disconn:
class_export_put(export);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(class_disconnect);
!test_bit(OBD_ZOMBIE_STOP, &obd_zombie_flags);
spin_unlock(&obd_zombie_impexp_lock);
- RETURN(rc);
+ return rc;
}
/**
complete(&obd_zombie_stop);
- RETURN(0);
+ return 0;
}
task = kthread_run(obd_zombie_impexp_thread, NULL, "obd_zombid");
if (IS_ERR(task))
- RETURN(PTR_ERR(task));
+ return PTR_ERR(task);
wait_for_completion(&obd_zombie_start);
- RETURN(0);
+ return 0;
}
/**
* stop destroy zombie import/export thread
err = copy_from_user(&hdr, (void *)arg, sizeof(hdr));
if ( err )
- RETURN(err);
+ return err;
if (hdr.ioc_version != OBD_IOCTL_VERSION) {
CERROR("Version mismatch kernel (%x) vs application (%x)\n",
OBD_IOCTL_VERSION, hdr.ioc_version);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr.ioc_len > OBD_MAX_IOCTL_BUFFER) {
CERROR("User buffer len %d exceeds %d max buffer\n",
hdr.ioc_len, OBD_MAX_IOCTL_BUFFER);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (hdr.ioc_len < sizeof(struct obd_ioctl_data)) {
CERROR("User buffer too small for ioctl (%d)\n", hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* When there are lots of processes calling vmalloc on multi-core
if (*buf == NULL) {
CERROR("Cannot allocate control buffer of len %d\n",
hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
*len = hdr.ioc_len;
data = (struct obd_ioctl_data *)*buf;
err = copy_from_user(*buf, (void *)arg, hdr.ioc_len);
if ( err ) {
OBD_FREE_LARGE(*buf, hdr.ioc_len);
- RETURN(err);
+ return err;
}
if (obd_ioctl_is_invalid(data)) {
CERROR("ioctl not correctly formatted\n");
OBD_FREE_LARGE(*buf, hdr.ioc_len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (data->ioc_inllen1) {
static int obd_class_open(struct inode * inode, struct file * file)
{
try_module_get(THIS_MODULE);
- RETURN(0);
+ return 0;
}
/* closing /dev/obd */
static int obd_class_release(struct inode * inode, struct file * file)
{
module_put(THIS_MODULE);
- RETURN(0);
+ return 0;
}
/* to control /dev/obd */
/* Allow non-root access for OBD_IOC_PING_TARGET - used by lfs check */
if (!cfs_capable(CFS_CAP_SYS_ADMIN) && (cmd != OBD_IOC_PING_TARGET))
- RETURN(err = -EACCES);
+ return err = -EACCES;
if ((cmd & 0xffffff00) == ((int)'T') << 8) /* ignore all tty ioctls */
- RETURN(err = -ENOTTY);
+ return err = -ENOTTY;
err = class_handle_ioctl(cmd, (unsigned long)arg);
- RETURN(err);
+ return err;
}
/* declare character device */
out:
if (rc)
CERROR("error adding /proc/fs/lustre/devices file\n");
- RETURN(0);
+ return 0;
}
int class_procfs_clean(void)
if (proc_lustre_root) {
lprocfs_remove(&proc_lustre_root);
}
- RETURN(0);
+ return 0;
}
if (index == 0) {
CERROR("Can't cancel index 0 which is header\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
spin_lock(&loghandle->lgh_hdr_lock);
if (!ext2_clear_bit(index, llh->llh_bitmap)) {
spin_unlock(&loghandle->lgh_hdr_lock);
CDEBUG(D_RPCTRACE, "Catalog index %u already clear?\n", index);
- RETURN(-ENOENT);
+ return -ENOENT;
}
llh->llh_count--;
loghandle->lgh_id.lgl_ogen, rc);
GOTO(out_err, rc);
}
- RETURN(1);
+ return 1;
}
spin_unlock(&loghandle->lgh_hdr_lock);
loghandle->lgh_id.lgl_ogen, rc);
GOTO(out_err, rc);
}
- RETURN(0);
+ return 0;
out_err:
spin_lock(&loghandle->lgh_hdr_lock);
ext2_set_bit(index, llh->llh_bitmap);
rc = llog_handle2ops(handle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_read_header == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_read_header(env, handle);
if (rc == LLOG_EEMPTY) {
OBD_ALLOC_PTR(llh);
if (llh == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
handle->lgh_hdr = llh;
/* first assign flags to use llog_client_ops */
llh->llh_flags = flags;
OBD_FREE_PTR(llh);
handle->lgh_hdr = NULL;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_init_handle);
rec->lrh_index, rc, rec->lrh_len, lcfg->lcfg_command,
lustre_cfg_string(lcfg, 0), lustre_cfg_string(lcfg, 1));
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_copy_handler);
OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
if (!buf) {
lpi->lpi_rc = -ENOMEM;
- RETURN(0);
+ return 0;
}
if (cd != NULL) {
OBD_ALLOC_PTR(lpi);
if (lpi == NULL) {
CERROR("cannot alloc pointer\n");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
lpi->lpi_loghandle = loghandle;
lpi->lpi_cb = cb;
CERROR("%s: cannot start thread: rc = %d\n",
loghandle->lgh_ctxt->loc_obd->obd_name, rc);
OBD_FREE_PTR(lpi);
- RETURN(rc);
+ return rc;
}
wait_for_completion(&lpi->lpi_completion);
} else {
}
rc = lpi->lpi_rc;
OBD_FREE_PTR(lpi);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_process_or_fork);
OBD_ALLOC(buf, LLOG_CHUNK_SIZE);
if (!buf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (cd != NULL)
first_index = cd->lpcd_first_idx + 1;
out:
if (buf)
OBD_FREE(buf, LLOG_CHUNK_SIZE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_reverse_process);
rc = llog_handle2ops(loghandle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_exist == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = lop->lop_exist(loghandle);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_exist);
rc = llog_handle2ops(loghandle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_declare_create == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
rc = lop->lop_declare_create(env, loghandle, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_declare_create);
rc = llog_handle2ops(handle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
if (lop->lop_create == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
rc = lop->lop_create(env, handle, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_create);
rc = llog_handle2ops(handle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
LASSERT(lop);
if (lop->lop_declare_write_rec == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
rc = lop->lop_declare_write_rec(env, handle, rec, idx, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_declare_write_rec);
rc = llog_handle2ops(handle, &lop);
if (rc)
- RETURN(rc);
+ return rc;
LASSERT(lop);
if (lop->lop_write_rec == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (buf)
buflen = rec->lrh_len + sizeof(struct llog_rec_hdr) +
buf, idx, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_write_rec);
int raised, rc;
if (lgh->lgh_logops->lop_add == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
rc = lgh->lgh_logops->lop_add(env, lgh, rec, logcookies, buf, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_add);
int raised, rc;
if (lgh->lgh_logops->lop_declare_add == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
if (!raised)
rc = lgh->lgh_logops->lop_declare_add(env, lgh, rec, th);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_declare_add);
rc = llog_open(env, ctxt, res, logid, name, LLOG_OPEN_NEW);
if (rc)
- RETURN(rc);
+ return rc;
if (llog_exist(*res))
- RETURN(0);
+ return 0;
if ((*res)->lgh_obj != NULL) {
struct dt_device *d;
out:
if (rc)
llog_close(env, *res);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_open_create);
/* nothing to erase */
if (name == NULL && logid == NULL)
- RETURN(0);
+ return 0;
rc = llog_open(env, ctxt, &handle, logid, name, LLOG_OPEN_EXISTS);
if (rc < 0)
- RETURN(rc);
+ return rc;
rc = llog_init_handle(env, handle, LLOG_F_IS_PLAIN, NULL);
if (rc == 0)
rc2 = llog_close(env, handle);
if (rc == 0)
rc = rc2;
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_erase);
th = dt_trans_create(env, dt);
if (IS_ERR(th))
- RETURN(PTR_ERR(th));
+ return PTR_ERR(th);
rc = llog_declare_write_rec(env, loghandle, rec, idx, th);
if (rc)
cookiecount, buf, idx, NULL);
up_write(&loghandle->lgh_lock);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_write);
if (ctxt->loc_logops->lop_open == NULL) {
*lgh = NULL;
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
}
*lgh = llog_alloc_handle();
if (*lgh == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
(*lgh)->lgh_ctxt = ctxt;
(*lgh)->lgh_logops = ctxt->loc_logops;
llog_free_handle(*lgh);
*lgh = NULL;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_open);
rc = lop->lop_close(env, loghandle);
out:
llog_handle_put(loghandle);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_close);
/* maximum number of available slots in catlog is bitmap_size - 2 */
if (llh->llh_cat_idx == index) {
CERROR("no free catalog slots for log...\n");
- RETURN(-ENOSPC);
+ return -ENOSPC;
}
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_LLOG_CREATE_FAILED))
- RETURN(-ENOSPC);
+ return -ENOSPC;
rc = llog_create(env, loghandle, th);
/* if llog is already created, no need to initialize it */
if (rc == -EEXIST) {
- RETURN(0);
+ return 0;
} else if (rc != 0) {
CERROR("%s: can't create new plain llog in catalog: rc = %d\n",
loghandle->lgh_ctxt->loc_obd->obd_name, rc);
- RETURN(rc);
+ return rc;
}
rc = llog_init_handle(env, loghandle,
GOTO(out_destroy, rc);
loghandle->lgh_hdr->llh_cat_idx = index;
- RETURN(0);
+ return 0;
out_destroy:
llog_destroy(env, loghandle);
- RETURN(rc);
+ return rc;
}
/* Open an existent log handle and add it to the open list.
int rc = 0;
if (cathandle == NULL)
- RETURN(-EBADF);
+ return -EBADF;
down_write(&cathandle->lgh_lock);
list_for_each_entry(loghandle, &cathandle->u.chd.chd_head,
CERROR("%s: error opening log id "DOSTID":%x: rc = %d\n",
cathandle->lgh_ctxt->loc_obd->obd_name,
POSTID(&logid->lgl_oi), logid->lgl_ogen, rc);
- RETURN(rc);
+ return rc;
}
rc = llog_init_handle(env, loghandle, LLOG_F_IS_PLAIN, NULL);
if (rc < 0) {
llog_close(env, loghandle);
loghandle = NULL;
- RETURN(rc);
+ return rc;
}
down_write(&cathandle->lgh_lock);
if (cathandle->lgh_ctxt->loc_handle == cathandle)
cathandle->lgh_ctxt->loc_handle = NULL;
rc = llog_close(env, cathandle);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_close);
if (llh == NULL ||
loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
up_read(&cathandle->lgh_lock);
- RETURN(loghandle);
+ return loghandle;
} else {
up_write(&loghandle->lgh_lock);
}
LASSERT(llh);
if (loghandle->lgh_last_idx < LLOG_BITMAP_SIZE(llh) - 1) {
up_write(&cathandle->lgh_lock);
- RETURN(loghandle);
+ return loghandle;
} else {
up_write(&loghandle->lgh_lock);
}
down_write_nested(&loghandle->lgh_lock, LLOGH_LOG);
up_write(&cathandle->lgh_lock);
LASSERT(loghandle);
- RETURN(loghandle);
+ return loghandle;
}
/* Add a single record to the recovery log(s) using a catalog
rc = llog_cat_new_log(env, cathandle, loghandle, th);
if (rc < 0) {
up_write(&loghandle->lgh_lock);
- RETURN(rc);
+ return rc;
}
}
/* now let's try to add the record */
rc = llog_cat_new_log(env, cathandle, loghandle, th);
if (rc < 0) {
up_write(&loghandle->lgh_lock);
- RETURN(rc);
+ return rc;
}
}
/* now let's try to add the record */
up_write(&loghandle->lgh_lock);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_add_rec);
llog_declare_write_rec(env, next, rec, -1, th);
}
out:
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_declare_add_rec);
th = dt_trans_create(env, dt);
if (IS_ERR(th))
- RETURN(PTR_ERR(th));
+ return PTR_ERR(th);
rc = llog_cat_declare_add_rec(env, cathandle, rec, th);
if (rc)
rc = llog_cat_add_rec(env, cathandle, rec, reccookie,
buf, th);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_add);
cathandle->lgh_ctxt->loc_obd->obd_name, failed, count,
rc);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_cancel_records);
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cat_llh->lgh_ctxt->loc_obd->obd_name,
POSTID(&lir->lid_id.lgl_oi), rc);
- RETURN(rc);
+ return rc;
}
if (rec->lrh_index < d->lpd_startcat)
/* Skip processing of the logs until startcat */
- RETURN(0);
+ return 0;
if (d->lpd_startidx > 0) {
struct llog_process_cat_data cd;
}
llog_handle_put(llh);
- RETURN(rc);
+ return rc;
}
int llog_cat_process_or_fork(const struct lu_env *env,
rc = llog_process_or_fork(env, cat_llh, llog_cat_process_cb,
&d, &cd, fork);
if (rc != 0)
- RETURN(rc);
+ return rc;
cd.lpcd_first_idx = 0;
cd.lpcd_last_idx = cat_llh->lgh_last_idx;
&d, NULL, fork);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_process_or_fork);
if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
DOSTID"\n", POSTID(&lir->lid_id.lgl_oi), lir->lid_id.lgl_ogen,
CERROR("%s: cannot find handle for llog "DOSTID": %d\n",
cat_llh->lgh_ctxt->loc_obd->obd_name,
POSTID(&lir->lid_id.lgl_oi), rc);
- RETURN(rc);
+ return rc;
}
rc = llog_reverse_process(env, llh, d->lpd_cb, d->lpd_data, NULL);
llog_handle_put(llh);
- RETURN(rc);
+ return rc;
}
int llog_cat_reverse_process(const struct lu_env *env,
llog_cat_reverse_process_cb,
&d, &cd);
if (rc != 0)
- RETURN(rc);
+ return rc;
cd.lpcd_first_idx = le32_to_cpu(llh->llh_cat_idx);
cd.lpcd_last_idx = 0;
&d, NULL);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cat_reverse_process);
POSTID(&cathandle->lgh_id.lgl_oi), llh->llh_cat_idx);
}
- RETURN(0);
+ return 0;
}
/* Cleanup deleted plain llog traces from catalog */
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_HA, "processing log "DOSTID":%x at index %u of catalog "
/* remove index from catalog */
llog_cat_cleanup(env, cathandle, NULL, rec->lrh_index);
}
- RETURN(rc);
+ return rc;
}
llh = loghandle->lgh_hdr;
}
llog_handle_put(loghandle);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(cat_cancel_cb);
rc = llog_init_handle(env, llh, LLOG_F_IS_CAT, NULL);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_process_or_fork(env, llh, cat_cancel_cb, NULL, NULL, false);
if (rc)
CERROR("%s: llog_process() with cat_cancel_cb failed: rc = "
"%d\n", llh->lgh_ctxt->loc_obd->obd_name, rc);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(llog_cat_init_and_process);
start = str;
if (*start != '#')
- RETURN(-EINVAL);
+ return -EINVAL;
start++;
if (start - str >= len - 1)
- RETURN(-EINVAL);
+ return -EINVAL;
end = strchr(start, '#');
if (end == NULL || end == start)
- RETURN(-EINVAL);
+ return -EINVAL;
*end = '\0';
id = simple_strtoull(start, &endp, 0);
if (endp != end)
- RETURN(-EINVAL);
+ return -EINVAL;
start = ++end;
if (start - str >= len - 1)
- RETURN(-EINVAL);
+ return -EINVAL;
end = strchr(start, '#');
if (end == NULL || end == start)
- RETURN(-EINVAL);
+ return -EINVAL;
*end = '\0';
seq = simple_strtoull(start, &endp, 0);
if (endp != end)
- RETURN(-EINVAL);
+ return -EINVAL;
ostid_set_seq(&logid->lgl_oi, seq);
ostid_set_id(&logid->lgl_oi, id);
start = ++end;
if (start - str >= len - 1)
- RETURN(-EINVAL);
+ return -EINVAL;
logid->lgl_ogen = simple_strtoul(start, &endp, 16);
if (*endp != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
- RETURN(0);
+ return 0;
}
static int llog_check_cb(const struct lu_env *env, struct llog_handle *handle,
cfs_size_round(ioc_data->ioc_inllen3);
from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
if (*endp != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
if (*endp != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
ioc_data->ioc_inllen1 = 0;
out = ioc_data->ioc_bulk;
}
cur_index = rec->lrh_index;
if (cur_index < from)
- RETURN(0);
+ return 0;
if (to > 0 && cur_index > to)
- RETURN(-LLOG_EEMPTY);
+ return -LLOG_EEMPTY;
if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
rec->lrh_len);
}
if (handle->lgh_ctxt == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
rc = llog_cat_id2handle(env, handle, &loghandle, &lir->lid_id);
if (rc) {
CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
POSTID(&lir->lid_id.lgl_oi),
lir->lid_id.lgl_ogen);
- RETURN(rc);
+ return rc;
}
rc = llog_process(env, loghandle, llog_check_cb, NULL, NULL);
llog_handle_put(loghandle);
if (remains <= 0) {
CERROR("%s: no space to print log records\n",
handle->lgh_ctxt->loc_obd->obd_name);
- RETURN(-LLOG_EEMPTY);
+ return -LLOG_EEMPTY;
}
}
- RETURN(rc);
+ return rc;
}
static int llog_print_cb(const struct lu_env *env, struct llog_handle *handle,
cfs_size_round(ioc_data->ioc_inllen3);
from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
if (*endp != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
if (*endp != '\0')
- RETURN(-EINVAL);
+ return -EINVAL;
out = ioc_data->ioc_bulk;
ioc_data->ioc_inllen1 = 0;
}
cur_index = rec->lrh_index;
if (cur_index < from)
- RETURN(0);
+ return 0;
if (to > 0 && cur_index > to)
- RETURN(-LLOG_EEMPTY);
+ return -LLOG_EEMPTY;
if (handle->lgh_hdr->llh_flags & LLOG_F_IS_CAT) {
struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
l = snprintf(out, remains,
rc = class_config_parse_rec(rec, out, remains);
if (rc < 0)
- RETURN(rc);
+ return rc;
l = rc;
} else {
l = snprintf(out, remains,
remains -= l;
if (remains <= 0) {
CERROR("not enough space for print log records\n");
- RETURN(-LLOG_EEMPTY);
+ return -LLOG_EEMPTY;
}
- RETURN(0);
+ return 0;
}
static int llog_remove_log(const struct lu_env *env, struct llog_handle *cat,
struct llog_logid *logid)
if (rc) {
CDEBUG(D_IOCTL, "cannot find log #"DOSTID"#%08x\n",
POSTID(&logid->lgl_oi), logid->lgl_ogen);
- RETURN(-ENOENT);
+ return -ENOENT;
}
rc = llog_destroy(env, log);
llog_cat_cleanup(env, cat, log, log->u.phd.phd_cookie.lgc_index);
out:
llog_handle_put(log);
- RETURN(rc);
+ return rc;
}
int rc;
if (rec->lrh_type != LLOG_LOGID_MAGIC)
- RETURN(-EINVAL);
+ return -EINVAL;
rc = llog_remove_log(env, handle, &lir->lid_id);
- RETURN(rc);
+ return rc;
}
if (*data->ioc_inlbuf1 == '#') {
rc = str2logid(&logid, data->ioc_inlbuf1, data->ioc_inllen1);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_open(env, ctxt, &handle, &logid, NULL,
LLOG_OPEN_EXISTS);
if (rc)
- RETURN(rc);
+ return rc;
} else if (*data->ioc_inlbuf1 == '$') {
char *name = data->ioc_inlbuf1 + 1;
rc = llog_open(env, ctxt, &handle, NULL, name,
LLOG_OPEN_EXISTS);
if (rc)
- RETURN(rc);
+ return rc;
} else {
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = llog_init_handle(env, handle, 0, NULL);
llog_cat_close(env, handle);
else
llog_close(env, handle);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_ioctl);
}
out:
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_write_blob(struct obd_device *obd, struct l_file *file,
if (saved_off > file->f_pos)
file->f_pos = saved_off;
LASSERT(rc <= 0);
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_read_blob(struct obd_device *obd, struct l_file *file,
rc = fsfilt_read_record(obd, file, buf, size, &offset);
if (rc) {
CERROR("error reading log record: rc %d\n", rc);
- RETURN(rc);
+ return rc;
}
- RETURN(0);
+ return 0;
}
static int llog_lvfs_read_header(const struct lu_env *env,
if (i_size_read(handle->lgh_file->f_dentry->d_inode) == 0) {
CDEBUG(D_HA, "not reading header from 0-byte log\n");
- RETURN(LLOG_EEMPTY);
+ return LLOG_EEMPTY;
}
rc = llog_lvfs_read_blob(obd, handle->lgh_file, handle->lgh_hdr,
handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index;
handle->lgh_file->f_pos = i_size_read(handle->lgh_file->f_dentry->d_inode);
- RETURN(rc);
+ return rc;
}
/* returns negative in on error; 0 if success && reccookie == 0; 1 otherwise */
else
rc = (reclen > LLOG_CHUNK_SIZE) ? -E2BIG : 0;
if (rc)
- RETURN(rc);
+ return rc;
if (buf)
/* write_blob adds header and tail to lrh_len. */
}
if (idx && llh->llh_size && llh->llh_size != rec->lrh_len)
- RETURN(-EINVAL);
+ return -EINVAL;
if (!ext2_test_bit(idx, llh->llh_bitmap))
CERROR("Modify unset record %u\n", idx);
rc = llog_lvfs_write_blob(obd, file, &llh->llh_hdr, NULL, 0);
/* we are done if we only write the header or on error */
if (rc || idx == 0)
- RETURN(rc);
+ return rc;
if (buf) {
/* We assume that caller has set lgh_cur_* */
if (rec->lrh_index != loghandle->lgh_cur_idx) {
CERROR("modify idx mismatch %u/%d\n",
idx, loghandle->lgh_cur_idx);
- RETURN(-EFAULT);
+ return -EFAULT;
}
} else {
/* Assumes constant lrh_len */
reccookie->lgc_index = idx;
rc = 1;
}
- RETURN(rc);
+ return rc;
}
/* Make sure that records don't cross a chunk boundary, so we can
index = loghandle->lgh_last_idx + 1;
rc = llog_lvfs_pad(obd, file, left, index);
if (rc)
- RETURN(rc);
+ return rc;
loghandle->lgh_last_idx++; /*for pad rec*/
}
/* if it's the last idx in log file, then return -ENOSPC */
if (loghandle->lgh_last_idx >= LLOG_BITMAP_SIZE(llh) - 1)
- RETURN(-ENOSPC);
+ return -ENOSPC;
loghandle->lgh_last_idx++;
index = loghandle->lgh_last_idx;
LASSERT(index < LLOG_BITMAP_SIZE(llh));
rc = llog_lvfs_write_blob(obd, file, &llh->llh_hdr, NULL, 0);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_lvfs_write_blob(obd, file, rec, buf, file->f_pos);
if (rc)
- RETURN(rc);
+ return rc;
CDEBUG(D_RPCTRACE, "added record "DOSTID": idx: %u, %u \n",
POSTID(&loghandle->lgh_id.lgl_oi), index, rec->lrh_len);
if (rc == 0 && rec->lrh_type == LLOG_GEN_REC)
rc = 1;
- RETURN(rc);
+ return rc;
}
/* We can skip reading at least as many log blocks as the number of
int rc;
if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_OTHER, "looking for log index %u (cur idx %u off "LPU64")\n",
next_idx, *cur_idx, *cur_offset);
POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen,
*cur_offset);
- RETURN(rc);
+ return rc;
}
/* put number of bytes read into rc to make code simpler */
}
if (rc == 0) /* end of file, nothing to do */
- RETURN(0);
+ return 0;
if (rc < sizeof(*tail)) {
CERROR("Invalid llog block at log id "DOSTID"/%u offset"
LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, *cur_offset);
- RETURN(-EINVAL);
+ return -EINVAL;
}
rec = buf;
CERROR("Invalid llog tail at log id "DOSTID"/%u offset "
LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, *cur_offset);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (tail->lrt_index < next_idx)
continue;
if (rec->lrh_index > next_idx) {
CERROR("missed desired record? %u > %u\n",
rec->lrh_index, next_idx);
- RETURN(-ENOENT);
+ return -ENOENT;
}
- RETURN(0);
+ return 0;
}
- RETURN(-EIO);
+ return -EIO;
}
static int llog_lvfs_prev_block(const struct lu_env *env,
int rc;
if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_OTHER, "looking for log index %u\n", prev_idx);
POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen,
cur_offset);
- RETURN(rc);
+ return rc;
}
/* put number of bytes read into rc to make code simpler */
rc = cur_offset - ppos;
if (rc == 0) /* end of file, nothing to do */
- RETURN(0);
+ return 0;
if (rc < sizeof(*tail)) {
CERROR("Invalid llog block at log id "DOSTID"/%u offset"
LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, cur_offset);
- RETURN(-EINVAL);
+ return -EINVAL;
}
rec = buf;
CERROR("Invalid llog tail at log id "DOSTID"/%u offset"
LPU64"\n", POSTID(&loghandle->lgh_id.lgl_oi),
loghandle->lgh_id.lgl_ogen, cur_offset);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (tail->lrt_index < prev_idx)
continue;
if (rec->lrh_index > prev_idx) {
CERROR("missed desired record? %u > %u\n",
rec->lrh_index, prev_idx);
- RETURN(-ENOENT);
+ return -ENOENT;
}
- RETURN(0);
+ return 0;
}
- RETURN(-EIO);
+ return -EIO;
}
static struct file *llog_filp_open(char *dir, char *name, int flags, int mode)
if (open_param != LLOG_OPEN_NEW && handle->lgh_file == NULL)
GOTO(out_name, rc = -ENOENT);
- RETURN(0);
+ return 0;
out_name:
if (handle->lgh_name != NULL)
OBD_FREE(handle->lgh_name, strlen(name) + 1);
out:
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_exist(struct llog_handle *handle)
file = llog_filp_open(MOUNT_CONFIGS_DIR, handle->lgh_name,
open_flags, 0644);
if (IS_ERR(file))
- RETURN(PTR_ERR(file));
+ return PTR_ERR(file);
lustre_build_llog_lvfs_oid(&handle->lgh_id,
file->f_dentry->d_inode->i_ino,
} else {
OBDO_ALLOC(oa);
if (oa == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
ostid_set_seq_llog(&oa->o_oi);
oa->o_valid = OBD_MD_FLGENER | OBD_MD_FLGROUP;
out:
OBDO_FREE(oa);
}
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_close(const struct lu_env *env,
int rc;
if (handle->lgh_file == NULL)
- RETURN(0);
+ return 0;
rc = filp_close(handle->lgh_file, 0);
if (rc)
CERROR("%s: error closing llog #"DOSTID"#%08x: "
OBD_FREE(handle->lgh_name, strlen(handle->lgh_name) + 1);
handle->lgh_name = NULL;
}
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_destroy(const struct lu_env *env,
dput(fdentry);
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- RETURN(rc);
+ return rc;
}
OBDO_ALLOC(oa);
if (oa == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oa->o_oi = handle->lgh_id.lgl_oi;
oa->o_generation = handle->lgh_id.lgl_ogen;
rc = rc1;
out:
OBDO_FREE(oa);
- RETURN(rc);
+ return rc;
}
static int llog_lvfs_declare_create(const struct lu_env *env,
l_wait_event(olg->olg_waitq,
llog_group_ctxt_null(olg, idx), &lwi);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cleanup);
int rc = 0;
if (index < 0 || index >= LLOG_MAX_CTXTS)
- RETURN(-EINVAL);
+ return -EINVAL;
LASSERT(olg != NULL);
ctxt = llog_new_ctxt(obd);
if (!ctxt)
- RETURN(-ENOMEM);
+ return -ENOMEM;
ctxt->loc_obd = obd;
ctxt->loc_olg = olg;
}
rc = 0;
}
- RETURN(rc);
+ return rc;
}
if (op->lop_setup) {
ctxt->loc_flags &= ~LLOG_CTXT_FLAG_UNINITIALIZED;
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_setup);
int rc = 0;
if (!ctxt)
- RETURN(0);
+ return 0;
if (CTXTP(ctxt, sync))
rc = CTXTP(ctxt, sync)(ctxt, exp, flags);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_sync);
if (!ctxt) {
CERROR("No ctxt\n");
- RETURN(-ENODEV);
+ return -ENODEV;
}
if (ctxt->loc_flags & LLOG_CTXT_FLAG_UNINITIALIZED)
- RETURN(-ENXIO);
+ return -ENXIO;
CTXT_CHECK_OP(ctxt, obd_add, -EOPNOTSUPP);
raised = cfs_cap_raised(CFS_CAP_SYS_RESOURCE);
numcookies);
if (!raised)
cfs_cap_lower(CFS_CAP_SYS_RESOURCE);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_obd_add);
if (!ctxt) {
CERROR("No ctxt\n");
- RETURN(-ENODEV);
+ return -ENODEV;
}
CTXT_CHECK_OP(ctxt, cancel, -EOPNOTSUPP);
rc = CTXTP(ctxt, cancel)(env, ctxt, lsm, count, cookies, flags);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_cancel);
OBD_COUNTER_INCREMENT(obd, llog_init);
rc = OBP(obd, llog_init)(obd, olg, disk_obd, index);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(obd_llog_init);
OBD_COUNTER_INCREMENT(obd, llog_finish);
rc = OBP(obd, llog_finish)(obd, count);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(obd_llog_finish);
o->do_lu.lo_dev->ld_obd->obd_name, rc);
out:
dt_write_unlock(env, o);
- RETURN(rc);
+ return rc;
}
static int llog_osd_write_blob(const struct lu_env *env, struct dt_object *o,
dt_attr_set(env, o, &lgi->lgi_attr, th, BYPASS_CAPA);
}
- RETURN(rc);
+ return rc;
}
static int llog_osd_read_header(const struct lu_env *env,
rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
if (rc)
- RETURN(rc);
+ return rc;
LASSERT(lgi->lgi_attr.la_valid & LA_SIZE);
if (lgi->lgi_attr.la_size == 0) {
CDEBUG(D_HA, "not reading header from 0-byte log\n");
- RETURN(LLOG_EEMPTY);
+ return LLOG_EEMPTY;
}
lgi->lgi_off = 0;
CERROR("%s: error reading log header from "DFID": rc = %d\n",
o->do_lu.lo_dev->ld_obd->obd_name,
PFID(lu_object_fid(&o->do_lu)), rc);
- RETURN(rc);
+ return rc;
}
llh_hdr = &handle->lgh_hdr->llh_hdr;
handle->lgh_name ? handle->lgh_name : "",
PFID(lu_object_fid(&o->do_lu)),
llh_hdr->lrh_type, LLOG_HDR_MAGIC);
- RETURN(-EIO);
+ return -EIO;
} else if (llh_hdr->lrh_len != LLOG_CHUNK_SIZE) {
CERROR("%s: incorrectly sized log %s "DFID" header: "
"%#x (expected %#x)\n"
handle->lgh_name ? handle->lgh_name : "",
PFID(lu_object_fid(&o->do_lu)),
llh_hdr->lrh_len, LLOG_CHUNK_SIZE);
- RETURN(-EIO);
+ return -EIO;
}
handle->lgh_last_idx = handle->lgh_hdr->llh_tail.lrt_index;
- RETURN(0);
+ return 0;
}
static int llog_osd_declare_write_rec(const struct lu_env *env,
rc = dt_declare_record_write(env, o, sizeof(struct llog_log_hdr), 0,
th);
if (rc || idx == 0) /* if error or just header */
- RETURN(rc);
+ return rc;
if (dt_object_exists(o)) {
rc = dt_attr_get(env, o, &lgi->lgi_attr, BYPASS_CAPA);
lgi->lgi_off = lgi->lgi_attr.la_size;
LASSERT(ergo(rc == 0, lgi->lgi_attr.la_valid & LA_SIZE));
if (rc)
- RETURN(rc);
+ return rc;
rc = dt_declare_punch(env, o, lgi->lgi_off, OBD_OBJECT_EOF, th);
if (rc)
- RETURN(rc);
+ return rc;
} else {
lgi->lgi_off = 0;
}
/* XXX: implement declared window or multi-chunks approach */
rc = dt_declare_record_write(env, o, 32 * 1024, lgi->lgi_off, th);
- RETURN(rc);
+ return rc;
}
/* returns negative in on error; 0 if success && reccookie == 0; 1 otherwise */
else
rc = (reclen > LLOG_CHUNK_SIZE) ? -E2BIG : 0;
if (rc)
- RETURN(rc);
+ return rc;
rc = dt_attr_get(env, o, &lgi->lgi_attr, NULL);
if (rc)
- RETURN(rc);
+ return rc;
if (buf)
/* write_blob adds header and tail to lrh_len. */
LBUG();
if (idx && llh->llh_size && llh->llh_size != rec->lrh_len)
- RETURN(-EINVAL);
+ return -EINVAL;
if (!ext2_test_bit(idx, llh->llh_bitmap))
CERROR("%s: modify unset record %u\n",
&lgi->lgi_off, th);
/* we are done if we only write the header or on error */
if (rc || idx == 0)
- RETURN(rc);
+ return rc;
if (buf) {
/* We assume that caller has set lgh_cur_* */
CERROR("%s: modify idx mismatch %u/%d\n",
o->do_lu.lo_dev->ld_obd->obd_name, idx,
loghandle->lgh_cur_idx);
- RETURN(-EFAULT);
+ return -EFAULT;
}
} else {
/* Assumes constant lrh_len */
reccookie->lgc_index = idx;
rc = 1;
}
- RETURN(rc);
+ return rc;
}
/* Make sure that records don't cross a chunk boundary, so we can
index = loghandle->lgh_last_idx + 1;
rc = llog_osd_pad(env, o, &lgi->lgi_off, left, index, th);
if (rc)
- RETURN(rc);
+ return rc;
loghandle->lgh_last_idx++; /*for pad rec*/
}
/* if it's the last idx in log file, then return -ENOSPC */
if (loghandle->lgh_last_idx >= LLOG_BITMAP_SIZE(llh) - 1)
- RETURN(-ENOSPC);
+ return -ENOSPC;
loghandle->lgh_last_idx++;
index = loghandle->lgh_last_idx;
reccookie->lgc_subsys = -1;
rc = 1;
}
- RETURN(rc);
+ return rc;
}
/* We can skip reading at least as many log blocks as the number of
LASSERT(lgi);
if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_OTHER, "looking for log index %u (cur idx %u off "LPU64")\n",
next_idx, *cur_idx, *cur_offset);
int rc;
if (len == 0 || len & (LLOG_CHUNK_SIZE - 1))
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_OTHER, "looking for log index %u\n", prev_idx);
ls = ls_device_get(dt);
if (IS_ERR(ls))
- RETURN(PTR_ERR(ls));
+ return PTR_ERR(ls);
mutex_lock(&ls->ls_los_mutex);
los = dt_los_find(ls, name != NULL ? FID_SEQ_LLOG_NAME : FID_SEQ_LLOG);
handle->private_data = los;
LASSERT(handle->lgh_ctxt);
- RETURN(rc);
+ return rc;
out_put:
lu_object_put(env, &o->do_lu);
OBD_FREE(handle->lgh_name, strlen(name) + 1);
out:
dt_los_put(los);
- RETURN(rc);
+ return rc;
}
static int llog_osd_exist(struct llog_handle *handle)
/* object can be created by another thread */
o = res->lgh_obj;
if (dt_object_exists(o))
- RETURN(0);
+ return 0;
los = res->private_data;
LASSERT(los);
rc = llog_osd_declare_new_object(env, los, o, th);
if (rc)
- RETURN(rc);
+ return rc;
rc = dt_declare_record_write(env, o, LLOG_CHUNK_SIZE, 0, th);
if (rc)
- RETURN(rc);
+ return rc;
if (res->lgh_name) {
struct dt_object *llog_dir;
llog_dir = llog_osd_dir_get(env, res->lgh_ctxt);
if (IS_ERR(llog_dir))
- RETURN(PTR_ERR(llog_dir));
+ return PTR_ERR(llog_dir);
logid_to_fid(&res->lgh_id, &lgi->lgi_fid);
rc = dt_declare_insert(env, llog_dir,
(struct dt_rec *)&lgi->lgi_fid,
o->do_lu.lo_dev->ld_obd->obd_name,
res->lgh_name, rc);
}
- RETURN(rc);
+ return rc;
}
/* This is a callback from the llog_* functions.
/* llog can be already created */
if (dt_object_exists(o))
- RETURN(-EEXIST);
+ return -EEXIST;
los = res->private_data;
LASSERT(los);
dt_write_unlock(env, o);
if (rc)
- RETURN(rc);
+ return rc;
if (res->lgh_name) {
struct dt_object *llog_dir;
llog_dir = llog_osd_dir_get(env, res->lgh_ctxt);
if (IS_ERR(llog_dir))
- RETURN(PTR_ERR(llog_dir));
+ return PTR_ERR(llog_dir);
logid_to_fid(&res->lgh_id, &lgi->lgi_fid);
dt_read_lock(env, llog_dir, 0);
o->do_lu.lo_dev->ld_obd->obd_name,
res->lgh_name, rc);
}
- RETURN(rc);
+ return rc;
}
static int llog_osd_close(const struct lu_env *env, struct llog_handle *handle)
if (handle->lgh_name)
OBD_FREE(handle->lgh_name, strlen(handle->lgh_name) + 1);
- RETURN(rc);
+ return rc;
}
static int llog_osd_destroy(const struct lu_env *env,
th = dt_trans_create(env, d);
if (IS_ERR(th))
- RETURN(PTR_ERR(th));
+ return PTR_ERR(th);
if (loghandle->lgh_name) {
llog_dir = llog_osd_dir_get(env, ctxt);
dt_trans_stop(env, d, th);
if (llog_dir != NULL)
lu_object_put(env, &llog_dir->do_lu);
- RETURN(rc);
+ return rc;
}
static int llog_osd_setup(const struct lu_env *env, struct obd_device *obd,
dt = ctxt->loc_exp->exp_obd->obd_lvfs_ctxt.dt;
ls = ls_device_get(dt);
if (IS_ERR(ls))
- RETURN(PTR_ERR(ls));
+ return PTR_ERR(ls);
mutex_lock(&ls->ls_los_mutex);
los = dt_los_find(ls, FID_SEQ_LLOG);
o = dt_locate(env, d, &lgi->lgi_fid);
if (IS_ERR(o))
- RETURN(PTR_ERR(o));
+ return PTR_ERR(o);
if (!dt_object_exists(o)) {
th = dt_trans_create(env, d);
out:
lu_object_put(env, &o->do_lu);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_osd_get_cat_list);
int rc, size;
if (!count)
- RETURN(0);
+ return 0;
LASSERT(d);
o = dt_locate(env, d, &lgi->lgi_fid);
if (IS_ERR(o))
- RETURN(PTR_ERR(o));
+ return PTR_ERR(o);
if (!dt_object_exists(o))
GOTO(out, rc = -ENOENT);
dt_trans_stop(env, d, th);
out:
lu_object_put(env, &o->do_lu);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_osd_put_cat_list);
if (active_recs != num_recs) {
CERROR("%s: expected %d active recs after write, found %d\n",
test, num_recs, active_recs);
- RETURN(-ERANGE);
+ return -ERANGE;
}
if (llh->lgh_hdr->llh_count != num_recs) {
CERROR("%s: handle->count is %d, expected %d after write\n",
test, llh->lgh_hdr->llh_count, num_recs);
- RETURN(-ERANGE);
+ return -ERANGE;
}
if (llh->lgh_last_idx < last_idx) {
CERROR("%s: handle->last_idx is %d, expected %d after write\n",
test, llh->lgh_last_idx, last_idx);
- RETURN(-ERANGE);
+ return -ERANGE;
}
- RETURN(0);
+ return 0;
}
/* Test named-log create/open, close */
}
out:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test named-log reopen; returns opened log on success */
out_put:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test record writing, single and in bulk */
num_recs++;
if (rc < 0) {
CERROR("3a: write one log record failed: %d\n", rc);
- RETURN(rc);
+ return rc;
}
rc = verify_handle("3a", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3b: write 10 cfg log records with 8 bytes bufs\n");
for (i = 0; i < 10; i++) {
if (rc < 0) {
CERROR("3b: write 10 records failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
rc = verify_handle("3b", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3c: write 1000 more log records\n");
for (i = 0; i < 1000; i++) {
if (rc < 0) {
CERROR("3c: write 1000 records failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
rc = verify_handle("3c", llh, num_recs);
if (rc)
- RETURN(rc);
+ return rc;
CWARN("3d: write log more than BITMAP_SIZE, return -ENOSPC\n");
for (i = 0; i < LLOG_BITMAP_SIZE(llh->lgh_hdr) + 1; i++) {
} else if (rc < 0) {
CERROR("3d: write recs failed at #%d: %d\n",
i + 1, rc);
- RETURN(rc);
+ return rc;
}
num_recs++;
}
if (rc != -ENOSPC) {
CWARN("3d: write record more than BITMAP size!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CWARN("3d: wrote %d more records before end of llog is reached\n",
num_recs);
rc = verify_handle("3d", llh, num_recs);
- RETURN(rc);
+ return rc;
}
/* Test catalogue additions */
}
ctxt_release:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
static int cat_counter;
if (rec->lrh_type != LLOG_LOGID_MAGIC) {
CERROR("invalid record in catalog\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
logid_to_fid(&lir->lid_id, &fid);
cat_counter++;
- RETURN(0);
+ return 0;
}
static int plain_counter;
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
logid_to_fid(&llh->lgh_id, &fid);
plain_counter++;
- RETURN(0);
+ return 0;
}
static int cancel_count;
if (!(llh->lgh_hdr->llh_flags & LLOG_F_IS_PLAIN)) {
CERROR("log is not plain\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
cookie.lgc_lgl = llh->lgh_id;
llog_cat_cancel_records(env, llh->u.phd.phd_cat_handle, 1, &cookie);
cancel_count++;
if (cancel_count == LLOG_TEST_RECNUM)
- RETURN(-LLOG_EEMPTY);
- RETURN(0);
+ return -LLOG_EEMPTY;
+ return 0;
}
/* Test log and catalogue processing */
out_put:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* Test client api; open log by name and process */
llog_ctxt_put(nctxt);
ctxt_release:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
static union {
rc = llog_open_create(env, ctxt, &llh, NULL, NULL);
if (rc) {
CERROR("7_sub: create log failed\n");
- RETURN(rc);
+ return rc;
}
rc = llog_init_handle(env, llh,
if (rc)
llog_destroy(env, llh);
llog_close(env, llh);
- RETURN(rc);
+ return rc;
}
/* Test all llog records writing and processing */
}
out:
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
/* -------------------------------------------------------------------------
rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
if (rc)
- RETURN(rc);
+ return rc;
tgt = obd->obd_lvfs_ctxt.dt->dd_lu_dev.ld_obd;
rc = llog_cleanup(&env, llog_get_context(tgt, LLOG_TEST_ORIG_CTXT));
if (rc)
CERROR("failed to llog_test_llog_finish: %d\n", rc);
lu_env_fini(&env);
- RETURN(rc);
+ return rc;
}
static int llog_test_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
if (lcfg->lcfg_bufcount < 2) {
CERROR("requires a TARGET OBD name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (lcfg->lcfg_buflens[1] < 1) {
CERROR("requires a TARGET OBD name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* disk obd */
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("target device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = lu_env_init(&env, LCT_LOCAL | LCT_MG_THREAD);
if (rc)
- RETURN(rc);
+ return rc;
rc = lu_context_init(&test_session, LCT_SESSION);
if (rc)
lu_context_fini(&test_session);
cleanup_env:
lu_env_fini(&env);
- RETURN(rc);
+ return rc;
}
static struct obd_ops llog_obd_ops = {
under = &ls->ls_osd->dd_lu_dev;
below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
if (below == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lu_object_add(o, below);
- RETURN(0);
+ return 0;
}
static void ls_object_free(const struct lu_env *env, struct lu_object *o)
list_add(&ls->ls_linkage, &ls_list_head);
out_ls:
mutex_unlock(&ls_list_mutex);
- RETURN(ls);
+ return ls;
}
void ls_device_put(const struct lu_env *env, struct ls_device *ls)
rc = dt_declare_record_write(env, los->los_obj,
sizeof(struct los_ondisk), 0, th);
if (rc)
- RETURN(rc);
+ return rc;
}
rc = dt_declare_create(env, o, attr, NULL, dof, th);
if (rc)
- RETURN(rc);
+ return rc;
dti->dti_lb.lb_buf = NULL;
dti->dti_lb.lb_len = sizeof(dti->dti_lma);
rc = dt_declare_xattr_set(env, o, &dti->dti_lb, XATTR_NAME_LMA, 0, th);
- RETURN(rc);
+ return rc;
}
int local_object_create(const struct lu_env *env,
rc = dt_create(env, o, attr, NULL, dof, th);
if (rc)
- RETURN(rc);
+ return rc;
if (los == NULL)
- RETURN(rc);
+ return rc;
LASSERT(los->los_obj);
LASSERT(dt_object_exists(los->los_obj));
th);
mutex_unlock(&los->los_id_lock);
- RETURN(rc);
+ return rc;
}
/*
dto = ls_locate(env, ls, fid);
if (unlikely(IS_ERR(dto)))
- RETURN(dto);
+ return dto;
LASSERT(dto != NULL);
if (dt_object_exists(dto))
lu_object_put_nocache(env, &dto->do_lu);
dto = ERR_PTR(rc);
}
- RETURN(dto);
+ return dto;
}
/*
rc = dt_lookup_dir(env, parent, name, &dti->dti_fid);
if (rc == -ENOENT)
- RETURN(0);
+ return 0;
else if (rc < 0)
- RETURN(rc);
+ return rc;
dto = dt_locate(env, dt, &dti->dti_fid);
if (unlikely(IS_ERR(dto)))
- RETURN(PTR_ERR(dto));
+ return PTR_ERR(dto);
th = dt_trans_create(env, dt);
if (IS_ERR(th))
ls = ls_device_get(dev);
if (IS_ERR(ls))
- RETURN(PTR_ERR(ls));
+ return PTR_ERR(ls);
mutex_lock(&ls->ls_los_mutex);
*los = dt_los_find(ls, fid_seq(first_fid));
spin_lock(&stat->nid_obd->obd_nid_lock);
list_move(&stat->nid_list, data);
spin_unlock(&stat->nid_obd->obd_nid_lock);
- RETURN(1);
+ return 1;
}
/* we has reference to object - only clear data*/
if (stat->nid_stats)
lprocfs_clear_stats(stat->nid_stats);
- RETURN(0);
+ return 0;
}
int lprocfs_nid_stats_clear_write(struct file *file, const char *buffer,
if (!exp || !exp->exp_obd || !exp->exp_obd->obd_proc_exports_entry ||
!exp->exp_obd->obd_nid_stats_hash)
- RETURN(-EINVAL);
+ return -EINVAL;
/* not test against zero because eric say:
* You may only test nid against another nid, or LNET_NID_ANY.
* Anything else is nonsense.*/
if (!nid || *nid == LNET_NID_ANY)
- RETURN(0);
+ return 0;
obd = exp->exp_obd;
OBD_ALLOC_PTR(new_stat);
if (new_stat == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
new_stat->nid = *nid;
new_stat->nid_obd = exp->exp_obd;
list_add(&new_stat->nid_list, &obd->obd_nid_stats);
spin_unlock(&obd->obd_nid_lock);
- RETURN(rc);
+ return rc;
destroy_new_ns:
if (new_stat->nid_proc != NULL)
destroy_new:
nidstat_putref(new_stat);
OBD_FREE_PTR(new_stat);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lprocfs_exp_setup);
struct nid_stat *stat = exp->exp_nid_stats;
if(!stat || !exp->exp_obd)
- RETURN(0);
+ return 0;
nidstat_putref(exp->exp_nid_stats);
exp->exp_nid_stats = NULL;
entry = proc_create_data(name, mode, parent, seq_fops, data);
if (entry == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(lprocfs_seq_create);
*/
top = dev->ld_ops->ldo_object_alloc(env, NULL, dev);
if (top == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
if (IS_ERR(top))
- RETURN(top);
+ return top;
/*
* This is the only place where object fid is assigned. It's constant
* after this point.
result = scan->lo_ops->loo_object_init(env, scan, conf);
if (result != 0) {
lu_object_free(env, top);
- RETURN(ERR_PTR(result));
+ return ERR_PTR(result);
}
scan->lo_flags |= LU_OBJECT_ALLOCATED;
}
result = scan->lo_ops->loo_object_start(env, scan);
if (result != 0) {
lu_object_free(env, top);
- RETURN(ERR_PTR(result));
+ return ERR_PTR(result);
}
}
}
lprocfs_counter_incr(dev->ld_site->ls_stats, LU_SS_CREATED);
- RETURN(top);
+ return top;
}
/**
int i;
if (OBD_FAIL_CHECK(OBD_FAIL_OBD_NO_LRU))
- RETURN(0);
+ return 0;
INIT_LIST_HEAD(&dispose);
/*
lu_dev_add_linkage(s, top);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(lu_site_init);
}
rcu_read_unlock();
- RETURN(retval);
+ return retval;
}
EXPORT_SYMBOL(class_handle2object);
break;
}
spin_unlock(&g_uuid_lock);
- RETURN(found);
+ return found;
}
EXPORT_SYMBOL(class_check_uuid);
if (rc == 0 || rc == -ENODATA)
/* no SOM attributes */
- RETURN(-ENODATA);
+ return -ENODATA;
if (rc < 0)
/* error hit while fetching xattr */
- RETURN(rc);
+ return rc;
/* check SOM compatibility */
if (attrs->som_incompat & ~cpu_to_le32(SOM_INCOMPAT_SUPP))
- RETURN(-ENODATA);
+ return -ENODATA;
/* unpack SOM attributes */
lustre_som_swab(attrs);
msd->msd_blocks = attrs->som_blocks;
msd->msd_mountid = attrs->som_mountid;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(lustre_buf2som);
if (rc == 0 || rc == -ENODATA)
/* no HSM attributes */
- RETURN(-ENODATA);
+ return -ENODATA;
if (rc < 0)
/* error hit while fetching xattr */
- RETURN(rc);
+ return rc;
/* unpack HSM attributes */
lustre_hsm_swab(attrs);
mh->mh_arch_id = attrs->hsm_arch_id;
mh->mh_arch_ver = attrs->hsm_arch_ver;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(lustre_buf2hsm);
int name_len = 0;
if (param == NULL || ptr == NULL)
- RETURN(NULL);
+ return NULL;
value = strchr(param, '=');
if (value == NULL)
while (ptr->old_param != NULL) {
if (strncmp(param, ptr->old_param, name_len) == 0 &&
name_len == strlen(ptr->old_param))
- RETURN(ptr);
+ return ptr;
ptr++;
}
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(class_find_old_param);
if (!LUSTRE_CFG_BUFLEN(lcfg, 1)) {
CERROR("No type passed!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
typename = lustre_cfg_string(lcfg, 1);
if (!LUSTRE_CFG_BUFLEN(lcfg, 0)) {
CERROR("No name passed!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
name = lustre_cfg_string(lcfg, 0);
if (!LUSTRE_CFG_BUFLEN(lcfg, 2)) {
CERROR("No UUID passed!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
uuid = lustre_cfg_string(lcfg, 2);
obd->obd_attached = 1;
CDEBUG(D_IOCTL, "OBD: dev %d attached type %s with refcount %d\n",
obd->obd_minor, typename, atomic_read(&obd->obd_refcount));
- RETURN(0);
+ return 0;
out:
if (obd != NULL) {
class_release_dev(obd);
/* have we attached a type to this device? */
if (!obd->obd_attached) {
CERROR("Device %d not attached\n", obd->obd_minor);
- RETURN(-ENODEV);
+ return -ENODEV;
}
if (obd->obd_set_up) {
CERROR("Device %d already setup (type %s)\n",
obd->obd_minor, obd->obd_type->typ_name);
- RETURN(-EEXIST);
+ return -EEXIST;
}
/* is someone else setting us up right now? (attach inits spinlock) */
spin_unlock(&obd->obd_dev_lock);
CERROR("Device %d setup in progress (type %s)\n",
obd->obd_minor, obd->obd_type->typ_name);
- RETURN(-EEXIST);
+ return -EEXIST;
}
/* just leave this on forever. I can't use obd_set_up here because
other fns check that status, and we're not actually set up yet. */
CDEBUG(D_IOCTL, "finished setup of obd %s (uuid %s)\n",
obd->obd_name, obd->obd_uuid.uuid);
- RETURN(0);
+ return 0;
err_exp:
if (obd->obd_self_export) {
class_unlink_export(obd->obd_self_export);
{
if (obd->obd_set_up) {
CERROR("OBD device %d still set up\n", obd->obd_minor);
- RETURN(-EBUSY);
+ return -EBUSY;
}
spin_lock(&obd->obd_dev_lock);
if (!obd->obd_attached) {
spin_unlock(&obd->obd_dev_lock);
CERROR("OBD device %d not attached\n", obd->obd_minor);
- RETURN(-ENODEV);
+ return -ENODEV;
}
obd->obd_attached = 0;
spin_unlock(&obd->obd_dev_lock);
obd->obd_name, obd->obd_uuid.uuid);
class_decref(obd, "attach", obd);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(class_detach);
if (!obd->obd_set_up) {
CERROR("Device %d not setup\n", obd->obd_minor);
- RETURN(-ENODEV);
+ return -ENODEV;
}
spin_lock(&obd->obd_dev_lock);
if (obd->obd_stopping) {
spin_unlock(&obd->obd_dev_lock);
CERROR("OBD %d already stopping\n", obd->obd_minor);
- RETURN(-ENODEV);
+ return -ENODEV;
}
/* Leave this on forever */
obd->obd_stopping = 1;
class_decref(obd, "setup", obd);
obd->obd_set_up = 0;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(class_cleanup);
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1 ||
LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(struct obd_uuid)) {
CERROR("invalid conn_uuid\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_LWP_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME)) {
CERROR("can't add connection on non-client dev\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
imp = obd->u.cli.cl_import;
if (!imp) {
CERROR("try to add conn on immature client dev\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
obd_str2uuid(&uuid, lustre_cfg_string(lcfg, 1));
rc = obd_add_conn(imp, &uuid, lcfg->lcfg_num);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_add_conn);
if (LUSTRE_CFG_BUFLEN(lcfg, 1) < 1 ||
LUSTRE_CFG_BUFLEN(lcfg, 1) > sizeof(struct obd_uuid)) {
CERROR("invalid conn_uuid\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_OSC_NAME)) {
CERROR("can't del connection on non-client dev\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
imp = obd->u.cli.cl_import;
if (!imp) {
CERROR("try to del conn on immature client dev\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
obd_str2uuid(&uuid, lustre_cfg_string(lcfg, 1));
rc = obd_del_conn(imp, &uuid);
- RETURN(rc);
+ return rc;
}
LIST_HEAD(lustre_profile_list);
list_for_each_entry(lprof, &lustre_profile_list, lp_list) {
if (!strcmp(lprof->lp_profile, prof)) {
- RETURN(lprof);
+ return lprof;
}
}
- RETURN(NULL);
+ return NULL;
}
EXPORT_SYMBOL(class_get_profile);
OBD_ALLOC(lprof, sizeof(*lprof));
if (lprof == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
INIT_LIST_HEAD(&lprof->lp_list);
LASSERT(proflen == (strlen(prof) + 1));
}
list_add(&lprof->lp_list, &lustre_profile_list);
- RETURN(err);
+ return err;
out:
if (lprof->lp_md)
if (lprof->lp_profile)
OBD_FREE(lprof->lp_profile, proflen);
OBD_FREE(lprof, sizeof(*lprof));
- RETURN(err);
+ return err;
}
void class_del_profile(const char *prof)
strlcpy(obd_jobid_var, lustre_cfg_string(lcfg, 2),
JOBSTATS_JOBID_VAR_MAX_LEN + 1);
else
- RETURN(-EINVAL);
+ return -EINVAL;
CDEBUG(D_IOCTL, "global %s = %d\n", ptr, val);
- RETURN(0);
+ return 0;
}
int new_len = 0;
if (cfg == NULL || new_name == NULL)
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
param = lustre_cfg_string(cfg, 1);
if (param == NULL)
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
value = strchr(param, '=');
if (value == NULL)
OBD_ALLOC(new_param, new_len);
if (new_param == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
strcpy(new_param, new_name);
if (value != NULL)
OBD_ALLOC_PTR(bufs);
if (bufs == NULL) {
OBD_FREE(new_param, new_len);
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
}
lustre_cfg_bufs_reset(bufs, NULL);
OBD_FREE(new_param, new_len);
OBD_FREE_PTR(bufs);
if (new_cfg == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
new_cfg->lcfg_num = cfg->lcfg_num;
new_cfg->lcfg_flags = cfg->lcfg_flags;
new_cfg->lcfg_nid = cfg->lcfg_nid;
new_cfg->lcfg_nal = cfg->lcfg_nal;
- RETURN(new_cfg);
+ return new_cfg;
}
EXPORT_SYMBOL(lustre_cfg_rename);
if (lcfg->lcfg_command != LCFG_PARAM) {
CERROR("Unknown command: %d\n", lcfg->lcfg_command);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* fake a seq file so that var->fops->write can work... */
/* If the prefix doesn't match, return error so we
can pass it down the stack */
if (strnchr(key, keylen, '.'))
- RETURN(-ENOSYS);
+ return -ENOSYS;
CERROR("%s: unknown param %s\n",
(char *)lustre_cfg_string(lcfg, 0), key);
/* rc = -EINVAL; continue parsing other params */
rc = 0;
if (!rc && skip)
rc = skip;
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_process_proc_param);
handle->lgh_ctxt->loc_obd->obd_name, rc);
class_config_dump_handler(NULL, handle, rec, data);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_config_llog_handler);
CDEBUG(D_INFO, "looking up llog %s\n", name);
rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
if (rc)
parse_out:
llog_close(env, llh);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_config_parse_llog);
LASSERT(rec->lrh_type == OBD_CFG_REC);
rc = lustre_cfg_sanity_check(lcfg, rec->lrh_len);
if (rc < 0)
- RETURN(rc);
+ return rc;
ptr += snprintf(ptr, end-ptr, "cmd=%05x ", lcfg->lcfg_command);
if (lcfg->lcfg_flags)
}
/* return consumed bytes */
rc = ptr - buf;
- RETURN(rc);
+ return rc;
}
int class_config_dump_handler(const struct lu_env *env,
OBD_ALLOC(outstr, 256);
if (outstr == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (rec->lrh_type == OBD_CFG_REC) {
class_config_parse_rec(rec, outstr, 256);
}
OBD_FREE(outstr, 256);
- RETURN(rc);
+ return rc;
}
int class_config_dump_llog(const struct lu_env *env, struct llog_ctxt *ctxt,
rc = llog_open(env, ctxt, &llh, NULL, name, LLOG_OPEN_EXISTS);
if (rc)
- RETURN(rc);
+ return rc;
rc = llog_init_handle(env, llh, LLOG_F_IS_PLAIN, NULL);
if (rc)
llog_close(env, llh);
LCONSOLE_INFO("End config log %s\n", name);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_config_dump_llog);
if (!obd) {
CERROR("empty cleanup\n");
- RETURN(-EALREADY);
+ return -EALREADY;
}
if (obd->obd_force)
lustre_cfg_bufs_set_string(&bufs, 1, flags);
lcfg = lustre_cfg_new(LCFG_CLEANUP, &bufs);
if (!lcfg)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = class_process_config(lcfg);
if (rc) {
CERROR("detach failed %d: %s\n", rc, obd->obd_name);
out:
lustre_cfg_free(lcfg);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(class_manual_cleanup);
exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
- RETURN(&exp->exp_connection->c_peer.nid);
+ return &exp->exp_connection->c_peer.nid;
}
/*
LASSERT(key);
exp = hlist_entry(hnode, struct obd_export, exp_nid_hash);
- RETURN(exp->exp_connection->c_peer.nid == *(lnet_nid_t *)key &&
- !exp->exp_failed);
+ return exp->exp_connection->c_peer.nid == *(lnet_nid_t *)key &&
+ !exp->exp_failed;
}
static void *
OBD_ALLOC_PTR(bufs);
if (bufs == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* mgc_process_config */
lustre_cfg_bufs_reset(bufs, mgc->obd_name);
rc);
/* class_obd_list(); */
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lustre_process_log);
int rc;
if (!mgc)
- RETURN(-ENOENT);
+ return -ENOENT;
/* mgc_process_config */
lustre_cfg_bufs_reset(&bufs, mgc->obd_name);
lcfg = lustre_cfg_new(LCFG_LOG_END, &bufs);
rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
lustre_cfg_free(lcfg);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lustre_end_log);
}
if (i == 0) {
CERROR("No valid MGS nids found.\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
mutex_lock(&mgc_start_lock);
OBD_FREE(mgcname, len);
if (niduuid)
OBD_FREE(niduuid, len + 2);
- RETURN(rc);
+ return rc;
}
static int lustre_stop_mgc(struct super_block *sb)
int i, rc = 0, len = 0;
if (!lsi)
- RETURN(-ENOENT);
+ return -ENOENT;
obd = lsi->lsi_mgc;
if (!obd)
- RETURN(-ENOENT);
+ return -ENOENT;
lsi->lsi_mgc = NULL;
mutex_lock(&mgc_start_lock);
/* class_import_put will get rid of the additional connections */
mutex_unlock(&mgc_start_lock);
- RETURN(rc);
+ return rc;
}
/***************** lustre superblock **************/
OBD_ALLOC_PTR(lsi);
if (!lsi)
- RETURN(NULL);
+ return NULL;
OBD_ALLOC_PTR(lsi->lsi_lmd);
if (!lsi->lsi_lmd) {
OBD_FREE_PTR(lsi);
- RETURN(NULL);
+ return NULL;
}
lsi->lsi_lmd->lmd_exclude_count = 0;
/* Default umount style */
lsi->lsi_flags = LSI_UMOUNT_FAILOVER;
- RETURN(lsi);
+ return lsi;
}
static int lustre_free_lsi(struct super_block *sb)
OBD_FREE(lsi, sizeof(*lsi));
s2lsi_nocast(sb) = NULL;
- RETURN(0);
+ return 0;
}
/* The lsi has one reference for every server that is using the disk -
obd_zombie_barrier();
}
lustre_free_lsi(sb);
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
/*** SERVER NAME ***
if (rc && (rc != -ENOENT)) {
if (rc != -EBUSY) {
CERROR("Can't stop MGC: %d\n", rc);
- RETURN(rc);
+ return rc;
}
/* BUSY just means that there's some other obd that
needs the mgc. Let him clean it up. */
/* Drop a ref to the mounted disk */
lustre_put_lsi(sb);
lu_types_stop();
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(lustre_common_put_super);
rc = server_name2index(svname, &index, NULL);
if (rc != LDD_F_SV_TYPE_OST)
/* Only exclude OSTs */
- RETURN(0);
+ return 0;
CDEBUG(D_MOUNT, "Check exclusion %s (%d) in %d of %s\n", svname,
index, lmd->lmd_exclude_count, lmd->lmd_dev);
for(i = 0; i < lmd->lmd_exclude_count; i++) {
if (index == lmd->lmd_exclude[i]) {
CWARN("Excluding %s (on exclusion list)\n", svname);
- RETURN(1);
+ return 1;
}
}
- RETURN(0);
+ return 0;
}
/* mount -v -o exclude=lustre-OST0001:lustre-OST0002 -t lustre ... */
/* temp storage until we figure out how many we have */
OBD_ALLOC(exclude_list, sizeof(index) * devmax);
if (!exclude_list)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* we enter this fn pointing at the '=' */
while (*s1 && *s1 != ' ' && *s1 != ',') {
}
}
OBD_FREE(exclude_list, sizeof(index) * devmax);
- RETURN(rc);
+ return rc;
}
static int lmd_parse_mgssec(struct lustre_mount_data *lmd, char *ptr)
if (!options) {
LCONSOLE_ERROR_MSG(0x162, "Missing mount data: check that "
"/sbin/mount.lustre is installed.\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* Options should be a string - try to detect old lmd data */
LCONSOLE_ERROR_MSG(0x163, "You're using an old version of "
"/sbin/mount.lustre. Please install "
"version %s\n", LUSTRE_VERSION_STRING);
- RETURN(-EINVAL);
+ return -EINVAL;
}
lmd->lmd_magic = LMD_MAGIC;
OBD_ALLOC(lmd->lmd_params, 4096);
if (lmd->lmd_params == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lmd->lmd_params[0] = '\0';
/* Set default flags here */
/* Freed in lustre_free_lsi */
OBD_ALLOC(lmd->lmd_profile, strlen(s1) + 8);
if (!lmd->lmd_profile)
- RETURN(-ENOMEM);
+ return -ENOMEM;
sprintf(lmd->lmd_profile, "%s-client", s1);
}
/* Freed in lustre_free_lsi */
OBD_ALLOC(lmd->lmd_dev, strlen(devname) + 1);
if (!lmd->lmd_dev)
- RETURN(-ENOMEM);
+ return -ENOMEM;
strcpy(lmd->lmd_dev, devname);
/* Save mount options */
/* Freed in lustre_free_lsi */
OBD_ALLOC(lmd->lmd_opts, strlen(options) + 1);
if (!lmd->lmd_opts)
- RETURN(-ENOMEM);
+ return -ENOMEM;
strcpy(lmd->lmd_opts, options);
}
lmd_print(lmd);
lmd->lmd_magic = LMD_MAGIC;
- RETURN(rc);
+ return rc;
invalid:
CERROR("Bad mount options %s\n", options);
- RETURN(-EINVAL);
+ return -EINVAL;
}
struct lustre_mount_data2 {
lsi = lustre_init_lsi(sb);
if (!lsi)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lmd = lsi->lsi_lmd;
/*
target_destroy_export(exp);
ldlm_destroy_export(exp);
- RETURN(0);
+ return 0;
}
static __u64 echo_next_id(struct obd_device *obddev)
if (!obd) {
CERROR("invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (!(oa->o_valid & OBD_MD_FLID)) {
CERROR("obdo missing FLID valid flag: "LPX64"\n", oa->o_valid);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (ostid_id(&oa->o_oi) > obd->u.echo.eo_lastino ||
ostid_id(&oa->o_oi) < ECHO_INIT_OID) {
CERROR("bad destroy objid: "DOSTID"\n", POSTID(&oa->o_oi));
- RETURN(-EINVAL);
+ return -EINVAL;
}
- RETURN(0);
+ return 0;
}
static int echo_getattr(const struct lu_env *env, struct obd_export *exp,
if (!obd) {
CERROR("invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
CERROR("obdo missing FLID valid flag: "LPX64"\n",
oinfo->oi_oa->o_valid);
- RETURN(-EINVAL);
+ return -EINVAL;
}
obdo_cpy_md(oinfo->oi_oa, &obd->u.echo.eo_oa, oinfo->oi_oa->o_valid);
ostid_set_seq_echo(&oinfo->oi_oa->o_oi);
ostid_set_id(&oinfo->oi_oa->o_oi, id);
- RETURN(0);
+ return 0;
}
static int echo_setattr(const struct lu_env *env, struct obd_export *exp,
if (!obd) {
CERROR("invalid client cookie "LPX64"\n",
exp->exp_handle.h_cookie);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (!(oinfo->oi_oa->o_valid & OBD_MD_FLID)) {
CERROR("obdo missing FLID valid flag: "LPX64"\n",
oinfo->oi_oa->o_valid);
- RETURN(-EINVAL);
+ return -EINVAL;
}
memcpy(&obd->u.echo.eo_oa, oinfo->oi_oa, sizeof(*oinfo->oi_oa));
oti->oti_ack_locks[0].lock = obd->u.echo.eo_nl_lock;
}
- RETURN(0);
+ return 0;
}
static void
obd = export->exp_obd;
if (obd == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
/* Temp fix to stop falling foul of osc_announce_cached() */
oa->o_valid &= ~(OBD_MD_FLBLOCKS | OBD_MD_FLGRANT);
CDEBUG(D_PAGE, "%d pages allocated after prep\n",
atomic_read(&obd->u.echo.eo_prep));
- RETURN(0);
+ return 0;
preprw_cleanup:
/* It is possible that we would rather handle errors by allow
obd = export->exp_obd;
if (obd == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
if (rc)
GOTO(commitrw_cleanup, rc);
if (niocount && res == NULL) {
CERROR("NULL res niobuf with niocount %d\n", niocount);
- RETURN(-EINVAL);
+ return -EINVAL;
}
LASSERT(oti == NULL || oti->oti_handle == (void *)DESC_PRIV);
CDEBUG(D_PAGE, "%d pages remain after commit\n",
atomic_read(&obd->u.echo.eo_prep));
- RETURN(rc);
+ return rc;
commitrw_cleanup:
atomic_sub(pgs, &obd->u.echo.eo_prep);
LDLM_NS_TYPE_OST);
if (obd->obd_namespace == NULL) {
LBUG();
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
rc = ldlm_cli_enqueue_local(obd->obd_namespace, &res_id, LDLM_PLAIN,
ptlrpc_init_client (LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
"echo_ldlm_cb_client", &obd->obd_ldlm_client);
- RETURN(0);
+ return 0;
}
static int echo_cleanup(struct obd_device *obd)
if (leaked != 0)
CERROR("%d prep/commitrw pages leaked\n", leaked);
- RETURN(0);
+ return 0;
}
struct obd_ops echo_obd_ops = {
mutex_init(&ep->ep_lock);
cl_page_slice_add(page, &ep->ep_cl, obj, &echo_page_ops);
atomic_inc(&eco->eo_npages);
- RETURN(0);
+ return 0;
}
static int echo_io_init(const struct lu_env *env, struct cl_object *obj,
INIT_LIST_HEAD(&el->el_chain);
atomic_set(&el->el_refcount, 0);
}
- RETURN(el == NULL ? -ENOMEM : 0);
+ return el == NULL ? -ENOMEM : 0;
}
static int echo_conf_set(const struct lu_env *env, struct cl_object *obj,
below = under->ld_ops->ldo_object_alloc(env, obj->lo_header,
under);
if (below == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
lu_object_add(obj, below);
}
list_add_tail(&eco->eo_obj_chain, &ec->ec_objects);
spin_unlock(&ec->ec_lock);
- RETURN(0);
+ return 0;
}
/* taken from osc_unpackmd() */
LASSERT(*lsmp == NULL);
OBD_ALLOC(*lsmp, lsm_size);
if (*lsmp == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo));
if ((*lsmp)->lsm_oinfo[0] == NULL) {
OBD_FREE(*lsmp, lsm_size);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
loi_init((*lsmp)->lsm_oinfo[0]);
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES;
ostid_set_seq_echo(&(*lsmp)->lsm_oi);
- RETURN(lsm_size);
+ return lsm_size;
}
static int echo_free_memmd(struct echo_device *ed, struct lov_stripe_md **lsmp)
OBD_FREE((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo));
OBD_FREE(*lsmp, lsm_size);
*lsmp = NULL;
- RETURN(0);
+ return 0;
}
static void echo_object_free(const struct lu_env *env, struct lu_object *obj)
eco->eo_cl.co_ops = &echo_cl_obj_ops;
obj->lo_ops = &echo_lu_obj_ops;
}
- RETURN(obj);
+ return obj;
}
static struct lu_device_operations echo_device_lu_ops = {
OBD_ALLOC_PTR(ed->ed_cl_seq);
if (ed->ed_cl_seq == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC(prefix, MAX_OBD_NAME + 5);
if (prefix == NULL)
if (rc)
GOTO(out_free_seq, rc);
- RETURN(0);
+ return 0;
out_free_seq:
OBD_FREE_PTR(ed->ed_cl_seq);
ed->ed_cl_seq = NULL;
- RETURN(rc);
+ return rc;
}
static int echo_fid_fini(struct obd_device *obddev)
ed->ed_cl_seq = NULL;
}
- RETURN(0);
+ return 0;
}
static struct lu_device *echo_device_alloc(const struct lu_env *env,
}
ed->ed_next = next;
- RETURN(&cd->cd_lu_dev);
+ return &cd->cd_lu_dev;
out:
switch(cleanup) {
case 4: {
/* Never return an object if the obd is to be freed. */
if (echo_dev2cl(d)->cd_lu_dev.ld_obd->obd_stopping)
- RETURN(ERR_PTR(-ENODEV));
+ return ERR_PTR(-ENODEV);
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN((void *)env);
+ return (void *)env;
info = echo_env_info(env);
conf = &info->eti_conf;
out:
cl_env_put(env, &refcheck);
- RETURN(eco);
+ return eco;
}
static int cl_echo_object_put(struct echo_object *eco)
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
/* an external function to kill an object? */
if (eco->eo_deleted) {
cl_object_put(env, obj);
cl_env_put(env, &refcheck);
- RETURN(0);
+ return 0;
}
static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
cl_lock_release(env, lck, "ec enqueue", current);
}
}
- RETURN(rc);
+ return rc;
}
static int cl_echo_enqueue(struct echo_object *eco, obd_off start, obd_off end,
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
info = echo_env_info(env);
io = &info->eti_io;
spin_unlock(&ec->ec_lock);
if (!found)
- RETURN(-ENOENT);
+ return -ENOENT;
echo_lock_release(env, ecl, still_used);
- RETURN(0);
+ return 0;
}
static int cl_echo_cancel(struct echo_device *ed, __u64 cookie)
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
rc = cl_echo_cancel0(env, ed, cookie);
cl_env_put(env, &refcheck);
- RETURN(rc);
+ return rc;
}
static int cl_echo_async_brw(const struct lu_env *env, struct cl_io *io,
continue;
result = result ?: rc;
}
- RETURN(result);
+ return result;
}
static int cl_echo_object_brw(struct echo_object *eco, int rw, obd_off offset,
LASSERT(ed->ed_next != NULL);
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
info = echo_env_info(env);
io = &info->eti_io;
rc = mo_xattr_get(env, o, &LU_BUF_NULL, XATTR_NAME_LOV);
if (rc < 0)
- RETURN(rc);
+ return rc;
/* big_lmm may need to be grown */
if (info->eti_big_lmmsize < rc) {
OBD_ALLOC_LARGE(info->eti_big_lmm, size);
if (info->eti_big_lmm == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
info->eti_big_lmmsize = size;
}
LASSERT(info->eti_big_lmmsize >= rc);
info->eti_buf.lb_len = info->eti_big_lmmsize;
rc = mo_xattr_get(env, o, &info->eti_buf, XATTR_NAME_LOV);
if (rc < 0)
- RETURN(rc);
+ return rc;
ma->ma_valid |= MA_LOV;
ma->ma_lmm = info->eti_big_lmm;
ma->ma_lmm_size = rc;
- RETURN(0);
+ return 0;
}
int echo_attr_get_complex(const struct lu_env *env, struct md_object *next,
ma->ma_need = need;
CDEBUG(D_INODE, "after getattr rc = %d, ma_valid = "LPX64" ma_lmm=%p\n",
rc, ma->ma_valid, ma->ma_lmm);
- RETURN(rc);
+ return rc;
}
static int
if (IS_ERR(ec_child)) {
CERROR("Can not find the child "DFID": rc = %ld\n", PFID(fid),
PTR_ERR(ec_child));
- RETURN(PTR_ERR(ec_child));
+ return PTR_ERR(ec_child);
}
child = lu_object_locate(ec_child->lo_header, ld->ld_type);
return -1;
parent = lu_object_locate(ec_parent->lo_header, ld->ld_type);
if (parent == NULL)
- RETURN(-ENXIO);
+ return -ENXIO;
memset(ma, 0, sizeof(*ma));
memset(spec, 0, sizeof(*spec));
/* If name is specified, only create one object by name */
rc = echo_md_create_internal(env, ed, lu2md(parent), fid, lname,
spec, ma);
- RETURN(rc);
+ return rc;
}
/* Create multiple object sequenced by id */
fid->f_oid++;
}
- RETURN(rc);
+ return rc;
}
static struct lu_object *echo_md_lookup(const struct lu_env *env,
rc = mdo_lookup(env, parent, lname, fid, NULL);
if (rc) {
CERROR("lookup %s: rc = %d\n", lname->ln_name, rc);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
/* In the function below, .hs_keycmp resolves to
/* coverity[overrun-buffer-val] */
child = lu_object_find_at(env, &ed->ed_cl.cd_lu_dev, fid, NULL);
- RETURN(child);
+ return child;
}
static int echo_setattr_object(const struct lu_env *env,
return -1;
parent = lu_object_locate(ec_parent->lo_header, ld->ld_type);
if (parent == NULL)
- RETURN(-ENXIO);
+ return -ENXIO;
for (i = 0; i < count; i++) {
struct lu_object *ec_child, *child;
if (IS_ERR(ec_child)) {
CERROR("Can't find child %s: rc = %ld\n",
lname->ln_name, PTR_ERR(ec_child));
- RETURN(PTR_ERR(ec_child));
+ return PTR_ERR(ec_child);
}
child = lu_object_locate(ec_child->lo_header, ld->ld_type);
id++;
lu_object_put(env, ec_child);
}
- RETURN(rc);
+ return rc;
}
static int echo_getattr_object(const struct lu_env *env,
return -1;
parent = lu_object_locate(ec_parent->lo_header, ld->ld_type);
if (parent == NULL)
- RETURN(-ENXIO);
+ return -ENXIO;
memset(ma, 0, sizeof(*ma));
ma->ma_need |= MA_INODE | MA_LOV | MA_PFID | MA_HSM | MA_ACL_DEF;
if (IS_ERR(ec_child)) {
CERROR("Can't find child %s: rc = %ld\n",
lname->ln_name, PTR_ERR(ec_child));
- RETURN(PTR_ERR(ec_child));
+ return PTR_ERR(ec_child);
}
child = lu_object_locate(ec_child->lo_header, ld->ld_type);
if (child == NULL) {
CERROR("Can not locate the child %s\n", lname->ln_name);
lu_object_put(env, ec_child);
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_RPCTRACE, "Start getattr object "DFID"\n",
lu_object_put(env, ec_child);
}
- RETURN(rc);
+ return rc;
}
static int echo_lookup_object(const struct lu_env *env,
if (IS_ERR(ec_child)) {
CERROR("Can't find child %s: rc = %ld\n", lname->ln_name,
PTR_ERR(ec_child));
- RETURN(PTR_ERR(ec_child));
+ return PTR_ERR(ec_child);
}
child = lu_object_locate(ec_child->lo_header, ld->ld_type);
parent = lu_object_locate(ec_parent->lo_header, ld->ld_type);
if (parent == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
memset(ma, 0, sizeof(*ma));
ma->ma_attr.la_mode = mode;
lname->ln_namelen = namelen;
rc = echo_md_destroy_internal(env, ed, lu2md(parent), lname,
ma);
- RETURN(rc);
+ return rc;
}
/*prepare the requests*/
id++;
}
- RETURN(rc);
+ return rc;
}
static struct lu_object *echo_resolve_path(const struct lu_env *env,
rc = md->md_ops->mdo_root_get(env, md, fid);
if (rc) {
CERROR("get root error: rc = %d\n", rc);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
/* In the function below, .hs_keycmp resolves to
if (IS_ERR(parent)) {
CERROR("Can not find the parent "DFID": rc = %ld\n",
PFID(fid), PTR_ERR(parent));
- RETURN(parent);
+ return parent;
}
while (1) {
parent = child;
}
if (rc)
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
- RETURN(parent);
+ return parent;
}
static void echo_ucred_init(struct lu_env *env)
if (ld == NULL) {
CERROR("MD echo client is not being initialized properly\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (strcmp(ld->ld_type->ldt_name, LUSTRE_MDD_NAME)) {
CERROR("Only support MDD layer right now!\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
env = cl_env_get(&refcheck);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
rc = lu_env_refill_by_tags(env, ECHO_MD_CTX_TAG, ECHO_MD_SES_TAG);
if (rc != 0)
(on_target || /* set_stripe */
ec->ec_nstripes != 0)) { /* LOV */
CERROR ("No valid oid\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = echo_alloc_memmd(ed, &lsm);
if ((oa->o_valid & OBD_MD_FLID) == 0 || ostid_id(&oa->o_oi) == 0) {
/* disallow use of object id 0 */
CERROR ("No valid oid\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = echo_alloc_memmd(ed, &lsm);
if (rc < 0)
- RETURN(rc);
+ return rc;
lsm->lsm_oi = oa->o_oi;
if (!(oa->o_valid & OBD_MD_FLGROUP))
rc = PTR_ERR(eco);
if (lsm)
echo_free_memmd(ed, &lsm);
- RETURN(rc);
+ return rc;
}
static void echo_put_object(struct echo_object *eco)
if (count <= 0 ||
(count & (~CFS_PAGE_MASK)) != 0)
- RETURN(-EINVAL);
+ return -EINVAL;
/* XXX think again with misaligned I/O */
npages = count >> PAGE_CACHE_SHIFT;
OBD_ALLOC(pga, npages * sizeof(*pga));
if (pga == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC(pages, npages * sizeof(*pages));
if (pages == NULL) {
OBD_FREE(pga, npages * sizeof(*pga));
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
for (i = 0, pgp = pga, off = offset;
}
OBD_FREE(pga, npages * sizeof(*pga));
OBD_FREE(pages, npages * sizeof(*pages));
- RETURN(rc);
+ return rc;
}
static int echo_client_prep_commit(const struct lu_env *env,
if (count <= 0 || (count & (~CFS_PAGE_MASK)) != 0 ||
(lsm != NULL && ostid_id(&lsm->lsm_oi) != ostid_id(&oa->o_oi)))
- RETURN(-EINVAL);
+ return -EINVAL;
npages = batch >> PAGE_CACHE_SHIFT;
tot_pages = count >> PAGE_CACHE_SHIFT;
OBD_FREE(lnb, npages * sizeof(struct niobuf_local));
if (rnb)
OBD_FREE(rnb, npages * sizeof(struct niobuf_remote));
- RETURN(ret);
+ return ret;
}
static int echo_client_brw_ioctl(const struct lu_env *env, int rw,
rc = echo_get_object(&eco, ed, oa);
if (rc)
- RETURN(rc);
+ return rc;
oa->o_valid &= ~OBD_MD_FLHANDLE;
rc = -EINVAL;
}
echo_put_object(eco);
- RETURN(rc);
+ return rc;
}
static int
int rc;
if (ed->ed_next == NULL)
- RETURN(-EOPNOTSUPP);
+ return -EOPNOTSUPP;
if (!(mode == LCK_PR || mode == LCK_PW))
- RETURN(-EINVAL);
+ return -EINVAL;
if ((offset & (~CFS_PAGE_MASK)) != 0 ||
(nob & (~CFS_PAGE_MASK)) != 0)
- RETURN(-EINVAL);
+ return -EINVAL;
rc = echo_get_object (&eco, ed, oa);
if (rc != 0)
- RETURN(rc);
+ return rc;
end = (nob == 0) ? ((obd_off) -1) : (offset + nob - 1);
rc = cl_echo_enqueue(eco, offset, end, mode, &ulh->cookie);
CDEBUG(D_INFO, "Cookie is "LPX64"\n", ulh->cookie);
}
echo_put_object(eco);
- RETURN(rc);
+ return rc;
}
static int
/* This FID is unpacked just for validation at this point */
rc = ostid_to_fid(&fid, &oa->o_oi, 0);
if (rc < 0)
- RETURN(rc);
+ return rc;
OBD_ALLOC_PTR(env);
if (env == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = lu_env_init(env, LCT_DT_THREAD);
if (rc)
if (lcfg->lcfg_bufcount < 2 || LUSTRE_CFG_BUFLEN(lcfg, 1) < 1) {
CERROR("requires a TARGET OBD name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
tgt = class_name2obd(lustre_cfg_string(lcfg, 1));
if (!tgt || !tgt->obd_attached || !tgt->obd_set_up) {
CERROR("device not attached or not set up (%s)\n",
lustre_cfg_string(lcfg, 1));
- RETURN(-EINVAL);
+ return -EINVAL;
}
spin_lock_init(&ec->ec_lock);
if (!strcmp(tgt->obd_type->typ_name, LUSTRE_MDT_NAME)) {
lu_context_tags_update(ECHO_MD_CTX_TAG);
lu_session_tags_update(ECHO_MD_SES_TAG);
- RETURN(0);
+ return 0;
}
OBD_ALLOC(ocd, sizeof(*ocd));
return (rc);
}
- RETURN(rc);
+ return rc;
}
static int echo_client_cleanup(struct obd_device *obddev)
/*Do nothing for Metadata echo client*/
if (ed == NULL )
- RETURN(0);
+ return 0;
if (ed->ed_next_ismd) {
lu_context_tags_clear(ECHO_MD_CTX_TAG);
lu_session_tags_clear(ECHO_MD_SES_TAG);
- RETURN(0);
+ return 0;
}
if (!list_empty(&obddev->obd_exports)) {
CERROR("still has clients!\n");
- RETURN(-EBUSY);
+ return -EBUSY;
}
LASSERT(atomic_read(&ec->ec_exp->exp_refcount) > 0);
if (rc != 0)
CERROR("fail to disconnect device: %d\n", rc);
- RETURN(rc);
+ return rc;
}
static int echo_client_connect(const struct lu_env *env,
*exp = class_conn2export(&conn);
}
- RETURN (rc);
+ return rc;
}
static int echo_client_disconnect(struct obd_export *exp)
rc = echo_client_init();
- RETURN(rc);
+ return rc;
}
static void /*__exit*/ obdecho_exit(void)
osc_io_unplug_async(env, osc_cli(obj), obj);
}
osc_extent_put(env, ext);
- RETURN(rc);
+ return rc;
}
static inline int overlapped(struct osc_extent *ex1, struct osc_extent *ex2)
cur = osc_extent_alloc(obj);
if (cur == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
lock = cl_lock_at_pgoff(env, osc2cl(obj), index, NULL, 1, 0);
LASSERT(lock != NULL);
osc_extent_remove(ext);
/* put the refcount for RPC */
osc_extent_put(env, ext);
- RETURN(0);
+ return 0;
}
static int extent_wait_cb(struct osc_extent *ext, int state)
}
if (rc == 0 && ext->oe_rc < 0)
rc = ext->oe_rc;
- RETURN(rc);
+ return rc;
}
/**
out:
cl_io_fini(env, io);
cl_env_nested_put(&nest, env);
- RETURN(rc);
+ return rc;
}
/**
/* get a refcount for RPC. */
osc_extent_get(ext);
- RETURN(0);
+ return 0;
}
/**
out:
osc_object_unlock(obj);
- RETURN(rc);
+ return rc;
}
static void osc_extent_tree_dump0(int level, struct osc_object *obj,
result = cl_page_make_ready(env, page, CRT_WRITE);
if (result == 0)
opg->ops_submit_time = cfs_time_current();
- RETURN(result);
+ return result;
}
static int osc_refresh_count(const struct lu_env *env,
cl_page_completion(env, page, crt, rc);
- RETURN(0);
+ return 0;
}
#define OSC_DUMP_GRANT(cli, fmt, args...) do { \
out:
client_obd_list_unlock(&cli->cl_loi_list_lock);
OSC_DUMP_GRANT(cli, "returned %d.\n", rc);
- RETURN(rc);
+ return rc;
}
/* caller must hold loi_list_lock */
if (cmd & OBD_BRW_WRITE) {
if (atomic_read(&osc->oo_nr_writes) == 0)
- RETURN(0);
+ return 0;
if (invalid_import) {
CDEBUG(D_CACHE, "invalid import forcing RPC\n");
- RETURN(1);
+ return 1;
}
if (!list_empty(&osc->oo_hp_exts)) {
CDEBUG(D_CACHE, "high prio request forcing RPC\n");
- RETURN(1);
+ return 1;
}
if (!list_empty(&osc->oo_urgent_exts)) {
CDEBUG(D_CACHE, "urgent request forcing RPC\n");
- RETURN(1);
+ return 1;
}
/* trigger a write rpc stream as long as there are dirtiers
* waiting for space. as they're waiting, they're not going to
* create more pages to coalesce with what's waiting.. */
if (!list_empty(&cli->cl_cache_waiters)) {
CDEBUG(D_CACHE, "cache waiters forcing RPC\n");
- RETURN(1);
+ return 1;
}
if (atomic_read(&osc->oo_nr_writes) >=
cli->cl_max_pages_per_rpc)
- RETURN(1);
+ return 1;
} else {
if (atomic_read(&osc->oo_nr_reads) == 0)
- RETURN(0);
+ return 0;
if (invalid_import) {
CDEBUG(D_CACHE, "invalid import forcing RPC\n");
- RETURN(1);
+ return 1;
}
/* all read are urgent. */
if (!list_empty(&osc->oo_reading_exts))
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
static void osc_update_pending(struct osc_object *obj, int cmd, int delta)
*max_pages = max(ext->oe_mppr, *max_pages);
if (*pc + ext->oe_nr_pages > *max_pages)
- RETURN(0);
+ return 0;
list_for_each_entry(tmp, rpclist, oe_link) {
EASSERT(tmp->oe_owner == current, tmp);
if (tmp->oe_srvlock != ext->oe_srvlock ||
!tmp->oe_grants != !ext->oe_grants)
- RETURN(0);
+ return 0;
/* remove break for strict check */
break;
*pc += ext->oe_nr_pages;
list_move_tail(&ext->oe_link, rpclist);
ext->oe_owner = current;
- RETURN(1);
+ return 1;
}
/**
LASSERT(equi(page_count == 0, list_empty(&rpclist)));
if (list_empty(&rpclist))
- RETURN(0);
+ return 0;
osc_update_pending(osc, OBD_BRW_WRITE, -page_count);
}
osc_object_lock(osc);
- RETURN(rc);
+ return rc;
}
/**
osc_object_lock(osc);
}
- RETURN(rc);
+ return rc;
}
#define list_to_obj(list, item) ({ \
* will be flushed quickly and other clients can get the lock,
* then objects which have pages ready to be stuffed into RPCs */
if (!list_empty(&cli->cl_loi_hp_ready_list))
- RETURN(list_to_obj(&cli->cl_loi_hp_ready_list, hp_ready_item));
+ return list_to_obj(&cli->cl_loi_hp_ready_list, hp_ready_item);
if (!list_empty(&cli->cl_loi_ready_list))
- RETURN(list_to_obj(&cli->cl_loi_ready_list, ready_item));
+ return list_to_obj(&cli->cl_loi_ready_list, ready_item);
/* then if we have cache waiters, return all objects with queued
* writes. This is especially important when many small files
* they don't pass the nr_pending/object threshhold */
if (!list_empty(&cli->cl_cache_waiters) &&
!list_empty(&cli->cl_loi_write_list))
- RETURN(list_to_obj(&cli->cl_loi_write_list, write_item));
+ return list_to_obj(&cli->cl_loi_write_list, write_item);
/* then return all queued objects when we have an invalid import
* so that they get flushed */
if (cli->cl_import == NULL || cli->cl_import->imp_invalid) {
if (!list_empty(&cli->cl_loi_write_list))
- RETURN(list_to_obj(&cli->cl_loi_write_list,
- write_item));
+ return list_to_obj(&cli->cl_loi_write_list, write_item);
if (!list_empty(&cli->cl_loi_read_list))
- RETURN(list_to_obj(&cli->cl_loi_read_list,
- read_item));
+ return list_to_obj(&cli->cl_loi_read_list, read_item);
}
- RETURN(NULL);
+ return NULL;
}
/* called with the loi list lock held */
spin_lock_init(&oap->oap_lock);
CDEBUG(D_INFO, "oap %p page %p obj off "LPU64"\n",
oap, page, oap->oap_obj_off);
- RETURN(0);
+ return 0;
}
int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
int rc = 0;
if (oap->oap_magic != OAP_MAGIC)
- RETURN(-EINVAL);
+ return -EINVAL;
if (cli->cl_import == NULL || cli->cl_import->imp_invalid)
- RETURN(-EIO);
+ return -EIO;
if (!list_empty(&oap->oap_pending_item) ||
!list_empty(&oap->oap_rpc_item))
- RETURN(-EBUSY);
+ return -EBUSY;
/* Set the OBD_BRW_SRVLOCK before the page is queued. */
brw_flags |= ops->ops_srvlock ? OBD_BRW_SRVLOCK : 0;
if (rc == 0 && osc_quota_chkdq(cli, qid) == NO_QUOTA)
rc = -EDQUOT;
if (rc)
- RETURN(rc);
+ return rc;
}
oap->oap_cmd = cmd;
list_add_tail(&oap->oap_pending_item, &ext->oe_pages);
osc_object_unlock(osc);
}
- RETURN(rc);
+ return rc;
}
int osc_teardown_async_page(const struct lu_env *env,
osc_object_unlock(obj);
if (ext != NULL)
osc_extent_put(env, ext);
- RETURN(rc);
+ return rc;
}
/**
}
osc_list_maint(cli, obj);
- RETURN(rc);
+ return rc;
}
int osc_queue_sync_pages(const struct lu_env *env, struct osc_object *obj,
list_del_init(&oap->oap_pending_item);
osc_ap_completion(env, cli, oap, 0, -ENOMEM);
}
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
ext->oe_rw = !!(cmd & OBD_BRW_READ);
osc_object_unlock(obj);
osc_io_unplug(env, cli, obj, PDL_POLICY_ROUND);
- RETURN(0);
+ return 0;
}
/**
waiting = NULL;
goto again;
}
- RETURN(result);
+ return result;
}
/**
osc_object_unlock(obj);
OSC_IO_DEBUG(obj, "sync file range.\n");
- RETURN(result);
+ return result;
}
/**
}
OSC_IO_DEBUG(obj, "cache page out.\n");
- RETURN(result);
+ return result;
}
/** @} osc */
static int osc_cl_process_config(const struct lu_env *env,
struct lu_device *d, struct lustre_cfg *cfg)
{
- RETURN(osc_process_config_base(d->ld_obd, cfg));
+ return osc_process_config_base(d->ld_obd, cfg);
}
static const struct lu_device_operations osc_lu_ops = {
static int osc_device_init(const struct lu_env *env, struct lu_device *d,
const char *name, struct lu_device *next)
{
- RETURN(0);
+ return 0;
}
static struct lu_device *osc_device_fini(const struct lu_env *env,
OBD_ALLOC_PTR(od);
if (od == NULL)
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
cl_device_init(&od->od_cl, t);
d = osc2lu_dev(od);
rc = osc_setup(obd, cfg);
if (rc) {
osc_device_free(env, d);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
od->od_exp = obd->obd_self_export;
- RETURN(d);
+ return d;
}
static const struct lu_device_type_operations osc_device_type_ops = {
* [from, to) bytes of this page to OST. -jay */
cl_page_export(env, slice->cpl_page, 1);
- RETURN(result);
+ return result;
}
static int osc_io_commit_write(const struct lu_env *env,
/* see osc_io_prepare_write() for lockless io handling. */
cl_page_clip(env, slice->cpl_page, from, to);
- RETURN(0);
+ return 0;
}
static int osc_io_fault_start(const struct lu_env *env,
if (fio->ft_writable)
osc_page_touch_at(env, ios->cis_obj,
fio->ft_index, fio->ft_nob);
- RETURN(0);
+ return 0;
}
static int osc_async_upcall(void *a, int rc)
}
cl_object_attr_unlock(obj);
}
- RETURN(result);
+ return result;
}
static int osc_io_write_start(const struct lu_env *env,
}
cl_object_attr_unlock(obj);
}
- RETURN(result);
+ return result;
}
static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
rc = osc_sync_base(osc_export(obj), oinfo, osc_async_upcall, cbargs,
PTLRPCD_SET);
- RETURN(rc);
+ return rc;
}
static int osc_io_fsync_start(const struct lu_env *env,
result = rc;
}
- RETURN(result);
+ return result;
}
static void osc_io_fsync_end(const struct lu_env *env,
/* should never happen, similar to osc_ldlm_blocking_ast(). */
LBUG();
}
- RETURN(errcode);
+ return errcode;
}
/**
rc = CLO_WAIT;
}
}
- RETURN(rc);
+ return rc;
}
/**
}
}
LASSERT(ergo(ols->ols_glimpse, !osc_lock_is_lockless(ols)));
- RETURN(result);
+ return result;
}
static int osc_lock_wait(const struct lu_env *env,
ols->ols_flush = 1;
LINVRNT(!osc_lock_has_pages(ols));
}
- RETURN(result);
+ return result;
}
/**
lvb->lvb_size = oinfo->loi_kms;
lvb->lvb_blocks = oinfo->loi_lvb.lvb_blocks;
- RETURN(0);
+ return 0;
}
}
}
- RETURN(result);
+ return result;
}
void osc_index2policy(ldlm_policy_data_t *policy, const struct cl_object *obj,
result = -EBUSY;
cl_lock_put(env, lock);
}
- RETURN(result);
+ return result;
}
static void osc_page_disown(const struct lu_env *env,
int rc = 0;
rc = osc_flush_async_page(env, io, opg);
- RETURN(rc);
+ return rc;
}
static const struct cl_page_operations osc_page_ops = {
LASSERT(atomic_read(&cli->cl_lru_in_list) >= 0);
if (atomic_read(&cli->cl_lru_in_list) == 0 || target <= 0)
- RETURN(0);
+ return 0;
env = cl_env_nested_get(&nest);
if (IS_ERR(env))
- RETURN(PTR_ERR(env));
+ return PTR_ERR(env);
pvec = osc_env_info(env)->oti_pvec;
io = &osc_env_info(env)->oti_io;
cl_env_nested_put(&nest, env);
atomic_dec(&cli->cl_lru_shrinkers);
- RETURN(count > 0 ? count : rc);
+ return count > 0 ? count : rc;
}
static void osc_lru_add(struct client_obd *cli, struct osc_page *opg)
int rc = 0;
if (cli->cl_cache == NULL) /* shall not be in LRU */
- RETURN(0);
+ return 0;
LASSERT(atomic_read(cli->cl_lru_left) >= 0);
while (!cfs_atomic_add_unless(cli->cl_lru_left, -1, 0)) {
rc = 0;
}
- RETURN(rc);
+ return rc;
}
/** @} osc */
* quota space on this OST */
CDEBUG(D_QUOTA, "chkdq found noquota for %s %d\n",
type == USRQUOTA ? "user" : "grout", qid[type]);
- RETURN(NO_QUOTA);
+ return NO_QUOTA;
}
}
- RETURN(QUOTA_OK);
+ return QUOTA_OK;
}
#define MD_QUOTA_FLAG(type) ((type == USRQUOTA) ? OBD_MD_FLUSRQUOTA \
int rc = 0;
if ((valid & (OBD_MD_FLUSRQUOTA | OBD_MD_FLGRPQUOTA)) == 0)
- RETURN(0);
+ return 0;
for (type = 0; type < MAXQUOTAS; type++) {
struct osc_quota_info *oqi;
}
}
- RETURN(rc);
+ return rc;
}
/*
}
if (type == MAXQUOTAS)
- RETURN(0);
+ return 0;
for (i = 0; i < type; i++)
cfs_hash_putref(cli->cl_quota_hash[i]);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
int osc_quota_cleanup(struct obd_device *obd)
for (type = 0; type < MAXQUOTAS; type++)
cfs_hash_putref(cli->cl_quota_hash[type]);
- RETURN(0);
+ return 0;
}
int osc_quotactl(struct obd_device *unused, struct obd_export *exp,
&RQF_OST_QUOTACTL, LUSTRE_OST_VERSION,
OST_QUOTACTL);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
oqc = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
*oqc = *oqctl;
}
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
int osc_quotacheck(struct obd_device *unused, struct obd_export *exp,
&RQF_OST_QUOTACHECK, LUSTRE_OST_VERSION,
OST_QUOTACHECK);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
body = req_capsule_client_get(&req->rq_pill, &RMF_OBD_QUOTACTL);
*body = *oqctl;
if (rc)
cli->cl_qchk_stat = rc;
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
int osc_quota_poll_check(struct obd_export *exp, struct if_quotacheck *qchk)
/* the client is not the previous one */
if (rc == CL_NOT_QUOTACHECKED)
rc = -EINTR;
- RETURN(rc);
+ return rc;
}
lmm_size = sizeof(**lmmp);
if (lmmp == NULL)
- RETURN(lmm_size);
+ return lmm_size;
if (*lmmp != NULL && lsm == NULL) {
OBD_FREE(*lmmp, lmm_size);
*lmmp = NULL;
- RETURN(0);
+ return 0;
} else if (unlikely(lsm != NULL && ostid_id(&lsm->lsm_oi) == 0)) {
- RETURN(-EBADF);
+ return -EBADF;
}
if (*lmmp == NULL) {
OBD_ALLOC(*lmmp, lmm_size);
if (*lmmp == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
if (lsm)
ostid_cpu_to_le(&lsm->lsm_oi, &(*lmmp)->lmm_oi);
- RETURN(lmm_size);
+ return lmm_size;
}
/* Unpack OSC object metadata from disk storage (LE byte order). */
CERROR("%s: lov_mds_md too small: %d, need %d\n",
exp->exp_obd->obd_name, lmm_bytes,
(int)sizeof(*lmm));
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* XXX LOV_MAGIC etc check? */
if (unlikely(ostid_id(&lmm->lmm_oi) == 0)) {
CERROR("%s: zero lmm_object_id: rc = %d\n",
exp->exp_obd->obd_name, -EINVAL);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
lsm_size = lov_stripe_md_size(1);
if (lsmp == NULL)
- RETURN(lsm_size);
+ return lsm_size;
if (*lsmp != NULL && lmm == NULL) {
OBD_FREE((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo));
OBD_FREE(*lsmp, lsm_size);
*lsmp = NULL;
- RETURN(0);
+ return 0;
}
if (*lsmp == NULL) {
OBD_ALLOC(*lsmp, lsm_size);
if (unlikely(*lsmp == NULL))
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC((*lsmp)->lsm_oinfo[0], sizeof(struct lov_oinfo));
if (unlikely((*lsmp)->lsm_oinfo[0] == NULL)) {
OBD_FREE(*lsmp, lsm_size);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
loi_init((*lsmp)->lsm_oinfo[0]);
} else if (unlikely(ostid_id(&(*lsmp)->lsm_oi) == 0)) {
- RETURN(-EBADF);
+ return -EBADF;
}
if (lmm != NULL)
else
(*lsmp)->lsm_maxbytes = LUSTRE_STRIPE_MAXBYTES;
- RETURN(lsm_size);
+ return lsm_size;
}
static inline void osc_pack_capa(struct ptlrpc_request *req,
}
out:
rc = aa->aa_oi->oi_cb_up(aa->aa_oi, rc);
- RETURN(rc);
+ return rc;
}
static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
osc_pack_req_body(req, oinfo);
aa->aa_oi = oinfo;
ptlrpc_set_add_req(set, req);
- RETURN(0);
+ return 0;
}
static int osc_getattr(const struct lu_env *env, struct obd_export *exp,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_GETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
osc_pack_req_body(req, oinfo);
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
osc_pack_req_body(req, oinfo);
out:
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int osc_setattr_interpret(const struct lu_env *env,
&body->oa);
out:
rc = sa->sa_upcall(sa->sa_cookie, rc);
- RETURN(rc);
+ return rc;
}
int osc_setattr_async_base(struct obd_export *exp, struct obd_info *oinfo,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SETATTR);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
if (oti && oinfo->oi_oa->o_valid & OBD_MD_FLCOOKIE)
ptlrpc_set_add_req(rqset, req);
}
- RETURN(0);
+ return 0;
}
static int osc_setattr_async(struct obd_export *exp, struct obd_info *oinfo,
if (!lsm) {
rc = obd_alloc_memmd(exp, &lsm);
if (rc < 0)
- RETURN(rc);
+ return rc;
}
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_CREATE);
out:
if (rc && !*ea)
obd_free_memmd(exp, &lsm);
- RETURN(rc);
+ return rc;
}
int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_PUNCH);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_PUNCH);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
req->rq_request_portal = OST_IO_PORTAL; /* bug 7198 */
ptlrpc_at_set_req_timeout(req);
else
ptlrpc_set_add_req(rqset, req);
- RETURN(0);
+ return 0;
}
static int osc_punch(const struct lu_env *env, struct obd_export *exp,
*fa->fa_oi->oi_oa = body->oa;
out:
rc = fa->fa_upcall(fa->fa_cookie, rc);
- RETURN(rc);
+ return rc;
}
int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_SYNC);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SYNC);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
/* overload the size and blocks fields in the oa with start/end */
else
ptlrpc_set_add_req(rqset, req);
- RETURN (0);
+ return 0;
}
static int osc_sync(const struct lu_env *env, struct obd_export *exp,
{
if (!oinfo->oi_oa) {
CDEBUG(D_INFO, "oa NULL\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
oinfo->oi_oa->o_size = start;
oinfo->oi_oa->o_blocks = end;
oinfo->oi_oa->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
- RETURN(osc_sync_base(exp, oinfo, oinfo->oi_cb_up, oinfo, set));
+ return osc_sync_base(exp, oinfo, oinfo->oi_cb_up, oinfo, set);
}
/* Find and cancel locally locks matched by @mode in the resource found by
* when we still want to cancel locks in advance and just cancel them
* locally, without sending any RPC. */
if (exp_connect_cancelset(exp) && !ns_connect_cancelset(ns))
- RETURN(0);
+ return 0;
ostid_build_res_name(&oa->o_oi, &res_id);
res = ldlm_resource_get(ns, NULL, &res_id, 0, 0);
if (res == NULL)
- RETURN(0);
+ return 0;
LDLM_RESOURCE_ADDREF(res);
count = ldlm_cancel_resource_local(res, cancels, NULL, mode,
lock_flags, 0, NULL);
LDLM_RESOURCE_DELREF(res);
ldlm_resource_putref(res);
- RETURN(count);
+ return count;
}
static int osc_destroy_interpret(const struct lu_env *env,
if ((oa->o_valid & OBD_MD_FLFLAGS) &&
oa->o_flags == OBD_FL_RECREATE_OBJS) {
- RETURN(osc_real_create(exp, oa, ea, oti));
+ return osc_real_create(exp, oa, ea, oti);
}
if (!fid_seq_is_mdt(ostid_seq(&oa->o_oi)))
- RETURN(osc_real_create(exp, oa, ea, oti));
+ return osc_real_create(exp, oa, ea, oti);
/* we should not get here anymore */
LBUG();
- RETURN(rc);
+ return rc;
}
/* Destroy requests can be async always on the client, and we don't even really
if (!oa) {
CDEBUG(D_INFO, "oa NULL\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
count = osc_resource_get_unused(exp, oa, &cancels, LCK_PW,
req = ptlrpc_request_alloc(class_exp2cliimp(exp), &RQF_OST_DESTROY);
if (req == NULL) {
ldlm_lock_list_put(&cancels, l_bl_ast, count);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
osc_set_capa_size(req, &RMF_CAPA1, (struct obd_capa *)capa);
0, &cancels, count);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
req->rq_request_portal = OST_IO_PORTAL; /* bug 7198 */
/* Do not wait for response */
ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
- RETURN(0);
+ return 0;
}
static void osc_announce_cached(struct client_obd *cli, struct obdo *oa,
if (target_bytes >= cli->cl_avail_grant) {
client_obd_list_unlock(&cli->cl_loi_list_lock);
- RETURN(0);
+ return 0;
}
client_obd_list_unlock(&cli->cl_loi_list_lock);
OBD_ALLOC_PTR(body);
if (!body)
- RETURN(-ENOMEM);
+ return -ENOMEM;
osc_announce_cached(cli, &body->oa, 0);
if (rc != 0)
__osc_update_grant(cli, body->oa.o_grant);
OBD_FREE_PTR(body);
- RETURN(rc);
+ return rc;
}
static int osc_should_shrink_grant(struct client_obd *client)
struct brw_page *pg_prev;
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ))
- RETURN(-ENOMEM); /* Recoverable */
+ return -ENOMEM; /* Recoverable */
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_BRW_PREP_REQ2))
- RETURN(-EINVAL); /* Fatal */
+ return -EINVAL; /* Fatal */
if ((cmd & OBD_BRW_WRITE) != 0) {
opc = OST_WRITE;
req = ptlrpc_request_alloc(cli->cl_import, &RQF_OST_BRW_READ);
}
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
for (niocount = i = 1; i < page_count; i++) {
if (!can_merge_pages(pga[i - 1], pga[i]))
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, opc);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
req->rq_request_portal = OST_IO_PORTAL; /* bug 7198 */
ptlrpc_at_set_req_timeout(req);
aa->aa_ocapa = capa_get(ocapa);
*reqp = req;
- RETURN(0);
+ return 0;
out:
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int check_write_checksum(struct obdo *oa, const lnet_process_id_t *peer,
if (rc < 0 && rc != -EDQUOT) {
DEBUG_REQ(D_INFO, req, "Failed request with rc = %d\n", rc);
- RETURN(rc);
+ return rc;
}
LASSERTF(req->rq_repmsg != NULL, "rc = %d\n", rc);
body = req_capsule_server_get(&req->rq_pill, &RMF_OST_BODY);
if (body == NULL) {
DEBUG_REQ(D_INFO, req, "Can't unpack body\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
/* set/clear over quota flag for a uid/gid */
osc_update_grant(cli, body);
if (rc < 0)
- RETURN(rc);
+ return rc;
if (aa->aa_oa->o_valid & OBD_MD_FLCKSUM)
client_cksum = aa->aa_oa->o_cksum; /* save for later */
if (lustre_msg_get_opc(req->rq_reqmsg) == OST_WRITE) {
if (rc > 0) {
CERROR("Unexpected +ve rc %d\n", rc);
- RETURN(-EPROTO);
+ return -EPROTO;
}
LASSERT(req->rq_bulk->bd_nob == aa->aa_requested_nob);
if (sptlrpc_cli_unwrap_bulk_write(req, req->rq_bulk))
- RETURN(-EAGAIN);
+ return -EAGAIN;
if ((aa->aa_oa->o_valid & OBD_MD_FLCKSUM) && client_cksum &&
check_write_checksum(&body->oa, peer, client_cksum,
body->oa.o_cksum, aa->aa_requested_nob,
aa->aa_page_count, aa->aa_ppga,
cksum_type_unpack(aa->aa_oa->o_flags)))
- RETURN(-EAGAIN);
+ return -EAGAIN;
rc = check_write_rcs(req, aa->aa_requested_nob,aa->aa_nio_count,
aa->aa_page_count, aa->aa_ppga);
if (rc > aa->aa_requested_nob) {
CERROR("Unexpected rc %d (%d requested)\n", rc,
aa->aa_requested_nob);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (rc != req->rq_bulk->bd_nob_transferred) {
lustre_get_wire_obdo(&req->rq_import->imp_connect_data,
aa->aa_oa, &body->oa);
- RETURN(rc);
+ return rc;
}
static int osc_brw_internal(int cmd, struct obd_export *exp, struct obdo *oa,
out:
if (rc == -EAGAIN || rc == -EINPROGRESS)
rc = -EIO;
- RETURN (rc);
+ return rc;
}
static int osc_brw_redo_request(struct ptlrpc_request *request,
aa->aa_page_count, aa->aa_ppga,
&new_req, aa->aa_ocapa, 0, 1);
if (rc)
- RETURN(rc);
+ return rc;
list_for_each_entry(oap, &aa->aa_oaps, oap_rpc_item) {
if (oap->oap_request != NULL) {
request, oap->oap_request);
if (oap->oap_interrupted) {
ptlrpc_req_finished(new_req);
- RETURN(-EINTR);
+ return -EINTR;
}
}
}
ptlrpcd_add_req(new_req, PDL_POLICY_SAME, -1);
DEBUG_REQ(D_INFO, new_req, "new request");
- RETURN(0);
+ return 0;
}
/*
* I/O can succeed */
if (imp->imp_invalid)
- RETURN(-EIO);
- RETURN(0);
+ return -EIO;
+ return 0;
}
/* test_brw with a failed create can trip this, maybe others. */
orig = ppga = osc_build_ppga(pga, page_count);
if (ppga == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
page_count_orig = page_count;
sort_brw_pages(ppga, page_count);
if (saved_oa != NULL)
OBDO_FREE(saved_oa);
- RETURN(rc);
+ return rc;
}
static int brw_interpret(const struct lu_env *env,
}
if (rc == 0)
- RETURN(0);
+ return 0;
else if (rc == -EAGAIN || rc == -EINPROGRESS)
rc = -EIO;
}
client_obd_list_unlock(&cli->cl_loi_list_lock);
osc_io_unplug(env, cli, NULL, PDL_POLICY_SAME);
- RETURN(rc);
+ return rc;
}
/**
if (clerq && !IS_ERR(clerq))
cl_req_completion(env, clerq, rc);
}
- RETURN(rc);
+ return rc;
}
static int osc_set_lock_data_with_check(struct ldlm_lock *lock,
/* Call the update callback. */
rc = (*upcall)(cookie, rc);
- RETURN(rc);
+ return rc;
}
static int osc_enqueue_interpret(const struct lu_env *env,
* Return -ECANCELED to tell the caller. */
ldlm_lock_decref(lockh, mode);
LDLM_LOCK_PUT(matched);
- RETURN(-ECANCELED);
+ return -ECANCELED;
} else if (osc_set_lock_data_with_check(matched, einfo)) {
*flags |= LDLM_FL_LVB_READY;
/* addref the lock only if not async requests and PW
/* For async requests, decref the lock. */
ldlm_lock_decref(lockh, einfo->ei_mode);
LDLM_LOCK_PUT(matched);
- RETURN(ELDLM_OK);
+ return ELDLM_OK;
} else {
ldlm_lock_decref(lockh, mode);
LDLM_LOCK_PUT(matched);
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_LDLM_ENQUEUE_LVB);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = ldlm_prep_enqueue_req(exp, req, &cancels, 0);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
req_capsule_set_size(&req->rq_pill, &RMF_DLM_LVB, RCL_SERVER,
} else if (intent) {
ptlrpc_req_finished(req);
}
- RETURN(rc);
+ return rc;
}
rc = osc_enqueue_fini(req, lvb, upcall, cookie, flags, agl, rc);
if (intent)
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
static int osc_enqueue(struct obd_export *exp, struct obd_info *oinfo,
oinfo->oi_md->lsm_oinfo[0]->loi_kms_valid,
oinfo->oi_cb_up, oinfo, einfo, oinfo->oi_lockh,
rqset, rqset != NULL, 0);
- RETURN(rc);
+ return rc;
}
int osc_match_base(struct obd_export *exp, struct ldlm_res_id *res_id,
ldlm_mode_t rc;
if (OBD_FAIL_CHECK(OBD_FAIL_OSC_MATCH))
- RETURN(-EIO);
+ return -EIO;
/* Filesystem lock extents are extended to page boundaries so that
* dealing with the page cache is a little smoother */
if (!osc_set_data_with_check(lockh, data)) {
if (!(lflags & LDLM_FL_TEST_LOCK))
ldlm_lock_decref(lockh, rc);
- RETURN(0);
+ return 0;
}
}
if (!(lflags & LDLM_FL_TEST_LOCK) && mode != rc) {
ldlm_lock_addref(lockh, LCK_PR);
ldlm_lock_decref(lockh, LCK_PW);
}
- RETURN(rc);
+ return rc;
}
- RETURN(rc);
+ return rc;
}
int osc_cancel_base(struct lustre_handle *lockh, __u32 mode)
else
ldlm_lock_decref(lockh, mode);
- RETURN(0);
+ return 0;
}
static int osc_cancel(struct obd_export *exp, struct lov_stripe_md *md,
__u32 mode, struct lustre_handle *lockh)
{
- RETURN(osc_cancel_base(lockh, mode));
+ return osc_cancel_base(lockh, mode);
}
static int osc_cancel_unused(struct obd_export *exp,
* Exit immediately since the caller is
* aware of the problem and takes care
* of the clean up */
- RETURN(rc);
+ return rc;
if ((rc == -ENOTCONN || rc == -EAGAIN) &&
(aa->aa_oi->oi_flags & OBD_STATFS_NODELAY))
*aa->aa_oi->oi_osfs = *msfs;
out:
rc = aa->aa_oi->oi_cb_up(aa->aa_oi, rc);
- RETURN(rc);
+ return rc;
}
static int osc_statfs_async(struct obd_export *exp,
* timestamps are not ideal because they need time synchronization. */
req = ptlrpc_request_alloc(obd->u.cli.cl_import, &RQF_OST_STATFS);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_STATFS);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
ptlrpc_request_set_replen(req);
req->rq_request_portal = OST_CREATE_PORTAL;
aa->aa_oi = oinfo;
ptlrpc_set_add_req(rqset, req);
- RETURN(0);
+ return 0;
}
static int osc_statfs(const struct lu_env *env, struct obd_export *exp,
imp = class_import_get(obd->u.cli.cl_import);
up_read(&obd->u.cli.cl_sem);
if (!imp)
- RETURN(-ENODEV);
+ return -ENODEV;
/* We could possibly pass max_age in the request (as an absolute
* timestamp or a "seconds.usec ago") so the target can avoid doing
class_import_put(imp);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_STATFS);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
ptlrpc_request_set_replen(req);
req->rq_request_portal = OST_CREATE_PORTAL;
int rc = 0, lum_size;
if (!lsm)
- RETURN(-ENODATA);
+ return -ENODATA;
/* we only need the header part from user space to get lmm_magic and
* lmm_stripe_count, (the header part is common to v1 and v3) */
lum_size = sizeof(struct lov_user_md_v1);
if (copy_from_user(&lum, lump, lum_size))
- RETURN(-EFAULT);
+ return -EFAULT;
if ((lum.lmm_magic != LOV_USER_MAGIC_V1) &&
(lum.lmm_magic != LOV_USER_MAGIC_V3))
- RETURN(-EINVAL);
+ return -EINVAL;
/* lov_user_md_vX and lov_mds_md_vX must have the same size */
LASSERT(sizeof(struct lov_user_md_v1) == sizeof(struct lov_mds_md_v1));
lum_size = lov_mds_md_size(lum.lmm_stripe_count, lum.lmm_magic);
OBD_ALLOC(lumk, lum_size);
if (!lumk)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (lum.lmm_magic == LOV_USER_MAGIC_V1)
lmm_objects =
if (lumk != &lum)
OBD_FREE(lumk, lum_size);
- RETURN(rc);
+ return rc;
}
struct lov_stripe_md *lsm)
{
if (!vallen || !val)
- RETURN(-EFAULT);
+ return -EFAULT;
if (KEY_IS(KEY_LOCK_TO_STRIPE)) {
__u32 *stripe = val;
*vallen = sizeof(*stripe);
*stripe = 0;
- RETURN(0);
+ return 0;
} else if (KEY_IS(KEY_LAST_ID)) {
struct ptlrpc_request *req;
obd_id *reply;
req = ptlrpc_request_alloc(class_exp2cliimp(exp),
&RQF_OST_GET_INFO_LAST_ID);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY,
RCL_CLIENT, keylen);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GET_INFO);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY);
*((obd_id *)val) = *reply;
out:
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
} else if (KEY_IS(KEY_FIEMAP)) {
struct ll_fiemap_info_key *fm_key =
(struct ll_fiemap_info_key *)key;
drop_lock:
if (mode)
ldlm_lock_decref(&lockh, LCK_PR);
- RETURN(rc);
+ return rc;
}
- RETURN(-EINVAL);
+ return -EINVAL;
}
static int osc_set_info_async(const struct lu_env *env, struct obd_export *exp,
if (KEY_IS(KEY_CHECKSUM)) {
if (vallen != sizeof(int))
- RETURN(-EINVAL);
+ return -EINVAL;
exp->exp_obd->u.cli.cl_checksum = (*(int *)val) ? 1 : 0;
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_SPTLRPC_CONF)) {
sptlrpc_conf_client_adapt(obd);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_FLUSH_CTX)) {
sptlrpc_import_flush_my_ctx(imp);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_CACHE_SET)) {
list_add(&cli->cl_lru_osc, &cli->cl_cache->ccc_lru);
spin_unlock(&cli->cl_cache->ccc_lru_lock);
- RETURN(0);
+ return 0;
}
if (KEY_IS(KEY_CACHE_LRU_SHRINK)) {
nr = osc_lru_shrink(cli, min(nr, target));
*(int *)val -= nr;
- RETURN(0);
+ return 0;
}
if (!set && !KEY_IS(KEY_GRANT_SHRINK))
- RETURN(-EINVAL);
+ return -EINVAL;
/* We pass all other commands directly to OST. Since nobody calls osc
methods directly and everybody is supposed to go through LOV, we
&RQF_OST_SET_GRANT_INFO :
&RQF_OBD_SET_INFO);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY,
RCL_CLIENT, keylen);
rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SET_INFO);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY);
OBDO_ALLOC(oa);
if (!oa) {
ptlrpc_req_finished(req);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
*oa = ((struct ost_body *)val)->oa;
aa->aa_oa = oa;
} else
ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
- RETURN(0);
+ return 0;
}
ctxt = llog_get_context(obd, LLOG_SIZE_REPL_CTXT);
if (ctxt)
llog_cleanup(NULL, ctxt);
- RETURN(0);
+ return 0;
}
static int osc_reconnect(const struct lu_env *env,
data->ocd_version, data->ocd_grant, lost_grant);
}
- RETURN(0);
+ return 0;
}
static int osc_disconnect(struct obd_export *exp)
CERROR("Unknown import event %d\n", event);
LBUG();
}
- RETURN(rc);
+ return rc;
}
/**
(lock->l_granted_mode == LCK_PR ||
lock->l_granted_mode == LCK_CR) &&
(osc_dlm_lock_pageref(lock) == 0))
- RETURN(1);
+ return 1;
- RETURN(0);
+ return 0;
}
static int brw_queue_work(const struct lu_env *env, void *data)
CDEBUG(D_CACHE, "Run writeback work for client obd %p.\n", cli);
osc_io_unplug(env, cli, NULL, PDL_POLICY_SAME);
- RETURN(0);
+ return 0;
}
int osc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
rc = ptlrpcd_addref();
if (rc)
- RETURN(rc);
+ return rc;
rc = client_obd_setup(obd, lcfg);
if (rc)
INIT_LIST_HEAD(&cli->cl_grant_shrink_list);
ns_register_cancel(obd->obd_namespace, osc_cancel_for_recovery);
- RETURN(rc);
+ return rc;
out_ptlrpcd_work:
ptlrpcd_destroy_work(handler);
client_obd_cleanup(obd);
out_ptlrpcd:
ptlrpcd_decref();
- RETURN(rc);
+ return rc;
}
static int osc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
break;
}
}
- RETURN(rc);
+ return rc;
}
int osc_cleanup(struct obd_device *obd)
rc = client_obd_cleanup(obd);
ptlrpcd_decref();
- RETURN(rc);
+ return rc;
}
int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *lcfg)
rc = lu_kmem_init(osc_caches);
if (rc)
- RETURN(rc);
+ return rc;
lprocfs_osc_init_vars(&lvars);
LUSTRE_OSC_NAME, &osc_device_type);
if (rc) {
lu_kmem_fini(osc_caches);
- RETURN(rc);
+ return rc;
}
spin_lock_init(&osc_ast_guard);
lockdep_set_class(&osc_ast_guard, &osc_ast_guard_class);
- RETURN(rc);
+ return rc;
}
static void /*__exit*/ osc_exit(void)
LASSERT(type == BULK_PUT_SINK || type == BULK_GET_SOURCE);
desc = ptlrpc_new_bulk(npages, max_brw, type, portal);
if (desc == NULL)
- RETURN(NULL);
+ return NULL;
desc->bd_import_generation = req->rq_import_generation;
desc->bd_import = class_import_get(imp);
rc = sptlrpc_cli_unwrap_early_reply(req, &early_req);
if (rc) {
spin_lock(&req->rq_lock);
- RETURN(rc);
+ return rc;
}
rc = unpack_reply(early_req);
if (rc != 0) {
spin_lock(&req->rq_lock);
- RETURN(rc);
+ return rc;
}
/* Adjust the local timeout for this req */
cfs_time_sub(req->rq_deadline, cfs_time_current_sec()),
cfs_time_sub(req->rq_deadline, olddl));
- RETURN(rc);
+ return rc;
}
/**
lustre_msg_set_opc(request->rq_reqmsg, opcode);
- RETURN(0);
+ return 0;
out_ctx:
sptlrpc_cli_ctx_put(request->rq_cli_ctx, 1);
out_free:
OBD_ALLOC(set, sizeof *set);
if (!set)
- RETURN(NULL);
+ return NULL;
atomic_set(&set->set_refcount, 1);
INIT_LIST_HEAD(&set->set_requests);
init_waitqueue_head(&set->set_waitq);
set->set_producer_arg = NULL;
set->set_rc = 0;
- RETURN(set);
+ return set;
}
EXPORT_SYMBOL(ptlrpc_prep_set);
set = ptlrpc_prep_set();
if (!set)
- RETURN(NULL);
+ return NULL;
set->set_max_inflight = max;
set->set_producer = func;
set->set_producer_arg = arg;
- RETURN(set);
+ return set;
}
EXPORT_SYMBOL(ptlrpc_prep_fcset);
OBD_ALLOC_PTR(cbdata);
if (cbdata == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
cbdata->psc_interpret = fn;
cbdata->psc_data = data;
list_add_tail(&cbdata->psc_item, &set->set_cblist);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_set_add_cb);
}
}
- RETURN(delay);
+ return delay;
}
/**
libcfs_nid2str(
imp->imp_connection->c_peer.nid),
ll_opcode2str(opc), err);
- RETURN(err < 0 ? err : -EINVAL);
+ return err < 0 ? err : -EINVAL;
}
if (err < 0) {
DEBUG_REQ(D_INFO, req, "status is %d", err);
}
- RETURN(err);
+ return err;
}
/**
DEBUG_REQ(D_ERROR, req, "reply buffer overflow,"
" expected: %d, actual size: %d",
req->rq_nob_received, req->rq_repbuf_len);
- RETURN(-EOVERFLOW);
+ return -EOVERFLOW;
}
sptlrpc_cli_free_repbuf(req);
req->rq_replen = req->rq_nob_received;
req->rq_nob_received = 0;
req->rq_resend = 1;
- RETURN(0);
+ return 0;
}
/*
rc = sptlrpc_cli_unwrap_reply(req);
if (rc) {
DEBUG_REQ(D_ERROR, req, "unwrap reply failed (%d):", rc);
- RETURN(rc);
+ return rc;
}
/*
* Security layer unwrap might ask resend this request.
*/
if (req->rq_resend)
- RETURN(0);
+ return 0;
rc = unpack_reply(req);
if (rc)
- RETURN(rc);
+ return rc;
/* retry indefinitely on EINPROGRESS */
if (lustre_msg_get_status(req->rq_repmsg) == -EINPROGRESS &&
else
req->rq_sent = now + req->rq_nr_resend;
- RETURN(0);
+ return 0;
}
do_gettimeofday(&work_start);
lustre_msg_get_type(req->rq_repmsg) != PTL_RPC_MSG_ERR) {
DEBUG_REQ(D_ERROR, req, "invalid packet received (type=%u)",
lustre_msg_get_type(req->rq_repmsg));
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (lustre_msg_get_opc(req->rq_reqmsg) != OBD_PING)
if (ll_rpc_recoverable_error(rc)) {
if (req->rq_send_state != LUSTRE_IMP_FULL ||
imp->imp_obd->obd_no_recov || imp->imp_dlm_fake) {
- RETURN(rc);
+ return rc;
}
ptlrpc_request_handle_notconn(req);
- RETURN(rc);
+ return rc;
}
} else {
/*
spin_unlock(&imp->imp_lock);
}
- RETURN(rc);
+ return rc;
}
/**
if (req->rq_sent && (req->rq_sent > cfs_time_current_sec()) &&
(!req->rq_generation_set ||
req->rq_import_generation == imp->imp_generation))
- RETURN (0);
+ return 0;
ptlrpc_rqphase_move(req, RQ_PHASE_RPC);
list_add_tail(&req->rq_list, &imp->imp_delayed_list);
atomic_inc(&req->rq_import->imp_inflight);
spin_unlock(&imp->imp_lock);
- RETURN(0);
+ return 0;
}
if (rc != 0) {
spin_unlock(&imp->imp_lock);
req->rq_status = rc;
ptlrpc_rqphase_move(req, RQ_PHASE_INTERPRET);
- RETURN(rc);
+ return rc;
}
LASSERT(list_empty(&req->rq_list));
if (rc) {
if (req->rq_err) {
req->rq_status = rc;
- RETURN(1);
+ return 1;
} else {
req->rq_wait_ctx = 1;
- RETURN(0);
+ return 0;
}
}
if (rc) {
DEBUG_REQ(D_HA, req, "send failed (%d); expect timeout", rc);
req->rq_net_err = 1;
- RETURN(rc);
+ return rc;
}
- RETURN(0);
+ return 0;
}
static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set)
/* no more RPC to produce */
set->set_producer = NULL;
set->set_producer_arg = NULL;
- RETURN(0);
+ return 0;
}
}
- RETURN((atomic_read(&set->set_remaining) - remaining));
+ return (atomic_read(&set->set_remaining) - remaining);
}
/**
int force_timer_recalc = 0;
if (atomic_read(&set->set_remaining) == 0)
- RETURN(1);
+ return 1;
list_for_each_safe(tmp, next, &set->set_requests) {
struct ptlrpc_request *req =
}
/* If we hit an error, we want to recover promptly. */
- RETURN(atomic_read(&set->set_remaining) == 0 || force_timer_recalc);
+ return atomic_read(&set->set_remaining) == 0 || force_timer_recalc;
}
EXPORT_SYMBOL(ptlrpc_check_set);
if (imp == NULL) {
DEBUG_REQ(D_HA, req, "NULL import: already cleaned up?");
- RETURN(1);
+ return 1;
}
atomic_inc(&imp->imp_timeouts);
/* The DLM server doesn't want recovery run on its imports. */
if (imp->imp_dlm_fake)
- RETURN(1);
+ return 1;
/* If this request is for recovery or other primordial tasks,
* then error it out here. */
req->rq_status = -ETIMEDOUT;
req->rq_err = 1;
spin_unlock(&req->rq_lock);
- RETURN(1);
+ return 1;
}
/* if a request can't be resent we can't wait for an answer after
ptlrpc_fail_import(imp, lustre_msg_get_conn_cnt(req->rq_reqmsg));
- RETURN(rc);
+ return rc;
}
/**
* sleep so we can recalculate the timeout, or enable interrupts
* if everyone's timed out.
*/
- RETURN(1);
+ return 1;
}
EXPORT_SYMBOL(ptlrpc_expired_set);
else if (timeout == 0 || timeout > deadline - now)
timeout = deadline - now;
}
- RETURN(timeout);
+ return timeout;
}
EXPORT_SYMBOL(ptlrpc_set_next_timeout);
}
if (list_empty(&set->set_requests))
- RETURN(0);
+ return 0;
do {
timeout = ptlrpc_set_next_timeout(set);
}
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_set_wait);
static int __ptlrpc_req_finished(struct ptlrpc_request *request, int locked)
{
if (request == NULL)
- RETURN(1);
+ return 1;
if (request == LP_POISON ||
request->rq_reqmsg == LP_POISON) {
CERROR("dereferencing freed request (bug 575)\n");
LBUG();
- RETURN(1);
+ return 1;
}
DEBUG_REQ(D_INFO, request, "refcount now %u",
if (atomic_dec_and_test(&request->rq_refcount)) {
__ptlrpc_free_req(request, locked);
- RETURN(1);
+ return 1;
}
- RETURN(0);
+ return 0;
}
/**
* Nothing left to do.
*/
if (!ptlrpc_client_recv_or_unlink(request))
- RETURN(1);
+ return 1;
LNetMDUnlink(request->rq_reply_md_h);
* Let's check it once again.
*/
if (!ptlrpc_client_recv_or_unlink(request))
- RETURN(1);
+ return 1;
/*
* Move to "Unregistering" phase as reply was not unlinked yet.
* Do not wait for unlink to finish.
*/
if (async)
- RETURN(0);
+ return 0;
/*
* We have to l_wait_event() whatever the result, to give liblustre
&lwi);
if (rc == 0) {
ptlrpc_rqphase_move(request, request->rq_next_phase);
- RETURN(1);
+ return 1;
}
LASSERT(rc == -ETIMEDOUT);
"rvcng=%d unlnk=%d", request->rq_receiving_reply,
request->rq_must_unlink);
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_unregister_reply);
struct ptlrpc_request *ptlrpc_request_addref(struct ptlrpc_request *req)
{
atomic_inc(&req->rq_refcount);
- RETURN(req);
+ return req;
}
EXPORT_SYMBOL(ptlrpc_request_addref);
set = ptlrpc_prep_set();
if (set == NULL) {
CERROR("Unable to allocate ptlrpc set.");
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* for distributed debugging */
rc = ptlrpc_set_wait(set);
ptlrpc_set_destroy(set);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_queue_wait);
/* this replay failed, so restart recovery */
ptlrpc_connect_import(imp);
- RETURN(rc);
+ return rc;
}
/**
ptlrpc_request_addref(req); /* ptlrpcd needs a ref */
ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_replay_req);
might_sleep();
if (cb == NULL)
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
/* copy some code from deprecated fakereq. */
OBD_ALLOC_PTR(req);
if (req == NULL) {
CERROR("ptlrpc: run out of memory!\n");
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
}
req->rq_send_state = LUSTRE_IMP_FULL;
args->cb = cb;
args->cbdata = cbdata;
- RETURN(req);
+ return req;
}
EXPORT_SYMBOL(ptlrpcd_alloc_work);
OBD_ALLOC_PTR(conn);
if (!conn)
- RETURN(NULL);
+ return NULL;
conn->c_peer = peer;
conn->c_self = self;
int rc = 0;
if (!conn)
- RETURN(rc);
+ return rc;
LASSERT(atomic_read(&conn->c_refcount) > 1);
conn, atomic_read(&conn->c_refcount),
libcfs_nid2str(conn->c_peer.nid));
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_connection_put);
conn, atomic_read(&conn->c_refcount),
libcfs_nid2str(conn->c_peer.nid));
- RETURN(conn);
+ return conn;
}
EXPORT_SYMBOL(ptlrpc_connection_addref);
CFS_HASH_MAX_THETA,
&conn_hash_ops, CFS_HASH_DEFAULT);
if (!conn_hash)
- RETURN(-ENOMEM);
+ return -ENOMEM;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_connection_init);
bsd->bsd_svc = SPTLRPC_FLVR_BULK_SVC(req->rq_flvr.sf_rpc);
if (bsd->bsd_svc == SPTLRPC_BULK_SVC_NULL)
- RETURN(0);
+ return 0;
LASSERT(bsd->bsd_svc == SPTLRPC_BULK_SVC_INTG ||
bsd->bsd_svc == SPTLRPC_BULK_SVC_PRIV);
&token);
if (maj != GSS_S_COMPLETE) {
CWARN("failed to sign bulk data: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
} else {
/* privacy mode */
if (desc->bd_iov_count == 0)
- RETURN(0);
+ return 0;
rc = sptlrpc_enc_pool_get_pages(desc);
if (rc) {
CERROR("bulk write: failed to allocate "
"encryption pages: %d\n", rc);
- RETURN(rc);
+ return rc;
}
token.data = bsd->bsd_data;
maj = lgss_wrap_bulk(gctx->gc_mechctx, desc, &token, 0);
if (maj != GSS_S_COMPLETE) {
CWARN("fail to encrypt bulk data: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
}
}
- RETURN(0);
+ return 0;
}
int gss_cli_ctx_unwrap_bulk(struct ptlrpc_cli_ctx *ctx,
"(%u,%u,%u) != (%u,%u,%u)\n",
bsdr->bsd_version, bsdr->bsd_type, bsdr->bsd_svc,
bsdv->bsd_version, bsdv->bsd_type, bsdv->bsd_svc);
- RETURN(-EPROTO);
+ return -EPROTO;
}
LASSERT(bsdv->bsd_svc == SPTLRPC_BULK_SVC_NULL ||
if (req->rq_bulk_write) {
if (bsdv->bsd_flags & BSD_FL_ERR) {
CERROR("server reported bulk i/o failure\n");
- RETURN(-EIO);
+ return -EIO;
}
if (bsdv->bsd_svc == SPTLRPC_BULK_SVC_PRIV)
&token);
if (maj != GSS_S_COMPLETE) {
CERROR("failed to verify bulk read: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
} else if (bsdv->bsd_svc == SPTLRPC_BULK_SVC_PRIV) {
desc->bd_nob = bsdv->bsd_nob;
if (desc->bd_nob == 0)
- RETURN(0);
+ return 0;
token.data = bsdv->bsd_data;
token.len = lustre_msg_buflen(vmsg, voff) -
if (maj != GSS_S_COMPLETE) {
CERROR("failed to decrypt bulk read: %x\n",
maj);
- RETURN(-EACCES);
+ return -EACCES;
}
desc->bd_nob_transferred = desc->bd_nob;
}
}
- RETURN(0);
+ return 0;
}
static int gss_prep_bulk(struct ptlrpc_bulk_desc *desc,
LASSERT(req->rq_bulk_read);
if (SPTLRPC_FLVR_BULK_SVC(req->rq_flvr.sf_rpc) != SPTLRPC_BULK_SVC_PRIV)
- RETURN(0);
+ return 0;
rc = gss_prep_bulk(desc, ctx2gctx(req->rq_cli_ctx)->gc_mechctx);
if (rc)
CERROR("bulk read: failed to prepare encryption "
"pages: %d\n", rc);
- RETURN(rc);
+ return rc;
}
int gss_svc_prep_bulk(struct ptlrpc_request *req,
bsd = grctx->src_reqbsd;
if (bsd->bsd_svc != SPTLRPC_BULK_SVC_PRIV)
- RETURN(0);
+ return 0;
rc = gss_prep_bulk(desc, grctx->src_ctx->gsc_mechctx);
if (rc)
CERROR("bulk write: failed to prepare encryption "
"pages: %d\n", rc);
- RETURN(rc);
+ return rc;
}
int gss_svc_unwrap_bulk(struct ptlrpc_request *req,
if (maj != GSS_S_COMPLETE) {
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("failed to verify bulk signature: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
break;
case SPTLRPC_BULK_SVC_PRIV:
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("prepared nob %d doesn't match the actual "
"nob %d\n", desc->bd_nob, bsdr->bsd_nob);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (desc->bd_iov_count == 0) {
if (maj != GSS_S_COMPLETE) {
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("failed decrypt bulk data: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
break;
}
- RETURN(0);
+ return 0;
}
int gss_svc_wrap_bulk(struct ptlrpc_request *req,
if (maj != GSS_S_COMPLETE) {
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("failed to sign bulk data: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
break;
case SPTLRPC_BULK_SVC_PRIV:
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("bulk read: failed to allocate encryption "
"pages: %d\n", rc);
- RETURN(rc);
+ return rc;
}
token.data = bsdv->bsd_data;
if (maj != GSS_S_COMPLETE) {
bsdv->bsd_flags |= BSD_FL_ERR;
CERROR("failed to encrypt bulk data: %x\n", maj);
- RETURN(-EACCES);
+ return -EACCES;
}
break;
}
- RETURN(0);
+ return 0;
}
if (count != sizeof(param)) {
CERROR("ioctl size %lu, expect %lu, please check lgss_keyring "
"version\n", count, (unsigned long) sizeof(param));
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (copy_from_user(¶m, buffer, sizeof(param))) {
CERROR("failed copy data from lgssd\n");
- RETURN(-EFAULT);
+ return -EFAULT;
}
if (param.version != GSSD_INTERFACE_VERSION) {
CERROR("gssd interface version %d (expect %d)\n",
param.version, GSSD_INTERFACE_VERSION);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* take name */
if (strncpy_from_user(obdname, param.uuid, sizeof(obdname)) <= 0) {
CERROR("Invalid obdname pointer\n");
- RETURN(-EFAULT);
+ return -EFAULT;
}
obd = class_name2obd(obdname);
if (!obd) {
CERROR("no such obd %s\n", obdname);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (unlikely(!obd->obd_set_up)) {
CERROR("obd %s not setup\n", obdname);
- RETURN(-EINVAL);
+ return -EINVAL;
}
spin_lock(&obd->obd_dev_lock);
if (obd->obd_stopping) {
CERROR("obd %s has stopped\n", obdname);
spin_unlock(&obd->obd_dev_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (strcmp(obd->obd_type->typ_name, LUSTRE_MDC_NAME) &&
strcmp(obd->obd_type->typ_name, LUSTRE_MGC_NAME)) {
CERROR("obd %s is not a client device\n", obdname);
spin_unlock(&obd->obd_dev_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
spin_unlock(&obd->obd_dev_lock);
if (obd->u.cli.cl_import == NULL) {
CERROR("obd %s: import has gone\n", obd->obd_name);
up_read(&obd->u.cli.cl_sem);
- RETURN(-EINVAL);
+ return -EINVAL;
}
imp = class_import_get(obd->u.cli.cl_import);
up_read(&obd->u.cli.cl_sem);
if (imp->imp_deactive) {
CERROR("import has been deactivated\n");
class_import_put(imp);
- RETURN(-EINVAL);
+ return -EINVAL;
}
req = ptlrpc_request_alloc_pack(imp, &RQF_SEC_CTX, LUSTRE_OBD_VERSION,
class_import_put(imp);
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
int gss_do_ctx_fini_rpc(struct gss_cli_ctx *gctx)
CDEBUG(D_SEC, "ctx %p(%u->%s) not uptodate, "
"don't send destroy rpc\n", ctx,
ctx->cc_vcred.vc_uid, sec2target_str(ctx->cc_sec));
- RETURN(0);
+ return 0;
}
might_sleep();
out_ref:
ptlrpc_req_finished(req);
out:
- RETURN(rc);
+ return rc;
}
int __init gss_init_cli_upcall(void)
OBD_ALLOC(gsec_kr, sizeof(*gsec_kr));
if (gsec_kr == NULL)
- RETURN(NULL);
+ return NULL;
INIT_HLIST_HEAD(&gsec_kr->gsk_clist);
gsec_kr->gsk_root_ctx = NULL;
goto err_free;
}
- RETURN(&gsec_kr->gsk_base.gs_base);
+ return &gsec_kr->gsk_base.gs_base;
err_free:
OBD_FREE(gsec_kr, sizeof(*gsec_kr));
- RETURN(NULL);
+ return NULL;
}
static
* always succeed.
*/
if (ctx || sec_is_reverse(sec))
- RETURN(ctx);
+ return ctx;
}
LASSERT(create != 0);
out:
if (is_root)
mutex_unlock(&gsec_kr->gsk_root_uc_lock);
- RETURN(ctx);
+ return ctx;
}
static
else
flush_spec_ctx_cache_kr(sec, uid, grace, force);
- RETURN(0);
+ return 0;
}
static
}
spin_unlock(&sec->ps_lock);
- RETURN(0);
+ return 0;
}
/****************************************
if (data != NULL || datalen != 0) {
CERROR("invalid: data %p, len %lu\n", data, (long)datalen);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (key->payload.data != 0) {
CERROR("key already have payload\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* link the key to session keyring, so following context negotiation
CERROR("failed to link key %08x to keyring %08x: %d\n",
key->serial,
key_tgcred(current)->session_keyring->serial, rc);
- RETURN(rc);
+ return rc;
}
CDEBUG(D_SEC, "key %p instantiated, ctx %p\n", key, key->payload.data);
- RETURN(0);
+ return 0;
}
/*
if (data == NULL || datalen == 0) {
CWARN("invalid: data %p, len %lu\n", data, (long)datalen);
- RETURN(-EINVAL);
+ return -EINVAL;
}
/* if upcall finished negotiation too fast (mostly likely because
rc = key_validate(key);
if (rc == 0)
- RETURN(-EAGAIN);
+ return -EAGAIN;
else
- RETURN(rc);
+ return rc;
}
LASSERT(atomic_read(&ctx->cc_refcount) > 0);
/* don't proceed if already refreshed */
if (cli_ctx_is_refreshed(ctx)) {
CWARN("ctx already done refresh\n");
- RETURN(0);
+ return 0;
}
sptlrpc_cli_ctx_get(ctx);
/* let user space think it's a success */
sptlrpc_cli_ctx_put(ctx, 1);
- RETURN(0);
+ return 0;
}
static
if (rc) {
CERROR("encrypt error %d\n", rc);
- RETURN(rc);
+ return rc;
}
datalen += inobjs[i].len;
}
outobj->len = datalen;
- RETURN(0);
+ return 0;
}
/*
cli_ctx = ctx_create_pf(&gsec->gs_base, &vcred);
if (!cli_ctx)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rc = gss_copy_rvc_cli_ctx(cli_ctx, svc_ctx);
if (rc) {
ctx_destroy_pf(cli_ctx->cc_sec, cli_ctx);
- RETURN(rc);
+ return rc;
}
gss_sec_ctx_replace_pf(gsec, cli_ctx);
- RETURN(0);
+ return 0;
}
static
OBD_ALLOC(gsec_pf, alloc_size);
if (!gsec_pf)
- RETURN(NULL);
+ return NULL;
gsec_pf->gsp_chash_size = hash_size;
for (i = 0; i < hash_size; i++)
goto err_destroy;
}
- RETURN(&gsec_pf->gsp_base.gs_base);
+ return &gsec_pf->gsp_base.gs_base;
err_destroy:
gss_sec_destroy_common(&gsec_pf->gsp_base);
err_free:
OBD_FREE(gsec_pf, alloc_size);
- RETURN(NULL);
+ return NULL;
}
static
/* don't allocate for reverse sec */
if (sec_is_reverse(sec)) {
spin_unlock(&sec->ps_lock);
- RETURN(NULL);
+ return NULL;
}
if (new) {
}
ctx_list_destroy_pf(&freelist);
- RETURN(ctx);
+ return ctx;
}
static
spin_unlock(&sec->ps_lock);
ctx_list_destroy_pf(&freelist);
- RETURN(busy);
+ return busy;
}
/****************************************
left = copy_to_user(dst, data, mlen);
if (left < 0) {
msg->errno = left;
- RETURN(left);
+ return left;
}
mlen -= left;
msg->copied += mlen;
msg->errno = 0;
- RETURN(mlen);
+ return mlen;
}
static
OBD_ALLOC(buf, mlen);
if (!buf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (copy_from_user(buf, src, mlen)) {
CERROR("failed copy user space data\n");
* hack pipefs: always return asked length unless all following
* downcalls might be messed up. */
rc = mlen;
- RETURN(rc);
+ return rc;
}
static
imp = ctx->cc_sec->ps_import;
if (!imp->imp_connection) {
CERROR("import has no connection set\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
gsec = container_of(ctx->cc_sec, struct gss_sec, gs_base);
OBD_ALLOC_PTR(gmsg);
if (!gmsg)
- RETURN(-ENOMEM);
+ return -ENOMEM;
/* initialize pipefs base msg */
INIT_LIST_HEAD(&gmsg->gum_base.list);
goto err_free;
}
- RETURN(0);
+ return 0;
err_free:
OBD_FREE_PTR(gmsg);
- RETURN(rc);
+ return rc;
}
static
OBD_ALLOC_LARGE(obj->data, len);
if (!obj->data) {
obj->len = 0;
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
memcpy(obj->data, buf, len);
} else
if (status)
CERROR("rsi parse error %d\n", status);
- RETURN(status);
+ return status;
}
static struct cache_detail rsi_cache = {
if (rc)
CERROR("create reverse svc ctx: idx "LPX64", rc %d\n",
gsec->gs_rvs_hdl, rc);
- RETURN(rc);
+ return rc;
}
int gss_svc_upcall_expire_rvs_ctx(rawobj_t *handle)
COMPAT_RSC_PUT(&rsci->h, &rsc_cache);
}
- RETURN(rc);
+ return rc;
}
struct gss_svc_ctx *gss_svc_upcall_get_ctx(struct ptlrpc_request *req,
if (msgbuf->lm_bufcount != 2) {
CERROR("invalid bufcount %d\n", msgbuf->lm_bufcount);
- RETURN(GSS_S_FAILURE);
+ return GSS_S_FAILURE;
}
/* allocate a temporary clear text buffer, same sized as token,
clear_buflen = lustre_msg_buflen(msgbuf, 1);
OBD_ALLOC_LARGE(clear_buf, clear_buflen);
if (!clear_buf)
- RETURN(GSS_S_FAILURE);
+ return GSS_S_FAILURE;
/* buffer objects */
hdrobj.len = lustre_msg_buflen(msgbuf, 0);
major = GSS_S_COMPLETE;
out_free:
OBD_FREE_LARGE(clear_buf, clear_buflen);
- RETURN(major);
+ return major;
}
/********************************************
/* nothing to do for context negotiation RPCs */
if (req->rq_ctx_init)
- RETURN(0);
+ return 0;
svc = SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc);
if (req->rq_pack_bulk)
flags, gctx->gc_proc, seq, svc,
&gctx->gc_handle);
if (rc < 0)
- RETURN(rc);
+ return rc;
/* gss_sign_msg() msg might take long time to finish, in which period
* more rpcs could be wrapped up and sent out. if we found too many
}
req->rq_reqdata_len = rc;
- RETURN(0);
+ return 0;
}
static
if (req->rq_ctx_init && !req->rq_early) {
req->rq_repmsg = lustre_msg_buf(msg, 1, 0);
req->rq_replen = msg->lm_buflens[1];
- RETURN(0);
+ return 0;
}
if (msg->lm_bufcount < 2 || msg->lm_bufcount > 4) {
CERROR("unexpected bufcount %u\n", msg->lm_bufcount);
- RETURN(-EPROTO);
+ return -EPROTO;
}
swabbed = ptlrpc_rep_need_swab(req);
ghdr = gss_swab_header(msg, 0, swabbed);
if (ghdr == NULL) {
CERROR("can't decode gss header\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
/* sanity checks */
if (ghdr->gh_version != reqhdr->gh_version) {
CERROR("gss version %u mismatch, expect %u\n",
ghdr->gh_version, reqhdr->gh_version);
- RETURN(-EPROTO);
+ return -EPROTO;
}
switch (ghdr->gh_proc) {
if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){
CERROR("%s bulk flag in reply\n",
req->rq_pack_bulk ? "missing" : "unexpected");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (ghdr->gh_seq != reqhdr->gh_seq) {
CERROR("seqnum %u mismatch, expect %u\n",
ghdr->gh_seq, reqhdr->gh_seq);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (ghdr->gh_svc != reqhdr->gh_svc) {
CERROR("svc %u mismatch, expect %u\n",
ghdr->gh_svc, reqhdr->gh_svc);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (swabbed)
major = gss_verify_msg(msg, gctx->gc_mechctx, reqhdr->gh_svc);
if (major != GSS_S_COMPLETE) {
CERROR("failed to verify reply: %x\n", major);
- RETURN(-EPERM);
+ return -EPERM;
}
if (req->rq_early && reqhdr->gh_svc == SPTLRPC_SVC_NULL) {
if (cksum != msg->lm_cksum) {
CWARN("early reply checksum mismatch: "
"%08x != %08x\n", cksum, msg->lm_cksum);
- RETURN(-EPROTO);
+ return -EPROTO;
}
}
if (msg->lm_bufcount < 3) {
CERROR("Invalid reply bufcount %u\n",
msg->lm_bufcount);
- RETURN(-EPROTO);
+ return -EPROTO;
}
rc = bulk_sec_desc_unpack(msg, 2, swabbed);
if (rc) {
CERROR("unpack bulk desc: %d\n", rc);
- RETURN(rc);
+ return rc;
}
}
rc = -EPROTO;
}
- RETURN(rc);
+ return rc;
}
int gss_cli_ctx_seal(struct ptlrpc_cli_ctx *ctx,
} else {
OBD_ALLOC_LARGE(req->rq_reqbuf, wiresize);
if (!req->rq_reqbuf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_reqbuf_len = wiresize;
}
/* now set the final wire data length */
req->rq_reqdata_len = lustre_shrink_msg(req->rq_reqbuf, 1, token.len,0);
- RETURN(0);
+ return 0;
err_free:
if (!req->rq_pool) {
req->rq_reqbuf = NULL;
req->rq_reqbuf_len = 0;
}
- RETURN(rc);
+ return rc;
}
int gss_cli_ctx_unseal(struct ptlrpc_cli_ctx *ctx,
ghdr = gss_swab_header(msg, 0, swabbed);
if (ghdr == NULL) {
CERROR("can't decode gss header\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
/* sanity checks */
if (ghdr->gh_version != PTLRPC_GSS_VERSION) {
CERROR("gss version %u mismatch, expect %u\n",
ghdr->gh_version, PTLRPC_GSS_VERSION);
- RETURN(-EPROTO);
+ return -EPROTO;
}
switch (ghdr->gh_proc) {
if (!req->rq_early && !equi(req->rq_pack_bulk == 1, pack_bulk)){
CERROR("%s bulk flag in reply\n",
req->rq_pack_bulk ? "missing" : "unexpected");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (swabbed)
swabbed = __lustre_unpack_msg(msg, msglen);
if (swabbed < 0) {
CERROR("Failed to unpack after decryption\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (msg->lm_bufcount < 1) {
CERROR("Invalid reply buffer: empty\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (pack_bulk) {
if (msg->lm_bufcount < 2) {
CERROR("bufcount %u: missing bulk sec desc\n",
msg->lm_bufcount);
- RETURN(-EPROTO);
+ return -EPROTO;
}
/* bulk checksum is the last segment */
if (bulk_sec_desc_unpack(msg, msg->lm_bufcount - 1,
swabbed))
- RETURN(-EPROTO);
+ return -EPROTO;
}
req->rq_repmsg = lustre_msg_buf(msg, 0, 0);
rc = -EPERM;
}
- RETURN(rc);
+ return rc;
}
/*********************************************
OBD_ALLOC_LARGE(req->rq_reqbuf, bufsize);
if (!req->rq_reqbuf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_reqbuf_len = bufsize;
} else {
if (req->rq_pack_udesc)
sptlrpc_pack_user_desc(req->rq_reqbuf, 2);
- RETURN(0);
+ return 0;
}
static
OBD_ALLOC_LARGE(req->rq_clrbuf, clearsize);
if (!req->rq_clrbuf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
req->rq_clrbuf_len = clearsize;
if (req->rq_pack_udesc)
sptlrpc_pack_user_desc(req->rq_clrbuf, 1);
- RETURN(0);
+ return 0;
}
/*
OBD_ALLOC_LARGE(newbuf, newbuf_size);
if (newbuf == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
memcpy(newbuf, req->rq_reqbuf, req->rq_reqbuf_len);
_sptlrpc_enlarge_msg_inplace(req->rq_reqmsg, segment, newsize);
req->rq_reqlen = newmsg_size;
- RETURN(0);
+ return 0;
}
static
OBD_ALLOC_LARGE(newclrbuf, newclrbuf_size);
if (newclrbuf == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
memcpy(newclrbuf, req->rq_clrbuf, req->rq_clrbuf_len);
_sptlrpc_enlarge_msg_inplace(req->rq_reqmsg, segment, newsize);
req->rq_reqlen = newmsg_size;
- RETURN(0);
+ return 0;
}
int gss_enlarge_reqbuf(struct ptlrpc_sec *sec,
LUSTRE_SP_ANY, flags, PTLRPC_GSS_PROC_DATA,
grctx->src_wirectx.gw_seq, svc, NULL);
if (rc < 0)
- RETURN(rc);
+ return rc;
rs->rs_repdata_len = rc;
req->rq_reply_off = 0;
}
- RETURN(0);
+ return 0;
}
int gss_pack_err_notify(struct ptlrpc_request *req, __u32 major, __u32 minor)
int rc;
//if (OBD_FAIL_CHECK_ORSET(OBD_FAIL_SVCGSS_ERR_NOTIFY, OBD_FAIL_ONCE))
- // RETURN(-EINVAL);
+ // return -EINVAL;
grctx->src_err_notify = 1;
grctx->src_reserve_len = 0;
rc = lustre_pack_reply_v2(req, 1, &replen, NULL, 0);
if (rc) {
CERROR("could not pack reply, err %d\n", rc);
- RETURN(rc);
+ return rc;
}
/* gss hdr */
CDEBUG(D_SEC, "prepare gss error notify(0x%x/0x%x) to %s\n",
major, minor, libcfs_nid2str(req->rq_peer.nid));
- RETURN(0);
+ return 0;
}
static
if (gw->gw_flags & LUSTRE_GSS_PACK_BULK) {
CERROR("unexpected bulk flag\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (gw->gw_proc == PTLRPC_GSS_PROC_INIT && gw->gw_handle.len != 0) {
CERROR("proc %u: invalid handle length %u\n",
gw->gw_proc, gw->gw_handle.len);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (reqbuf->lm_bufcount < 3 || reqbuf->lm_bufcount > 4){
CERROR("Invalid bufcount %d\n", reqbuf->lm_bufcount);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
swabbed = ptlrpc_req_need_swab(req);
if (seclen < 4 + 4) {
CERROR("sec size %d too small\n", seclen);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
/* lustre svc type */
* because touched internal structure of obd_uuid */
if (rawobj_extract(&uuid_obj, &secdata, &seclen)) {
CERROR("failed to extract target uuid\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
uuid_obj.data[uuid_obj.len - 1] = '\0';
CERROR("target '%s' is not available for context init (%s)\n",
uuid->uuid, target == NULL ? "no target" :
(target->obd_stopping ? "stopping" : "not set up"));
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
/* extract reverse handle */
if (rawobj_extract(&rvs_hdl, &secdata, &seclen)) {
CERROR("failed extract reverse handle\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
/* extract token */
if (rawobj_extract(&in_token, &secdata, &seclen)) {
CERROR("can't extract token\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
rc = gss_svc_upcall_handle_init(req, grctx, gw, target, lustre_svc,
&rvs_hdl, &in_token);
if (rc != SECSVC_OK)
- RETURN(rc);
+ return rc;
if (grctx->src_ctx->gsc_usr_mds || grctx->src_ctx->gsc_usr_oss ||
grctx->src_ctx->gsc_usr_root)
if (gw->gw_flags & LUSTRE_GSS_PACK_USER) {
if (reqbuf->lm_bufcount < 4) {
CERROR("missing user descriptor\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (sptlrpc_unpack_user_desc(reqbuf, 2, swabbed)) {
CERROR("Mal-formed user descriptor\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
req->rq_pack_udesc = 1;
req->rq_reqmsg = lustre_msg_buf(reqbuf, 1, 0);
req->rq_reqlen = lustre_msg_buflen(reqbuf, 1);
- RETURN(rc);
+ return rc;
}
/*
if (msg->lm_bufcount < 2) {
CERROR("Too few segments (%u) in request\n", msg->lm_bufcount);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (gw->gw_svc == SPTLRPC_SVC_NULL)
if (gss_check_seq_num(&gctx->gsc_seqdata, gw->gw_seq, 0)) {
CERROR("phase 0: discard replayed req: seq %u\n", gw->gw_seq);
*major = GSS_S_DUPLICATE_TOKEN;
- RETURN(-EACCES);
+ return -EACCES;
}
*major = gss_verify_msg(msg, gctx->gsc_mechctx, gw->gw_svc);
if (*major != GSS_S_COMPLETE) {
CERROR("failed to verify request: %x\n", *major);
- RETURN(-EACCES);
+ return -EACCES;
}
if (gctx->gsc_reverse == 0 &&
gss_check_seq_num(&gctx->gsc_seqdata, gw->gw_seq, 1)) {
CERROR("phase 1+: discard replayed req: seq %u\n", gw->gw_seq);
*major = GSS_S_DUPLICATE_TOKEN;
- RETURN(-EACCES);
+ return -EACCES;
}
verified:
if (gw->gw_flags & LUSTRE_GSS_PACK_USER) {
if (msg->lm_bufcount < (offset + 1)) {
CERROR("no user desc included\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (sptlrpc_unpack_user_desc(msg, offset, swabbed)) {
CERROR("Mal-formed user descriptor\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
req->rq_pack_udesc = 1;
if (gw->gw_flags & LUSTRE_GSS_PACK_BULK) {
if (msg->lm_bufcount < (offset + 1)) {
CERROR("missing bulk sec descriptor\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (bulk_sec_desc_unpack(msg, offset, swabbed))
- RETURN(-EINVAL);
+ return -EINVAL;
req->rq_pack_bulk = 1;
grctx->src_reqbsd = lustre_msg_buf(msg, offset, 0);
req->rq_reqmsg = lustre_msg_buf(msg, 1, 0);
req->rq_reqlen = msg->lm_buflens[1];
- RETURN(0);
+ return 0;
}
static
if (gss_check_seq_num(&gctx->gsc_seqdata, gw->gw_seq, 0)) {
CERROR("phase 0: discard replayed req: seq %u\n", gw->gw_seq);
*major = GSS_S_DUPLICATE_TOKEN;
- RETURN(-EACCES);
+ return -EACCES;
}
*major = gss_unseal_msg(gctx->gsc_mechctx, msg,
&msglen, req->rq_reqdata_len);
if (*major != GSS_S_COMPLETE) {
CERROR("failed to unwrap request: %x\n", *major);
- RETURN(-EACCES);
+ return -EACCES;
}
if (gss_check_seq_num(&gctx->gsc_seqdata, gw->gw_seq, 1)) {
CERROR("phase 1+: discard replayed req: seq %u\n", gw->gw_seq);
*major = GSS_S_DUPLICATE_TOKEN;
- RETURN(-EACCES);
+ return -EACCES;
}
swabbed = __lustre_unpack_msg(msg, msglen);
if (swabbed < 0) {
CERROR("Failed to unpack after decryption\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
req->rq_reqdata_len = msglen;
if (msg->lm_bufcount < 1) {
CERROR("Invalid buffer: is empty\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (gw->gw_flags & LUSTRE_GSS_PACK_USER) {
if (msg->lm_bufcount < offset + 1) {
CERROR("no user descriptor included\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (sptlrpc_unpack_user_desc(msg, offset, swabbed)) {
CERROR("Mal-formed user descriptor\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
req->rq_pack_udesc = 1;
if (gw->gw_flags & LUSTRE_GSS_PACK_BULK) {
if (msg->lm_bufcount < offset + 1) {
CERROR("no bulk checksum included\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (bulk_sec_desc_unpack(msg, offset, swabbed))
- RETURN(-EINVAL);
+ return -EINVAL;
req->rq_pack_bulk = 1;
grctx->src_reqbsd = lustre_msg_buf(msg, offset, 0);
req->rq_reqmsg = lustre_msg_buf(req->rq_reqbuf, 0, 0);
req->rq_reqlen = req->rq_reqbuf->lm_buflens[0];
- RETURN(0);
+ return 0;
}
static
}
if (rc == 0)
- RETURN(SECSVC_OK);
+ return SECSVC_OK;
CERROR("svc %u failed: major 0x%08x: req xid "LPU64" ctx %p idx "
LPX64"(%u->%s)\n", gw->gw_svc, major, req->rq_xid,
* might happen after server reboot, to allow recovery. */
if ((major == GSS_S_NO_CONTEXT || major == GSS_S_BAD_SIG) &&
gss_pack_err_notify(req, major, 0) == 0)
- RETURN(SECSVC_COMPLETE);
+ return SECSVC_COMPLETE;
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
static
grctx->src_ctx = gss_svc_upcall_get_ctx(req, gw);
if (!grctx->src_ctx) {
CDEBUG(D_SEC, "invalid gss context handle for destroy.\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (gw->gw_svc != SPTLRPC_SVC_INTG) {
CERROR("svc %u is not supported in destroy.\n", gw->gw_svc);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (gss_svc_verify_request(req, grctx, gw, &major))
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
CWARN("destroy svc ctx %p idx "LPX64" (%u->%s)\n",
grctx->src_ctx, gss_handle_to_u64(&gw->gw_handle),
if (gw->gw_flags & LUSTRE_GSS_PACK_USER) {
if (req->rq_reqbuf->lm_bufcount < 4) {
CERROR("missing user descriptor, ignore it\n");
- RETURN(SECSVC_OK);
+ return SECSVC_OK;
}
if (sptlrpc_unpack_user_desc(req->rq_reqbuf, 2,
ptlrpc_req_need_swab(req))) {
CERROR("Mal-formed user descriptor, ignore it\n");
- RETURN(SECSVC_OK);
+ return SECSVC_OK;
}
req->rq_pack_udesc = 1;
req->rq_user_desc = lustre_msg_buf(req->rq_reqbuf, 2, 0);
}
- RETURN(SECSVC_OK);
+ return SECSVC_OK;
}
int gss_svc_accept(struct ptlrpc_sec_policy *policy, struct ptlrpc_request *req)
if (req->rq_reqbuf->lm_bufcount < 2) {
CERROR("buf count only %d\n", req->rq_reqbuf->lm_bufcount);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
swabbed = ptlrpc_req_need_swab(req);
ghdr = gss_swab_header(req->rq_reqbuf, 0, swabbed);
if (ghdr == NULL) {
CERROR("can't decode gss header\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
/* sanity checks */
if (ghdr->gh_version != PTLRPC_GSS_VERSION) {
CERROR("gss version %u, expect %u\n", ghdr->gh_version,
PTLRPC_GSS_VERSION);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
req->rq_sp_from = ghdr->gh_sp;
/* alloc grctx data */
OBD_ALLOC_PTR(grctx);
if (!grctx)
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
grctx->src_base.sc_policy = sptlrpc_policy_get(policy);
atomic_set(&grctx->src_base.sc_refcount, 1);
break;
}
- RETURN(rc);
+ return rc;
}
void gss_svc_invalidate_ctx(struct ptlrpc_svc_ctx *svc_ctx)
if (req->rq_pack_bulk && !req->rq_bulk_read && !req->rq_bulk_write) {
CERROR("client request bulk sec on non-bulk rpc\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
svc = SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc);
} else {
OBD_ALLOC_LARGE(rs, rs_size);
if (rs == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rs->rs_size = rs_size;
}
LASSERT(rs->rs_msg);
req->rq_reply_state = rs;
- RETURN(0);
+ return 0;
}
static int gss_svc_seal(struct ptlrpc_request *req,
token_buflen = gss_mech_payload(gctx->gsc_mechctx, msglen, 1);
OBD_ALLOC_LARGE(token_buf, token_buflen);
if (token_buf == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
hdrobj.len = PTLRPC_GSS_HEADER_SIZE;
hdrobj.data = (__u8 *) ghdr;
rc = 0;
out_free:
OBD_FREE_LARGE(token_buf, token_buflen);
- RETURN(rc);
+ return rc;
}
int gss_svc_authorize(struct ptlrpc_request *req)
LASSERT(rs->rs_repdata_len != 0);
req->rq_reply_off = gss_at_reply_off_integ;
- RETURN(0);
+ return 0;
}
/* early reply could happen in many cases */
gw->gw_proc != PTLRPC_GSS_PROC_DATA &&
gw->gw_proc != PTLRPC_GSS_PROC_DESTROY) {
CERROR("proc %d not support\n", gw->gw_proc);
- RETURN(-EINVAL);
+ return -EINVAL;
}
LASSERT(grctx->src_ctx);
rc = 0;
out:
- RETURN(rc);
+ return rc;
}
void gss_svc_free_rs(struct ptlrpc_reply_state *rs)
CERROR("%s: no connections available\n",
imp->imp_obd->obd_name);
spin_unlock(&imp->imp_lock);
- RETURN(-EINVAL);
+ return -EINVAL;
}
list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
spin_unlock(&imp->imp_lock);
- RETURN(0);
+ return 0;
}
/*
if (imp->imp_state == LUSTRE_IMP_CLOSED) {
spin_unlock(&imp->imp_lock);
CERROR("can't connect to a closed import\n");
- RETURN(-EINVAL);
+ return -EINVAL;
} else if (imp->imp_state == LUSTRE_IMP_FULL) {
spin_unlock(&imp->imp_lock);
CERROR("already connected\n");
- RETURN(0);
+ return 0;
} else if (imp->imp_state == LUSTRE_IMP_CONNECTING) {
spin_unlock(&imp->imp_lock);
CERROR("already connecting\n");
- RETURN(-EALREADY);
+ return -EALREADY;
}
IMPORT_SET_STATE_NOLOCK(imp, LUSTRE_IMP_CONNECTING);
IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_connect_import);
if (imp->imp_state == LUSTRE_IMP_CLOSED) {
imp->imp_connect_tried = 1;
spin_unlock(&imp->imp_lock);
- RETURN(0);
+ return 0;
}
if (rc) {
imp->imp_connection->c_remote_uuid.uuid);
ptlrpc_connect_import(imp);
imp->imp_connect_tried = 1;
- RETURN(0);
+ return 0;
}
} else {
/* reply message might not be ready */
if (request->rq_repmsg == NULL)
- RETURN(-EPROTO);
+ return -EPROTO;
ocd = req_capsule_server_get(&request->rq_pill,
&RMF_CONNECT_DATA);
ptlrpc_deactivate_import(imp);
IMPORT_SET_STATE(imp, LUSTRE_IMP_CLOSED);
}
- RETURN(-EPROTO);
+ return -EPROTO;
}
ptlrpc_maybe_ping_import_soon(imp);
}
wake_up_all(&imp->imp_recovery_waitq);
- RETURN(rc);
+ return rc;
}
/**
ptlrpc_connect_import(req->rq_import);
}
- RETURN(0);
+ return 0;
}
/**
struct ptlrpc_request *req;
if (unlikely(OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_FINISH_REPLAY)))
- RETURN(0);
+ return 0;
LASSERT(atomic_read(&imp->imp_replay_inflight) == 0);
atomic_inc(&imp->imp_replay_inflight);
OBD_PING);
if (req == NULL) {
atomic_dec(&imp->imp_replay_inflight);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
ptlrpc_request_set_replen(req);
req->rq_interpret_reply = completed_replay_interpret;
ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
- RETURN(0);
+ return 0;
}
/**
ptlrpc_import_recovery_state_machine(imp);
class_import_put(imp);
- RETURN(0);
+ return 0;
}
/**
} else {
rc = 0;
}
- RETURN(rc);
+ return rc;
}
}
}
out:
- RETURN(rc);
+ return rc;
}
int ptlrpc_disconnect_import(struct obd_import *imp, int noclose)
default:
CERROR("don't know how to disconnect from %s (connect_op %d)\n",
obd2cli_tgt(imp->imp_obd), imp->imp_connect_op);
- RETURN(-EINVAL);
+ return -EINVAL;
}
if (ptlrpc_import_in_recovery(imp)) {
memset(&imp->imp_remote_handle, 0, sizeof(imp->imp_remote_handle));
spin_unlock(&imp->imp_lock);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_disconnect_import);
ptlrpc_req_finished(req);
err_exit:
LLOG_CLIENT_EXIT(loghandle->lgh_ctxt, imp);
- RETURN(rc);
+ return rc;
}
ctxt->loc_imp = class_import_get(new_imp);
}
mutex_unlock(&ctxt->loc_mutex);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(llog_initiator_connect);
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
if (body == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
if (ostid_id(&body->lgd_logid.lgl_oi) > 0)
logid = &body->lgd_logid;
if (req_capsule_field_present(&req->rq_pill, &RMF_NAME, RCL_CLIENT)) {
name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
if (name == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
CDEBUG(D_INFO, "%s: opening log %s\n", obd->obd_name, name);
}
if (ctxt == NULL) {
CDEBUG(D_WARNING, "%s: no ctxt. group=%p idx=%d name=%s\n",
obd->obd_name, &obd->obd_olg, body->lgd_ctxt_idx, name);
- RETURN(-ENODEV);
+ return -ENODEV;
}
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
if (body == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
if (ostid_id(&body->lgd_logid.lgl_oi) > 0)
logid = &body->lgd_logid;
ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx);
if (ctxt == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
rc = llog_erase(req->rq_svc_thread->t_env, ctxt, logid, NULL);
pop_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
llog_ctxt_put(ctxt);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(llog_origin_handle_destroy);
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
if (body == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx);
if (ctxt == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
if (body == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx);
if (ctxt == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
body = req_capsule_client_get(&req->rq_pill, &RMF_LLOGD_BODY);
if (body == NULL)
- RETURN(-EFAULT);
+ return -EFAULT;
ctxt = llog_get_context(req->rq_export->exp_obd, body->lgd_ctxt_idx);
if (ctxt == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
int llog_origin_handle_close(struct ptlrpc_request *req)
{
/* Nothing to do */
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(llog_origin_handle_close);
RCL_CLIENT) / sizeof(*logcookies);
if (logcookies == NULL || num_cookies == 0) {
DEBUG_REQ(D_HA, req, "No llog cookies sent");
- RETURN(-EFAULT);
+ return -EFAULT;
}
ctxt = llog_get_context(req->rq_export->exp_obd,
logcookies->lgc_subsys);
if (ctxt == NULL)
- RETURN(-ENODEV);
+ return -ENODEV;
disk_obd = ctxt->loc_exp->exp_obd;
push_ctxt(&saved, &disk_obd->obd_lvfs_ctxt, NULL);
mutex_unlock(&nrs_core.nrs_mutex);
- RETURN(rc);
+ return rc;
}
/**
if (cmd_copy)
OBD_FREE(cmd_copy, LPROCFS_NRS_WR_MAX_CMD);
- RETURN(rc < 0 ? rc : count);
+ return rc < 0 ? rc : count;
}
LPROC_SEQ_FOPS(ptlrpc_lprocfs_nrs);
req = ptlrpc_prep_ping(obd->u.cli.cl_import);
LPROCFS_CLIMP_EXIT(obd);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_send_state = LUSTRE_IMP_FULL;
ptlrpc_req_finished(req);
if (rc >= 0)
- RETURN(count);
- RETURN(rc);
+ return count;
+ return rc;
}
EXPORT_SYMBOL(lprocfs_wr_ping);
if (unlikely(rc != 0)) {
CERROR ("LNetMDBind failed: %d\n", rc);
LASSERT (rc == -ENOMEM);
- RETURN (-ENOMEM);
+ return -ENOMEM;
}
CDEBUG(D_NET, "Sending %d bytes to portal %d, xid "LPD64", offset %u\n",
LASSERTF(rc2 == 0, "rc2 = %d\n", rc2);
}
- RETURN (0);
+ return 0;
}
static void mdunlink_iterate_helper(lnet_handle_md_t *bd_mds, int count)
lnet_md_t md;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_BULK_GET_NET))
- RETURN(0);
+ return 0;
/* NB no locking required until desc is on the network */
LASSERT(desc->bd_nob > 0);
LASSERT(desc->bd_md_count >= 0);
mdunlink_iterate_helper(desc->bd_mds, desc->bd_md_max_brw);
req->rq_status = -ENOMEM;
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
/* Set rq_xid to matchbits of the final bulk so that server can
desc->bd_iov_count, desc->bd_nob,
desc->bd_last_xid, req->rq_xid, desc->bd_portal);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_register_bulk);
req->rq_bulk_deadline = cfs_time_current_sec() + LONG_UNLINK;
if (ptlrpc_client_bulk_active(req) == 0) /* completed or */
- RETURN(1); /* never registered */
+ return 1; /* never registered */
LASSERT(desc->bd_req == req); /* bd_req NULL until registered */
mdunlink_iterate_helper(desc->bd_mds, desc->bd_md_max_brw);
if (ptlrpc_client_bulk_active(req) == 0) /* completed or */
- RETURN(1); /* never registered */
+ return 1; /* never registered */
/* Move to "Unregistering" phase as bulk was not unlinked yet. */
ptlrpc_rqphase_move(req, RQ_PHASE_UNREGISTERING);
/* Do not wait for unlink to finish. */
if (async)
- RETURN(0);
+ return 0;
if (req->rq_set != NULL)
wq = &req->rq_set->set_waitq;
rc = l_wait_event(*wq, !ptlrpc_client_bulk_active(req), &lwi);
if (rc == 0) {
ptlrpc_rqphase_move(req, req->rq_next_phase);
- RETURN(1);
+ return 1;
}
LASSERT(rc == -ETIMEDOUT);
DEBUG_REQ(D_WARNING, req, "Unexpectedly long timeout: desc %p",
desc);
}
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_unregister_bulk);
int rc;
if (req->rq_no_reply)
- RETURN(0);
+ return 0;
if (!req->rq_repmsg) {
rc = lustre_pack_reply(req, 1, NULL, NULL);
if (rc)
- RETURN(rc);
+ return rc;
}
if (req->rq_status != -ENOSPC && req->rq_status != -EACCES &&
req->rq_type = PTL_RPC_MSG_ERR;
rc = ptlrpc_send_reply(req, may_be_difficult);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_send_error);
struct obd_device *obd = request->rq_import->imp_obd;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_DROP_RPC))
- RETURN(0);
+ return 0;
LASSERT(request->rq_type == PTL_RPC_MSG_REQUEST);
LASSERT(request->rq_wait_ctx == 0);
/* this prevents us from waiting in ptlrpc_queue_wait */
request->rq_err = 1;
request->rq_status = -ENODEV;
- RETURN(-ENODEV);
+ return -ENODEV;
}
connection = request->rq_import->imp_connection;
* policy->pol_private will be NULL in such a case.
*/
if (policy->pol_state == NRS_POL_STATE_STOPPED)
- RETURN(-ENODEV);
+ return -ENODEV;
- RETURN(policy->pol_desc->pd_ops->op_policy_ctl != NULL ?
+ return policy->pol_desc->pd_ops->op_policy_ctl != NULL ?
policy->pol_desc->pd_ops->op_policy_ctl(policy, opc, arg) :
- -ENOSYS);
+ -ENOSYS;
}
static void nrs_policy_stop0(struct ptlrpc_nrs_policy *policy)
struct ptlrpc_nrs *nrs = policy->pol_nrs;
if (nrs->nrs_policy_fallback == policy && !nrs->nrs_stopping)
- RETURN(-EPERM);
+ return -EPERM;
if (policy->pol_state == NRS_POL_STATE_STARTING)
- RETURN(-EAGAIN);
+ return -EAGAIN;
/* In progress or already stopped */
if (policy->pol_state != NRS_POL_STATE_STARTED)
- RETURN(0);
+ return 0;
policy->pol_state = NRS_POL_STATE_STOPPING;
if (policy->pol_ref == 1)
nrs_policy_stop0(policy);
- RETURN(0);
+ return 0;
}
/**
* benefit.
*/
if (nrs->nrs_policy_starting)
- RETURN(-EAGAIN);
+ return -EAGAIN;
LASSERT(policy->pol_state != NRS_POL_STATE_STARTING);
if (policy->pol_state == NRS_POL_STATE_STOPPING)
- RETURN(-EAGAIN);
+ return -EAGAIN;
if (policy->pol_flags & PTLRPC_NRS_FL_FALLBACK) {
/**
*/
if (policy == nrs->nrs_policy_fallback) {
nrs_policy_stop_primary(nrs);
- RETURN(0);
+ return 0;
}
/**
* Shouldn't start primary policy if w/o fallback policy.
*/
if (nrs->nrs_policy_fallback == NULL)
- RETURN(-EPERM);
+ return -EPERM;
if (policy->pol_state == NRS_POL_STATE_STARTED)
- RETURN(0);
+ return 0;
}
/**
atomic_dec(&policy->pol_desc->pd_refs);
CERROR("NRS: cannot get module for policy %s; is it alive?\n",
policy->pol_desc->pd_name);
- RETURN(-ENODEV);
+ return -ENODEV;
}
/**
out:
nrs->nrs_policy_starting = 0;
- RETURN(rc);
+ return rc;
}
/**
spin_unlock(&nrs->nrs_lock);
- RETURN(rc);
+ return rc;
}
/**
spin_unlock(&nrs->nrs_lock);
CERROR("Can't find NRS policy %s\n", name);
- RETURN(-ENOENT);
+ return -ENOENT;
}
if (policy->pol_ref > 1) {
nrs_policy_put_locked(policy);
spin_unlock(&nrs->nrs_lock);
- RETURN(-EBUSY);
+ return -EBUSY;
}
LASSERT(policy->pol_req_queued == 0);
LASSERT(policy->pol_private == NULL);
OBD_FREE_PTR(policy);
- RETURN(0);
+ return 0;
}
/**
OBD_CPT_ALLOC_GFP(policy, svcpt->scp_service->srv_cptable,
svcpt->scp_cpt, sizeof(*policy), __GFP_IO);
if (policy == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
policy->pol_nrs = nrs;
policy->pol_desc = desc;
rc = nrs_policy_init(policy);
if (rc != 0) {
OBD_FREE_PTR(policy);
- RETURN(rc);
+ return rc;
}
spin_lock(&nrs->nrs_lock);
nrs_policy_fini(policy);
OBD_FREE_PTR(policy);
- RETURN(-EEXIST);
+ return -EEXIST;
}
list_add_tail(&policy->pol_list, &nrs->nrs_policy_list);
if (rc != 0)
(void) nrs_policy_unregister(nrs, policy->pol_desc->pd_name);
- RETURN(rc);
+ return rc;
}
/**
}
}
- RETURN(rc);
+ return rc;
}
/**
rc = nrs_register_policies_locked(nrs);
- RETURN(rc);
+ return rc;
}
/**
rc = nrs_svcpt_setup_locked0(nrs, svcpt);
out:
- RETURN(rc);
+ return rc;
}
/**
list_for_each_entry(tmp, &nrs_core.nrs_policies, pd_list) {
if (strncmp(tmp->pd_name, name, NRS_POL_NAME_MAX) == 0)
- RETURN(tmp);
+ return tmp;
}
- RETURN(NULL);
+ return NULL;
}
/**
"partition %d of service %s: %d\n",
desc->pd_name, svcpt->scp_cpt,
svcpt->scp_service->srv_name, rc);
- RETURN(rc);
+ return rc;
}
if (!hp && nrs_svc_has_hp(svc)) {
desc->pd_ops->op_lprocfs_fini(svc);
}
- RETURN(rc);
+ return rc;
}
/**
"policy flags; external policies cannot act as fallback "
"policies, or be started immediately upon registration "
"without interaction with lprocfs\n", conf->nc_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
mutex_lock(&nrs_core.nrs_mutex);
fail:
mutex_unlock(&nrs_core.nrs_mutex);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_nrs_policy_register);
if (conf->nc_flags & PTLRPC_NRS_FL_FALLBACK) {
CERROR("Unable to unregister a fallback policy, unless the "
"PTLRPC service is stopping.\n");
- RETURN(-EPERM);
+ return -EPERM;
}
conf->nc_name[NRS_POL_NAME_MAX - 1] = '\0';
not_exist:
mutex_unlock(&nrs_core.nrs_mutex);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_nrs_policy_unregister);
mutex_unlock(&nrs_core.nrs_mutex);
- RETURN(rc);
+ return rc;
}
/**
}
}
out:
- RETURN(rc);
+ return rc;
}
GOTO(fail, rc);
- RETURN(rc);
+ return rc;
fail:
/**
* Since no PTLRPC services have been started at this point, all we need
*/
ptlrpc_nrs_fini();
- RETURN(rc);
+ return rc;
}
/**
msg_len = lustre_msg_size_v2(count, lens);
rc = sptlrpc_svc_alloc_rs(req, msg_len);
if (rc)
- RETURN(rc);
+ return rc;
rs = req->rq_reply_state;
atomic_set(&rs->rs_refcount, 1); /* 1 ref for rq_reply_state */
PTLRPC_RS_DEBUG_LRU_ADD(rs);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(lustre_pack_reply_v2);
/* can't even look inside the message */
CERROR("message length %d too small for magic/version check\n",
len);
- RETURN(-EINVAL);
+ return -EINVAL;
}
rc = lustre_unpack_msg_v2(m, len);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(__lustre_unpack_msg);
req = ptlrpc_request_alloc(imp, &RQF_OBD_SET_INFO);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req_capsule_set_size(&req->rq_pill, &RMF_SETINFO_KEY,
RCL_CLIENT, keylen);
rc = ptlrpc_request_pack(req, version, opcode);
if (rc) {
ptlrpc_request_free(req);
- RETURN(rc);
+ return rc;
}
tmp = req_capsule_client_get(&req->rq_pill, &RMF_SETINFO_KEY);
ptlrpc_req_finished(req);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(do_set_info_async);
req = ptlrpc_prep_ping(obd->u.cli.cl_import);
if (req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_send_state = LUSTRE_IMP_FULL;
ptlrpc_req_finished(req);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_obd_ping);
CERROR("OOM trying to ping %s->%s\n",
imp->imp_obd->obd_uuid.uuid,
obd2cli_tgt(imp->imp_obd));
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
DEBUG_REQ(D_INFO, req, "pinging %s->%s",
imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd));
ptlrpcd_add_req(req, PDL_POLICY_ROUND, -1);
- RETURN(0);
+ return 0;
}
void ptlrpc_update_next_ping(struct obd_import *imp, int soon)
if (!thread_is_init(&pinger_thread) &&
!thread_is_stopped(&pinger_thread))
- RETURN(-EALREADY);
+ return -EALREADY;
init_waitqueue_head(&pinger_thread.t_ctl_waitq);
init_waitqueue_head(&suspend_timeouts_waitq);
&pinger_thread, pinger_thread.t_name));
if (IS_ERR_VALUE(rc)) {
CERROR("cannot start thread: %d\n", rc);
- RETURN(rc);
+ return rc;
}
l_wait_event(pinger_thread.t_ctl_waitq,
thread_is_running(&pinger_thread), &lwi);
"(Search for the \"suppress_pings\" kernel module "
"parameter.)\n");
- RETURN(0);
+ return 0;
}
int ptlrpc_pinger_remove_timeouts(void);
if (!thread_is_init(&pinger_thread) &&
!thread_is_stopped(&pinger_thread))
- RETURN(-EALREADY);
+ return -EALREADY;
ptlrpc_pinger_remove_timeouts();
thread_set_flags(&pinger_thread, SVC_STOPPING);
l_wait_event(pinger_thread.t_ctl_waitq,
thread_is_stopped(&pinger_thread), &lwi);
- RETURN(rc);
+ return rc;
}
void ptlrpc_pinger_sending_on_import(struct obd_import *imp)
int ptlrpc_pinger_add_import(struct obd_import *imp)
{
if (!list_empty(&imp->imp_pinger_chain))
- RETURN(-EALREADY);
+ return -EALREADY;
mutex_lock(&pinger_mutex);
CDEBUG(D_HA, "adding pingable import %s->%s\n",
ptlrpc_pinger_wake_up();
mutex_unlock(&pinger_mutex);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_pinger_add_import);
int ptlrpc_pinger_del_import(struct obd_import *imp)
{
if (list_empty(&imp->imp_pinger_chain))
- RETURN(-ENOENT);
+ return -ENOENT;
mutex_lock(&pinger_mutex);
list_del_init(&imp->imp_pinger_chain);
imp->imp_obd->obd_no_recov = 1;
class_import_put(imp);
mutex_unlock(&pinger_mutex);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_pinger_del_import);
}
CDEBUG(D_HA, "Exiting Ping Evictor\n");
- RETURN(0);
+ return 0;
}
void ping_evictor_start(void)
rc = req_layout_init();
if (rc)
- RETURN(rc);
+ return rc;
rc = ptlrpc_hr_init();
if (rc)
- RETURN(rc);
+ return rc;
cleanup_phase = 1;
rc = tgt_mod_init();
if (rc)
GOTO(cleanup, rc);
- RETURN(0);
+ return 0;
cleanup:
switch(cleanup_phase) {
* new modules are loaded, i.e., early during boot up.
*/
CERROR("Failure to refill session: %d\n", rc2);
- RETURN(rc);
+ return rc;
}
if (atomic_read(&set->set_remaining))
}
}
- RETURN(rc);
+ return rc;
}
/**
complete(&pc->pc_starting);
if (rc != 0)
- RETURN(rc);
+ return rc;
/*
* This mainloop strongly resembles ptlrpc_set_wait() except that our
}
}
- RETURN(rc);
+ return rc;
}
if (test_and_set_bit(LIOD_START, &pc->pc_flags)) {
CWARN("Starting second thread (%s) for same pc %p\n",
name, pc);
- RETURN(0);
+ return 0;
}
pc->pc_index = index;
clear_bit(LIOD_BIND, &pc->pc_flags);
clear_bit(LIOD_START, &pc->pc_flags);
}
- RETURN(rc);
+ return rc;
}
void ptlrpcd_stop(struct ptlrpcd_ctl *pc, int force)
ptlrpcds = NULL;
}
- RETURN(0);
+ return 0;
}
int ptlrpcd_addref(void)
if (++ptlrpcd_users == 1)
rc = ptlrpcd_init();
mutex_unlock(&ptlrpcd_mutex);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpcd_addref);
if (rc) {
CERROR("recovery replay error %d for req "
LPU64"\n", rc, req->rq_xid);
- RETURN(rc);
+ return rc;
}
*inflight = 1;
}
- RETURN(rc);
+ return rc;
}
/**
spin_lock(&imp->imp_lock);
if (imp->imp_state != LUSTRE_IMP_RECOVER) {
spin_unlock(&imp->imp_lock);
- RETURN(-1);
+ return -1;
}
list_for_each_entry_safe(req, next, &imp->imp_sending_list,
}
spin_unlock(&imp->imp_lock);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_resend);
rc = ptlrpc_recover_import(imp, NULL, 0);
}
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_set_import_active);
rc = import_sec_validate_get(imp, &sec);
if (rc)
- RETURN(rc);
+ return rc;
req->rq_cli_ctx = get_my_ctx(sec);
if (!req->rq_cli_ctx) {
CERROR("req %p: fail to get context\n", req);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
- RETURN(0);
+ return 0;
}
/**
/* restore old ctx */
req->rq_cli_ctx = oldctx;
- RETURN(rc);
+ return rc;
}
newctx = req->rq_cli_ctx;
/* restore old ctx */
sptlrpc_req_put_ctx(req, 0);
req->rq_cli_ctx = oldctx;
- RETURN(rc);
+ return rc;
}
LASSERT(req->rq_cli_ctx == newctx);
}
sptlrpc_cli_ctx_put(oldctx, 1);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(sptlrpc_req_replace_dead_ctx);
LASSERT(ctx);
if (req->rq_ctx_init || req->rq_ctx_fini)
- RETURN(0);
+ return 0;
/*
* during the process a request's context might change type even
again:
rc = import_sec_validate_get(req->rq_import, &sec);
if (rc)
- RETURN(rc);
+ return rc;
if (sec->ps_flvr.sf_rpc != req->rq_flvr.sf_rpc) {
CDEBUG(D_SEC, "req %p: flavor has changed %x -> %x\n",
sptlrpc_sec_put(sec);
if (cli_ctx_is_eternal(ctx))
- RETURN(0);
+ return 0;
if (unlikely(test_bit(PTLRPC_CTX_NEW_BIT, &ctx->cc_flags))) {
LASSERT(ctx->cc_ops->refresh);
LASSERT(ctx->cc_ops->validate);
if (ctx->cc_ops->validate(ctx) == 0) {
req_off_ctx_list(req, ctx);
- RETURN(0);
+ return 0;
}
if (unlikely(test_bit(PTLRPC_CTX_ERROR_BIT, &ctx->cc_flags))) {
req->rq_err = 1;
spin_unlock(&req->rq_lock);
req_off_ctx_list(req, ctx);
- RETURN(-EPERM);
+ return -EPERM;
}
/*
unlikely(req->rq_reqmsg) &&
lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) {
req_off_ctx_list(req, ctx);
- RETURN(0);
+ return 0;
}
if (unlikely(test_bit(PTLRPC_CTX_DEAD_BIT, &ctx->cc_flags))) {
spin_lock(&req->rq_lock);
req->rq_err = 1;
spin_unlock(&req->rq_lock);
- RETURN(-EINTR);
+ return -EINTR;
}
rc = sptlrpc_req_replace_dead_ctx(req);
spin_lock(&req->rq_lock);
req->rq_err = 1;
spin_unlock(&req->rq_lock);
- RETURN(rc);
+ return rc;
}
ctx = req->rq_cli_ctx;
spin_unlock(&ctx->cc_lock);
if (timeout < 0)
- RETURN(-EWOULDBLOCK);
+ return -EWOULDBLOCK;
/* Clear any flags that may be present from previous sends */
LASSERT(req->rq_receiving_reply == 0);
req_off_ctx_list(req, ctx);
LASSERT(rc != 0);
- RETURN(rc);
+ return rc;
}
goto again;
sptlrpc_sec_put(sec);
if (!ctx)
- RETURN(-ENOMEM);
+ return -ENOMEM;
if (cli_ctx_is_eternal(ctx) ||
ctx->cc_ops->validate(ctx) == 0) {
sptlrpc_cli_ctx_put(ctx, 1);
- RETURN(0);
+ return 0;
}
if (cli_ctx_is_error(ctx)) {
sptlrpc_cli_ctx_put(ctx, 1);
- RETURN(-EACCES);
+ return -EACCES;
}
OBD_ALLOC_PTR(req);
if (!req)
- RETURN(-ENOMEM);
+ return -ENOMEM;
spin_lock_init(&req->rq_lock);
atomic_set(&req->rq_refcount, 10000);
sptlrpc_cli_ctx_put(req->rq_cli_ctx, 1);
OBD_FREE_PTR(req);
- RETURN(rc);
+ return rc;
}
/**
if (req->rq_bulk) {
rc = sptlrpc_cli_wrap_bulk(req, req->rq_bulk);
if (rc)
- RETURN(rc);
+ return rc;
}
switch (SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc)) {
LASSERT(req->rq_reqdata_len <= req->rq_reqbuf_len);
}
- RETURN(rc);
+ return rc;
}
static int do_cli_unwrap_reply(struct ptlrpc_request *req)
break;
default:
CERROR("failed unpack reply: x"LPU64"\n", req->rq_xid);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (req->rq_repdata_len < sizeof(struct lustre_msg)) {
CERROR("replied data length %d too small\n",
req->rq_repdata_len);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (SPTLRPC_FLVR_POLICY(req->rq_repdata->lm_secflvr) !=
CERROR("reply policy %u doesn't match request policy %u\n",
SPTLRPC_FLVR_POLICY(req->rq_repdata->lm_secflvr),
SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc));
- RETURN(-EPROTO);
+ return -EPROTO;
}
switch (SPTLRPC_FLVR_SVC(req->rq_flvr.sf_rpc)) {
if (SPTLRPC_FLVR_POLICY(req->rq_flvr.sf_rpc) != SPTLRPC_POLICY_NULL &&
!req->rq_ctx_init)
req->rq_rep_swab_mask = 0;
- RETURN(rc);
+ return rc;
}
/**
OBD_ALLOC_PTR(early_req);
if (early_req == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
early_size = req->rq_nob_received;
early_bufsz = size_roundup_power2(early_size);
LASSERT(early_req->rq_repmsg);
*req_ret = early_req;
- RETURN(0);
+ return 0;
err_ctx:
sptlrpc_cli_ctx_put(early_req->rq_cli_ctx, 1);
OBD_FREE_LARGE(early_buf, early_bufsz);
err_req:
OBD_FREE_PTR(early_req);
- RETURN(rc);
+ return rc;
}
/**
policy = sptlrpc_wireflavor2policy(sf->sf_rpc);
if (!policy) {
CERROR("invalid flavor 0x%x\n", sf->sf_rpc);
- RETURN(NULL);
+ return NULL;
}
}
sptlrpc_policy_put(policy);
}
- RETURN(sec);
+ return sec;
}
struct ptlrpc_sec *sptlrpc_import_sec_ref(struct obd_import *imp)
might_sleep();
if (imp == NULL)
- RETURN(0);
+ return 0;
conn = imp->imp_connection;
mutex_unlock(&imp->imp_sec_mutex);
out:
sptlrpc_sec_put(sec);
- RETURN(rc);
+ return rc;
}
void sptlrpc_import_sec_put(struct obd_import *imp)
LASSERT(ctx->cc_sec->ps_policy);
if (req->rq_repbuf)
- RETURN(0);
+ return 0;
policy = ctx->cc_sec->ps_policy;
- RETURN(policy->sp_cops->alloc_repbuf(ctx->cc_sec, req, msgsize));
+ return policy->sp_cops->alloc_repbuf(ctx->cc_sec, req, msgsize);
}
/**
default:
CERROR("error unpacking request from %s x"LPU64"\n",
libcfs_id2str(req->rq_peer), req->rq_xid);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
req->rq_flvr.sf_rpc = WIRE_FLVR(msg->lm_secflvr);
policy = sptlrpc_wireflavor2policy(req->rq_flvr.sf_rpc);
if (!policy) {
CERROR("unsupported rpc flavor %x\n", req->rq_flvr.sf_rpc);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
LASSERT(policy->sp_sops->accept);
/* sanity check for the request source */
rc = sptlrpc_svc_check_from(req, rc);
- RETURN(rc);
+ return rc;
}
/**
/* failed alloc, try emergency pool */
rs = lustre_get_emerg_rs(req->rq_rqbd->rqbd_svcpt);
if (rs == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_reply_state = rs;
rc = policy->sp_sops->alloc_rs(req, msglen);
LASSERT(rc != 0 ||
(req->rq_reply_state && req->rq_reply_state->rs_msg));
- RETURN(rc);
+ return rc;
}
/**
rc = policy->sp_sops->authorize(req);
LASSERT(rc || req->rq_reply_state->rs_repdata_len);
- RETURN(rc);
+ return rc;
}
/**
flavor = strchr(param, '=');
if (flavor == NULL) {
CERROR("invalid param, no '='\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
*flavor++ = '\0';
rule->sr_netid = libcfs_str2net(param);
if (rule->sr_netid == LNET_NIDNET(LNET_NID_ANY)) {
CERROR("invalid network name: %s\n", param);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
rule->sr_to = LUSTRE_SP_MDT;
} else {
CERROR("invalid rule dir segment: %s\n", dir);
- RETURN(-EINVAL);
+ return -EINVAL;
}
}
/* 2.1 flavor */
rc = sptlrpc_parse_flavor(flavor, &rule->sr_flvr);
if (rc)
- RETURN(-EINVAL);
+ return -EINVAL;
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(sptlrpc_parse_rule);
target = lustre_cfg_string(lcfg, 1);
if (target == NULL) {
CERROR("missing target name\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
param = lustre_cfg_string(lcfg, 2);
if (param == NULL) {
CERROR("missing parameter\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_SEC, "processing rule: %s.%s\n", target, param);
/* parse rule to make sure the format is correct */
if (strncmp(param, PARAM_SRPC_FLVR, sizeof(PARAM_SRPC_FLVR) - 1) != 0) {
CERROR("Invalid sptlrpc parameter: %s\n", param);
- RETURN(-EINVAL);
+ return -EINVAL;
}
param += sizeof(PARAM_SRPC_FLVR) - 1;
rc = sptlrpc_parse_rule(param, &rule);
if (rc)
- RETURN(-EINVAL);
+ return -EINVAL;
if (conf == NULL) {
target2fsname(target, fsname, sizeof(fsname));
if (rc == 0)
conf->sc_modified++;
- RETURN(rc);
+ return rc;
}
int sptlrpc_process_config(struct lustre_cfg *lcfg)
ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt == NULL)
- RETURN(-EINVAL);
+ return -EINVAL;
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
llog_ctxt_put(ctxt);
CDEBUG(D_SEC, "target %s: write local sptlrpc conf: rc = %d\n",
obd->obd_name, rc);
- RETURN(rc);
+ return rc;
}
static int local_read_handler(const struct lu_env *env,
if (rec->lrh_type != OBD_CFG_REC) {
CERROR("unhandled lrh_type: %#x\n", rec->lrh_type);
- RETURN(-EINVAL);
+ return -EINVAL;
}
cfg_len = rec->lrh_len - sizeof(struct llog_rec_hdr) -
rc = lustre_cfg_sanity_check(lcfg, cfg_len);
if (rc) {
CERROR("Insane cfg\n");
- RETURN(rc);
+ return rc;
}
if (lcfg->lcfg_command != LCFG_SPTLRPC_CONF) {
CERROR("invalid command (%x)\n", lcfg->lcfg_command);
- RETURN(-EINVAL);
+ return -EINVAL;
}
- RETURN(__sptlrpc_process_config(lcfg, conf));
+ return __sptlrpc_process_config(lcfg, conf);
}
static
ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
if (ctxt == NULL) {
CERROR("missing llog context\n");
- RETURN(-EINVAL);
+ return -EINVAL;
}
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
llog_ctxt_put(ctxt);
CDEBUG(D_SEC, "target %s: read local sptlrpc conf: rc = %d\n",
obd->obd_name, rc);
- RETURN(rc);
+ return rc;
}
sp_dst = LUSTRE_SP_OST;
} else {
CERROR("unexpected obd type %s\n", obd->obd_type->typ_name);
- RETURN(-EINVAL);
+ return -EINVAL;
}
CDEBUG(D_SEC, "get rules for target %s\n", obd->obd_uuid.uuid);
LUSTRE_SP_ANY, sp_dst, rset);
out:
mutex_unlock(&sptlrpc_conf_lock);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(sptlrpc_conf_target_get_rules);
req->rq_reqdata_len = lustre_msg_size_v2(msg->lm_bufcount,
msg->lm_buflens);
- RETURN(0);
+ return 0;
}
static
if (msg->lm_bufcount != PLAIN_PACK_SEGMENTS) {
CERROR("unexpected reply buf count %u\n", msg->lm_bufcount);
- RETURN(-EPROTO);
+ return -EPROTO;
}
swabbed = ptlrpc_rep_need_swab(req);
phdr = lustre_msg_buf(msg, PLAIN_PACK_HDR_OFF, sizeof(*phdr));
if (phdr == NULL) {
CERROR("missing plain header\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (phdr->ph_ver != 0) {
CERROR("Invalid header version\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
/* expect no user desc in reply */
if (phdr->ph_flags & PLAIN_FL_USER) {
CERROR("Unexpected udesc flag in reply\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (phdr->ph_bulk_hash_alg != req->rq_flvr.u_bulk.hash.hash_alg) {
CERROR("reply bulk flavor %u != %u\n", phdr->ph_bulk_hash_alg,
req->rq_flvr.u_bulk.hash.hash_alg);
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (unlikely(req->rq_early)) {
CDEBUG(D_SEC,
"early reply checksum mismatch: %08x != %08x\n",
cpu_to_le32(cksum), msg->lm_cksum);
- RETURN(-EINVAL);
+ return -EINVAL;
}
} else {
/* whether we sent with bulk or not, we expect the same
phdr->ph_flags & PLAIN_FL_BULK)) {
CERROR("%s bulk checksum in reply\n",
req->rq_pack_bulk ? "Missing" : "Unexpected");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (phdr->ph_flags & PLAIN_FL_BULK) {
if (plain_unpack_bsd(msg, swabbed))
- RETURN(-EPROTO);
+ return -EPROTO;
}
}
req->rq_repmsg = lustre_msg_buf(msg, PLAIN_PACK_MSG_OFF, 0);
req->rq_replen = lustre_msg_buflen(msg, PLAIN_PACK_MSG_OFF);
- RETURN(0);
+ return 0;
}
static
bsd->bsd_svc = SPTLRPC_FLVR_BULK_SVC(req->rq_flvr.sf_rpc);
if (bsd->bsd_svc == SPTLRPC_BULK_SVC_NULL)
- RETURN(0);
+ return 0;
if (req->rq_bulk_read)
- RETURN(0);
+ return 0;
rc = plain_generate_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg,
token);
OBD_ALLOC_PTR(plsec);
if (plsec == NULL)
- RETURN(NULL);
+ return NULL;
/*
* initialize plain_sec
ctx = plain_sec_install_ctx(plsec);
if (ctx == NULL) {
plain_destroy_sec(sec);
- RETURN(NULL);
+ return NULL;
}
sptlrpc_cli_ctx_put(ctx, 1);
}
- RETURN(sec);
+ return sec;
}
static
if (unlikely(ctx == NULL))
ctx = plain_sec_install_ctx(plsec);
- RETURN(ctx);
+ return ctx;
}
static
/* do nothing unless caller want to flush for 'all' */
if (uid != -1)
- RETURN(0);
+ return 0;
write_lock(&plsec->pls_lock);
ctx = plsec->pls_ctx;
if (ctx)
sptlrpc_cli_ctx_put(ctx, 1);
- RETURN(0);
+ return 0;
}
static
alloc_len = size_roundup_power2(alloc_len);
OBD_ALLOC_LARGE(req->rq_reqbuf, alloc_len);
if (!req->rq_reqbuf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_reqbuf_len = alloc_len;
} else {
if (req->rq_pack_udesc)
sptlrpc_pack_user_desc(req->rq_reqbuf, PLAIN_PACK_USER_OFF);
- RETURN(0);
+ return 0;
}
static
OBD_ALLOC_LARGE(req->rq_repbuf, alloc_len);
if (!req->rq_repbuf)
- RETURN(-ENOMEM);
+ return -ENOMEM;
req->rq_repbuf_len = alloc_len;
- RETURN(0);
+ return 0;
}
static
OBD_ALLOC_LARGE(newbuf, newbuf_size);
if (newbuf == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
memcpy(newbuf, req->rq_reqbuf, req->rq_reqbuf_len);
_sptlrpc_enlarge_msg_inplace(req->rq_reqmsg, segment, newsize);
req->rq_reqlen = newmsg_size;
- RETURN(0);
+ return 0;
}
/****************************************
SPTLRPC_FLVR_BULK_TYPE(req->rq_flvr.sf_rpc) !=
SPTLRPC_FLVR_BULK_TYPE(SPTLRPC_FLVR_PLAIN)) {
CERROR("Invalid rpc flavor %x\n", req->rq_flvr.sf_rpc);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
if (msg->lm_bufcount < PLAIN_PACK_SEGMENTS) {
CERROR("unexpected request buf count %u\n", msg->lm_bufcount);
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
swabbed = ptlrpc_req_need_swab(req);
phdr = lustre_msg_buf(msg, PLAIN_PACK_HDR_OFF, sizeof(*phdr));
if (phdr == NULL) {
CERROR("missing plain header\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (phdr->ph_ver != 0) {
CERROR("Invalid header version\n");
- RETURN(-EPROTO);
+ return -EPROTO;
}
if (phdr->ph_bulk_hash_alg >= BULK_HASH_ALG_MAX) {
CERROR("invalid hash algorithm: %u\n", phdr->ph_bulk_hash_alg);
- RETURN(-EPROTO);
+ return -EPROTO;
}
req->rq_sp_from = phdr->ph_sp;
if (sptlrpc_unpack_user_desc(msg, PLAIN_PACK_USER_OFF,
swabbed)) {
CERROR("Mal-formed user descriptor\n");
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
}
req->rq_pack_udesc = 1;
if (phdr->ph_flags & PLAIN_FL_BULK) {
if (plain_unpack_bsd(msg, swabbed))
- RETURN(SECSVC_DROP);
+ return SECSVC_DROP;
req->rq_pack_bulk = 1;
}
req->rq_svc_ctx = &plain_svc_ctx;
atomic_inc(&req->rq_svc_ctx->sc_refcount);
- RETURN(SECSVC_OK);
+ return SECSVC_OK;
}
static
} else {
OBD_ALLOC_LARGE(rs, rs_size);
if (rs == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
rs->rs_size = rs_size;
}
rs->rs_msg = lustre_msg_buf_v2(rs->rs_repbuf, PLAIN_PACK_MSG_OFF, 0);
req->rq_reply_state = rs;
- RETURN(0);
+ return 0;
}
static
req->rq_reply_off = 0;
}
- RETURN(0);
+ return 0;
}
static
if (rc != 0) {
CERROR("%s: invalid CPT pattern string: %s",
conf->psc_name, cconf->cc_pattern);
- RETURN(ERR_PTR(-EINVAL));
+ return ERR_PTR(-EINVAL);
}
rc = cfs_expr_list_values(el, ncpts, &cpts);
conf->psc_name, cconf->cc_pattern, rc);
if (cpts != NULL)
OBD_FREE(cpts, sizeof(*cpts) * ncpts);
- RETURN(ERR_PTR(rc < 0 ? rc : -EINVAL));
+ return ERR_PTR(rc < 0 ? rc : -EINVAL);
}
ncpts = rc;
}
if (service == NULL) {
if (cpts != NULL)
OBD_FREE(cpts, sizeof(*cpts) * ncpts);
- RETURN(ERR_PTR(-ENOMEM));
+ return ERR_PTR(-ENOMEM);
}
service->srv_cptable = cptable;
GOTO(failed, rc);
}
- RETURN(service);
+ return service;
failed:
ptlrpc_unregister_service(service);
- RETURN(ERR_PTR(rc));
+ return ERR_PTR(rc);
}
EXPORT_SYMBOL(ptlrpc_register_service);
at_get(&svcpt->scp_at_estimate), at_extra);
if (AT_OFF)
- RETURN(0);
+ return 0;
if (olddl < 0) {
DEBUG_REQ(D_WARNING, req, "Already past deadline (%+lds), "
"at_early_margin (%d)?", olddl, at_early_margin);
/* Return an error so we're not re-added to the timed list. */
- RETURN(-ETIMEDOUT);
+ return -ETIMEDOUT;
}
if ((lustre_msghdr_get_flags(req->rq_reqmsg) & MSGHDR_AT_SUPPORT) == 0){
DEBUG_REQ(D_INFO, req, "Wanted to ask client for more time, "
"but no AT support");
- RETURN(-ENOSYS);
+ return -ENOSYS;
}
if (req->rq_export &&
olddl, req->rq_arrival_time.tv_sec +
at_get(&svcpt->scp_at_estimate) -
cfs_time_current_sec());
- RETURN(-ETIMEDOUT);
+ return -ETIMEDOUT;
}
}
newdl = cfs_time_current_sec() + at_get(&svcpt->scp_at_estimate);
OBD_ALLOC(reqcopy, sizeof *reqcopy);
if (reqcopy == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
OBD_ALLOC_LARGE(reqmsg, req->rq_reqlen);
if (!reqmsg) {
OBD_FREE(reqcopy, sizeof *reqcopy);
- RETURN(-ENOMEM);
+ return -ENOMEM;
}
*reqcopy = *req;
sptlrpc_svc_ctx_decref(reqcopy);
OBD_FREE_LARGE(reqmsg, req->rq_reqlen);
OBD_FREE(reqcopy, sizeof *reqcopy);
- RETURN(rc);
+ return rc;
}
/* Send early replies to everybody expiring within at_early_margin
spin_lock(&svcpt->scp_at_lock);
if (svcpt->scp_at_check == 0) {
spin_unlock(&svcpt->scp_at_lock);
- RETURN(0);
+ return 0;
}
delay = cfs_time_sub(cfs_time_current(), svcpt->scp_at_checktime);
svcpt->scp_at_check = 0;
if (array->paa_count == 0) {
spin_unlock(&svcpt->scp_at_lock);
- RETURN(0);
+ return 0;
}
/* The timer went off, but maybe the nearest rpc already completed. */
/* We've still got plenty of time. Reset the timer. */
ptlrpc_at_set_timer(svcpt);
spin_unlock(&svcpt->scp_at_lock);
- RETURN(0);
+ return 0;
}
/* We're close to a timeout, and we don't know how much longer the
ptlrpc_server_drop_request(rq);
}
- RETURN(1); /* return "did_something" for liblustre */
+ return 1; /* return "did_something" for liblustre */
}
/**
if (svcpt->scp_service->srv_ops.so_hpreq_handler) {
rc = svcpt->scp_service->srv_ops.so_hpreq_handler(req);
if (rc < 0)
- RETURN(rc);
+ return rc;
LASSERT(rc == 0);
}
if (req->rq_export && req->rq_ops) {
* ost_brw_write().
*/
if (rc < 0)
- RETURN(rc);
+ return rc;
LASSERT(rc == 0 || rc == 1);
}
ptlrpc_nrs_req_initialize(svcpt, req, rc);
- RETURN(rc);
+ return rc;
}
/** Remove the request from the export list. */
rc = ptlrpc_server_hpreq_init(svcpt, req);
if (rc < 0)
- RETURN(rc);
+ return rc;
ptlrpc_nrs_req_add(svcpt, req, !!rc);
- RETURN(0);
+ return 0;
}
/**
}
spin_unlock(&svcpt->scp_req_lock);
- RETURN(NULL);
+ return NULL;
got_request:
svcpt->scp_nreqs_active++;
if (likely(req->rq_export))
class_export_rpc_inc(req->rq_export);
- RETURN(req);
+ return req;
}
/**
spin_lock(&svcpt->scp_lock);
if (list_empty(&svcpt->scp_req_incoming)) {
spin_unlock(&svcpt->scp_lock);
- RETURN(0);
+ return 0;
}
req = list_entry(svcpt->scp_req_incoming.next,
GOTO(err_req, rc);
wake_up(&svcpt->scp_waitq);
- RETURN(1);
+ return 1;
err_req:
ptlrpc_server_finish_request(svcpt, req);
- RETURN(1);
+ return 1;
}
/**
request = ptlrpc_server_request_get(svcpt, false);
if (request == NULL)
- RETURN(0);
+ return 0;
if (OBD_FAIL_CHECK(OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT))
fail_opc = OBD_FAIL_PTLRPC_HPREQ_NOTIMEOUT;
out_req:
ptlrpc_server_finish_active_request(svcpt, request);
- RETURN(1);
+ return 1;
}
/**
if (atomic_dec_and_test(&svcpt->scp_nreps_difficult) &&
svc->srv_is_stopping)
wake_up_all(&svcpt->scp_waitq);
- RETURN(1);
+ return 1;
}
/* still on the net; callback will schedule */
spin_unlock(&rs->rs_lock);
- RETURN(1);
+ return 1;
}
CERROR("Reply handling thread %d:%d Failed on starting: "
"rc = %d\n", i, j, rc);
ptlrpc_stop_hr_threads();
- RETURN(rc);
+ return rc;
}
- RETURN(0);
+ return 0;
}
static void ptlrpc_svcpt_stop_threads(struct ptlrpc_service_part *svcpt)
}
}
- RETURN(0);
+ return 0;
failed:
CERROR("cannot start %s thread #%d_%d: rc %d\n",
svc->srv_thread_name, i, j, rc);
ptlrpc_stop_all_threads(svc);
- RETURN(rc);
+ return rc;
}
EXPORT_SYMBOL(ptlrpc_start_threads);
again:
if (unlikely(svc->srv_is_stopping))
- RETURN(-ESRCH);
+ return -ESRCH;
if (!ptlrpc_threads_increasable(svcpt) ||
(OBD_FAIL_CHECK(OBD_FAIL_TGT_TOOMANY_THREADS) &&
svcpt->scp_nthrs_running == svc->srv_nthrs_cpt_init - 1))
- RETURN(-EMFILE);
+ return -EMFILE;
OBD_CPT_ALLOC_PTR(thread, svc->srv_cptable, svcpt->scp_cpt);
if (thread == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
init_waitqueue_head(&thread->t_ctl_waitq);
spin_lock(&svcpt->scp_lock);
if (!ptlrpc_threads_increasable(svcpt)) {
spin_unlock(&svcpt->scp_lock);
OBD_FREE_PTR(thread);
- RETURN(-EMFILE);
+ return -EMFILE;
}
if (svcpt->scp_nthrs_starting != 0) {
CDEBUG(D_INFO, "Creating thread %s #%d race, retry later\n",
svc->srv_thread_name, svcpt->scp_thr_nextid);
- RETURN(-EAGAIN);
+ return -EAGAIN;
}
svcpt->scp_nthrs_starting++;
spin_unlock(&svcpt->scp_lock);
OBD_FREE_PTR(thread);
}
- RETURN(rc);
+ return rc;
}
if (!wait)
- RETURN(0);
+ return 0;
l_wait_event(thread->t_ctl_waitq,
thread_is_running(thread) || thread_is_stopped(thread),
&lwi);
rc = thread_is_stopped(thread) ? thread->t_id : 0;
- RETURN(rc);
+ return rc;
}
int ptlrpc_hr_init(void)
ptlrpc_hr.hr_partitions = cfs_percpt_alloc(ptlrpc_hr.hr_cpt_table,
sizeof(*hrp));
if (ptlrpc_hr.hr_partitions == NULL)
- RETURN(-ENOMEM);
+ return -ENOMEM;
init_waitqueue_head(&ptlrpc_hr.hr_waitq);
out:
if (rc != 0)
ptlrpc_hr_fini();
- RETURN(rc);
+ return rc;
}
void ptlrpc_hr_fini(void)
ptlrpc_service_free(service);
- RETURN(0);
+ return 0;
}
EXPORT_SYMBOL(ptlrpc_unregister_service);