Merge branch 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax
Pull IDA updates from Matthew Wilcox: "A better IDA API: id = ida_alloc(ida, GFP_xxx); ida_free(ida, id); rather than the cumbersome ida_simple_get(), ida_simple_remove(). The new IDA API is similar to ida_simple_get() but better named. The internal restructuring of the IDA code removes the bitmap preallocation nonsense. I hope the net -200 lines of code is convincing" * 'ida-4.19' of git://git.infradead.org/users/willy/linux-dax: (29 commits) ida: Change ida_get_new_above to return the id ida: Remove old API test_ida: check_ida_destroy and check_ida_alloc test_ida: Convert check_ida_conv to new API test_ida: Move ida_check_max test_ida: Move ida_check_leaf idr-test: Convert ida_check_nomem to new API ida: Start new test_ida module target/iscsi: Allocate session IDs from an IDA iscsi target: fix session creation failure handling drm/vmwgfx: Convert to new IDA API dmaengine: Convert to new IDA API ppc: Convert vas ID allocation to new IDA API media: Convert entity ID allocation to new IDA API ppc: Convert mmu context allocation to new IDA API Convert net_namespace to new IDA API cb710: Convert to new IDA API rsxx: Convert to new IDA API osd: Convert to new IDA API sd: Convert to new IDA API ...
This commit is contained in:
@@ -515,35 +515,17 @@ int init_winctx_regs(struct vas_window *window, struct vas_winctx *winctx)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static DEFINE_SPINLOCK(vas_ida_lock);
|
||||
|
||||
static void vas_release_window_id(struct ida *ida, int winid)
|
||||
{
|
||||
spin_lock(&vas_ida_lock);
|
||||
ida_remove(ida, winid);
|
||||
spin_unlock(&vas_ida_lock);
|
||||
ida_free(ida, winid);
|
||||
}
|
||||
|
||||
static int vas_assign_window_id(struct ida *ida)
|
||||
{
|
||||
int rc, winid;
|
||||
int winid = ida_alloc_max(ida, VAS_WINDOWS_PER_CHIP - 1, GFP_KERNEL);
|
||||
|
||||
do {
|
||||
rc = ida_pre_get(ida, GFP_KERNEL);
|
||||
if (!rc)
|
||||
return -EAGAIN;
|
||||
|
||||
spin_lock(&vas_ida_lock);
|
||||
rc = ida_get_new(ida, &winid);
|
||||
spin_unlock(&vas_ida_lock);
|
||||
} while (rc == -EAGAIN);
|
||||
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (winid > VAS_WINDOWS_PER_CHIP) {
|
||||
pr_err("Too many (%d) open windows\n", winid);
|
||||
vas_release_window_id(ida, winid);
|
||||
if (winid == -ENOSPC) {
|
||||
pr_err("Too many (%d) open windows\n", VAS_WINDOWS_PER_CHIP);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user