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: 9403453 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 53E5460587 for ; Sat, 29 Oct 2016 08:32:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 407D32A5EC for ; Sat, 29 Oct 2016 08:32:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 357792A697; Sat, 29 Oct 2016 08:32:20 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC19C2A5EC for ; Sat, 29 Oct 2016 08:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756795AbcJ2IMc (ORCPT ); Sat, 29 Oct 2016 04:12:32 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35990 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932766AbcJ2IM3 (ORCPT ); Sat, 29 Oct 2016 04:12:29 -0400 Received: by mail-pf0-f193.google.com with SMTP id n85so3383233pfi.3; 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=e3HaIJj4H2ihD8w9wNcQbD9094sTBRcmLsqwEY28vbWxh6BeXcSetsyZita9Szh1iR nIo0+1JZC2VsmjU9AfOn6jENPazNm1quDUKGGyf3uLL7JATENik/+A9n/o97CEIEgL5o bSANUGbV99LJjBpM+e4axovIlEvFL8H9nEVD/ZWv/MO7w1ygprgodpW2ydPfyvMzgaDi PoBYbyec8idUk0TRk7TEuGMiI2zXTu0QwhQOuHwy1lt70gynZTL/CQ8S9xq9VCo7Io/k GiOPBRaF8hbWmmjMivlbOPRju1rjqOiFL2Sp6kZdhgFU6pi3i3IM4yZSoKooKooQ0A7i 5KRg== X-Gm-Message-State: ABUngvdJfl5h/Og3JVnWoZZY1216grEcDK5It47Jz9fux2dkrtntXiJqLhbhPNCrTXhBxw== 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 Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , "Kirill A . Shutemov" , Ming Lei , Alasdair Kergon , Mike Snitzer , dm-devel@redhat.com (maintainer:DEVICE-MAPPER (LVM)), Shaohua Li , linux-raid@vger.kernel.org (open list:SOFTWARE RAID (Multiple Disks) SUPPORT) Subject: [PATCH 07/60] dm: crypt: use bio_add_page() Date: Sat, 29 Oct 2016 16:08:06 +0800 Message-Id: <1477728600-12938-8-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> References: <1477728600-12938-1-git-send-email-tom.leiming@gmail.com> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org 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; }