aboutsummaryrefslogtreecommitdiffstats
path: root/fs/file_table.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/file_table.c')
-rw-r--r--fs/file_table.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 70f2a0fd6aec..a305d9e2d1b2 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -34,7 +34,6 @@ struct files_stat_struct files_stat = {
34 .max_files = NR_FILE 34 .max_files = NR_FILE
35}; 35};
36 36
37DECLARE_LGLOCK(files_lglock);
38DEFINE_LGLOCK(files_lglock); 37DEFINE_LGLOCK(files_lglock);
39 38
40/* SLAB cache for file structures */ 39/* SLAB cache for file structures */
@@ -421,9 +420,9 @@ static inline void __file_sb_list_add(struct file *file, struct super_block *sb)
421 */ 420 */
422void file_sb_list_add(struct file *file, struct super_block *sb) 421void file_sb_list_add(struct file *file, struct super_block *sb)
423{ 422{
424 lg_local_lock(files_lglock); 423 lg_local_lock(&files_lglock);
425 __file_sb_list_add(file, sb); 424 __file_sb_list_add(file, sb);
426 lg_local_unlock(files_lglock); 425 lg_local_unlock(&files_lglock);
427} 426}
428 427
429/** 428/**
@@ -436,9 +435,9 @@ void file_sb_list_add(struct file *file, struct super_block *sb)
436void file_sb_list_del(struct file *file) 435void file_sb_list_del(struct file *file)
437{ 436{
438 if (!list_empty(&file->f_u.fu_list)) { 437 if (!list_empty(&file->f_u.fu_list)) {
439 lg_local_lock_cpu(files_lglock, file_list_cpu(file)); 438 lg_local_lock_cpu(&files_lglock, file_list_cpu(file));
440 list_del_init(&file->f_u.fu_list); 439 list_del_init(&file->f_u.fu_list);
441 lg_local_unlock_cpu(files_lglock, file_list_cpu(file)); 440 lg_local_unlock_cpu(&files_lglock, file_list_cpu(file));
442 } 441 }
443} 442}
444 443
@@ -485,7 +484,7 @@ void mark_files_ro(struct super_block *sb)
485 struct file *f; 484 struct file *f;
486 485
487retry: 486retry:
488 lg_global_lock(files_lglock); 487 lg_global_lock(&files_lglock);
489 do_file_list_for_each_entry(sb, f) { 488 do_file_list_for_each_entry(sb, f) {
490 struct vfsmount *mnt; 489 struct vfsmount *mnt;
491 if (!S_ISREG(f->f_path.dentry->d_inode->i_mode)) 490 if (!S_ISREG(f->f_path.dentry->d_inode->i_mode))
@@ -502,12 +501,12 @@ retry:
502 file_release_write(f); 501 file_release_write(f);
503 mnt = mntget(f->f_path.mnt); 502 mnt = mntget(f->f_path.mnt);
504 /* This can sleep, so we can't hold the spinlock. */ 503 /* This can sleep, so we can't hold the spinlock. */
505 lg_global_unlock(files_lglock); 504 lg_global_unlock(&files_lglock);
506 mnt_drop_write(mnt); 505 mnt_drop_write(mnt);
507 mntput(mnt); 506 mntput(mnt);
508 goto retry; 507 goto retry;
509 } while_file_list_for_each_entry; 508 } while_file_list_for_each_entry;
510 lg_global_unlock(files_lglock); 509 lg_global_unlock(&files_lglock);
511} 510}
512 511
513void __init files_init(unsigned long mempages) 512void __init files_init(unsigned long mempages)
@@ -525,6 +524,6 @@ void __init files_init(unsigned long mempages)
525 n = (mempages * (PAGE_SIZE / 1024)) / 10; 524 n = (mempages * (PAGE_SIZE / 1024)) / 10;
526 files_stat.max_files = max_t(unsigned long, n, NR_FILE); 525 files_stat.max_files = max_t(unsigned long, n, NR_FILE);
527 files_defer_init(); 526 files_defer_init();
528 lg_lock_init(files_lglock); 527 lg_lock_init(&files_lglock, "files_lglock");
529 percpu_counter_init(&nr_files, 0); 528 percpu_counter_init(&nr_files, 0);
530} 529}