1. 26 9月, 2006 7 次提交
    • A
      [PATCH] mm/: make functions static · b221385b
      Adrian Bunk 提交于
      This patch makes the following needlessly global functions static:
       - slab.c: kmem_find_general_cachep()
       - swap.c: __page_cache_release()
       - vmalloc.c: __vmalloc_node()
      Signed-off-by: NAdrian Bunk <bunk@stusta.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b221385b
    • P
      [PATCH] mm: balance dirty pages · edc79b2a
      Peter Zijlstra 提交于
      Now that we can detect writers of shared mappings, throttle them.  Avoids OOM
      by surprise.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hugh Dickins <hugh@veritas.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      edc79b2a
    • P
      [PATCH] mm: tracking shared dirty pages · d08b3851
      Peter Zijlstra 提交于
      Tracking of dirty pages in shared writeable mmap()s.
      
      The idea is simple: write protect clean shared writeable pages, catch the
      write-fault, make writeable and set dirty.  On page write-back clean all the
      PTE dirty bits and write protect them once again.
      
      The implementation is a tad harder, mainly because the default
      backing_dev_info capabilities were too loosely maintained.  Hence it is not
      enough to test the backing_dev_info for cap_account_dirty.
      
      The current heuristic is as follows, a VMA is eligible when:
       - its shared writeable
          (vm_flags & (VM_WRITE|VM_SHARED)) == (VM_WRITE|VM_SHARED)
       - it is not a 'special' mapping
          (vm_flags & (VM_PFNMAP|VM_INSERTPAGE)) == 0
       - the backing_dev_info is cap_account_dirty
          mapping_cap_account_dirty(vma->vm_file->f_mapping)
       - f_op->mmap() didn't change the default page protection
      
      Page from remap_pfn_range() are explicitly excluded because their COW
      semantics are already horrid enough (see vm_normal_page() in do_wp_page()) and
      because they don't have a backing store anyway.
      
      mprotect() is taught about the new behaviour as well.  However it overrides
      the last condition.
      
      Cleaning the pages on write-back is done with page_mkclean() a new rmap call.
      It can be called on any page, but is currently only implemented for mapped
      pages, if the page is found the be of a VMA that accounts dirty pages it will
      also wrprotect the PTE.
      
      Finally, in fs/buffers.c:try_to_free_buffers(); remove clear_page_dirty() from
      under ->private_lock.  This seems to be safe, since ->private_lock is used to
      serialize access to the buffers, not the page itself.  This is needed because
      clear_page_dirty() will call into page_mkclean() and would thereby violate
      locking order.
      
      [dhowells@redhat.com: Provide a page_mkclean() implementation for NOMMU]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Hugh Dickins <hugh@veritas.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d08b3851
    • N
      [PATCH] mm: VM_BUG_ON · 725d704e
      Nick Piggin 提交于
      Introduce a VM_BUG_ON, which is turned on with CONFIG_DEBUG_VM.  Use this
      in the lightweight, inline refcounting functions; PageLRU and PageActive
      checks in vmscan, because they're pretty well confined to vmscan.  And in
      page allocate/free fastpaths which can be the hottest parts of the kernel
      for kbuilds.
      
      Unlike BUG_ON, VM_BUG_ON must not be used to execute statements with
      side-effects, and should not be used outside core mm code.
      Signed-off-by: NNick Piggin <npiggin@suse.de>
      Cc: Hugh Dickins <hugh@veritas.com>
      Cc: Christoph Lameter <clameter@engr.sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      725d704e
    • J
      [PATCH] update to the kernel kmap/kunmap API · a6ca1b99
      James Bottomley 提交于
      Give non-highmem architectures access to the kmap API for the purposes of
      overriding (this is what the attached patch does).
      
      The proposal is that we should now require all architectures with coherence
      issues to manage data coherence via the kmap/kunmap API.  Thus driver
      writers never have to write code like
      
          kmap(page)
          modify data in page
          flush_kernel_dcache_page(page)
          kunmap(page)
      
      instead, kmap/kunmap will manage the coherence and driver (and filesystem)
      writers don't need to worry about how to flush between kmap and kunmap.
      
      For most architectures, the page only needs to be flushed if it was
      actually written to *and* there are user mappings of it, so the best
      implementation looks to be: clear the page dirty pte bit in the kernel page
      tables on kmap and on kunmap, check page->mappings for user maps, and then
      the dirty bit, and only flush if it both has user mappings and is dirty.
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      a6ca1b99
    • J
      [PATCH] trigger a syntax error if percpu macros are incorrectly used · 632bbfee
      Jan Blunck 提交于
      get_cpu_var()/per_cpu()/__get_cpu_var() arguments must be simple
      identifiers.  Otherwise the arch dependent implementations might break.
      
      This patch enforces the correct usage of the macros by producing a syntax
      error if the variable is not a simple identifier.
      Signed-off-by: NJan Blunck <jblunck@suse.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      632bbfee
    • J
      [libata] No need for all those arch libata-portmap.h headers · a6d967a4
      Jeff Garzik 提交于
      They all contain the same thing.  Instead, have a single generic one in
      include/asm-generic, and permit an arch to override as needed.
      Signed-off-by: NJeff Garzik <jeff@garzik.org>
      a6d967a4
  2. 25 9月, 2006 6 次提交
  3. 24 9月, 2006 2 次提交
  4. 23 9月, 2006 25 次提交
    • T
      SUNRPC: Add refcounting to the struct rpc_xprt · 6b6ca86b
      Trond Myklebust 提交于
      In a subsequent patch, this will allow the portmapper to take a reference
      to the rpc_xprt for which it is updating the port number, fixing an Oops.
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      6b6ca86b
    • T
    • T
    • T
    • C
      NFS: Use cached page as buffer for NFS symlink requests · 94a6d753
      Chuck Lever 提交于
      Now that we have a copy of the symlink path in the page cache, we can pass
      a struct page down to the XDR routines instead of a string buffer.
      
      Test plan:
      Connectathon, all NFS versions.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      94a6d753
    • C
      NFS: Fix double d_drop in nfs_instantiate() error path · 4f390c15
      Chuck Lever 提交于
      If the LOOKUP or GETATTR in nfs_instantiate fail, nfs_instantiate will do a
      d_drop before returning.  But some callers already do a d_drop in the case
      of an error return.  Make certain we do only one d_drop in all error paths.
      
      This issue was introduced because over time, the symlink proc API diverged
      slightly from the create/mkdir/mknod proc API.  To prevent other coding
      mistakes of this type, change the symlink proc API to be more like
      create/mkdir/mknod and move the nfs_instantiate call into the symlink proc
      routines so it is used in exactly the same way for create, mkdir, mknod,
      and symlink.
      
      Test plan:
      Connectathon, all versions of NFS.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      4f390c15
    • C
      SUNRPC: Eliminate xprt_create_proto and rpc_create_client · ff9aa5e5
      Chuck Lever 提交于
      The two function call API for creating a new RPC client is now obsolete.
      Remove it.
      
      Also, remove an unnecessary check to see whether the caller is capable of
      using privileged network services.  The kernel RPC client always uses a
      privileged ephemeral port by default; callers are responsible for checking
      the authority of users to make use of any RPC service, or for specifying
      that a nonprivileged port is acceptable.
      
      Test plan:
      Repeated runs of Connectathon locking suite.  Check network trace to ensure
      correctness of NLM requests and replies.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ff9aa5e5
    • C
      SUNRPC: use sockaddr + size when creating remote transport endpoints · c2866763
      Chuck Lever 提交于
      Prepare for more generic transport endpoint handling needed by transports
      that might use different forms of addressing, such as IPv6.
      
      Introduce a single function call to replace the two-call
      xprt_create_proto/rpc_create_client API.  Define a new rpc_create_args
      structure that allows callers to pass in remote endpoint addresses of
      varying length.
      
      Test-plan:
      Compile kernel with CONFIG_NFS enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      c2866763
    • C
      SUNRPC: Clean-up after previous patches. · 6ca94823
      Chuck Lever 提交于
      Remove some unused macros related to accessing an RPC peer address
      
      Test plan:
      Compile kernel with CONFIG_NFS option enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      6ca94823
    • C
      SUNRPC: Use "sockaddr_storage" for storing RPC client's remote peer address · c4efcb1d
      Chuck Lever 提交于
      IPv6 addresses are big (128 bytes).  Now that no RPC client consumers treat
      the addr field in rpc_xprt structs as an opaque, and access it only via the
      API calls, we can safely widen the field in the rpc_xprt struct to
      accomodate larger addresses.
      
      Test plan:
      Compile kernel with CONFIG_NFS enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      c4efcb1d
    • C
      SUNRPC: Create API for displaying remote peer address · f425eba4
      Chuck Lever 提交于
      Provide an API for formatting the remote peer address for printing without
      exposing its internal structure.  The address could be dynamic, so we
      support a function call to get the address rather than reading it straight
      out of a structure.
      
      Test-plan:
      Destructive testing (unplugging the network temporarily).  Probably need
      to rig a server where certain services aren't running, or that returns an
      error for some typical operation.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      f425eba4
    • C
      SUNRPC: add xprt switch API for printing formatted remote peer addresses · edb267a6
      Chuck Lever 提交于
      Add a new method to the transport switch API to provide a way to convert
      the opaque contents of xprt->addr to a human-readable string.
      
      Test plan:
      Compile kernel with CONFIG_NFS enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      edb267a6
    • C
      SUNRPC: remove extraneous header inclusions · 39d7bbcb
      Chuck Lever 提交于
      include/linux/sunrpc/clnt.h already includes include/linux/sunrpc/xprt.h.
      We can remove xprt.h from source files that already include clnt.h.
      Likewise include/linux/sunrpc/timer.h.
      
      Test plan:
      Compile kernel with CONFIG_NFS enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      39d7bbcb
    • C
      SUNRPC: create API for getting remote peer address · ed39440a
      Chuck Lever 提交于
      Provide an API for retrieving the remote peer address without allowing
      direct access to the rpc_xprt struct.
      
      Test-plan:
      Compile kernel with CONFIG_NFS enabled.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ed39440a
    • C
      SUNRPC: Introduce transport switch callout for pluggable rpcbind · bbf7c1dd
      Chuck Lever 提交于
      Introduce a clean transport switch API for plugging in different types of
      rpcbind mechanisms.  For instance, rpcbind can cleanly replace the
      existing portmapper client, or a transport can choose to implement RPC
      binding any way it likes.
      
      Test plan:
      Destructive testing (unplugging the network temporarily).  Connectathon
      with UDP and TCP.  NFSv2/3 and NFSv4 mounting should be carefully checked.
      Probably need to rig a server where certain services aren't running, or
      that returns an error for some typical operation.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      bbf7c1dd
    • C
      SUNRPC: Support for RPC child tasks no longer needed · 5b1eacbc
      Chuck Lever 提交于
      The previous patches removed the last user of RPC child tasks, so we can
      remove support for child tasks from net/sunrpc/sched.c now.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      5b1eacbc
    • C
      SUNRPC: Make RPC portmapper use per-transport storage · 4a68179d
      Chuck Lever 提交于
      Move connection and bind state that was maintained in the rpc_clnt
      structure to the rpc_xprt structure.  This will allow the creation of
      a clean API for plugging in different types of bind mechanisms.
      
      This brings improvements such as the elimination of a single spin lock to
      control serialization for all in-kernel RPC binding.  A set of per-xprt
      bitops is used to serialize tasks during RPC binding, just like it now
      works for making RPC transport connections.
      
      Test-plan:
      Destructive testing (unplugging the network temporarily).  Connectathon
      with UDP and TCP.  NFSv2/3 and NFSv4 mounting should be carefully checked.
      Probably need to rig a server where certain services aren't running, or
      that returns an error for some typical operation.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      4a68179d
    • C
      SUNRPC: Create a helper to tell whether a transport is bound · ec739ef0
      Chuck Lever 提交于
      Hide the contents and format of xprt->addr by eliminating direct uses
      of the xprt->addr.sin_port field.  This change is required to support
      alternate RPC host address formats (eg IPv6).
      
      Test-plan:
      Destructive testing (unplugging the network temporarily).  Repeated runs of
      Connectathon locking suite with UDP and TCP.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      ec739ef0
    • D
      NFS: Share NFS superblocks per-protocol per-server per-FSID · 54ceac45
      David Howells 提交于
      The attached patch makes NFS share superblocks between mounts from the same
      server and FSID over the same protocol.
      
      It does this by creating each superblock with a false root and returning the
      real root dentry in the vfsmount presented by get_sb(). The root dentry set
      starts off as an anonymous dentry if we don't already have the dentry for its
      inode, otherwise it simply returns the dentry we already have.
      
      We may thus end up with several trees of dentries in the superblock, and if at
      some later point one of anonymous tree roots is discovered by normal filesystem
      activity to be located in another tree within the superblock, the anonymous
      root is named and materialises attached to the second tree at the appropriate
      point.
      
      Why do it this way? Why not pass an extra argument to the mount() syscall to
      indicate the subpath and then pathwalk from the server root to the desired
      directory? You can't guarantee this will work for two reasons:
      
       (1) The root and intervening nodes may not be accessible to the client.
      
           With NFS2 and NFS3, for instance, mountd is called on the server to get
           the filehandle for the tip of a path. mountd won't give us handles for
           anything we don't have permission to access, and so we can't set up NFS
           inodes for such nodes, and so can't easily set up dentries (we'd have to
           have ghost inodes or something).
      
           With this patch we don't actually create dentries until we get handles
           from the server that we can use to set up their inodes, and we don't
           actually bind them into the tree until we know for sure where they go.
      
       (2) Inaccessible symbolic links.
      
           If we're asked to mount two exports from the server, eg:
      
      	mount warthog:/warthog/aaa/xxx /mmm
      	mount warthog:/warthog/bbb/yyy /nnn
      
           We may not be able to access anything nearer the root than xxx and yyy,
           but we may find out later that /mmm/www/yyy, say, is actually the same
           directory as the one mounted on /nnn. What we might then find out, for
           example, is that /warthog/bbb was actually a symbolic link to
           /warthog/aaa/xxx/www, but we can't actually determine that by talking to
           the server until /warthog is made available by NFS.
      
           This would lead to having constructed an errneous dentry tree which we
           can't easily fix. We can end up with a dentry marked as a directory when
           it should actually be a symlink, or we could end up with an apparently
           hardlinked directory.
      
           With this patch we need not make assumptions about the type of a dentry
           for which we can't retrieve information, nor need we assume we know its
           place in the grand scheme of things until we actually see that place.
      
      This patch reduces the possibility of aliasing in the inode and page caches for
      inodes that may be accessed by more than one NFS export. It also reduces the
      number of superblocks required for NFS where there are many NFS exports being
      used from a server (home directory server + autofs for example).
      
      This in turn makes it simpler to do local caching of network filesystems, as it
      can then be guaranteed that there won't be links from multiple inodes in
      separate superblocks to the same cache file.
      
      Obviously, cache aliasing between different levels of NFS protocol could still
      be a problem, but at least that gives us another key to use when indexing the
      cache.
      
      This patch makes the following changes:
      
       (1) The server record construction/destruction has been abstracted out into
           its own set of functions to make things easier to get right.  These have
           been moved into fs/nfs/client.c.
      
           All the code in fs/nfs/client.c has to do with the management of
           connections to servers, and doesn't touch superblocks in any way; the
           remaining code in fs/nfs/super.c has to do with VFS superblock management.
      
       (2) The sequence of events undertaken by NFS mount is now reordered:
      
           (a) A volume representation (struct nfs_server) is allocated.
      
           (b) A server representation (struct nfs_client) is acquired.  This may be
           	 allocated or shared, and is keyed on server address, port and NFS
           	 version.
      
           (c) If allocated, the client representation is initialised.  The state
           	 member variable of nfs_client is used to prevent a race during
           	 initialisation from two mounts.
      
           (d) For NFS4 a simple pathwalk is performed, walking from FH to FH to find
           	 the root filehandle for the mount (fs/nfs/getroot.c).  For NFS2/3 we
           	 are given the root FH in advance.
      
           (e) The volume FSID is probed for on the root FH.
      
           (f) The volume representation is initialised from the FSINFO record
           	 retrieved on the root FH.
      
           (g) sget() is called to acquire a superblock.  This may be allocated or
           	 shared, keyed on client pointer and FSID.
      
           (h) If allocated, the superblock is initialised.
      
           (i) If the superblock is shared, then the new nfs_server record is
           	 discarded.
      
           (j) The root dentry for this mount is looked up from the root FH.
      
           (k) The root dentry for this mount is assigned to the vfsmount.
      
       (3) nfs_readdir_lookup() creates dentries for each of the entries readdir()
           returns; this function now attaches disconnected trees from alternate
           roots that happen to be discovered attached to a directory being read (in
           the same way nfs_lookup() is made to do for lookup ops).
      
           The new d_materialise_unique() function is now used to do this, thus
           permitting the whole thing to be done under one set of locks, and thus
           avoiding any race between mount and lookup operations on the same
           directory.
      
       (4) The client management code uses a new debug facility: NFSDBG_CLIENT which
           is set by echoing 1024 to /proc/net/sunrpc/nfs_debug.
      
       (5) Clone mounts are now called xdev mounts.
      
       (6) Use the dentry passed to the statfs() op as the handle for retrieving fs
           statistics rather than the root dentry of the superblock (which is now a
           dummy).
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      54ceac45
    • D
      NFS: Eliminate client_sys in favour of cl_rpcclient · 5006a76c
      David Howells 提交于
      Eliminate nfs_server::client_sys in favour of nfs_client::cl_rpcclient as we
      only really need one per server that we're talking to since it doesn't have any
      security on it.
      
      The retransmission management variables are also moved to the common struct as
      they're required to set up the cl_rpcclient connection.
      
      The NFS2/3 client and client_acl connections are thenceforth derived by cloning
      the cl_rpcclient connection and post-applying the authorisation flavour.
      
      The code for setting up the initial common connection has been moved to
      client.c as nfs_create_rpc_client().  All the NFS program definition tables are
      also moved there as that's where they're now required rather than super.c.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      5006a76c
    • D
      NFS: Move rpc_ops from nfs_server to nfs_client · 8fa5c000
      David Howells 提交于
      Move the rpc_ops from the nfs_server struct to the nfs_client struct as they're
      common to all server records of a particular NFS protocol version.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      8fa5c000
    • D
      NFS: Maintain a common server record for NFS2/3 as well as for NFS4 · 27951bd2
      David Howells 提交于
      Maintain a common server record for NFS2/3 as well as for NFS4 so that common
      stuff can be moved there from struct nfs_server.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      27951bd2
    • D
      NFS: Add extra const qualifiers · 509de811
      David Howells 提交于
      Add some extra const qualifiers into NFS.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      509de811
    • D
      NFS: Generalise the nfs_client structure · 24c8dbbb
      David Howells 提交于
      Generalise the nfs_client structure by:
      
       (1) Moving nfs_client to a more general place (nfs_fs_sb.h).
      
       (2) Renaming its maintenance routines to be non-NFS4 specific.
      
       (3) Move those maintenance routines to a new non-NFS4 specific file (client.c)
           and move the declarations to internal.h.
      
       (4) Make nfs_find/get_client() take a full sockaddr_in to include the port
           number (will be required for NFS2/3).
      
       (5) Make nfs_find/get_client() take the NFS protocol version (again will be
           required to differentiate NFS2, 3 & 4 client records).
      
      Also:
      
       (6) Make nfs_client construction proceed akin to inodes, marking them as under
           construction and providing a function to indicate completion.
      
       (7) Make nfs_get_client() wait interruptibly if it finds a client that it can
           share, but that client is currently being constructed.
      
       (8) Make nfs4_create_client() use (6) and (7) instead of locking cl_sem.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      24c8dbbb
    • D
      NFS: Add a server capabilities NFS RPC op · e9326dca
      David Howells 提交于
      Add a set_capabilities NFS RPC op so that the server capabilities can be set.
      Signed-Off-By: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
      e9326dca