mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>,
	linux-fsdevel@vger.kernel.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] fat: improve fat_sync_bhs() write submission
Date: Tue, 27 Oct 2026 12:35:38 +0900	[thread overview]
Message-ID: <87zevzbyt1.fsf@mail.parknet.co.jp> (raw)
In-Reply-To: <20261026163941.495833-3-matheus.aalmeida@inf.ufrgs.br>

Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br> writes:

> fat_sync_bhs() does many individual write_dirty_buffer() calls without
> plugging, making batching in the block layer more difficult. It also
> does not pass the REQ_SYNC hint for these synchronous writes.
>
> Use a plug around the writes so the block layer can more easily batch
> them. Pass the REQ_SYNC hint to write_dirty_buffer().
>
> Benchmarking was done under QEMU/KVM with a virtio-blk device using
> cache=directsync. Each result is the arithmetic mean of 10 samples.
>
> start = now_ns();
> for (unsigned i = 0; i < count; i++) {
>     fallocate(fds[i], FALLOC_FL_KEEP_SIZE, 0, bytes);
> }
> elapsed = now_ns() - start;
>
> Sync-mounted FAT32 using count=16 files:
> File size    Cluster size    Before    After    Improvement
> 256MiB       512B            13.11s    11.87s   1.10x
> 256MiB       4096B           1.657s    1.469s   1.13x
>
> Signed-off-by: Matheus Alves de Almeida <matheus.aalmeida@inf.ufrgs.br>

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> ---
>  fs/fat/misc.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/fs/fat/misc.c b/fs/fat/misc.c
> index b6a9e2e122cd..e8e2f13254d5 100644
> --- a/fs/fat/misc.c
> +++ b/fs/fat/misc.c
> @@ -9,6 +9,7 @@
>  
>  #include "fat.h"
>  #include <linux/iversion.h>
> +#include <linux/blk_plug.h>
>  
>  /*
>   * fat_fs_error reports a file system problem that might indicate fa data
> @@ -354,9 +355,14 @@ EXPORT_SYMBOL_GPL(fat_update_time);
>  int fat_sync_bhs(struct buffer_head **bhs, int nr_bhs)
>  {
>  	int i, err = 0;
> +	struct blk_plug plug;
> +
> +	blk_start_plug(&plug);
>  
>  	for (i = 0; i < nr_bhs; i++)
> -		write_dirty_buffer(bhs[i], 0);
> +		write_dirty_buffer(bhs[i], REQ_SYNC);
> +
> +	blk_finish_plug(&plug);
>  
>  	for (i = 0; i < nr_bhs; i++) {
>  		wait_on_buffer(bhs[i]);

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

      reply	other threads:[~2026-10-27  3:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 16:39 [PATCH v2 0/2] fat: improve synchronous mount performance Matheus Alves de Almeida
2026-10-26 16:39 ` [PATCH v2 1/2] fat: batch synchronous mirror writes Matheus Alves de Almeida
2026-10-27  3:34   ` OGAWA Hirofumi
2026-10-26 16:39 ` [PATCH v2 2/2] fat: improve fat_sync_bhs() write submission Matheus Alves de Almeida
2026-10-27  3:35   ` OGAWA Hirofumi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zevzbyt1.fsf@mail.parknet.co.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=akpm@linux-foundation.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matheus.aalmeida@inf.ufrgs.br \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®