xfs
[Top] [All Lists]

Re: Zero filled files

To: Murthy Kambhampaty <murthy.kambhampaty@xxxxxxxxx>
Subject: Re: Zero filled files
From: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Date: Mon, 12 May 2003 22:47:31 +0100
Cc: "'Steve Lord'" <lord@xxxxxxx>, linux-xfs@xxxxxxxxxxx
In-reply-to: <2D92FEBFD3BE1346A6C397223A8DD3FC09224F@THOR.goeci.com>; from murthy.kambhampaty@goeci.com on Mon, May 12, 2003 at 05:11:29PM -0400
References: <2D92FEBFD3BE1346A6C397223A8DD3FC09224F@THOR.goeci.com>
Sender: linux-xfs-bounce@xxxxxxxxxxx
User-agent: Mutt/1.2.5.1i
Could you please try the ttached patch?  (against TOT but should also work with
older codebases)


--- 1.13/fs/xfs/xfs_log.c       Fri May  2 22:01:27 2003
+++ edited/fs/xfs/xfs_log.c     Mon May 12 01:43:06 2003
@@ -852,7 +852,7 @@
        int             needed = 0, gen;
        xlog_t          *log = mp->m_log;
 
-       if (mp->m_frozen || XFS_FORCED_SHUTDOWN(mp))
+       if (atomic_read(&mp->m_frozen) || XFS_FORCED_SHUTDOWN(mp))
                return 0;
 
        s = LOG_LOCK(log);
--- 1.27/fs/xfs/xfs_mount.c     Fri May  2 22:01:28 2003
+++ edited/fs/xfs/xfs_mount.c   Mon May 12 01:45:21 2003
@@ -140,8 +140,7 @@
        xfs_trans_ail_init(mp);
 
        /* Init freeze sync structures */
-       spinlock_init(&mp->m_freeze_lock, "xfs_freeze");
-       init_sv(&mp->m_wait_unfreeze, SV_DEFAULT, "xfs_freeze", 0);
+       init_waitqueue_head(&mp->m_wait_unfreeze);
        atomic_set(&mp->m_active_trans, 0);
 
        return mp;
@@ -192,7 +191,6 @@
        }
 
        spinlock_destroy(&mp->m_freeze_lock);
-       sv_destroy(&mp->m_wait_unfreeze);
        kmem_free(mp, sizeof(xfs_mount_t));
 }
 
@@ -1586,10 +1584,7 @@
        xfs_mount_t     *mp,
        int             level)
 {
-       unsigned long   s = mutex_spinlock(&mp->m_freeze_lock);
-
-       mp->m_frozen = level;
-       mutex_spinunlock(&mp->m_freeze_lock, s);
+       atomic_set(&mp->m_frozen, level);
 
        if (level == XFS_FREEZE_TRANS) {
                while (atomic_read(&mp->m_active_trans) > 0)
@@ -1601,14 +1596,8 @@
 xfs_finish_freeze(
        xfs_mount_t     *mp)
 {
-       unsigned long   s = mutex_spinlock(&mp->m_freeze_lock);
-
-       if (mp->m_frozen) {
-               mp->m_frozen = 0;
-               sv_broadcast(&mp->m_wait_unfreeze);
-       }
-
-       mutex_spinunlock(&mp->m_freeze_lock, s);
+       atomic_set(&mp->m_frozen, 0);
+       wake_up(&mp->m_wait_unfreeze);
 }
 
 void
@@ -1617,18 +1606,8 @@
        bhv_desc_t      *bdp,
        int             level)
 {
-       unsigned long   s;
-
-       if (mp->m_frozen) {
-               s = mutex_spinlock(&mp->m_freeze_lock);
-
-               if (mp->m_frozen < level) {
-                       mutex_spinunlock(&mp->m_freeze_lock, s);
-               } else {
-                       sv_wait(&mp->m_wait_unfreeze, 0, &mp->m_freeze_lock, s);
-               }
-       }
-
+       wait_event(mp->m_wait_unfreeze,
+                       (atomic_read(&mp->m_frozen) < level));
        if (level == XFS_FREEZE_TRANS)
                atomic_inc(&mp->m_active_trans);
 }
--- 1.13/fs/xfs/xfs_mount.h     Fri May  2 21:36:12 2003
+++ edited/fs/xfs/xfs_mount.h   Mon May 12 01:32:45 2003
@@ -378,10 +378,9 @@
        struct xfs_dmops        m_dm_ops;       /* vector of DMI ops */
        struct xfs_qmops        m_qm_ops;       /* vector of XQM ops */
        struct xfs_ioops        m_io_ops;       /* vector of I/O ops */
-       lock_t                  m_freeze_lock;  /* Lock for m_frozen */
-       uint                    m_frozen;       /* FS frozen for shutdown or
+       atomic_t                m_frozen;       /* FS frozen for shutdown or
                                                 * snapshot */
-       sv_t                    m_wait_unfreeze;/* waiting to unfreeze */
+       wait_queue_head_t       m_wait_unfreeze;/* waiting to unfreeze */
        atomic_t                m_active_trans; /* number trans frozen */
 } xfs_mount_t;
 


<Prev in Thread] Current Thread [Next in Thread>