From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="CXg83zgi" 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-fsdevel@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?