Commit 75d25ffe authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: allow create lkb with specific id range

This patch adds functionality to add a lkb with a specific id range.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 9af5b8f0
...@@ -1180,7 +1180,8 @@ static void detach_lkb(struct dlm_lkb *lkb) ...@@ -1180,7 +1180,8 @@ static void detach_lkb(struct dlm_lkb *lkb)
} }
} }
static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret) static int _create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret,
int start, int end)
{ {
struct dlm_lkb *lkb; struct dlm_lkb *lkb;
int rv; int rv;
...@@ -1201,7 +1202,7 @@ static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret) ...@@ -1201,7 +1202,7 @@ static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
idr_preload(GFP_NOFS); idr_preload(GFP_NOFS);
spin_lock(&ls->ls_lkbidr_spin); spin_lock(&ls->ls_lkbidr_spin);
rv = idr_alloc(&ls->ls_lkbidr, lkb, 1, 0, GFP_NOWAIT); rv = idr_alloc(&ls->ls_lkbidr, lkb, start, end, GFP_NOWAIT);
if (rv >= 0) if (rv >= 0)
lkb->lkb_id = rv; lkb->lkb_id = rv;
spin_unlock(&ls->ls_lkbidr_spin); spin_unlock(&ls->ls_lkbidr_spin);
...@@ -1217,6 +1218,11 @@ static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret) ...@@ -1217,6 +1218,11 @@ static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
return 0; return 0;
} }
static int create_lkb(struct dlm_ls *ls, struct dlm_lkb **lkb_ret)
{
return _create_lkb(ls, lkb_ret, 1, 0);
}
static int find_lkb(struct dlm_ls *ls, uint32_t lkid, struct dlm_lkb **lkb_ret) static int find_lkb(struct dlm_ls *ls, uint32_t lkid, struct dlm_lkb **lkb_ret)
{ {
struct dlm_lkb *lkb; struct dlm_lkb *lkb;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment