diff options
Diffstat (limited to 'fs/fs-writeback.c')
| -rw-r--r-- | fs/fs-writeback.c | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index da86ef58e427..628235cf44b5 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
| @@ -1242,57 +1242,3 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc) | |||
| 1242 | return ret; | 1242 | return ret; |
| 1243 | } | 1243 | } |
| 1244 | EXPORT_SYMBOL(sync_inode); | 1244 | EXPORT_SYMBOL(sync_inode); |
| 1245 | |||
| 1246 | /** | ||
| 1247 | * generic_osync_inode - flush all dirty data for a given inode to disk | ||
| 1248 | * @inode: inode to write | ||
| 1249 | * @mapping: the address_space that should be flushed | ||
| 1250 | * @what: what to write and wait upon | ||
| 1251 | * | ||
| 1252 | * This can be called by file_write functions for files which have the | ||
| 1253 | * O_SYNC flag set, to flush dirty writes to disk. | ||
| 1254 | * | ||
| 1255 | * @what is a bitmask, specifying which part of the inode's data should be | ||
| 1256 | * written and waited upon. | ||
| 1257 | * | ||
| 1258 | * OSYNC_DATA: i_mapping's dirty data | ||
| 1259 | * OSYNC_METADATA: the buffers at i_mapping->private_list | ||
| 1260 | * OSYNC_INODE: the inode itself | ||
| 1261 | */ | ||
| 1262 | |||
| 1263 | int generic_osync_inode(struct inode *inode, struct address_space *mapping, int what) | ||
| 1264 | { | ||
| 1265 | int err = 0; | ||
| 1266 | int need_write_inode_now = 0; | ||
| 1267 | int err2; | ||
| 1268 | |||
| 1269 | if (what & OSYNC_DATA) | ||
| 1270 | err = filemap_fdatawrite(mapping); | ||
| 1271 | if (what & (OSYNC_METADATA|OSYNC_DATA)) { | ||
| 1272 | err2 = sync_mapping_buffers(mapping); | ||
| 1273 | if (!err) | ||
| 1274 | err = err2; | ||
| 1275 | } | ||
| 1276 | if (what & OSYNC_DATA) { | ||
| 1277 | err2 = filemap_fdatawait(mapping); | ||
| 1278 | if (!err) | ||
| 1279 | err = err2; | ||
| 1280 | } | ||
| 1281 | |||
| 1282 | spin_lock(&inode_lock); | ||
| 1283 | if ((inode->i_state & I_DIRTY) && | ||
| 1284 | ((what & OSYNC_INODE) || (inode->i_state & I_DIRTY_DATASYNC))) | ||
| 1285 | need_write_inode_now = 1; | ||
| 1286 | spin_unlock(&inode_lock); | ||
| 1287 | |||
| 1288 | if (need_write_inode_now) { | ||
| 1289 | err2 = write_inode_now(inode, 1); | ||
| 1290 | if (!err) | ||
| 1291 | err = err2; | ||
| 1292 | } | ||
| 1293 | else | ||
| 1294 | inode_sync_wait(inode); | ||
| 1295 | |||
| 1296 | return err; | ||
| 1297 | } | ||
| 1298 | EXPORT_SYMBOL(generic_osync_inode); | ||
