diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-30 12:46:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-30 12:46:36 -0400 |
commit | 85cf0ac38c10b1f19fb1682354df1f7d9380a973 (patch) | |
tree | 4a892a01cd844f574566b8b3381aab03edb4dea2 /fs | |
parent | 50f3515828024582402044bcced6804c070c491c (diff) | |
parent | af71dda0b8e667d03eec21d25f90265eec5efea1 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/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
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nilfs2/file.c | 11 | ||||
-rw-r--r-- | fs/nilfs2/nilfs.h | 14 | ||||
-rw-r--r-- | fs/nilfs2/page.c | 4 |
3 files changed, 15 insertions, 14 deletions
diff --git a/fs/nilfs2/file.c b/fs/nilfs2/file.c index 93589fccdd9..397e7325863 100644 --- a/fs/nilfs2/file.c +++ b/fs/nilfs2/file.c | |||
@@ -72,10 +72,9 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
72 | /* | 72 | /* |
73 | * check to see if the page is mapped already (no holes) | 73 | * check to see if the page is mapped already (no holes) |
74 | */ | 74 | */ |
75 | if (PageMappedToDisk(page)) { | 75 | if (PageMappedToDisk(page)) |
76 | unlock_page(page); | ||
77 | goto mapped; | 76 | goto mapped; |
78 | } | 77 | |
79 | if (page_has_buffers(page)) { | 78 | if (page_has_buffers(page)) { |
80 | struct buffer_head *bh, *head; | 79 | struct buffer_head *bh, *head; |
81 | int fully_mapped = 1; | 80 | int fully_mapped = 1; |
@@ -90,7 +89,6 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
90 | 89 | ||
91 | if (fully_mapped) { | 90 | if (fully_mapped) { |
92 | SetPageMappedToDisk(page); | 91 | SetPageMappedToDisk(page); |
93 | unlock_page(page); | ||
94 | goto mapped; | 92 | goto mapped; |
95 | } | 93 | } |
96 | } | 94 | } |
@@ -105,16 +103,17 @@ static int nilfs_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
105 | return VM_FAULT_SIGBUS; | 103 | return VM_FAULT_SIGBUS; |
106 | 104 | ||
107 | ret = block_page_mkwrite(vma, vmf, nilfs_get_block); | 105 | ret = block_page_mkwrite(vma, vmf, nilfs_get_block); |
108 | if (unlikely(ret)) { | 106 | if (ret != VM_FAULT_LOCKED) { |
109 | nilfs_transaction_abort(inode->i_sb); | 107 | nilfs_transaction_abort(inode->i_sb); |
110 | return ret; | 108 | return ret; |
111 | } | 109 | } |
110 | nilfs_set_file_dirty(inode, 1 << (PAGE_SHIFT - inode->i_blkbits)); | ||
112 | nilfs_transaction_commit(inode->i_sb); | 111 | nilfs_transaction_commit(inode->i_sb); |
113 | 112 | ||
114 | mapped: | 113 | mapped: |
115 | SetPageChecked(page); | 114 | SetPageChecked(page); |
116 | wait_on_page_writeback(page); | 115 | wait_on_page_writeback(page); |
117 | return 0; | 116 | return VM_FAULT_LOCKED; |
118 | } | 117 | } |
119 | 118 | ||
120 | static const struct vm_operations_struct nilfs_file_vm_ops = { | 119 | static const struct vm_operations_struct nilfs_file_vm_ops = { |
diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h index 856e8e4e0b7..a8dd344303c 100644 --- a/fs/nilfs2/nilfs.h +++ b/fs/nilfs2/nilfs.h | |||
@@ -114,19 +114,19 @@ enum { | |||
114 | * Macros to check inode numbers | 114 | * Macros to check inode numbers |
115 | */ | 115 | */ |
116 | #define NILFS_MDT_INO_BITS \ | 116 | #define NILFS_MDT_INO_BITS \ |
117 | ((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \ | 117 | ((unsigned int)(1 << NILFS_DAT_INO | 1 << NILFS_CPFILE_INO | \ |
118 | 1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \ | 118 | 1 << NILFS_SUFILE_INO | 1 << NILFS_IFILE_INO | \ |
119 | 1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO)) | 119 | 1 << NILFS_ATIME_INO | 1 << NILFS_SKETCH_INO)) |
120 | 120 | ||
121 | #define NILFS_SYS_INO_BITS \ | 121 | #define NILFS_SYS_INO_BITS \ |
122 | ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS) | 122 | ((unsigned int)(1 << NILFS_ROOT_INO) | NILFS_MDT_INO_BITS) |
123 | 123 | ||
124 | #define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino) | 124 | #define NILFS_FIRST_INO(sb) (((struct the_nilfs *)sb->s_fs_info)->ns_first_ino) |
125 | 125 | ||
126 | #define NILFS_MDT_INODE(sb, ino) \ | 126 | #define NILFS_MDT_INODE(sb, ino) \ |
127 | ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino)))) | 127 | ((ino) < NILFS_FIRST_INO(sb) && (NILFS_MDT_INO_BITS & (1 << (ino)))) |
128 | #define NILFS_VALID_INODE(sb, ino) \ | 128 | #define NILFS_VALID_INODE(sb, ino) \ |
129 | ((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino)))) | 129 | ((ino) >= NILFS_FIRST_INO(sb) || (NILFS_SYS_INO_BITS & (1 << (ino)))) |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * struct nilfs_transaction_info: context information for synchronization | 132 | * struct nilfs_transaction_info: context information for synchronization |
@@ -285,7 +285,7 @@ extern void nilfs_destroy_inode(struct inode *); | |||
285 | extern void nilfs_error(struct super_block *, const char *, const char *, ...) | 285 | extern void nilfs_error(struct super_block *, const char *, const char *, ...) |
286 | __attribute__ ((format (printf, 3, 4))); | 286 | __attribute__ ((format (printf, 3, 4))); |
287 | extern void nilfs_warning(struct super_block *, const char *, const char *, ...) | 287 | extern void nilfs_warning(struct super_block *, const char *, const char *, ...) |
288 | __attribute__ ((format (printf, 3, 4))); | 288 | __attribute__ ((format (printf, 3, 4))); |
289 | extern struct nilfs_super_block * | 289 | extern struct nilfs_super_block * |
290 | nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **); | 290 | nilfs_read_super_block(struct super_block *, u64, int, struct buffer_head **); |
291 | extern int nilfs_store_magic_and_option(struct super_block *, | 291 | extern int nilfs_store_magic_and_option(struct super_block *, |
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 4d2a1ee0eb4..9d2dc6b4348 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c | |||
@@ -495,12 +495,14 @@ unsigned nilfs_page_count_clean_buffers(struct page *page, | |||
495 | void nilfs_mapping_init(struct address_space *mapping, | 495 | void nilfs_mapping_init(struct address_space *mapping, |
496 | struct backing_dev_info *bdi) | 496 | struct backing_dev_info *bdi) |
497 | { | 497 | { |
498 | static const struct address_space_operations empty_aops; | ||
499 | |||
498 | mapping->host = NULL; | 500 | mapping->host = NULL; |
499 | mapping->flags = 0; | 501 | mapping->flags = 0; |
500 | mapping_set_gfp_mask(mapping, GFP_NOFS); | 502 | mapping_set_gfp_mask(mapping, GFP_NOFS); |
501 | mapping->assoc_mapping = NULL; | 503 | mapping->assoc_mapping = NULL; |
502 | mapping->backing_dev_info = bdi; | 504 | mapping->backing_dev_info = bdi; |
503 | mapping->a_ops = NULL; | 505 | mapping->a_ops = &empty_aops; |
504 | } | 506 | } |
505 | 507 | ||
506 | /* | 508 | /* |