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 possible mismatch of sufile counters on recovery
  nilfs2: segment usage file cleanups
  nilfs2: fix wrong accounting and duplicate brelse in nilfs_sufile_set_error
  nilfs2: simplify handling of active state of segments fix
  nilfs2: remove module version
  nilfs2: fix lockdep recursive locking warning on meta data files
  nilfs2: fix lockdep recursive locking warning on bmap
  nilfs2: return f_fsid for statfs2
  • Loading branch information
torvalds committed Apr 14, 2009
2 parents 2b6b6d3 + c85399c commit 9fc0178
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 213 deletions.
5 changes: 5 additions & 0 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,8 @@ static const struct nilfs_bmap_ptr_operations nilfs_bmap_ptr_ops_gc = {
.bpop_translate = NULL,
};

static struct lock_class_key nilfs_bmap_dat_lock_key;

/**
* nilfs_bmap_read - read a bmap from an inode
* @bmap: bmap
Expand Down Expand Up @@ -715,6 +717,7 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode)
bmap->b_pops = &nilfs_bmap_ptr_ops_p;
bmap->b_last_allocated_key = 0; /* XXX: use macro */
bmap->b_last_allocated_ptr = NILFS_BMAP_NEW_PTR_INIT;
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
break;
case NILFS_CPFILE_INO:
case NILFS_SUFILE_INO:
Expand Down Expand Up @@ -772,12 +775,14 @@ void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
{
memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union));
init_rwsem(&gcbmap->b_sem);
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
gcbmap->b_inode = &NILFS_BMAP_I(gcbmap)->vfs_inode;
}

void nilfs_bmap_commit_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
{
memcpy(bmap, gcbmap, sizeof(union nilfs_bmap_union));
init_rwsem(&bmap->b_sem);
lockdep_set_class(&bmap->b_sem, &nilfs_bmap_dat_lock_key);
bmap->b_inode = &NILFS_BMAP_I(bmap)->vfs_inode;
}
5 changes: 0 additions & 5 deletions fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@
#include "bmap.h"
#include "bmap_union.h"

/*
* NILFS filesystem version
*/
#define NILFS_VERSION "2.0.5"

/*
* nilfs inode data in memory
*/
Expand Down
20 changes: 4 additions & 16 deletions fs/nilfs2/recovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
struct nilfs_segment_entry *ent, *n;
struct inode *sufile = nilfs->ns_sufile;
__u64 segnum[4];
time_t mtime;
int err;
int i;

Expand Down Expand Up @@ -442,24 +441,13 @@ static int nilfs_prepare_segment_for_recovery(struct the_nilfs *nilfs,
* Collecting segments written after the latest super root.
* These are marked dirty to avoid being reallocated in the next write.
*/
mtime = get_seconds();
list_for_each_entry_safe(ent, n, head, list) {
if (ent->segnum == segnum[0]) {
list_del(&ent->list);
nilfs_free_segment_entry(ent);
continue;
}
err = nilfs_open_segment_entry(ent, sufile);
if (unlikely(err))
goto failed;
if (!nilfs_segment_usage_dirty(ent->raw_su)) {
/* make the segment garbage */
ent->raw_su->su_nblocks = cpu_to_le32(0);
ent->raw_su->su_lastmod = cpu_to_le32(mtime);
nilfs_segment_usage_set_dirty(ent->raw_su);
if (ent->segnum != segnum[0]) {
err = nilfs_sufile_scrap(sufile, ent->segnum);
if (unlikely(err))
goto failed;
}
list_del(&ent->list);
nilfs_close_segment_entry(ent, sufile);
nilfs_free_segment_entry(ent);
}

Expand Down
Loading

0 comments on commit 9fc0178

Please sign in to comment.