From patchwork Fri Nov 11 12:05:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 9422891 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 7085F60233 for ; Fri, 11 Nov 2016 12:08:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 632CF29A14 for ; Fri, 11 Nov 2016 12:08:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 580CD29A87; Fri, 11 Nov 2016 12:08:29 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 B8FFE29A81 for ; Fri, 11 Nov 2016 12:08:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933064AbcKKMG7 (ORCPT ); Fri, 11 Nov 2016 07:06:59 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33256 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756349AbcKKMGw (ORCPT ); Fri, 11 Nov 2016 07:06:52 -0500 Received: by mail-pf0-f194.google.com with SMTP id 144so2418397pfv.0; Fri, 11 Nov 2016 04:06:52 -0800 (PST) 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=VwMTlMO28X0Ecr0jols8MJDIQ4JEG4gB++xsSlHMxKY=; b=fm5Vqtk1Yzg8wT0zsDUldqO2DP0+k/0GNWS5q+KZ9+5qljI4BODRdVby8g7HY2uwU6 59cy+SVugMbzFMbd/PYO/kjiW+352OgWFwyZ3sLUDSDqs87GlzoOKShQEthTBD8+5HLK 4+jgCMR/CUwopBX9pBCBFg84PwlMU77fbo65Ju0X+ZI/GwLHNKgyKGxOYWNPftVXwMZT Q/y3vy0tGCYrISiyqlv0phCFolyjfFI/OPl4bDl7CWLpzhhGJ48sQkJ1tLVkhVGZRH23 Tf/Zb/ZsT6C3h4aoo93rJt08efYzMU7AHisp3HNyAN6UEEZGlEh5m91gNaf4x0laz5BT ZJ2Q== 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=VwMTlMO28X0Ecr0jols8MJDIQ4JEG4gB++xsSlHMxKY=; b=FYz3U9+NV3e8ruIaGebopaVuuchdkDhnqeWAIQ1BPc5cCJPVsZgT/jCwmgL8N7+lyN gfv65R4/o8Pr7ES9RD3YcIxqkUUOtVYJYsiZltwsvfevmnGg8sU6CNRd/kAA+LmO6uFi b4tT7kfnX0YeyB5fXOuX+wXK1cGMBzeg8OzCl4/5asYfwTD7sbkkZHrJQx+hvMc+IDRf kZs8VwxsQBv/6Vr/APnrDgXV9QT6bbLvjs8rpDP7Vw2IjhTI/EIdk7nU7eYvq/kOwmwh HNO5fAPJYXxB7WpIjUhn1tmIcVAQQUDqoD4MzSeH3mdB5vtodXMIhyu3oHKIZg8u2ar5 23HQ== X-Gm-Message-State: ABUngvcdde9GIGL654HL3hw5/zYzrNwXOMd52Pp16ATB0Q7kFIAM7Cl8KAg+ZR5lXFep3A== X-Received: by 10.98.150.88 with SMTP id c85mr6384331pfe.68.1478866011486; Fri, 11 Nov 2016 04:06:51 -0800 (PST) Received: from localhost ([45.34.23.101]) by smtp.gmail.com with ESMTPSA id v6sm14757899paz.45.2016.11.11.04.06.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Nov 2016 04:06:50 -0800 (PST) From: Ming Lei To: Jens Axboe , linux-kernel@vger.kernel.org Cc: linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, Christoph Hellwig , 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 06/12] dm: crypt: use bio_add_page() Date: Fri, 11 Nov 2016 20:05:34 +0800 Message-Id: <1478865957-25252-7-git-send-email-tom.leiming@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1478865957-25252-1-git-send-email-tom.leiming@gmail.com> References: <1478865957-25252-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 68a9eb4f3f36..e4f86bead9d3 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; }