diff options
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/dir.c | 10 | ||||
-rw-r--r-- | fs/f2fs/f2fs.h | 1 | ||||
-rw-r--r-- | fs/f2fs/inode.c | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index d900c088c7c6..b4e24f32b54e 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -256,13 +256,16 @@ void f2fs_set_link(struct inode *dir, struct f2fs_dir_entry *de, | |||
256 | set_page_dirty(page); | 256 | set_page_dirty(page); |
257 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; | 257 | dir->i_mtime = dir->i_ctime = CURRENT_TIME; |
258 | mark_inode_dirty(dir); | 258 | mark_inode_dirty(dir); |
259 | |||
260 | /* update parent inode number before releasing dentry page */ | ||
261 | F2FS_I(inode)->i_pino = dir->i_ino; | ||
262 | |||
259 | f2fs_put_page(page, 1); | 263 | f2fs_put_page(page, 1); |
260 | mutex_unlock_op(sbi, DENTRY_OPS); | 264 | mutex_unlock_op(sbi, DENTRY_OPS); |
261 | } | 265 | } |
262 | 266 | ||
263 | void init_dent_inode(struct dentry *dentry, struct page *ipage) | 267 | void init_dent_inode(struct dentry *dentry, struct page *ipage) |
264 | { | 268 | { |
265 | struct inode *dir = dentry->d_parent->d_inode; | ||
266 | struct f2fs_node *rn; | 269 | struct f2fs_node *rn; |
267 | 270 | ||
268 | if (IS_ERR(ipage)) | 271 | if (IS_ERR(ipage)) |
@@ -272,7 +275,6 @@ void init_dent_inode(struct dentry *dentry, struct page *ipage) | |||
272 | 275 | ||
273 | /* copy dentry info. to this inode page */ | 276 | /* copy dentry info. to this inode page */ |
274 | rn = (struct f2fs_node *)page_address(ipage); | 277 | rn = (struct f2fs_node *)page_address(ipage); |
275 | rn->i.i_pino = cpu_to_le32(dir->i_ino); | ||
276 | rn->i.i_namelen = cpu_to_le32(dentry->d_name.len); | 278 | rn->i.i_namelen = cpu_to_le32(dentry->d_name.len); |
277 | memcpy(rn->i.i_name, dentry->d_name.name, dentry->d_name.len); | 279 | memcpy(rn->i.i_name, dentry->d_name.name, dentry->d_name.len); |
278 | set_page_dirty(ipage); | 280 | set_page_dirty(ipage); |
@@ -444,7 +446,11 @@ add_dentry: | |||
444 | for (i = 0; i < slots; i++) | 446 | for (i = 0; i < slots; i++) |
445 | test_and_set_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap); | 447 | test_and_set_bit_le(bit_pos + i, &dentry_blk->dentry_bitmap); |
446 | set_page_dirty(dentry_page); | 448 | set_page_dirty(dentry_page); |
449 | |||
447 | update_parent_metadata(dir, inode, current_depth); | 450 | update_parent_metadata(dir, inode, current_depth); |
451 | |||
452 | /* update parent inode number before releasing dentry page */ | ||
453 | F2FS_I(inode)->i_pino = dir->i_ino; | ||
448 | fail: | 454 | fail: |
449 | kunmap(dentry_page); | 455 | kunmap(dentry_page); |
450 | f2fs_put_page(dentry_page, 1); | 456 | f2fs_put_page(dentry_page, 1); |
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 2bce3a62c0ba..a18d63db2fb6 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h | |||
@@ -136,6 +136,7 @@ struct f2fs_inode_info { | |||
136 | unsigned long i_flags; /* keep an inode flags for ioctl */ | 136 | unsigned long i_flags; /* keep an inode flags for ioctl */ |
137 | unsigned char i_advise; /* use to give file attribute hints */ | 137 | unsigned char i_advise; /* use to give file attribute hints */ |
138 | unsigned int i_current_depth; /* use only in directory structure */ | 138 | unsigned int i_current_depth; /* use only in directory structure */ |
139 | unsigned int i_pino; /* parent inode number */ | ||
139 | umode_t i_acl_mode; /* keep file acl mode temporarily */ | 140 | umode_t i_acl_mode; /* keep file acl mode temporarily */ |
140 | 141 | ||
141 | /* Use below internally in f2fs*/ | 142 | /* Use below internally in f2fs*/ |
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index aa4ef4f48ffd..df5fb381ebf1 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c | |||
@@ -107,6 +107,7 @@ static int do_read_inode(struct inode *inode) | |||
107 | fi->flags = 0; | 107 | fi->flags = 0; |
108 | fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1; | 108 | fi->data_version = le64_to_cpu(F2FS_CKPT(sbi)->checkpoint_ver) - 1; |
109 | fi->i_advise = ri->i_advise; | 109 | fi->i_advise = ri->i_advise; |
110 | fi->i_pino = le32_to_cpu(ri->i_pino); | ||
110 | get_extent_info(&fi->ext, ri->i_ext); | 111 | get_extent_info(&fi->ext, ri->i_ext); |
111 | f2fs_put_page(node_page, 1); | 112 | f2fs_put_page(node_page, 1); |
112 | return 0; | 113 | return 0; |
@@ -200,6 +201,7 @@ void update_inode(struct inode *inode, struct page *node_page) | |||
200 | ri->i_current_depth = cpu_to_le32(F2FS_I(inode)->i_current_depth); | 201 | ri->i_current_depth = cpu_to_le32(F2FS_I(inode)->i_current_depth); |
201 | ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid); | 202 | ri->i_xattr_nid = cpu_to_le32(F2FS_I(inode)->i_xattr_nid); |
202 | ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); | 203 | ri->i_flags = cpu_to_le32(F2FS_I(inode)->i_flags); |
204 | ri->i_pino = cpu_to_le32(F2FS_I(inode)->i_pino); | ||
203 | ri->i_generation = cpu_to_le32(inode->i_generation); | 205 | ri->i_generation = cpu_to_le32(inode->i_generation); |
204 | set_page_dirty(node_page); | 206 | set_page_dirty(node_page); |
205 | } | 207 | } |