From: swhiteho@redhat.com <swhiteho@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 19/58] [GFS2] Don't add glocks to the journal
Date: Mon, 21 Jan 2008 09:21:37 +0000 [thread overview]
Message-ID: <1200907374616-git-send-email-swhiteho@redhat.com> (raw)
In-Reply-To: <12009073722253-git-send-email-swhiteho@redhat.com>
From: Steven Whitehouse <swhiteho@redhat.com>
The only reason for adding glocks to the journal was to keep track
of which locks required a log flush prior to release. We add a
flag to the glock to allow this check to be made in a simpler way.
This reduces the size of a glock (by 12 bytes on i386, 24 on x86_64)
and means that we can avoid extra work during the journal flush.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index 5fbd9d3..d83df68 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -346,7 +346,6 @@ int gfs2_glock_get(struct gfs2_sbd *sdp, u64 number,
gl->gl_object = NULL;
gl->gl_sbd = sdp;
gl->gl_aspace = NULL;
- lops_init_le(&gl->gl_le, &gfs2_glock_lops);
INIT_DELAYED_WORK(&gl->gl_work, glock_work_func);
/* If this glock protects actual on-disk data or metadata blocks,
@@ -1900,8 +1899,6 @@ static int dump_glock(struct glock_iter *gi, struct gfs2_glock *gl)
print_dbg(gi, " req_bh = %s\n", (gl->gl_req_bh) ? "yes" : "no");
print_dbg(gi, " lvb_count = %d\n", atomic_read(&gl->gl_lvb_count));
print_dbg(gi, " object = %s\n", (gl->gl_object) ? "yes" : "no");
- print_dbg(gi, " le = %s\n",
- (list_empty(&gl->gl_le.le_list)) ? "no" : "yes");
print_dbg(gi, " reclaim = %s\n",
(list_empty(&gl->gl_reclaim)) ? "no" : "yes");
if (gl->gl_aspace)
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index 478023e..911822d 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -168,6 +168,7 @@ enum {
GLF_PENDING_DEMOTE = 4,
GLF_DIRTY = 5,
GLF_DEMOTE_IN_PROGRESS = 6,
+ GLF_LFLUSH = 7,
};
struct gfs2_glock {
@@ -208,7 +209,6 @@ struct gfs2_glock {
struct gfs2_sbd *gl_sbd;
struct inode *gl_aspace;
- struct gfs2_log_element gl_le;
struct list_head gl_ail_list;
atomic_t gl_ail_count;
struct delayed_work gl_work;
@@ -584,13 +584,11 @@ struct gfs2_sbd {
unsigned int sd_log_commited_databuf;
unsigned int sd_log_commited_revoke;
- unsigned int sd_log_num_gl;
unsigned int sd_log_num_buf;
unsigned int sd_log_num_revoke;
unsigned int sd_log_num_rg;
unsigned int sd_log_num_databuf;
- struct list_head sd_log_le_gl;
struct list_head sd_log_le_buf;
struct list_head sd_log_le_revoke;
struct list_head sd_log_le_rg;
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 532784e..92959d0 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -362,7 +362,8 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
if (error)
goto out_rg_gunlock;
- gfs2_trans_add_gl(ip->i_gl);
+ set_bit(GLF_DIRTY, &ip->i_gl->gl_flags);
+ set_bit(GLF_LFLUSH, &ip->i_gl->gl_flags);
gfs2_free_di(rgd, ip);
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c
index 1e1fe8d..d246843 100644
--- a/fs/gfs2/log.c
+++ b/fs/gfs2/log.c
@@ -692,20 +692,16 @@ static void gfs2_ordered_wait(struct gfs2_sbd *sdp)
*
*/
-void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
+void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl)
{
struct gfs2_ail *ai;
down_write(&sdp->sd_log_flush_lock);
- if (gl) {
- gfs2_log_lock(sdp);
- if (list_empty(&gl->gl_le.le_list)) {
- gfs2_log_unlock(sdp);
- up_write(&sdp->sd_log_flush_lock);
- return;
- }
- gfs2_log_unlock(sdp);
+ /* Log might have been flushed while we waited for the flush lock */
+ if (gl && !test_bit(GLF_LFLUSH, &gl->gl_flags)) {
+ up_write(&sdp->sd_log_flush_lock);
+ return;
}
ai = kzalloc(sizeof(struct gfs2_ail), GFP_NOFS | __GFP_NOFAIL);
@@ -823,7 +819,6 @@ void gfs2_log_shutdown(struct gfs2_sbd *sdp)
down_write(&sdp->sd_log_flush_lock);
gfs2_assert_withdraw(sdp, !sdp->sd_log_blks_reserved);
- gfs2_assert_withdraw(sdp, !sdp->sd_log_num_gl);
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_buf);
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_revoke);
gfs2_assert_withdraw(sdp, !sdp->sd_log_num_rg);
diff --git a/fs/gfs2/log.h b/fs/gfs2/log.h
index 24e7161..4babd43 100644
--- a/fs/gfs2/log.h
+++ b/fs/gfs2/log.h
@@ -57,7 +57,14 @@ void gfs2_log_incr_head(struct gfs2_sbd *sdp);
struct buffer_head *gfs2_log_get_buf(struct gfs2_sbd *sdp);
struct buffer_head *gfs2_log_fake_buf(struct gfs2_sbd *sdp,
struct buffer_head *real);
-void gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
+void __gfs2_log_flush(struct gfs2_sbd *sdp, struct gfs2_glock *gl);
+
+static inline void gfs2_log_flush(struct gfs2_sbd *sbd, struct gfs2_glock *gl)
+{
+ if (!gl || test_bit(GLF_LFLUSH, &gl->gl_flags))
+ __gfs2_log_flush(sbd, gl);
+}
+
void gfs2_log_commit(struct gfs2_sbd *sdp, struct gfs2_trans *trans);
void gfs2_remove_from_ail(struct gfs2_bufdata *bd);
diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c
index e901f8f..fae59d6 100644
--- a/fs/gfs2/lops.c
+++ b/fs/gfs2/lops.c
@@ -87,6 +87,7 @@ static void gfs2_unpin(struct gfs2_sbd *sdp, struct buffer_head *bh,
}
bd->bd_ail = ai;
list_add(&bd->bd_ail_st_list, &ai->ai_ail1_list);
+ clear_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
gfs2_log_unlock(sdp);
unlock_buffer(bh);
}
@@ -124,49 +125,6 @@ static struct buffer_head *gfs2_get_log_desc(struct gfs2_sbd *sdp, u32 ld_type)
return bh;
}
-static void __glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
-{
- struct gfs2_glock *gl;
- struct gfs2_trans *tr = current->journal_info;
-
- tr->tr_touched = 1;
-
- gl = container_of(le, struct gfs2_glock, gl_le);
- if (gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl)))
- return;
-
- if (!list_empty(&le->le_list))
- return;
-
- gfs2_glock_hold(gl);
- set_bit(GLF_DIRTY, &gl->gl_flags);
- sdp->sd_log_num_gl++;
- list_add(&le->le_list, &sdp->sd_log_le_gl);
-}
-
-static void glock_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
-{
- gfs2_log_lock(sdp);
- __glock_lo_add(sdp, le);
- gfs2_log_unlock(sdp);
-}
-
-static void glock_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
-{
- struct list_head *head = &sdp->sd_log_le_gl;
- struct gfs2_glock *gl;
-
- while (!list_empty(head)) {
- gl = list_entry(head->next, struct gfs2_glock, gl_le.le_list);
- list_del_init(&gl->gl_le.le_list);
- sdp->sd_log_num_gl--;
-
- gfs2_assert_withdraw(sdp, gfs2_glock_is_held_excl(gl));
- gfs2_glock_put(gl);
- }
- gfs2_assert_warn(sdp, !sdp->sd_log_num_gl);
-}
-
static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
{
struct gfs2_bufdata *bd = container_of(le, struct gfs2_bufdata, bd_le);
@@ -182,7 +140,8 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
list_add(&bd->bd_list_tr, &tr->tr_list_buf);
if (!list_empty(&le->le_list))
goto out;
- __glock_lo_add(sdp, &bd->bd_gl->gl_le);
+ set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
+ set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
gfs2_meta_check(sdp, bd->bd_bh);
gfs2_pin(sdp, bd->bd_bh);
sdp->sd_log_num_buf++;
@@ -568,8 +527,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
if (!list_empty(&le->le_list))
goto out;
- if (tr)
- __glock_lo_add(sdp, &bd->bd_gl->gl_le);
+ set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
+ set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
if (gfs2_is_jdata(ip)) {
gfs2_pin(sdp, bd->bd_bh);
tr->tr_num_databuf_new++;
@@ -776,12 +735,6 @@ static void databuf_lo_after_commit(struct gfs2_sbd *sdp, struct gfs2_ail *ai)
}
-const struct gfs2_log_operations gfs2_glock_lops = {
- .lo_add = glock_lo_add,
- .lo_after_commit = glock_lo_after_commit,
- .lo_name = "glock",
-};
-
const struct gfs2_log_operations gfs2_buf_lops = {
.lo_add = buf_lo_add,
.lo_incore_commit = buf_lo_incore_commit,
@@ -819,7 +772,6 @@ const struct gfs2_log_operations gfs2_databuf_lops = {
};
const struct gfs2_log_operations *gfs2_log_ops[] = {
- &gfs2_glock_lops,
&gfs2_databuf_lops,
&gfs2_buf_lops,
&gfs2_rg_lops,
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index 17de58e..52aaba9 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -77,7 +77,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
spin_lock_init(&sdp->sd_log_lock);
- INIT_LIST_HEAD(&sdp->sd_log_le_gl);
INIT_LIST_HEAD(&sdp->sd_log_le_buf);
INIT_LIST_HEAD(&sdp->sd_log_le_revoke);
INIT_LIST_HEAD(&sdp->sd_log_le_rg);
diff --git a/fs/gfs2/trans.c b/fs/gfs2/trans.c
index 717983e..73e5d92 100644
--- a/fs/gfs2/trans.c
+++ b/fs/gfs2/trans.c
@@ -114,11 +114,6 @@ void gfs2_trans_end(struct gfs2_sbd *sdp)
gfs2_log_flush(sdp, NULL);
}
-void gfs2_trans_add_gl(struct gfs2_glock *gl)
-{
- lops_add(gl->gl_sbd, &gl->gl_le);
-}
-
/**
* gfs2_trans_add_bh - Add a to-be-modified buffer to the current transaction
* @gl: the glock the buffer belongs to
diff --git a/fs/gfs2/trans.h b/fs/gfs2/trans.h
index 043d5f4..e826f0d 100644
--- a/fs/gfs2/trans.h
+++ b/fs/gfs2/trans.h
@@ -30,7 +30,6 @@ int gfs2_trans_begin(struct gfs2_sbd *sdp, unsigned int blocks,
void gfs2_trans_end(struct gfs2_sbd *sdp);
-void gfs2_trans_add_gl(struct gfs2_glock *gl);
void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta);
void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd);
void gfs2_trans_add_unrevoke(struct gfs2_sbd *sdp, u64 blkno);
--
1.5.1.2
next prev parent reply other threads:[~2008-01-21 9:21 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-21 9:21 [Cluster-devel] [GFS2] Pre-pull patch posting swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 01/58] [GFS2] Handle multiple glock demote requests swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 02/58] [GFS2] Clean up internal read function swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 03/58] [GFS2] Use ->page_mkwrite() for mmap() swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 04/58] [GFS2] Remove useless i_cache from inodes swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 05/58] [GFS2] Remove unused field in struct gfs2_inode swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 06/58] [GFS2] Add gfs2_is_writeback() swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 07/58] [GFS2] Introduce gfs2_set_aops() swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 08/58] [GFS2] Split gfs2_writepage into three cases swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 09/58] [GFS2] Add writepages for GFS2 jdata swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 10/58] [GFS2] Don't hold page lock when starting transaction swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 11/58] [GFS2] Use correct include file in ops_address.c swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 12/58] [GFS2] Remove unused variables swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 13/58] [GFS2] Remove "reclaim limit" swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 14/58] [GFS2] Add sync_page to metadata address space operations swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 15/58] [GFS2] Reorder writeback for glock sync swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 16/58] [GFS2] Remove flags no longer required swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 17/58] [GFS2] Given device ID rather than s_id in "id" sysfs file swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 18/58] [GFS2] check kthread_should_stop when waiting swhiteho
2008-01-21 9:21 ` swhiteho [this message]
2008-01-21 9:21 ` [Cluster-devel] [PATCH 20/58] [GFS2] Use atomic_t for journal free blocks counter swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 21/58] [GFS2] Move gfs2_logd into log.c swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 22/58] [GFS2] Don't periodically update the jindex swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 23/58] [GFS2] Check for installation of mount helpers for DLM mounts swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 24/58] [GFS2] tidy up error message swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 25/58] [GFS2] Fix runtime issue with UP kernels swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 26/58] [GFS2] Revise gfs2_logd and flush thresholds swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 27/58] [GFS2] remove unnecessary permission checks swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 28/58] [GFS2] Fix build warnings swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 29/58] [GFS2] Remove unrequired code swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 30/58] [GFS2] Remove lock methods for lock_nolock protocol swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 31/58] [GFS2] patch to check for recursive lock requests in gfs2_rename code path swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 32/58] [GFS2] Remove unused variable swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 33/58] [GFS2] use pid for plock owner for nfs clients swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 34/58] [GFS2] Remove function gfs2_get_block swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 35/58] [GFS2] Fix typo in log.c swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 36/58] [GFS2] Journal extent mapping swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 37/58] [GFS2] Get rid of useless "found" variable in quota.c swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 38/58] [GFS2] Run through full bitmaps quicker in gfs2_bitfit swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 39/58] [GFS2] Reorganize function gfs2_glmutex_lock swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 40/58] [GFS2] Only fetch the dinode once in block_map swhiteho
2008-01-21 9:21 ` [Cluster-devel] [PATCH 41/58] [GFS2] Function meta_read optimization swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 42/58] [GFS2] Incremental patch to fix compiler warning swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 43/58] [GFS2] Eliminate the no longer needed sd_statfs_mutex swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 44/58] [GFS2] Minor correction swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 45/58] [GFS2] Fix log block mapper swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 46/58] [GFS2] Remove unused variable swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 47/58] [GFS2] Allow page migration for writeback and ordered pages swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 48/58] [GFS2] Initialize extent_list earlier swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 49/58] [GFS2] Fix problems relating to execution of files on GFS2 swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 50/58] [GFS2] Fix assert in log code swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 51/58] [GFS2] Reduce inode size by moving i_alloc out of line swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 52/58] [GFS2] Remove unneeded i_spin swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 53/58] [GFS2] gfs2_alloc_required performance swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 54/58] [GFS2] Fix write alloc required shortcut calculation swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 55/58] [GFS2] Fix typo swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 56/58] [GFS2] Fix page_mkwrite truncation race path swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 57/58] [GFS2] Lockup on error swhiteho
2008-01-21 9:22 ` [Cluster-devel] [PATCH 58/58] [GFS2] Allow journal recovery on read-only mount swhiteho
[not found] ` <be5784b198847d5cdfa103c6882383c11eb6d7d2.1200905287.git.swhiteho@redhat.com>
2008-01-21 14:56 ` [Cluster-devel] [PATCH 26/58] [GFS2] Revise gfs2_logd and flush thresholds Kevin Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1200907374616-git-send-email-swhiteho@redhat.com \
--to=swhiteho@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).