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: (45 commits)
  nilfs2: reject filesystem with unsupported block size
  nilfs2: avoid rec_len overflow with 64KB block size
  nilfs2: simplify nilfs_get_page function
  nilfs2: reject incompatible filesystem
  nilfs2: add feature set fields to super block
  nilfs2: clarify byte offset in super block format
  nilfs2: apply read-ahead for nilfs_btree_lookup_contig
  nilfs2: introduce check flag to btree node buffer
  nilfs2: add btree get block function with readahead option
  nilfs2: add read ahead mode to nilfs_btnode_submit_block
  nilfs2: fix buffer head leak in nilfs_btnode_submit_block
  nilfs2: eliminate inline keywords in btree implementation
  nilfs2: get maximum number of child nodes from bmap object
  nilfs2: reduce repetitive calculation of max number of child nodes
  nilfs2: optimize calculation of min/max number of btree node children
  nilfs2: remove redundant pointer checks in bmap lookup functions
  nilfs2: get rid of nilfs_bmap_union
  nilfs2: unify bmap set_target_v operations
  nilfs2: get rid of nilfs_btree uses
  nilfs2: get rid of nilfs_direct uses
  ...
  • Loading branch information
torvalds committed Aug 7, 2010
2 parents 09dc942 + 89c0fd0 commit a57f9a3
Show file tree
Hide file tree
Showing 24 changed files with 1,294 additions and 905 deletions.
12 changes: 8 additions & 4 deletions Documentation/filesystems/nilfs2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ Mount options
NILFS2 supports the following mount options:
(*) == default

nobarrier Disables barriers.
barrier(*) This enables/disables the use of write barriers. This
nobarrier requires an IO stack which can support barriers, and
if nilfs gets an error on a barrier write, it will
disable again with a warning.
errors=continue Keep going on a filesystem error.
errors=remount-ro(*) Remount the filesystem read-only on an error.
errors=panic Panic and halt the machine if an error occurs.
Expand All @@ -74,9 +77,10 @@ norecovery Disable recovery of the filesystem on mount.
This disables every write access on the device for
read-only mounts or snapshots. This option will fail
for r/w mounts on an unclean volume.
discard Issue discard/TRIM commands to the underlying block
device when blocks are freed. This is useful for SSD
devices and sparse/thinly-provisioned LUNs.
discard This enables/disables the use of discard/TRIM commands.
nodiscard(*) The discard/TRIM commands are sent to the underlying
block device when blocks are freed. This is useful
for SSD devices and sparse/thinly-provisioned LUNs.

NILFS2 usage
============
Expand Down
6 changes: 4 additions & 2 deletions fs/nilfs2/bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "nilfs.h"
#include "bmap.h"
#include "sb.h"
#include "btree.h"
#include "direct.h"
#include "btnode.h"
#include "mdt.h"
#include "dat.h"
Expand Down Expand Up @@ -533,15 +535,15 @@ void nilfs_bmap_init_gc(struct nilfs_bmap *bmap)

void nilfs_bmap_init_gcdat(struct nilfs_bmap *gcbmap, struct nilfs_bmap *bmap)
{
memcpy(gcbmap, bmap, sizeof(union nilfs_bmap_union));
memcpy(gcbmap, bmap, sizeof(*bmap));
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));
memcpy(bmap, gcbmap, sizeof(*bmap));
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;
Expand Down
16 changes: 10 additions & 6 deletions fs/nilfs2/bmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@

#define NILFS_BMAP_INVALID_PTR 0

#define nilfs_bmap_dkey_to_key(dkey) le64_to_cpu(dkey)
#define nilfs_bmap_key_to_dkey(key) cpu_to_le64(key)
#define nilfs_bmap_dptr_to_ptr(dptr) le64_to_cpu(dptr)
#define nilfs_bmap_ptr_to_dptr(ptr) cpu_to_le64(ptr)

#define nilfs_bmap_keydiff_abs(diff) ((diff) < 0 ? -(diff) : (diff))


