* [Cluster-devel] [GFS2 PATCH] GFS2: Refactor gfs2_remove_from_journal
[not found] <1537068764.60585117.1462208237041.JavaMail.zimbra@redhat.com>
@ 2016-05-02 16:58 ` Bob Peterson
2016-05-02 17:31 ` Steven Whitehouse
0 siblings, 1 reply; 2+ messages in thread
From: Bob Peterson @ 2016-05-02 16:58 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
This patch makes two simple changes to function gfs2_remove_from_journal.
First, it removes the parameter that specifies the transaction.
Since it's always passed in as current->journal_info, we might as well
set that in the function rather than passing it in. Second, it changes
the meta parameter to use an enum to make the code more clear.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
---
diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
index 58dd006..e21a931 100644
--- a/fs/gfs2/aops.c
+++ b/fs/gfs2/aops.c
@@ -977,7 +977,7 @@ static void gfs2_discard(struct gfs2_sbd *sdp, struct buffer_head *bh)
if (!list_empty(&bd->bd_list) && !buffer_pinned(bh))
list_del_init(&bd->bd_list);
else
- gfs2_remove_from_journal(bh, current->journal_info, 0);
+ gfs2_remove_from_journal(bh, REMOVE_JDATA);
}
bh->b_bdev = NULL;
clear_buffer_mapped(bh);
diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
index e137d96..8f3f1b8 100644
--- a/fs/gfs2/meta_io.c
+++ b/fs/gfs2/meta_io.c
@@ -325,18 +325,19 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
return 0;
}
-void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta)
+void gfs2_remove_from_journal(struct buffer_head *bh, int meta)
{
struct address_space *mapping = bh->b_page->mapping;
struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
struct gfs2_bufdata *bd = bh->b_private;
+ struct gfs2_trans *tr = current->journal_info;
int was_pinned = 0;
if (test_clear_buffer_pinned(bh)) {
trace_gfs2_pin(bd, 0);
atomic_dec(&sdp->sd_log_pinned);
list_del_init(&bd->bd_list);
- if (meta)
+ if (meta == REMOVE_META)
tr->tr_num_buf_rm++;
else
tr->tr_num_databuf_rm++;
@@ -376,7 +377,7 @@ void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen)
if (bh) {
lock_buffer(bh);
gfs2_log_lock(sdp);
- gfs2_remove_from_journal(bh, current->journal_info, 1);
+ gfs2_remove_from_journal(bh, REMOVE_META);
gfs2_log_unlock(sdp);
unlock_buffer(bh);
brelse(bh);
diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
index c5086c8..ffdf6aa 100644
--- a/fs/gfs2/meta_io.h
+++ b/fs/gfs2/meta_io.h
@@ -57,8 +57,12 @@ extern int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
extern int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh);
extern struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno,
int create);
-extern void gfs2_remove_from_journal(struct buffer_head *bh,
- struct gfs2_trans *tr, int meta);
+enum {
+ REMOVE_JDATA = 0,
+ REMOVE_META = 1,
+};
+
+extern void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
extern void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen);
extern int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
struct buffer_head **bhp);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Cluster-devel] [GFS2 PATCH] GFS2: Refactor gfs2_remove_from_journal
2016-05-02 16:58 ` [Cluster-devel] [GFS2 PATCH] GFS2: Refactor gfs2_remove_from_journal Bob Peterson
@ 2016-05-02 17:31 ` Steven Whitehouse
0 siblings, 0 replies; 2+ messages in thread
From: Steven Whitehouse @ 2016-05-02 17:31 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
On 02/05/16 17:58, Bob Peterson wrote:
> Hi,
>
> This patch makes two simple changes to function gfs2_remove_from_journal.
> First, it removes the parameter that specifies the transaction.
> Since it's always passed in as current->journal_info, we might as well
> set that in the function rather than passing it in. Second, it changes
> the meta parameter to use an enum to make the code more clear.
>
> Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Looks good to me.
Acked-by: Steven Whitehouse <swhiteho@redhat.com>
Steve.
> ---
> diff --git a/fs/gfs2/aops.c b/fs/gfs2/aops.c
> index 58dd006..e21a931 100644
> --- a/fs/gfs2/aops.c
> +++ b/fs/gfs2/aops.c
> @@ -977,7 +977,7 @@ static void gfs2_discard(struct gfs2_sbd *sdp, struct buffer_head *bh)
> if (!list_empty(&bd->bd_list) && !buffer_pinned(bh))
> list_del_init(&bd->bd_list);
> else
> - gfs2_remove_from_journal(bh, current->journal_info, 0);
> + gfs2_remove_from_journal(bh, REMOVE_JDATA);
> }
> bh->b_bdev = NULL;
> clear_buffer_mapped(bh);
> diff --git a/fs/gfs2/meta_io.c b/fs/gfs2/meta_io.c
> index e137d96..8f3f1b8 100644
> --- a/fs/gfs2/meta_io.c
> +++ b/fs/gfs2/meta_io.c
> @@ -325,18 +325,19 @@ int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh)
> return 0;
> }
>
> -void gfs2_remove_from_journal(struct buffer_head *bh, struct gfs2_trans *tr, int meta)
> +void gfs2_remove_from_journal(struct buffer_head *bh, int meta)
> {
> struct address_space *mapping = bh->b_page->mapping;
> struct gfs2_sbd *sdp = gfs2_mapping2sbd(mapping);
> struct gfs2_bufdata *bd = bh->b_private;
> + struct gfs2_trans *tr = current->journal_info;
> int was_pinned = 0;
>
> if (test_clear_buffer_pinned(bh)) {
> trace_gfs2_pin(bd, 0);
> atomic_dec(&sdp->sd_log_pinned);
> list_del_init(&bd->bd_list);
> - if (meta)
> + if (meta == REMOVE_META)
> tr->tr_num_buf_rm++;
> else
> tr->tr_num_databuf_rm++;
> @@ -376,7 +377,7 @@ void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen)
> if (bh) {
> lock_buffer(bh);
> gfs2_log_lock(sdp);
> - gfs2_remove_from_journal(bh, current->journal_info, 1);
> + gfs2_remove_from_journal(bh, REMOVE_META);
> gfs2_log_unlock(sdp);
> unlock_buffer(bh);
> brelse(bh);
> diff --git a/fs/gfs2/meta_io.h b/fs/gfs2/meta_io.h
> index c5086c8..ffdf6aa 100644
> --- a/fs/gfs2/meta_io.h
> +++ b/fs/gfs2/meta_io.h
> @@ -57,8 +57,12 @@ extern int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
> extern int gfs2_meta_wait(struct gfs2_sbd *sdp, struct buffer_head *bh);
> extern struct buffer_head *gfs2_getbuf(struct gfs2_glock *gl, u64 blkno,
> int create);
> -extern void gfs2_remove_from_journal(struct buffer_head *bh,
> - struct gfs2_trans *tr, int meta);
> +enum {
> + REMOVE_JDATA = 0,
> + REMOVE_META = 1,
> +};
> +
> +extern void gfs2_remove_from_journal(struct buffer_head *bh, int meta);
> extern void gfs2_meta_wipe(struct gfs2_inode *ip, u64 bstart, u32 blen);
> extern int gfs2_meta_indirect_buffer(struct gfs2_inode *ip, int height, u64 num,
> struct buffer_head **bhp);
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-05-02 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1537068764.60585117.1462208237041.JavaMail.zimbra@redhat.com>
2016-05-02 16:58 ` [Cluster-devel] [GFS2 PATCH] GFS2: Refactor gfs2_remove_from_journal Bob Peterson
2016-05-02 17:31 ` Steven Whitehouse
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).