From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bombadil.infradead.org ([198.137.202.133]:59280 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754537AbeFVVNC (ORCPT ); Fri, 22 Jun 2018 17:13:02 -0400 Date: Fri, 22 Jun 2018 14:12:59 -0700 From: Matthew Wilcox To: Randy Dunlap Cc: linux-kernel@vger.kernel.org, Alexander Viro , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH 05/26] fs: Convert unnamed_dev_ida to new API Message-ID: <20180622211259.GB18630@bombadil.infradead.org> References: <20180621212835.5636-1-willy@infradead.org> <20180621212835.5636-6-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, Jun 22, 2018 at 12:45:10PM -0700, Randy Dunlap wrote: > > + * Context: Any context. Frequently called while holding sb_lock. > > + * Return: 0 on success, -EMFILE if there are no anonymous bdevs left > > + * or -EAGAIN if memory allocation failed. > > Looks to me like the code used to return -ENOMEM and used -EAGAIN as an > internal retry code. > > confused? (/me) Quite right. +++ b/fs/super.c @@ -989,7 +989,7 @@ static DEFINE_IDA(unnamed_dev_ida); * * Context: Any context. Frequently called while holding sb_lock. * Return: 0 on success, -EMFILE if there are no anonymous bdevs left - * or -EAGAIN if memory allocation failed. + * or -ENOMEM if memory allocation failed. */ int get_anon_bdev(dev_t *p) { @@ -1002,9 +1002,9 @@ int get_anon_bdev(dev_t *p) dev = ida_alloc_range(&unnamed_dev_ida, 1, (1 << MINORBITS) - 1, GFP_ATOMIC); if (dev == -ENOSPC) - return -EMFILE; + dev = -EMFILE; if (dev < 0) - return -EAGAIN; + return dev; *p = MKDEV(0, dev); return 0;