Commit ed4e6a94 authored by Linus Torvalds's avatar Linus Torvalds

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'
parents 22f4f7b5 13d2eb01
...@@ -241,6 +241,7 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags, ...@@ -241,6 +241,7 @@ static u32 make_flags(struct gfs2_glock *gl, const unsigned int gfs_flags,
static void gfs2_reverse_hex(char *c, u64 value) static void gfs2_reverse_hex(char *c, u64 value)
{ {
*c = '0';
while (value) { while (value) {
*c-- = hex_asc[value & 0x0f]; *c-- = hex_asc[value & 0x0f];
value >>= 4; value >>= 4;
......
...@@ -350,10 +350,14 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len) ...@@ -350,10 +350,14 @@ static u32 gfs2_free_extlen(const struct gfs2_rbm *rrbm, u32 len)
BUG_ON(len < chunk_size); BUG_ON(len < chunk_size);
len -= chunk_size; len -= chunk_size;
block = gfs2_rbm_to_block(&rbm); block = gfs2_rbm_to_block(&rbm);
gfs2_rbm_from_block(&rbm, block + chunk_size); if (gfs2_rbm_from_block(&rbm, block + chunk_size)) {
n_unaligned = 3; n_unaligned = 0;
if (ptr)
break; break;
}
if (ptr) {
n_unaligned = 3;
break;
}
n_unaligned = len & 3; n_unaligned = len & 3;
} }
...@@ -557,22 +561,20 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd) ...@@ -557,22 +561,20 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd)
*/ */
int gfs2_rs_alloc(struct gfs2_inode *ip) int gfs2_rs_alloc(struct gfs2_inode *ip)
{ {
struct gfs2_blkreserv *res; int error = 0;
down_write(&ip->i_rw_mutex);
if (ip->i_res) if (ip->i_res)
return 0; goto out;
res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
if (!res)
return -ENOMEM;
RB_CLEAR_NODE(&res->rs_node); ip->i_res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
if (!ip->i_res) {
error = -ENOMEM;
goto out;
}
down_write(&ip->i_rw_mutex); RB_CLEAR_NODE(&ip->i_res->rs_node);
if (ip->i_res) out:
kmem_cache_free(gfs2_rsrv_cachep, res);
else
ip->i_res = res;
up_write(&ip->i_rw_mutex); up_write(&ip->i_rw_mutex);
return 0; return 0;
} }
...@@ -1424,6 +1426,9 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip, ...@@ -1424,6 +1426,9 @@ static void rg_mblk_search(struct gfs2_rgrpd *rgd, struct gfs2_inode *ip,
rs->rs_free = extlen; rs->rs_free = extlen;
rs->rs_inum = ip->i_no_addr; rs->rs_inum = ip->i_no_addr;
rs_insert(ip); rs_insert(ip);
} else {
if (goal == rgd->rd_last_alloc + rgd->rd_data0)
rgd->rd_last_alloc = 0;
} }
} }
......
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