Skip to content

Commit 7cd33ad

Browse files
Christoph HellwigJens Axboe
authored andcommitted
reiserfs: replace barriers with explicit flush / FUA usage
Switch to the WRITE_FLUSH_FUA flag for log writes and remove the EOPNOTSUPP detection for barriers. Note that reiserfs had a fairly different code path for barriers before as it wa the only filesystem actually making use of them. The new code always uses the old non-barrier codepath and just sets the WRITE_FLUSH_FUA explicitly for the journal commits. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Jan Kara <jack@suse.cz> Acked-by: Chris Mason <chris.mason@oracle.com> Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
1 parent f1e4d51 commit 7cd33ad

1 file changed

Lines changed: 20 additions & 86 deletions

File tree

‎fs/reiserfs/journal.c‎

Lines changed: 20 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,6 @@ static int reiserfs_clean_and_file_buffer(struct buffer_head *bh)
138138
return 0;
139139
}
140140

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-
148141
static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block
149142
*sb)
150143
{
@@ -677,30 +670,6 @@ static void submit_ordered_buffer(struct buffer_head *bh)
677670
submit_bh(WRITE, bh);
678671
}
679672

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-
704673
#define CHUNK_SIZE 32
705674
struct buffer_chunk {
706675
struct buffer_head *bh[CHUNK_SIZE];
@@ -1009,7 +978,6 @@ static int flush_commit_list(struct super_block *s,
1009978
struct buffer_head *tbh = NULL;
1010979
unsigned int trans_id = jl->j_trans_id;
1011980
struct reiserfs_journal *journal = SB_JOURNAL(s);
1012-
int barrier = 0;
1013981
int retval = 0;
1014982
int write_len;
1015983

@@ -1094,24 +1062,6 @@ static int flush_commit_list(struct super_block *s,
10941062
}
10951063
atomic_dec(&journal->j_async_throttle);
10961064

1097-
/* We're skipping the commit if there's an error */
1098-
if (retval || reiserfs_is_journal_aborted(journal))
1099-
barrier = 0;
1100-
1101-
/* wait on everything written so far before writing the commit
1102-
* if we are in barrier mode, send the commit down now
1103-
*/
1104-
barrier = reiserfs_barrier_flush(s);
1105-
if (barrier) {
1106-
int ret;
1107-
lock_buffer(jl->j_commit_bh);
1108-
ret = submit_barrier_buffer(jl->j_commit_bh);
1109-
if (ret == -EOPNOTSUPP) {
1110-
set_buffer_uptodate(jl->j_commit_bh);
1111-
disable_barrier(s);
1112-
barrier = 0;
1113-
}
1114-
}
11151065
for (i = 0; i < (jl->j_len + 1); i++) {
11161066
bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) +
11171067
(jl->j_start + i) % SB_ONDISK_JOURNAL_SIZE(s);
@@ -1143,27 +1093,22 @@ static int flush_commit_list(struct super_block *s,
11431093

11441094
BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
11451095

1146-
if (!barrier) {
1147-
/* If there was a write error in the journal - we can't commit
1148-
* this transaction - it will be invalid and, if successful,
1149-
* will just end up propagating the write error out to
1150-
* the file system. */
1151-
if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
1152-
if (buffer_dirty(jl->j_commit_bh))
1153-
BUG();
1154-
mark_buffer_dirty(jl->j_commit_bh) ;
1155-
reiserfs_write_unlock(s);
1156-
sync_dirty_buffer(jl->j_commit_bh) ;
1157-
reiserfs_write_lock(s);
1158-
}
1159-
} else {
1096+
/* If there was a write error in the journal - we can't commit
1097+
* this transaction - it will be invalid and, if successful,
1098+
* will just end up propagating the write error out to
1099+
* the file system. */
1100+
if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
1101+
if (buffer_dirty(jl->j_commit_bh))
1102+
BUG();
1103+
mark_buffer_dirty(jl->j_commit_bh) ;
11601104
reiserfs_write_unlock(s);
1161-
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);
11621109
reiserfs_write_lock(s);
11631110
}
11641111

1165-
check_barrier_completion(s, jl->j_commit_bh);
1166-
11671112
/* If there was a write error in the journal - we can't commit this
11681113
* transaction - it will be invalid and, if successful, will just end
11691114
* up propagating the write error out to the filesystem. */
@@ -1319,26 +1264,15 @@ static int _update_journal_header_block(struct super_block *sb,
13191264
jh->j_first_unflushed_offset = cpu_to_le32(offset);
13201265
jh->j_mount_id = cpu_to_le32(journal->j_mount_id);
13211266

1322-
if (reiserfs_barrier_flush(sb)) {
1323-
int ret;
1324-
lock_buffer(journal->j_header_bh);
1325-
ret = submit_barrier_buffer(journal->j_header_bh);
1326-
if (ret == -EOPNOTSUPP) {
1327-
set_buffer_uptodate(journal->j_header_bh);
1328-
disable_barrier(sb);
1329-
goto sync;
1330-
}
1331-
reiserfs_write_unlock(sb);
1332-
wait_on_buffer(journal->j_header_bh);
1333-
reiserfs_write_lock(sb);
1334-
check_barrier_completion(sb, journal->j_header_bh);
1335-
} else {
1336-
sync:
1337-
set_buffer_dirty(journal->j_header_bh);
1338-
reiserfs_write_unlock(sb);
1267+
set_buffer_dirty(journal->j_header_bh);
1268+
reiserfs_write_unlock(sb);
1269+
1270+
if (reiserfs_barrier_flush(sb))
1271+
__sync_dirty_buffer(journal->j_header_bh, WRITE_FLUSH_FUA);
1272+
else
13391273
sync_dirty_buffer(journal->j_header_bh);
1340-
reiserfs_write_lock(sb);
1341-
}
1274+
1275+
reiserfs_write_lock(sb);
13421276
if (!buffer_uptodate(journal->j_header_bh)) {
13431277
reiserfs_warning(sb, "journal-837",
13441278
"IO error during journal replay");

0 commit comments

Comments
 (0)