nfsd: Use write gathering only with NFSv2
[safe/jmp/linux-2.6] / fs / gfs2 / super.c
index 70f424f..601913e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) Sistina Software, Inc.  1997-2003 All rights reserved.
- * Copyright (C) 2004-2006 Red Hat, Inc.  All rights reserved.
+ * Copyright (C) 2004-2007 Red Hat, Inc.  All rights reserved.
  *
  * This copyrighted material is made available to anyone wishing to use,
  * modify, copy, or redistribute it subject to the terms and conditions
@@ -15,7 +15,6 @@
 #include <linux/crc32.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/bio.h>
-#include <linux/lm_interface.h>
 
 #include "gfs2.h"
 #include "incore.h"
 #include "trans.h"
 #include "util.h"
 
-static const u32 gfs2_old_fs_formats[] = {
-        0
-};
-
-static const u32 gfs2_old_multihost_formats[] = {
-        0
-};
-
-/**
- * gfs2_tune_init - Fill a gfs2_tune structure with default values
- * @gt: tune
- *
- */
-
-void gfs2_tune_init(struct gfs2_tune *gt)
-{
-       spin_lock_init(&gt->gt_spin);
-
-       gt->gt_ilimit = 100;
-       gt->gt_ilimit_tries = 3;
-       gt->gt_ilimit_min = 1;
-       gt->gt_demote_secs = 300;
-       gt->gt_incore_log_blocks = 1024;
-       gt->gt_log_flush_secs = 60;
-       gt->gt_jindex_refresh_secs = 60;
-       gt->gt_scand_secs = 15;
-       gt->gt_recoverd_secs = 60;
-       gt->gt_logd_secs = 1;
-       gt->gt_quotad_secs = 5;
-       gt->gt_quota_simul_sync = 64;
-       gt->gt_quota_warn_period = 10;
-       gt->gt_quota_scale_num = 1;
-       gt->gt_quota_scale_den = 1;
-       gt->gt_quota_cache_secs = 300;
-       gt->gt_quota_quantum = 60;
-       gt->gt_atime_quantum = 3600;
-       gt->gt_new_files_jdata = 0;
-       gt->gt_new_files_directio = 0;
-       gt->gt_max_readahead = 1 << 18;
-       gt->gt_lockdump_size = 131072;
-       gt->gt_stall_secs = 600;
-       gt->gt_complain_secs = 10;
-       gt->gt_reclaim_limit = 5000;
-       gt->gt_entries_per_readdir = 32;
-       gt->gt_statfs_quantum = 30;
-       gt->gt_statfs_slow = 0;
-}
-
-/**
- * gfs2_check_sb - Check superblock
- * @sdp: the filesystem
- * @sb: The superblock
- * @silent: Don't print a message if the check fails
- *
- * Checks the version code of the FS is one that we understand how to
- * read and that the sizes of the various on-disk structures have not
- * changed.
- */
-
-int gfs2_check_sb(struct gfs2_sbd *sdp, struct gfs2_sb_host *sb, int silent)
-{
-       unsigned int x;
-
-       if (sb->sb_header.mh_magic != GFS2_MAGIC ||
-           sb->sb_header.mh_type != GFS2_METATYPE_SB) {
-               if (!silent)
-                       printk(KERN_WARNING "GFS2: not a GFS2 filesystem\n");
-               return -EINVAL;
-       }
-
-       /*  If format numbers match exactly, we're done.  */
-
-       if (sb->sb_fs_format == GFS2_FORMAT_FS &&
-           sb->sb_multihost_format == GFS2_FORMAT_MULTI)
-               return 0;
-
-       if (sb->sb_fs_format != GFS2_FORMAT_FS) {
-               for (x = 0; gfs2_old_fs_formats[x]; x++)
-                       if (gfs2_old_fs_formats[x] == sb->sb_fs_format)
-                               break;
-
-               if (!gfs2_old_fs_formats[x]) {
-                       printk(KERN_WARNING
-                              "GFS2: code version (%u, %u) is incompatible "
-                              "with ondisk format (%u, %u)\n",
-                              GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
-                              sb->sb_fs_format, sb->sb_multihost_format);
-                       printk(KERN_WARNING
-                              "GFS2: I don't know how to upgrade this FS\n");
-                       return -EINVAL;
-               }
-       }
-
-       if (sb->sb_multihost_format != GFS2_FORMAT_MULTI) {
-               for (x = 0; gfs2_old_multihost_formats[x]; x++)
-                       if (gfs2_old_multihost_formats[x] ==
-                           sb->sb_multihost_format)
-                               break;
-
-               if (!gfs2_old_multihost_formats[x]) {
-                       printk(KERN_WARNING
-                              "GFS2: code version (%u, %u) is incompatible "
-                              "with ondisk format (%u, %u)\n",
-                              GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
-                              sb->sb_fs_format, sb->sb_multihost_format);
-                       printk(KERN_WARNING
-                              "GFS2: I don't know how to upgrade this FS\n");
-                       return -EINVAL;
-               }
-       }
-
-       if (!sdp->sd_args.ar_upgrade) {
-               printk(KERN_WARNING
-                      "GFS2: code version (%u, %u) is incompatible "
-                      "with ondisk format (%u, %u)\n",
-                      GFS2_FORMAT_FS, GFS2_FORMAT_MULTI,
-                      sb->sb_fs_format, sb->sb_multihost_format);
-               printk(KERN_INFO
-                      "GFS2: Use the \"upgrade\" mount option to upgrade "
-                      "the FS\n");
-               printk(KERN_INFO "GFS2: See the manual for more details\n");
-               return -EINVAL;
-       }
-
-       return 0;
-}
-
-
-static int end_bio_io_page(struct bio *bio, unsigned int bytes_done, int error)
-{
-       struct page *page = bio->bi_private;
-       if (bio->bi_size)
-               return 1;
-
-       if (!error)
-               SetPageUptodate(page);
-       else
-               printk(KERN_WARNING "gfs2: error %d reading superblock\n", error);
-       unlock_page(page);
-       return 0;
-}
-
-/**
- * gfs2_read_super - Read the gfs2 super block from disk
- * @sb: The VFS super block
- * @sector: The location of the super block
- *
- * This uses the bio functions to read the super block from disk
- * because we want to be 100% sure that we never read cached data.
- * A super block is read twice only during each GFS2 mount and is
- * never written to by the filesystem. The first time its read no
- * locks are held, and the only details which are looked at are those
- * relating to the locking protocol. Once locking is up and working,
- * the sb is read again under the lock to establish the location of
- * the master directory (contains pointers to journals etc) and the
- * root directory.
- *
- * Returns: A page containing the sb or NULL
- */
-
-struct page *gfs2_read_super(struct super_block *sb, sector_t sector)
-{
-       struct page *page;
-       struct bio *bio;
-
-       page = alloc_page(GFP_KERNEL);
-       if (unlikely(!page))
-               return NULL;
-
-       ClearPageUptodate(page);
-       ClearPageDirty(page);
-       lock_page(page);
-
-       bio = bio_alloc(GFP_KERNEL, 1);
-       if (unlikely(!bio)) {
-               __free_page(page);
-               return NULL;
-       }
-
-       bio->bi_sector = sector * (sb->s_blocksize >> 9);
-       bio->bi_bdev = sb->s_bdev;
-       bio_add_page(bio, page, PAGE_SIZE, 0);
-
-       bio->bi_end_io = end_bio_io_page;
-       bio->bi_private = page;
-       submit_bio(READ_SYNC | (1 << BIO_RW_META), bio);
-       wait_on_page_locked(page);
-       bio_put(bio);
-       if (!PageUptodate(page)) {
-               __free_page(page);
-               return NULL;
-       }
-       return page;
-}
-
-/**
- * gfs2_read_sb - Read super block
- * @sdp: The GFS2 superblock
- * @gl: the glock for the superblock (assumed to be held)
- * @silent: Don't print message if mount fails
- *
- */
-
-int gfs2_read_sb(struct gfs2_sbd *sdp, struct gfs2_glock *gl, int silent)
-{
-       u32 hash_blocks, ind_blocks, leaf_blocks;
-       u32 tmp_blocks;
-       unsigned int x;
-       int error;
-       struct page *page;
-       char *sb;
-
-       page = gfs2_read_super(sdp->sd_vfs, GFS2_SB_ADDR >> sdp->sd_fsb2bb_shift);
-       if (!page) {
-               if (!silent)
-                       fs_err(sdp, "can't read superblock\n");
-               return -EIO;
-       }
-       sb = kmap(page);
-       gfs2_sb_in(&sdp->sd_sb, sb);
-       kunmap(page);
-       __free_page(page);
-
-       error = gfs2_check_sb(sdp, &sdp->sd_sb, silent);
-       if (error)
-               return error;
-
-       sdp->sd_fsb2bb_shift = sdp->sd_sb.sb_bsize_shift -
-                              GFS2_BASIC_BLOCK_SHIFT;
-       sdp->sd_fsb2bb = 1 << sdp->sd_fsb2bb_shift;
-       sdp->sd_diptrs = (sdp->sd_sb.sb_bsize -
-                         sizeof(struct gfs2_dinode)) / sizeof(u64);
-       sdp->sd_inptrs = (sdp->sd_sb.sb_bsize -
-                         sizeof(struct gfs2_meta_header)) / sizeof(u64);
-       sdp->sd_jbsize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_meta_header);
-       sdp->sd_hash_bsize = sdp->sd_sb.sb_bsize / 2;
-       sdp->sd_hash_bsize_shift = sdp->sd_sb.sb_bsize_shift - 1;
-       sdp->sd_hash_ptrs = sdp->sd_hash_bsize / sizeof(u64);
-       sdp->sd_qc_per_block = (sdp->sd_sb.sb_bsize -
-                               sizeof(struct gfs2_meta_header)) /
-                               sizeof(struct gfs2_quota_change);
-
-       /* Compute maximum reservation required to add a entry to a directory */
-
-       hash_blocks = DIV_ROUND_UP(sizeof(u64) * (1 << GFS2_DIR_MAX_DEPTH),
-                            sdp->sd_jbsize);
-
-       ind_blocks = 0;
-       for (tmp_blocks = hash_blocks; tmp_blocks > sdp->sd_diptrs;) {
-               tmp_blocks = DIV_ROUND_UP(tmp_blocks, sdp->sd_inptrs);
-               ind_blocks += tmp_blocks;
-       }
-
-       leaf_blocks = 2 + GFS2_DIR_MAX_DEPTH;
-
-       sdp->sd_max_dirres = hash_blocks + ind_blocks + leaf_blocks;
-
-       sdp->sd_heightsize[0] = sdp->sd_sb.sb_bsize -
-                               sizeof(struct gfs2_dinode);
-       sdp->sd_heightsize[1] = sdp->sd_sb.sb_bsize * sdp->sd_diptrs;
-       for (x = 2;; x++) {
-               u64 space, d;
-               u32 m;
-
-               space = sdp->sd_heightsize[x - 1] * sdp->sd_inptrs;
-               d = space;
-               m = do_div(d, sdp->sd_inptrs);
-
-               if (d != sdp->sd_heightsize[x - 1] || m)
-                       break;
-               sdp->sd_heightsize[x] = space;
-       }
-       sdp->sd_max_height = x;
-       gfs2_assert(sdp, sdp->sd_max_height <= GFS2_MAX_META_HEIGHT);
-
-       sdp->sd_jheightsize[0] = sdp->sd_sb.sb_bsize -
-                                sizeof(struct gfs2_dinode);
-       sdp->sd_jheightsize[1] = sdp->sd_jbsize * sdp->sd_diptrs;
-       for (x = 2;; x++) {
-               u64 space, d;
-               u32 m;
-
-               space = sdp->sd_jheightsize[x - 1] * sdp->sd_inptrs;
-               d = space;
-               m = do_div(d, sdp->sd_inptrs);
-
-               if (d != sdp->sd_jheightsize[x - 1] || m)
-                       break;
-               sdp->sd_jheightsize[x] = space;
-       }
-       sdp->sd_max_jheight = x;
-       gfs2_assert(sdp, sdp->sd_max_jheight <= GFS2_MAX_META_HEIGHT);
-
-       return 0;
-}
-
-/**
- * gfs2_jindex_hold - Grab a lock on the jindex
- * @sdp: The GFS2 superblock
- * @ji_gh: the holder for the jindex glock
- *
- * This is very similar to the gfs2_rindex_hold() function, except that
- * in general we hold the jindex lock for longer periods of time and
- * we grab it far less frequently (in general) then the rgrp lock.
- *
- * Returns: errno
- */
-
-int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
-{
-       struct gfs2_inode *dip = GFS2_I(sdp->sd_jindex);
-       struct qstr name;
-       char buf[20];
-       struct gfs2_jdesc *jd;
-       int error;
-
-       name.name = buf;
-
-       mutex_lock(&sdp->sd_jindex_mutex);
-
-       for (;;) {
-               error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
-               if (error)
-                       break;
-
-               name.len = sprintf(buf, "journal%u", sdp->sd_journals);
-               name.hash = gfs2_disk_hash(name.name, name.len);
-
-               error = gfs2_dir_search(sdp->sd_jindex, &name, NULL, NULL);
-               if (error == -ENOENT) {
-                       error = 0;
-                       break;
-               }
-
-               gfs2_glock_dq_uninit(ji_gh);
-
-               if (error)
-                       break;
-
-               error = -ENOMEM;
-               jd = kzalloc(sizeof(struct gfs2_jdesc), GFP_KERNEL);
-               if (!jd)
-                       break;
-
-               jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1, NULL);
-               if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
-                       if (!jd->jd_inode)
-                               error = -ENOENT;
-                       else
-                               error = PTR_ERR(jd->jd_inode);
-                       kfree(jd);
-                       break;
-               }
-
-               spin_lock(&sdp->sd_jindex_spin);
-               jd->jd_jid = sdp->sd_journals++;
-               list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
-               spin_unlock(&sdp->sd_jindex_spin);
-       }
-
-       mutex_unlock(&sdp->sd_jindex_mutex);
-
-       return error;
-}
-
 /**
  * gfs2_jindex_free - Clear all the journal index information
  * @sdp: The GFS2 superblock
@@ -406,8 +40,9 @@ int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
 
 void gfs2_jindex_free(struct gfs2_sbd *sdp)
 {
-       struct list_head list;
+       struct list_head list, *head;
        struct gfs2_jdesc *jd;
+       struct gfs2_journal_extent *jext;
 
        spin_lock(&sdp->sd_jindex_spin);
        list_add(&list, &sdp->sd_jindex_list);
@@ -417,6 +52,14 @@ void gfs2_jindex_free(struct gfs2_sbd *sdp)
 
        while (!list_empty(&list)) {
                jd = list_entry(list.next, struct gfs2_jdesc, jd_list);
+               head = &jd->extent_list;
+               while (!list_empty(head)) {
+                       jext = list_entry(head->next,
+                                         struct gfs2_journal_extent,
+                                         extent_list);
+                       list_del(&jext->extent_list);
+                       kfree(jext);
+               }
                list_del(&jd->jd_list);
                iput(jd->jd_inode);
                kfree(jd);
@@ -452,39 +95,6 @@ struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid)
        return jd;
 }
 
-void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid)
-{
-       struct gfs2_jdesc *jd;
-
-       spin_lock(&sdp->sd_jindex_spin);
-       jd = jdesc_find_i(&sdp->sd_jindex_list, jid);
-       if (jd)
-               jd->jd_dirty = 1;
-       spin_unlock(&sdp->sd_jindex_spin);
-}
-
-struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
-{
-       struct gfs2_jdesc *jd;
-       int found = 0;
-
-       spin_lock(&sdp->sd_jindex_spin);
-
-       list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
-               if (jd->jd_dirty) {
-                       jd->jd_dirty = 0;
-                       found = 1;
-                       break;
-               }
-       }
-       spin_unlock(&sdp->sd_jindex_spin);
-
-       if (!found)
-               jd = NULL;
-
-       return jd;
-}
-
 int gfs2_jdesc_check(struct gfs2_jdesc *jd)
 {
        struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
@@ -492,14 +102,14 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
        int ar;
        int error;
 
-       if (ip->i_di.di_size < (8 << 20) || ip->i_di.di_size > (1 << 30) ||
-           (ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1))) {
+       if (ip->i_disksize < (8 << 20) || ip->i_disksize > (1 << 30) ||
+           (ip->i_disksize & (sdp->sd_sb.sb_bsize - 1))) {
                gfs2_consist_inode(ip);
                return -EIO;
        }
-       jd->jd_blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift;
+       jd->jd_blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift;
 
-       error = gfs2_write_alloc_required(ip, 0, ip->i_di.di_size, &ar);
+       error = gfs2_write_alloc_required(ip, 0, ip->i_disksize, &ar);
        if (!error && ar) {
                gfs2_consist_inode(ip);
                error = -EIO;
@@ -527,7 +137,6 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
        if (error)
                return error;
 
-       gfs2_meta_cache_flush(ip);
        j_gl->gl_ops->go_inval(j_gl, DIO_METADATA);
 
        error = gfs2_find_jhead(sdp->sd_jdesc, &head);
@@ -561,37 +170,22 @@ fail:
        return error;
 }
 
-/**
- * gfs2_make_fs_ro - Turn a Read-Write FS into a Read-Only one
- * @sdp: the filesystem
- *
- * Returns: errno
- */
-
-int gfs2_make_fs_ro(struct gfs2_sbd *sdp)
+static void gfs2_statfs_change_in(struct gfs2_statfs_change_host *sc, const void *buf)
 {
-       struct gfs2_holder t_gh;
-       int error;
-
-       gfs2_quota_sync(sdp);
-       gfs2_statfs_sync(sdp);
+       const struct gfs2_statfs_change *str = buf;
 
-       error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_SHARED, GL_NOCACHE,
-                                  &t_gh);
-       if (error && !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
-               return error;
-
-       gfs2_meta_syncfs(sdp);
-       gfs2_log_shutdown(sdp);
-
-       clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
-
-       if (t_gh.gh_gl)
-               gfs2_glock_dq_uninit(&t_gh);
+       sc->sc_total = be64_to_cpu(str->sc_total);
+       sc->sc_free = be64_to_cpu(str->sc_free);
+       sc->sc_dinodes = be64_to_cpu(str->sc_dinodes);
+}
 
