diff options
-rw-r--r-- | fs/9p/vfs_super.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index f3eed3383e4f..acdc26593e64 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -307,6 +307,51 @@ static int v9fs_drop_inode(struct inode *inode) | |||
307 | return 1; | 307 | return 1; |
308 | } | 308 | } |
309 | 309 | ||
310 | static int v9fs_write_inode(struct inode *inode, | ||
311 | struct writeback_control *wbc) | ||
312 | { | ||
313 | int ret; | ||
314 | struct p9_wstat wstat; | ||
315 | struct v9fs_inode *v9inode; | ||
316 | /* | ||
317 | * send an fsync request to server irrespective of | ||
318 | * wbc->sync_mode. | ||
319 | */ | ||
320 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
321 | v9inode = V9FS_I(inode); | ||
322 | if (!v9inode->writeback_fid) | ||
323 | return 0; | ||
324 | v9fs_blank_wstat(&wstat); | ||
325 | |||
326 | ret = p9_client_wstat(v9inode->writeback_fid, &wstat); | ||
327 | if (ret < 0) { | ||
328 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
329 | return ret; | ||
330 | } | ||
331 | return 0; | ||
332 | } | ||
333 | |||
334 | static int v9fs_write_inode_dotl(struct inode *inode, | ||
335 | struct writeback_control *wbc) | ||
336 | { | ||
337 | int ret; | ||
338 | struct v9fs_inode *v9inode; | ||
339 | /* | ||
340 | * send an fsync request to server irrespective of | ||
341 | * wbc->sync_mode. | ||
342 | */ | ||
343 | P9_DPRINTK(P9_DEBUG_VFS, "%s: inode %p\n", __func__, inode); | ||
344 | v9inode = V9FS_I(inode); | ||
345 | if (!v9inode->writeback_fid) | ||
346 | return 0; | ||
347 | ret = p9_client_fsync(v9inode->writeback_fid, 0); | ||
348 | if (ret < 0) { | ||
349 | __mark_inode_dirty(inode, I_DIRTY_DATASYNC); | ||
350 | return ret; | ||
351 | } | ||
352 | return 0; | ||
353 | } | ||
354 | |||
310 | static const struct super_operations v9fs_super_ops = { | 355 | static const struct super_operations v9fs_super_ops = { |
311 | .alloc_inode = v9fs_alloc_inode, | 356 | .alloc_inode = v9fs_alloc_inode, |
312 | .destroy_inode = v9fs_destroy_inode, | 357 | .destroy_inode = v9fs_destroy_inode, |
@@ -314,6 +359,7 @@ static const struct super_operations v9fs_super_ops = { | |||
314 | .evict_inode = v9fs_evict_inode, | 359 | .evict_inode = v9fs_evict_inode, |
315 | .show_options = generic_show_options, | 360 | .show_options = generic_show_options, |
316 | .umount_begin = v9fs_umount_begin, | 361 | .umount_begin = v9fs_umount_begin, |
362 | .write_inode = v9fs_write_inode, | ||
317 | }; | 363 | }; |
318 | 364 | ||
319 | static const struct super_operations v9fs_super_ops_dotl = { | 365 | static const struct super_operations v9fs_super_ops_dotl = { |
@@ -325,6 +371,7 @@ static const struct super_operations v9fs_super_ops_dotl = { | |||
325 | .evict_inode = v9fs_evict_inode, | 371 | .evict_inode = v9fs_evict_inode, |
326 | .show_options = generic_show_options, | 372 | .show_options = generic_show_options, |
327 | .umount_begin = v9fs_umount_begin, | 373 | .umount_begin = v9fs_umount_begin, |
374 | .write_inode = v9fs_write_inode_dotl, | ||
328 | }; | 375 | }; |
329 | 376 | ||
330 | struct file_system_type v9fs_fs_type = { | 377 | struct file_system_type v9fs_fs_type = { |