aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/cache.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-17 15:09:59 -0500
commit48c871c1f6a7c7044dd76774fb469e65c7e2e4e8 (patch)
treeda3aa535c98cc0957851354ceb0fbff7482d7a9d /net/sunrpc/cache.c
parent1a1689344add3333d28d1b5495d8043a3877d01c (diff)
parent4409d28140d9a6e6e3f4f1fdaf7234c4b965d954 (diff)
Merge branch 'gfar' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into upstream
Diffstat (limited to 'net/sunrpc/cache.c')
-rw-r--r--net/sunrpc/cache.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
index 14274490f92e..8612044b9189 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
@@ -274,7 +274,7 @@ int cache_check(struct cache_detail *detail,
274 * 274 *
275 * A table is then only scanned if the current time is at least 275 * A table is then only scanned if the current time is at least
276 * the nextcheck time. 276 * the nextcheck time.
277 * 277 *
278 */ 278 */
279 279
280static LIST_HEAD(cache_list); 280static LIST_HEAD(cache_list);
@@ -282,9 +282,9 @@ static DEFINE_SPINLOCK(cache_list_lock);
282static struct cache_detail *current_detail; 282static struct cache_detail *current_detail;
283static int current_index; 283static int current_index;
284 284
285static struct file_operations cache_file_operations; 285static const struct file_operations cache_file_operations;
286static struct file_operations content_file_operations; 286static const struct file_operations content_file_operations;
287static struct file_operations cache_flush_operations; 287static const struct file_operations cache_flush_operations;
288 288
289static void do_cache_clean(struct work_struct *work); 289static void do_cache_clean(struct work_struct *work);
290static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean); 290static DECLARE_DELAYED_WORK(cache_cleaner, do_cache_clean);
@@ -296,16 +296,16 @@ void cache_register(struct cache_detail *cd)
296 struct proc_dir_entry *p; 296 struct proc_dir_entry *p;
297 cd->proc_ent->owner = cd->owner; 297 cd->proc_ent->owner = cd->owner;
298 cd->channel_ent = cd->content_ent = NULL; 298 cd->channel_ent = cd->content_ent = NULL;
299 299
300 p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR, 300 p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR,
301 cd->proc_ent); 301 cd->proc_ent);
302 cd->flush_ent = p; 302 cd->flush_ent = p;
303 if (p) { 303 if (p) {
304 p->proc_fops = &cache_flush_operations; 304 p->proc_fops = &cache_flush_operations;
305 p->owner = cd->owner; 305 p->owner = cd->owner;
306 p->data = cd; 306 p->data = cd;
307 } 307 }
308 308
309 if (cd->cache_request || cd->cache_parse) { 309 if (cd->cache_request || cd->cache_parse) {
310 p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR, 310 p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR,
311 cd->proc_ent); 311 cd->proc_ent);
@@ -316,16 +316,16 @@ void cache_register(struct cache_detail *cd)
316 p->data = cd; 316 p->data = cd;
317 } 317 }
318 } 318 }
319 if (cd->cache_show) { 319 if (cd->cache_show) {
320 p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR, 320 p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR,
321 cd->proc_ent); 321 cd->proc_ent);
322 cd->content_ent = p; 322 cd->content_ent = p;
323 if (p) { 323 if (p) {
324 p->proc_fops = &content_file_operations; 324 p->proc_fops = &content_file_operations;
325 p->owner = cd->owner; 325 p->owner = cd->owner;
326 p->data = cd; 326 p->data = cd;
327 } 327 }
328 } 328 }
329 } 329 }
330 rwlock_init(&cd->hash_lock); 330 rwlock_init(&cd->hash_lock);
331 INIT_LIST_HEAD(&cd->queue); 331 INIT_LIST_HEAD(&cd->queue);
@@ -417,15 +417,15 @@ static int cache_clean(void)
417 current_index++; 417 current_index++;
418 418
419 /* find a cleanable entry in the bucket and clean it, or set to next bucket */ 419 /* find a cleanable entry in the bucket and clean it, or set to next bucket */
420 420
421 if (current_detail && current_index < current_detail->hash_size) { 421 if (current_detail && current_index < current_detail->hash_size) {
422 struct cache_head *ch, **cp; 422 struct cache_head *ch, **cp;
423 struct cache_detail *d; 423 struct cache_detail *d;
424 424
425 write_lock(&current_detail->hash_lock); 425 write_lock(&current_detail->hash_lock);
426 426
427 /* Ok, now to clean this strand */ 427 /* Ok, now to clean this strand */
428 428
429 cp = & current_detail->hash_table[current_index]; 429 cp = & current_detail->hash_table[current_index];
430 ch = *cp; 430 ch = *cp;
431 for (; ch; cp= & ch->next, ch= *cp) { 431 for (; ch; cp= & ch->next, ch= *cp) {
@@ -477,9 +477,9 @@ static void do_cache_clean(struct work_struct *work)
477} 477}
478 478
479 479
480/* 480/*
481 * Clean all caches promptly. This just calls cache_clean 481 * Clean all caches promptly. This just calls cache_clean
482 * repeatedly until we are sure that every cache has had a chance to 482 * repeatedly until we are sure that every cache has had a chance to
483 * be fully cleaned 483 * be fully cleaned
484 */ 484 */
485void cache_flush(void) 485void cache_flush(void)
@@ -508,7 +508,7 @@ void cache_purge(struct cache_detail *detail)
508 * All deferred requests are stored in a hash table, 508 * All deferred requests are stored in a hash table,
509 * indexed by "struct cache_head *". 509 * indexed by "struct cache_head *".
510 * As it may be wasteful to store a whole request 510 * As it may be wasteful to store a whole request
511 * structure, we allow the request to provide a 511 * structure, we allow the request to provide a
512 * deferred form, which must contain a 512 * deferred form, which must contain a
513 * 'struct cache_deferred_req' 513 * 'struct cache_deferred_req'
514 * This cache_deferred_req contains a method to allow 514 * This cache_deferred_req contains a method to allow
@@ -584,7 +584,7 @@ static void cache_revisit_request(struct cache_head *item)
584 584
585 INIT_LIST_HEAD(&pending); 585 INIT_LIST_HEAD(&pending);
586 spin_lock(&cache_defer_lock); 586 spin_lock(&cache_defer_lock);
587 587
588 lp = cache_defer_hash[hash].next; 588 lp = cache_defer_hash[hash].next;
589 if (lp) { 589 if (lp) {
590 while (lp != &cache_defer_hash[hash]) { 590 while (lp != &cache_defer_hash[hash]) {
@@ -614,7 +614,7 @@ void cache_clean_deferred(void *owner)
614 614
615 INIT_LIST_HEAD(&pending); 615 INIT_LIST_HEAD(&pending);
616 spin_lock(&cache_defer_lock); 616 spin_lock(&cache_defer_lock);
617 617
618 list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) { 618 list_for_each_entry_safe(dreq, tmp, &cache_defer_list, recent) {
619 if (dreq->owner == owner) { 619 if (dreq->owner == owner) {
620 list_del(&dreq->hash); 620 list_del(&dreq->hash);
@@ -639,7 +639,7 @@ void cache_clean_deferred(void *owner)
639 * On write, an update request is processed 639 * On write, an update request is processed
640 * Poll works if anything to read, and always allows write 640 * Poll works if anything to read, and always allows write
641 * 641 *
642 * Implemented by linked list of requests. Each open file has 642 * Implemented by linked list of requests. Each open file has
643 * a ->private that also exists in this list. New request are added 643 * a ->private that also exists in this list. New request are added
644 * to the end and may wakeup and preceding readers. 644 * to the end and may wakeup and preceding readers.
645 * New readers are added to the head. If, on read, an item is found with 645 * New readers are added to the head. If, on read, an item is found with
@@ -887,7 +887,7 @@ cache_release(struct inode *inode, struct file *filp)
887 887
888 888
889 889
890static struct file_operations cache_file_operations = { 890static const struct file_operations cache_file_operations = {
891 .owner = THIS_MODULE, 891 .owner = THIS_MODULE,
892 .llseek = no_llseek, 892 .llseek = no_llseek,
893 .read = cache_read, 893 .read = cache_read,
@@ -1059,10 +1059,10 @@ static int cache_make_upcall(struct cache_detail *detail, struct cache_head *h)
1059 * Messages are, like requests, separated into fields by 1059 * Messages are, like requests, separated into fields by
1060 * spaces and dequotes as \xHEXSTRING or embedded \nnn octal 1060 * spaces and dequotes as \xHEXSTRING or embedded \nnn octal
1061 * 1061 *
1062 * Message is 1062 * Message is
1063 * reply cachename expiry key ... content.... 1063 * reply cachename expiry key ... content....
1064 * 1064 *
1065 * key and content are both parsed by cache 1065 * key and content are both parsed by cache
1066 */ 1066 */
1067 1067
1068#define isodigit(c) (isdigit(c) && c <= '7') 1068#define isodigit(c) (isdigit(c) && c <= '7')
@@ -1132,7 +1132,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
1132 unsigned hash, entry; 1132 unsigned hash, entry;
1133 struct cache_head *ch; 1133 struct cache_head *ch;
1134 struct cache_detail *cd = ((struct handle*)m->private)->cd; 1134 struct cache_detail *cd = ((struct handle*)m->private)->cd;
1135 1135
1136 1136
1137 read_lock(&cd->hash_lock); 1137 read_lock(&cd->hash_lock);
1138 if (!n--) 1138 if (!n--)
@@ -1147,7 +1147,7 @@ static void *c_start(struct seq_file *m, loff_t *pos)
1147 do { 1147 do {
1148 hash++; 1148 hash++;
1149 n += 1LL<<32; 1149 n += 1LL<<32;
1150 } while(hash < cd->hash_size && 1150 } while(hash < cd->hash_size &&
1151 cd->hash_table[hash]==NULL); 1151 cd->hash_table[hash]==NULL);
1152 if (hash >= cd->hash_size) 1152 if (hash >= cd->hash_size)
1153 return NULL; 1153 return NULL;
@@ -1245,7 +1245,7 @@ static int content_release(struct inode *inode, struct file *file)
1245 return seq_release(inode, file); 1245 return seq_release(inode, file);
1246} 1246}
1247 1247
1248static struct file_operations content_file_operations = { 1248static const struct file_operations content_file_operations = {
1249 .open = content_open, 1249 .open = content_open,
1250 .read = seq_read, 1250 .read = seq_read,
1251 .llseek = seq_lseek, 1251 .llseek = seq_lseek,
@@ -1297,7 +1297,7 @@ static ssize_t write_flush(struct file * file, const char __user * buf,
1297 return count; 1297 return count;
1298} 1298}
1299 1299
1300static struct file_operations cache_flush_operations = { 1300static const struct file_operations cache_flush_operations = {
1301 .open = nonseekable_open, 1301 .open = nonseekable_open,
1302 .read = read_flush, 1302 .read = read_flush,
1303 .write = write_flush, 1303 .write = write_flush,