Make this work with Linux 2.2 kernels again. In particular,
authorGarry Zacheiss <zacheiss@mit.edu>
Wed, 20 Nov 2002 03:13:23 +0000 (03:13 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Wed, 20 Nov 2002 03:13:23 +0000 (03:13 +0000)
- Use the DCOUNT() macro from afs.h instead of atomic_read, because
  the d_count member of a struct dentry is an int in the 2.2 series,
  not an atomic_t.

- Use list_del() + INIT_LIST_HEAD() on 2.2, which doesn't have list_del_init().

- BUG() only exists on 2.4 kernels.  Just don't use it on 2.2.

src/afs/afs_vcache.c

index f66ace7..efb311c 100644 (file)
@@ -512,7 +512,7 @@ resume:
                struct list_head *tmp = next;
                struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
                next = tmp->next;
-               if (!atomic_read(&dentry->d_count)) {
+               if (!DCOUNT(dentry)) {
                        list_del(&dentry->d_lru);
                        list_add(&dentry->d_lru, afs_dentry_unused.prev);
                        found++;
@@ -542,15 +542,26 @@ resume:
 
                if (tmp == &afs_dentry_unused)
                        break;
+#ifdef AFS_LINUX24_ENV
                list_del_init(tmp);
+#else
+               list_del(tmp);
+               INIT_LIST_HEAD(tmp);
+#endif /* AFS_LINUX24_ENV */
                dentry = list_entry(tmp, struct dentry, d_lru);
 
+#ifdef AFS_LINUX24_ENV
                /* Unused dentry with a count? */
-               if (atomic_read(&dentry->d_count))
+               if (DCOUNT(dentry))
                        BUG();
-
+#endif
                DGET(dentry);
+#ifdef AFS_LINUX24_ENV
                list_del_init(&dentry->d_hash);         /* d_drop */
+#else
+               list_del(&dentry->d_hash);
+               INIT_LIST_HEAD(&dentry->d_hash);
+#endif /* AFS_LINUX24_ENV */
                DUNLOCK();
                dput(dentry);
                DLOCK();
@@ -593,9 +604,14 @@ restart:
         if (!list_empty(&dentry->d_hash) && !list_empty(&dentry->d_subdirs))
            __shrink_dcache_parent(dentry);
 
-        if (!atomic_read(&dentry->d_count)) {
+        if (!DCOUNT(dentry)) {
            DGET(dentry);
+#ifdef AFS_LINUX24_ENV 
            list_del_init(&dentry->d_hash);     /* d_drop */
+#else
+           list_del(&dentry->d_hash);
+           INIT_LIST_HEAD(&dentry->d_hash);
+#endif /* AFS_LINUX24_ENV */
            DUNLOCK();
            dput(dentry);
            goto restart;