aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>2013-01-15 04:27:23 +0900
committerDaniel Phillips <daniel@tux3.org>2013-01-15 04:27:23 +0900
commit6842cbff38c655c70f584d26276a481bcb77a1d8 (patch)
treeefbd860348e716edaf348830c06181bb41728442
parent5999eb7a5824efb7f5fd109b188a608f1ef41084 (diff)
downloadlinux-tux3-6842cbff38c655c70f584d26276a481bcb77a1d8.tar.gz
tux3: Initial fsync/fdatasync(2) support (same with sync(2))
To benchmark well, this add implementation of fsync/fdatasync(2). FIXME: Current implementation does same thing with sync(2). We have to do better. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
-rw-r--r--fs/tux3/inode.c19
-rw-r--r--fs/tux3/namei.c1
-rw-r--r--fs/tux3/tux3.h1
3 files changed, 20 insertions, 1 deletions
diff --git a/fs/tux3/inode.c b/fs/tux3/inode.c
index f2c61057d95cc1..7060d2186d6830 100644
--- a/fs/tux3/inode.c
+++ b/fs/tux3/inode.c
@@ -732,6 +732,23 @@ void iget_if_dirty(struct inode *inode)
atomic_inc(&inode->i_count);
}
+/* Synchronize changes to a file and directory. */
+int tux3_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+{
+ struct inode *inode = file->f_mapping->host;
+ struct sb *sb = tux_sb(inode->i_sb);
+
+ /* FIXME: this is sync(2). We should implement real one */
+ static int print_once;
+ if (!print_once) {
+ print_once++;
+ warn("fsync(2) fall-back to sync(2): %Lx-%Lx, datasync %d",
+ start, end, datasync);
+ }
+
+ return force_delta(sb);
+}
+
int tux3_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat)
{
struct inode *inode = dentry->d_inode;
@@ -803,7 +820,7 @@ static const struct file_operations tux_file_fops = {
#endif
.mmap = generic_file_mmap,
.open = generic_file_open,
-// .fsync = file_fsync,
+ .fsync = tux3_sync_file,
.splice_read = generic_file_splice_read,
.splice_write = tux3_file_splice_write,
};
diff --git a/fs/tux3/namei.c b/fs/tux3/namei.c
index 4d3abd1200b264..53cbe7dfe36b07 100644
--- a/fs/tux3/namei.c
+++ b/fs/tux3/namei.c
@@ -340,6 +340,7 @@ const struct file_operations tux_dir_fops = {
.llseek = generic_file_llseek,
.read = generic_read_dir,
.readdir = tux_readdir,
+ .fsync = tux3_sync_file,
};
const struct inode_operations tux_dir_iops = {
diff --git a/fs/tux3/tux3.h b/fs/tux3/tux3.h
index 65b6de47654131..ff615dcd5f4f1c 100644
--- a/fs/tux3/tux3.h
+++ b/fs/tux3/tux3.h
@@ -632,6 +632,7 @@ extern const struct address_space_operations tux_blk_aops;
extern const struct address_space_operations tux_vol_aops;
/* inode.c */
+int tux3_sync_file(struct file *file, loff_t start, loff_t end, int datasync);
int tux3_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat);
int tux3_setattr(struct dentry *dentry, struct iattr *iattr);