From patchwork Wed Aug 23 22:45:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timofey Titovets X-Patchwork-Id: 9918593 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 9682D600C5 for ; Wed, 23 Aug 2017 22:46:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8A1C328A7E for ; Wed, 23 Aug 2017 22:46:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7EF7D28A9F; Wed, 23 Aug 2017 22:46: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 2B5F728A7E for ; Wed, 23 Aug 2017 22:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751104AbdHWWqA (ORCPT ); Wed, 23 Aug 2017 18:46:00 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34693 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbdHWWp6 (ORCPT ); Wed, 23 Aug 2017 18:45:58 -0400 Received: by mail-wm0-f66.google.com with SMTP id 69so964097wmh.1 for ; Wed, 23 Aug 2017 15:45:57 -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=RMDnnpUlZb2tvD6f1909B/plN+Ry9ZjyRiMfzJbBhTs=; b=LKKG0/NbbSPIcfBWO6yAd5qOaGhZHNaV9z2iRLJuff6LzLbr09q78Pxfi8yUWNZzHf PshCMzhex6SpLv5DtZRe8xH60SQCPw45IOjHL7iD7ufwAphVtS3CHAi+fbyYx1OKg/lh QLnn/UIdXPr1+AkI4FP/tiGZY2vHpR5dU1d46PWSCIVQOVnyS26FFFZ4B6qWZzriy9wl i4869QWrgEf62URcAsM5Xh4vatFPwXK7UQOw4coetXw01QQr4NwXEBNw88urMhOrofTP 8wncv3yDbtxtzU8wK8ect4QrXiUSWkB5WcbXCQ4CvM8ln1hliG2LB+22zA9VzCaW/tsw OJzg== 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=RMDnnpUlZb2tvD6f1909B/plN+Ry9ZjyRiMfzJbBhTs=; b=HqJhsE7dkMJLqreVPGl+F1yFUsX45IxjOy1eLxlLCkcanA2/oUKpdVPh+JhmbNZ9IA xJBfqarYY86OacUiABWrKqsh2BKzNsT75V2t0LFWId21g/lBUNBb5VU4MWs/FLex3qVt cgEQj4frBFp6TDnShUzyg9yGOTbvOnnjffA+NIiuQyG05tPwes6xhAyHjnq2eHdz8saF iSU/v1B7UD7sNx2fDaek9D6DpwtnjnUWYFVlo3TuPOvuKESXxUgzElZGh4JQDWpeQKhI R9QV6iIHRjnqtTipEbv/bVuZVjgQG9dU6uIG/TMpF491rxYnB3p4mijxIJBiH2Dr7bXg 8zgQ== X-Gm-Message-State: AHYfb5iEowkCp/5ZKxHSsrEBTCZmBjz9rrva+PNHzkW1I8c4MAPFOOdS Akb60VUFInLSQKWF X-Received: by 10.28.45.20 with SMTP id t20mr3043277wmt.5.1503528357073; Wed, 23 Aug 2017 15:45:57 -0700 (PDT) Received: from localhost.localdomain (nat3-minsk-pool-46-53-180-190.telecom.by. [46.53.180.190]) by smtp.gmail.com with ESMTPSA id m27sm5896166wrf.69.2017.08.23.15.45.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Aug 2017 15:45:56 -0700 (PDT) From: Timofey Titovets To: linux-btrfs@vger.kernel.org Cc: Timofey Titovets Subject: [PATCH v6 1/6] Btrfs: heuristic make use compression workspaces Date: Thu, 24 Aug 2017 01:45:40 +0300 Message-Id: <20170823224545.16375-2-nefelim4ag@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170823224545.16375-1-nefelim4ag@gmail.com> References: <20170823224545.16375-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 Move heuristic to external file Implement compression workspaces support for heuristic resources Signed-off-by: Timofey Titovets --- fs/btrfs/heuristic.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/heuristic.c b/fs/btrfs/heuristic.c index 96ae3e9334bc..d0e9f9112b7e 100644 --- a/fs/btrfs/heuristic.c +++ b/fs/btrfs/heuristic.c @@ -48,14 +48,20 @@ static int heuristic(struct list_head *ws, struct inode *inode, { struct page *page; u64 index, index_end; - u8 *input_data; index = start >> PAGE_SHIFT; index_end = end >> PAGE_SHIFT; + /* + * If end aligned to PAGE_SIZE + * It's useless to check +1 PAGE + */ + if(end%PAGE_SIZE == 0) + index_end--; + for (; index <= index_end; index++) { page = find_get_page(inode->i_mapping, index); - input_data = kmap(page); + kmap(page); kunmap(page); put_page(page); }