diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-03 14:38:14 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-03 14:38:14 -0500 |
commit | ed4e6a94d3053b9900b4a1338b8056d532a564c4 (patch) | |
tree | 89b4183298e7ae08ec531652529bbd73076ceda7 /fs | |
parent | 22f4f7b59afd02c3f5372e19a536fde339bfd1dc (diff) | |
parent | 13d2eb012927b03ac1b80202af5aa9abc4003bd5 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes
Pull GFS2 fixes from Steven Whitehouse:
"Here are four small bug fixes for GFS2. There is no common theme here
really, just a few items that were fixed recently.
The first fixes lock name generation when the glock number is 0. The
second fixes a race allocating reservation structures and the final
two fix a performance issue by making small changes in the allocation
code."
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes:
GFS2: Reset rd_last_alloc when it reaches the end of the rgrp
GFS2: Stop looking for free blocks at end of rgrp
GFS2: Fix race in gfs2_rs_alloc
GFS2: Initialize hex string to '0'
Diffstat (limited to 'fs')
-rw-r--r-- | fs/gfs2/lock_dlm.c | 1 | ||||
-rw-r--r-- | fs/gfs2/rgrp.c | 35 |
2 files changed, 21 insertions, 15 deletions
diff --git a/fs/gfs2/lock_dlm.c b/fs/gfs2/lock_dlm.c index 8dad6b093716..b906ed17a839 100644 --- a/fs/gfs2/lock_dlm.c +++ b/fs/gfs2/lock_dlm.c | |||
@@ -241,6 +241,7 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags, | |||
241 | 241 | ||
242 | static void gfs2_reverse_hex(char *c, u64 value) | 242 | static void gfs2_reverse_hex(char *c, u64 value) |
243 | { | 243 | { |
244 | *c = '0'; | ||
244 | while (value) { | 245 | while (value) { |
245 | *c-- = hex_asc[value & 0x0f]; | 246 | *c-- = hex_asc[value & 0x0f]; |
246 | value >>= 4; | 247 | value >>= 4; |
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c index 37ee061d899e..b7eff078fe90 100644 --- a/fs/gfs2/rgrp.c +++ b/fs/gfs2/rgrp.c | |||
@@ -350,10 +350,14 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len) | |||
350 | BUG_ON(len < chunk_size); | 350 | BUG_ON(len < chunk_size); |
351 | len -= chunk_size; | 351 | len -= chunk_size; |
352 | block = gfs2_rbm_to_block(&rbm); | 352 | block = gfs2_rbm_to_block(&rbm); |
353 | gfs2_rbm_from_block(&rbm, block + chunk_size); | 353 | if (gfs2_rbm_from_block(&rbm, block + chunk_size)) { |
354 | n_unaligned = 3; | 354 | n_unaligned = 0; |
355 | if (ptr) | ||
356 | break; | 355 | break; |
356 | } | ||
357 | if (ptr) { | ||
358 | n_unaligned = 3; | ||
359 | break; | ||
360 | } | ||
357 | n_unaligned = len & 3; | 361 | n_unaligned = len & 3; |
358 | } | 362 | } |
359 | 363 | ||
@@ -557,22 +561,20 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd) | |||
557 | */ | 561 | */ |
558 | int gfs2_rs_alloc(struct gfs2_inode *ip) | 562 | int gfs2_rs_alloc(struct gfs2_inode *ip) |
559 | { | 563 | { |
560 | struct gfs2_blkreserv *res; | 564 | int error = 0; |
561 | 565 | ||
566 | down_write(&ip->i_rw_mutex); | ||
562 | if (ip->i_res) | 567 | if (ip->i_res) |
563 | return 0; | 568 | goto out; |
564 | |||
565 | res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); | ||
566 | if (!res) | ||
567 | return -ENOMEM; | ||
568 | 569 | ||
569 | RB_CLEAR_NODE(&res->rs_node); | 570 | ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); |
571 | if (!ip->i_res) { | ||
572 | error = -ENOMEM; | ||
573 | goto out; | ||
574 | } | ||
570 | 575 | ||
571 | down_write(&ip->i_rw_mutex); | 576 | RB_CLEAR_NODE(&ip->i_res->rs_node); |
572 | if (ip->i_res) | 577 | out: |
573 | kmem_cache_free(gfs2_rsrv_cachep, res); | ||
574 | else | ||
575 | ip->i_res = res; | ||
576 | up_write(&ip->i_rw_mutex); | 578 | up_write(&ip->i_rw_mutex); |
577 | return 0; | 579 | return 0; |
578 | } | 580 | } |
@@ -1424,6 +1426,9 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, | |||
1424 | rs->rs_free = extlen; | 1426 | rs->rs_free = extlen; |
1425 | rs->rs_inum = ip->i_no_addr; | 1427 | rs->rs_inum = ip->i_no_addr; |
1426 | rs_insert(ip); | 1428 | rs_insert(ip); |
1429 | } else { | ||
1430 | if (goal == rgd->rd_last_alloc + rgd->rd_data0) | ||
1431 | rgd->rd_last_alloc = 0; | ||
1427 | } | 1432 | } |
1428 | } | 1433 | } |
1429 | 1434 | ||