-       gfs2_quota_cleanup(sdp);
+static void gfs2_statfs_change_out(const struct gfs2_statfs_change_host *sc, void *buf)
+{
+       struct gfs2_statfs_change *str = buf;
 
-       return error;
+       str->sc_total = cpu_to_be64(sc->sc_total);
+       str->sc_free = cpu_to_be64(sc->sc_free);
+       str->sc_dinodes = cpu_to_be64(sc->sc_dinodes);
 }
 
 int gfs2_statfs_init(struct gfs2_sbd *sdp)
@@ -652,9 +246,7 @@ void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free,
        if (error)
                return;
 
-       mutex_lock(&sdp->sd_statfs_mutex);
        gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
-       mutex_unlock(&sdp->sd_statfs_mutex);
 
        spin_lock(&sdp->sd_statfs_spin);
        l_sc->sc_total += total;
@@ -702,9 +294,7 @@ int gfs2_statfs_sync(struct gfs2_sbd *sdp)
        if (error)
                goto out_bh2;
 
-       mutex_lock(&sdp->sd_statfs_mutex);
        gfs2_trans_add_bh(l_ip->i_gl, l_bh, 1);
-       mutex_unlock(&sdp->sd_statfs_mutex);
 
        spin_lock(&sdp->sd_statfs_spin);
        m_sc->sc_total += l_sc->sc_total;
