From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A6EEC169C4 for ; Thu, 31 Jan 2019 16:00:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 12CCB21900 for ; Thu, 31 Jan 2019 16:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387912AbfAaQAr (ORCPT ); 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.