All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/15] replace barriers with explicit flush / FUA usage
@ 2010-08-18  9:29 Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 01/15] kill BH_Ordered flag Christoph Hellwig
                   ` (17 more replies)
  0 siblings, 18 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

This series converts over all filesystems to the new WRITE_FLUSH_FUA
primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
have passed extensive xfstests coverage with this, while ocfs2, nilfs2
and fat are unsupposed by xfstests and thus untested in this patch.

The discard code hasn't been tested yet, I'm looking into more extensive
testing for this later.  Note that the nilfs2 discard code did not wait
for the discards to finish meaning that it's almost guaranteed to be
broken after these patches, although I wouldn't be surprised if it already
was before.

The patches are a bit larger than the one liners I promised because I
remove the EOPNOTSUPP handling that's not needed with the new code.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 01/15] kill BH_Ordered flag
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard Christoph Hellwig
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: kill-buffer_ordered --]
[-- Type: text/plain, Size: 8675 bytes --]

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 <hch@lst.de>

Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c	2010-08-17 15:34:30.271255364 +0200
+++ linux-2.6/fs/buffer.c	2010-08-17 15:35:19.678254107 +0200
@@ -3020,13 +3020,6 @@ int submit_bh(int rw, struct buffer_head
 	BUG_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_head
 	if (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);
 
 /*
Index: linux-2.6/include/linux/buffer_head.h
===================================================================
--- linux-2.6.orig/include/linux/buffer_head.h	2010-08-17 15:34:30.000000000 +0200
+++ linux-2.6/include/linux/buffer_head.h	2010-08-17 15:35:58.147054147 +0200
@@ -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,	/* DEPRECATED: ordered write */
 	BH_Eopnotsupp,	/* DEPRECATED: 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 *b
 void __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);
Index: linux-2.6/fs/jbd/commit.c
===================================================================
--- linux-2.6.orig/fs/jbd/commit.c	2010-08-16 15:55:47.000000000 +0200
+++ linux-2.6/fs/jbd/commit.c	2010-08-17 15:35:19.683254107 +0200
@@ -119,7 +119,6 @@ static int journal_write_commit_record(j
 	struct buffer_head *bh;
 	journal_header_t *header;
 	int ret;
-	int barrier_done = 0;
 
 	if (is_journal_aborted(journal))
 		return 0;
@@ -137,34 +136,36 @@ static int journal_write_commit_record(j
 
 	JBUFFER_TRACE(descriptor, "write commit block");
 	set_buffer_dirty(bh);
+
 	if (journal->j_flags & JFS_BARRIER) {
-		set_buffer_ordered(bh);
-		barrier_done = 1;
-	}
-	ret = sync_dirty_buffer(bh);
-	if (barrier_done)
-		clear_buffer_ordered(bh);
-	/* is it possible for another commit to fail at roughly
-	 * the same time as this one?  If so, we don't want to
-	 * trust the barrier flag in the super, but instead want
-	 * to remember if we sent a barrier request
-	 */
-	if (ret == -EOPNOTSUPP && barrier_done) {
-		char b[BDEVNAME_SIZE];
-
-		printk(KERN_WARNING
-			"JBD: barrier-based sync failed on %s - "
-			"disabling barriers\n",
-			bdevname(journal->j_dev, b));
-		spin_lock(&journal->j_state_lock);
-		journal->j_flags &= ~JFS_BARRIER;
-		spin_unlock(&journal->j_state_lock);
-
-		/* And try again, without the barrier */
-		set_buffer_uptodate(bh);
-		set_buffer_dirty(bh);
+		ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER);
+
+		/*
+		 * Is it possible for another commit to fail at roughly
+		 * the same time as this one?  If so, we don't want to
+		 * trust the barrier flag in the super, but instead want
+		 * to remember if we sent a barrier request
+		 */
+		if (ret == -EOPNOTSUPP) {
+			char b[BDEVNAME_SIZE];
+
+			printk(KERN_WARNING
+				"JBD: barrier-based sync failed on %s - "
+				"disabling barriers\n",
+				bdevname(journal->j_dev, b));
+			spin_lock(&journal->j_state_lock);
+			journal->j_flags &= ~JFS_BARRIER;
+			spin_unlock(&journal->j_state_lock);
+
+			/* And try again, without the barrier */
+			set_buffer_uptodate(bh);
+			set_buffer_dirty(bh);
+			ret = sync_dirty_buffer(bh);
+		}
+	} else {
 		ret = sync_dirty_buffer(bh);
 	}
+
 	put_bh(bh);		/* One for getblk() */
 	journal_put_journal_head(descriptor);
 
Index: linux-2.6/fs/jbd2/commit.c
===================================================================
--- linux-2.6.orig/fs/jbd2/commit.c	2010-08-17 15:34:30.000000000 +0200
+++ linux-2.6/fs/jbd2/commit.c	2010-08-17 15:50:29.096003723 +0200
@@ -101,7 +101,6 @@ static int journal_submit_commit_record(
 	struct commit_header *tmp;
 	struct buffer_head *bh;
 	int ret;
-	int barrier_done = 0;
 	struct timespec now = current_kernel_time();
 
 	if (is_journal_aborted(journal))
@@ -136,32 +135,25 @@ static int journal_submit_commit_record(
 	if (journal->j_flags & JBD2_BARRIER &&
 	    !JBD2_HAS_INCOMPAT_FEATURE(journal,
 				       JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
-		set_buffer_ordered(bh);
-		barrier_done = 1;
-	}
-	ret = submit_bh(WRITE_SYNC_PLUG, bh);
-	if (barrier_done)
-		clear_buffer_ordered(bh);
-
-	/* is it possible for another commit to fail at roughly
-	 * the same time as this one?  If so, we don't want to
-	 * trust the barrier flag in the super, but instead want
-	 * to remember if we sent a barrier request
-	 */
-	if (ret == -EOPNOTSUPP && barrier_done) {
-		printk(KERN_WARNING
-		       "JBD: barrier-based sync failed on %s - "
-		       "disabling barriers\n", journal->j_devname);
-		spin_lock(&journal->j_state_lock);
-		journal->j_flags &= ~JBD2_BARRIER;
-		spin_unlock(&journal->j_state_lock);
-
-		/* And try again, without the barrier */
-		lock_buffer(bh);
-		set_buffer_uptodate(bh);
-		clear_buffer_dirty(bh);
+		ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh);
+		if (ret == -EOPNOTSUPP) {
+			printk(KERN_WARNING
+			       "JBD: barrier-based sync failed on %s - "
+			       "disabling barriers\n", journal->j_devname);
+			spin_lock(&journal->j_state_lock);
+			journal->j_flags &= ~JBD2_BARRIER;
+			spin_unlock(&journal->j_state_lock);
+
+			/* And try again, without the barrier */
+			lock_buffer(bh);
+			set_buffer_uptodate(bh);
+			clear_buffer_dirty(bh);
+			ret = submit_bh(WRITE_SYNC_PLUG, bh);
+		}
+	} else {
 		ret = submit_bh(WRITE_SYNC_PLUG, bh);
 	}
+
 	*cbh = bh;
 	return ret;
 }
Index: linux-2.6/fs/nilfs2/super.c
===================================================================
--- linux-2.6.orig/fs/nilfs2/super.c	2010-08-17 15:34:30.000000000 +0200
+++ linux-2.6/fs/nilfs2/super.c	2010-08-17 15:35:19.691276596 +0200
@@ -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);


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 01/15] kill BH_Ordered flag Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-20  1:23   ` Mike Snitzer
  2010-08-18  9:29 ` [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: sb_issue-discard-parameters --]
[-- Type: text/plain, Size: 2616 bytes --]

We'll need to get rid of the BLKDEV_IFL_BARRIER flag, and to facilitate
that and to make the interface less confusing pass all flags explicitly.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.orig/fs/ext4/mballoc.c	2010-08-17 15:56:00.337259833 +0200
+++ linux-2.6/fs/ext4/mballoc.c	2010-08-17 15:59:09.490005395 +0200
@@ -2588,7 +2588,10 @@ static void release_blocks_on_commit(jou
 			trace_ext4_discard_blocks(sb,
 					(unsigned long long)discard_block,
 					entry->count);
-			ret = sb_issue_discard(sb, discard_block, entry->count);
+			ret = sb_issue_discard(sb, discard_block, entry->count,
+						GFP_NOFS,
+						BLKDEV_IFL_WAIT |
+						BLKDEV_IFL_BARRIER);
 			if (ret == EOPNOTSUPP) {
 				ext4_warning(sb,
 					"discard not supported, disabling");
Index: linux-2.6/fs/fat/fatent.c
===================================================================
--- linux-2.6.orig/fs/fat/fatent.c	2010-08-17 15:56:00.351254455 +0200
+++ linux-2.6/fs/fat/fatent.c	2010-08-17 15:58:54.980023211 +0200
@@ -577,7 +577,9 @@ int fat_free_clusters(struct inode *inod
 
 				sb_issue_discard(sb,
 					fat_clus_to_blknr(sbi, first_cl),
-					nr_clus * sbi->sec_per_clus);
+					nr_clus * sbi->sec_per_clus,
+					GFP_NOFS,
+					BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
 
 				first_cl = cluster;
 			}
Index: linux-2.6/include/linux/blkdev.h
===================================================================
--- linux-2.6.orig/include/linux/blkdev.h	2010-08-17 15:55:24.299003653 +0200
+++ linux-2.6/include/linux/blkdev.h	2010-08-17 15:58:49.351006024 +0200
@@ -877,13 +877,12 @@ extern int blkdev_issue_discard(struct b
 		sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
 extern int blkdev_issue_zeroout(struct block_device *bdev, sector_t sector,
 			sector_t nr_sects, gfp_t gfp_mask, unsigned long flags);
-static inline int sb_issue_discard(struct super_block *sb,
-				   sector_t block, sector_t nr_blocks)
+static inline int sb_issue_discard(struct super_block *sb, sector_t block,
+		sector_t nr_blocks, gfp_t gfp_mask, unsigned long flags)
 {
-	block <<= (sb->s_blocksize_bits - 9);
-	nr_blocks <<= (sb->s_blocksize_bits - 9);
-	return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS,
-				   BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+	return blkdev_issue_discard(sb->s_bdev, block << (sb->s_blocksize_bits - 9),
+				    nr_blocks << (sb->s_blocksize_bits - 9),
+				    gfp_mask, flags);
 }
 
 extern int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm);


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 01/15] kill BH_Ordered flag Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 23:47   ` Dave Chinner
  2010-08-18  9:29 ` [PATCH 04/15] btrfs: " Christoph Hellwig
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: xfs-use-flush-fua --]
[-- Type: text/plain, Size: 3989 bytes --]

Switch to the WRITE_FLUSH_FUA flag for log writes and remove the EOPNOTSUPP
detection for barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.c	2010-08-17 16:13:10.738276176 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.c	2010-08-17 16:13:54.388005813 +0200
@@ -929,19 +929,7 @@ xfs_buf_iodone_work(
 	xfs_buf_t		*bp =
 		container_of(work, xfs_buf_t, b_iodone_work);
 
-	/*
-	 * We can get an EOPNOTSUPP to ordered writes.  Here we clear the
-	 * ordered flag and reissue them.  Because we can't tell the higher
-	 * layers directly that they should not issue ordered I/O anymore, they
-	 * need to check if the _XFS_BARRIER_FAILED flag was set during I/O completion.
-	 */
-	if ((bp->b_error == EOPNOTSUPP) &&
-	    (bp->b_flags & (XBF_ORDERED|XBF_ASYNC)) == (XBF_ORDERED|XBF_ASYNC)) {
-		trace_xfs_buf_ordered_retry(bp, _RET_IP_);
-		bp->b_flags &= ~XBF_ORDERED;
-		bp->b_flags |= _XFS_BARRIER_FAILED;
-		xfs_buf_iorequest(bp);
-	} else if (bp->b_iodone)
+	if (bp->b_iodone)
 		(*(bp->b_iodone))(bp);
 	else if (bp->b_flags & XBF_ASYNC)
 		xfs_buf_relse(bp);
@@ -1200,7 +1188,7 @@ _xfs_buf_ioapply(
 
 	if (bp->b_flags & XBF_ORDERED) {
 		ASSERT(!(bp->b_flags & XBF_READ));
-		rw = WRITE_BARRIER;
+		rw = WRITE_FLUSH_FUA;
 	} else if (bp->b_flags & XBF_LOG_BUFFER) {
 		ASSERT(!(bp->b_flags & XBF_READ_AHEAD));
 		bp->b_flags &= ~_XBF_RUN_QUEUES;
Index: linux-2.6/fs/xfs/linux-2.6/xfs_buf.h
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_buf.h	2010-08-17 16:14:18.087003792 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_buf.h	2010-08-17 16:14:28.235256201 +0200
@@ -86,14 +86,6 @@ typedef enum {
  */
 #define _XBF_PAGE_LOCKED	(1 << 22)
 
-/*
- * If we try a barrier write, but it fails we have to communicate
- * this to the upper layers.  Unfortunately b_error gets overwritten
- * when the buffer is re-issued so we have to add another flag to
- * keep this information.
- */
-#define _XFS_BARRIER_FAILED	(1 << 23)
-
 typedef unsigned int xfs_buf_flags_t;
 
 #define XFS_BUF_FLAGS \
@@ -114,8 +106,7 @@ typedef unsigned int xfs_buf_flags_t;
 	{ _XBF_PAGES,		"PAGES" }, \
 	{ _XBF_RUN_QUEUES,	"RUN_QUEUES" }, \
 	{ _XBF_DELWRI_Q,	"DELWRI_Q" }, \
-	{ _XBF_PAGE_LOCKED,	"PAGE_LOCKED" }, \
-	{ _XFS_BARRIER_FAILED,	"BARRIER_FAILED" }
+	{ _XBF_PAGE_LOCKED,	"PAGE_LOCKED" }
 
 
 typedef enum {
Index: linux-2.6/fs/xfs/linux-2.6/xfs_trace.h
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_trace.h	2010-08-17 16:14:31.286004001 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_trace.h	2010-08-17 16:14:47.254054289 +0200
@@ -325,7 +325,6 @@ DEFINE_BUF_EVENT(xfs_buf_lock);
 DEFINE_BUF_EVENT(xfs_buf_lock_done);
 DEFINE_BUF_EVENT(xfs_buf_cond_lock);
 DEFINE_BUF_EVENT(xfs_buf_unlock);
-DEFINE_BUF_EVENT(xfs_buf_ordered_retry);
 DEFINE_BUF_EVENT(xfs_buf_iowait);
 DEFINE_BUF_EVENT(xfs_buf_iowait_done);
 DEFINE_BUF_EVENT(xfs_buf_delwri_queue);
Index: linux-2.6/fs/xfs/xfs_log.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_log.c	2010-08-17 16:14:01.355263465 +0200
+++ linux-2.6/fs/xfs/xfs_log.c	2010-08-17 16:14:11.962255293 +0200
@@ -917,19 +917,6 @@ xlog_iodone(xfs_buf_t *bp)
 	l = iclog->ic_log;
 
 	/*
-	 * If the _XFS_BARRIER_FAILED flag was set by a lower
-	 * layer, it means the underlying device no longer supports
-	 * barrier I/O. Warn loudly and turn off barriers.
-	 */
-	if (bp->b_flags & _XFS_BARRIER_FAILED) {
-		bp->b_flags &= ~_XFS_BARRIER_FAILED;
-		l->l_mp->m_flags &= ~XFS_MOUNT_BARRIER;
-		xfs_fs_cmn_err(CE_WARN, l->l_mp,
-				"xlog_iodone: Barriers are no longer supported"
-				" by device. Disabling barriers\n");
-	}
-
-	/*
 	 * Race to shutdown the filesystem if we see an error.
 	 */
 	if (XFS_TEST_ERROR((XFS_BUF_GETERROR(bp)), l->l_mp,


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 04/15] btrfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (2 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 12:06   ` Chris Mason
  2010-08-18  9:29 ` [PATCH 05/15] gfs2: " Christoph Hellwig
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: btrfs-use-flush-fua --]
[-- Type: text/plain, Size: 3810 bytes --]

Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
detection for barriers and stop setting the barrier flag for discards.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/btrfs/disk-io.c
===================================================================
--- linux-2.6.orig/fs/btrfs/disk-io.c	2010-08-17 16:16:43.225263395 +0200
+++ linux-2.6/fs/btrfs/disk-io.c	2010-08-17 16:53:07.236005746 +0200
@@ -2063,7 +2063,7 @@ static void btrfs_end_buffer_write_sync(
 	if (uptodate) {
 		set_buffer_uptodate(bh);
 	} else {
-		if (!buffer_eopnotsupp(bh) && printk_ratelimit()) {
+		if (printk_ratelimit()) {
 			printk(KERN_WARNING "lost page write due to "
 					"I/O error on %s\n",
 				       bdevname(bh->b_bdev, b));
@@ -2200,21 +2200,10 @@ static int write_dev_supers(struct btrfs
 			bh->b_end_io = btrfs_end_buffer_write_sync;
 		}
 
-		if (i == last_barrier && do_barriers && device->barriers) {
-			ret = submit_bh(WRITE_BARRIER, bh);
-			if (ret == -EOPNOTSUPP) {
-				printk("btrfs: disabling barriers on dev %s\n",
-				       device->name);
-				set_buffer_uptodate(bh);
-				device->barriers = 0;
-				/* one reference for submit_bh */
-				get_bh(bh);
-				lock_buffer(bh);
-				ret = submit_bh(WRITE_SYNC, bh);
-			}
-		} else {
+		if (i == last_barrier && do_barriers)
+			ret = submit_bh(WRITE_FLUSH_FUA, bh);
+		else
 			ret = submit_bh(WRITE_SYNC, bh);
-		}
 
 		if (ret)
 			errors++;
Index: linux-2.6/fs/btrfs/extent-tree.c
===================================================================
--- linux-2.6.orig/fs/btrfs/extent-tree.c	2010-08-17 16:19:03.735260042 +0200
+++ linux-2.6/fs/btrfs/extent-tree.c	2010-08-17 16:19:19.434004907 +0200
@@ -1696,7 +1696,7 @@ static void btrfs_issue_discard(struct b
 				u64 start, u64 len)
 {
 	blkdev_issue_discard(bdev, start >> 9, len >> 9, GFP_KERNEL,
-			BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+			BLKDEV_IFL_WAIT);
 }
 
 static int btrfs_discard_extent(struct btrfs_root *root, u64 bytenr,
Index: linux-2.6/fs/btrfs/volumes.c
===================================================================
--- linux-2.6.orig/fs/btrfs/volumes.c	2010-08-17 16:17:35.878254036 +0200
+++ linux-2.6/fs/btrfs/volumes.c	2010-08-17 16:17:49.874005678 +0200
@@ -398,7 +398,6 @@ static noinline int device_list_add(cons
 		device->work.func = pending_bios_fn;
 		memcpy(device->uuid, disk_super->dev_item.uuid,
 		       BTRFS_UUID_SIZE);
-		device->barriers = 1;
 		spin_lock_init(&device->io_lock);
 		device->name = kstrdup(path, GFP_NOFS);
 		if (!device->name) {
@@ -462,7 +461,6 @@ static struct btrfs_fs_devices *clone_fs
 		device->devid = orig_dev->devid;
 		device->work.func = pending_bios_fn;
 		memcpy(device->uuid, orig_dev->uuid, sizeof(device->uuid));
-		device->barriers = 1;
 		spin_lock_init(&device->io_lock);
 		INIT_LIST_HEAD(&device->dev_list);
 		INIT_LIST_HEAD(&device->dev_alloc_list);
@@ -1489,7 +1487,6 @@ int btrfs_init_new_device(struct btrfs_r
 	trans = btrfs_start_transaction(root, 0);
 	lock_chunks(root);
 
-	device->barriers = 1;
 	device->writeable = 1;
 	device->work.func = pending_bios_fn;
 	generate_random_uuid(device->uuid);
@@ -3084,7 +3081,6 @@ static struct btrfs_device *add_missing_
 		return NULL;
 	list_add(&device->dev_list,
 		 &fs_devices->devices);
-	device->barriers = 1;
 	device->dev_root = root->fs_info->dev_root;
 	device->devid = devid;
 	device->work.func = pending_bios_fn;
Index: linux-2.6/fs/btrfs/volumes.h
===================================================================
--- linux-2.6.orig/fs/btrfs/volumes.h	2010-08-17 16:18:27.849273872 +0200
+++ linux-2.6/fs/btrfs/volumes.h	2010-08-17 16:18:30.070255642 +0200
@@ -42,7 +42,6 @@ struct btrfs_device {
 	int running_pending;
 	u64 generation;
 
-	int barriers;
 	int writeable;
 	int in_fs_metadata;
 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 05/15] gfs2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (3 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 04/15] btrfs: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 10:08   ` Steven Whitehouse
  2010-08-18 13:37   ` Bob Peterson
  2010-08-18  9:29 ` [PATCH 06/15] reiserfs: " Christoph Hellwig
                   ` (12 subsequent siblings)
  17 siblings, 2 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: gfs2-use-flush-fua --]
[-- Type: text/plain, Size: 2006 bytes --]

Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
detection for barriers and stop setting the barrier flag for discards.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/gfs2/log.c
===================================================================
--- linux-2.6.orig/fs/gfs2/log.c	2010-08-17 16:19:53.597003932 +0200
+++ linux-2.6/fs/gfs2/log.c	2010-08-17 16:22:04.889005329 +0200
@@ -592,22 +592,13 @@ static void log_write_header(struct gfs2
 	lh->lh_hash = cpu_to_be32(hash);
 
 	bh->b_end_io = end_buffer_write_sync;
-	if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
-		goto skip_barrier;
 	get_bh(bh);
-	submit_bh(WRITE_BARRIER | REQ_META, bh);
-	wait_on_buffer(bh);
-	if (buffer_eopnotsupp(bh)) {
-		clear_buffer_eopnotsupp(bh);
-		set_buffer_uptodate(bh);
-		fs_info(sdp, "barrier sync failed - disabling barriers\n");
-		set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
-		lock_buffer(bh);
-skip_barrier:
-		get_bh(bh);
+	if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
 		submit_bh(WRITE_SYNC | REQ_META, bh);
-		wait_on_buffer(bh);
-	}
+	else
+		submit_bh(WRITE_FLUSH_FUA | REQ_META, bh);
+	wait_on_buffer(bh);
+
 	if (!buffer_uptodate(bh))
 		gfs2_io_error_bh(sdp, bh);
 	brelse(bh);
Index: linux-2.6/fs/gfs2/rgrp.c
===================================================================
--- linux-2.6.orig/fs/gfs2/rgrp.c	2010-08-17 16:21:23.626253967 +0200
+++ linux-2.6/fs/gfs2/rgrp.c	2010-08-17 16:21:39.702005748 +0200
@@ -854,8 +854,7 @@ static void gfs2_rgrp_send_discards(stru
 				if ((start + nr_sects) != blk) {
 					rv = blkdev_issue_discard(bdev, start,
 							    nr_sects, GFP_NOFS,
-							    BLKDEV_IFL_WAIT |
-							    BLKDEV_IFL_BARRIER);
+							    BLKDEV_IFL_WAIT);
 					if (rv)
 						goto fail;
 					nr_sects = 0;
@@ -870,7 +869,7 @@ start_new_extent:
 	}
 	if (nr_sects) {
 		rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS,
-					 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+					 BLKDEV_IFL_WAIT);
 		if (rv)
 			goto fail;
 	}


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 06/15] reiserfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (4 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 05/15] gfs2: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 13:16   ` Jan Kara
  2010-08-18  9:29 ` [PATCH 07/15] nilfs2: " Christoph Hellwig
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: reiserfs-use-flush-fua --]
[-- Type: text/plain, Size: 5408 bytes --]

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>


Index: linux-2.6/fs/reiserfs/journal.c
===================================================================
--- linux-2.6.orig/fs/reiserfs/journal.c	2010-08-17 16:26:42.837261928 +0200
+++ linux-2.6/fs/reiserfs/journal.c	2010-08-17 16:35:34.565255365 +0200
@@ -138,13 +138,6 @@ static int reiserfs_clean_and_file_buffe
 	return 0;
 }
 
-static void disable_barrier(struct super_block *s)
-{
-	REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_BARRIER_FLUSH);
-	printk("reiserfs: disabling flush barriers on %s\n",
-	       reiserfs_bdevname(s));
-}
-
 static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block
 							 *sb)
 {
@@ -677,30 +670,6 @@ static void submit_ordered_buffer(struct
 	submit_bh(WRITE, bh);
 }
 
-static int submit_barrier_buffer(struct buffer_head *bh)
-{
-	get_bh(bh);
-	bh->b_end_io = reiserfs_end_ordered_io;
-	clear_buffer_dirty(bh);
-	if (!buffer_uptodate(bh))
-		BUG();
-	return submit_bh(WRITE_BARRIER, bh);
-}
-
-static void check_barrier_completion(struct super_block *s,
-				     struct buffer_head *bh)
-{
-	if (buffer_eopnotsupp(bh)) {
-		clear_buffer_eopnotsupp(bh);
-		disable_barrier(s);
-		set_buffer_uptodate(bh);
-		set_buffer_dirty(bh);
-		reiserfs_write_unlock(s);
-		sync_dirty_buffer(bh);
-		reiserfs_write_lock(s);
-	}
-}
-
 #define CHUNK_SIZE 32
 struct buffer_chunk {
 	struct buffer_head *bh[CHUNK_SIZE];
@@ -1010,7 +979,6 @@ static int flush_commit_list(struct supe
 	struct buffer_head *tbh = NULL;
 	unsigned int trans_id = jl->j_trans_id;
 	struct reiserfs_journal *journal = SB_JOURNAL(s);
-	int barrier = 0;
 	int retval = 0;
 	int write_len;
 
@@ -1095,24 +1063,6 @@ static int flush_commit_list(struct supe
 	}
 	atomic_dec(&journal->j_async_throttle);
 
-	/* We're skipping the commit if there's an error */
-	if (retval || reiserfs_is_journal_aborted(journal))
-		barrier = 0;
-
-	/* wait on everything written so far before writing the commit
-	 * if we are in barrier mode, send the commit down now
-	 */
-	barrier = reiserfs_barrier_flush(s);
-	if (barrier) {
-		int ret;
-		lock_buffer(jl->j_commit_bh);
-		ret = submit_barrier_buffer(jl->j_commit_bh);
-		if (ret == -EOPNOTSUPP) {
-			set_buffer_uptodate(jl->j_commit_bh);
-			disable_barrier(s);
-			barrier = 0;
-		}
-	}
 	for (i = 0; i < (jl->j_len + 1); i++) {
 		bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) +
 		    (jl->j_start + i) % SB_ONDISK_JOURNAL_SIZE(s);
@@ -1144,27 +1094,22 @@ static int flush_commit_list(struct supe
 
 	BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
 
-	if (!barrier) {
-		/* If there was a write error in the journal - we can't commit
-		 * this transaction - it will be invalid and, if successful,
-		 * will just end up propagating the write error out to
-		 * the file system. */
-		if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
-			if (buffer_dirty(jl->j_commit_bh))
-				BUG();
-			mark_buffer_dirty(jl->j_commit_bh) ;
-			reiserfs_write_unlock(s);
-			sync_dirty_buffer(jl->j_commit_bh) ;
-			reiserfs_write_lock(s);
-		}
-	} else {
+	/* If there was a write error in the journal - we can't commit
+	 * this transaction - it will be invalid and, if successful,
+	 * will just end up propagating the write error out to
+	 * the file system. */
+	if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
+		if (buffer_dirty(jl->j_commit_bh))
+			BUG();
+		mark_buffer_dirty(jl->j_commit_bh) ;
 		reiserfs_write_unlock(s);
-		wait_on_buffer(jl->j_commit_bh);
+		if (reiserfs_barrier_flush(s))
+			__sync_dirty_buffer(jl->j_commit_bh, WRITE_FLUSH_FUA);
+		else
+			sync_dirty_buffer(jl->j_commit_bh);
 		reiserfs_write_lock(s);
 	}
 
-	check_barrier_completion(s, jl->j_commit_bh);
-
 	/* If there was a write error in the journal - we can't commit this
 	 * transaction - it will be invalid and, if successful, will just end
 	 * up propagating the write error out to the filesystem. */
@@ -1320,26 +1265,15 @@ static int _update_journal_header_block(
 		jh->j_first_unflushed_offset = cpu_to_le32(offset);
 		jh->j_mount_id = cpu_to_le32(journal->j_mount_id);
 
-		if (reiserfs_barrier_flush(sb)) {
-			int ret;
-			lock_buffer(journal->j_header_bh);
-			ret = submit_barrier_buffer(journal->j_header_bh);
-			if (ret == -EOPNOTSUPP) {
-				set_buffer_uptodate(journal->j_header_bh);
-				disable_barrier(sb);
-				goto sync;
-			}
-			reiserfs_write_unlock(sb);
-			wait_on_buffer(journal->j_header_bh);
-			reiserfs_write_lock(sb);
-			check_barrier_completion(sb, journal->j_header_bh);
-		} else {
-		      sync:
-			set_buffer_dirty(journal->j_header_bh);
-			reiserfs_write_unlock(sb);
+		set_buffer_dirty(journal->j_header_bh);
+		reiserfs_write_unlock(sb);
+
+		if (reiserfs_barrier_flush(sb))
+			__sync_dirty_buffer(journal->j_header_bh, WRITE_FLUSH_FUA);
+		else
 			sync_dirty_buffer(journal->j_header_bh);
-			reiserfs_write_lock(sb);
-		}
+
+		reiserfs_write_lock(sb);
 		if (!buffer_uptodate(journal->j_header_bh)) {
 			reiserfs_warning(sb, "journal-837",
 					 "IO error during journal replay");


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 07/15] nilfs2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (5 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 06/15] reiserfs: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 13:31   ` Ryusuke Konishi
  2010-08-18  9:29 ` [PATCH 08/15] jbd: " Christoph Hellwig
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: nilfs2-use-flush-fua --]
[-- Type: text/plain, Size: 1889 bytes --]

Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
detection for barriers and stop setting the barrier flag for discards.

XXX: nilfs2 does not actually wait for discards to finish, so the code
after this patch is almost guaranteed to be incorrect when dicards are
used.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/nilfs2/super.c
===================================================================
--- linux-2.6.orig/fs/nilfs2/super.c	2010-08-17 16:37:07.848008123 +0200
+++ linux-2.6/fs/nilfs2/super.c	2010-08-17 16:39:44.528037875 +0200
@@ -183,17 +183,9 @@ static int nilfs_sync_super(struct nilfs
 
  retry:
 	set_buffer_dirty(nilfs->ns_sbh[0]);
-
 	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;
-		}
+					  WRITE_SYNC | WRITE_FLUSH_FUA);
 	} else {
 		err = sync_dirty_buffer(nilfs->ns_sbh[0]);
 	}
Index: linux-2.6/fs/nilfs2/the_nilfs.c
===================================================================
--- linux-2.6.orig/fs/nilfs2/the_nilfs.c	2010-08-17 16:38:22.118254665 +0200
+++ linux-2.6/fs/nilfs2/the_nilfs.c	2010-08-17 16:38:50.459265700 +0200
@@ -674,7 +674,7 @@ int nilfs_discard_segments(struct the_ni
 						   start * sects_per_block,
 						   nblocks * sects_per_block,
 						   GFP_NOFS,
-						   BLKDEV_IFL_BARRIER);
+						   0);
 			if (ret < 0)
 				return ret;
 			nblocks = 0;
@@ -684,7 +684,7 @@ int nilfs_discard_segments(struct the_ni
 		ret = blkdev_issue_discard(nilfs->ns_bdev,
 					   start * sects_per_block,
 					   nblocks * sects_per_block,
-					   GFP_NOFS, BLKDEV_IFL_BARRIER);
+					   GFP_NOFS, 0);
 	return ret;
 }
 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 08/15] jbd: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (6 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 07/15] nilfs2: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 13:07   ` Jan Kara
  2010-08-18  9:29 ` [PATCH 09/15] jbd2: " Christoph Hellwig
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: jbd-use-flush-fua --]
[-- Type: text/plain, Size: 1560 bytes --]

Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
EOPNOTSUPP detection for barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/jbd/commit.c
===================================================================
--- linux-2.6.orig/fs/jbd/commit.c	2010-08-17 16:46:44.370004211 +0200
+++ linux-2.6/fs/jbd/commit.c	2010-08-17 16:47:18.894004770 +0200
@@ -137,34 +137,10 @@ static int journal_write_commit_record(j
 	JBUFFER_TRACE(descriptor, "write commit block");
 	set_buffer_dirty(bh);
 
-	if (journal->j_flags & JFS_BARRIER) {
-		ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER);
-
-		/*
-		 * Is it possible for another commit to fail at roughly
-		 * the same time as this one?  If so, we don't want to
-		 * trust the barrier flag in the super, but instead want
-		 * to remember if we sent a barrier request
-		 */
-		if (ret == -EOPNOTSUPP) {
-			char b[BDEVNAME_SIZE];
-
-			printk(KERN_WARNING
-				"JBD: barrier-based sync failed on %s - "
-				"disabling barriers\n",
-				bdevname(journal->j_dev, b));
-			spin_lock(&journal->j_state_lock);
-			journal->j_flags &= ~JFS_BARRIER;
-			spin_unlock(&journal->j_state_lock);
-
-			/* And try again, without the barrier */
-			set_buffer_uptodate(bh);
-			set_buffer_dirty(bh);
-			ret = sync_dirty_buffer(bh);
-		}
-	} else {
+	if (journal->j_flags & JFS_BARRIER)
+		ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_FLUSH_FUA);
+	else
 		ret = sync_dirty_buffer(bh);
-	}
 
 	put_bh(bh);		/* One for getblk() */
 	journal_put_journal_head(descriptor);


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 09/15] jbd2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (7 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 08/15] jbd: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 14:03   ` Jan Kara
  2010-08-18  9:29 ` [PATCH 10/15] ext4: do not send discards as barriers Christoph Hellwig
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: jbd2-use-flush-fua --]
[-- Type: text/plain, Size: 2064 bytes --]

Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
EOPNOTSUPP detection for barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/jbd2/commit.c
===================================================================
--- linux-2.6.orig/fs/jbd2/commit.c	2010-08-17 16:52:37.111011684 +0200
+++ linux-2.6/fs/jbd2/commit.c	2010-08-17 16:53:50.531029420 +0200
@@ -134,25 +134,10 @@ static int journal_submit_commit_record(
 
 	if (journal->j_flags & JBD2_BARRIER &&
 	    !JBD2_HAS_INCOMPAT_FEATURE(journal,
-				       JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
-		ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh);
-		if (ret == -EOPNOTSUPP) {
-			printk(KERN_WARNING
-			       "JBD: barrier-based sync failed on %s - "
-			       "disabling barriers\n", journal->j_devname);
-			spin_lock(&journal->j_state_lock);
-			journal->j_flags &= ~JBD2_BARRIER;
-			spin_unlock(&journal->j_state_lock);
-
-			/* And try again, without the barrier */
-			lock_buffer(bh);
-			set_buffer_uptodate(bh);
-			clear_buffer_dirty(bh);
-			ret = submit_bh(WRITE_SYNC_PLUG, bh);
-		}
-	} else {
+				       JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT))
+		ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh);
+	else
 		ret = submit_bh(WRITE_SYNC_PLUG, bh);
-	}
 
 	*cbh = bh;
 	return ret;
@@ -167,29 +152,8 @@ static int journal_wait_on_commit_record
 {
 	int ret = 0;
 
-retry:
 	clear_buffer_dirty(bh);
 	wait_on_buffer(bh);
-	if (buffer_eopnotsupp(bh) && (journal->j_flags & JBD2_BARRIER)) {
-		printk(KERN_WARNING
-		       "JBD2: wait_on_commit_record: sync failed on %s - "
-		       "disabling barriers\n", journal->j_devname);
-		spin_lock(&journal->j_state_lock);
-		journal->j_flags &= ~JBD2_BARRIER;
-		spin_unlock(&journal->j_state_lock);
-
-		lock_buffer(bh);
-		clear_buffer_dirty(bh);
-		set_buffer_uptodate(bh);
-		bh->b_end_io = journal_end_buffer_io_sync;
-
-		ret = submit_bh(WRITE_SYNC_PLUG, bh);
-		if (ret) {
-			unlock_buffer(bh);
-			return ret;
-		}
-		goto retry;
-	}
 
 	if (unlikely(!buffer_uptodate(bh)))
 		ret = -EIO;


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 10/15] ext4: do not send discards as barriers
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (8 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 09/15] jbd2: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 13:28   ` Jan Kara
  2010-08-18  9:29 ` [PATCH 11/15] fat: " Christoph Hellwig
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: ext4-discard-nobarrier --]
[-- Type: text/plain, Size: 746 bytes --]

ext4 already uses synchronous discards, no need to add I/O barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/ext4/mballoc.c
===================================================================
--- linux-2.6.orig/fs/ext4/mballoc.c	2010-08-17 16:48:50.546274081 +0200
+++ linux-2.6/fs/ext4/mballoc.c	2010-08-17 16:48:58.896006097 +0200
@@ -2589,9 +2589,7 @@ static void release_blocks_on_commit(jou
 					(unsigned long long)discard_block,
 					entry->count);
 			ret = sb_issue_discard(sb, discard_block, entry->count,
-						GFP_NOFS,
-						BLKDEV_IFL_WAIT |
-						BLKDEV_IFL_BARRIER);
+						GFP_NOFS, BLKDEV_IFL_WAIT);
 			if (ret == EOPNOTSUPP) {
 				ext4_warning(sb,
 					"discard not supported, disabling");


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 11/15] fat: do not send discards as barriers
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (9 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 10/15] ext4: do not send discards as barriers Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 12/15] swap: " Christoph Hellwig
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: fat-discard-nobarrier --]
[-- Type: text/plain, Size: 609 bytes --]

fat already uses synchronous discards, no need to add I/O barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/fat/fatent.c
===================================================================
--- linux-2.6.orig/fs/fat/fatent.c	2010-08-17 16:49:12.976253898 +0200
+++ linux-2.6/fs/fat/fatent.c	2010-08-17 16:49:17.378285050 +0200
@@ -579,7 +579,7 @@ int fat_free_clusters(struct inode *inod
 					fat_clus_to_blknr(sbi, first_cl),
 					nr_clus * sbi->sec_per_clus,
 					GFP_NOFS,
-					BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+					BLKDEV_IFL_WAIT);
 
 				first_cl = cluster;
 			}


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 12/15] swap: do not send discards as barriers
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (10 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 11/15] fat: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-19  3:47   ` Hugh Dickins
  2010-08-18  9:29 ` [PATCH 13/15] remove the WRITE_BARRIER flag Christoph Hellwig
                   ` (5 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: swap-discard-nobarrier --]
