X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Finclude%2Flinux%2Flustre_fsfilt.h;h=40e991415b52e4ab28b846a016a87825b50367a7;hb=c3ced3e86c18ab5e457c090f2d2320802f7eb002;hp=8446e5b12527dcdabd787072c7c64df30ed317e7;hpb=e74a5707a7977045fc7c4aa3765539c5151340bf;p=fs%2Flustre-release.git diff --git a/lustre/include/linux/lustre_fsfilt.h b/lustre/include/linux/lustre_fsfilt.h index 8446e5b..40e9914 100644 --- a/lustre/include/linux/lustre_fsfilt.h +++ b/lustre/include/linux/lustre_fsfilt.h @@ -28,7 +28,7 @@ #ifdef __KERNEL__ #include -#include +#include typedef void (*fsfilt_cb_t)(struct obd_device *obd, __u64 last_rcvd, void *data, int error); @@ -42,9 +42,11 @@ struct fsfilt_operations { struct list_head fs_list; struct module *fs_owner; char *fs_type; - void *(* fs_start)(struct inode *inode, int op, void *desc_private); + void *(* fs_start)(struct inode *inode, int op, void *desc_private, + int logs); void *(* fs_brw_start)(int objcount, struct fsfilt_objinfo *fso, - int niocount, void *desc_private); + int niocount, struct niobuf_local *nb, + void *desc_private, int logs); int (* fs_commit)(struct inode *inode, void *handle,int force_sync); int (* fs_commit_async)(struct inode *inode, void *handle, void **wait_handle); @@ -72,6 +74,7 @@ struct fsfilt_operations { int force_sync); int (* fs_read_record)(struct file *, void *, int size, loff_t *); int (* fs_setup)(struct super_block *sb); + int (* fs_get_op_len)(int, struct fsfilt_objinfo *, int); }; extern int fsfilt_register_ops(struct fsfilt_operations *fs_ops); @@ -88,15 +91,15 @@ extern void fsfilt_put_ops(struct fsfilt_operations *fs_ops); #define FSFILT_OP_MKNOD 7 #define FSFILT_OP_SETATTR 8 #define FSFILT_OP_LINK 9 -#define FSFILT_OP_CREATE_LOG 10 -#define FSFILT_OP_UNLINK_LOG 11 +#define FSFILT_OP_CANCEL_UNLINK 10 -static inline void *fsfilt_start(struct obd_device *obd, struct inode *inode, - int op, struct obd_trans_info *oti) +static inline void *fsfilt_start_log(struct obd_device *obd, + struct inode *inode, int op, + struct obd_trans_info *oti, int logs) { unsigned long now = jiffies; void *parent_handle = oti ? oti->oti_handle : NULL; - void *handle = obd->obd_fsops->fs_start(inode, op, parent_handle); + void *handle = obd->obd_fsops->fs_start(inode, op, parent_handle, logs); CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle); if (oti != NULL) { @@ -104,7 +107,7 @@ static inline void *fsfilt_start(struct obd_device *obd, struct inode *inode, oti->oti_handle = handle; } else if (handle != parent_handle) { CERROR("mismatch: parent %p, handle %p, oti %p\n", - parent_handle, handle, oti->oti_handle); + parent_handle, handle, oti); LBUG(); } } @@ -113,16 +116,22 @@ static inline void *fsfilt_start(struct obd_device *obd, struct inode *inode, return handle; } -static inline void *fsfilt_brw_start(struct obd_device *obd, int objcount, - struct fsfilt_objinfo *fso, int niocount, - struct obd_trans_info *oti) +static inline void *fsfilt_start(struct obd_device *obd, struct inode *inode, + int op, struct obd_trans_info *oti) +{ + return fsfilt_start_log(obd, inode, op, oti, 0); +} + +static inline void *fsfilt_brw_start_log(struct obd_device *obd, + int objcount, + struct fsfilt_objinfo *fso, + int niocount, struct niobuf_local *nb, + struct obd_trans_info *oti, int logs) { unsigned long now = jiffies; void *parent_handle = oti ? oti->oti_handle : NULL; - void *handle; - - handle = obd->obd_fsops->fs_brw_start(objcount, fso, niocount, - parent_handle); + void *handle = obd->obd_fsops->fs_brw_start(objcount, fso, niocount, nb, + parent_handle, logs); CDEBUG(D_HA, "started handle %p (%p)\n", handle, parent_handle); if (oti != NULL) { @@ -130,41 +139,53 @@ static inline void *fsfilt_brw_start(struct obd_device *obd, int objcount, oti->oti_handle = handle; } else if (handle != parent_handle) { CERROR("mismatch: parent %p, handle %p, oti %p\n", - parent_handle, handle, oti->oti_handle); + parent_handle, handle, oti); LBUG(); } } if (time_after(jiffies, now + 15 * HZ)) CERROR("long journal start time %lus\n", (jiffies - now) / HZ); + return handle; } +static inline void *fsfilt_brw_start(struct obd_device *obd, int objcount, + struct fsfilt_objinfo *fso, int niocount, + struct niobuf_local *nb, + struct obd_trans_info *oti) +{ + return fsfilt_brw_start_log(obd, objcount, fso, niocount, nb, oti, 0); +} + static inline int fsfilt_commit(struct obd_device *obd, struct inode *inode, void *handle, int force_sync) { unsigned long now = jiffies; int rc = obd->obd_fsops->fs_commit(inode, handle, force_sync); CDEBUG(D_HA, "committing handle %p\n", handle); + if (time_after(jiffies, now + 15 * HZ)) CERROR("long journal start time %lus\n", (jiffies - now) / HZ); + return rc; } static inline int fsfilt_commit_async(struct obd_device *obd, - struct inode *inode, - void *handle, - void **wait_handle) + struct inode *inode, void *handle, + void **wait_handle) { unsigned long now = jiffies; int rc = obd->obd_fsops->fs_commit_async(inode, handle, wait_handle); + CDEBUG(D_HA, "committing handle %p (async)\n", *wait_handle); if (time_after(jiffies, now + 15 * HZ)) CERROR("long journal start time %lus\n", (jiffies - now) / HZ); + return rc; } -static inline int fsfilt_commit_wait(struct obd_device *obd, struct inode *inode, - void *handle) +static inline int fsfilt_commit_wait(struct obd_device *obd, + struct inode *inode, void *handle) { unsigned long now = jiffies; int rc = obd->obd_fsops->fs_commit_wait(inode, handle); @@ -215,14 +236,26 @@ static inline int fsfilt_add_journal_cb(struct obd_device *obd, __u64 last_rcvd, void *handle, fsfilt_cb_t cb_func, void *cb_data) { - return obd->obd_fsops->fs_add_journal_cb(obd, last_rcvd, handle, - cb_func, cb_data); + return obd->obd_fsops->fs_add_journal_cb(obd, last_rcvd, + handle, cb_func, cb_data); } +/* very similar to obd_statfs(), but caller already holds obd_osfs_lock */ static inline int fsfilt_statfs(struct obd_device *obd, struct super_block *sb, - struct obd_statfs *osfs) + unsigned long max_age) { - return obd->obd_fsops->fs_statfs(sb, osfs); + int rc = 0; + + CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age); + if (time_before(obd->obd_osfs_age, max_age)) { + rc = obd->obd_fsops->fs_statfs(sb, &obd->obd_osfs); + if (rc == 0) /* N.B. statfs can't really fail */ + obd->obd_osfs_age = jiffies; + } else { + CDEBUG(D_SUPER, "using cached obd_statfs data\n"); + } + + return rc; } static inline int fsfilt_sync(struct obd_device *obd, struct super_block *sb)