file.c (15d04354555fdfe8005e1365009e349148fb5f90) file.c (7c45729a4d6d1c90879e6c5c2df325c2f6db7191)
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

--- 250 unchanged lines hidden (view full) ---

259
260 /* if cp_error was enabled, we should avoid infinite loop */
261 if (unlikely(f2fs_cp_error(sbi))) {
262 ret = -EIO;
263 goto out;
264 }
265
266 if (need_inode_block_update(sbi, ino)) {
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

--- 250 unchanged lines hidden (view full) ---

259
260 /* if cp_error was enabled, we should avoid infinite loop */
261 if (unlikely(f2fs_cp_error(sbi))) {
262 ret = -EIO;
263 goto out;
264 }
265
266 if (need_inode_block_update(sbi, ino)) {
267 f2fs_mark_inode_dirty_sync(inode);
267 f2fs_mark_inode_dirty_sync(inode, true);
268 f2fs_write_inode(inode, NULL);
269 goto sync_nodes;
270 }
271
272 ret = wait_on_node_pages_writeback(sbi, ino);
273 if (ret)
274 goto out;
275

--- 351 unchanged lines hidden (view full) ---

627 return err;
628 }
629
630 err = truncate_blocks(inode, i_size_read(inode), true);
631 if (err)
632 return err;
633
634 inode->i_mtime = inode->i_ctime = current_time(inode);
268 f2fs_write_inode(inode, NULL);
269 goto sync_nodes;
270 }
271
272 ret = wait_on_node_pages_writeback(sbi, ino);
273 if (ret)
274 goto out;
275

--- 351 unchanged lines hidden (view full) ---

627 return err;
628 }
629
630 err = truncate_blocks(inode, i_size_read(inode), true);
631 if (err)
632 return err;
633
634 inode->i_mtime = inode->i_ctime = current_time(inode);
635 f2fs_mark_inode_dirty_sync(inode);
635 f2fs_mark_inode_dirty_sync(inode, false);
636 return 0;
637}
638
639int f2fs_getattr(struct vfsmount *mnt,
640 struct dentry *dentry, struct kstat *stat)
641{
642 struct inode *inode = d_inode(dentry);
643 generic_fillattr(inode, stat);

--- 72 unchanged lines hidden (view full) ---

716 if (attr->ia_valid & ATTR_MODE) {
717 err = posix_acl_chmod(inode, get_inode_mode(inode));
718 if (err || is_inode_flag_set(inode, FI_ACL_MODE)) {
719 inode->i_mode = F2FS_I(inode)->i_acl_mode;
720 clear_inode_flag(inode, FI_ACL_MODE);
721 }
722 }
723
636 return 0;
637}
638
639int f2fs_getattr(struct vfsmount *mnt,
640 struct dentry *dentry, struct kstat *stat)
641{
642 struct inode *inode = d_inode(dentry);
643 generic_fillattr(inode, stat);

--- 72 unchanged lines hidden (view full) ---

716 if (attr->ia_valid & ATTR_MODE) {
717 err = posix_acl_chmod(inode, get_inode_mode(inode));
718 if (err || is_inode_flag_set(inode, FI_ACL_MODE)) {
719 inode->i_mode = F2FS_I(inode)->i_acl_mode;
720 clear_inode_flag(inode, FI_ACL_MODE);
721 }
722 }
723
724 f2fs_mark_inode_dirty_sync(inode);
724 /* update attributes only */
725 f2fs_mark_inode_dirty_sync(inode, false);
725
726 /* inode change will produce dirty node pages flushed by checkpoint */
727 f2fs_balance_fs(F2FS_I_SB(inode), true);
728
729 return err;
730}
731
732const struct inode_operations f2fs_file_inode_operations = {

--- 661 unchanged lines hidden (view full) ---

1394 } else if (mode & FALLOC_FL_INSERT_RANGE) {
1395 ret = f2fs_insert_range(inode, offset, len);
1396 } else {
1397 ret = expand_inode_data(inode, offset, len, mode);
1398 }
1399
1400 if (!ret) {
1401 inode->i_mtime = inode->i_ctime = current_time(inode);
726
727 /* inode change will produce dirty node pages flushed by checkpoint */
728 f2fs_balance_fs(F2FS_I_SB(inode), true);
729
730 return err;
731}
732
733const struct inode_operations f2fs_file_inode_operations = {

--- 661 unchanged lines hidden (view full) ---

1395 } else if (mode & FALLOC_FL_INSERT_RANGE) {
1396 ret = f2fs_insert_range(inode, offset, len);
1397 } else {
1398 ret = expand_inode_data(inode, offset, len, mode);
1399 }
1400
1401 if (!ret) {
1402 inode->i_mtime = inode->i_ctime = current_time(inode);
1402 f2fs_mark_inode_dirty_sync(inode);
1403 f2fs_mark_inode_dirty_sync(inode, false);
1403 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
1404 }
1405
1406out:
1407 inode_unlock(inode);
1408
1409 trace_f2fs_fallocate(inode, mode, offset, len, ret);
1410 return ret;

--- 919 unchanged lines hidden ---
1404 f2fs_update_time(F2FS_I_SB(inode), REQ_TIME);
1405 }
1406
1407out:
1408 inode_unlock(inode);
1409
1410 trace_f2fs_fallocate(inode, mode, offset, len, ret);
1411 return ret;

--- 919 unchanged lines hidden ---