[-- Type: text/plain, Size: 1196 bytes --]

The swap code already uses synchronous discards, no need to add I/O barriers.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/mm/swapfile.c
===================================================================
--- linux-2.6.orig/mm/swapfile.c	2010-08-17 16:49:28.312010428 +0200
+++ linux-2.6/mm/swapfile.c	2010-08-17 16:49:43.694255853 +0200
@@ -140,7 +140,7 @@ static int discard_swap(struct swap_info
 	if (nr_blocks) {
 		err = blkdev_issue_discard(si->bdev, start_block,
 				nr_blocks, GFP_KERNEL,
-				BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+				BLKDEV_IFL_WAIT);
 		if (err)
 			return err;
 		cond_resched();
@@ -152,7 +152,7 @@ static int discard_swap(struct swap_info
 
 		err = blkdev_issue_discard(si->bdev, start_block,
 				nr_blocks, GFP_KERNEL,
-				BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
+				BLKDEV_IFL_WAIT);
 		if (err)
 			break;
 
@@ -191,8 +191,7 @@ static void discard_swap_cluster(struct
 			start_block <<= PAGE_SHIFT - 9;
 			nr_blocks <<= PAGE_SHIFT - 9;
 			if (blkdev_issue_discard(si->bdev, start_block,
-				    nr_blocks, GFP_NOIO, BLKDEV_IFL_WAIT |
-							BLKDEV_IFL_BARRIER))
+				    nr_blocks, GFP_NOIO, BLKDEV_IFL_WAIT))
 				break;
 		}
 


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 13/15] remove the WRITE_BARRIER flag
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (11 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 12/15] swap: " Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18  9:29 ` [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag Christoph Hellwig
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: kill-WRITE_BARRIER --]
[-- Type: text/plain, Size: 1147 bytes --]

