diff options
author | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-05-16 02:04:49 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-05-28 02:03:02 -0400 |
commit | f356fe0cba0e3523e538987916bd2acedd4e6f41 (patch) | |
tree | 12b34452cd5e5886c90f6739d20b3a18f289ba79 /fs/f2fs/recovery.c | |
parent | 44a83ff6a81d84ab83bcb43a49ff1ba6c7e17cd1 (diff) |
f2fs: add debug msgs in the recovery routine
This patch adds some trivial debugging messages in the recovery process.
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs/recovery.c')
-rw-r--r-- | fs/f2fs/recovery.c | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c index 23f580397e6c..6ad4e539c60a 100644 --- a/fs/f2fs/recovery.c +++ b/fs/f2fs/recovery.c | |||
@@ -49,9 +49,6 @@ static int recover_dentry(struct page *ipage, struct inode *inode) | |||
49 | struct inode *dir; | 49 | struct inode *dir; |
50 | int err = 0; | 50 | int err = 0; |
51 | 51 | ||
52 | if (!is_dent_dnode(ipage)) | ||
53 | goto out; | ||
54 | |||
55 | dir = check_dirty_dir_inode(F2FS_SB(inode->i_sb), pino); | 52 | dir = check_dirty_dir_inode(F2FS_SB(inode->i_sb), pino); |
56 | if (!dir) { | 53 | if (!dir) { |
57 | dir = f2fs_iget(inode->i_sb, pino); | 54 | dir = f2fs_iget(inode->i_sb, pino); |
@@ -73,6 +70,9 @@ static int recover_dentry(struct page *ipage, struct inode *inode) | |||
73 | err = __f2fs_add_link(dir, &name, inode); | 70 | err = __f2fs_add_link(dir, &name, inode); |
74 | } | 71 | } |
75 | out: | 72 | out: |
73 | f2fs_msg(inode->i_sb, KERN_NOTICE, "recover_inode and its dentry: " | ||
74 | "ino = %x, name = %s, dir = %lx, err = %d", | ||
75 | ino_of_node(ipage), raw_inode->i_name, dir->i_ino, err); | ||
76 | kunmap(ipage); | 76 | kunmap(ipage); |
77 | return err; | 77 | return err; |
78 | } | 78 | } |
@@ -83,6 +83,9 @@ static int recover_inode(struct inode *inode, struct page *node_page) | |||
83 | struct f2fs_node *raw_node = (struct f2fs_node *)kaddr; | 83 | struct f2fs_node *raw_node = (struct f2fs_node *)kaddr; |
84 | struct f2fs_inode *raw_inode = &(raw_node->i); | 84 | struct f2fs_inode *raw_inode = &(raw_node->i); |
85 | 85 | ||
86 | if (!IS_INODE(node_page)) | ||
87 | return 0; | ||
88 | |||
86 | inode->i_mode = le16_to_cpu(raw_inode->i_mode); | 89 | inode->i_mode = le16_to_cpu(raw_inode->i_mode); |
87 | i_size_write(inode, le64_to_cpu(raw_inode->i_size)); | 90 | i_size_write(inode, le64_to_cpu(raw_inode->i_size)); |
88 | inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime); | 91 | inode->i_atime.tv_sec = le64_to_cpu(raw_inode->i_mtime); |
@@ -92,7 +95,12 @@ static int recover_inode(struct inode *inode, struct page *node_page) | |||
92 | inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); | 95 | inode->i_ctime.tv_nsec = le32_to_cpu(raw_inode->i_ctime_nsec); |
93 | inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); | 96 | inode->i_mtime.tv_nsec = le32_to_cpu(raw_inode->i_mtime_nsec); |
94 | 97 | ||
95 | return recover_dentry(node_page, inode); | 98 | if (is_dent_dnode(node_page)) |
99 | return recover_dentry(node_page, inode); | ||
100 | |||
101 | f2fs_msg(inode->i_sb, KERN_NOTICE, "recover_inode: ino = %x, name = %s", | ||
102 | ino_of_node(node_page), raw_inode->i_name); | ||
103 | return 0; | ||
96 | } | 104 | } |
97 | 105 | ||
98 | static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) | 106 | static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) |
@@ -123,7 +131,7 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) | |||
123 | lock_page(page); | 131 | lock_page(page); |
124 | 132 | ||
125 | if (cp_ver != cpver_of_node(page)) | 133 | if (cp_ver != cpver_of_node(page)) |
126 | goto unlock_out; | 134 | break; |
127 | 135 | ||
128 | if (!is_fsync_dnode(page)) | 136 | if (!is_fsync_dnode(page)) |
129 | goto next; | 137 | goto next; |
@@ -137,40 +145,33 @@ static int find_fsync_dnodes(struct f2fs_sb_info *sbi, struct list_head *head) | |||
137 | if (IS_INODE(page) && is_dent_dnode(page)) { | 145 | if (IS_INODE(page) && is_dent_dnode(page)) { |
138 | err = recover_inode_page(sbi, page); | 146 | err = recover_inode_page(sbi, page); |
139 | if (err) | 147 | if (err) |
140 | goto unlock_out; | 148 | break; |
141 | } | 149 | } |
142 | 150 | ||
143 | /* add this fsync inode to the list */ | 151 | /* add this fsync inode to the list */ |
144 | entry = kmem_cache_alloc(fsync_entry_slab, GFP_NOFS); | 152 | entry = kmem_cache_alloc(fsync_entry_slab, GFP_NOFS); |
145 | if (!entry) { | 153 | if (!entry) { |
146 | err = -ENOMEM; | 154 | err = -ENOMEM; |
147 | goto unlock_out; | 155 | break; |
148 | } | 156 | } |
149 | 157 | ||
150 | entry->inode = f2fs_iget(sbi->sb, ino_of_node(page)); | 158 | entry->inode = f2fs_iget(sbi->sb, ino_of_node(page)); |
151 | if (IS_ERR(entry->inode)) { | 159 | if (IS_ERR(entry->inode)) { |
152 | err = PTR_ERR(entry->inode); | 160 | err = PTR_ERR(entry->inode); |
153 | kmem_cache_free(fsync_entry_slab, entry); | 161 | kmem_cache_free(fsync_entry_slab, entry); |
154 | goto unlock_out; | 162 | break; |
155 | } | 163 | } |
156 | list_add_tail(&entry->list, head); | 164 | list_add_tail(&entry->list, head); |
157 | } | 165 | } |
158 | entry->blkaddr = blkaddr; | 166 | entry->blkaddr = blkaddr; |
159 | 167 | ||
160 | if (IS_INODE(page)) { | 168 | err = recover_inode(entry->inode, page); |
161 | err = recover_inode(entry->inode, page); | 169 | if (err && err != -ENOENT) |
162 | if (err == -ENOENT) { | 170 | break; |
163 | goto next; | ||
164 | } else if (err) { | ||
165 | err = -EINVAL; | ||
166 | goto unlock_out; | ||
167 | } | ||
168 | } | ||
169 | next: | 171 | next: |
170 | /* check next segment */ | 172 | /* check next segment */ |
171 | blkaddr = next_blkaddr_of_node(page); | 173 | blkaddr = next_blkaddr_of_node(page); |
172 | } | 174 | } |
173 | unlock_out: | ||
174 | unlock_page(page); | 175 | unlock_page(page); |
175 | out: | 176 | out: |
176 | __free_pages(page, 0); | 177 | __free_pages(page, 0); |
@@ -248,7 +249,7 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
248 | struct dnode_of_data dn; | 249 | struct dnode_of_data dn; |
249 | struct f2fs_summary sum; | 250 | struct f2fs_summary sum; |
250 | struct node_info ni; | 251 | struct node_info ni; |
251 | int err = 0; | 252 | int err = 0, recovered = 0; |
252 | int ilock; | 253 | int ilock; |
253 | 254 | ||
254 | start = start_bidx_of_node(ofs_of_node(page)); | 255 | start = start_bidx_of_node(ofs_of_node(page)); |
@@ -293,6 +294,7 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
293 | /* write dummy data page */ | 294 | /* write dummy data page */ |
294 | recover_data_page(sbi, NULL, &sum, src, dest); | 295 | recover_data_page(sbi, NULL, &sum, src, dest); |
295 | update_extent_cache(dest, &dn); | 296 | update_extent_cache(dest, &dn); |
297 | recovered++; | ||
296 | } | 298 | } |
297 | dn.ofs_in_node++; | 299 | dn.ofs_in_node++; |
298 | } | 300 | } |
@@ -310,6 +312,10 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode, | |||
310 | recover_node_page(sbi, dn.node_page, &sum, &ni, blkaddr); | 312 | recover_node_page(sbi, dn.node_page, &sum, &ni, blkaddr); |
311 | f2fs_put_dnode(&dn); | 313 | f2fs_put_dnode(&dn); |
312 | mutex_unlock_op(sbi, ilock); | 314 | mutex_unlock_op(sbi, ilock); |
315 | |||
316 | f2fs_msg(sbi->sb, KERN_NOTICE, "recover_data: ino = %lx, " | ||
317 | "recovered_data = %d blocks", | ||
318 | inode->i_ino, recovered); | ||
313 | return 0; | 319 | return 0; |
314 | } | 320 | } |
315 | 321 | ||