file.c (f6248dd88dba3aeb19351410a027d92eee7ceb72) | file.c (7a10f0177e117e9935ee9e5c595fcf3c57215de5) |
---|---|
1/* 2 * fs/f2fs/file.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 1481 unchanged lines hidden (view full) --- 1490 stat_dec_volatile_write(inode); 1491 set_inode_flag(inode, FI_DROP_CACHE); 1492 filemap_fdatawrite(inode->i_mapping); 1493 clear_inode_flag(inode, FI_DROP_CACHE); 1494 } 1495 return 0; 1496} 1497 | 1/* 2 * fs/f2fs/file.c 3 * 4 * Copyright (c) 2012 Samsung Electronics Co., Ltd. 5 * http://www.samsung.com/ 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 1481 unchanged lines hidden (view full) --- 1490 stat_dec_volatile_write(inode); 1491 set_inode_flag(inode, FI_DROP_CACHE); 1492 filemap_fdatawrite(inode->i_mapping); 1493 clear_inode_flag(inode, FI_DROP_CACHE); 1494 } 1495 return 0; 1496} 1497 |
1498static int f2fs_file_flush(struct file *file, fl_owner_t id) 1499{ 1500 struct inode *inode = file_inode(file); 1501 1502 /* 1503 * If the process doing a transaction is crashed, we should do 1504 * roll-back. Otherwise, other reader/write can see corrupted database 1505 * until all the writers close its file. Since this should be done 1506 * before dropping file lock, it needs to do in ->flush. 1507 */ 1508 if (f2fs_is_atomic_file(inode) && 1509 F2FS_I(inode)->inmem_task == current) 1510 drop_inmem_pages(inode); 1511 return 0; 1512} 1513 |
|
1498#define F2FS_REG_FLMASK (~(FS_DIRSYNC_FL | FS_TOPDIR_FL)) 1499#define F2FS_OTHER_FLMASK (FS_NODUMP_FL | FS_NOATIME_FL) 1500 1501static inline __u32 f2fs_mask_flags(umode_t mode, __u32 flags) 1502{ 1503 if (S_ISDIR(mode)) 1504 return flags; 1505 else if (S_ISREG(mode)) --- 103 unchanged lines hidden (view full) --- 1609 inode->i_ino, get_dirty_pages(inode)); 1610 ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); 1611 if (ret) { 1612 clear_inode_flag(inode, FI_ATOMIC_FILE); 1613 goto out; 1614 } 1615 1616inc_stat: | 1514#define F2FS_REG_FLMASK (~(FS_DIRSYNC_FL | FS_TOPDIR_FL)) 1515#define F2FS_OTHER_FLMASK (FS_NODUMP_FL | FS_NOATIME_FL) 1516 1517static inline __u32 f2fs_mask_flags(umode_t mode, __u32 flags) 1518{ 1519 if (S_ISDIR(mode)) 1520 return flags; 1521 else if (S_ISREG(mode)) --- 103 unchanged lines hidden (view full) --- 1625 inode->i_ino, get_dirty_pages(inode)); 1626 ret = filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); 1627 if (ret) { 1628 clear_inode_flag(inode, FI_ATOMIC_FILE); 1629 goto out; 1630 } 1631 1632inc_stat: |
1633 F2FS_I(inode)->inmem_task = current; |
|
1617 stat_inc_atomic_write(inode); 1618 stat_update_max_atomic_write(inode); 1619out: 1620 inode_unlock(inode); 1621 mnt_drop_write_file(filp); 1622 return ret; 1623} 1624 --- 876 unchanged lines hidden (view full) --- 2501 2502const struct file_operations f2fs_file_operations = { 2503 .llseek = f2fs_llseek, 2504 .read_iter = generic_file_read_iter, 2505 .write_iter = f2fs_file_write_iter, 2506 .open = f2fs_file_open, 2507 .release = f2fs_release_file, 2508 .mmap = f2fs_file_mmap, | 1634 stat_inc_atomic_write(inode); 1635 stat_update_max_atomic_write(inode); 1636out: 1637 inode_unlock(inode); 1638 mnt_drop_write_file(filp); 1639 return ret; 1640} 1641 --- 876 unchanged lines hidden (view full) --- 2518 2519const struct file_operations f2fs_file_operations = { 2520 .llseek = f2fs_llseek, 2521 .read_iter = generic_file_read_iter, 2522 .write_iter = f2fs_file_write_iter, 2523 .open = f2fs_file_open, 2524 .release = f2fs_release_file, 2525 .mmap = f2fs_file_mmap, |
2526 .flush = f2fs_file_flush, |
|
2509 .fsync = f2fs_sync_file, 2510 .fallocate = f2fs_fallocate, 2511 .unlocked_ioctl = f2fs_ioctl, 2512#ifdef CONFIG_COMPAT 2513 .compat_ioctl = f2fs_compat_ioctl, 2514#endif 2515 .splice_read = generic_file_splice_read, 2516 .splice_write = iter_file_splice_write, 2517}; | 2527 .fsync = f2fs_sync_file, 2528 .fallocate = f2fs_fallocate, 2529 .unlocked_ioctl = f2fs_ioctl, 2530#ifdef CONFIG_COMPAT 2531 .compat_ioctl = f2fs_compat_ioctl, 2532#endif 2533 .splice_read = generic_file_splice_read, 2534 .splice_write = iter_file_splice_write, 2535}; |