It's unused now.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/include/linux/fs.h
===================================================================
--- linux-2.6.orig/include/linux/fs.h	2010-08-17 16:50:01.004254175 +0200
+++ linux-2.6/include/linux/fs.h	2010-08-17 16:52:27.329271148 +0200
@@ -138,7 +138,6 @@ struct inodes_stat_t {
  * SWRITE_SYNC
  * SWRITE_SYNC_PLUG	Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
  *			See SWRITE.
- * WRITE_BARRIER	DEPRECATED. Always fails. Use FLUSH/FUA instead.
  * WRITE_FLUSH		Like WRITE_SYNC but with preceding cache flush.
  * WRITE_FUA		Like WRITE_SYNC but data is guaranteed to be on
  *			non-volatile media on completion.
@@ -160,8 +159,6 @@ struct inodes_stat_t {
 #define WRITE_SYNC		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
 #define WRITE_ODIRECT_PLUG	(WRITE | REQ_SYNC)
 #define WRITE_META		(WRITE | REQ_META)
-#define WRITE_BARRIER		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
-				 REQ_HARDBARRIER)
 #define WRITE_FLUSH		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
 				 REQ_FLUSH)
 #define WRITE_FUA		(WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (12 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 13/15] remove the WRITE_BARRIER flag Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-20  1:26   ` Mike Snitzer
  2010-08-18  9:29 ` [PATCH 15/15] remove the BH_Eopnotsupp flag Christoph Hellwig
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: kill-discard-barrier --]
[-- Type: text/plain, Size: 2907 bytes --]

Remove support for barriers on discards, which is unused now.  Also
remove the DISCARD_NOBARRIER I/O type in favour of just setting the
rw flags up locally in blkdev_issue_discard.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/block/blk-lib.c
===================================================================
--- linux-2.6.orig/block/blk-lib.c	2010-08-17 16:50:30.438254107 +0200
+++ linux-2.6/block/blk-lib.c	2010-08-17 16:51:44.809025795 +0200
@@ -39,8 +39,7 @@ int blkdev_issue_discard(struct block_de
 {
 	DECLARE_COMPLETION_ONSTACK(wait);
 	struct request_queue *q = bdev_get_queue(bdev);
-	int type = flags & BLKDEV_IFL_BARRIER ?
-		DISCARD_BARRIER : DISCARD_NOBARRIER;
+	int type = REQ_WRITE | REQ_DISCARD;
 	unsigned int max_discard_sectors;
 	struct bio *bio;
 	int ret = 0;
@@ -156,12 +155,6 @@ int blkdev_issue_zeroout(struct block_de
 	bb.wait = &wait;
 	bb.end_io = NULL;
 
-	if (flags & BLKDEV_IFL_BARRIER) {
-		/* issue async barrier before the data */
-		ret = blkdev_issue_flush(bdev, gfp_mask, NULL, 0);
-		if (ret)
-			return ret;
-	}
 submit:
 	ret = 0;
 	while (nr_sects != 0) {
@@ -193,13 +186,6 @@ submit:
 		issued++;
 		submit_bio(WRITE, bio);
 	}
-	/*
-	 * When all data bios are in flight. Send final barrier if requeted.
-	 */
-	if (nr_sects == 0 && flags & BLKDEV_IFL_BARRIER)
-		ret = blkdev_issue_flush(bdev, gfp_mask, NULL,
-					flags & BLKDEV_IFL_WAIT);
-
 
 	if (flags & BLKDEV_IFL_WAIT)
 		/* Wait for bios in-flight */
Index: linux-2.6/include/linux/blkdev.h
===================================================================
--- linux-2.6.orig/include/linux/blkdev.h	2010-08-17 16:51:50.018003723 +0200
+++ linux-2.6/include/linux/blkdev.h	2010-08-17 16:52:06.146015176 +0200
@@ -867,10 +867,8 @@ static inline struct request *blk_map_qu
 }
 enum{
 	BLKDEV_WAIT,	/* wait for completion */
-	BLKDEV_BARRIER,	/*issue request with barrier */
 };
 #define BLKDEV_IFL_WAIT		(1 << BLKDEV_WAIT)
-#define BLKDEV_IFL_BARRIER	(1 << BLKDEV_BARRIER)
 extern int blkdev_issue_flush(struct block_device *, gfp_t, sector_t *,
 			unsigned long);
 extern int blkdev_issue_discard(struct block_device *bdev, sector_t sector,
Index: linux-2.6/include/linux/fs.h
===================================================================
--- linux-2.6.orig/include/linux/fs.h	2010-08-17 16:50:30.424260881 +0200
+++ linux-2.6/include/linux/fs.h	2010-08-17 16:50:37.579005468 +0200
@@ -168,13 +168,6 @@ struct inodes_stat_t {
 #define SWRITE_SYNC_PLUG	(SWRITE | REQ_SYNC | REQ_NOIDLE)
 #define SWRITE_SYNC		(SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
 
-/*
- * These aren't really reads or writes, they pass down information about
- * parts of device that are now unused by the file system.
- */
-#define DISCARD_NOBARRIER	(WRITE | REQ_DISCARD)
-#define DISCARD_BARRIER		(WRITE | REQ_DISCARD | REQ_HARDBARRIER)
-
 #define SEL_IN		1
 #define SEL_OUT		2
 #define SEL_EX		4


^ permalink raw reply	[flat|nested] 41+ messages in thread

* [PATCH 15/15] remove the BH_Eopnotsupp flag
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (13 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag Christoph Hellwig
@ 2010-08-18  9:29 ` Christoph Hellwig
  2010-08-18 10:35 ` [PATCH 00/15] replace barriers with explicit flush / FUA usage Joel Becker
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18  9:29 UTC (permalink / raw)
  To: tj
  Cc: chris.mason, swhiteho, konishi.ryusuke, tytso, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: kill-buffer_eopnotsupp --]
[-- Type: text/plain, Size: 2755 bytes --]

This flag was only set for barrier buffers, which we don't submit
anymore.

Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/buffer.c
===================================================================
--- linux-2.6.orig/fs/buffer.c	2010-08-17 16:54:41.264023137 +0200
+++ linux-2.6/fs/buffer.c	2010-08-17 16:55:20.874006239 +0200
@@ -156,7 +156,7 @@ void end_buffer_write_sync(struct buffer
 	if (uptodate) {
 		set_buffer_uptodate(bh);
 	} else {
-		if (!buffer_eopnotsupp(bh) && !quiet_error(bh)) {
+		if (!quiet_error(bh)) {
 			buffer_io_error(bh);
 			printk(KERN_WARNING "lost page write due to "
 					"I/O error on %s\n",
@@ -2998,7 +2998,6 @@ static void end_bio_bh_io_sync(struct bi
 
 	if (err == -EOPNOTSUPP) {
 		set_bit(BIO_EOPNOTSUPP, &bio->bi_flags);
-		set_bit(BH_Eopnotsupp, &bh->b_state);
 	}
 
 	if (unlikely (test_bit(BIO_QUIET,&bio->bi_flags)))
@@ -3133,10 +3132,6 @@ int __sync_dirty_buffer(struct buffer_he
 		bh->b_end_io = end_buffer_write_sync;
 		ret = submit_bh(rw, bh);
 		wait_on_buffer(bh);
-		if (buffer_eopnotsupp(bh)) {
-			clear_buffer_eopnotsupp(bh);
-			ret = -EOPNOTSUPP;
-		}
 		if (!ret && !buffer_uptodate(bh))
 			ret = -EIO;
 	} else {
Index: linux-2.6/fs/fat/misc.c
===================================================================
--- linux-2.6.orig/fs/fat/misc.c	2010-08-17 16:54:15.924259764 +0200
+++ linux-2.6/fs/fat/misc.c	2010-08-17 16:54:31.050283161 +0200
@@ -253,10 +253,7 @@ int fat_sync_bhs(struct buffer_head **bh
 	ll_rw_block(SWRITE, nr_bhs, bhs);
 	for (i = 0; i < nr_bhs; i++) {
 		wait_on_buffer(bhs[i]);
-		if (buffer_eopnotsupp(bhs[i])) {
-			clear_buffer_eopnotsupp(bhs[i]);
-			err = -EOPNOTSUPP;
-		} else if (!err && !buffer_uptodate(bhs[i]))
+		if (!err && !buffer_uptodate(bhs[i]))
 			err = -EIO;
 	}
 	return err;
Index: linux-2.6/include/linux/buffer_head.h
===================================================================
--- linux-2.6.orig/include/linux/buffer_head.h	2010-08-17 16:55:24.578254804 +0200
+++ linux-2.6/include/linux/buffer_head.h	2010-08-17 16:55:28.173010427 +0200
@@ -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_Eopnotsupp,	/* DEPRECATED: operation not supported (barrier) */
 	BH_Unwritten,	/* Buffer is allocated on disk but not written */
 	BH_Quiet,	/* Buffer Error Prinks to be quiet */
 
@@ -124,7 +123,6 @@ BUFFER_FNS(Async_Write, async_write)
 BUFFER_FNS(Delay, delay)
 BUFFER_FNS(Boundary, boundary)
 BUFFER_FNS(Write_EIO, write_io_error)
-BUFFER_FNS(Eopnotsupp, eopnotsupp)
 BUFFER_FNS(Unwritten, unwritten)
 
 #define bh_offset(bh)		((unsigned long)(bh)->b_data & ~PAGE_MASK)


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 05/15] gfs2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 05/15] gfs2: " Christoph Hellwig
@ 2010-08-18 10:08   ` Steven Whitehouse
  2010-08-18 13:37   ` Bob Peterson
  1 sibling, 0 replies; 41+ messages in thread
From: Steven Whitehouse @ 2010-08-18 10:08 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, konishi.ryusuke, tytso, jack, hirofumi, mfasheh,
	joel.becker, hughd, linux-fsdevel

Hi,

Acked-by: Steven Whitehouse <swhiteho@redhat.com>

Steve.

On Wed, 2010-08-18 at 05:29 -0400, Christoph Hellwig wrote:
> plain text document attachment (gfs2-use-flush-fua)
> Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
> detection for barriers and stop setting the barrier flag for discards.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6/fs/gfs2/log.c
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/log.c	2010-08-17 16:19:53.597003932 +0200
> +++ linux-2.6/fs/gfs2/log.c	2010-08-17 16:22:04.889005329 +0200
> @@ -592,22 +592,13 @@ static void log_write_header(struct gfs2
>  	lh->lh_hash = cpu_to_be32(hash);
>  
>  	bh->b_end_io = end_buffer_write_sync;
> -	if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
> -		goto skip_barrier;
>  	get_bh(bh);
> -	submit_bh(WRITE_BARRIER | REQ_META, bh);
> -	wait_on_buffer(bh);
> -	if (buffer_eopnotsupp(bh)) {
> -		clear_buffer_eopnotsupp(bh);
> -		set_buffer_uptodate(bh);
> -		fs_info(sdp, "barrier sync failed - disabling barriers\n");
> -		set_bit(SDF_NOBARRIERS, &sdp->sd_flags);
> -		lock_buffer(bh);
> -skip_barrier:
> -		get_bh(bh);
> +	if (test_bit(SDF_NOBARRIERS, &sdp->sd_flags))
>  		submit_bh(WRITE_SYNC | REQ_META, bh);
> -		wait_on_buffer(bh);
> -	}
> +	else
> +		submit_bh(WRITE_FLUSH_FUA | REQ_META, bh);
> +	wait_on_buffer(bh);
> +
>  	if (!buffer_uptodate(bh))
>  		gfs2_io_error_bh(sdp, bh);
>  	brelse(bh);
> Index: linux-2.6/fs/gfs2/rgrp.c
> ===================================================================
> --- linux-2.6.orig/fs/gfs2/rgrp.c	2010-08-17 16:21:23.626253967 +0200
> +++ linux-2.6/fs/gfs2/rgrp.c	2010-08-17 16:21:39.702005748 +0200
> @@ -854,8 +854,7 @@ static void gfs2_rgrp_send_discards(stru
>  				if ((start + nr_sects) != blk) {
>  					rv = blkdev_issue_discard(bdev, start,
>  							    nr_sects, GFP_NOFS,
> -							    BLKDEV_IFL_WAIT |
> -							    BLKDEV_IFL_BARRIER);
> +							    BLKDEV_IFL_WAIT);
>  					if (rv)
>  						goto fail;
>  					nr_sects = 0;
> @@ -870,7 +869,7 @@ start_new_extent:
>  	}
>  	if (nr_sects) {
>  		rv = blkdev_issue_discard(bdev, start, nr_sects, GFP_NOFS,
> -					 BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
> +					 BLKDEV_IFL_WAIT);
>  		if (rv)
>  			goto fail;
>  	}
> 



^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (14 preceding siblings ...)
  2010-08-18  9:29 ` [PATCH 15/15] remove the BH_Eopnotsupp flag Christoph Hellwig
