[PATCH] xfs: use WRITE_SYNC_PLUG for synchronous writeout

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] xfs: use WRITE_SYNC_PLUG for synchronous writeout

by Christoph Hellwig :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The VM and I/O schedulers now expect us to use WRITE_SYNC_PLUG for synchronous
writeout. Right now I can't see any changes in performance numbers with this,
but we're getting some beating for not using it, and the knowledge defintively
could help the block code to make better decisions.

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

Index: linux-2.6/fs/xfs/linux-2.6/xfs_aops.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_aops.c 2009-10-24 10:08:36.622254197 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_aops.c 2009-10-24 10:18:27.803006347 +0200
@@ -412,8 +412,9 @@ xfs_end_bio(
 
 STATIC void
 xfs_submit_ioend_bio(
- xfs_ioend_t *ioend,
- struct bio *bio)
+ struct writeback_control *wbc,
+ xfs_ioend_t *ioend,
+ struct bio *bio)
 {
  atomic_inc(&ioend->io_remaining);
  bio->bi_private = ioend;
@@ -426,7 +427,8 @@ xfs_submit_ioend_bio(
  if (xfs_ioend_new_eof(ioend))
  xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode));
 
- submit_bio(WRITE, bio);
+ submit_bio(wbc->sync_mode == WB_SYNC_ALL ?
+   WRITE_SYNC_PLUG : WRITE, bio);
  ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP));
  bio_put(bio);
 }
@@ -505,6 +507,7 @@ static inline int bio_add_buffer(struct
  */
 STATIC void
 xfs_submit_ioend(
+ struct writeback_control *wbc,
  xfs_ioend_t *ioend)
 {
  xfs_ioend_t *head = ioend;
@@ -533,19 +536,19 @@ xfs_submit_ioend(
  retry:
  bio = xfs_alloc_ioend_bio(bh);
  } else if (bh->b_blocknr != lastblock + 1) {
- xfs_submit_ioend_bio(ioend, bio);
+ xfs_submit_ioend_bio(wbc, ioend, bio);
  goto retry;
  }
 
  if (bio_add_buffer(bio, bh) != bh->b_size) {
- xfs_submit_ioend_bio(ioend, bio);
+ xfs_submit_ioend_bio(wbc, ioend, bio);
  goto retry;
  }
 
  lastblock = bh->b_blocknr;
  }
  if (bio)
- xfs_submit_ioend_bio(ioend, bio);
+ xfs_submit_ioend_bio(wbc, ioend, bio);
  xfs_finish_ioend(ioend, 0);
  } while ((ioend = next) != NULL);
 }
@@ -1198,7 +1201,7 @@ xfs_page_state_convert(
  }
 
  if (iohead)
- xfs_submit_ioend(iohead);
+ xfs_submit_ioend(wbc, iohead);
 
  return page_dirty;
 

_______________________________________________
xfs mailing list
xfs@...
http://oss.sgi.com/mailman/listinfo/xfs

RE: [PATCH] xfs: use WRITE_SYNC_PLUG for synchronous writeout

by Alex Elder :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Christoph Hellwig wrote:
> The VM and I/O schedulers now expect us to use WRITE_SYNC_PLUG for synchronous
> writeout. Right now I can't see any changes in performance numbers with this,
> but we're getting some beating for not using it, and the knowledge defintively
> could help the block code to make better decisions.
>
> Signed-off-by: Christoph Hellwig <hch@...>

Looks good.

Reviewed-by: Alex Elder <aelder@...>


> Index: linux-2.6/fs/xfs/linux-2.6/xfs_aops.c
> ===================================================================
> --- linux-2.6.orig/fs/xfs/linux-2.6/xfs_aops.c 2009-10-24 10:08:36.622254197 +0200
> +++ linux-2.6/fs/xfs/linux-2.6/xfs_aops.c 2009-10-24 10:18:27.803006347 +0200
> @@ -412,8 +412,9 @@ xfs_end_bio(
>
>  STATIC void
>  xfs_submit_ioend_bio(
> - xfs_ioend_t *ioend,
> - struct bio *bio)
> + struct writeback_control *wbc,
> + xfs_ioend_t *ioend,
> + struct bio *bio)
>  {
>   atomic_inc(&ioend->io_remaining);
>   bio->bi_private = ioend;
> @@ -426,7 +427,8 @@ xfs_submit_ioend_bio(
>   if (xfs_ioend_new_eof(ioend))
>   xfs_mark_inode_dirty_sync(XFS_I(ioend->io_inode));
>
> - submit_bio(WRITE, bio);
> + submit_bio(wbc->sync_mode == WB_SYNC_ALL ?
> +   WRITE_SYNC_PLUG : WRITE, bio);
>   ASSERT(!bio_flagged(bio, BIO_EOPNOTSUPP));
>   bio_put(bio);
>  }
> @@ -505,6 +507,7 @@ static inline int bio_add_buffer(struct
>   */
>  STATIC void
>  xfs_submit_ioend(
> + struct writeback_control *wbc,
>   xfs_ioend_t *ioend)
>  {
>   xfs_ioend_t *head = ioend;
> @@ -533,19 +536,19 @@ xfs_submit_ioend(
>   retry:
>   bio = xfs_alloc_ioend_bio(bh);
>   } else if (bh->b_blocknr != lastblock + 1) {
> - xfs_submit_ioend_bio(ioend, bio);
> + xfs_submit_ioend_bio(wbc, ioend, bio);
>   goto retry;
>   }
>
>   if (bio_add_buffer(bio, bh) != bh->b_size) {
> - xfs_submit_ioend_bio(ioend, bio);
> + xfs_submit_ioend_bio(wbc, ioend, bio);
>   goto retry;
>   }
>
>   lastblock = bh->b_blocknr;
>   }
>   if (bio)
> - xfs_submit_ioend_bio(ioend, bio);
> + xfs_submit_ioend_bio(wbc, ioend, bio);
>   xfs_finish_ioend(ioend, 0);
>   } while ((ioend = next) != NULL);
>  }
> @@ -1198,7 +1201,7 @@ xfs_page_state_convert(
>   }
>
>   if (iohead)
> - xfs_submit_ioend(iohead);
> + xfs_submit_ioend(wbc, iohead);
>
>   return page_dirty;
>
>
> _______________________________________________
> xfs mailing list
> xfs@...
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@...
http://oss.sgi.com/mailman/listinfo/xfs