⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 obd_class.h

📁 lustre 1.6.5 source code
💻 H
📖 第 1 页 / 共 4 页
字号:
static inline intobd_process_config(struct obd_device *obd, int datalen, void *data){        int rc;        ENTRY;        OBD_CHECK_OP(obd, process_config, -EOPNOTSUPP);        OBD_COUNTER_INCREMENT(obd, process_config);        rc = OBP(obd, process_config)(obd, datalen, data);        RETURN(rc);}/* Pack an in-memory MD struct for storage on disk. * Returns +ve size of packed MD (0 for free), or -ve error. * * If @disk_tgt == NULL, MD size is returned (max size if @mem_src == NULL). * If @*disk_tgt != NULL and @mem_src == NULL, @*disk_tgt will be freed. * If @*disk_tgt == NULL, it will be allocated */static inline int obd_packmd(struct obd_export *exp,                             struct lov_mds_md **disk_tgt,                             struct lov_stripe_md *mem_src){        int rc;        ENTRY;        EXP_CHECK_OP(exp, packmd);        EXP_COUNTER_INCREMENT(exp, packmd);        rc = OBP(exp->exp_obd, packmd)(exp, disk_tgt, mem_src);        RETURN(rc);}static inline int obd_size_diskmd(struct obd_export *exp,                                  struct lov_stripe_md *mem_src){        return obd_packmd(exp, NULL, mem_src);}/* helper functions */static inline int obd_alloc_diskmd(struct obd_export *exp,                                   struct lov_mds_md **disk_tgt){        LASSERT(disk_tgt);        LASSERT(*disk_tgt == NULL);        return obd_packmd(exp, disk_tgt, NULL);}static inline int obd_free_diskmd(struct obd_export *exp,                                  struct lov_mds_md **disk_tgt){        LASSERT(disk_tgt);        LASSERT(*disk_tgt);        return obd_packmd(exp, disk_tgt, NULL);}/* Unpack an MD struct from disk to in-memory format. * Returns +ve size of unpacked MD (0 for free), or -ve error. * * If @mem_tgt == NULL, MD size is returned (max size if @disk_src == NULL). * If @*mem_tgt != NULL and @disk_src == NULL, @*mem_tgt will be freed. * If @*mem_tgt == NULL, it will be allocated */static inline int obd_unpackmd(struct obd_export *exp,                               struct lov_stripe_md **mem_tgt,                               struct lov_mds_md *disk_src,                               int disk_len){        int rc;        ENTRY;        EXP_CHECK_OP(exp, unpackmd);        EXP_COUNTER_INCREMENT(exp, unpackmd);        rc = OBP(exp->exp_obd, unpackmd)(exp, mem_tgt, disk_src, disk_len);        RETURN(rc);}/* helper functions */static inline int obd_alloc_memmd(struct obd_export *exp,                                  struct lov_stripe_md **mem_tgt){        LASSERT(mem_tgt);        LASSERT(*mem_tgt == NULL);        return obd_unpackmd(exp, mem_tgt, NULL, 0);}static inline int obd_free_memmd(struct obd_export *exp,                                 struct lov_stripe_md **mem_tgt){        LASSERT(mem_tgt);        LASSERT(*mem_tgt);        return obd_unpackmd(exp, mem_tgt, NULL, 0);}static inline int obd_checkmd(struct obd_export *exp,                              struct obd_export *md_exp,                              struct lov_stripe_md *mem_tgt){        int rc;        ENTRY;        EXP_CHECK_OP(exp, checkmd);        EXP_COUNTER_INCREMENT(exp, checkmd);        rc = OBP(exp->exp_obd, checkmd)(exp, md_exp, mem_tgt);        RETURN(rc);}static inline int obd_precreate(struct obd_export *exp){        int rc;        ENTRY;        EXP_CHECK_OP(exp, precreate);        OBD_COUNTER_INCREMENT(exp->exp_obd, precreate);        rc = OBP(exp->exp_obd, precreate)(exp);        RETURN(rc);}static inline int obd_create(struct obd_export *exp, struct obdo *obdo,                             struct lov_stripe_md **ea,                             struct obd_trans_info *oti){        int rc;        ENTRY;        EXP_CHECK_OP(exp, create);        EXP_COUNTER_INCREMENT(exp, create);        rc = OBP(exp->exp_obd, create)(exp, obdo, ea, oti);        RETURN(rc);}static inline int obd_destroy(struct obd_export *exp, struct obdo *obdo,                              struct lov_stripe_md *ea,                              struct obd_trans_info *oti,                              struct obd_export *md_exp){        int rc;        ENTRY;        EXP_CHECK_OP(exp, destroy);        EXP_COUNTER_INCREMENT(exp, destroy);        rc = OBP(exp->exp_obd, destroy)(exp, obdo, ea, oti, md_exp);        RETURN(rc);}static inline int obd_getattr(struct obd_export *exp, struct obd_info *oinfo){        int rc;        ENTRY;        EXP_CHECK_OP(exp, getattr);        EXP_COUNTER_INCREMENT(exp, getattr);        rc = OBP(exp->exp_obd, getattr)(exp, oinfo);        RETURN(rc);}static inline int obd_getattr_async(struct obd_export *exp,                                    struct obd_info *oinfo,                                    struct ptlrpc_request_set *set){        int rc;        ENTRY;        EXP_CHECK_OP(exp, getattr_async);        EXP_COUNTER_INCREMENT(exp, getattr_async);        rc = OBP(exp->exp_obd, getattr_async)(exp, oinfo, set);        RETURN(rc);}static inline int obd_setattr(struct obd_export *exp, struct obd_info *oinfo,                              struct obd_trans_info *oti){        int rc;        ENTRY;        EXP_CHECK_OP(exp, setattr);        EXP_COUNTER_INCREMENT(exp, setattr);        rc = OBP(exp->exp_obd, setattr)(exp, oinfo, oti);        RETURN(rc);}/* This performs all the requests set init/wait/destroy actions. */static inline int obd_setattr_rqset(struct obd_export *exp,                                    struct obd_info *oinfo,                                    struct obd_trans_info *oti){        struct ptlrpc_request_set *set = NULL;        int rc;        ENTRY;        EXP_CHECK_OP(exp, setattr_async);        EXP_COUNTER_INCREMENT(exp, setattr_async);        set =  ptlrpc_prep_set();        if (set == NULL)                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);}/* This adds all the requests into @set if @set != NULL, otherwise   all requests are sent asynchronously without waiting for response. */static inline int obd_setattr_async(struct obd_export *exp,                                    struct obd_info *oinfo,                                    struct obd_trans_info *oti,                                    struct ptlrpc_request_set *set){        int rc;        ENTRY;        EXP_CHECK_OP(exp, setattr_async);        EXP_COUNTER_INCREMENT(exp, setattr_async);        rc = OBP(exp->exp_obd, setattr_async)(exp, oinfo, oti, set);        RETURN(rc);}static inline int obd_add_conn(struct obd_import *imp, struct obd_uuid *uuid,                               int priority){        struct obd_device *obd = imp->imp_obd;        int rc;        ENTRY;        OBD_CHECK_DEV_ACTIVE(obd);        OBD_CHECK_OP(obd, add_conn, -EOPNOTSUPP);        OBD_COUNTER_INCREMENT(obd, add_conn);        rc = OBP(obd, add_conn)(imp, uuid, priority);        RETURN(rc);}static inline int obd_del_conn(struct obd_import *imp, struct obd_uuid *uuid){        struct obd_device *obd = imp->imp_obd;        int rc;        ENTRY;        OBD_CHECK_DEV_ACTIVE(obd);        OBD_CHECK_OP(obd, del_conn, -EOPNOTSUPP);        OBD_COUNTER_INCREMENT(obd, del_conn);        rc = OBP(obd, del_conn)(imp, uuid);        RETURN(rc);}static inline int obd_connect(struct lustre_handle *conn,struct obd_device *obd,                              struct obd_uuid *cluuid,                              struct obd_connect_data *d,                              void *localdata){        int rc;        __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition check */        ENTRY;        OBD_CHECK_DEV_ACTIVE(obd);        OBD_CHECK_OP(obd, connect, -EOPNOTSUPP);        OBD_COUNTER_INCREMENT(obd, connect);        rc = OBP(obd, connect)(conn, obd, cluuid, d, localdata);        /* check that only subset is granted */        LASSERT(ergo(d != NULL,                     (d->ocd_connect_flags & ocf) == d->ocd_connect_flags));        RETURN(rc);}static inline int obd_reconnect(struct obd_export *exp,                                struct obd_device *obd,                                struct obd_uuid *cluuid,                                struct obd_connect_data *d){        int rc;        __u64 ocf = d ? d->ocd_connect_flags : 0; /* for post-condition check */        ENTRY;        OBD_CHECK_DEV_ACTIVE(obd);        OBD_CHECK_OP(obd, reconnect, 0);        OBD_COUNTER_INCREMENT(obd, reconnect);        rc = OBP(obd, reconnect)(exp, obd, cluuid, d);        /* check that only subset is granted */        LASSERT(ergo(d != NULL,                     (d->ocd_connect_flags & ocf) == d->ocd_connect_flags));        RETURN(rc);}static inline int obd_disconnect(struct obd_export *exp){        int rc;        ENTRY;        EXP_CHECK_OP(exp, disconnect);        EXP_COUNTER_INCREMENT(exp, disconnect);        rc = OBP(exp->exp_obd, disconnect)(exp);        RETURN(rc);}static inline int obd_ping(struct obd_export *exp){        int rc;        ENTRY;        OBD_CHECK_OP(exp->exp_obd, ping, 0);        EXP_COUNTER_INCREMENT(exp, ping);        rc = OBP(exp->exp_obd, ping)(exp);        RETURN(rc);}static inline int obd_init_export(struct obd_export *exp){        int rc = 0;        ENTRY;        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);}static inline int obd_destroy_export(struct obd_export *exp){        ENTRY;        if ((exp)->exp_obd != NULL && OBT((exp)->exp_obd) &&            OBP((exp)->exp_obd, destroy_export))                OBP(exp->exp_obd, destroy_export)(exp);        RETURN(0);}static inline int obd_extent_calc(struct obd_export *exp,                                  struct lov_stripe_md *md,                                  int cmd, obd_off *offset){        int rc;        ENTRY;        EXP_CHECK_OP(exp, extent_calc);        rc = OBP(exp->exp_obd, extent_calc)(exp, md, cmd, offset);        RETURN(rc);}static inline struct dentry *obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr){        LASSERT(exp->exp_obd);        return lvfs_fid2dentry(&exp->exp_obd->obd_lvfs_ctxt, id_ino, gen, gr,                               exp->exp_obd);}#ifndef time_before#define time_before(t1, t2) ((long)t2 - (long)t1 > 0)#endif/* @max_age is the oldest time in jiffies that we accept using a cached data. * If the cache is older than @max_age we will get a new value from the * target.  Use a value of "cfs_time_current() + HZ" to guarantee freshness. */static inline int obd_statfs_async(struct obd_device *obd,                                   struct obd_info *oinfo,                                   __u64 max_age,                                   struct ptlrpc_request_set *rqset){        int rc = 0;        ENTRY;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -