diff options
| author | Christoph Hellwig <hch@lst.de> | 2010-10-06 04:48:20 -0400 |
|---|---|---|
| committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-10-25 21:18:19 -0400 |
| commit | c37650161a53c01ddd88587675f9a4adc909a73e (patch) | |
| tree | 85821998de9a6723dedc42488b9491db9692d1e3 /fs/fs-writeback.c | |
| parent | 81fca444001e5a41ab80ce8cf9a5734c00ec6546 (diff) | |
fs: add sync_inode_metadata
Add a new helper to write out the inode using the writeback code,
that is including the correct dirty bit and list manipulation. A few
of filesystems already opencode this, and a lot of others should be
using it instead of using write_inode_now which also writes out the
data.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index ab38fef1c9a1..29e3f409bbd0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -1198,3 +1198,23 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 1198 | return ret; | 1198 | return ret; |
| 1199 | } | 1199 | } |
| 1200 | EXPORT_SYMBOL(sync_inode); | 1200 | EXPORT_SYMBOL(sync_inode); |
| 1201 | |||
| 1202 | /** | ||
| 1203 | * sync_inode - write an inode to disk | ||
| 1204 | * @inode: the inode to sync | ||
| 1205 | * @wait: wait for I/O to complete. | ||
| 1206 | * | ||
| 1207 | * Write an inode to disk and adjust it's dirty state after completion. | ||
| 1208 | * | ||
| 1209 | * Note: only writes the actual inode, no associated data or other metadata. | ||
| 1210 | */ | ||
| 1211 | int sync_inode_metadata(struct inode *inode, int wait) | ||
| 1212 | { | ||
| 1213 | struct writeback_control wbc = { | ||
| 1214 | .sync_mode = wait ? WB_SYNC_ALL : WB_SYNC_NONE, | ||
| 1215 | .nr_to_write = 0, /* metadata-only */ | ||
| 1216 | }; | ||
| 1217 | |||
| 1218 | return sync_inode(inode, &wbc); | ||
| 1219 | } | ||
| 1220 | EXPORT_SYMBOL(sync_inode_metadata); | ||