@ 2010-08-18 10:35 ` Joel Becker
  2010-08-18 10:53   ` Christoph Hellwig
  2010-08-18 15:11 ` Ted Ts'o
  2010-08-20  4:00 ` Tao Ma
  17 siblings, 1 reply; 41+ messages in thread
From: Joel Becker @ 2010-08-18 10:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 05:29:08AM -0400, Christoph Hellwig wrote:
> This series converts over all filesystems to the new WRITE_FLUSH_FUA
> primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
> have passed extensive xfstests coverage with this, while ocfs2, nilfs2
> and fat are unsupposed by xfstests and thus untested in this patch.

	What does it take to get ocfs2 supported by xfstests?

Joel

-- 

"But then she looks me in the eye
 And says, 'We're going to last forever,'
 And man you know I can't begin to doubt it.
 Cause it just feels so good and so free and so right,
 I know we ain't never going to change our minds about it, Hey!
 Here comes my girl."

Joel Becker
Consulting Software Developer
Oracle
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18 10:35 ` [PATCH 00/15] replace barriers with explicit flush / FUA usage Joel Becker
@ 2010-08-18 10:53   ` Christoph Hellwig
  2010-08-20  6:50     ` Tao Ma
  0 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18 10:53 UTC (permalink / raw)
  To: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	tytso, jack, hirofumi

On Wed, Aug 18, 2010 at 03:35:42AM -0700, Joel Becker wrote:
> On Wed, Aug 18, 2010 at 05:29:08AM -0400, Christoph Hellwig wrote:
> > This series converts over all filesystems to the new WRITE_FLUSH_FUA
> > primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
> > have passed extensive xfstests coverage with this, while ocfs2, nilfs2
> > and fat are unsupposed by xfstests and thus untested in this patch.
> 
> 	What does it take to get ocfs2 supported by xfstests?

Basically just a few filesystem-specific paramters need to be added
to the switch table in common.rc:

 - mkfs paramters if the default mkfs.$FSTYPE invocation doesn't do the
   right thing, or ask for confirmatio when doing things like
   overwriting existing filesystems or working on whole disks (not sure
   if anyone but extN came up with that last weird thing)
 - mount paramters for a successfull single node mount with acls and
   xattrs enabled
 - fsck options to actually force a real check even if the filesystem
   is mounted clean (and is nessecary to not make it wait for user
   input)
 - optionally an entry to create a filesystem with a given size for
   ENOSPC tests.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 04/15] btrfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 04/15] btrfs: " Christoph Hellwig
@ 2010-08-18 12:06   ` Chris Mason
  0 siblings, 0 replies; 41+ messages in thread
