Re: [GFS2] Simplify glops functions [53/70]

2006-12-04 Thread Steven Whitehouse
Hi,

On Fri, 2006-12-01 at 12:43 -0600, Russell Cattelan wrote:
> On Thu, 2006-11-30 at 12:21 +, Steven Whitehouse wrote:
> > >From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
> > From: Steven Whitehouse <[EMAIL PROTECTED]>
> > Date: Mon, 20 Nov 2006 10:37:45 -0500
> > Subject: [PATCH] [GFS2] Simplify glops functions
> > 
> > The go_sync callback took two flags, but one of them was set on every
> > call, so this patch removes once of the flags and makes the previously
> > conditional operations (on this flag), unconditional.
> > 
> > The go_inval callback took three flags, each of which was set on every
> > call to it. This patch removes the flags and makes the operations
> > unconditional, which makes the logic rather more obvious.
> 
> I get really nervous about making these type of interfaces changes
> until the problem is understood.
> 
The problem can by understood by the simple use of grep.

> Given the the rather non-function and incomplete state of GFS2 it
> seems premature to just remove flags states on the observation
> that they are not CURRENTLY used.
> 
I disagree, I don't want the code to be littered with functions
containing code which is never called as its very confusing,
particularly for those who are unable to devote their full time to
working on gfs2 but still need to understand the code.

If a use is ever found for this code (which I very much doubt) then we
can always put it back at that time. In the mean time, simpler code is
easier to debug,

Steve.

