linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Huijin Park <huijin.park@samsung.com>
To: Jens Axboe <axboe@kernel.dk>, Christoph Hellwig <hch@lst.de>,
	Chaitanya Kulkarni <kch@nvidia.com>
Cc: Ming Lei <ming.lei@canonical.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	huijin.park@samsung.com, bbanghj.park@gmail.com
Subject: [PATCH] loop: change fsync to fdatasync when update dio
Date: Thu, 26 Jan 2023 14:16:57 +0900	[thread overview]
Message-ID: <20230126051657.163497-1-huijin.park@samsung.com> (raw)
In-Reply-To: CGME20230126051713epcas1p10a9005ad21887893a486100cbbd376e5@epcas1p1.samsung.com

In general, fsync has a larger overhead than fdatasync. And since the
dio option is for data, it seems like fdatasync is enough.
So this patch changes it to fdatasync which has little load relatively.

Signed-off-by: Huijin Park <huijin.park@samsung.com>

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index 1518a6423279..6c7ce8be8c0c 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -203,7 +203,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
 		return;
 
 	/* flush dirty pages before changing direct IO */
-	vfs_fsync(file, 0);
+	vfs_fsync(file, 1);
 
 	/*
 	 * The flag of LO_FLAGS_DIRECT_IO is handled similarly with
-- 
2.17.1


       reply	other threads:[~2023-01-26  5:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20230126051713epcas1p10a9005ad21887893a486100cbbd376e5@epcas1p1.samsung.com>
2023-01-26  5:16 ` Huijin Park [this message]
2023-01-26  5:31   ` [PATCH] loop: change fsync to fdatasync when update dio Christoph Hellwig
2023-02-02 18:12     ` Huijin Park

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=20230126051657.163497-1-huijin.park@samsung.com \
    --to=huijin.park@samsung.com \
    --cc=axboe@kernel.dk \
    --cc=bbanghj.park@gmail.com \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.lei@canonical.com \
    /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;
as well as URLs for NNTP newsgroup(s).