Commit 3f49ad65 authored by Anton Altaparmakov's avatar Anton Altaparmakov

NTFS: Change ntfs_write_inode to return 0 on success and -errno on error

      and create a wrapper ntfs_write_inode_vfs that does not have a
      return value and use the wrapper for the VFS super_operations
      write_inode function.
Signed-off-by: default avatarAnton Altaparmakov <aia21@cantab.net>
parent d629b96b
......@@ -2314,8 +2314,10 @@ int ntfs_setattr(struct dentry *dentry, struct iattr *attr)
* marking the page (and in this case mft record) dirty but we do not implement
* this yet as write_mft_record() largely ignores the @sync parameter and
* always performs synchronous writes.
*
* Return 0 on success and -errno on error.
*/
void ntfs_write_inode(struct inode *vi, int sync)
int ntfs_write_inode(struct inode *vi, int sync)
{
ntfs_inode *ni = NTFS_I(vi);
#if 0
......@@ -2332,7 +2334,7 @@ void ntfs_write_inode(struct inode *vi, int sync)
*/
if (NInoAttr(ni)) {
NInoClearDirty(ni);
return;
return 0;
}
/* Map, pin, and lock the mft record belonging to the inode. */
m = map_mft_record(ni);
......@@ -2410,7 +2412,7 @@ void ntfs_write_inode(struct inode *vi, int sync)
if (unlikely(err))
goto err_out;
ntfs_debug("Done.");
return;
return 0;
#if 0
unm_err_out:
unmap_mft_record(ni);
......@@ -2426,7 +2428,31 @@ void ntfs_write_inode(struct inode *vi, int sync)
"as bad. You should run chkdsk.", -err);
make_bad_inode(vi);
}
return;
return err;
}
/**
* ntfs_write_inode_vfs - write out a dirty inode
* @vi: inode to write out
* @sync: if true, write out synchronously
*
* Write out a dirty inode to disk including any extent inodes if present.
*
* If @sync is true, commit the inode to disk and wait for io completion. This
* is done using write_mft_record().
*
* If @sync is false, just schedule the write to happen but do not wait for i/o
* completion. In 2.6 kernels, scheduling usually happens just by virtue of
* marking the page (and in this case mft record) dirty but we do not implement
* this yet as write_mft_record() largely ignores the @sync parameter and
* always performs synchronous writes.
*
* This functions does not have a return value which is the required behaviour
* for the VFS super_operations ->dirty_inode function.
*/
void ntfs_write_inode_vfs(struct inode *vi, int sync)
{
ntfs_write_inode(vi, sync);
}
#endif /* NTFS_RW */
......@@ -285,7 +285,8 @@ extern void ntfs_truncate(struct inode *vi);
extern int ntfs_setattr(struct dentry *dentry, struct iattr *attr);
extern void ntfs_write_inode(struct inode *vi, int sync);
extern int ntfs_write_inode(struct inode *vi, int sync);
extern void ntfs_write_inode_vfs(struct inode *vi, int sync);
static inline void ntfs_commit_inode(struct inode *vi)
{
......
......@@ -2050,7 +2050,7 @@ struct super_operations ntfs_sops = {
#ifdef NTFS_RW
//.dirty_inode = NULL, /* VFS: Called from
// __mark_inode_dirty(). */
.write_inode = ntfs_write_inode, /* VFS: Write dirty inode to
.write_inode = ntfs_write_inode_vfs, /* VFS: Write dirty inode to
disk. */
//.drop_inode = NULL, /* VFS: Called just after the
// inode reference count has
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment