All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lin <mlin@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>,
	Kent Overstreet <kent.overstreet@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	Dongsu Park <dongsu.park@profitbricks.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org, Ming Lin <mlin@kernel.org>
Subject: [PATCH v3 3/4] fs: make _submit_bh consistent with generic bio chaining
Date: Thu, 23 Apr 2015 16:04:34 -0700	[thread overview]
Message-ID: <1429830275-6792-4-git-send-email-mlin@kernel.org> (raw)
In-Reply-To: <1429830275-6792-1-git-send-email-mlin@kernel.org>

From: Kent Overstreet <kent.overstreet@gmail.com>

Make _submit_bh() handle refcounting by increasing bio->bi_remaining,
followed by bio_endio(). Since bio chaining was introduced with
196d38bccfcf ("block: Generic bio chaining"), refcounting should be
done on bi_remaining instead of ancient bio_cnt. Doing that, calling
convention can be consistent with the immutable biovecs API.

Cc: Christoph Hellwig <hch@infradead.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
[dpark: add more description in commit message]
[mlin: rebase as Jens is changing the bi_remaining rules]
Signed-off-by: Dongsu Park <dongsu.park@profitbricks.com>
Signed-off-by: Ming Lin <mlin@kernel.org>
---
 fs/buffer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/buffer.c b/fs/buffer.c
index c7a5602..c1c0e0d 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3041,13 +3041,13 @@ int _submit_bh(int rw, struct buffer_head *bh, unsigned long bio_flags)
 	if (buffer_prio(bh))
 		rw |= REQ_PRIO;
 
-	bio_get(bio);
+	bio_inc_remaining(bio);
 	submit_bio(rw, bio);
 
 	if (bio_flagged(bio, BIO_EOPNOTSUPP))
 		ret = -EOPNOTSUPP;
 
-	bio_put(bio);
+	bio_endio(bio, 0);
 	return ret;
 }
 EXPORT_SYMBOL_GPL(_submit_bh);
-- 
1.9.1


  parent reply	other threads:[~2015-04-23 23:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23 23:04 [PATCH v3 0/4] preparation for block layer simplification Ming Lin
2015-04-23 23:04 ` [PATCH v3 1/4] block: refactor iov_count_pages() from bio_{copy,map}_user_iov() Ming Lin
2015-04-24  7:06   ` Christoph Hellwig
2015-04-23 23:04 ` [PATCH v3 2/4] md/raid10: make sync_request_write() call bio_copy_data() Ming Lin
2015-04-24  7:08   ` Christoph Hellwig
2015-04-23 23:04 ` Ming Lin [this message]
2015-04-24  7:25   ` [PATCH v3 3/4] fs: make _submit_bh consistent with generic bio chaining Christoph Hellwig
2015-04-23 23:04 ` [PATCH v3 4/4] PM: submit bio in a sane way in cases without bio_chain Ming Lin
2015-04-24 16:17   ` Christoph Hellwig
2015-04-25  6:23     ` Ming Lin
2015-04-30 17:34     ` Pavel Machek
2015-05-01 17:21       ` Christoph Hellwig
2015-05-04 14:14         ` Rafael J. Wysocki
     [not found]     ` <20150430164717.GA21211@amd>
2015-05-05  9:23       ` Pavel Machek

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=1429830275-6792-4-git-send-email-mlin@kernel.org \
    --to=mlin@kernel.org \
    --cc=axboe@kernel.dk \
    --cc=dongsu.park@profitbricks.com \
    --cc=hch@infradead.org \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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 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.