From 7af9691f58013e0afdcb8e798e292349bcf73fb3 Mon Sep 17 00:00:00 2001 From: Garry Zacheiss Date: Wed, 20 Nov 2002 03:18:47 +0000 Subject: [PATCH] Make this work with Linux 2.2 kernels again. In particular, - 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 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index 5fa9e8978..4dce21619 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -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; -- 2.39.5