@@ -729,137 +319,6 @@ out:
        return error;
 }
 
-/**
- * gfs2_statfs_i - Do a statfs
- * @sdp: the filesystem
- * @sg: the sg structure
- *
- * Returns: errno
- */
-
-int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
-{
-       struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
-       struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
-
-       spin_lock(&sdp->sd_statfs_spin);
-
-       *sc = *m_sc;
-       sc->sc_total += l_sc->sc_total;
-       sc->sc_free += l_sc->sc_free;
-       sc->sc_dinodes += l_sc->sc_dinodes;
-
-       spin_unlock(&sdp->sd_statfs_spin);
-
-       if (sc->sc_free < 0)
-               sc->sc_free = 0;
-       if (sc->sc_free > sc->sc_total)
-               sc->sc_free = sc->sc_total;
-       if (sc->sc_dinodes < 0)
-               sc->sc_dinodes = 0;
-
-       return 0;
-}
-
-/**
- * statfs_fill - fill in the sg for a given RG
- * @rgd: the RG
- * @sc: the sc structure
- *
- * Returns: 0 on success, -ESTALE if the LVB is invalid
- */
-
-static int statfs_slow_fill(struct gfs2_rgrpd *rgd,
-                           struct gfs2_statfs_change_host *sc)
-{
-       gfs2_rgrp_verify(rgd);
-       sc->sc_total += rgd->rd_ri.ri_data;
-       sc->sc_free += rgd->rd_rg.rg_free;
-       sc->sc_dinodes += rgd->rd_rg.rg_dinodes;
-       return 0;
-}
-
-/**
- * gfs2_statfs_slow - Stat a filesystem using asynchronous locking
- * @sdp: the filesystem
- * @sc: the sc info that will be returned
- *
- * Any error (other than a signal) will cause this routine to fall back
- * to the synchronous version.
- *
- * FIXME: This really shouldn't busy wait like this.
- *
- * Returns: errno
- */
-
-int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
-{
-       struct gfs2_holder ri_gh;
-       struct gfs2_rgrpd *rgd_next;
-       struct gfs2_holder *gha, *gh;
-       unsigned int slots = 64;
-       unsigned int x;
-       int done;
-       int error = 0, err;
-
-       memset(sc, 0, sizeof(struct gfs2_statfs_change_host));
-       gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL);
-       if (!gha)
-               return -ENOMEM;
-
-       error = gfs2_rindex_hold(sdp, &ri_gh);
-       if (error)
-               goto out;
-
-       rgd_next = gfs2_rgrpd_get_first(sdp);
-
-       for (;;) {
-               done = 1;
-
-               for (x = 0; x < slots; x++) {
-                       gh = gha + x;
-
-                       if (gh->gh_gl && gfs2_glock_poll(gh)) {
-                               err = gfs2_glock_wait(gh);
-                               if (err) {
-                                       gfs2_holder_uninit(gh);
-                                       error = err;
-                               } else {
-                                       if (!error)
-                                               error = statfs_slow_fill(
-                                                       gh->gh_gl->gl_object, sc);
-                                       gfs2_glock_dq_uninit(gh);
-                               }
-                       }
-
-                       if (gh->gh_gl)
-                               done = 0;
-                       else if (rgd_next && !error) {
-                               error = gfs2_glock_nq_init(rgd_next->rd_gl,
-                                                          LM_ST_SHARED,
-                                                          GL_ASYNC,
-                                                          gh);
-                               rgd_next = gfs2_rgrpd_get_next(rgd_next);
-                               done = 0;
-                       }
-
-                       if (signal_pending(current))
-                               error = -ERESTARTSYS;
-               }
-
-               if (done)
-                       break;
-
-               yield();
-       }
-
-       gfs2_glock_dq_uninit(&ri_gh);
-
-out:
-       kfree(gha);
-       return error;
-}
-
 struct lfcc {
        struct list_head list;
        struct gfs2_holder gh;
@@ -879,17 +338,12 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp,
                                    struct gfs2_holder *t_gh)
 {
        struct gfs2_inode *ip;
-       struct gfs2_holder ji_gh;
        struct gfs2_jdesc *jd;
        struct lfcc *lfcc;
        LIST_HEAD(list);
        struct gfs2_log_header_host lh;
        int error;
 
-       error = gfs2_jindex_hold(sdp, &ji_gh);
-       if (error)
-               return error;
-
        list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
                lfcc = kmalloc(sizeof(struct lfcc), GFP_KERNEL);
                if (!lfcc) {
@@ -906,8 +360,7 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp,
        }
 
        error = gfs2_glock_nq_init(sdp->sd_trans_gl, LM_ST_DEFERRED,
-                              LM_FLAG_PRIORITY | GL_NOCACHE,
-                              t_gh);
+                                  GL_NOCACHE, t_gh);
 
        list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
                error = gfs2_jdesc_check(jd);
@@ -932,7 +385,6 @@ out:
                gfs2_glock_dq_uninit(&lfcc->gh);
                kfree(lfcc);
        }
-       gfs2_glock_dq_uninit(&ji_gh);
        return error;
 }