From: Chris Mason @ 2010-08-18 12:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, swhiteho, konishi.ryusuke, tytso, jack, hirofumi, mfasheh,
	joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 05:29:12AM -0400, Christoph Hellwig wrote:
> Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
> detection for barriers and stop setting the barrier flag for discards.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Nice.

Signed-off-by: Chris Mason <chris.mason@oracle.com>

-chris


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 08/15] jbd: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 08/15] jbd: " Christoph Hellwig
@ 2010-08-18 13:07   ` Jan Kara
  0 siblings, 0 replies; 41+ messages in thread
From: Jan Kara @ 2010-08-18 13:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed 18-08-10 05:29:16, Christoph Hellwig wrote:
> Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
> EOPNOTSUPP detection for barriers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
  Looks OK.
Acked-by: Jan Kara <jack@suse.cz>

								Honza
> 
> Index: linux-2.6/fs/jbd/commit.c
> ===================================================================
> --- linux-2.6.orig/fs/jbd/commit.c	2010-08-17 16:46:44.370004211 +0200
> +++ linux-2.6/fs/jbd/commit.c	2010-08-17 16:47:18.894004770 +0200
> @@ -137,34 +137,10 @@ static int journal_write_commit_record(j
>  	JBUFFER_TRACE(descriptor, "write commit block");
>  	set_buffer_dirty(bh);
>  
> -	if (journal->j_flags & JFS_BARRIER) {
> -		ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_BARRIER);
> -
> -		/*
> -		 * Is it possible for another commit to fail at roughly
> -		 * the same time as this one?  If so, we don't want to
> -		 * trust the barrier flag in the super, but instead want
> -		 * to remember if we sent a barrier request
> -		 */
> -		if (ret == -EOPNOTSUPP) {
> -			char b[BDEVNAME_SIZE];
> -
> -			printk(KERN_WARNING
> -				"JBD: barrier-based sync failed on %s - "
> -				"disabling barriers\n",
> -				bdevname(journal->j_dev, b));
> -			spin_lock(&journal->j_state_lock);
> -			journal->j_flags &= ~JFS_BARRIER;
> -			spin_unlock(&journal->j_state_lock);
> -
> -			/* And try again, without the barrier */
> -			set_buffer_uptodate(bh);
> -			set_buffer_dirty(bh);
> -			ret = sync_dirty_buffer(bh);
> -		}
> -	} else {
> +	if (journal->j_flags & JFS_BARRIER)
> +		ret = __sync_dirty_buffer(bh, WRITE_SYNC | WRITE_FLUSH_FUA);
> +	else
>  		ret = sync_dirty_buffer(bh);
> -	}
>  
>  	put_bh(bh);		/* One for getblk() */
>  	journal_put_journal_head(descriptor);
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 06/15] reiserfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 06/15] reiserfs: " Christoph Hellwig
@ 2010-08-18 13:16   ` Jan Kara
  2010-08-18 13:21     ` Chris Mason
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Kara @ 2010-08-18 13:16 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed 18-08-10 05:29:14, Christoph Hellwig wrote:
> 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>
  This one looks good to me as well.
Acked-by: Jan Kara <jack@suse.cz>

								Honza

> Index: linux-2.6/fs/reiserfs/journal.c
> ===================================================================
> --- linux-2.6.orig/fs/reiserfs/journal.c	2010-08-17 16:26:42.837261928 +0200
> +++ linux-2.6/fs/reiserfs/journal.c	2010-08-17 16:35:34.565255365 +0200
> @@ -138,13 +138,6 @@ static int reiserfs_clean_and_file_buffe
>  	return 0;
>  }
>  
> -static void disable_barrier(struct super_block *s)
> -{
> -	REISERFS_SB(s)->s_mount_opt &= ~(1 << REISERFS_BARRIER_FLUSH);
> -	printk("reiserfs: disabling flush barriers on %s\n",
> -	       reiserfs_bdevname(s));
> -}
> -
>  static struct reiserfs_bitmap_node *allocate_bitmap_node(struct super_block
>  							 *sb)
>  {
> @@ -677,30 +670,6 @@ static void submit_ordered_buffer(struct
>  	submit_bh(WRITE, bh);
>  }
>  
> -static int submit_barrier_buffer(struct buffer_head *bh)
> -{
> -	get_bh(bh);
> -	bh->b_end_io = reiserfs_end_ordered_io;
> -	clear_buffer_dirty(bh);
> -	if (!buffer_uptodate(bh))
> -		BUG();
> -	return submit_bh(WRITE_BARRIER, bh);
> -}
> -
> -static void check_barrier_completion(struct super_block *s,
> -				     struct buffer_head *bh)
> -{
> -	if (buffer_eopnotsupp(bh)) {
> -		clear_buffer_eopnotsupp(bh);
> -		disable_barrier(s);
> -		set_buffer_uptodate(bh);
> -		set_buffer_dirty(bh);
> -		reiserfs_write_unlock(s);
> -		sync_dirty_buffer(bh);
> -		reiserfs_write_lock(s);
> -	}
> -}
> -
>  #define CHUNK_SIZE 32
>  struct buffer_chunk {
>  	struct buffer_head *bh[CHUNK_SIZE];
> @@ -1010,7 +979,6 @@ static int flush_commit_list(struct supe
>  	struct buffer_head *tbh = NULL;
>  	unsigned int trans_id = jl->j_trans_id;
>  	struct reiserfs_journal *journal = SB_JOURNAL(s);
> -	int barrier = 0;
>  	int retval = 0;
>  	int write_len;
>  
> @@ -1095,24 +1063,6 @@ static int flush_commit_list(struct supe
>  	}
>  	atomic_dec(&journal->j_async_throttle);
>  
> -	/* We're skipping the commit if there's an error */
> -	if (retval || reiserfs_is_journal_aborted(journal))
> -		barrier = 0;
> -
> -	/* wait on everything written so far before writing the commit
> -	 * if we are in barrier mode, send the commit down now
> -	 */
> -	barrier = reiserfs_barrier_flush(s);
> -	if (barrier) {
> -		int ret;
> -		lock_buffer(jl->j_commit_bh);
> -		ret = submit_barrier_buffer(jl->j_commit_bh);
> -		if (ret == -EOPNOTSUPP) {
> -			set_buffer_uptodate(jl->j_commit_bh);
> -			disable_barrier(s);
> -			barrier = 0;
> -		}
> -	}
>  	for (i = 0; i < (jl->j_len + 1); i++) {
>  		bn = SB_ONDISK_JOURNAL_1st_BLOCK(s) +
>  		    (jl->j_start + i) % SB_ONDISK_JOURNAL_SIZE(s);
> @@ -1144,27 +1094,22 @@ static int flush_commit_list(struct supe
>  
>  	BUG_ON(atomic_read(&(jl->j_commit_left)) != 1);
>  
> -	if (!barrier) {
> -		/* If there was a write error in the journal - we can't commit
> -		 * this transaction - it will be invalid and, if successful,
> -		 * will just end up propagating the write error out to
> -		 * the file system. */
> -		if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
> -			if (buffer_dirty(jl->j_commit_bh))
> -				BUG();
> -			mark_buffer_dirty(jl->j_commit_bh) ;
> -			reiserfs_write_unlock(s);
> -			sync_dirty_buffer(jl->j_commit_bh) ;
> -			reiserfs_write_lock(s);
> -		}
> -	} else {
> +	/* If there was a write error in the journal - we can't commit
> +	 * this transaction - it will be invalid and, if successful,
> +	 * will just end up propagating the write error out to
> +	 * the file system. */
> +	if (likely(!retval && !reiserfs_is_journal_aborted (journal))) {
> +		if (buffer_dirty(jl->j_commit_bh))
> +			BUG();
> +		mark_buffer_dirty(jl->j_commit_bh) ;
>  		reiserfs_write_unlock(s);
> -		wait_on_buffer(jl->j_commit_bh);
> +		if (reiserfs_barrier_flush(s))
> +			__sync_dirty_buffer(jl->j_commit_bh, WRITE_FLUSH_FUA);
> +		else
> +			sync_dirty_buffer(jl->j_commit_bh);
>  		reiserfs_write_lock(s);
>  	}
>  
> -	check_barrier_completion(s, jl->j_commit_bh);
> -
>  	/* If there was a write error in the journal - we can't commit this
>  	 * transaction - it will be invalid and, if successful, will just end
>  	 * up propagating the write error out to the filesystem. */
> @@ -1320,26 +1265,15 @@ static int _update_journal_header_block(
>  		jh->j_first_unflushed_offset = cpu_to_le32(offset);
>  		jh->j_mount_id = cpu_to_le32(journal->j_mount_id);
>  
> -		if (reiserfs_barrier_flush(sb)) {
> -			int ret;
> -			lock_buffer(journal->j_header_bh);
> -			ret = submit_barrier_buffer(journal->j_header_bh);
> -			if (ret == -EOPNOTSUPP) {
> -				set_buffer_uptodate(journal->j_header_bh);
> -				disable_barrier(sb);
> -				goto sync;
> -			}
> -			reiserfs_write_unlock(sb);
> -			wait_on_buffer(journal->j_header_bh);
> -			reiserfs_write_lock(sb);
> -			check_barrier_completion(sb, journal->j_header_bh);
> -		} else {
> -		      sync:
> -			set_buffer_dirty(journal->j_header_bh);
> -			reiserfs_write_unlock(sb);
> +		set_buffer_dirty(journal->j_header_bh);
> +		reiserfs_write_unlock(sb);
> +
> +		if (reiserfs_barrier_flush(sb))
> +			__sync_dirty_buffer(journal->j_header_bh, WRITE_FLUSH_FUA);
> +		else
>  			sync_dirty_buffer(journal->j_header_bh);
> -			reiserfs_write_lock(sb);
> -		}
> +
> +		reiserfs_write_lock(sb);
>  		if (!buffer_uptodate(journal->j_header_bh)) {
>  			reiserfs_warning(sb, "journal-837",
>  					 "IO error during journal replay");
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 06/15] reiserfs: replace barriers with explicit flush / FUA usage
  2010-08-18 13:16   ` Jan Kara
