kill BH_Ordered flag
Subsystems (3)
PATCH 1/1 kill BH_Ordered flag
Instead of abusing a buffer_head flag just add a variant of sync_dirty_buffer which allos passing the exact type of write flag required.
Signed-off-by Christoph Hellwig <[email protected]>
fs/buffer.c +8 -9
@@ -3020,13 +3020,6 @@ int submit_bh(int rw, struct buffer_headBUG_ON (buffer_unwritten (bh));/* -* Mask in barrier bit for a write (could be either a WRITE or a -* WRITE_SYNC -*/ -if (buffer_ordered (bh) && (rw &WRITE )) - rw |=WRITE_BARRIER ; - -/* * Only clear out a write error when rewriting */ if (test_set_buffer_req (bh) && (rw &WRITE ))
@@ -3129,7 +3122,7 @@ EXPORT_SYMBOL(ll_rw_block);* and then start new I/O and then wait upon it. The caller must have a ref on * the buffer_head. */ -int sync_dirty_buffer (struct buffer_head *bh) +int __sync_dirty_buffer (struct buffer_head *bh,int rw) {int ret =0 ;
@@ -3138,7 +3131,7 @@ int sync_dirty_buffer(struct buffer_headif (test_clear_buffer_dirty (bh)) {get_bh (bh); bh->b_end_io = end_buffer_write_sync; - ret =submit_bh (WRITE_SYNC , bh); + ret =submit_bh (rw, bh);wait_on_buffer (bh);if (buffer_eopnotsupp (bh)) {clear_buffer_eopnotsupp (bh);
@@ -3151,6 +3144,12 @@ int sync_dirty_buffer(struct buffer_head }return ret; } +EXPORT_SYMBOL (__sync_dirty_buffer); + +int sync_dirty_buffer (struct buffer_head *bh) +{ +return __sync_dirty_buffer (bh,WRITE_SYNC ); +}EXPORT_SYMBOL (sync_dirty_buffer);/*
include/linux/buffer_head.h +1 -2
@@ -32,7 +32,6 @@ enum bh_state_bits { BH_Delay,/* Buffer is not yet allocated on disk */ BH_Boundary,/* Block is followed by a discontiguity */ BH_Write_EIO,/* I/O error on write */ - BH_Ordered,/* ordered write */ BH_Eopnotsupp,/* operation not supported (barrier) */ BH_Unwritten,/* Buffer is allocated on disk but not written */ BH_Quiet, /* Buffer Error Prinks to be quiet */
@@ -125,7 +124,6 @@ BUFFER_FNS(Async_Write, async_write) BUFFER_FNS(Delay, delay) BUFFER_FNS(Boundary, boundary) BUFFER_FNS(Write_EIO, write_io_error) -BUFFER_FNS(Ordered, ordered) BUFFER_FNS(Eopnotsupp, eopnotsupp)BUFFER_FNS (Unwritten, unwritten)
@@ -183,6 +181,7 @@ void unlock_buffer(struct buffer_head *bvoid __lock_buffer (struct buffer_head *bh);void ll_rw_block (int ,int ,struct buffer_head * bh[]);int sync_dirty_buffer (struct buffer_head *bh); +int __sync_dirty_buffer (struct buffer_head *bh,int rw);int submit_bh (int ,struct buffer_head *);void write_boundary_block (struct block_device *bdev,sector_t bblock,unsigned blocksize);
fs/jbd/commit.c +27 -26
68 lines not on this page · raw message
fs/jbd2/commit.c +24 -25
63 lines not on this page · raw message
fs/nilfs2/super.c +14 -14
@@ -180,24 +180,24 @@ static int nilfs_sync_super(struct nilfs {struct the_nilfs *nilfs = sbi->s_nilfs;int err; -int barrier_done =0 ; -if (nilfs_test_opt (sbi,BARRIER )) { -set_buffer_ordered (nilfs->ns_sbh[0 ]); - barrier_done =1 ; - } retry:set_buffer_dirty (nilfs->ns_sbh[0 ]); - err =sync_dirty_buffer (nilfs->ns_sbh[0 ]); -if (err == -EOPNOTSUPP && barrier_done) { -nilfs_warning (sbi->s_super, __func__, -"barrier-based sync failed. " -"disabling barriers\n" ); -nilfs_clear_opt (sbi,BARRIER ); - barrier_done =0 ; -clear_buffer_ordered (nilfs->ns_sbh[0 ]); - goto retry; + +if (nilfs_test_opt (sbi,BARRIER )) { + err =__sync_dirty_buffer (nilfs->ns_sbh[0 ], +WRITE_SYNC |WRITE_BARRIER ); +if (err == -EOPNOTSUPP ) { +nilfs_warning (sbi->s_super, __func__, +"barrier-based sync failed. " +"disabling barriers\n" ); +nilfs_clear_opt (sbi,BARRIER ); + goto retry; + } + }else { + err =sync_dirty_buffer (nilfs->ns_sbh[0 ]); } +if (unlikely (err)) {printk (KERN_ERR "NILFS: unable to write superblock (err=%d)\n" , err);
Let's keep this out of trees for a while. I have another series that touches this area which is needs to go in through Jens' tree,
so it would just create merge nightmares. I'll resubmit it once
that is settled.