From patchwork Sat Oct 29 08:08:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9405165 X-Patchwork-Delegate: snitzer@redhat.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD9646022E for ; Mon, 31 Oct 2016 09:01:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A64192928D for ; Mon, 31 Oct 2016 09:01:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A5B629291; Mon, 31 Oct 2016 09:01:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8CC082928D for ; Mon, 31 Oct 2016 09:01:10 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9V8wH0x042680; Mon, 31 Oct 2016 04:58:17 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u9T8CUDD026567 for ; Sat, 29 Oct 2016 04:12:30 -0400 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9T8CU69017609 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sat, 29 Oct 2016 04:12:30 -0400 Received: from mail-pf0-f193.google.com (mail-pf0-f193.google.com [209.85.192.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 98241C04B302; Sat, 29 Oct 2016 08:12:29 +0000 (UTC) Received: by mail-pf0-f193.google.com with SMTP id s8so3376867pfj.2; Sat, 29 Oct 2016 01:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3i70nB5sbBD8+4bRakR8dNK5gv+qUGP5BtQj4ne/fss=; b=p8gRTpik52IWDBA/vckO0mGFiU0r0P3AeO8zUv+7zSFqhV7xrb11gYwUjzJlF53QXo Qz4IaOMGPWXG/iMppldgt3V0U/lfCTJDIztNRDboC/eL1t/XdTBAcBgCKYDKjCeoslcX yNT/KcgmiZWPItZWkzxVwAZ4v3ZxMVDc1QVbIvkNTJbziF8tJ/pcRUYzPjuJC/Cx/Lsx sl61aijTVA+xX27O2UYUzkGHrLXf+ihFnl51BtQu66r0ie8LB33BLciCQfYKFXzYrh8V +dQ56w3YTVzeVAH3UiLEHHQNC4Vo3NpzCw8pkzyu1tY1gnuP2bMPZ7Pf2Go0+XpyG2DL 1fVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3i70nB5sbBD8+4bRakR8dNK5gv+qUGP5BtQj4ne/fss=; b=YbvxaSGXdPxDZ9ApLBxtj8w12DqHRGmMIGfT0sqkkNL+IOcFcKLvPdUXUZ/7dlK9ty kN1RWSgjPE9zIG4uZdnK5H0hH6xmNxG8zOpvqX8vuaxyZDmyT5N+unjMAjYqo4WaSXvF ypFJIGMbaby+fJ+7uYz5htoPBFRiwPNtiMrNjGVCOjmjaGVeBceOU1YudLBs+dE4u/DW JPRa7vQPNpOYFsonWts0Uv3RDXi5JMr+HGnbyvB2f6YlCdh4WxqBzZFDyZqWxeYJ58tt zOIGCybKgOBNTwWAr22dqrYYhRd2vT3WXe0XeqYkIf55JO5v9dXQJ064EEUusa/UnfIZ KRlQ== X-Gm-Message-State: ABUngvfq/ytMzXDAk6iOI8FTw8I5JLg9g7X3T2n7NHBbAlYIcPFwklvOfTCko1nDxJTtfg== X-Received: by 10.99.110.14 with SMTP id j14mr26379034pgc.135.1477728749130; Sat, 29 Oct 2016 01:12:29 -0700 (PDT) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id y77sm23484737pfi.69.2016.10.29.01.12.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Oct 2016 01:12:28 -0700 (PDT) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Date: Sat, 29 Oct 2016 16:08:06 +0800 Message-Id: <1477728600-12938-8-git-send-email-tom.leiming@gmail.com> In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 29 Oct 2016 08:12:29 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Sat, 29 Oct 2016 08:12:29 +0000 (UTC) for IP:'209.85.192.193' DOMAIN:'mail-pf0-f193.google.com' HELO:'mail-pf0-f193.google.com' FROM:'tom.leiming@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.189 * (BAYES_50, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.192.193 mail-pf0-f193.google.com 209.85.192.193 mail-pf0-f193.google.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: dm-devel@redhat.com X-Mailman-Approved-At: Mon, 31 Oct 2016 04:58:15 -0400 Cc: Christoph Hellwig , Mike Snitzer , Ming Lei , linux-block@vger.kernel.org, "maintainer:DEVICE-MAPPER LVM, Shaohua Li , linux-raid@vger.kernel.org open list:SOFTWARE RAID Multiple DisksSUPPORT" , "Kirill A . Shutemov" , linux-fsdevel@vger.kernel.org, Alasdair Kergon Subject: [dm-devel] [PATCH 07/60] dm: crypt: use bio_add_page() 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: , MIME-Version: 1.0 Sender: dm-devel-bounces@redhat.com Errors-To: dm-devel-bounces@redhat.com X-Virus-Scanned: ClamAV using ClamSMTP We have the standard interface to add page to bio, so don't do that in hacking way. Reviewed-by: Christoph Hellwig Signed-off-by: Ming Lei --- drivers/md/dm-crypt.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index a2768835d394..4999c7497f95 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -994,7 +994,6 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size) gfp_t gfp_mask = GFP_NOWAIT | __GFP_HIGHMEM; unsigned i, len, remaining_size; struct page *page; - struct bio_vec *bvec; retry: if (unlikely(gfp_mask & __GFP_DIRECT_RECLAIM)) @@ -1019,12 +1018,7 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size) len = (remaining_size > PAGE_SIZE) ? PAGE_SIZE : remaining_size; - bvec = &clone->bi_io_vec[clone->bi_vcnt++]; - bvec->bv_page = page; - bvec->bv_len = len; - bvec->bv_offset = 0; - - clone->bi_iter.bi_size += len; + bio_add_page(clone, page, len, 0); remaining_size -= len; }