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: unfold nilfs_dat_inode function
  nilfs2: do not pass sbi to functions which can get it from inode
  nilfs2: get rid of nilfs_mount_options structure
  nilfs2: simplify nilfs_mdt_freeze_buffer
  nilfs2: get rid of loaded flag from nilfs object
  nilfs2: fix a checkpatch error in page.c
  nilfs2: fiemap support
  nilfs2: mark buffer heads as delayed until the data is written to disk
  nilfs2: call nilfs_error inside bmap routines
  fs/nilfs2/super.c: Use printf extension %pV
  MAINTAINERS: add nilfs2 git tree entry
  • Loading branch information
torvalds committed Jan 10, 2011
2 parents f3ea597 + 365e215 commit b65f0d6
Show file tree
Hide file tree
Showing 19 changed files with 337 additions and 147 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4268,6 +4268,7 @@ NILFS2 FILESYSTEM
M: KONISHI Ryusuke <[email protected]>
L: [email protected]
W: http://www.nilfs.org/en/
T: git git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2.git
S: Supported
F: Documentation/filesystems/nilfs2.txt
F: fs/nilfs2/
Expand Down
47 changes: 36 additions & 11 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@

struct inode *nilfs_bmap_get_dat(const struct nilfs_bmap *bmap)
{
return nilfs_dat_inode(NILFS_I_NILFS(bmap->b_inode));
return NILFS_I_NILFS(bmap->b_inode)->ns_dat;
}

static int nilfs_bmap_convert_error(struct nilfs_bmap *bmap,
const char *fname, int err)
{
struct inode *inode = bmap->b_inode;

if (err == -EINVAL) {
nilfs_error(inode->i_sb, fname,
"broken bmap (inode number=%lu)\n", inode->i_ino);
err = -EIO;
}
return err;
}

/**
Expand Down Expand Up @@ -66,8 +79,10 @@ int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level,

down_read(&bmap->b_sem);
ret = bmap->b_ops->bop_lookup(bmap, key, level, ptrp);
if (ret < 0)
if (ret < 0) {
ret = nilfs_bmap_convert_error(bmap, __func__, ret);
goto out;
}
if (NILFS_BMAP_USE_VBN(bmap)) {
ret = nilfs_dat_translate(nilfs_bmap_get_dat(bmap), *ptrp,
&blocknr);
Expand All @@ -88,7 +103,8 @@ int nilfs_bmap_lookup_contig(struct nilfs_bmap *bmap, __u64 key, __u64 *ptrp,
down_read(&bmap->b_sem);
ret = bmap->b_ops->bop_lookup_contig(bmap, key, ptrp, maxblocks);
up_read(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

static int nilfs_bmap_do_insert(struct nilfs_bmap *bmap, __u64 key, __u64 ptr)
Expand Down Expand Up @@ -144,7 +160,8 @@ int nilfs_bmap_insert(struct nilfs_bmap *bmap,
down_write(&bmap->b_sem);
ret = nilfs_bmap_do_insert(bmap, key, rec);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

static int nilfs_bmap_do_delete(struct nilfs_bmap *bmap, __u64 key)
Expand Down Expand Up @@ -180,9 +197,12 @@ int nilfs_bmap_last_key(struct nilfs_bmap *bmap, unsigned long *key)

down_read(&bmap->b_sem);
ret = bmap->b_ops->bop_last_key(bmap, &lastkey);
if (!ret)
*key = lastkey;
up_read(&bmap->b_sem);

if (ret < 0)
ret = nilfs_bmap_convert_error(bmap, __func__, ret);
else
*key = lastkey;
return ret;
}

Expand Down Expand Up @@ -210,7 +230,8 @@ int nilfs_bmap_delete(struct nilfs_bmap *bmap, unsigned long key)
down_write(&bmap->b_sem);
ret = nilfs_bmap_do_delete(bmap, key);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

static int nilfs_bmap_do_truncate(struct nilfs_bmap *bmap, unsigned long key)
Expand Down Expand Up @@ -261,7 +282,8 @@ int nilfs_bmap_truncate(struct nilfs_bmap *bmap, unsigned long key)
down_write(&bmap->b_sem);
ret = nilfs_bmap_do_truncate(bmap, key);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

/**
Expand Down Expand Up @@ -300,7 +322,8 @@ int nilfs_bmap_propagate(struct nilfs_bmap *bmap, struct buffer_head *bh)
down_write(&bmap->b_sem);
ret = bmap->b_ops->bop_propagate(bmap, bh);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

/**
Expand Down Expand Up @@ -344,7 +367,8 @@ int nilfs_bmap_assign(struct nilfs_bmap *bmap,
down_write(&bmap->b_sem);
ret = bmap->b_ops->bop_assign(bmap, bh, blocknr, binfo);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

/**
Expand Down Expand Up @@ -373,7 +397,8 @@ int nilfs_bmap_mark(struct nilfs_bmap *bmap, __u64 key, int level)
down_write(&bmap->b_sem);
ret = bmap->b_ops->bop_mark(bmap, key, level);
up_write(&bmap->b_sem);
return ret;

return nilfs_bmap_convert_error(bmap, __func__, ret);
}

/**
Expand Down
3 changes: 1 addition & 2 deletions fs/nilfs2/btnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
if (pblocknr == 0) {
pblocknr = blocknr;
if (inode->i_ino != NILFS_DAT_INO) {
struct inode *dat =
nilfs_dat_inode(NILFS_I_NILFS(inode));
struct inode *dat = NILFS_I_NILFS(inode)->ns_dat;

/* blocknr is a virtual block number */
err = nilfs_dat_translate(dat, blocknr, &pblocknr);
Expand Down
3 changes: 1 addition & 2 deletions fs/nilfs2/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ static void nilfs_commit_chunk(struct page *page,
unsigned from, unsigned to)
{
struct inode *dir = mapping->host;
struct nilfs_sb_info *sbi = NILFS_SB(dir->i_sb);
loff_t pos = page_offset(page) + from;
unsigned len = to - from;
unsigned nr_dirty, copied;
Expand All @@ -103,7 +102,7 @@ static void nilfs_commit_chunk(struct page *page,
i_size_write(dir, pos + copied);
if (IS_DIRSYNC(dir))
nilfs_set_transaction_flag(NILFS_TI_SYNC);
err = nilfs_set_file_dirty(sbi, dir, nr_dirty);
err = nilfs_set_file_dirty(dir, nr_dirty);
WARN_ON(err); /* do not happen */
unlock_page(page);
}
Expand Down
1 change: 1 addition & 0 deletions fs/nilfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@ const struct inode_operations nilfs_file_inode_operations = {
.truncate = nilfs_truncate,
.setattr = nilfs_setattr,
.permission = nilfs_permission,
.fiemap = nilfs_fiemap,
};

/* end of file */
11 changes: 3 additions & 8 deletions fs/nilfs2/ifile.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,14 +149,9 @@ int nilfs_ifile_get_inode_block(struct inode *ifile, ino_t ino,
}

err = nilfs_palloc_get_entry_block(ifile, ino, 0, out_bh);
if (unlikely(err)) {
if (err == -EINVAL)
nilfs_error(sb, __func__, "ifile is broken");
else
nilfs_warning(sb, __func__,
"unable to read inode: %lu",
(unsigned long) ino);
}
if (unlikely(err))
nilfs_warning(sb, __func__, "unable to read inode: %lu",
(unsigned long) ino);
return err;
}

Expand Down
Loading

0 comments on commit b65f0d6

Please sign in to comment.