linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kanchan Joshi <joshi.k@samsung.com>
To: linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.com,
	viro@zeniv.linux.org.uk, darrick.wong@oracle.com,
	axboe@kernel.dk, jrdr.linux@gmail.com, ebiggers@google.com,
	jooyoung.hwang@samsung.com, chur.lee@samsung.com,
	prakash.v@samsung.com, Kanchan Joshi <joshi.k@samsung.com>
Subject: [PATCH 1/2] fs: introduce APIs to enable sending write-hint with buffer-head
Date: Mon, 10 Dec 2018 18:20:03 +0530	[thread overview]
Message-ID: <1544446204-5291-2-git-send-email-joshi.k@samsung.com> (raw)
In-Reply-To: <1544446204-5291-1-git-send-email-joshi.k@samsung.com>

submit_bh and write_dirty_buffer do not take write-hint as
parameter. This patch introduces variants which do.

Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
---
 fs/buffer.c                 | 21 +++++++++++++++++++++
 include/linux/buffer_head.h |  3 +++
 2 files changed, 24 insertions(+)

diff --git a/fs/buffer.c b/fs/buffer.c
index 1286c2b..60c8867 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3094,6 +3094,13 @@ int submit_bh(int op, int op_flags, struct buffer_head *bh)
 }
 EXPORT_SYMBOL(submit_bh);
 
+int submit_bh_write_hint(int op, int op_flags, struct buffer_head *bh,
+			 enum rw_hint hint)
+{
+	return submit_bh_wbc(op, op_flags, bh, hint, NULL);
+}
+EXPORT_SYMBOL(submit_bh_write_hint);
+
 /**
  * ll_rw_block: low-level access to block devices (DEPRECATED)
  * @op: whether to %READ or %WRITE
@@ -3162,6 +3169,20 @@ void write_dirty_buffer(struct buffer_head *bh, int op_flags)
 }
 EXPORT_SYMBOL(write_dirty_buffer);
 
+void write_dirty_buffer_write_hint(struct buffer_head *bh, int op_flags,
+				   enum rw_hint hint)
+{
+	lock_buffer(bh);
+	if (!test_clear_buffer_dirty(bh)) {
+		unlock_buffer(bh);
+		return;
+	}
+	bh->b_end_io = end_buffer_write_sync;
+	get_bh(bh);
+	submit_bh_wbc(REQ_OP_WRITE, op_flags, bh, hint, NULL);
+}
+EXPORT_SYMBOL(write_dirty_buffer_write_hint);
+
 /*
  * For a data-integrity writeout, we need to wait upon any in-progress I/O
  * and then start new I/O and then wait upon it.  The caller must have a ref on
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index 7b73ef7..ac9f111 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -200,7 +200,10 @@ void ll_rw_block(int, int, int, struct buffer_head * bh[]);
 int sync_dirty_buffer(struct buffer_head *bh);
 int __sync_dirty_buffer(struct buffer_head *bh, int op_flags);
 void write_dirty_buffer(struct buffer_head *bh, int op_flags);
+void write_dirty_buffer_write_hint(struct buffer_head *bh, int op_flags,
+				   enum rw_hint hint);
 int submit_bh(int, int, struct buffer_head *);
+int submit_bh_write_hint(int, int, struct buffer_head *, enum rw_hint hint);
 void write_boundary_block(struct block_device *bdev,
 			sector_t bblock, unsigned blocksize);
 int bh_uptodate_or_lock(struct buffer_head *bh);
-- 
2.7.4

  parent reply	other threads:[~2018-12-10 12:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181210125245epcas2p202bc4336e91a55cee3786ed6abffea05@epcas2p2.samsung.com>
2018-12-10 12:50 ` [PATCH 0/2] fs,ext4,jbd2: Specifying write-hint for Ext4 journal Kanchan Joshi
     [not found]   ` <CGME20181210125251epcas1p3023db72cc08d6b2f899141d551d53f61@epcas1p3.samsung.com>
2018-12-10 12:50     ` Kanchan Joshi [this message]
2018-12-10 13:49       ` [PATCH 1/2] fs: introduce APIs to enable sending write-hint with buffer-head Jan Kara
2018-12-11 11:57         ` Kanchan Joshi
     [not found]   ` <CGME20181210125256epcas1p1e4142cfefb9b21dfb8dad927fbd49143@epcas1p1.samsung.com>
2018-12-10 12:50     ` [PATCH 2/2] fs/ext4,jbd2: Add support for passing write-hint with journal Kanchan Joshi
2018-12-10 14:12       ` Jan Kara
2018-12-10 15:17         ` Jens Axboe
2018-12-10 15:41           ` Jan Kara
2018-12-10 15:44             ` Jens Axboe
2018-12-11  4:07               ` Dave Chinner
2018-12-11  5:07                 ` Jens Axboe
2018-12-11 13:53                   ` Kanchan Joshi
2018-12-11 21:54                   ` Dave Chinner
2018-12-12 22:21                     ` Dave Chinner
2018-12-19 14:10                       ` Kanchan Joshi

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=1544446204-5291-2-git-send-email-joshi.k@samsung.com \
    --to=joshi.k@samsung.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=axboe@kernel.dk \
    --cc=chur.lee@samsung.com \
    --cc=darrick.wong@oracle.com \
    --cc=ebiggers@google.com \
    --cc=jack@suse.com \
    --cc=jooyoung.hwang@samsung.com \
    --cc=jrdr.linux@gmail.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=prakash.v@samsung.com \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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).