Skip to content

Commit

Permalink
hpfs: move setting hpfs-private i_dirty to ->write_end()
Browse files Browse the repository at this point in the history
... so that writev(2) doesn't miss it.  Get rid of hpfs_file_write().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Apr 9, 2013
1 parent d5daaaf commit 5f2e354
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions fs/hpfs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down

0 comments on commit 5f2e354

Please sign in to comment.