inode.c (b3fdfc1b4b641d372e35ced98814289bc60bc5d1) | inode.c (3843154598a00408f4214a68bd536fdf27b1df10) |
---|---|
1/* 2 * fs/f2fs/inode.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 --- 93 unchanged lines hidden (view full) --- 102 inode->i_generation = le32_to_cpu(ri->i_generation); 103 104 fi->i_current_depth = le32_to_cpu(ri->i_current_depth); 105 fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid); 106 fi->i_flags = le32_to_cpu(ri->i_flags); 107 fi->flags = 0; 108 fi->i_advise = ri->i_advise; 109 fi->i_pino = le32_to_cpu(ri->i_pino); | 1/* 2 * fs/f2fs/inode.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 --- 93 unchanged lines hidden (view full) --- 102 inode->i_generation = le32_to_cpu(ri->i_generation); 103 104 fi->i_current_depth = le32_to_cpu(ri->i_current_depth); 105 fi->i_xattr_nid = le32_to_cpu(ri->i_xattr_nid); 106 fi->i_flags = le32_to_cpu(ri->i_flags); 107 fi->flags = 0; 108 fi->i_advise = ri->i_advise; 109 fi->i_pino = le32_to_cpu(ri->i_pino); |
110 fi->i_dir_level = ri->i_dir_level; |
|
110 111 get_extent_info(&fi->ext, ri->i_ext); 112 get_inline_info(fi, ri); 113 114 /* get rdev by using inline_info */ 115 __get_inode_rdev(inode, ri); 116 117 f2fs_put_page(node_page, 1); --- 81 unchanged lines hidden (view full) --- 199 ri->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 200 ri->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 201 ri->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 202 ri->i_current_depth = cpu_to_le32(F2FS_I(inode)->i_current_depth); 203 ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid); 204 ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); 205 ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino); 206 ri->i_generation = cpu_to_le32(inode->i_generation); | 111 112 get_extent_info(&fi->ext, ri->i_ext); 113 get_inline_info(fi, ri); 114 115 /* get rdev by using inline_info */ 116 __get_inode_rdev(inode, ri); 117 118 f2fs_put_page(node_page, 1); --- 81 unchanged lines hidden (view full) --- 200 ri->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec); 201 ri->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); 202 ri->i_mtime_nsec = cpu_to_le32(inode->i_mtime.tv_nsec); 203 ri->i_current_depth = cpu_to_le32(F2FS_I(inode)->i_current_depth); 204 ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid); 205 ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); 206 ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino); 207 ri->i_generation = cpu_to_le32(inode->i_generation); |
208 ri->i_dir_level = F2FS_I(inode)->i_dir_level; |
|
207 208 __set_inode_rdev(inode, ri); 209 set_cold_node(inode, node_page); 210 set_page_dirty(node_page); 211 212 clear_inode_flag(F2FS_I(inode), FI_DIRTY_INODE); 213} 214 | 209 210 __set_inode_rdev(inode, ri); 211 set_cold_node(inode, node_page); 212 set_page_dirty(node_page); 213 214 clear_inode_flag(F2FS_I(inode), FI_DIRTY_INODE); 215} 216 |
215int update_inode_page(struct inode *inode) | 217void update_inode_page(struct inode *inode) |
216{ 217 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 218 struct page *node_page; | 218{ 219 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); 220 struct page *node_page; |
219 | 221retry: |
220 node_page = get_node_page(sbi, inode->i_ino); | 222 node_page = get_node_page(sbi, inode->i_ino); |
221 if (IS_ERR(node_page)) 222 return PTR_ERR(node_page); 223 | 223 if (IS_ERR(node_page)) { 224 int err = PTR_ERR(node_page); 225 if (err == -ENOMEM) { 226 cond_resched(); 227 goto retry; 228 } else if (err != -ENOENT) { 229 f2fs_stop_checkpoint(sbi); 230 } 231 return; 232 } |
224 update_inode(inode, node_page); 225 f2fs_put_page(node_page, 1); | 233 update_inode(inode, node_page); 234 f2fs_put_page(node_page, 1); |
226 return 0; | |
227} 228 229int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) 230{ 231 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); | 235} 236 237int f2fs_write_inode(struct inode *inode, struct writeback_control *wbc) 238{ 239 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); |
232 int ret; | |
233 234 if (inode->i_ino == F2FS_NODE_INO(sbi) || 235 inode->i_ino == F2FS_META_INO(sbi)) 236 return 0; 237 238 if (!is_inode_flag_set(F2FS_I(inode), FI_DIRTY_INODE)) 239 return 0; 240 241 /* 242 * We need to lock here to prevent from producing dirty node pages 243 * during the urgent cleaning time when runing out of free sections. 244 */ 245 f2fs_lock_op(sbi); | 240 241 if (inode->i_ino == F2FS_NODE_INO(sbi) || 242 inode->i_ino == F2FS_META_INO(sbi)) 243 return 0; 244 245 if (!is_inode_flag_set(F2FS_I(inode), FI_DIRTY_INODE)) 246 return 0; 247 248 /* 249 * We need to lock here to prevent from producing dirty node pages 250 * during the urgent cleaning time when runing out of free sections. 251 */ 252 f2fs_lock_op(sbi); |
246 ret = update_inode_page(inode); | 253 update_inode_page(inode); |
247 f2fs_unlock_op(sbi); 248 249 if (wbc) 250 f2fs_balance_fs(sbi); 251 | 254 f2fs_unlock_op(sbi); 255 256 if (wbc) 257 f2fs_balance_fs(sbi); 258 |
252 return ret; | 259 return 0; |
253} 254 255/* 256 * Called at the last iput() if i_nlink is zero 257 */ 258void f2fs_evict_inode(struct inode *inode) 259{ 260 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); --- 30 unchanged lines hidden --- | 260} 261 262/* 263 * Called at the last iput() if i_nlink is zero 264 */ 265void f2fs_evict_inode(struct inode *inode) 266{ 267 struct f2fs_sb_info *sbi = F2FS_SB(inode->i_sb); --- 30 unchanged lines hidden --- |