From c737cb12496dfc80f806714edf3235b6dafb72a2 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 8 Sep 2003 06:25:28 +0000 Subject: [PATCH] - pad llog_* body structures correctly (thanks Andreas) - countless build fixes --- lustre/include/linux/lvfs.h | 9 +++++---- lustre/include/linux/lvfs_linux.h | 12 +++++++++++- lustre/lvfs/lvfs_linux.c | 15 +++++++++------ lustre/obdclass/llog_cat.c | 3 ++- lustre/obdclass/llog_lvfs.c | 29 ++++++++++++++++++++++++----- 5 files changed, 51 insertions(+), 17 deletions(-) diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h index 06d76aa..8ea973f 100644 --- a/lustre/include/linux/lvfs.h +++ b/lustre/include/linux/lvfs.h @@ -1,6 +1,8 @@ #ifndef __LVFS_H__ #define __LVFS_H__ +#include + #if defined __KERNEL__ #include #endif @@ -36,13 +38,15 @@ struct obd_run_ctxt { #endif }; - #ifdef OBD_CTXT_DEBUG #define OBD_SET_CTXT_MAGIC(ctxt) (ctxt)->magic = OBD_RUN_CTXT_MAGIC #else #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0) #endif +/* lvfs_common.c */ +struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *, __u64, __u32, void *data); + #ifdef __KERNEL__ void push_ctxt(struct obd_run_ctxt *save, struct obd_run_ctxt *new_ctx, @@ -55,9 +59,6 @@ int lustre_fread(struct file *file, void *buf, int len, loff_t *off); int lustre_fwrite(struct file *file, const void *buf, int len, loff_t *off); int lustre_fsync(struct file *file); -/* lvfs_common.c */ -struct dentry *lvfs_fid2dentry(struct obd_run_ctxt *, __u64, __u32, void *data); - static inline void l_dput(struct dentry *de) { if (!de || IS_ERR(de)) diff --git a/lustre/include/linux/lvfs_linux.h b/lustre/include/linux/lvfs_linux.h index 0c17b70..9349760 100644 --- a/lustre/include/linux/lvfs_linux.h +++ b/lustre/include/linux/lvfs_linux.h @@ -1,11 +1,21 @@ #ifndef __LVFS_LINUX_H__ #define __LVFS_LINUX_H__ +#include +#include +#include +#include + +#include + #define l_file file #define l_dentry dentry #define l_inode inode -#define l_dentry_open dentry_open #define l_filp_open filp_open +struct obd_run_ctxt; +struct l_file *l_dentry_open(struct obd_run_ctxt *, struct l_dentry *, + int flags); + #endif diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c index fb09c74..8559507 100644 --- a/lustre/lvfs/lvfs_linux.c +++ b/lustre/lvfs/lvfs_linux.c @@ -202,7 +202,8 @@ struct dentry *simple_mknod(struct dentry *dir, char *name, int mode) GOTO(out_up, dchild); } - err = ll_vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG, NULL); + err = ll_vfs_create(dir->d_inode, dchild, (mode & ~S_IFMT) | S_IFREG, + NULL); if (err) GOTO(out_err, err); @@ -301,11 +302,13 @@ int lustre_fsync(struct file *file) } EXPORT_SYMBOL(lustre_fsync); - - - - - +struct l_file *l_dentry_open(struct obd_run_ctxt *ctxt, struct l_dentry *de, + int flags) +{ + mntget(ctxt->pwdmnt); + return dentry_open(de, ctxt->pwdmnt, flags); +} +EXPORT_SYMBOL(l_dentry_open); #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)) diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 7d5e4cd..073dea0 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -144,7 +144,7 @@ out: } - +#if 0 /* Assumes caller has already pushed us into the kernel context. */ int llog_cat_init(struct llog_handle *cathandle, struct obd_uuid *tgtuuid) { @@ -322,3 +322,4 @@ void llog_cat_put(struct obd_device *obd, struct llog_handle *cathandle) EXIT; } +#endif diff --git a/lustre/obdclass/llog_lvfs.c b/lustre/obdclass/llog_lvfs.c index e6a8311..d2ac439 100644 --- a/lustre/obdclass/llog_lvfs.c +++ b/lustre/obdclass/llog_lvfs.c @@ -205,7 +205,7 @@ int llog_lvfs_write_rec(struct llog_handle *loghandle, } RETURN(rc); } -EXPORT_SYMBOL(llog_lvfs_write_record); +EXPORT_SYMBOL(llog_lvfs_write_rec); int llog_lvfs_next_block(struct llog_handle *loghandle, int cur_idx, int next_idx, __u64 *cur_offset, void *buf, int len) @@ -313,10 +313,11 @@ int llog_lvfs_create(struct obd_device *obd, rc = obd_create(obd->obd_log_exp, oa, NULL, NULL); if (rc) GOTO(out_handle, rc); - de = obd_lvfs_fid2dentry(handle->lgh_obd, oa->o_id, oa->o_gr); + de = obd_lvfs_fid2dentry(obd->obd_log_exp, oa->o_id, oa->o_gr); if (IS_ERR(de)) GOTO(out_handle, rc = PTR_ERR(de)); - handle->lgh_file = l_dentry_open(de, open_flags); + handle->lgh_file = l_dentry_open(&obd->obd_ctxt, de, + open_flags); if (IS_ERR(handle->lgh_file)) GOTO(out_handle, rc = PTR_ERR(handle->lgh_file)); handle->lgh_id.lgl_oid = oa->o_id; @@ -332,7 +333,6 @@ out_handle: return rc; } - int llog_lvfs_close(struct llog_handle *handle) { int rc; @@ -346,13 +346,32 @@ int llog_lvfs_close(struct llog_handle *handle) RETURN(rc); } -#if 0 int llog_lvfs_destroy(struct llog_handle *handle) { + struct obdo *oa; + int rc; + ENTRY; + + oa = obdo_alloc(); + if (oa == NULL) + RETURN(-ENOMEM); + oa->o_id = handle->lgh_id.lgl_oid; + oa->o_gr = handle->lgh_id.lgl_ogr; + oa->o_generation = handle->lgh_id.lgl_ogen; + oa->o_valid = OBD_MD_FLGROUP | OBD_MD_FLGENER; + rc = llog_lvfs_close(handle); + if (rc) + GOTO(out, rc); + + rc = obd_destroy(handle->lgh_obd->obd_log_exp, oa, NULL, NULL); + out: + obdo_free(oa); + RETURN(rc); } +#if 0 /* This is a callback from the llog_* functions. * Assumes caller has already pushed us into the kernel context. */ int mds_log_close(struct llog_handle *cathandle, struct llog_handle *loghandle) -- 1.8.3.1