From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ming Lin Subject: [PATCH v3 3/4] fs: make _submit_bh consistent with generic bio chaining Date: Thu, 23 Apr 2015 16:04:34 -0700 Message-ID: <1429830275-6792-4-git-send-email-mlin@kernel.org> References: <1429830275-6792-1-git-send-email-mlin@kernel.org> Cc: Christoph Hellwig , Kent Overstreet , Jens Axboe , Dongsu Park , Al Viro , linux-fsdevel@vger.kernel.org, Ming Lin To: linux-kernel@vger.kernel.org Return-path: In-reply-to: <1429830275-6792-1-git-send-email-mlin@kernel.org> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org From: Kent Overstreet 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 Cc: Al Viro Cc: linux-fsdevel@vger.kernel.org Signed-off-by: Kent Overstreet [dpark: add more description in commit message] [mlin: rebase as Jens is changing the bi_remaining rules] Signed-off-by: Dongsu Park Signed-off-by: Ming Lin --- 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