Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 377675
b: refs/heads/master
c: b292dca
h: refs/heads/master
i:
  377673: 37c82e3
  377671: bdf3099
v: v3
  • Loading branch information
Jaegeuk Kim committed May 28, 2013
1 parent f03c847 commit 1569347
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b638f0c4b8fca9d2f82805a2d6601b09283e0d32
refs/heads/master: b292dcab068e141d8a820b77cbcc88d98c610eb4
1 change: 1 addition & 0 deletions trunk/fs/f2fs/f2fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ void truncate_data_blocks(struct dnode_of_data *);
void f2fs_truncate(struct inode *);
int f2fs_setattr(struct dentry *, struct iattr *);
int truncate_hole(struct inode *, pgoff_t, pgoff_t);
int truncate_data_blocks_range(struct dnode_of_data *, int);
long f2fs_ioctl(struct file *, unsigned int, unsigned long);
long f2fs_compat_ioctl(struct file *, unsigned int, unsigned long);

Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/f2fs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int f2fs_file_mmap(struct file *file, struct vm_area_struct *vma)
return 0;
}

static int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
int truncate_data_blocks_range(struct dnode_of_data *dn, int count)
{
int nr_free = 0, ofs = dn->ofs_in_node;
struct f2fs_sb_info *sbi = F2FS_SB(dn->inode->i_sb);
Expand Down
26 changes: 21 additions & 5 deletions trunk/fs/f2fs/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ static void destroy_fsync_dnodes(struct f2fs_sb_info *sbi,
}

static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
block_t blkaddr)
block_t blkaddr, struct dnode_of_data *dn)
{
struct seg_entry *sentry;
unsigned int segno = GET_SEGNO(sbi, blkaddr);
unsigned short blkoff = GET_SEGOFF_FROM_SEG0(sbi, blkaddr) &
(sbi->blocks_per_seg - 1);
struct f2fs_summary sum;
nid_t ino;
nid_t ino, nid;
void *kaddr;
struct inode *inode;
struct page *node_page;
Expand Down Expand Up @@ -224,10 +224,26 @@ static void check_index_in_prev_nodes(struct f2fs_sb_info *sbi,
f2fs_put_page(sum_page, 1);
}

/* Use the locked dnode page and inode */
nid = le32_to_cpu(sum.nid);
if (dn->inode->i_ino == nid) {
struct dnode_of_data tdn = *dn;
tdn.nid = nid;
tdn.node_page = dn->inode_page;
tdn.ofs_in_node = sum.ofs_in_node;
truncate_data_blocks_range(&tdn, 1);
return;
} else if (dn->nid == nid) {
struct dnode_of_data tdn = *dn;
tdn.ofs_in_node = sum.ofs_in_node;
truncate_data_blocks_range(&tdn, 1);
return;
}

/* Get the node page */
node_page = get_node_page(sbi, le32_to_cpu(sum.nid));
node_page = get_node_page(sbi, nid);
bidx = start_bidx_of_node(ofs_of_node(node_page)) +
le16_to_cpu(sum.ofs_in_node);
le16_to_cpu(sum.ofs_in_node);
ino = ino_of_node(node_page);
f2fs_put_page(node_page, 1);

Expand Down Expand Up @@ -285,7 +301,7 @@ static int do_recover_data(struct f2fs_sb_info *sbi, struct inode *inode,
}

/* Check the previous node page having this index */
check_index_in_prev_nodes(sbi, dest);
check_index_in_prev_nodes(sbi, dest, &dn);

set_summary(&sum, dn.nid, dn.ofs_in_node, ni.version);

Expand Down

0 comments on commit 1569347

Please sign in to comment.