aboutsummaryrefslogtreecommitdiffstats
path: root/fs/gfs2/ops_address.c
diff options
context:
space:
mode:
authorSteven Whitehouse <swhiteho@redhat.com>2008-05-21 12:03:22 -0400
committerSteven Whitehouse <swhiteho@redhat.com>2008-06-27 04:39:22 -0400
commit6802e3400ff4549525930ee744030c36fce9cc73 (patch)
treedb889bf5337c1d3bb12ebbf571c3c1cad1040496 /fs/gfs2/ops_address.c
parent543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff)
[GFS2] Clean up the glock core
This patch implements a number of cleanups to the core of the GFS2 glock code. As a result a lot of code is removed. It looks like a really big change, but actually a large part of this patch is either removing or moving existing code. There are some new bits too though, such as the new run_queue() function which is considerably streamlined. Highlights of this patch include: o Fixes a cluster coherency bug during SH -> EX lock conversions o Removes the "glmutex" code in favour of a single bit lock o Removes the ->go_xmote_bh() for inodes since it was duplicating ->go_lock() o We now only use the ->lm_lock() function for both locks and unlocks (i.e. unlock is a lock with target mode LM_ST_UNLOCKED) o The fast path is considerably shortly, giving performance gains especially with lock_nolock o The glock_workqueue is now used for all the callbacks from the DLM which allows us to simplify the lock_dlm module (see following patch) o The way is now open to make further changes such as eliminating the two threads (gfs2_glockd and gfs2_scand) in favour of a more efficient scheme. This patch has undergone extensive testing with various test suites so it should be pretty stable by now. Signed-off-by: Steven Whitehouse <swhiteho@redhat.com> Cc: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/ops_address.c')
-rw-r--r--fs/gfs2/ops_address.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index f55394e57cb2..2b556dd034bb 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -507,26 +507,23 @@ static int __gfs2_readpage(void *file, struct page *page)
507static int gfs2_readpage(struct file *file, struct page *page) 507static int gfs2_readpage(struct file *file, struct page *page)
508{ 508{
509 struct gfs2_inode *ip = GFS2_I(page->mapping->host); 509 struct gfs2_inode *ip = GFS2_I(page->mapping->host);
510 struct gfs2_holder *gh; 510 struct gfs2_holder gh;
511 int error; 511 int error;
512 512
513 gh = gfs2_glock_is_locked_by_me(ip->i_gl); 513 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME|LM_FLAG_TRY_1CB, &gh);
514 if (!gh) { 514 error = gfs2_glock_nq_atime(&gh);
515 gh = kmalloc(sizeof(struct gfs2_holder), GFP_NOFS); 515 if (unlikely(error)) {
516 if (!gh)
517 return -ENOBUFS;
518 gfs2_holder_init(ip->i_gl, LM_ST_SHARED, GL_ATIME, gh);
519 unlock_page(page); 516 unlock_page(page);
520 error = gfs2_glock_nq_atime(gh); 517 goto out;
521 if (likely(error != 0))
522 goto out;
523 return AOP_TRUNCATED_PAGE;
524 } 518 }
525 error = __gfs2_readpage(file, page); 519 error = __gfs2_readpage(file, page);
526 gfs2_glock_dq(gh); 520 gfs2_glock_dq(&gh);
527out: 521out:
528 gfs2_holder_uninit(gh); 522 gfs2_holder_uninit(&gh);
529 kfree(gh); 523 if (error == GLR_TRYFAILED) {
524 yield();
525 return AOP_TRUNCATED_PAGE;
526 }
530 return error; 527 return error;
531} 528}
532 529