GFS2: Move gfs2_file_splice_write outside of #ifdef
[linux-2.6-block.git] / fs / gfs2 / file.c
index ec9c2d33477a848d88ba2a60d9a206efea44fd31..7353c0a01a1e2e51c6f37e6ba60a326e56dffe74 100644 (file)
@@ -654,7 +654,7 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
 {
        struct address_space *mapping = file->f_mapping;
        struct inode *inode = mapping->host;
-       int sync_state = inode->i_state & I_DIRTY;
+       int sync_state = inode->i_state & I_DIRTY_ALL;
        struct gfs2_inode *ip = GFS2_I(inode);
        int ret = 0, ret1 = 0;
 
@@ -667,7 +667,7 @@ static int gfs2_fsync(struct file *file, loff_t start, loff_t end,
        if (!gfs2_is_jdata(ip))
                sync_state &= ~I_DIRTY_PAGES;
        if (datasync)
-               sync_state &= ~I_DIRTY_SYNC;
+               sync_state &= ~(I_DIRTY_SYNC | I_DIRTY_TIME);
 
        if (sync_state) {
                ret = sync_inode_metadata(inode, 1);
@@ -931,6 +931,22 @@ out_uninit:
        return ret;
 }
 
+static ssize_t gfs2_file_splice_write(struct pipe_inode_info *pipe,
+                                     struct file *out, loff_t *ppos,
+                                     size_t len, unsigned int flags)
+{
+       int error;
+       struct gfs2_inode *ip = GFS2_I(out->f_mapping->host);
+
+       error = gfs2_rs_alloc(ip);
+       if (error)
+               return (ssize_t)error;
+
+       gfs2_size_hint(out, *ppos, len);
+
+       return iter_file_splice_write(pipe, out, ppos, len, flags);
+}
+
 #ifdef CONFIG_GFS2_FS_LOCKING_DLM
 
 /**
@@ -1077,7 +1093,7 @@ const struct file_operations gfs2_file_fops = {
        .lock           = gfs2_lock,
        .flock          = gfs2_flock,
        .splice_read    = generic_file_splice_read,
-       .splice_write   = iter_file_splice_write,
+       .splice_write   = gfs2_file_splice_write,
        .setlease       = simple_nosetlease,
        .fallocate      = gfs2_fallocate,
 };
@@ -1107,7 +1123,7 @@ const struct file_operations gfs2_file_fops_nolock = {
        .release        = gfs2_release,
        .fsync          = gfs2_fsync,
        .splice_read    = generic_file_splice_read,
-       .splice_write   = iter_file_splice_write,
+       .splice_write   = gfs2_file_splice_write,
        .setlease       = generic_setlease,
        .fallocate      = gfs2_fallocate,
 };