From patchwork Thu Sep 13 12:05:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikolay Borisov X-Patchwork-Id: 10599329 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B12F96CB for ; Thu, 13 Sep 2018 12:05:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A12922A9AF for ; Thu, 13 Sep 2018 12:05:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 957A32AA90; Thu, 13 Sep 2018 12:05:13 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 4344D2A9AF for ; Thu, 13 Sep 2018 12:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727726AbeIMROV (ORCPT ); Thu, 13 Sep 2018 13:14:21 -0400 Received: from mx2.suse.de ([195.135.220.15]:50904 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726919AbeIMROV (ORCPT ); Thu, 13 Sep 2018 13:14:21 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 83024AD6A for ; Thu, 13 Sep 2018 12:05:10 +0000 (UTC) From: Nikolay Borisov To: linux-btrfs@vger.kernel.org Cc: Nikolay Borisov Subject: [PATCH 0/3] Misc refactoring of check_file_extent Date: Thu, 13 Sep 2018 15:05:04 +0300 Message-Id: <20180913120507.18197-1-nborisov@suse.com> X-Mailer: git-send-email 2.17.1 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 While looking at check_file_extent I thought that the code might be a bit cleaner than it actually is and cleaner as well. The first patch factors out the code dealing with inline extents into a separate function aptly named check_file_extent_inline. This allows to remove some inline-specific variable from check_file_extent. Patch 2 just moves the final check in the new function into the already existing branch handling the !compressed case. Finally the check which detects unknown extent types is moved first in check_file_extent, followed by the code to handle inline extents and finally the existing code to handle regular/prealloc extents is left intact. This patchset brings no functional changes. Nikolay Borisov (3): btrfs-progs: check: lowmem: Factor out inline extent checking code in its own function btrfs-progs: check: lowmem: Refactor extent len test in check_file_extent_inline btrfs-progs: check: lowmem: Refactor extent type checks in check_file_extent check/mode-lowmem.c | 151 ++++++++++++++++++++++++++------------------ 1 file changed, 89 insertions(+), 62 deletions(-) Reviewed-by: Lu Fengqi