@ 2010-08-18 13:21     ` Chris Mason
  0 siblings, 0 replies; 41+ messages in thread
From: Chris Mason @ 2010-08-18 13:21 UTC (permalink / raw)
  To: Jan Kara
  Cc: Christoph Hellwig, tj, swhiteho, konishi.ryusuke, tytso,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 03:16:27PM +0200, Jan Kara wrote:
> On Wed 18-08-10 05:29:14, Christoph Hellwig wrote:
> > 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>
>   This one looks good to me as well.
> Acked-by: Jan Kara <jack@suse.cz>

me too

Acked-by: Chris Mason <chris.mason@oracle.com>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 10/15] ext4: do not send discards as barriers
  2010-08-18  9:29 ` [PATCH 10/15] ext4: do not send discards as barriers Christoph Hellwig
@ 2010-08-18 13:28   ` Jan Kara
  0 siblings, 0 replies; 41+ messages in thread
From: Jan Kara @ 2010-08-18 13:28 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed 18-08-10 05:29:18, Christoph Hellwig wrote:
> ext4 already uses synchronous discards, no need to add I/O barriers.
  The patch looks ok. But note that in -rc1 the code looks sligthly
differently so you'll need to rediff it.

								Honza
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6/fs/ext4/mballoc.c
> ===================================================================
> --- linux-2.6.orig/fs/ext4/mballoc.c	2010-08-17 16:48:50.546274081 +0200
> +++ linux-2.6/fs/ext4/mballoc.c	2010-08-17 16:48:58.896006097 +0200
> @@ -2589,9 +2589,7 @@ static void release_blocks_on_commit(jou
>  					(unsigned long long)discard_block,
>  					entry->count);
>  			ret = sb_issue_discard(sb, discard_block, entry->count,
> -						GFP_NOFS,
> -						BLKDEV_IFL_WAIT |
> -						BLKDEV_IFL_BARRIER);
> +						GFP_NOFS, BLKDEV_IFL_WAIT);
>  			if (ret == EOPNOTSUPP) {
>  				ext4_warning(sb,
>  					"discard not supported, disabling");
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 07/15] nilfs2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 07/15] nilfs2: " Christoph Hellwig
@ 2010-08-18 13:31   ` Ryusuke Konishi
  2010-08-18 13:41     ` Christoph Hellwig
  0 siblings, 1 reply; 41+ messages in thread
From: Ryusuke Konishi @ 2010-08-18 13:31 UTC (permalink / raw)
  To: hch
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, 18 Aug 2010 05:29:15 -0400, Christoph Hellwig wrote:
> Switch to the WRITE_FLUSH_FUA flag for log writes, remove the EOPNOTSUPP
> detection for barriers and stop setting the barrier flag for discards.
> 
> XXX: nilfs2 does not actually wait for discards to finish, so the code
> after this patch is almost guaranteed to be incorrect when dicards are
> used.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Ahh, actually discards in nilfs missed adoption of wait semantics, and
should be corrected.

May I send up the following fix on ahead ?

As for the rest, the patch looks ok to me.

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

Thanks,
Ryusuke Konishi

---
From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>

nilfs2: wait for discard to finish

nilfs_discard_segment() doesn't wait for completion of discard
requests.  This specifies BLKDEV_IFL_WAIT flag when calling
blkdev_issue_discard() in order to fix the sync failure.

Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Cc: Christoph Hellwig <hch@lst.de>
---
 fs/nilfs2/the_nilfs.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
index 6af1c00..4317f17 100644
--- a/fs/nilfs2/the_nilfs.c
+++ b/fs/nilfs2/the_nilfs.c
@@ -775,6 +775,7 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump,
 						   start * sects_per_block,
 						   nblocks * sects_per_block,
 						   GFP_NOFS,
+						   BLKDEV_IFL_WAIT |
 						   BLKDEV_IFL_BARRIER);
 			if (ret < 0)
 				return ret;
@@ -785,7 +786,8 @@ int nilfs_discard_segments(struct the_nilfs *nilfs, __u64 *segnump,
 		ret = blkdev_issue_discard(nilfs->ns_bdev,
 					   start * sects_per_block,
 					   nblocks * sects_per_block,
-					   GFP_NOFS, BLKDEV_IFL_BARRIER);
+					   GFP_NOFS,
+					  BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
 	return ret;
 }
 
-- 
1.6.6.2


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 05/15] gfs2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 05/15] gfs2: " Christoph Hellwig
  2010-08-18 10:08   ` Steven Whitehouse
@ 2010-08-18 13:37   ` Bob Peterson
  1 sibling, 0 replies; 41+ messages in thread
From: Bob Peterson @ 2010-08-18 13:37 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: chris mason, swhiteho, konishi ryusuke, tytso, jack, hirofumi,
	mfasheh, joel becker, hughd, linux-fsdevel, tj

----- "Christoph Hellwig" <hch@infradead.org> wrote:
| Switch to the WRITE_FLUSH_FUA flag for log writes, remove the
| EOPNOTSUPP
| detection for barriers and stop setting the barrier flag for
| discards.
| 
| Signed-off-by: Christoph Hellwig <hch@lst.de>

Hi,

ACK

Bob Peterson
Red Hat File Systems

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 07/15] nilfs2: replace barriers with explicit flush / FUA usage
  2010-08-18 13:31   ` Ryusuke Konishi
