diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/file.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 1 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 7 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 109 |
4 files changed, 27 insertions, 93 deletions
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index 6846371498b6..91f080cc76c8 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -152,8 +152,7 @@ static int reiserfs_sync_file(struct file *filp, int datasync) | |||
152 | barrier_done = reiserfs_commit_for_inode(inode); | 152 | barrier_done = reiserfs_commit_for_inode(inode); |
153 | reiserfs_write_unlock(inode->i_sb); | 153 | reiserfs_write_unlock(inode->i_sb); |
154 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) | 154 | if (barrier_done != 1 && reiserfs_barrier_flush(inode->i_sb)) |
155 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL, | 155 | blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL); |
156 | BLKDEV_IFL_WAIT); | ||
157 | if (barrier_done < 0) | 156 | if (barrier_done < 0) |
158 | return barrier_done; | 157 | return barrier_done; |
159 | return (err < 0) ? -EIO : 0; | 158 | return (err < 0) ? -EIO : 0; |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index ae35413dcbe1..caa758377d66 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -83,6 +83,7 @@ void reiserfs_evict_inode(struct inode *inode) | |||
83 | dquot_drop(inode); | 83 | dquot_drop(inode); |
84 | inode->i_blocks = 0; | 84 | inode->i_blocks = 0; |
85 | reiserfs_write_unlock_once(inode->i_sb, depth); | 85 | reiserfs_write_unlock_once(inode->i_sb, depth); |
86 | return; | ||
86 | 87 | ||
87 | no_delete: | 88 | no_delete: |
88 | end_writeback(inode); | 89 | end_writeback(inode); |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index f53505de0712..5cbb81e134ac 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -170,6 +170,7 @@ int reiserfs_prepare_write(struct file *f, struct page *page, | |||
170 | int reiserfs_unpack(struct inode *inode, struct file *filp) | 170 | int reiserfs_unpack(struct inode *inode, struct file *filp) |
171 | { | 171 | { |
172 | int retval = 0; | 172 | int retval = 0; |
173 | int depth; | ||
173 | int index; | 174 | int index; |
174 | struct page *page; | 175 | struct page *page; |
175 | struct address_space *mapping; | 176 | struct address_space *mapping; |
@@ -188,8 +189,8 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
188 | /* we need to make sure nobody is changing the file size beneath | 189 | /* we need to make sure nobody is changing the file size beneath |
189 | ** us | 190 | ** us |
190 | */ | 191 | */ |
191 | mutex_lock(&inode->i_mutex); | 192 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); |
192 | reiserfs_write_lock(inode->i_sb); | 193 | depth = reiserfs_write_lock_once(inode->i_sb); |
193 | 194 | ||
194 | write_from = inode->i_size & (blocksize - 1); | 195 | write_from = inode->i_size & (blocksize - 1); |
195 | /* if we are on a block boundary, we are already unpacked. */ | 196 | /* if we are on a block boundary, we are already unpacked. */ |
@@ -224,6 +225,6 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
224 | 225 | ||
225 | out: | 226 | out: |
226 | mutex_unlock(&inode->i_mutex); | 227 | mutex_unlock(&inode->i_mutex); |
227 | reiserfs_write_unlock(inode->i_sb); | 228 | reiserfs_write_unlock_once(inode->i_sb, depth); |
228 | return retval; | 229 | return retval; |
229 | } | 230 | } |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 19fbc810e8e7..076c8b194682 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -138,13 +138,6 @@ static int reiserfs_clean_and_file_buffer(struct buffer_head *bh) | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | static void disable_barrier(struct super_block *s) | ||
142 | { | ||
143 | REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_BARRIER_FLUSH); | ||
144 | printk("reiserfs: disabling flush barriers on %s\n", | ||
145 | reiserfs_bdevname(s)); | ||
146 | } | ||
147 | |||
148 | static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block | 141 | static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block |
149 | *sb) | 142 | *sb) |
150 | { | 143 | { |
@@ -677,30 +670,6 @@ static void submit_ordered_buffer(struct buffer_head *bh) | |||
677 | submit_bh(WRITE, bh); | 670 | submit_bh(WRITE, bh); |
678 | } | 671 | } |
679 | 672 | ||
680 | static int submit_barrier_buffer(struct buffer_head *bh) | ||
681 | { | ||
682 | get_bh(bh); | ||
683 | bh->b_end_io = reiserfs_end_ordered_io; | ||
684 | clear_buffer_dirty(bh); | ||
685 | if (!buffer_uptodate(bh)) | ||
686 | BUG(); | ||
687 | return submit_bh(WRITE_BARRIER, bh); | ||
688 | } | ||
689 | |||
690 | static void check_barrier_completion(struct super_block *s, | ||
691 | struct buffer_head *bh) | ||
692 | { | ||
693 | if (buffer_eopnotsupp(bh)) { | ||
694 | clear_buffer_eopnotsupp(bh); | ||
695 | disable_barrier(s); | ||
696 | set_buffer_uptodate(bh); | ||
697 | set_buffer_dirty(bh); | ||
698 | reiserfs_write_unlock(s); | ||
699 | sync_dirty_buffer(bh); | ||
700 | reiserfs_write_lock(s); | ||
701 | } | ||
702 | } | ||
703 | |||
704 | #define CHUNK_SIZE 32 | 673 | #define CHUNK_SIZE 32 |
705 | struct buffer_chunk { | 674 | struct buffer_chunk { |
706 | struct buffer_head *bh[CHUNK_SIZE]; | 675 | struct buffer_head *bh[CHUNK_SIZE]; |
@@ -983,7 +952,6 @@ static int flush_older_commits(struct super_block *s, | |||
983 | 952 | ||
984 | static int reiserfs_async_progress_wait(struct super_block *s) | 953 | static int reiserfs_async_progress_wait(struct super_block *s) |
985 | { | 954 | { |
986 | DEFINE_WAIT(wait); | ||
987 | struct reiserfs_journal *j = SB_JOURNAL(s); | 955 | struct reiserfs_journal *j = SB_JOURNAL(s); |
988 | 956 | ||
989 | if (atomic_read(&j->j_async_throttle)) { | 957 | if (atomic_read(&j->j_async_throttle)) { |
@@ -1010,7 +978,6 @@ static int flush_commit_list(struct super_block *s, | |||
1010 | struct buffer_head *tbh = NULL; | 978 | struct buffer_head *tbh = NULL; |
1011 | unsigned int trans_id = jl->j_trans_id; | 979 | unsigned int trans_id = jl->j_trans_id; |
1012 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 980 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1013 | int barrier = 0; | ||
1014 | int retval = 0; | 981 | int retval = 0; |
1015 | int write_len; | 982 | int write_len; |
1016 | 983 | ||
@@ -1095,24 +1062,6 @@ static int flush_commit_list(struct super_block *s, | |||
1095 | } | 1062 | } |
1096 | atomic_dec(&journal->j_async_throttle); | 1063 | atomic_dec(&journal->j_async_throttle); |
1097 | 1064 | ||
1098 | /* We're skipping the commit if there's an error */ | ||
1099 | if (retval || reiserfs_is_journal_aborted(journal)) | ||
1100 | barrier = 0; | ||
1101 | |||
1102 | /* wait on everything written so far before writing the commit | ||
1103 | * if we are in barrier mode, send the commit down now | ||
1104 | */ | ||
1105 | barrier = reiserfs_barrier_flush(s); | ||
1106 | if (barrier) { | ||
1107 | int ret; | ||
1108 | lock_buffer(jl->j_commit_bh); | ||
1109 | ret = submit_barrier_buffer(jl->j_commit_bh); | ||
1110 | if (ret == -EOPNOTSUPP) { | ||
1111 | set_buffer_uptodate(jl->j_commit_bh); | ||
1112 | disable_barrier(s); | ||
1113 | barrier = 0; | ||
1114 | } | ||
1115 | } | ||
1116 | for (i = 0; i < (jl->j_len + 1); i++) { | 1065 | for (i = 0; i < (jl->j_len + 1); i++) { |
1117 | bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) + | 1066 | bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) + |
1118 | (jl->j_start + i) % SB_ONDISK_JOURNAL_SIZE(s); | 1067 | (jl->j_start + i) % SB_ONDISK_JOURNAL_SIZE(s); |
@@ -1144,27 +1093,22 @@ static int flush_commit_list(struct super_block *s, | |||
1144 | 1093 | ||
1145 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); | 1094 | BUG_ON(atomic_read(&(jl->j_commit_left)) != 1); |
1146 | 1095 | ||
1147 | if (!barrier) { | 1096 | /* If there was a write error in the journal - we can't commit |
1148 | /* If there was a write error in the journal - we can't commit | 1097 | * this transaction - it will be invalid and, if successful, |
1149 | * this transaction - it will be invalid and, if successful, | 1098 | * will just end up propagating the write error out to |
1150 | * will just end up propagating the write error out to | 1099 | * the file system. */ |
1151 | * the file system. */ | 1100 | if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { |
1152 | if (likely(!retval && !reiserfs_is_journal_aborted (journal))) { | 1101 | if (buffer_dirty(jl->j_commit_bh)) |
1153 | if (buffer_dirty(jl->j_commit_bh)) | 1102 | BUG(); |
1154 | BUG(); | 1103 | mark_buffer_dirty(jl->j_commit_bh) ; |
1155 | mark_buffer_dirty(jl->j_commit_bh) ; | ||
1156 | reiserfs_write_unlock(s); | ||
1157 | sync_dirty_buffer(jl->j_commit_bh) ; | ||
1158 | reiserfs_write_lock(s); | ||
1159 | } | ||
1160 | } else { | ||
1161 | reiserfs_write_unlock(s); | 1104 | reiserfs_write_unlock(s); |
1162 | wait_on_buffer(jl->j_commit_bh); | 1105 | if (reiserfs_barrier_flush(s)) |
1106 | __sync_dirty_buffer(jl->j_commit_bh, WRITE_FLUSH_FUA); | ||
1107 | else | ||
1108 | sync_dirty_buffer(jl->j_commit_bh); | ||
1163 | reiserfs_write_lock(s); | 1109 | reiserfs_write_lock(s); |
1164 | } | 1110 | } |
1165 | 1111 | ||
1166 | check_barrier_completion(s, jl->j_commit_bh); | ||
1167 | |||
1168 | /* If there was a write error in the journal - we can't commit this | 1112 | /* If there was a write error in the journal - we can't commit this |
1169 | * transaction - it will be invalid and, if successful, will just end | 1113 | * transaction - it will be invalid and, if successful, will just end |
1170 | * up propagating the write error out to the filesystem. */ | 1114 | * up propagating the write error out to the filesystem. */ |
@@ -1320,26 +1264,15 @@ static int _update_journal_header_block(struct super_block *sb, | |||
1320 | jh->j_first_unflushed_offset = cpu_to_le32(offset); | 1264 | jh->j_first_unflushed_offset = cpu_to_le32(offset); |
1321 | jh->j_mount_id = cpu_to_le32(journal->j_mount_id); | 1265 | jh->j_mount_id = cpu_to_le32(journal->j_mount_id); |
1322 | 1266 | ||
1323 | if (reiserfs_barrier_flush(sb)) { | 1267 | set_buffer_dirty(journal->j_header_bh); |
1324 | int ret; | 1268 | reiserfs_write_unlock(sb); |
1325 | lock_buffer(journal->j_header_bh); | 1269 | |
1326 | ret = submit_barrier_buffer(journal->j_header_bh); | 1270 | if (reiserfs_barrier_flush(sb)) |
1327 | if (ret == -EOPNOTSUPP) { | 1271 | __sync_dirty_buffer(journal->j_header_bh, WRITE_FLUSH_FUA); |
1328 | set_buffer_uptodate(journal->j_header_bh); | 1272 | else |
1329 | disable_barrier(sb); | ||
1330 | goto sync; | ||
1331 | } | ||
1332 | reiserfs_write_unlock(sb); | ||
1333 | wait_on_buffer(journal->j_header_bh); | ||
1334 | reiserfs_write_lock(sb); | ||
1335 | check_barrier_completion(sb, journal->j_header_bh); | ||
1336 | } else { | ||
1337 | sync: | ||
1338 | set_buffer_dirty(journal->j_header_bh); | ||
1339 | reiserfs_write_unlock(sb); | ||
1340 | sync_dirty_buffer(journal->j_header_bh); | 1273 | sync_dirty_buffer(journal->j_header_bh); |
1341 | reiserfs_write_lock(sb); | 1274 | |
1342 | } | 1275 | reiserfs_write_lock(sb); |
1343 | if (!buffer_uptodate(journal->j_header_bh)) { | 1276 | if (!buffer_uptodate(journal->j_header_bh)) { |
1344 | reiserfs_warning(sb, "journal-837", | 1277 | reiserfs_warning(sb, "journal-837", |
1345 | "IO error during journal replay"); | 1278 | "IO error during journal replay"); |
@@ -2312,7 +2245,7 @@ static int journal_read_transaction(struct super_block *sb, | |||
2312 | /* flush out the real blocks */ | 2245 | /* flush out the real blocks */ |
2313 | for (i = 0; i < get_desc_trans_len(desc); i++) { | 2246 | for (i = 0; i < get_desc_trans_len(desc); i++) { |
2314 | set_buffer_dirty(real_blocks[i]); | 2247 | set_buffer_dirty(real_blocks[i]); |
2315 | ll_rw_block(SWRITE, 1, real_blocks + i); | 2248 | write_dirty_buffer(real_blocks[i], WRITE); |
2316 | } | 2249 | } |
2317 | for (i = 0; i < get_desc_trans_len(desc); i++) { | 2250 | for (i = 0; i < get_desc_trans_len(desc); i++) { |
2318 | wait_on_buffer(real_blocks[i]); | 2251 | wait_on_buffer(real_blocks[i]); |