From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 952FEC433DB for ; Mon, 29 Mar 2021 15:28:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4FBF0617ED for ; Mon, 29 Mar 2021 15:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230447AbhC2P2S (ORCPT ); Mon, 29 Mar 2021 11:28:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:32492 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231244AbhC2P1u (ORCPT ); Mon, 29 Mar 2021 11:27:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617031669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yiAZ1LG/jl/FrJlJpKhJ5cneSmOPmuiOZBkRQiXX7gg=; b=Brprz7ffKPsxHymN9t5jRZTpw9NoFBtNm3mxx28os4+QzUTv8oLFbcyavONJT5K7/h37p1 FiDkzvDRUxjrbOwKuApW2Qfl8GTrLb8wCwpCw11/MAwn1F2ytF3TfEOxqbVVqLUSzirFe1 p7CTuepL+KIbvOTiPQQ4SVNhTumSSS4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-489-1uYXQKzJOy6aPs0Jlkcu7A-1; Mon, 29 Mar 2021 11:27:45 -0400 X-MC-Unique: 1uYXQKzJOy6aPs0Jlkcu7A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 56EA0871377; Mon, 29 Mar 2021 15:27:44 +0000 (UTC) Received: from localhost (ovpn-12-50.pek2.redhat.com [10.72.12.50]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5ADCD5C5DF; Mon, 29 Mar 2021 15:27:43 +0000 (UTC) From: Ming Lei To: Jens Axboe Cc: linux-block@vger.kernel.org, Jeffle Xu , Mike Snitzer , dm-devel@redhat.com, Hannes Reinecke , Ming Lei Subject: [PATCH V4 05/12] block: add new field into 'struct bvec_iter' Date: Mon, 29 Mar 2021 23:26:15 +0800 Message-Id: <20210329152622.173035-6-ming.lei@redhat.com> In-Reply-To: <20210329152622.173035-1-ming.lei@redhat.com> References: <20210329152622.173035-1-ming.lei@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org There is a hole at the end of 'struct bvec_iter', so put a new field here and we can save cookie returned from submit_bio() here for supporting bio based polling. This way can avoid to extend bio unnecessarily. Meantime add two helpers to get/set this field. Reviewed-by: Hannes Reinecke Signed-off-by: Ming Lei --- block/blk.h | 10 ++++++++++ include/linux/bvec.h | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/block/blk.h b/block/blk.h index 35901cee709d..c1d8456656df 100644 --- a/block/blk.h +++ b/block/blk.h @@ -395,4 +395,14 @@ static inline void blk_create_io_poll_context(struct request_queue *q) bio_poll_ctx_alloc(ioc); } +static inline unsigned int bio_get_private_data(struct bio *bio) +{ + return bio->bi_iter.bi_private_data; +} + +static inline void bio_set_private_data(struct bio *bio, unsigned int data) +{ + bio->bi_iter.bi_private_data = data; +} + #endif /* BLK_INTERNAL_H */ diff --git a/include/linux/bvec.h b/include/linux/bvec.h index ff832e698efb..547ad7526960 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -43,6 +43,14 @@ struct bvec_iter { unsigned int bi_bvec_done; /* number of bytes completed in current bvec */ + + /* + * There is a hole at the end of bvec_iter, add one new field to hold + * something which isn't related with 'bvec_iter', so that we can + * avoid extending bio. So far this new field is used for bio based + * polling, we will store returning value of submit_bio() here. + */ + unsigned int bi_private_data; }; struct bvec_iter_all { -- 2.29.2