From 5e33bc68940db1817a869afcd0c898175e4ceb3a Mon Sep 17 00:00:00 2001 From: adilger Date: Sat, 27 Apr 2002 00:17:13 +0000 Subject: [PATCH] Add lustre_fsync() helper function. --- lustre/include/linux/lustre_lib.h | 1 + lustre/lib/simple.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index f6e3ecb..2db81cf 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -45,6 +45,7 @@ void pop_ctxt(struct obd_run_ctxt *saved); int simple_mkdir(struct dentry *dir, char *name, int mode); int lustre_fread(struct file *file, char *str, int len, loff_t *off); int lustre_fwrite(struct file *file, const char *str, int len, loff_t *off); +int lustre_fsync(struct file *file); #endif #include diff --git a/lustre/lib/simple.c b/lustre/lib/simple.c index 8876504..baeff93 100644 --- a/lustre/lib/simple.c +++ b/lustre/lib/simple.c @@ -71,18 +71,26 @@ out: int lustre_fread(struct file *file, char *str, int len, loff_t *off) { if (!file || !file->f_op || !file->f_op->read || !off) - RETURN(-EINVAL); + RETURN(-ENOSYS); return file->f_op->read(file, str, len, off); } int lustre_fwrite(struct file *file, const char *str, int len, loff_t *off) { - if (!file || !file->f_op || !file->f_op->write || !off) - RETURN(-EINVAL); + if (!file || !file->f_op || !off) + RETURN(-ENOSYS); if (!file->f_op->write) RETURN(-EROFS); return file->f_op->write(file, str, len, off); } + +int lustre_fsync(struct file *file) +{ + if (!file || !file->f_op || !file->f_op->fsync) + RETURN(-ENOSYS); + + return file->f_op->fsync(file, file->f_dentry, 0); +} -- 1.8.3.1