Re: [Cluster-devel] GFS2: Take account of blockages when using reserved blocks

2012-07-31 Thread Bob Peterson
- Original Message -
| 
| The claim_reserved_blks() function was not taking account of
| the possibility of blockages while performing allocation.
| This can be caused by another node allocating something in
| the same extent which has been reserved locally.
| 
| This patch tests for this condition and then skips the remainder
| of the reservation in this case. This is a relatively rare event,
| so that it should not affect the general performance improvement
| which the block reservations provide.
| 
| The claim_reserved_blks() function also appears not to be able
| to deal with reservations which cross bitmap boundaries, but
| that can be dealt with in a future patch since we don't generate
| boundary crossing reservations currently.
| 
| Signed-off-by: Steven Whitehouse swhit...@redhat.com
| Reported-by: David Teigland teigl...@redhat.com
| Cc: Bob Peterson rpete...@redhat.com

Hi,

ACK to both patches.

I've done a fair amount of testing with these two patches.

Regards,

Bob Peterson
Red Hat File Systems



[Cluster-devel] GFS2: Add structure to contain rgrp, bitmap, offset tuple

2012-07-31 Thread Steven Whitehouse

This patch introduces a new structure, gfs2_rbm, which is a
tuple of a resource group, a bitmap within the resource group
and an offset within that bitmap. This is designed to make
manipulating these sets of variables easier. There is also a
new helper function which converts this representation back
to a disk block address.

In addition, the rbtree nodes which are used for the reservations
were not being correctly initialised, which is now fixed. Also,
the tracing was not passing through the inode where it should
have been. That is mostly fixed aside from one corner case. This
needs to be revisited since there can also be a NULL rgrp in
some cases which results in the device being incorrect in the
trace.

This is intended to be the first step towards cleaning up some
of the allocation code, and some further bug fixes.

Signed-off-by: Steven Whitehouse swhit...@redhat.com

diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index 49cd7dd..1fd3ae2 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -786,7 +786,7 @@ static int do_strip(struct gfs2_inode *ip, struct 
buffer_head *dibh,
goto out_rlist;
 
if (gfs2_rs_active(ip-i_res)) /* needs to be done with the rgrp glock 
held */
-   gfs2_rs_deltree(ip-i_res);
+   gfs2_rs_deltree(ip, ip-i_res);
 
error = gfs2_trans_begin(sdp, rg_blocks + RES_DINODE +
 RES_INDIRECT + RES_STATFS + RES_QUOTA,
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 52078a1..d5e2546 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -102,6 +102,17 @@ struct gfs2_rgrpd {
u32 rd_rs_cnt;  /* count of current reservations */
 };
 
+struct gfs2_rbm {
+   struct gfs2_rgrpd *rgd;
+   struct gfs2_bitmap *bi; /* Bitmap must belong to the rgd */
+   u32 offset; /* The offset is bitmap relative */
+};
+
+static inline u64 gfs2_rbm_to_block(const struct gfs2_rbm *rbm)
+{
+   return rbm-rgd-rd_data0 + (rbm-bi-bi_start * GFS2_NBBY) + 
rbm-offset;
+}
+
 enum gfs2_state_bits {
BH_Pinned = BH_PrivateStart,
BH_Escaped = BH_PrivateStart + 1,
@@ -251,13 +262,11 @@ struct gfs2_blkreserv {
atomic_t rs_sizehint; /* hint of the write size */
 
/* components used during get_local_rgrp (step 3): */
-   struct gfs2_rgrpd *rs_rgd;/* pointer to the gfs2_rgrpd */
+   struct gfs2_rbm rs_rbm;
struct gfs2_holder rs_rgd_gh; /* Filled in by get_local_rgrp */
struct rb_node rs_node;   /* link to other block reservations */
 
/* components used during block searches and assignments (step 4): */
-   struct gfs2_bitmap *rs_bi;/* bitmap for the current allocation */
-   u32 rs_biblk; /* start block relative to the bi */
u32 rs_free;  /* how many blocks are still free */
 
/* ancillary quota stuff */
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index a2b43bb..eaa4188 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -192,7 +192,7 @@ static inline u64 gfs2_bit_search(const __le64 *ptr, u64 
mask, u8 state)
  */
 static inline int rs_cmp(u64 blk, u32 len, struct gfs2_blkreserv *rs)
 {
-   u64 startblk = gfs2_rs_startblk(rs);
+   u64 startblk = gfs2_rbm_to_block(rs-rs_rbm);
 
if (blk = startblk + rs-rs_free)
return 1;
@@ -487,6 +487,8 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
if (!res)
error = -ENOMEM;
 
+   rb_init_node(res-rs_node);
+
down_write(ip-i_rw_mutex);
if (ip-i_res)
kmem_cache_free(gfs2_rsrv_cachep, res);
@@ -499,8 +501,8 @@ int gfs2_rs_alloc(struct gfs2_inode *ip)
 static void dump_rs(struct seq_file *seq, struct gfs2_blkreserv *rs)
 {
gfs2_print_dbg(seq,   r: %llu s:%llu b:%u f:%u\n,
-  rs-rs_rgd-rd_addr, gfs2_rs_startblk(rs), rs-rs_biblk,
-  rs-rs_free);
+  rs-rs_rbm.rgd-rd_addr, gfs2_rbm_to_block(rs-rs_rbm), 
+  rs-rs_rbm.offset, rs-rs_free);
 }
 
 /**
@@ -508,40 +510,28 @@ static void dump_rs(struct seq_file *seq, struct 
gfs2_blkreserv *rs)
  * @rs: The reservation to remove
  *
  */
-static void __rs_deltree(struct gfs2_blkreserv *rs)
+static void __rs_deltree(struct gfs2_inode *ip, struct gfs2_blkreserv *rs)
 {
struct gfs2_rgrpd *rgd;
 
if (!gfs2_rs_active(rs))
return;
 
-   rgd = rs-rs_rgd;
-   /* We can't do this: The reason is that when the rgrp is invalidated,
-  it's in the middle of acquiring the glock, but the HOLDER bit
-  isn't set yet:
-  BUG_ON(!gfs2_glock_is_locked_by_me(rs-rs_rgd-rd_gl));*/
-   trace_gfs2_rs(NULL, rs, TRACE_RS_TREEDEL);
-
-   if (!RB_EMPTY_ROOT(rgd-rd_rstree))
-   rb_erase(rs-rs_node, rgd-rd_rstree);
+   rgd = rs-rs_rbm.rgd;
+   trace_gfs2_rs(ip, rs, TRACE_RS_TREEDEL);
+   rb_erase(rs-rs_node, rgd-rd_rstree);
+   

Re: [Cluster-devel] Fence driver for the Digital Loggers Web Power Switches

2012-07-31 Thread Dwight Hubbard
If I knew where to submit it I'd be happy to

On Mon, Jul 23, 2012 at 11:18 PM, Fabio M. Di Nitto fdini...@redhat.comwrote:

 On 07/23/2012 10:12 PM, Dwight Hubbard wrote:
  I updated the Fence driver I wrote back in 2009 for the Digital loggers
  network power switches (http://digital-loggers.com/lpc.html) to work
  with some additional powerswitch models and put the code in a github
  repo http://github.com/dwighthubbard/python-dlipower.  In case it's
  useful for anyone else...

 Is there a specific reason why you don't submit the code upstream and
 have it part of fence-agents.git?

 Thanks
 Fabio




Re: [Cluster-devel] Fence driver for the Digital Loggers Web Power Switches

2012-07-31 Thread Dwight Hubbard
Hopefully this is a correct patch, been a long while since I've generated
one

On Tue, Jul 31, 2012 at 12:06 PM, Fabio M. Di Nitto fdini...@redhat.comwrote:

 On 07/31/2012 06:59 PM, Dwight Hubbard wrote:
  If I knew where to submit it I'd be happy to

 here is just fine :) either in form of patch to fence-agents.git master
 branch or as a standalone agent and we can help integrating in the
 current tree.

 Fabio

 
  On Mon, Jul 23, 2012 at 11:18 PM, Fabio M. Di Nitto fdini...@redhat.com
  mailto:fdini...@redhat.com wrote:
 
  On 07/23/2012 10:12 PM, Dwight Hubbard wrote:
   I updated the Fence driver I wrote back in 2009 for the Digital
  loggers
   network power switches (http://digital-loggers.com/lpc.html) to
 work
   with some additional powerswitch models and put the code in a
 github
   repo http://github.com/dwighthubbard/python-dlipower.  In case
 it's
   useful for anyone else...
 
  Is there a specific reason why you don't submit the code upstream and
  have it part of fence-agents.git?
 
  Thanks
  Fabio
 
 




fence-agents-cd73f09_fence_dli.patch
Description: Binary data


Re: [Cluster-devel] Fence driver for the Digital Loggers Web Power Switches

2012-07-31 Thread Fabio M. Di Nitto
On 07/31/2012 10:24 PM, Dwight Hubbard wrote:
 Hopefully this is a correct patch, been a long while since I've
 generated one

Don't worry.. I'll have Marek review it and send comments back.

My only minor concern is the license. Do you think you can make your
agent GPLv2+ ? otherwise I guess it's time to fix the build system and
packaging to deal with multiple license. tho having the whole tree under
the same umbrella is easier ;)

Thanks
Fabio

 
 On Tue, Jul 31, 2012 at 12:06 PM, Fabio M. Di Nitto fdini...@redhat.com
 mailto:fdini...@redhat.com wrote:
 
 On 07/31/2012 06:59 PM, Dwight Hubbard wrote:
  If I knew where to submit it I'd be happy to
 
 here is just fine :) either in form of patch to fence-agents.git master
 branch or as a standalone agent and we can help integrating in the
 current tree.
 
 Fabio
 
 
  On Mon, Jul 23, 2012 at 11:18 PM, Fabio M. Di Nitto
 fdini...@redhat.com mailto:fdini...@redhat.com
  mailto:fdini...@redhat.com mailto:fdini...@redhat.com wrote:
 
  On 07/23/2012 10:12 PM, Dwight Hubbard wrote:
   I updated the Fence driver I wrote back in 2009 for the Digital
  loggers
   network power switches (http://digital-loggers.com/lpc.html)
 to work
   with some additional powerswitch models and put the code in
 a github
   repo http://github.com/dwighthubbard/python-dlipower.  In
 case it's
   useful for anyone else...
 
  Is there a specific reason why you don't submit the code
 upstream and
  have it part of fence-agents.git?
 
  Thanks
  Fabio