@ 2010-08-18 13:41     ` Christoph Hellwig
  0 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18 13:41 UTC (permalink / raw)
  To: Ryusuke Konishi
  Cc: hch, tj, chris.mason, swhiteho, tytso, jack, hirofumi, mfasheh,
	joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 10:31:33PM +0900, Ryusuke Konishi wrote:
> May I send up the following fix on ahead ?

Sure, go ahead and send it to Linus.  This series will need rebasing
anyway sooner or later.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 09/15] jbd2: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 09/15] jbd2: " Christoph Hellwig
@ 2010-08-18 14:03   ` Jan Kara
  2010-08-18 14:09     ` Christoph Hellwig
  0 siblings, 1 reply; 41+ messages in thread
From: Jan Kara @ 2010-08-18 14:03 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

[-- Attachment #1: Type: text/plain, Size: 2765 bytes --]

On Wed 18-08-10 05:29:17, Christoph Hellwig wrote:
> Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
> EOPNOTSUPP detection for barriers.
  Well, in the context of just this patch series, the patch is OK so you
can add
  Acked-by: Jan Kara <jack@suse.cz>
But as soon as blkdev_issue_flush() stops draining the queue, commit when
JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT is set breaks. Do you plan to fix
that separately? Actually, attached is a patch which should fix
ASYNC_COMMIT code... The patch is totally untested, I just wrote it
because it's simpler than explaining what needs to be done ;).

								Honza
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
> Index: linux-2.6/fs/jbd2/commit.c
> ===================================================================
> --- linux-2.6.orig/fs/jbd2/commit.c	2010-08-17 16:52:37.111011684 +0200
> +++ linux-2.6/fs/jbd2/commit.c	2010-08-17 16:53:50.531029420 +0200
> @@ -134,25 +134,10 @@ static int journal_submit_commit_record(
>  
>  	if (journal->j_flags & JBD2_BARRIER &&
>  	    !JBD2_HAS_INCOMPAT_FEATURE(journal,
> -				       JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT)) {
> -		ret = submit_bh(WRITE_SYNC_PLUG | WRITE_BARRIER, bh);
> -		if (ret == -EOPNOTSUPP) {
> -			printk(KERN_WARNING
> -			       "JBD: barrier-based sync failed on %s - "
> -			       "disabling barriers\n", journal->j_devname);
> -			spin_lock(&journal->j_state_lock);
> -			journal->j_flags &= ~JBD2_BARRIER;
> -			spin_unlock(&journal->j_state_lock);
> -
> -			/* And try again, without the barrier */
> -			lock_buffer(bh);
> -			set_buffer_uptodate(bh);
> -			clear_buffer_dirty(bh);
> -			ret = submit_bh(WRITE_SYNC_PLUG, bh);
> -		}
> -	} else {
> +				       JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT))
> +		ret = submit_bh(WRITE_SYNC_PLUG | WRITE_FLUSH_FUA, bh);
> +	else
>  		ret = submit_bh(WRITE_SYNC_PLUG, bh);
> -	}
>  
>  	*cbh = bh;
>  	return ret;
> @@ -167,29 +152,8 @@ static int journal_wait_on_commit_record
>  {
>  	int ret = 0;
>  
> -retry:
>  	clear_buffer_dirty(bh);
>  	wait_on_buffer(bh);
> -	if (buffer_eopnotsupp(bh) && (journal->j_flags & JBD2_BARRIER)) {
> -		printk(KERN_WARNING
> -		       "JBD2: wait_on_commit_record: sync failed on %s - "
> -		       "disabling barriers\n", journal->j_devname);
> -		spin_lock(&journal->j_state_lock);
> -		journal->j_flags &= ~JBD2_BARRIER;
> -		spin_unlock(&journal->j_state_lock);
> -
> -		lock_buffer(bh);
> -		clear_buffer_dirty(bh);
> -		set_buffer_uptodate(bh);
> -		bh->b_end_io = journal_end_buffer_io_sync;
> -
> -		ret = submit_bh(WRITE_SYNC_PLUG, bh);
> -		if (ret) {
> -			unlock_buffer(bh);
> -			return ret;
> -		}
> -		goto retry;
> -	}
>  
>  	if (unlikely(!buffer_uptodate(bh)))
>  		ret = -EIO;
> 
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

[-- Attachment #2: 0001-jbd2-Modify-ASYNC_COMMIT-code-to-not-rely-on-queue-d.patch --]
[-- Type: text/x-patch, Size: 2255 bytes --]

>From 21a76eb2010faf0c4507a238d2d110bac9842146 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 18 Aug 2010 15:56:56 +0200
Subject: [PATCH] jbd2: Modify ASYNC_COMMIT code to not rely on queue draining on barrier

Currently JBD2 relies blkdev_issue_flush() draining the queue when ASYNC_COMMIT
feature is set. This property is going away so make JBD2 wait for buffers it
needs on its own before submitting the cache flush.

Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/jbd2/commit.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index 6a25e51..4c52f78 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -667,6 +667,15 @@ start_journal_io:
 		}
 	}
 
+	err = journal_finish_inode_data_buffers(journal, commit_transaction);
+	if (err) {
+		printk(KERN_WARNING
+			"JBD2: Detected IO errors while flushing file data "
+		       "on %s\n", journal->j_devname);
+		if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
+			jbd2_journal_abort(journal, err);
+		err = 0;
+	}
 	/* 
 	 * If the journal is not located on the file system device,
 	 * then we must flush the file system device before we issue
@@ -685,19 +694,6 @@ start_journal_io:
 						 &cbh, crc32_sum);
 		if (err)
 			__jbd2_journal_abort_hard(journal);
-		if (journal->j_flags & JBD2_BARRIER)
-			blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL,
-				BLKDEV_IFL_WAIT);
-	}
-
-	err = journal_finish_inode_data_buffers(journal, commit_transaction);
-	if (err) {
-		printk(KERN_WARNING
-			"JBD2: Detected IO errors while flushing file data "
-		       "on %s\n", journal->j_devname);
-		if (journal->j_flags & JBD2_ABORT_ON_SYNCDATA_ERR)
-			jbd2_journal_abort(journal, err);
-		err = 0;
 	}
 
 	/* Lo and behold: we have just managed to send a transaction to
@@ -811,6 +807,12 @@ wait_for_iobuf:
 	}
 	if (!err && !is_journal_aborted(journal))
 		err = journal_wait_on_commit_record(journal, cbh);
+	if (JBD2_HAS_INCOMPAT_FEATURE(journal,
+				      JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT) &&
+	    journal->j_flags & JBD2_BARRIER) {
+			blkdev_issue_flush(journal->j_dev, GFP_KERNEL, NULL,
+				BLKDEV_IFL_WAIT);
+	}
 
 	if (err)
 		jbd2_journal_abort(journal, err);
-- 
1.6.4.2


^ permalink raw reply related	[flat|nested] 41+ messages in thread

* Re: [PATCH 09/15] jbd2: replace barriers with explicit flush / FUA usage
  2010-08-18 14:03   ` Jan Kara
@ 2010-08-18 14:09     ` Christoph Hellwig
  0 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18 14:09 UTC (permalink / raw)
  To: Jan Kara
  Cc: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	tytso, hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 04:03:08PM +0200, Jan Kara wrote:
> On Wed 18-08-10 05:29:17, Christoph Hellwig wrote:
> > Switch to the WRITE_FLUSH_FUA flag for journal commits and remove the
> > EOPNOTSUPP detection for barriers.
>   Well, in the context of just this patch series, the patch is OK so you
> can add
>   Acked-by: Jan Kara <jack@suse.cz>
> But as soon as blkdev_issue_flush() stops draining the queue, commit when
> JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT is set breaks.

blkdev_issue_flush already stopped draining queues in Tejun's series.
When I talked to Ted last week my impression was that the async commit
doesn't rely on the queue draining but only on the cache flushing, but
my head is still spinning trying to understand what that code actually
does, and especially why.

But maybe Ted just meant to say in principle and not with the current
code.  If everyone is fine with your patch I can include it into the
next respin.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (15 preceding siblings ...)
  2010-08-18 10:35 ` [PATCH 00/15] replace barriers with explicit flush / FUA usage Joel Becker
@ 2010-08-18 15:11 ` Ted Ts'o
  2010-08-18 16:46   ` Christoph Hellwig
  2010-08-20  4:00 ` Tao Ma
  17 siblings, 1 reply; 41+ messages in thread
From: Ted Ts'o @ 2010-08-18 15:11 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, jack, hirofumi,
	mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 05:29:08AM -0400, Christoph Hellwig wrote:
> This series converts over all filesystems to the new WRITE_FLUSH_FUA
> primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
> have passed extensive xfstests coverage with this, while ocfs2, nilfs2
> and fat are unsupposed by xfstests and thus untested in this patch.

Tejun's patches didn't make the merge window, right?

I wonder if it makes sense to make a special appeal to Linus to get
the new kernel interface(s) for WRITE_FLUSH_FUA into 2.6.36-rc2 (without
any callers) to make it easier for us to do testing and merging into
our respective file system trees?

						- Ted

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18 15:11 ` Ted Ts'o
@ 2010-08-18 16:46   ` Christoph Hellwig
  0 siblings, 0 replies; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-18 16:46 UTC (permalink / raw)
  To: Ted Ts'o
  Cc: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	jack, hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 11:11:27AM -0400, Ted Ts'o wrote:
> On Wed, Aug 18, 2010 at 05:29:08AM -0400, Christoph Hellwig wrote:
> > This series converts over all filesystems to the new WRITE_FLUSH_FUA
> > primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
> > have passed extensive xfstests coverage with this, while ocfs2, nilfs2
> > and fat are unsupposed by xfstests and thus untested in this patch.
> 
> Tejun's patches didn't make the merge window, right?

No.

> I wonder if it makes sense to make a special appeal to Linus to get
> the new kernel interface(s) for WRITE_FLUSH_FUA into 2.6.36-rc2 (without
> any callers) to make it easier for us to do testing and merging into
> our respective file system trees?

I don't think that's feasible.  The code added is not new but
modifies/replaces the existing barrier state machine.  What we'll have
to instead is to have a tree with all these changes for testing.
I've already got the promise from the RH filesystem QA team to get some
powerfail testing resources allocated to this.


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 ` [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage Christoph Hellwig
@ 2010-08-18 23:47   ` Dave Chinner
  0 siblings, 0 replies; 41+ messages in thread
From: Dave Chinner @ 2010-08-18 23:47 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 05:29:11AM -0400, Christoph Hellwig wrote:
> Switch to the WRITE_FLUSH_FUA flag for log writes and remove the EOPNOTSUPP
> detection for barriers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 12/15] swap: do not send discards as barriers
  2010-08-18  9:29 ` [PATCH 12/15] swap: " Christoph Hellwig
@ 2010-08-19  3:47   ` Hugh Dickins
  2010-08-19  4:08     ` Nigel Cunningham
                       ` (2 more replies)
  0 siblings, 3 replies; 41+ messages in thread
From: Hugh Dickins @ 2010-08-19  3:47 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, nigel, linux-fsdevel

On Wed, 18 Aug 2010, Christoph Hellwig wrote:

> The swap code already uses synchronous discards, no need to add I/O barriers.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Hugh Dickins <hughd@google.com>

(though if you happened to respin, I'd be be glad for those newlines
between GFP_KERNEL, BLKDEV_IFL_WAIT to go away now)

This patch could go in any time now: I may want to push it in and
get it to 35-stable, because it certainly helps against the swap
discard regression that Nigel reported (though I've not yet seen
his numbers with this).  However, I don't think it eliminates the
regression, so I've more testing and experimenting to do before
deciding about it - the right answer may just be to disable swap
discard, as you asked for long ago.

Hugh

> 
> Index: linux-2.6/mm/swapfile.c
> ===================================================================
> --- linux-2.6.orig/mm/swapfile.c	2010-08-17 16:49:28.312010428 +0200
> +++ linux-2.6/mm/swapfile.c	2010-08-17 16:49:43.694255853 +0200
> @@ -140,7 +140,7 @@ static int discard_swap(struct swap_info
>  	if (nr_blocks) {
>  		err = blkdev_issue_discard(si->bdev, start_block,
>  				nr_blocks, GFP_KERNEL,
> -				BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
> +				BLKDEV_IFL_WAIT);
>  		if (err)
>  			return err;
>  		cond_resched();
> @@ -152,7 +152,7 @@ static int discard_swap(struct swap_info
>  
>  		err = blkdev_issue_discard(si->bdev, start_block,
>  				nr_blocks, GFP_KERNEL,
> -				BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER);
> +				BLKDEV_IFL_WAIT);
>  		if (err)
>  			break;
>  
> @@ -191,8 +191,7 @@ static void discard_swap_cluster(struct
>  			start_block <<= PAGE_SHIFT - 9;
>  			nr_blocks <<= PAGE_SHIFT - 9;
>  			if (blkdev_issue_discard(si->bdev, start_block,
> -				    nr_blocks, GFP_NOIO, BLKDEV_IFL_WAIT |
> -							BLKDEV_IFL_BARRIER))
> +				    nr_blocks, GFP_NOIO, BLKDEV_IFL_WAIT))
>  				break;
>  		}
>  

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 12/15] swap: do not send discards as barriers
  2010-08-19  3:47   ` Hugh Dickins
@ 2010-08-19  4:08     ` Nigel Cunningham
  2010-08-19  9:02     ` Christoph Hellwig
  2010-08-22 12:20     ` Nigel Cunningham
  2 siblings, 0 replies; 41+ messages in thread
From: Nigel Cunningham @ 2010-08-19  4:08 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	tytso, jack, hirofumi, mfasheh, joel.becker, linux-fsdevel

Hi.

On 19/08/10 13:47, Hugh Dickins wrote:
> On Wed, 18 Aug 2010, Christoph Hellwig wrote:
>
>> The swap code already uses synchronous discards, no need to add I/O barriers.
>>
>> Signed-off-by: Christoph Hellwig<hch@lst.de>
>
> Acked-by: Hugh Dickins<hughd@google.com>
>
> (though if you happened to respin, I'd be be glad for those newlines
> between GFP_KERNEL, BLKDEV_IFL_WAIT to go away now)
>
> This patch could go in any time now: I may want to push it in and
> get it to 35-stable, because it certainly helps against the swap
> discard regression that Nigel reported (though I've not yet seen
> his numbers with this).  However, I don't think it eliminates the
> regression, so I've more testing and experimenting to do before
> deciding about it - the right answer may just be to disable swap
> discard, as you asked for long ago.

Sorry - I've been busy with other things. I'll seek to get back to this 
shortly.

Nigel

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 12/15] swap: do not send discards as barriers
  2010-08-19  3:47   ` Hugh Dickins
  2010-08-19  4:08     ` Nigel Cunningham
@ 2010-08-19  9:02     ` Christoph Hellwig
  2010-08-19 11:35       ` Chris Mason
  2010-08-22 12:20     ` Nigel Cunningham
  2 siblings, 1 reply; 41+ messages in thread
From: Christoph Hellwig @ 2010-08-19  9:02 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	tytso, jack, hirofumi, mfasheh, joel.becker, nigel,
	linux-fsdevel

On Wed, Aug 18, 2010 at 08:47:52PM -0700, Hugh Dickins wrote:
> (though if you happened to respin, I'd be be glad for those newlines
> between GFP_KERNEL, BLKDEV_IFL_WAIT to go away now)
> 
> This patch could go in any time now: I may want to push it in and
> get it to 35-stable, because it certainly helps against the swap
> discard regression that Nigel reported (though I've not yet seen
> his numbers with this).  However, I don't think it eliminates the
> regression, so I've more testing and experimenting to do before
> deciding about it - the right answer may just be to disable swap
> discard, as you asked for long ago.

If we do get a bit testing I'd be almost inclined to drop BLKDEV_IFL_BARRIER
under the floor for all callers in .36, and also remove BLKDEV_IFL_WAIT,
as it's now unconditional.  That would allow us to simpliy the
synchronous interfaces for the two, and give us an easy way to develop
a proper asynchronous discard interface in the .37 cycle without
interfering with the barrier rework.  Any comments on that idea from the
filesystem crowd?


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 12/15] swap: do not send discards as barriers
  2010-08-19  9:02     ` Christoph Hellwig
@ 2010-08-19 11:35       ` Chris Mason
  0 siblings, 0 replies; 41+ messages in thread
