26 Oct, 2010
7 commits
-
d_validate does a purely read lookup in the dentry hash, so use RCU read side
locking instead of dcache_lock. Split out from a larget patch by
Nick Piggin .Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
Always do a list_del_init on the LRU to make sure the list_empty invariant for
not beeing on the LRU always holds true, and fold dentry_lru_del_init into
dentry_lru_del. Replace the dentry_lru_add_tail primitive with a
dentry_lru_move_tail operations that simpler when the dentry already is one
the list, which is always is. Move the list_empty into dentry_lru_add to
fit the scheme of the other lru helpers, and simplify locking once we
move to a separate LRU lock.Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
Currently __shrink_dcache_sb has an extremly awkward calling convention
because it tries to please very different callers. Split out the
main loop into a shrink_dentry_list helper, which gets called directly
from shrink_dcache_sb for the cases where all dentries need to be pruned,
or from __shrink_dcache_sb for pruning only a certain number of dentries.Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
dentry referenced bit is only set when installing the dentry back
onto the LRU. However with lazy LRU, the dentry can already be on
the LRU list at dput time, thus missing out on setting the referenced
bit. Fix this.Signed-off-by: Nick Piggin
Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
The nr_dentry stat is a globally touched cacheline and atomic operation
twice over the lifetime of a dentry. It is used for the benfit of userspace
only. Turn it into a per-cpu counter and always decrement it in d_free instead
of doing various batching operations to reduce lock hold times in the callers.Based on an earlier patch from Nick Piggin .
Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
Remove d_callback and always call __d_free with a RCU head.
Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro -
All callers take dcache_lock just around the call to __d_path, so
take the lock into it in preparation of getting rid of dcache_lock.Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro
18 Aug, 2010
2 commits
-
fs: brlock vfsmount_lock
Use a brlock for the vfsmount lock. It must be taken for write whenever
modifying the mount hash or associated fields, and may be taken for read when
performing mount hash lookups.A new lock is added for the mnt-id allocator, so it doesn't need to take
the heavy vfsmount write-lock.The number of atomics should remain the same for fastpath rlock cases, though
code would be slightly slower due to per-cpu access. Scalability is not not be
much improved in common cases yet, due to other locks (ie. dcache_lock) getting
in the way. However path lookups crossing mountpoints should be one case where
scalability is improved (currently requiring the global lock).The slowpath is slower due to use of brlock. On a 64 core, 64 socket, 32 node
Altix system (high latency to remote nodes), a simple umount microbenchmark
(mount --bind mnt mnt2 ; umount mnt2 loop 1000 times), before this patch it
took 6.8s, afterwards took 7.1s, about 5% slower.Cc: Al Viro
Signed-off-by: Nick Piggin
Signed-off-by: Al Viro -
fs: remove extra lookup in __lookup_hash
Optimize lookup for create operations, where no dentry should often be
common-case. In cases where it is not, such as unlink, the added overhead
is much smaller than the removed.Also, move comments about __d_lookup racyness to the __d_lookup call site.
d_lookup is intuitive; __d_lookup is what needs commenting. So in that same
vein, add kerneldoc comments to __d_lookup and clean up some of the comments:- We are interested in how the RCU lookup works here, particularly with
renames. Make that explicit, and point to the document where it is explained
in more detail.
- RCU is pretty standard now, and macros make implementations pretty mindless.
If we want to know about RCU barrier details, we look in RCU code.
- Delete some boring legacy comments because we don't care much about how the
code used to work, more about the interesting parts of how it works now. So
comments about lazy LRU may be interesting, but would better be done in the
LRU or refcount management code.Signed-off-by: Nick Piggin
Signed-off-by: Al Viro
15 Aug, 2010
1 commit
-
Fix parameter name in kernel-doc notation (causes a warning).
Signed-off-by: Randy Dunlap
Signed-off-by: Linus Torvalds
11 Aug, 2010
5 commits
-
Prepend "(unreachable)" to path strings if the path is not reachable
from the current root.Two places updated are
- the return string from getcwd()
- and symlinks under /proc/$PID.Other uses of d_path() are left unchanged (we know that some old
software crashes if /proc/mounts is changed).Signed-off-by: Miklos Szeredi
Signed-off-by: Al Viro -
__d_path() has 4 callers:
d_path()
sys_getcwd()
seq_path_root()
tomoyo_realpath_from_path2()Of these the only one which needs the " (deleted)" ending is d_path().
sys_getcwd() checks for existence before calling __d_path().
seq_path_root() is used to show the mountpoint path in
/proc/PID/mountinfo, which is always a positive.And tomoyo doesn't want the deleted ending.
Create a helper "path_with_deleted()" as subsequent patches will need
this in multiple places.Signed-off-by: Miklos Szeredi
Signed-off-by: Al Viro -
Split off prepend_path() from __d_path(). This new helper takes an
end-of-buffer pointer and buffer-length pointer just like the other
prepend_* functions. Move the " (deleted)" postfix out to __d_path().This patch doesn't change any functionality but paves the way for the
following patches.Signed-off-by: Miklos Szeredi
Signed-off-by: Al Viro -
In the old times pseudo-filesystems set the name of theroot dentry to
some prefix like "pipe:" and the name of the child dentry to "[123]"
and relied on a hack in __d_path() to replace the preceding slash with
the root's name to get "pipe:[123]".Then the d_dname() dentry operation was introduced which solved the
same problem without having to pre-fill the name in each dentry.Currently the following pseudo filesystems exist in the kernel:
perfmon
mtd
anon_inode
bdev
pipe
socketOf these only perfmon, anon_inode, pipe and socket create
sub-dentries, all of which have now been switched to using d_dname().bdev and mtd only create inodes.
This means that now the hack to overwrite the slash can be removed, so
for unreachable paths (e.g. within a detached mount) the path string
won't be polluted with garbage. For these cases a subsequent patch
will add a prefix, indicating that the path is unreachable.Signed-off-by: Miklos Szeredi
Signed-off-by: Al Viro -
Add three helpers that retrieve a refcounted copy of the root and cwd
from the supplied fs_struct.get_fs_root()
get_fs_pwd()
get_fs_root_and_pwd()Signed-off-by: Miklos Szeredi
Signed-off-by: Al Viro
10 Aug, 2010
2 commits
-
just delay __put_super() a bit
Signed-off-by: Al Viro
-
builds path relative to fs root, called under dcache_lock,
doesn't append any nonsense to unlinked ones.Signed-off-by: Al Viro
19 Jul, 2010
1 commit
-
The current shrinker implementation requires the registered callback
to have global state to work from. This makes it difficult to shrink
caches that are not global (e.g. per-filesystem caches). Pass the shrinker
structure to the callback so that users can embed the shrinker structure
in the context the shrinker needs to operate on and get back to it in the
callback via container_of().Signed-off-by: Dave Chinner
Reviewed-by: Christoph Hellwig
30 Jun, 2010
1 commit
-
list_for_each_entry_safe is not suitable to protect against concurrent
modification of the list. 6754af6 introduced a race in sb walking.list_for_each_entry can use the trick of pinning the current entry in
the list before we drop and retake the lock because it subsequently
follows cur->next. However list_for_each_entry_safe saves n=cur->next
for following before entering the loop body, so when the lock is
dropped, n may be deleted.Signed-off-by: Nick Piggin
Cc: Christoph Hellwig
Cc: John Stultz
Cc: Frank Mayhar
Cc: Al Viro
Signed-off-by: Linus Torvalds
22 May, 2010
3 commits
-
... and get rid of the last __put_super_and_need_restart() caller
Signed-off-by: Al Viro
-
We used to remove from s_list and s_instances at the same
time. So let's *not* do the former and skip superblocks
that have empty s_instances in the loops over s_list.The next step, of course, will be to get rid of rescan logics
in those loops.Signed-off-by: Al Viro
-
We set the "it's dead, don't mount on it" flag _and_ do not remove it if
we turn the damn thing negative and leave it around. And if it goes
positive afterwards, well...Fortunately, there's only one place where that needs to be caught:
only d_delete() can turn the sucker negative without immediately freeing
it; all other places that can lead to ->d_iput() call are followed by
unconditionally freeing struct dentry in question. So the fix is obvious:Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16014
Reported-by: Adam Tkac
Tested-by: Adam Tkac
Cc: [2.6.34.x]Signed-off-by: Al Viro
04 Mar, 2010
3 commits
-
rehashing the negative placeholder opens a race with d_lookup();
we unhash it almost immediately (by d_move()), but the race
window is there. Since d_move() doesn't rely on target being
hashed, we don't need that d_rehash() at all.Signed-off-by: Al Viro
-
Analog of is_subdir for vfsmount,dentry pairs, moved from audit_tree.c
Signed-off-by: Al Viro
-
Cleanup EXPORT* macros according to Documantation/CodingStyle.
Move EXPORT* macros to the line immediately after the closing
function brace.Signed-off-by: H Hartley Sweeten
Signed-off-by: Al Viro
17 Dec, 2009
1 commit
-
The EXPORT_SYMBOL for d_alloc_name is in fs/libfs.c but the function
is in fs/dcache.c. Move the EXPORT_SYMBOL to the line immediately
after the closing function brace line in fs/dcache.c as mentioned
in Documentation/CodingStyle.Signed-off-by: H Hartley Sweeten
Signed-off-by: Al Viro
18 Jul, 2009
1 commit
-
might_sleep() is called late-ish in cond_resched(), after the
need_resched()/preempt enabled/system running tests are
checked.It's better to check the sleeps while atomic earlier and not
depend on some environment datas that reduce the chances to
detect a problem.Also define cond_resched_*() helpers as macros, so that the
FILE/LINE reported in the sleeping while atomic warning
displays the real origin and not sched.hChanges in v2:
- Call __might_sleep() directly instead of might_sleep() which
may call cond_resched()- Turn cond_resched() into a macro so that the file:line
couple reported refers to the caller of cond_resched() and
not __cond_resched() itself.Changes in v3:
- Also propagate this __might_sleep() pull up to
cond_resched_lock() and cond_resched_softirq()Signed-off-by: Frederic Weisbecker
Signed-off-by: Peter Zijlstra
LKML-Reference:
Signed-off-by: Ingo Molnar
12 Jun, 2009
1 commit
-
d_unlinked() will be used in middle-term to ban checkpointing when opened
but unlinked file is detected, and in long term, to detect such situation
and special case on it.Signed-off-by: Alexey Dobriyan
Signed-off-by: Al Viro
09 May, 2009
1 commit
-
Fix ordering of LRU when moving referenced dentries to the head of the list
(they should go to the head of the list in the same order as they were found
from the tail, rather than reverse order).Signed-off-by: Nick Piggin
Signed-off-by: Al Viro
21 Apr, 2009
1 commit
-
is_under() will DTRT anyway. And yes, is_subdir() behaviour
is intentional.Signed-off-by: Al Viro
01 Apr, 2009
2 commits
-
Signed-off-by: Al Viro
-
Don't pull it in sched.h; very few files actually need it and those
can include directly. sched.h itself only needs forward declaration
of struct fs_struct;Signed-off-by: Al Viro
28 Mar, 2009
1 commit
-
Make sure that comments describe what's going on and not how, and always
use __d_instantiate instead of two separate branches, one with
d_instantiate and one with __d_instantiate.Signed-off-by: Christoph Hellwig
Signed-off-by: Al Viro
28 Feb, 2009
1 commit
-
Commit 4ea3ada2955e4519befa98ff55dd62d6dfbd1705 declares d_obtain_alias()
as EXPORT_SYMBOL_GPL where it's supposed to replace d_alloc_anon which was
previously declared as EXPORT_SYMBOL and thus available to any loadable
module.This patch reverts that.
Signed-off-by: Benny Halevy
Acked-by: Linus Torvalds
Cc: Christoph Hellwig
Cc: "J. Bruce Fields"
Cc: Trond Myklebust
Acked-by: Al Viro
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Jan, 2009
1 commit
-
Signed-off-by: Heiko Carstens
09 Jan, 2009
1 commit
-
Use the new generic implementation.
Signed-off-by: Wu Fengguang
Cc: Al Viro
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
01 Jan, 2009
4 commits
-
Instead of creating the "filp" kmem_cache in vfs_caches_init(),
we can do it a litle be later in files_init(), so that filp_cachep
is static to fs/file_table.cAcked-by: Paul E. McKenney
Signed-off-by: Eric Dumazet
Signed-off-by: Al Viro -
Explain that you really need to use the return value of d_path rather than
the buffer you passed into it.Also fix the comment for seq_path(), the function arguments changed
recently but the comment hadn't been updated in sync.Signed-off-by: Arjan van de Ven
Cc: Al Viro
Cc: Christoph Hellwig
Signed-off-by: Andrew Morton
Signed-off-by: Al Viro -
no function named d_put(), it should be dput().
Impact: fix document and comment, no functionality changed
Signed-off-by: Zhao Lei
Signed-off-by: Randy Dunlap
Signed-off-by: Andrew Morton
Signed-off-by: Al Viro -
We want ->name.len to match the resulting name on *both*
source and targetSigned-off-by: Al Viro