]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Make this work with Linux 2.2 kernels again. In particular,
authorGarry Zacheiss <zacheiss@mit.edu>
Wed, 20 Nov 2002 03:18:47 +0000 (03:18 +0000)
committerGarry Zacheiss <zacheiss@mit.edu>
Wed, 20 Nov 2002 03:18:47 +0000 (03:18 +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.

(cherry picked from commit f8d781408717fbf65837fc69d4b4edda2349df4f)

src/afs/afs_vcache.c

index 5fa9e89789574950438644a9a0cf934a4876ca28..4dce21619c56e2b81147ca7c6596719408cd52d0 100644 (file)
@@ -482,7 +482,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++;
@@ -512,15 +512,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();
@@ -563,9 +574,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;