Skip to content

Commit 119dcc7

Browse files
author
Al Viro
committed
Merge branches 'work.dcache-misc' and 'work.dcache2' into work.dcache
2 parents ef69f05 + 6367b49 commit 119dcc7

File tree

13 files changed

+296
-431
lines changed

13 files changed

+296
-431
lines changed

Documentation/filesystems/porting.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1061,3 +1061,37 @@ export_operations ->encode_fh() no longer has a default implementation to
10611061
encode FILEID_INO32_GEN* file handles.
10621062
Filesystems that used the default implementation may use the generic helper
10631063
generic_encode_ino32_fh() explicitly.
1064+
1065+
---
1066+
1067+
**mandatory**
1068+
1069+
The list of children anchored in parent dentry got turned into hlist now.
1070+
Field names got changed (->d_children/->d_sib instead of ->d_subdirs/->d_child
1071+
for anchor/entries resp.), so any affected places will be immediately caught
1072+
by compiler.
1073+
1074+
---
1075+
1076+
**mandatory**
1077+
1078+
->d_delete() instances are now called for dentries with ->d_lock held
1079+
and refcount equal to 0. They are not permitted to drop/regain ->d_lock.
1080+
None of in-tree instances did anything of that sort. Make sure yours do not...
1081+
1082+
--
1083+
1084+
**mandatory**
1085+
1086+
->d_prune() instances are now called without ->d_lock held on the parent.
1087+
->d_lock on dentry itself is still held; if you need per-parent exclusions (none
1088+
of the in-tree instances did), use your own spinlock.
1089+
1090+
->d_iput() and ->d_release() are called with victim dentry still in the
1091+
list of parent's children. It is still unhashed, marked killed, etc., just not
1092+
removed from parent's ->d_children yet.
1093+
1094+
Anyone iterating through the list of children needs to be aware of the
1095+
half-killed dentries that might be seen there; taking ->d_lock on those will
1096+
see them negative, unhashed and with negative refcount, which means that most
1097+
of the in-kernel users would've done the right thing anyway without any adjustment.

arch/powerpc/platforms/cell/spufs/inode.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ spufs_evict_inode(struct inode *inode)
145145

146146
static void spufs_prune_dir(struct dentry *dir)
147147
{
148-
struct dentry *dentry, *tmp;
148+
struct dentry *dentry;
149+
struct hlist_node *n;
149150

150151
inode_lock(d_inode(dir));
151-
list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_child) {
152+
hlist_for_each_entry_safe(dentry, n, &dir->d_children, d_sib) {
152153
spin_lock(&dentry->d_lock);
153154
if (simple_positive(dentry)) {
154155
dget_dlock(dentry);

fs/afs/dynroot.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ int afs_dynroot_populate(struct super_block *sb)
370370
void afs_dynroot_depopulate(struct super_block *sb)
371371
{
372372
struct afs_net *net = afs_sb2net(sb);
373-
struct dentry *root = sb->s_root, *subdir, *tmp;
373+
struct dentry *root = sb->s_root, *subdir;
374374

375375
/* Prevent more subdirs from being created */
376376
mutex_lock(&net->proc_cells_lock);
@@ -379,10 +379,11 @@ void afs_dynroot_depopulate(struct super_block *sb)
379379
mutex_unlock(&net->proc_cells_lock);
380380

381381
if (root) {
382+
struct hlist_node *n;
382383
inode_lock(root->d_inode);
383384

384385
/* Remove all the pins for dirs created for manually added cells */
385-
list_for_each_entry_safe(subdir, tmp, &root->d_subdirs, d_child) {
386+
hlist_for_each_entry_safe(subdir, n, &root->d_children, d_sib) {
386387
if (subdir->d_fsdata) {
387388
subdir->d_fsdata = NULL;
388389
dput(subdir);

fs/autofs/expire.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ static int autofs_mount_busy(struct vfsmount *mnt,
7373
/* p->d_lock held */
7474
static struct dentry *positive_after(struct dentry *p, struct dentry *child)
7575
{
76-
if (child)
77-
child = list_next_entry(child, d_child);
78-
else
79-
child = list_first_entry(&p->d_subdirs, struct dentry, d_child);
76+
child = child ? d_next_sibling(child) : d_first_child(p);
8077

81-
list_for_each_entry_from(child, &p->d_subdirs, d_child) {
78+
hlist_for_each_entry_from(child, d_sib) {
8279
spin_lock_nested(&child->d_lock, DENTRY_D_LOCK_NESTED);
8380
if (simple_positive(child)) {
8481
dget_dlock(child);

fs/ceph/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ __dcache_find_get_entry(struct dentry *parent, u64 idx,
174174
/*
175175
* When possible, we try to satisfy a readdir by peeking at the
176176
* dcache. We make this work by carefully ordering dentries on
177-
* d_child when we initially get results back from the MDS, and
177+
* d_children when we initially get results back from the MDS, and
178178
* falling back to a "normal" sync readdir if any dentries in the dir
179179
* are dropped.
180180
*

fs/ceph/mds_client.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ static bool drop_negative_children(struct dentry *dentry)
21282128
goto out;
21292129

21302130
spin_lock(&dentry->d_lock);
2131-
list_for_each_entry(child, &dentry->d_subdirs, d_child) {
2131+
hlist_for_each_entry(child, &dentry->d_children, d_sib) {
21322132
if (d_really_is_positive(child)) {
21332133
all_negative = false;
21342134
break;

fs/coda/cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ static void coda_flag_children(struct dentry *parent, int flag)
9393
struct dentry *de;
9494

9595
spin_lock(&parent->d_lock);
96-
list_for_each_entry(de, &parent->d_subdirs, d_child) {
96+
hlist_for_each_entry(de, &parent->d_children, d_sib) {
97+
struct inode *inode = d_inode_rcu(de);
9798
/* don't know what to do with negative dentries */
98-
if (d_inode(de) )
99-
coda_flag_inode(d_inode(de), flag);
99+
if (inode)
100+
coda_flag_inode(inode, flag);
100101
}
101102
spin_unlock(&parent->d_lock);
102-
return;
103103
}
104104

105105
void coda_flag_inode_children(struct inode *inode, int flag)

0 commit comments

Comments
 (0)