From patchwork Tue May 5 02:09:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 11528023 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D3AAF92A for ; Tue, 5 May 2020 02:10:10 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3ECDC206D7 for ; Tue, 5 May 2020 02:10:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="XBY+BTDO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ECDC206D7 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588644608; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ItuHhbX29JUkjuASls4p8GrRrk4chbEZb7bpE4lWR24=; b=XBY+BTDO5dLeSwAEXWSpX4nUpSg+WOllJNpn4EV5qFhzK+G+xVisfXUN0TQ2KSpfNfuoXl lXG0UVTAbadExa+TdTvVMzU9R4nwetmx74xlb++q3A+6Ebl5PpHFAfu87ZYg8J4CCHKFml F1oX0LkzUpeb9opkYtn0URyZ7QhVp2w= 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-273-a_9ygZRLO5iz904iP9ua2A-1; Mon, 04 May 2020 22:10:07 -0400 X-MC-Unique: a_9ygZRLO5iz904iP9ua2A-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 226D71840410; Tue, 5 May 2020 02:10:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7B37562490; Tue, 5 May 2020 02:09:59 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DB3231809542; Tue, 5 May 2020 02:09:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04529ssc028782 for ; Mon, 4 May 2020 22:09:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 573075C1D3; Tue, 5 May 2020 02:09:54 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5795C5C1B2; Tue, 5 May 2020 02:09:44 +0000 (UTC) From: Ming Lei To: Jens Axboe Date: Tue, 5 May 2020 10:09:20 +0800 Message-Id: <20200505020930.1146281-2-ming.lei@redhat.com> In-Reply-To: <20200505020930.1146281-1-ming.lei@redhat.com> References: <20200505020930.1146281-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: dm-devel@redhat.com Cc: Hannes Reinecke , Bart Van Assche , Mike Snitzer , John Garry , Ming Lei , linux-block@vger.kernel.org, dm-devel@redhat.com, "Martin K . Petersen" , Thomas Gleixner , Christoph Hellwig Subject: [dm-devel] [PATCH V10 01/11] block: clone nr_integrity_segments and write_hint in blk_rq_prep_clone X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com So far blk_rq_prep_clone() is only used for setup one underlying cloned request from dm-rq request. block intetrity can be enabled for both dm-rq and the underlying queues, so it is reasonable to clone rq's nr_integrity_segments. Also write_hint is from bio, it should have been cloned too. So clone nr_integrity_segments and write_hint in blk_rq_prep_clone. Cc: John Garry Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Thomas Gleixner Cc: Mike Snitzer Cc: dm-devel@redhat.com Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Tested-by: John Garry Signed-off-by: Ming Lei --- block/blk-core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/block/blk-core.c b/block/blk-core.c index 7f11560bfddb..1fe73051fec3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1630,8 +1630,12 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, rq->rq_flags |= RQF_SPECIAL_PAYLOAD; rq->special_vec = rq_src->special_vec; } +#ifdef CONFIG_BLK_DEV_INTEGRITY + rq->nr_integrity_segments = rq_src->nr_integrity_segments; +#endif rq->nr_phys_segments = rq_src->nr_phys_segments; rq->ioprio = rq_src->ioprio; + rq->write_hint = rq_src->write_hint; return 0; From patchwork Tue May 5 02:09:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 11528027 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 31EBB92A for ; Tue, 5 May 2020 02:10:22 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5284206EB for ; Tue, 5 May 2020 02:10:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="WU1NofN8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5284206EB Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dm-devel-bounces@redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588644620; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=EzKy2k0sZuKbxqrO2MGAxIl2HzxVJgg9KtXLRFYh6Q0=; b=WU1NofN8yi7+Gi7m75G41lo5dK+KsXtX+DqBIrZgQK6YUBRtznnyxGCRNbs6VkjT5NdtW0 dQ0ffTjARncmFU4aCV4czxOhBVSp3LcbGhdxQ1XoH6lCqQ3U/SzduLcscuvetJVJ4Xo0Kf dCRUX+C0WcrRQo67E0Y0AvcOB9+ObC8= 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-28-TmY9ij4xMiqBssxqmLsAiA-1; Mon, 04 May 2020 22:10:18 -0400 X-MC-Unique: TmY9ij4xMiqBssxqmLsAiA-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6DB3E1840412; Tue, 5 May 2020 02:10:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1110960BEC; Tue, 5 May 2020 02:10:14 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 72C424CAA0; Tue, 5 May 2020 02:10:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0452A7xt028812 for ; Mon, 4 May 2020 22:10:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 78B8B5D9D5; Tue, 5 May 2020 02:10:07 +0000 (UTC) Delivered-To: dm-devel@redhat.com Received: from localhost (ovpn-8-17.pek2.redhat.com [10.72.8.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id DF53A5D9C9; Tue, 5 May 2020 02:09:56 +0000 (UTC) From: Ming Lei To: Jens Axboe Date: Tue, 5 May 2020 10:09:21 +0800 Message-Id: <20200505020930.1146281-3-ming.lei@redhat.com> In-Reply-To: <20200505020930.1146281-1-ming.lei@redhat.com> References: <20200505020930.1146281-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: dm-devel@redhat.com Cc: Hannes Reinecke , Bart Van Assche , Mike Snitzer , John Garry , Ming Lei , linux-block@vger.kernel.org, dm-devel@redhat.com, "Martin K . Petersen" , Thomas Gleixner , Christoph Hellwig Subject: [dm-devel] [PATCH V10 02/11] block: add helper for copying request X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Add one new helper of blk_rq_copy_request() to copy request, and the helper will be used in this patch for re-submitting request, so make it as a block layer internal helper. Cc: John Garry Cc: Bart Van Assche Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Thomas Gleixner Cc: Mike Snitzer Cc: dm-devel@redhat.com Reviewed-by: Hannes Reinecke Reviewed-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Tested-by: John Garry Signed-off-by: Ming Lei --- block/blk-core.c | 31 ++++++++++++++++++------------- block/blk.h | 2 ++ 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/block/blk-core.c b/block/blk-core.c index 1fe73051fec3..ec50d7e6be21 100644 --- a/block/blk-core.c +++ b/block/blk-core.c @@ -1581,6 +1581,23 @@ void blk_rq_unprep_clone(struct request *rq) } EXPORT_SYMBOL_GPL(blk_rq_unprep_clone); +void blk_rq_copy_request(struct request *rq, struct request *rq_src) +{ + /* Copy attributes of the original request to the clone request. */ + rq->__sector = blk_rq_pos(rq_src); + rq->__data_len = blk_rq_bytes(rq_src); + if (rq_src->rq_flags & RQF_SPECIAL_PAYLOAD) { + rq->rq_flags |= RQF_SPECIAL_PAYLOAD; + rq->special_vec = rq_src->special_vec; + } +#ifdef CONFIG_BLK_DEV_INTEGRITY + rq->nr_integrity_segments = rq_src->nr_integrity_segments; +#endif + rq->nr_phys_segments = rq_src->nr_phys_segments; + rq->ioprio = rq_src->ioprio; + rq->write_hint = rq_src->write_hint; +} + /** * blk_rq_prep_clone - Helper function to setup clone request * @rq: the request to be setup @@ -1623,19 +1640,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src, rq->bio = rq->biotail = bio; } - /* Copy attributes of the original request to the clone request. */ - rq->__sector = blk_rq_pos(rq_src); - rq->__data_len = blk_rq_bytes(rq_src); - if (rq_src->rq_flags & RQF_SPECIAL_PAYLOAD) { - rq->rq_flags |= RQF_SPECIAL_PAYLOAD; - rq->special_vec = rq_src->special_vec; - } -#ifdef CONFIG_BLK_DEV_INTEGRITY - rq->nr_integrity_segments = rq_src->nr_integrity_segments; -#endif - rq->nr_phys_segments = rq_src->nr_phys_segments; - rq->ioprio = rq_src->ioprio; - rq->write_hint = rq_src->write_hint; + blk_rq_copy_request(rq, rq_src); return 0; diff --git a/block/blk.h b/block/blk.h index 73bd3b1c6938..73dd86dc8f47 100644 --- a/block/blk.h +++ b/block/blk.h @@ -120,6 +120,8 @@ static inline void blk_rq_bio_prep(struct request *rq, struct bio *bio, rq->rq_disk = bio->bi_disk; } +void blk_rq_copy_request(struct request *rq, struct request *rq_src); + #ifdef CONFIG_BLK_DEV_INTEGRITY void blk_flush_integrity(void); bool __bio_integrity_endio(struct bio *);