lkml.org 
[lkml]   [2018]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH 05/26] fs: Convert unnamed_dev_ida to new API
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;
\
 
 \ /
  Last update: 2018-06-22 23:13    [W:0.068 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site