Expand Down Expand Up @@ -71,7 +66,7 @@ struct nilfs_bmap_operations {
int (*bop_delete)(struct nilfs_bmap *, __u64);
void (*bop_clear)(struct nilfs_bmap *);

int (*bop_propagate)(const struct nilfs_bmap *, struct buffer_head *);
int (*bop_propagate)(struct nilfs_bmap *, struct buffer_head *);
void (*bop_lookup_dirty_buffers)(struct nilfs_bmap *,
struct list_head *);

Expand Down Expand Up @@ -110,6 +105,7 @@ static inline int nilfs_bmap_is_new_ptr(unsigned long ptr)
* @b_last_allocated_ptr: last allocated ptr for data block
* @b_ptr_type: pointer type
* @b_state: state
* @b_nchildren_per_block: maximum number of child nodes for non-root nodes
*/
struct nilfs_bmap {
union {
Expand All @@ -123,6 +119,7 @@ struct nilfs_bmap {
__u64 b_last_allocated_ptr;
int b_ptr_type;
int b_state;
__u16 b_nchildren_per_block;
};

/* pointer type */
Expand Down Expand Up @@ -224,6 +221,13 @@ static inline void nilfs_bmap_abort_end_ptr(struct nilfs_bmap *bmap,
nilfs_dat_abort_end(dat, &req->bpr_req);
}

static inline void nilfs_bmap_set_target_v(struct nilfs_bmap *bmap, __u64 key,
__u64 ptr)
{
bmap->b_last_allocated_key = key;
bmap->b_last_allocated_ptr = ptr;
}

__u64 nilfs_bmap_data_get_key(const struct nilfs_bmap *,
const struct buffer_head *);

Expand Down
42 changes: 0 additions & 42 deletions fs/nilfs2/bmap_union.h

This file was deleted.

23 changes: 18 additions & 5 deletions fs/nilfs2/btnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,20 @@ nilfs_btnode_create_block(struct address_space *btnc, __u64 blocknr)
}

int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
sector_t pblocknr, struct buffer_head **pbh)
sector_t pblocknr, int mode,
struct buffer_head **pbh, sector_t *submit_ptr)
{
struct buffer_head *bh;
struct inode *inode = NILFS_BTNC_I(btnc);
struct page *page;
int err;

bh = nilfs_grab_buffer(inode, btnc, blocknr, 1 << BH_NILFS_Node);
if (unlikely(!bh))
return -ENOMEM;

err = -EEXIST; /* internal code */
page = bh->b_page;

if (buffer_uptodate(bh) || buffer_dirty(bh))
goto found;
Expand All @@ -125,7 +128,16 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
}
}
}
lock_buffer(bh);

if (mode == READA) {
if (pblocknr != *submit_ptr + 1 || !trylock_buffer(bh)) {
err = -EBUSY; /* internal code */
brelse(bh);
goto out_locked;
}
} else { /* mode == READ */
lock_buffer(bh);
}
if (buffer_uptodate(bh)) {
unlock_buffer(bh);
err = -EEXIST; /* internal code */
Expand All @@ -136,15 +148,16 @@ int nilfs_btnode_submit_block(struct address_space *btnc, __u64 blocknr,
bh->b_blocknr = pblocknr; /* set block address for read */
bh->b_end_io = end_buffer_read_sync;
get_bh(bh);
submit_bh(READ, bh);
submit_bh(mode, bh);
bh->b_blocknr = blocknr; /* set back to the given block address */
*submit_ptr = pblocknr;
err = 0;
found:
*pbh = bh;

out_locked:
unlock_page(bh->b_page);
page_cache_release(bh->b_page);
unlock_page(page);
page_cache_release(page);
return err;
}

Expand Down
4 changes: 2 additions & 2 deletions fs/nilfs2/btnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ void nilfs_btnode_cache_init(struct address_space *, struct backing_dev_info *);
void nilfs_btnode_cache_clear(struct address_space *);
struct buffer_head *nilfs_btnode_create_block(struct address_space *btnc,
__u64 blocknr);
int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t,
struct buffer_head **);
int nilfs_btnode_submit_block(struct address_space *, __u64, sector_t, int,
struct buffer_head **, sector_t *);
void nilfs_btnode_delete(struct buffer_head *);
int nilfs_btnode_prepare_change_key(struct address_space *,
struct nilfs_btnode_chkey_ctxt *);
Expand Down
Loading

0 comments on commit a57f9a3

Please sign in to comment.