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 whitespace coding style issues
  nilfs2: fix oops due to a bad aops initialization
  nilfs2: fix data loss in mmap page write for hole blocks
  • Loading branch information
Linus Torvalds committed Mar 30, 2011
2 parents 50f3515 + af71dda commit 85cf0ac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
11 changes: 5 additions & 6 deletions fs/nilfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,9 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
/*
* check to see if the page is mapped already (no holes)
*/
if (PageMappedToDisk(page)) {
unlock_page(page);
if (PageMappedToDisk(page))
goto mapped;
}

if (page_has_buffers(page)) {
struct buffer_head *bh, *head;
int fully_mapped = 1;
Expand All @@ -90,7 +89,6 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)

if (fully_mapped) {
SetPageMappedToDisk(page);
unlock_page(page);
goto mapped;
}
}
Expand All @@ -105,16 +103,17 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
return VM_FAULT_SIGBUS;

ret = block_page_mkwrite(vma, vmf, nilfs_get_block);
if (unlikely(ret)) {
if (ret != VM_FAULT_LOCKED) {
nilfs_transaction_abort(inode->i_sb);
return ret;
}
nilfs_set_file_dirty(inode, 1 << (PAGE_SHIFT - inode->i_blkbits));
nilfs_transaction_commit(inode->i_sb);

mapped:
SetPageChecked(page);
wait_on_page_writeback(page);
return 0;
return VM_FAULT_LOCKED;
}

static const struct vm_operations_struct nilfs_file_vm_ops = {
Expand Down
14 changes: 7 additions & 7 deletions fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ enum {
* Macros to check inode numbers
*/
#define NILFS_MDT_INO_BITS \
((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \
1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \
1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO))
((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \
1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \
1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO))

#define NILFS_SYS_INO_BITS \
((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)
((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS)

#define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino)

#define NILFS_MDT_INODE(sb, ino) \
((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino))))
((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino))))
#define NILFS_VALID_INODE(sb, ino) \
((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino))))
((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino))))

/**
* struct nilfs_transaction_info: context information for synchronization
Expand Down Expand Up @@ -285,7 +285,7 @@ extern void nilfs_destroy_inode(struct inode *);
extern void nilfs_error(struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4)));
extern void nilfs_warning(struct super_block *, const char *, const char *, ...)
__attribute__ ((format (printf, 3, 4)));
__attribute__ ((format (printf, 3, 4)));
extern struct nilfs_super_block *
nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **);
extern int nilfs_store_magic_and_option(struct super_block *,
Expand Down
4 changes: 3 additions & 1 deletion fs/nilfs2/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,14 @@ unsigned nilfs_page_count_clean_buffers(struct page *page,
void nilfs_mapping_init(struct address_space *mapping,
struct backing_dev_info *bdi)
{
static const struct address_space_operations empty_aops;

mapping->host = NULL;
mapping->flags = 0;
mapping_set_gfp_mask(mapping, GFP_NOFS);
mapping->assoc_mapping = NULL;
mapping->backing_dev_info = bdi;
mapping->a_ops = NULL;
mapping->a_ops = &empty_aops;
}

/*
Expand Down

0 comments on commit 85cf0ac

Please sign in to comment.