[GFS2] Function meta_read optimization
authorBob Peterson <rpeterso@redhat.com>
Wed, 12 Dec 2007 01:29:17 +0000 (19:29 -0600)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 25 Jan 2008 08:14:33 +0000 (08:14 +0000)
This patch optimizes function gfs2_meta_read.  Basically, gfs2_meta_wait
was being called regardless of whether a disk read was requested.
This just pulls that wait into the if that triggers the read.

Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/gfs2/meta_io.c

index 4b1aced9023d8fead3e9c48f66b4884a61edc113..3144d35a6261273b5e1e866146a0d818affa928e 100644 (file)
@@ -222,13 +222,14 @@ int gfs2_meta_read(struct gfs2_glock *gl, u64 blkno, int flags,
                   struct buffer_head **bhp)
 {
        *bhp = getbuf(gl, blkno, CREATE);
-       if (!buffer_uptodate(*bhp))
+       if (!buffer_uptodate(*bhp)) {
                ll_rw_block(READ_META, 1, bhp);
-       if (flags & DIO_WAIT) {
-               int error = gfs2_meta_wait(gl->gl_sbd, *bhp);
-               if (error) {
-                       brelse(*bhp);
-                       return error;
+               if (flags & DIO_WAIT) {
+                       int error = gfs2_meta_wait(gl->gl_sbd, *bhp);
+                       if (error) {
+                               brelse(*bhp);
+                               return error;
+                       }
                }
        }