From patchwork Tue Oct 3 15:06:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timofey Titovets X-Patchwork-Id: 9983029 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 53F2160375 for ; Tue, 3 Oct 2017 15:07:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45F8B287D2 for ; Tue, 3 Oct 2017 15:07:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3999E28806; Tue, 3 Oct 2017 15:07:12 +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 B5BD4287D2 for ; Tue, 3 Oct 2017 15:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752161AbdJCPHI (ORCPT ); Tue, 3 Oct 2017 11:07:08 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:38153 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751980AbdJCPHG (ORCPT ); Tue, 3 Oct 2017 11:07:06 -0400 Received: by mail-lf0-f68.google.com with SMTP id m199so3639137lfe.5 for ; Tue, 03 Oct 2017 08:07:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OI4MuNMw77Yt3z19ebh8N5VA9we8SRPeLXdgiO4AHwQ=; b=MX2X9e77XqEiD/0DT64E79aofx0TFkXWLkw1UbBKlFbDFkpIYdl3e1NY05KmcvY7OY mmNkaCWJqU+JDoYXeFXjcOVZAt94Z9lqg3PLsdw6bgtRbgDk6bO0kqhAmctp9aBYeRm5 GUwNpCh8HI4bsj81BZPo9wvUQjyQFNj1Os8vk5WlFqNuKjq7ka2sncrmkmq5wDaQN1fM pd2Chv2CK/NC+O2yRGYw3ZOIw6E0iwp43GGEGjY4VAknYkYW9PkHTfoYUKJ8GswZwMSt IBz+zSeBM5Y6y41o2qHdy7CVucYRMTpBuctKLdKN8kdNHiQPQpvNGsn9dkO8j1UTbGB/ tpBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OI4MuNMw77Yt3z19ebh8N5VA9we8SRPeLXdgiO4AHwQ=; b=cJylfMd4ddFw9r9J1OgNWRcMKqbjSv4O0JIxRr/hztGdwqOVhTMyu+ubmDYl2mBJeN gjBE64W6Bu38foLWFPzlZbe/ppZqD2DnK8N0xeKu+cZIsBy5kwbpEG1JwCedcmoCE7sQ kMrbMpDADWnkShXpnbU/+MIrQ7b+3cjBw7QqKUt1g62taB1aPaNs1FS1Ho5364hW/MxM twnTmGoRkc4cfKwmlVuecoOKICKE8zCnK/HGzG6coAglAGU9bFhl0X6izPnkXvlezUvB jABW6XMk8QRUnX174HCJ7L0ADw+npe5954DnwUXTNomEfQXbJ4ftbuyidaVSzuyT3IGi A8Mw== X-Gm-Message-State: AHPjjUjipjiqQWrQaTwGPnWD0/hY48unWRPjyoZA+88KXKIvD1Engmf5 YTshMHdqHtfVfoaShZ4nNKuQxw== X-Google-Smtp-Source: AOwi7QD4867ZlIePzP6OzLQkT+sKyh2LaZCtwtPkJneHOExKYqnklb3U2B9XFyivoPflx9nSFNpH0w== X-Received: by 10.46.91.154 with SMTP id m26mr9451761lje.111.1507043224959; Tue, 03 Oct 2017 08:07:04 -0700 (PDT) Received: from titovetst-l.itransition.corp ([93.171.6.182]) by smtp.gmail.com with ESMTPSA id t20sm2938498ljb.91.2017.10.03.08.07.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Oct 2017 08:07:04 -0700 (PDT) From: Timofey Titovets To: linux-btrfs@vger.kernel.org Cc: Timofey Titovets Subject: [PATCH 1/4] Btrfs: compress_file_range() remove dead variable num_bytes Date: Tue, 3 Oct 2017 18:06:01 +0300 Message-Id: <20171003150604.19596-2-nefelim4ag@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171003150604.19596-1-nefelim4ag@gmail.com> References: <20171003150604.19596-1-nefelim4ag@gmail.com> Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Remove dead assigment of num_bytes Also as num_bytes only used in will_compress block as copy of total_in just replace that with total_in and drop num_bytes entire Signed-off-by: Timofey Titovets Reviewed-by: Nikolay Borisov Reviewed-by: David Sterba --- fs/btrfs/inode.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b728397ba6e1..237df8fdf7b8 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -458,7 +458,6 @@ static noinline void compress_file_range(struct inode *inode, { struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); struct btrfs_root *root = BTRFS_I(inode)->root; - u64 num_bytes; u64 blocksize = fs_info->sectorsize; u64 actual_end; u64 isize = i_size_read(inode); @@ -508,8 +507,6 @@ static noinline void compress_file_range(struct inode *inode, total_compressed = min_t(unsigned long, total_compressed, BTRFS_MAX_UNCOMPRESSED); - num_bytes = ALIGN(end - start + 1, blocksize); - num_bytes = max(blocksize, num_bytes); total_in = 0; ret = 0; @@ -628,7 +625,6 @@ static noinline void compress_file_range(struct inode *inode, */ total_in = ALIGN(total_in, PAGE_SIZE); if (total_compressed + blocksize <= total_in) { - num_bytes = total_in; *num_added += 1; /* @@ -636,12 +632,12 @@ static noinline void compress_file_range(struct inode *inode, * allocation on disk for these compressed pages, and * will submit them to the elevator. */ - add_async_extent(async_cow, start, num_bytes, + add_async_extent(async_cow, start, total_in, total_compressed, pages, nr_pages, compress_type); - if (start + num_bytes < end) { - start += num_bytes; + if (start + total_in < end) { + start += total_in; pages = NULL; cond_resched(); goto again;