Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7290043imu; Thu, 31 Jan 2019 08:02:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN6LBo4Uyfa+YcY/LC3etq6eZLavuNWLsqV1KjraoMpJ+PcWbbQi/y/srYncFDGGsRe3jk93 X-Received: by 2002:a17:902:7107:: with SMTP id a7mr35316112pll.290.1548950520723; Thu, 31 Jan 2019 08:02:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548950520; cv=none; d=google.com; s=arc-20160816; b=u8vNU3KBBQSDgugi520RTC0QIpq6/lpsjThMWUAqxGdZzYh3dmEF7unpQjGJ/vLRH9 JxIqz3ZzlJD2u/7VGjZFbe7wWFgU9kS96fhoEXqvoxDzY5hlntRD8ImZ/LqdD9bMOoDf N/kofGHsmKw9SFmX0GXUR6uaCfRk5deYd94jtW7xm0Sq3WZh+U3PzBLj7eIYKHdbOo35 LKLbsxyzdU1QL4nQ6Ob4avidLJOLYl9D/jU0Mw/J9jfkxJSiC1yHF284t6xsYfpKeX58 UXVaDkyMiMdsjd8g9FfrYxNc3zOgh/7mGmZr8my9/jYFIMFikHQdx8RujP4iTQCzeT1i hRkw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :reply-to:message-id:subject:cc:to:from:date; bh=nIHK6TlOaUSiV6gidPb5t4VUqoHJVKJrlaD2F5sIDv4=; b=BkK0Ltjj0TtAZ46Iki7Zxu/SuKNIIalM/+G25aC32UCizbn1RFfIyUirwgf9UXn2OU 1/4eycVPF/uAKKKinvI5SOxRMsxTELbuZ/shFcrWYXpewt3zCVbntQTc2G2/auHFjRQw d4Pay6BEaEDnJQUAiXeKlnVhat1AP0aNIX3mphRQMJzyC/2r+SmWcW93QWHdxAzBTD1z bf10f9nrGkSRUjeC0x9PcSLXXselwE6D+LE8yCrUjLBhwnjMZikbIA7ybr27+odtIu7I Yuc61nFfeKn+o93AR9Sani9eg+7pRsvwd3PGKkyvUPzD9K84+n8atoqd/JTHxdB2yNIA syww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 27si4700589pgp.135.2019.01.31.08.01.42; Thu, 31 Jan 2019 08:02:00 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387906AbfAaQAr (ORCPT + 99 others); Thu, 31 Jan 2019 11:00:47 -0500 Received: from mx2.suse.de ([195.135.220.15]:53914 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726060AbfAaQAr (ORCPT ); Thu, 31 Jan 2019 11:00:47 -0500 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 86C16ACD8; Thu, 31 Jan 2019 16:00:45 +0000 (UTC) Received: by ds.suse.cz (Postfix, from userid 10065) id E1389DA7D6; Thu, 31 Jan 2019 17:00:10 +0100 (CET) Date: Thu, 31 Jan 2019 17:00:10 +0100 From: David Sterba To: Dennis Zhou Cc: David Sterba , Josef Bacik , Chris Mason , Omar Sandoval , Nick Terrell , kernel-team@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 01/11] btrfs: add macros for compression type and level Message-ID: <20190131160010.GK2900@twin.jikos.cz> Reply-To: dsterba@suse.cz Mail-Followup-To: dsterba@suse.cz, Dennis Zhou , David Sterba , Josef Bacik , Chris Mason , Omar Sandoval , Nick Terrell , kernel-team@fb.com, linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org References: <20190128212437.11597-1-dennis@kernel.org> <20190128212437.11597-2-dennis@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190128212437.11597-2-dennis@kernel.org> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 04:24:27PM -0500, Dennis Zhou wrote: > It is very easy to miss places that rely on a certain bitshifting for > decyphering the type_level overloading. Make macros handle this instead. This encoding was a simple way to introduce the combined type and level for zlib and it could certainly be improved. Either we'll use helpers like you suggest or add a new structure that contains type and level as members. That way we'd see where the level still matters and where the just the type is ok. I haven't checked how much intrusive this would be, so that's for later consideration. Some indirection can be removed for the .set_level callbacks as it does not necessarily need to be a function so I'm expecting that the code around that would be touched anyway.