> > 
> > Two now unused flags are also removed from incore.h.
> > 
> > Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
> > ---
> >  fs/gfs2/glock.c  |   10 +-
> >  fs/gfs2/glops.c  |   42 +++---
> >  fs/gfs2/incore.h |   25 +++--
> >  fs/gfs2/super.c  |2 +-
> >  4 files changed, 28 insertions(+), 51 deletions(-)
> > 
> > diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> > index edc21c8..b8ba4d5 100644
> > --- a/fs/gfs2/glock.c
> > +++ b/fs/gfs2/glock.c
> > @@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
> >  
> > if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) {
> > if (glops->go_inval)
> > -   glops->go_inval(gl, DIO_METADATA | DIO_DATA);
> > +   glops->go_inval(gl, DIO_METADATA);
> > } else if (gl->gl_state == LM_ST_DEFERRED) {
> > /* We might not want to do this here.
> >Look at moving to the inode glops. */
> > if (glops->go_inval)
> > -   glops->go_inval(gl, DIO_DATA);
> > +   glops->go_inval(gl, 0);
> > }
> >  
> > /*  Deal with each possible exit condition  */
> > @@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
> > gfs2_assert_warn(sdp, state != gl->gl_state);
> >  
> > if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
> > -   glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
> > +   glops->go_sync(gl);
> >  
> > gfs2_glock_hold(gl);
> > gl->gl_req_bh = xmote_bh;
> > @@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
> > state_change(gl, LM_ST_UNLOCKED);
> >  
> > if (glops->go_inval)
> > -   glops->go_inval(gl, DIO_METADATA | DIO_DATA);
> > +   glops->go_inval(gl, DIO_METADATA);
> >  
> > if (gh) {
> > spin_lock(>gl_spin);
> > @@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
> > gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED);
> >  
> > if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
> > -   glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
> > +   glops->go_sync(gl);
> >  
> > gfs2_glock_hold(gl);
> > gl->gl_req_bh = drop_bh;
> > diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
> > index b92de0a..60561ca 100644
> > --- a/fs/gfs2/glops.c
> > +++ b/fs/gfs2/glops.c
> > @@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
> >  /**
> >   * meta_go_sync - sync out the metadata for this glock
> >   * @gl: the glock
> > - * @flags: DIO_*
> >   *
> >   * Called when demoting or unlocking an EX glock.  We must flush
> >   * to disk all dirty buffers/pages relating to this glock, and must not
> >   * not return to caller to demote/unlock the glock until I/O is complete.
> >   */
> >  
> > -static void meta_go_sync(struct gfs2_glock *gl, int flags)
> > +static void meta_go_sync(struct gfs2_glock *gl)
> >  {
> > -   if (!(flags & DIO_METADATA))
> > -   return;
> > -
> > if (test_and_clear_bit(GLF_DIRTY, >gl_flags)) {
> > gfs2_log_flush(gl->gl_sbd, gl);
> > gfs2_meta_sync(gl);
> > -   if (flags & DIO_RELEASE)
> > -   gfs2_ail_empty_gl(gl);
> > +   gfs2_ail_empty_gl(gl);
> > }
> >  
> >  }
> > @@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
> >  /**
> >   * inode_go_sync - Sync the dirty data and/or metadata for an 

Re: [GFS2] Simplify glops functions [53/70]

2006-12-04 Thread Steven Whitehouse
Hi,

On Fri, 2006-12-01 at 12:43 -0600, Russell Cattelan wrote:
 On Thu, 2006-11-30 at 12:21 +, Steven Whitehouse wrote:
  From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
  From: Steven Whitehouse [EMAIL PROTECTED]
  Date: Mon, 20 Nov 2006 10:37:45 -0500
  Subject: [PATCH] [GFS2] Simplify glops functions
  
  The go_sync callback took two flags, but one of them was set on every
  call, so this patch removes once of the flags and makes the previously
  conditional operations (on this flag), unconditional.
  
  The go_inval callback took three flags, each of which was set on every
  call to it. This patch removes the flags and makes the operations
  unconditional, which makes the logic rather more obvious.
 
 I get really nervous about making these type of interfaces changes
 until the problem is understood.
 
The problem can by understood by the simple use of grep.

 Given the the rather non-function and incomplete state of GFS2 it
 seems premature to just remove flags states on the observation
 that they are not CURRENTLY used.
 
I disagree, I don't want the code to be littered with functions
containing code which is never called as its very confusing,
particularly for those who are unable to devote their full time to
working on gfs2 but still need to understand the code.

If a use is ever found for this code (which I very much doubt) then we
can always put it back at that time. In the mean time, simpler code is
easier to debug,

Steve.

  
  Two now unused flags are also removed from incore.h.
  
  Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]
  ---
   fs/gfs2/glock.c  |   10 +-
   fs/gfs2/glops.c  |   42 +++---
   fs/gfs2/incore.h |   25 +++--
   fs/gfs2/super.c  |2 +-
   4 files changed, 28 insertions(+), 51 deletions(-)
  
  diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
  index edc21c8..b8ba4d5 100644
  --- a/fs/gfs2/glock.c
  +++ b/fs/gfs2/glock.c
  @@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
   
  if (prev_state != LM_ST_UNLOCKED  !(ret  LM_OUT_CACHEABLE)) {
  if (glops-go_inval)
  -   glops-go_inval(gl, DIO_METADATA | DIO_DATA);
  +   glops-go_inval(gl, DIO_METADATA);
  } else if (gl-gl_state == LM_ST_DEFERRED) {
  /* We might not want to do this here.
 Look at moving to the inode glops. */
  if (glops-go_inval)
  -   glops-go_inval(gl, DIO_DATA);
  +   glops-go_inval(gl, 0);
  }
   
  /*  Deal with each possible exit condition  */
  @@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
  gfs2_assert_warn(sdp, state != gl-gl_state);
   
  if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
  -   glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
  +   glops-go_sync(gl);
   
  gfs2_glock_hold(gl);
  gl-gl_req_bh = xmote_bh;
  @@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
  state_change(gl, LM_ST_UNLOCKED);
   
  if (glops-go_inval)
  -   glops-go_inval(gl, DIO_METADATA | DIO_DATA);
  +   glops-go_inval(gl, DIO_METADATA);
   
  if (gh) {
  spin_lock(gl-gl_spin);
  @@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
  gfs2_assert_warn(sdp, gl-gl_state != LM_ST_UNLOCKED);
   
  if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
  -   glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
  +   glops-go_sync(gl);
   
  gfs2_glock_hold(gl);
  gl-gl_req_bh = drop_bh;
  diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
  index b92de0a..60561ca 100644
  --- a/fs/gfs2/glops.c
  +++ b/fs/gfs2/glops.c
  @@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
   /**
* meta_go_sync - sync out the metadata for this glock
* @gl: the glock
  - * @flags: DIO_*
*
* Called when demoting or unlocking an EX glock.  We must flush
* to disk all dirty buffers/pages relating to this glock, and must not
* not return to caller to demote/unlock the glock until I/O is complete.
*/
   
  -static void meta_go_sync(struct gfs2_glock *gl, int flags)
  +static void meta_go_sync(struct gfs2_glock *gl)
   {
  -   if (!(flags  DIO_METADATA))
  -   return;
  -
  if (test_and_clear_bit(GLF_DIRTY, gl-gl_flags)) {
  gfs2_log_flush(gl-gl_sbd, gl);
  gfs2_meta_sync(gl);
  -   if (flags  DIO_RELEASE)
  -   gfs2_ail_empty_gl(gl);
  +   gfs2_ail_empty_gl(gl);
  }
   
   }
  @@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
   /**
* inode_go_sync - Sync the dirty data and/or metadata for an inode glock
* @gl: the glock protecting the inode
  - * @flags:
*
*/
   
  -static void inode_go_sync(struct gfs2_glock *gl, int flags)
  +static void inode_go_sync(struct gfs2_glock *gl)
   {
  -   int meta = (flags  DIO_METADATA);
  -   

Re: [GFS2] Simplify glops functions [53/70]

2006-12-01 Thread Russell Cattelan
On Thu, 2006-11-30 at 12:21 +, Steven Whitehouse wrote:
> >From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
> From: Steven Whitehouse <[EMAIL PROTECTED]>
> Date: Mon, 20 Nov 2006 10:37:45 -0500
> Subject: [PATCH] [GFS2] Simplify glops functions
> 
> The go_sync callback took two flags, but one of them was set on every
> call, so this patch removes once of the flags and makes the previously
> conditional operations (on this flag), unconditional.
> 
> The go_inval callback took three flags, each of which was set on every
> call to it. This patch removes the flags and makes the operations
> unconditional, which makes the logic rather more obvious.

I get really nervous about making these type of interfaces changes
until the problem is understood.

Given the the rather non-function and incomplete state of GFS2 it
seems premature to just remove flags states on the observation
that they are not CURRENTLY used.

> 
> Two now unused flags are also removed from incore.h.
> 
> Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
> ---
>  fs/gfs2/glock.c  |   10 +-
>  fs/gfs2/glops.c  |   42 +++---
>  fs/gfs2/incore.h |   25 +++--
>  fs/gfs2/super.c  |2 +-
>  4 files changed, 28 insertions(+), 51 deletions(-)
> 
> diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
> index edc21c8..b8ba4d5 100644
> --- a/fs/gfs2/glock.c
> +++ b/fs/gfs2/glock.c
> @@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
>  
>   if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) {
>   if (glops->go_inval)
> - glops->go_inval(gl, DIO_METADATA | DIO_DATA);
> + glops->go_inval(gl, DIO_METADATA);
>   } else if (gl->gl_state == LM_ST_DEFERRED) {
>   /* We might not want to do this here.
>  Look at moving to the inode glops. */
>   if (glops->go_inval)
> - glops->go_inval(gl, DIO_DATA);
> + glops->go_inval(gl, 0);
>   }
>  
>   /*  Deal with each possible exit condition  */
> @@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
>   gfs2_assert_warn(sdp, state != gl->gl_state);
>  
>   if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
> - glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
> + glops->go_sync(gl);
>  
>   gfs2_glock_hold(gl);
>   gl->gl_req_bh = xmote_bh;
> @@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
>   state_change(gl, LM_ST_UNLOCKED);
>  
>   if (glops->go_inval)
> - glops->go_inval(gl, DIO_METADATA | DIO_DATA);
> + glops->go_inval(gl, DIO_METADATA);
>  
>   if (gh) {
>   spin_lock(>gl_spin);
> @@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
>   gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED);
>  
>   if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
> - glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
> + glops->go_sync(gl);
>  
>   gfs2_glock_hold(gl);
>   gl->gl_req_bh = drop_bh;
> diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
> index b92de0a..60561ca 100644
> --- a/fs/gfs2/glops.c
> +++ b/fs/gfs2/glops.c
> @@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
>  /**
>   * meta_go_sync - sync out the metadata for this glock
>   * @gl: the glock
> - * @flags: DIO_*
>   *
>   * Called when demoting or unlocking an EX glock.  We must flush
>   * to disk all dirty buffers/pages relating to this glock, and must not
>   * not return to caller to demote/unlock the glock until I/O is complete.
>   */
>  
> -static void meta_go_sync(struct gfs2_glock *gl, int flags)
> +static void meta_go_sync(struct gfs2_glock *gl)
>  {
> - if (!(flags & DIO_METADATA))
> - return;
> -
>   if (test_and_clear_bit(GLF_DIRTY, >gl_flags)) {
>   gfs2_log_flush(gl->gl_sbd, gl);
>   gfs2_meta_sync(gl);
> - if (flags & DIO_RELEASE)
> - gfs2_ail_empty_gl(gl);
> + gfs2_ail_empty_gl(gl);
>   }
>  
>  }
> @@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
>  /**
>   * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
>   * @gl: the glock protecting the inode
> - * @flags:
>   *
>   */
>  
> -static void inode_go_sync(struct gfs2_glock *gl, int flags)
> +static void inode_go_sync(struct gfs2_glock *gl)
>  {
> - int meta = (flags & DIO_METADATA);
> - int data = (flags & DIO_DATA);
> -
>   if (test_bit(GLF_DIRTY, >gl_flags)) {
> - if (meta && data) {
> - gfs2_page_writeback(gl);
> - gfs2_log_flush(gl->gl_sbd, gl);
> - gfs2_meta_sync(gl);
> - gfs2_page_wait(gl);
> - clear_bit(GLF_DIRTY, >gl_flags);
> - } else if (meta) {
> - 

Re: [GFS2] Simplify glops functions [53/70]

2006-12-01 Thread Russell Cattelan
On Thu, 2006-11-30 at 12:21 +, Steven Whitehouse wrote:
 From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
 From: Steven Whitehouse [EMAIL PROTECTED]
 Date: Mon, 20 Nov 2006 10:37:45 -0500
 Subject: [PATCH] [GFS2] Simplify glops functions
 
 The go_sync callback took two flags, but one of them was set on every
 call, so this patch removes once of the flags and makes the previously
 conditional operations (on this flag), unconditional.
 
 The go_inval callback took three flags, each of which was set on every
 call to it. This patch removes the flags and makes the operations
 unconditional, which makes the logic rather more obvious.

I get really nervous about making these type of interfaces changes
until the problem is understood.

Given the the rather non-function and incomplete state of GFS2 it
seems premature to just remove flags states on the observation
that they are not CURRENTLY used.

 
 Two now unused flags are also removed from incore.h.
 
 Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]
 ---
  fs/gfs2/glock.c  |   10 +-
  fs/gfs2/glops.c  |   42 +++---
  fs/gfs2/incore.h |   25 +++--
  fs/gfs2/super.c  |2 +-
  4 files changed, 28 insertions(+), 51 deletions(-)
 
 diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
 index edc21c8..b8ba4d5 100644
 --- a/fs/gfs2/glock.c
 +++ b/fs/gfs2/glock.c
 @@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
  
   if (prev_state != LM_ST_UNLOCKED  !(ret  LM_OUT_CACHEABLE)) {
   if (glops-go_inval)
 - glops-go_inval(gl, DIO_METADATA | DIO_DATA);
 + glops-go_inval(gl, DIO_METADATA);
   } else if (gl-gl_state == LM_ST_DEFERRED) {
   /* We might not want to do this here.
  Look at moving to the inode glops. */
   if (glops-go_inval)
 - glops-go_inval(gl, DIO_DATA);
 + glops-go_inval(gl, 0);
   }
  
   /*  Deal with each possible exit condition  */
 @@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
   gfs2_assert_warn(sdp, state != gl-gl_state);
  
   if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
 - glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
 + glops-go_sync(gl);
  
   gfs2_glock_hold(gl);
   gl-gl_req_bh = xmote_bh;
 @@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
   state_change(gl, LM_ST_UNLOCKED);
  
   if (glops-go_inval)
 - glops-go_inval(gl, DIO_METADATA | DIO_DATA);
 + glops-go_inval(gl, DIO_METADATA);
  
   if (gh) {
   spin_lock(gl-gl_spin);
 @@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
   gfs2_assert_warn(sdp, gl-gl_state != LM_ST_UNLOCKED);
  
   if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
 - glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
 + glops-go_sync(gl);
  
   gfs2_glock_hold(gl);
   gl-gl_req_bh = drop_bh;
 diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
 index b92de0a..60561ca 100644
 --- a/fs/gfs2/glops.c
 +++ b/fs/gfs2/glops.c
 @@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
  /**
   * meta_go_sync - sync out the metadata for this glock
   * @gl: the glock
 - * @flags: DIO_*
   *
   * Called when demoting or unlocking an EX glock.  We must flush
   * to disk all dirty buffers/pages relating to this glock, and must not
   * not return to caller to demote/unlock the glock until I/O is complete.
   */
  
 -static void meta_go_sync(struct gfs2_glock *gl, int flags)
 +static void meta_go_sync(struct gfs2_glock *gl)
  {
 - if (!(flags  DIO_METADATA))
 - return;
 -
   if (test_and_clear_bit(GLF_DIRTY, gl-gl_flags)) {
   gfs2_log_flush(gl-gl_sbd, gl);
   gfs2_meta_sync(gl);
 - if (flags  DIO_RELEASE)
 - gfs2_ail_empty_gl(gl);
 + gfs2_ail_empty_gl(gl);
   }
  
  }
 @@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
  /**
   * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
   * @gl: the glock protecting the inode
 - * @flags:
   *
   */
  
 -static void inode_go_sync(struct gfs2_glock *gl, int flags)
 +static void inode_go_sync(struct gfs2_glock *gl)
  {
 - int meta = (flags  DIO_METADATA);
 - int data = (flags  DIO_DATA);
 -
   if (test_bit(GLF_DIRTY, gl-gl_flags)) {
 - if (meta  data) {
 - gfs2_page_writeback(gl);
 - gfs2_log_flush(gl-gl_sbd, gl);
 - gfs2_meta_sync(gl);
 - gfs2_page_wait(gl);
 - clear_bit(GLF_DIRTY, gl-gl_flags);
 - } else if (meta) {
 - gfs2_log_flush(gl-gl_sbd, gl);
 - gfs2_meta_sync(gl);
 - } else if (data) {
 - gfs2_page_writeback(gl);
 -   

[GFS2] Simplify glops functions [53/70]

2006-11-30 Thread Steven Whitehouse
>From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse <[EMAIL PROTECTED]>
Date: Mon, 20 Nov 2006 10:37:45 -0500
Subject: [PATCH] [GFS2] Simplify glops functions

The go_sync callback took two flags, but one of them was set on every
call, so this patch removes once of the flags and makes the previously
conditional operations (on this flag), unconditional.

The go_inval callback took three flags, each of which was set on every
call to it. This patch removes the flags and makes the operations
unconditional, which makes the logic rather more obvious.

Two now unused flags are also removed from incore.h.

Signed-off-by: Steven Whitehouse <[EMAIL PROTECTED]>
---
 fs/gfs2/glock.c  |   10 +-
 fs/gfs2/glops.c  |   42 +++---
 fs/gfs2/incore.h |   25 +++--
 fs/gfs2/super.c  |2 +-
 4 files changed, 28 insertions(+), 51 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index edc21c8..b8ba4d5 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
 
if (prev_state != LM_ST_UNLOCKED && !(ret & LM_OUT_CACHEABLE)) {
if (glops->go_inval)
-   glops->go_inval(gl, DIO_METADATA | DIO_DATA);
+   glops->go_inval(gl, DIO_METADATA);
} else if (gl->gl_state == LM_ST_DEFERRED) {
/* We might not want to do this here.
   Look at moving to the inode glops. */
if (glops->go_inval)
-   glops->go_inval(gl, DIO_DATA);
+   glops->go_inval(gl, 0);
}
 
/*  Deal with each possible exit condition  */
@@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
gfs2_assert_warn(sdp, state != gl->gl_state);
 
if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
-   glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
+   glops->go_sync(gl);
 
gfs2_glock_hold(gl);
gl->gl_req_bh = xmote_bh;
@@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
state_change(gl, LM_ST_UNLOCKED);
 
if (glops->go_inval)
-   glops->go_inval(gl, DIO_METADATA | DIO_DATA);
+   glops->go_inval(gl, DIO_METADATA);
 
if (gh) {
spin_lock(>gl_spin);
@@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
gfs2_assert_warn(sdp, gl->gl_state != LM_ST_UNLOCKED);
 
if (gl->gl_state == LM_ST_EXCLUSIVE && glops->go_sync)
-   glops->go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
+   glops->go_sync(gl);
 
gfs2_glock_hold(gl);
gl->gl_req_bh = drop_bh;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index b92de0a..60561ca 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
 /**
  * meta_go_sync - sync out the metadata for this glock
  * @gl: the glock
- * @flags: DIO_*
  *
  * Called when demoting or unlocking an EX glock.  We must flush
  * to disk all dirty buffers/pages relating to this glock, and must not
  * not return to caller to demote/unlock the glock until I/O is complete.
  */
 
-static void meta_go_sync(struct gfs2_glock *gl, int flags)
+static void meta_go_sync(struct gfs2_glock *gl)
 {
-   if (!(flags & DIO_METADATA))
-   return;
-
if (test_and_clear_bit(GLF_DIRTY, >gl_flags)) {
gfs2_log_flush(gl->gl_sbd, gl);
gfs2_meta_sync(gl);
-   if (flags & DIO_RELEASE)
-   gfs2_ail_empty_gl(gl);
+   gfs2_ail_empty_gl(gl);
}
 
 }
@@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
 /**
  * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
  * @gl: the glock protecting the inode
- * @flags:
  *
  */
 
-static void inode_go_sync(struct gfs2_glock *gl, int flags)
+static void inode_go_sync(struct gfs2_glock *gl)
 {
-   int meta = (flags & DIO_METADATA);
-   int data = (flags & DIO_DATA);
-
if (test_bit(GLF_DIRTY, >gl_flags)) {
-   if (meta && data) {
-   gfs2_page_writeback(gl);
-   gfs2_log_flush(gl->gl_sbd, gl);
-   gfs2_meta_sync(gl);
-   gfs2_page_wait(gl);
-   clear_bit(GLF_DIRTY, >gl_flags);
-   } else if (meta) {
-   gfs2_log_flush(gl->gl_sbd, gl);
-   gfs2_meta_sync(gl);
-   } else if (data) {
-   gfs2_page_writeback(gl);
-   gfs2_page_wait(gl);
-   }
-   if (flags & DIO_RELEASE)
-   gfs2_ail_empty_gl(gl);
+   gfs2_page_writeback(gl);
+   gfs2_log_flush(gl->gl_sbd, gl);
+   gfs2_meta_sync(gl);
+   gfs2_page_wait(gl);
+   

[GFS2] Simplify glops functions [53/70]

2006-11-30 Thread Steven Whitehouse
From 1a14d3a68f04527546121eb7b45187ff6af63151 Mon Sep 17 00:00:00 2001
From: Steven Whitehouse [EMAIL PROTECTED]
Date: Mon, 20 Nov 2006 10:37:45 -0500
Subject: [PATCH] [GFS2] Simplify glops functions

The go_sync callback took two flags, but one of them was set on every
call, so this patch removes once of the flags and makes the previously
conditional operations (on this flag), unconditional.

The go_inval callback took three flags, each of which was set on every
call to it. This patch removes the flags and makes the operations
unconditional, which makes the logic rather more obvious.

Two now unused flags are also removed from incore.h.

Signed-off-by: Steven Whitehouse [EMAIL PROTECTED]
---
 fs/gfs2/glock.c  |   10 +-
 fs/gfs2/glops.c  |   42 +++---
 fs/gfs2/incore.h |   25 +++--
 fs/gfs2/super.c  |2 +-
 4 files changed, 28 insertions(+), 51 deletions(-)

diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index edc21c8..b8ba4d5 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -847,12 +847,12 @@ static void xmote_bh(struct gfs2_glock *
 
if (prev_state != LM_ST_UNLOCKED  !(ret  LM_OUT_CACHEABLE)) {
if (glops-go_inval)
-   glops-go_inval(gl, DIO_METADATA | DIO_DATA);
+   glops-go_inval(gl, DIO_METADATA);
} else if (gl-gl_state == LM_ST_DEFERRED) {
/* We might not want to do this here.
   Look at moving to the inode glops. */
if (glops-go_inval)
-   glops-go_inval(gl, DIO_DATA);
+   glops-go_inval(gl, 0);
}
 
/*  Deal with each possible exit condition  */
@@ -954,7 +954,7 @@ void gfs2_glock_xmote_th(struct gfs2_glo
gfs2_assert_warn(sdp, state != gl-gl_state);
 
if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
-   glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
+   glops-go_sync(gl);
 
gfs2_glock_hold(gl);
gl-gl_req_bh = xmote_bh;
@@ -995,7 +995,7 @@ static void drop_bh(struct gfs2_glock *g
state_change(gl, LM_ST_UNLOCKED);
 
if (glops-go_inval)
-   glops-go_inval(gl, DIO_METADATA | DIO_DATA);
+   glops-go_inval(gl, DIO_METADATA);
 
if (gh) {
spin_lock(gl-gl_spin);
@@ -1041,7 +1041,7 @@ void gfs2_glock_drop_th(struct gfs2_gloc
gfs2_assert_warn(sdp, gl-gl_state != LM_ST_UNLOCKED);
 
if (gl-gl_state == LM_ST_EXCLUSIVE  glops-go_sync)
-   glops-go_sync(gl, DIO_METADATA | DIO_DATA | DIO_RELEASE);
+   glops-go_sync(gl);
 
gfs2_glock_hold(gl);
gl-gl_req_bh = drop_bh;
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index b92de0a..60561ca 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -173,23 +173,18 @@ static void gfs2_page_writeback(struct g
 /**
  * meta_go_sync - sync out the metadata for this glock
  * @gl: the glock
- * @flags: DIO_*
  *
  * Called when demoting or unlocking an EX glock.  We must flush
  * to disk all dirty buffers/pages relating to this glock, and must not
  * not return to caller to demote/unlock the glock until I/O is complete.
  */
 
-static void meta_go_sync(struct gfs2_glock *gl, int flags)
+static void meta_go_sync(struct gfs2_glock *gl)
 {
-   if (!(flags  DIO_METADATA))
-   return;
-
if (test_and_clear_bit(GLF_DIRTY, gl-gl_flags)) {
gfs2_log_flush(gl-gl_sbd, gl);
gfs2_meta_sync(gl);
-   if (flags  DIO_RELEASE)
-   gfs2_ail_empty_gl(gl);
+   gfs2_ail_empty_gl(gl);
}
 
 }
@@ -264,31 +259,18 @@ static void inode_go_drop_th(struct gfs2
 /**
  * inode_go_sync - Sync the dirty data and/or metadata for an inode glock
  * @gl: the glock protecting the inode
- * @flags:
  *
  */
 
-static void inode_go_sync(struct gfs2_glock *gl, int flags)
+static void inode_go_sync(struct gfs2_glock *gl)
 {
-   int meta = (flags  DIO_METADATA);
-   int data = (flags  DIO_DATA);
-
if (test_bit(GLF_DIRTY, gl-gl_flags)) {
-   if (meta  data) {
-   gfs2_page_writeback(gl);
-   gfs2_log_flush(gl-gl_sbd, gl);
-   gfs2_meta_sync(gl);
-   gfs2_page_wait(gl);
-   clear_bit(GLF_DIRTY, gl-gl_flags);
-   } else if (meta) {
-   gfs2_log_flush(gl-gl_sbd, gl);
-   gfs2_meta_sync(gl);
-   } else if (data) {
-   gfs2_page_writeback(gl);
-   gfs2_page_wait(gl);
-   }
-   if (flags  DIO_RELEASE)
-   gfs2_ail_empty_gl(gl);
+   gfs2_page_writeback(gl);
+   gfs2_log_flush(gl-gl_sbd, gl);
+   gfs2_meta_sync(gl);
+   gfs2_page_wait(gl);
+   clear_bit(GLF_DIRTY,