Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/ryusuke/nilfs2

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
  nilfs2: fix disorder in cp count on error during deleting checkpoints
  nilfs2: fix lockdep warning between regular file and inode file
  nilfs2: fix incorrect KERN_CRIT messages in case of write failures
  nilfs2: fix hang problem of log writer which occurs after write failures
  nilfs2: remove unlikely directive causing mis-conversion of error code
  • Loading branch information
torvalds committed Jul 10, 2009
2 parents ac3f482 + d9a0a34 commit 9f2d8be
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 34 deletions.
5 changes: 5 additions & 0 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ void nilfs_bmap_abort_update_v(struct nilfs_bmap *bmap,
}

static struct lock_class_key nilfs_bmap_dat_lock_key;
static struct lock_class_key nilfs_bmap_mdt_lock_key;

/**
* nilfs_bmap_read - read a bmap from an inode
Expand Down Expand Up @@ -603,7 +604,11 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
bmap->b_ptr_type = NILFS_BMAP_PTR_VS;
bmap->b_last_allocated_key = 0;
bmap->b_last_allocated_ptr = NILFS_BMAP_INVALID_PTR;
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key);
break;
case NILFS_IFILE_INO:
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key);
/* Fall through */
default:
bmap->b_ptr_type = NILFS_BMAP_PTR_VM;
bmap->b_last_allocated_key = 0;
Expand Down
5 changes: 2 additions & 3 deletions fs/nilfs2/cpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh);
if (ret < 0) {
if (ret != -ENOENT)
goto out_header;
break;
/* skip hole */
ret = 0;
continue;
Expand Down Expand Up @@ -340,7 +340,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
continue;
printk(KERN_ERR "%s: cannot delete block\n",
__func__);
goto out_header;
break;
}
}

Expand All @@ -358,7 +358,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile,
kunmap_atomic(kaddr, KM_USER0);
}

out_header:
brelse(header_bh);

out_sem:
Expand Down
9 changes: 0 additions & 9 deletions fs/nilfs2/dat.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req,
entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr,
req->pr_entry_bh, kaddr);
entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat));
if (entry->de_blocknr != cpu_to_le64(0) ||
entry->de_end != cpu_to_le64(NILFS_CNO_MAX)) {
printk(KERN_CRIT
"%s: vbn = %llu, start = %llu, end = %llu, pbn = %llu\n",
__func__, (unsigned long long)req->pr_entry_nr,
(unsigned long long)le64_to_cpu(entry->de_start),
(unsigned long long)le64_to_cpu(entry->de_end),
(unsigned long long)le64_to_cpu(entry->de_blocknr));
}
entry->de_blocknr = cpu_to_le64(blocknr);
kunmap_atomic(kaddr, KM_USER0);

Expand Down
30 changes: 8 additions & 22 deletions fs/nilfs2/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,26 +1829,13 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci,
err = nilfs_segbuf_write(segbuf, &wi);

res = nilfs_segbuf_wait(segbuf, &wi);
err = unlikely(err) ? : res;
if (unlikely(err))
err = err ? : res;
if (err)
return err;
}
return 0;
}

static int nilfs_page_has_uncleared_buffer(struct page *page)
{
struct buffer_head *head, *bh;

head = bh = page_buffers(page);
do {
if (buffer_dirty(bh) && !list_empty(&bh->b_assoc_buffers))
return 1;
bh = bh->b_this_page;
} while (bh != head);
return 0;
}

static void __nilfs_end_page_io(struct page *page, int err)
{
if (!err) {
Expand All @@ -1872,12 +1859,11 @@ static void nilfs_end_page_io(struct page *page, int err)
if (!page)
return;

if (buffer_nilfs_node(page_buffers(page)) &&
nilfs_page_has_uncleared_buffer(page))
/* For b-tree node pages, this function may be called twice
or more because they might be split in a segment.
This check assures that cleanup has been done for all
buffers in a split btnode page. */
if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page))
/*
* For b-tree node pages, this function may be called twice
* or more because they might be split in a segment.
*/
return;

__nilfs_end_page_io(page, err);
Expand Down Expand Up @@ -1940,7 +1926,7 @@ static void nilfs_segctor_abort_write(struct nilfs_sc_info *sci,
}
if (bh->b_page != fs_page) {
nilfs_end_page_io(fs_page, err);
if (unlikely(fs_page == failed_page))
if (fs_page && fs_page == failed_page)
goto done;
fs_page = bh->b_page;
}
Expand Down

0 comments on commit 9f2d8be

Please sign in to comment.