X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=lustre%2Finclude%2Flinux%2Fobd_class.h;h=d7e847d0112cf1573230f50a6594d2e4ec0653bd;hb=1ef040b59bd9d7f127ca491b1f89f2477e6553b2;hp=d78158a525485428e6825aede0f13ee28ca28030;hpb=b5b6224b227ca816fc40739741f0c37364db6677;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index d78158a..d7e847d 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -103,6 +103,22 @@ struct lustre_profile { struct lustre_profile *class_get_profile(char * prof); void class_del_profile(char *prof); +#define class_export_rpc_get(exp) \ +({ \ + atomic_inc(&(exp)->exp_rpc_count); \ + CDEBUG(D_INFO, "RPC GETting export %p : new rpc_count %d\n", \ + (exp), atomic_read(&(exp)->exp_rpc_count)); \ + class_export_get(exp); \ +}) + +#define class_export_rpc_put(exp) \ +({ \ + atomic_dec(&(exp)->exp_rpc_count); \ + CDEBUG(D_INFO, "RPC PUTting export %p : new rpc_count %d\n", \ + (exp), atomic_read(&(exp)->exp_rpc_count)); \ + class_export_put(exp); \ +}) + #define class_export_get(exp) \ ({ \ struct obd_export *exp_ = exp; \ @@ -902,8 +918,28 @@ static inline int obd_commitrw(int cmd, struct obd_export *exp, struct obdo *oa, RETURN(rc); } -static inline int obd_write_extents(struct obd_export *exp, struct obd_ioobj *obj, - int niocount, struct niobuf_local *local, int rc) +static inline int obd_do_cow(struct obd_export *exp, struct obd_ioobj *obj, + int objcount,struct niobuf_remote *rnb) +{ + int rc; + ENTRY; + + /* there are cases when write_extents is not implemented. */ + if (!OBP(exp->exp_obd, do_cow)) + RETURN(0); + + OBD_COUNTER_INCREMENT(exp->exp_obd, do_cow); + + rc = OBP(exp->exp_obd, do_cow)(exp, obj, objcount, rnb); + + RETURN(rc); +} + +static inline int obd_write_extents(struct obd_export *exp, + struct obd_ioobj *obj, + int objcount, int niocount, + struct niobuf_local *local, + int rc) { ENTRY; @@ -913,7 +949,8 @@ static inline int obd_write_extents(struct obd_export *exp, struct obd_ioobj *ob OBD_COUNTER_INCREMENT(exp->exp_obd, write_extents); - rc = OBP(exp->exp_obd, write_extents)(exp, obj, niocount, local, rc); + rc = OBP(exp->exp_obd, write_extents)(exp, obj, objcount, niocount, + local, rc); RETURN(rc); } @@ -1122,11 +1159,31 @@ static inline int md_getstatus(struct obd_export *exp, struct ll_fid *fid) RETURN(rc); } +/* this function notifies MDC, that inode described by @fid gets removed from + * memory.*/ +static inline int md_delete_object(struct obd_export *exp, + struct ll_fid *fid) +{ + int rc; + ENTRY; + + /* as this method only notifies MDC that inode gets deleted, we can + * return zero if method is not implemented, this means, that OBD does + * not need such a notification. */ + if (MDP(exp->exp_obd, delete_object) == NULL) + RETURN(0); + + MD_COUNTER_INCREMENT(exp->exp_obd, delete_object); + rc = MDP(exp->exp_obd, delete_object)(exp, fid); + RETURN(rc); +} + static inline int md_getattr(struct obd_export *exp, struct ll_fid *fid, unsigned long valid, unsigned int ea_size, struct ptlrpc_request **request) { int rc; + ENTRY; EXP_CHECK_MD_OP(exp, getattr); MD_COUNTER_INCREMENT(exp->exp_obd, getattr); rc = MDP(exp->exp_obd, getattr)(exp, fid, valid, ea_size, request); @@ -1323,8 +1380,8 @@ static inline int md_unlink(struct obd_export *exp, struct mdc_op_data *data, RETURN(rc); } -static inline struct obd_device * md_get_real_obd(struct obd_export *exp, - char *name, int len) +static inline struct obd_device *md_get_real_obd(struct obd_export *exp, + char *name, int len) { ENTRY; if (MDP(exp->exp_obd, get_real_obd) == NULL)