Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp290527rdh; Wed, 7 Feb 2024 05:06:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiICT+0rDYlgeEyTY+n9TGOUGMRP2gIL4xr47dijJCB/f+V2SJRzeRGs8889FFGY+7or2n X-Received: by 2002:a17:90b:903:b0:296:833a:b47f with SMTP id bo3-20020a17090b090300b00296833ab47fmr2647057pjb.21.1707311216571; Wed, 07 Feb 2024 05:06:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707311216; cv=pass; d=google.com; s=arc-20160816; b=qg2wiCO5V4yDsad3WAk+PNlHI5CPWP5Pp7yglWyDHqgAYgc80jDFafZTSWX+4w5jXO NAnXW0dlPSdotCsAVRhz7Cl+trTvDSEW2DilWWwejky9O34cJzQ3tkKTGaYhfSfSqHKp +pXMSq/8s+wjF6XXa38U4g2vN/FjT+cM3k2OzVeeviVlFvO6Rjs6x4QYFQtNXZ3y9h4f vfjOaCZqACviNL/L12AXF/5FhaH5S4YRT6o8osi4w4IHji5ixZY15ejRqYal+rSmvTXC PI+T5uUO2jRHKuHgQQNTd3SGgyGCW4OSdqc4+A84sMwYfnM24IuNlAMDhuSx7wd/iYs8 7naw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=i5Q2EjVFD56Thy5YwUxsYl3ZKEbzYz5TtV7K+JoUogc=; fh=5nV0obbMXMbiYjPssEOqjCbQXH4eHqq5kQ442vuVmyM=; b=LtX7IPEmfdLi03MAABHc7Oe+eXh/wmpwXIEdMh4f+U6Djq5u0ZEw6B7KGdibld7MvN AhppIjiflNac62iMx9AMeW8l0JejVU4TVcm4kw0kYIIwG92EHFlzxeHY7AllK39zR7q/ 3Qp05bpNd3CS7CCJliNU2i6J8gT2ZCE0jaemvd9okjOu0feo6wzgefE64Jg37Ji10emg V/5IzDgWqVdRTYFAS8BextZn5wIiOXdhC2+WDfhWlkUIQ1IVoDpICA2ZcQGeeSsn8Cuj Ox7DDxfdaUmXSVz7gKoFfDk8gMZEFzV4fOHZ7uDPxM/vyFo3bHqft7JSi62wmF1iitLG /Xfw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CXg83zgi; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-56433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56433-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCU0cJqBMhXsqLmXAgKAEuv4+vkCUZPuo0vNPYZIjX7uhinv2MLxLJwRLMMngMqkaTvNqhbB9tiR/Q3C3MA7XMzG/xFxmpB3QeDb6VLcMQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id lk17-20020a17090b33d100b002931f778063si1670958pjb.67.2024.02.07.05.06.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 05:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=CXg83zgi; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-56433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56433-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E4638B271B7 for ; Wed, 7 Feb 2024 12:01:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3948259B53; Wed, 7 Feb 2024 12:01:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CXg83zgi" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4772F59B5B; Wed, 7 Feb 2024 12:01:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307265; cv=none; b=TKqWgT7xAXXECbvKYhBanxgR1nbWml14Yc+Fb4LRArMSG/wqTxaPRYKpnvZDJeY098dFm8tOYmSjmNNRrKINYfyYnC840Uad8/7Xf+aPyObKlmLAeEfnhlr1UubY0q6e6wbCyDTT2GwOFOFWCdJwu8oWInmAtu94a1hg9ILaGOw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707307265; c=relaxed/simple; bh=oYhU2hLjtwChKJiF05doNBvPoVd8EBer/T75afDR0Js=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VDt88cY3O2bLFCMD3org1kv7yypPuITGwzh7Zfe6hyhoZokWjl7D9FF6RHKJvJlZg8U6HQ8vSDNU9MNdP5oVbv40YVQEswwLcAX74DX9C0kwb76+lIDbHQjY82fWZ9WhR38ZHe59QNT4Yol8CIygqATqKS11YMrQsC86nNtsmiA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=CXg83zgi; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=i5Q2EjVFD56Thy5YwUxsYl3ZKEbzYz5TtV7K+JoUogc=; b=CXg83zgidTJP7jUi+An6EZG38t zAHIWwa4fp3UGNjlupaHHQHw+fv+azPP1DBEqrPMeO2fMCkPi8eNSE3nx/qmpGFwj3PyNc231627S Wd9n7Ta7BJsuCl+OdpBVAG5dxyufVXgJ1GThGJCvrjjRARW8oojrFffjJgN/1My4NuqlaBuqbpean b59drlGQJnlTeDWf041ss+MQ9dPJro1Acsi07LbLZV/fd32UBRs8wktm1RyaheRLWE/+J75lU71ep k3hIERMr4G6KwGwZ4coM9uMGdqeORxb78z4EhnhTd4iSQK9Si6OJF/Ourl3kWpsIPrQr78Elq1h5S 8Dqw+lwg==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rXgbp-0000000F3pw-3jRP; Wed, 07 Feb 2024 12:00:57 +0000 Date: Wed, 7 Feb 2024 12:00:57 +0000 From: Matthew Wilcox To: Miklos Szeredi Cc: Jan Kara , lsf-pc , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [Lsf-pc] [LSF/MM/BPF TOPIC] tracing the source of errors Message-ID: References: <20240207110041.fwypjtzsgrcdhalv@quack3> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Wed, Feb 07, 2024 at 12:23:41PM +0100, Miklos Szeredi wrote: > On Wed, 7 Feb 2024 at 12:00, Jan Kara wrote: > > > The problem always has been how to implement this functionality in a > > transparent way so the code does not become a mess. So if you have some > > idea, I'd say go for it :) > > My first idea would be to wrap all instances of E* (e.g. ERR(E*)). > But this could be made completely transparent by renaming current > definition of E* to _E* and defining E* to be the wrapped ones. > There's probably a catch (or several catches) somewhere, though. To be perfectly clear, you're suggesting two things. Option (a) change "all" code like this: - ret = -EINVAL; + ret = -ERR(EINVAL); where ERR would do some magic with __func__ and __LINE__. Option (b) -#define EINVAL 22 +#define E_INVAL 22 +#define EINVAL ERR(E_INVAL) and then change all code that does something like: if (err == -EINVAL) to if (err == -E_INVAL) Or have I misunderstood?