From: Chris Mason @ 2010-08-19 11:35 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Hugh Dickins, tj, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, nigel, linux-fsdevel

On Thu, Aug 19, 2010 at 05:02:21AM -0400, Christoph Hellwig wrote:
> On Wed, Aug 18, 2010 at 08:47:52PM -0700, Hugh Dickins wrote:
> > (though if you happened to respin, I'd be be glad for those newlines
> > between GFP_KERNEL, BLKDEV_IFL_WAIT to go away now)
> > 
> > This patch could go in any time now: I may want to push it in and
> > get it to 35-stable, because it certainly helps against the swap
> > discard regression that Nigel reported (though I've not yet seen
> > his numbers with this).  However, I don't think it eliminates the
> > regression, so I've more testing and experimenting to do before
> > deciding about it - the right answer may just be to disable swap
> > discard, as you asked for long ago.
> 
> If we do get a bit testing I'd be almost inclined to drop BLKDEV_IFL_BARRIER
> under the floor for all callers in .36, and also remove BLKDEV_IFL_WAIT,
> as it's now unconditional.  That would allow us to simpliy the
> synchronous interfaces for the two, and give us an easy way to develop
> a proper asynchronous discard interface in the .37 cycle without
> interfering with the barrier rework.  Any comments on that idea from the
> filesystem crowd?
> 

No complaints here.

-chris


^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard
  2010-08-18  9:29 ` [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard Christoph Hellwig
@ 2010-08-20  1:23   ` Mike Snitzer
  0 siblings, 0 replies; 41+ messages in thread
From: Mike Snitzer @ 2010-08-20  1:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 5:29 AM, Christoph Hellwig <hch@infradead.org> wrote:
> We'll need to get rid of the BLKDEV_IFL_BARRIER flag, and to facilitate
> that and to make the interface less confusing pass all flags explicitly.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mike Snitzer <snitzer@redhat.com>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag
  2010-08-18  9:29 ` [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag Christoph Hellwig
@ 2010-08-20  1:26   ` Mike Snitzer
  0 siblings, 0 replies; 41+ messages in thread
From: Mike Snitzer @ 2010-08-20  1:26 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: tj, chris.mason, swhiteho, konishi.ryusuke, tytso, jack,
	hirofumi, mfasheh, joel.becker, hughd, linux-fsdevel

On Wed, Aug 18, 2010 at 5:29 AM, Christoph Hellwig <hch@infradead.org> wrote:
> Remove support for barriers on discards, which is unused now.  Also
> remove the DISCARD_NOBARRIER I/O type in favour of just setting the
> rw flags up locally in blkdev_issue_discard.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Acked-by: Mike Snitzer <snitzer@redhat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
                   ` (16 preceding siblings ...)
  2010-08-18 15:11 ` Ted Ts'o
@ 2010-08-20  4:00 ` Tao Ma
  17 siblings, 0 replies; 41+ messages in thread
From: Tao Ma @ 2010-08-20  4:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: mfasheh, joel.becker, linux-fsdevel

Hi Christoph,

On 08/18/2010 05:29 PM, Christoph Hellwig wrote:
> This series converts over all filesystems to the new WRITE_FLUSH_FUA
> primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
> have passed extensive xfstests coverage with this, while ocfs2, nilfs2
> and fat are unsupposed by xfstests and thus untested in this patch.
As for the ocfs2 part, how to make ocfs2 supposed by xfstests? Any 
guidance of it? I'd like to make ocfs2 work with xfstests so that any 
future tests can be carried out with ocfs2 included. ;)

Regards,
Tao
>
> The discard code hasn't been tested yet, I'm looking into more extensive
> testing for this later.  Note that the nilfs2 discard code did not wait
> for the discards to finish meaning that it's almost guaranteed to be
> broken after these patches, although I wouldn't be surprised if it already
> was before.
>
> The patches are a bit larger than the one liners I promised because I
> remove the EOPNOTSUPP handling that's not needed with the new code.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 00/15] replace barriers with explicit flush / FUA usage
  2010-08-18 10:53   ` Christoph Hellwig
@ 2010-08-20  6:50     ` Tao Ma
  0 siblings, 0 replies; 41+ messages in thread
From: Tao Ma @ 2010-08-20  6:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: mfasheh, Joel Becker, linux-fsdevel



On 08/18/2010 06:53 PM, Christoph Hellwig wrote:
> On Wed, Aug 18, 2010 at 03:35:42AM -0700, Joel Becker wrote:
>> On Wed, Aug 18, 2010 at 05:29:08AM -0400, Christoph Hellwig wrote:
>>> This series converts over all filesystems to the new WRITE_FLUSH_FUA
>>> primitive that Tejun added.  XFS, btrfs, gfs2, reiserfs, ext3 and ext4
>>> have passed extensive xfstests coverage with this, while ocfs2, nilfs2
>>> and fat are unsupposed by xfstests and thus untested in this patch.
>>
>> 	What does it take to get ocfs2 supported by xfstests?
>
> Basically just a few filesystem-specific paramters need to be added
> to the switch table in common.rc:
>
>   - mkfs paramters if the default mkfs.$FSTYPE invocation doesn't do the
>     right thing, or ask for confirmatio when doing things like
>     overwriting existing filesystems or working on whole disks (not sure
>     if anyone but extN came up with that last weird thing)
>   - mount paramters for a successfull single node mount with acls and
>     xattrs enabled
>   - fsck options to actually force a real check even if the filesystem
>     is mounted clean (and is nessecary to not make it wait for user
>     input)
>   - optionally an entry to create a filesystem with a given size for
>     ENOSPC tests.
oh, I didn't noticed that you have described in detail here.
Sorry for the noise.

Regards,
Tao

^ permalink raw reply	[flat|nested] 41+ messages in thread

* Re: [PATCH 12/15] swap: do not send discards as barriers
  2010-08-19  3:47   ` Hugh Dickins
  2010-08-19  4:08     ` Nigel Cunningham
  2010-08-19  9:02     ` Christoph Hellwig
@ 2010-08-22 12:20     ` Nigel Cunningham
  2 siblings, 0 replies; 41+ messages in thread
From: Nigel Cunningham @ 2010-08-22 12:20 UTC (permalink / raw)
  To: Hugh Dickins
  Cc: Christoph Hellwig, tj, chris.mason, swhiteho, konishi.ryusuke,
	tytso, jack, hirofumi, mfasheh, joel.becker, linux-fsdevel

Hi.

On 19/08/10 13:47, Hugh Dickins wrote:
> On Wed, 18 Aug 2010, Christoph Hellwig wrote:
>
>> The swap code already uses synchronous discards, no need to add I/O barriers.
>>
>> Signed-off-by: Christoph Hellwig<hch@lst.de>
>
> Acked-by: Hugh Dickins<hughd@google.com>
>
> (though if you happened to respin, I'd be be glad for those newlines
> between GFP_KERNEL, BLKDEV_IFL_WAIT to go away now)
>
> This patch could go in any time now: I may want to push it in and
> get it to 35-stable, because it certainly helps against the swap
> discard regression that Nigel reported (though I've not yet seen
> his numbers with this).  However, I don't think it eliminates the
> regression, so I've more testing and experimenting to do before
> deciding about it - the right answer may just be to disable swap
> discard, as you asked for long ago.

That's correct. The patch reduces the pause from minutes to a matter of 
seconds (with 4GB of swap), but it is still there (there was previously 
no discernable delay).

Tested-by: Nigel Cunningham <nigel@tuxonice.net>

Regards,

Nigel

^ permalink raw reply	[flat|nested] 41+ messages in thread

end of thread, other threads:[~2010-08-22 12:20 UTC | newest]

Thread overview: 41+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-18  9:29 [PATCH 00/15] replace barriers with explicit flush / FUA usage Christoph Hellwig
2010-08-18  9:29 ` [PATCH 01/15] kill BH_Ordered flag Christoph Hellwig
2010-08-18  9:29 ` [PATCH 02/15] pass gfp_mask and flags to sb_issue_discard Christoph Hellwig
2010-08-20  1:23   ` Mike Snitzer
2010-08-18  9:29 ` [PATCH 03/15] xfs: replace barriers with explicit flush / FUA usage Christoph Hellwig
2010-08-18 23:47   ` Dave Chinner
2010-08-18  9:29 ` [PATCH 04/15] btrfs: " Christoph Hellwig
2010-08-18 12:06   ` Chris Mason
2010-08-18  9:29 ` [PATCH 05/15] gfs2: " Christoph Hellwig
2010-08-18 10:08   ` Steven Whitehouse
2010-08-18 13:37   ` Bob Peterson
2010-08-18  9:29 ` [PATCH 06/15] reiserfs: " Christoph Hellwig
2010-08-18 13:16   ` Jan Kara
2010-08-18 13:21     ` Chris Mason
2010-08-18  9:29 ` [PATCH 07/15] nilfs2: " Christoph Hellwig
2010-08-18 13:31   ` Ryusuke Konishi
2010-08-18 13:41     ` Christoph Hellwig
2010-08-18  9:29 ` [PATCH 08/15] jbd: " Christoph Hellwig
2010-08-18 13:07   ` Jan Kara
2010-08-18  9:29 ` [PATCH 09/15] jbd2: " Christoph Hellwig
2010-08-18 14:03   ` Jan Kara
2010-08-18 14:09     ` Christoph Hellwig
2010-08-18  9:29 ` [PATCH 10/15] ext4: do not send discards as barriers Christoph Hellwig
2010-08-18 13:28   ` Jan Kara
2010-08-18  9:29 ` [PATCH 11/15] fat: " Christoph Hellwig
2010-08-18  9:29 ` [PATCH 12/15] swap: " Christoph Hellwig
2010-08-19  3:47   ` Hugh Dickins
2010-08-19  4:08     ` Nigel Cunningham
2010-08-19  9:02     ` Christoph Hellwig
2010-08-19 11:35       ` Chris Mason
2010-08-22 12:20     ` Nigel Cunningham
2010-08-18  9:29 ` [PATCH 13/15] remove the WRITE_BARRIER flag Christoph Hellwig
2010-08-18  9:29 ` [PATCH 14/15] remove the BLKDEV_IFL_BARRIER flag Christoph Hellwig
2010-08-20  1:26   ` Mike Snitzer
2010-08-18  9:29 ` [PATCH 15/15] remove the BH_Eopnotsupp flag Christoph Hellwig
2010-08-18 10:35 ` [PATCH 00/15] replace barriers with explicit flush / FUA usage Joel Becker
2010-08-18 10:53   ` Christoph Hellwig
2010-08-20  6:50     ` Tao Ma
2010-08-18 15:11 ` Ted Ts'o
2010-08-18 16:46   ` Christoph Hellwig
2010-08-20  4:00 ` Tao Ma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.