From: Garry Zacheiss Date: Wed, 20 Nov 2002 03:13:23 +0000 (+0000) Subject: Make this work with Linux 2.2 kernels again. In particular, X-Git-Tag: openafs-devel-1_3_50~499 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=f8d781408717fbf65837fc69d4b4edda2349df4f;p=packages%2Fo%2Fopenafs.git 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. --- diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index f66ace77d..efb311c4d 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -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;