diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2007-03-18 13:04:15 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2007-05-01 04:10:47 -0400 |
commit | f35ac346bc48b2086aa94f031baf1f6237a89de6 (patch) | |
tree | 52894d686dfff82914655e3fd32767f806b77d33 /fs | |
parent | 254da030dfb1b13d42d07e4292a4790d88c6874f (diff) |
[GFS2] Speed up lock_dlm's locking (move sprintf)
The following patch speeds up lock_dlm's locking by moving the sprintf
out from the lock acquisition path and into the lock creation path. This
reduces the amount of CPU time used in acquiring locks by a fair amount.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Acked-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/locking/dlm/lock.c | 10 | ||||
-rw-r--r-- | fs/gfs2/locking/dlm/lock_dlm.h | 1 |
2 files changed, 5 insertions, 6 deletions
diff --git a/fs/gfs2/locking/dlm/lock.c b/fs/gfs2/locking/dlm/lock.c index b167addf9fd1..f9c8bda289a8 100644 --- a/fs/gfs2/locking/dlm/lock.c +++ b/fs/gfs2/locking/dlm/lock.c | |||
@@ -151,7 +151,7 @@ static inline unsigned int make_flags(struct gdlm_lock *lp, | |||
151 | 151 | ||
152 | /* make_strname - convert GFS lock numbers to a string */ | 152 | /* make_strname - convert GFS lock numbers to a string */ |
153 | 153 | ||
154 | static inline void make_strname(struct lm_lockname *lockname, | 154 | static inline void make_strname(const struct lm_lockname *lockname, |
155 | struct gdlm_strname *str) | 155 | struct gdlm_strname *str) |
156 | { | 156 | { |
157 | sprintf(str->name, "%8x%16llx", lockname->ln_type, | 157 | sprintf(str->name, "%8x%16llx", lockname->ln_type, |
@@ -169,6 +169,7 @@ static int gdlm_create_lp(struct gdlm_ls *ls, struct lm_lockname *name, | |||
169 | return -ENOMEM; | 169 | return -ENOMEM; |
170 | 170 | ||
171 | lp->lockname = *name; | 171 | lp->lockname = *name; |
172 | make_strname(name, &lp->strname); | ||
172 | lp->ls = ls; | 173 | lp->ls = ls; |
173 | lp->cur = DLM_LOCK_IV; | 174 | lp->cur = DLM_LOCK_IV; |
174 | lp->lvb = NULL; | 175 | lp->lvb = NULL; |
@@ -227,7 +228,6 @@ void gdlm_put_lock(void *lock) | |||
227 | unsigned int gdlm_do_lock(struct gdlm_lock *lp) | 228 | unsigned int gdlm_do_lock(struct gdlm_lock *lp) |
228 | { | 229 | { |
229 | struct gdlm_ls *ls = lp->ls; | 230 | struct gdlm_ls *ls = lp->ls; |
230 | struct gdlm_strname str; | ||
231 | int error, bast = 1; | 231 | int error, bast = 1; |
232 | 232 | ||
233 | /* | 233 | /* |
@@ -249,8 +249,6 @@ unsigned int gdlm_do_lock(struct gdlm_lock *lp) | |||
249 | if (test_bit(LFL_NOBAST, &lp->flags)) | 249 | if (test_bit(LFL_NOBAST, &lp->flags)) |
250 | bast = 0; | 250 | bast = 0; |
251 | 251 | ||
252 | make_strname(&lp->lockname, &str); | ||
253 | |||
254 | set_bit(LFL_ACTIVE, &lp->flags); | 252 | set_bit(LFL_ACTIVE, &lp->flags); |
255 | 253 | ||
256 | log_debug("lk %x,%llx id %x %d,%d %x", lp->lockname.ln_type, | 254 | log_debug("lk %x,%llx id %x %d,%d %x", lp->lockname.ln_type, |
@@ -258,8 +256,8 @@ unsigned int gdlm_do_lock(struct gdlm_lock *lp) | |||
258 | lp->cur, lp->req, lp->lkf); | 256 | lp->cur, lp->req, lp->lkf); |
259 | 257 | ||
260 | error = dlm_lock(ls->dlm_lockspace, lp->req, &lp->lksb, lp->lkf, | 258 | error = dlm_lock(ls->dlm_lockspace, lp->req, &lp->lksb, lp->lkf, |
261 | str.name, str.namelen, 0, gdlm_ast, lp, | 259 | lp->strname.name, lp->strname.namelen, 0, gdlm_ast, |
262 | bast ? gdlm_bast : NULL); | 260 | lp, bast ? gdlm_bast : NULL); |
263 | 261 | ||
264 | if ((error == -EAGAIN) && (lp->lkf & DLM_LKF_NOQUEUE)) { | 262 | if ((error == -EAGAIN) && (lp->lkf & DLM_LKF_NOQUEUE)) { |
265 | lp->lksb.sb_status = -EAGAIN; | 263 | lp->lksb.sb_status = -EAGAIN; |
diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h index a87c7bf3c568..6888bd49c31b 100644 --- a/fs/gfs2/locking/dlm/lock_dlm.h +++ b/fs/gfs2/locking/dlm/lock_dlm.h | |||
@@ -106,6 +106,7 @@ enum { | |||
106 | struct gdlm_lock { | 106 | struct gdlm_lock { |
107 | struct gdlm_ls *ls; | 107 | struct gdlm_ls *ls; |
108 | struct lm_lockname lockname; | 108 | struct lm_lockname lockname; |
109 | struct gdlm_strname strname; | ||
109 | char *lvb; | 110 | char *lvb; |
110 | struct dlm_lksb lksb; | 111 | struct dlm_lksb lksb; |
111 | 112 | ||