hpfs: move setting hpfs-private i_dirty to ->write_end()
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Mar 2013 00:35:00 +0000 (20:35 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Apr 2013 18:12:55 +0000 (14:12 -0400)
... so that writev(2) doesn't miss it.  Get rid of hpfs_file_write().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/hpfs/file.c

index 9f9dbec..3027f4d 100644 (file)
@@ -131,6 +131,24 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping,
        return ret;
 }
 
+static int hpfs_write_end(struct file *file, struct address_space *mapping,
+                       loff_t pos, unsigned len, unsigned copied,
+                       struct page *pagep, void *fsdata)
+{
+       struct inode *inode = mapping->host;
+       int err;
+       err = generic_write_end(file, mapping, pos, len, copied, pagep, fsdata);
+       if (err < len)
+               hpfs_write_failed(mapping, pos + len);
+       if (!(err < 0)) {
+               /* make sure we write it on close, if not earlier */
+               hpfs_lock(inode->i_sb);
+               hpfs_i(inode)->i_dirty = 1;
+               hpfs_unlock(inode->i_sb);
+       }
+       return err;
+}
+
 static sector_t _hpfs_bmap(struct address_space *mapping, sector_t block)
 {
        return generic_block_bmap(mapping,block,hpfs_get_block);
@@ -140,30 +158,16 @@ const struct address_space_operations hpfs_aops = {
        .readpage = hpfs_readpage,
        .writepage = hpfs_writepage,
        .write_begin = hpfs_write_begin,
-       .write_end = generic_write_end,
+       .write_end = hpfs_write_end,
        .bmap = _hpfs_bmap
 };
 
-static ssize_t hpfs_file_write(struct file *file, const char __user *buf,
-                       size_t count, loff_t *ppos)
-{
-       ssize_t retval;
-
-       retval = do_sync_write(file, buf, count, ppos);
-       if (retval > 0) {
-               hpfs_lock(file->f_path.dentry->d_sb);
-               hpfs_i(file_inode(file))->i_dirty = 1;
-               hpfs_unlock(file->f_path.dentry->d_sb);
-       }
-       return retval;
-}
-
 const struct file_operations hpfs_file_ops =
 {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
        .aio_read       = generic_file_aio_read,
-       .write          = hpfs_file_write,
+       .write          = do_sync_write,
        .aio_write      = generic_file_aio_write,
        .mmap           = generic_file_mmap,
        .release        = hpfs_file_release,