diff options
| author | James Simmons <jsimmons@kozmo.(none)> | 2003-04-12 16:40:01 -0700 |
|---|---|---|
| committer | James Simmons <jsimmons@kozmo.(none)> | 2003-04-12 16:40:01 -0700 |
| commit | 81ff732eecc651180e828c9527abaa9aec0883c6 (patch) | |
| tree | 61287be0e5af89b7549e1eb839c24079de1ce9c0 /include/linux | |
| parent | 762dbb7160e79065d80b0fcb86b38ca07b8d32c8 (diff) | |
| parent | 7b87c44eae286a1644612620c7ad45a231e549e5 (diff) | |
Merge kozmo.(none):/usr/src/linus-2.5
into kozmo.(none):/usr/src/fbdev-2.5
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/blockgroup_lock.h | 58 | ||||
| -rw-r--r-- | include/linux/bootmem.h | 2 | ||||
| -rw-r--r-- | include/linux/ext2_fs_sb.h | 7 | ||||
| -rw-r--r-- | include/linux/file.h | 2 | ||||
| -rw-r--r-- | include/linux/highmem.h | 1 | ||||
| -rw-r--r-- | include/linux/init_task.h | 2 | ||||
| -rw-r--r-- | include/linux/mm.h | 2 | ||||
| -rw-r--r-- | include/linux/nfsd/nfsd.h | 12 | ||||
| -rw-r--r-- | include/linux/nfsd/state.h | 63 | ||||
| -rw-r--r-- | include/linux/nfsd/syscall.h | 7 | ||||
| -rw-r--r-- | include/linux/percpu_counter.h | 100 | ||||
| -rw-r--r-- | include/linux/quota.h | 2 | ||||
| -rw-r--r-- | include/linux/radix-tree.h | 2 |
13 files changed, 256 insertions, 4 deletions
diff --git a/include/linux/blockgroup_lock.h b/include/linux/blockgroup_lock.h new file mode 100644 index 000000000000..87a890c4a0f8 --- /dev/null +++ b/include/linux/blockgroup_lock.h @@ -0,0 +1,58 @@ +/* + * Per-blockgroup locking for ext2 and ext3. + * + * Simple hashed spinlocking. + */ + +#include <linux/config.h> +#include <linux/spinlock.h> +#include <linux/cache.h> + +#ifdef CONFIG_SMP + +/* + * We want a power-of-two. Is there a better way than this? + */ + +#if NR_CPUS >= 32 +#define NR_BG_LOCKS 128 +#elif NR_CPUS >= 16 +#define NR_BG_LOCKS 64 +#elif NR_CPUS >= 8 +#define NR_BG_LOCKS 32 +#elif NR_CPUS >= 4 +#define NR_BG_LOCKS 16 +#elif NR_CPUS >= 2 +#define NR_BG_LOCKS 8 +#else +#define NR_BG_LOCKS 4 +#endif + +#else /* CONFIG_SMP */ +#define NR_BG_LOCKS 1 +#endif /* CONFIG_SMP */ + +struct bgl_lock { + spinlock_t lock; +} ____cacheline_aligned_in_smp; + +struct blockgroup_lock { + struct bgl_lock locks[NR_BG_LOCKS]; +}; + +static inline void bgl_lock_init(struct blockgroup_lock *bgl) +{ + int i; + + for (i = 0; i < NR_BG_LOCKS; i++) + spin_lock_init(&bgl->locks[i].lock); +} + +/* + * The accessor is a macro so we can embed a blockgroup_lock into different + * superblock types + */ +#define sb_bgl_lock(sb, block_group) \ + (&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock) + + diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index 782041f43326..6902724691d2 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h @@ -32,6 +32,8 @@ typedef struct bootmem_data { void *node_bootmem_map; unsigned long last_offset; unsigned long last_pos; + unsigned long last_success; /* Previous allocation point. To speed + * up searching */ } bootmem_data_t; extern unsigned long __init bootmem_bootmap_pages (unsigned long); diff --git a/include/linux/ext2_fs_sb.h b/include/linux/ext2_fs_sb.h index 3c07d4ecf898..13178c16c7ea 100644 --- a/include/linux/ext2_fs_sb.h +++ b/include/linux/ext2_fs_sb.h @@ -16,6 +16,9 @@ #ifndef _LINUX_EXT2_FS_SB #define _LINUX_EXT2_FS_SB +#include <linux/blockgroup_lock.h> +#include <linux/percpu_counter.h> + /* * second extended-fs super-block data in memory */ @@ -45,6 +48,10 @@ struct ext2_sb_info { u32 s_next_generation; unsigned long s_dir_count; u8 *s_debts; + struct percpu_counter s_freeblocks_counter; + struct percpu_counter s_freeinodes_counter; + struct percpu_counter s_dirs_counter; + struct blockgroup_lock s_blockgroup_lock; }; #endif /* _LINUX_EXT2_FS_SB */ diff --git a/include/linux/file.h b/include/linux/file.h index 0bfe318d873b..6fbd27f755d5 100644 --- a/include/linux/file.h +++ b/include/linux/file.h @@ -21,7 +21,7 @@ */ struct files_struct { atomic_t count; - rwlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ + spinlock_t file_lock; /* Protects all the below members. Nests inside tsk->alloc_lock */ int max_fds; int max_fdset; int next_fd; diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 8800a35efe74..3bc7bcb3c252 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h @@ -67,7 +67,6 @@ static inline void memclear_highpage_flush(struct page *page, unsigned int offse kaddr = kmap_atomic(page, KM_USER0); memset((char *)kaddr + offset, 0, size); flush_dcache_page(page); - flush_page_to_ram(page); kunmap_atomic(kaddr, KM_USER0); } diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 6e749b6c5a7f..96a5f926300e 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h @@ -6,7 +6,7 @@ #define INIT_FILES \ { \ .count = ATOMIC_INIT(1), \ - .file_lock = RW_LOCK_UNLOCKED, \ + .file_lock = SPIN_LOCK_UNLOCKED, \ .max_fds = NR_OPEN_DEFAULT, \ .max_fdset = __FD_SETSIZE, \ .next_fd = 0, \ diff --git a/include/linux/mm.h b/include/linux/mm.h index 5f4bf646e187..ede6c5ff4181 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -486,6 +486,8 @@ extern void free_area_init(unsigned long * zones_size); extern void free_area_init_node(int nid, pg_data_t *pgdat, struct page *pmap, unsigned long * zones_size, unsigned long zone_start_pfn, unsigned long *zholes_size); +extern void memmap_init_zone(struct page *, unsigned long, int, + unsigned long, unsigned long); extern void mem_init(void); extern void show_mem(void); extern void si_meminfo(struct sysinfo * val); diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h index cb97f810cfdd..6efd989a11d6 100644 --- a/include/linux/nfsd/nfsd.h +++ b/include/linux/nfsd/nfsd.h @@ -117,6 +117,17 @@ int nfsd_notify_change(struct inode *, struct iattr *); int nfsd_permission(struct svc_export *, struct dentry *, int); +/* + * NFSv4 State + */ +#ifdef CONFIG_NFSD_V4 +void nfs4_state_init(void); +void nfs4_state_shutdown(void); +#else +void static inline nfs4_state_init(void){} +void static inline nfs4_state_shutdown(void){} +#endif + /* * lockd binding */ @@ -162,6 +173,7 @@ void nfsd_lockd_shutdown(void); #define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE) #define nfserr_same __constant_htonl(NFSERR_SAME) #define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE) +#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID) #define nfserr_resource __constant_htonl(NFSERR_RESOURCE) #define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE) #define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH) diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h new file mode 100644 index 000000000000..920969e000b0 --- /dev/null +++ b/include/linux/nfsd/state.h @@ -0,0 +1,63 @@ +/* + * linux/include/nfsd/state.h + * + * Copyright (c) 2001 The Regents of the University of Michigan. + * All rights reserved. + * + * Kendrick Smith <kmsmith@umich.edu> + * Andy Adamson <andros@umich.edu> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef _NFSD4_STATE_H +#define _NFSD4_STATE_H + +#include <linux/list.h> + +#define NFSD4_CLIENT_MAXNAME 1024 + +extern int nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid); + +/* + * struct nfs4_client - one per client. Clientids live here. + * o Each nfs4_client is hashed by clientid. + * + * o Each nfs4_clients is also hashed by name + * (the opaque quantity initially sent by the client to identify itself). + */ +struct nfs4_client { + struct list_head cl_idhash; /* hash by cl_clientid.id */ + struct list_head cl_strhash; /* hash by cl_name */ + struct xdr_netobj cl_name; /* id generated by client */ + nfs4_verifier cl_verifier; /* generated by client */ + u32 cl_addr; /* client ipaddress */ + struct svc_cred cl_cred; /* setclientid principal */ + clientid_t cl_clientid; /* generated by server */ + nfs4_verifier cl_confirm; /* generated by server */ +}; +#endif /* NFSD4_STATE_H */ diff --git a/include/linux/nfsd/syscall.h b/include/linux/nfsd/syscall.h index 872af1fe9d7d..d512171f5bf8 100644 --- a/include/linux/nfsd/syscall.h +++ b/include/linux/nfsd/syscall.h @@ -91,6 +91,13 @@ struct nfsctl_arg { struct nfsctl_export u_export; struct nfsctl_fdparm u_getfd; struct nfsctl_fsparm u_getfs; + /* + * The following dummy member is needed to preserve binary compatibility + * on platforms where alignof(void*)>alignof(int). It's needed because + * this union used to contain a member (u_umap) which contained a + * pointer. + */ + void *u_ptr; } u; #define ca_svc u.u_svc #define ca_client u.u_client diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h new file mode 100644 index 000000000000..69d0a66b662e --- /dev/null +++ b/include/linux/percpu_counter.h @@ -0,0 +1,100 @@ +/* + * A simple "approximate counter" for use in ext2 and ext3 superblocks. + * + * WARNING: these things are HUGE. 4 kbytes per counter on 32-way P4. + */ + +#include <linux/config.h> +#include <linux/spinlock.h> +#include <linux/smp.h> +#include <linux/preempt.h> + +#ifdef CONFIG_SMP + +struct __percpu_counter { + long count; +} ____cacheline_aligned; + +struct percpu_counter { + spinlock_t lock; + long count; + struct __percpu_counter counters[NR_CPUS]; +}; + +#if NR_CPUS >= 16 +#define FBC_BATCH (NR_CPUS*2) +#else +#define FBC_BATCH (NR_CPUS*4) +#endif + +static inline void percpu_counter_init(struct percpu_counter *fbc) +{ + int i; + + spin_lock_init(&fbc->lock); + fbc->count = 0; + for (i = 0; i < NR_CPUS; i++) + fbc->counters[i].count = 0; +} + +void percpu_counter_mod(struct percpu_counter *fbc, long amount); + +static inline long percpu_counter_read(struct percpu_counter *fbc) +{ + return fbc->count; +} + +/* + * It is possible for the percpu_counter_read() to return a small negative + * number for some counter which should never be negative. + */ +static inline long percpu_counter_read_positive(struct percpu_counter *fbc) +{ + long ret = fbc->count; + + barrier(); /* Prevent reloads of fbc->count */ + if (ret > 0) + return ret; + return 1; +} + +#else + +struct percpu_counter { + long count; +}; + +static inline void percpu_counter_init(struct percpu_counter *fbc) +{ + fbc->count = 0; +} + +static inline void +percpu_counter_mod(struct percpu_counter *fbc, long amount) +{ + preempt_disable(); + fbc->count += amount; + preempt_enable(); +} + +static inline long percpu_counter_read(struct percpu_counter *fbc) +{ + return fbc->count; +} + +static inline long percpu_counter_read_positive(struct percpu_counter *fbc) +{ + return fbc->count; +} + +#endif /* CONFIG_SMP */ + +static inline void percpu_counter_inc(struct percpu_counter *fbc) +{ + percpu_counter_mod(fbc, 1); +} + +static inline void percpu_counter_dec(struct percpu_counter *fbc) +{ + percpu_counter_mod(fbc, -1); +} diff --git a/include/linux/quota.h b/include/linux/quota.h index e1c097e338d9..77d017472dc7 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -250,6 +250,7 @@ struct dquot_operations { void (*free_space) (struct inode *, qsize_t); void (*free_inode) (const struct inode *, unsigned long); int (*transfer) (struct inode *, struct iattr *); + int (*sync_dquot) (struct dquot *); }; /* Operations handling requests from userspace */ @@ -303,6 +304,7 @@ struct quota_info { int register_quota_format(struct quota_format_type *fmt); void unregister_quota_format(struct quota_format_type *fmt); +void init_dquot_operations(struct dquot_operations *fsdqops); #else diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index f4a78d52b5ce..c32a45fd1f0d 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h @@ -43,7 +43,7 @@ do { \ extern int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); extern void *radix_tree_lookup(struct radix_tree_root *, unsigned long); -extern int radix_tree_delete(struct radix_tree_root *, unsigned long); +extern void *radix_tree_delete(struct radix_tree_root *, unsigned long); extern unsigned int radix_tree_gang_lookup(struct radix_tree_root *root, void **results, unsigned long first_index, unsigned int max_items); |
