Changeset 242 for ksyslog/trunk


Ignore:
Timestamp:
10/01/13 20:59:01 (11 years ago)
Author:
atzm
Message:

move ksyslog_queue_lock into struct ksyslog_queue

Location:
ksyslog/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ksyslog/trunk/ksyslog.c

    r241 r242  
    1212#include "ksyslog.h" 
    1313 
    14 static DEFINE_SPINLOCK(ksyslog_queue_lock); 
    1514static DEFINE_SPINLOCK(ksyslog_vfs_lock); 
    1615 
     16static struct ksyslog_queue ksyslog_queue; 
    1717static struct socket *ksyslog_rcv_sk = NULL; 
    1818 
    1919static struct delayed_work ksyslog_work; 
    2020static struct workqueue_struct *ksyslog_wq = NULL; 
    21  
    22 static struct ksyslog_queue ksyslog_queue; 
    2321 
    2422#ifdef CONFIG_PROC_FS 
     
    3331static ushort ksyslog_port = 514; 
    3432static char *ksyslog_path = "/var/log/ksyslog.log"; 
    35 static ulong ksyslog_queue_length = 2048; 
     33static ulong ksyslog_queue_length = 4096; 
    3634static ulong ksyslog_flush_interval = 45;  /* milliseconds */ 
    3735 
     
    4745        memset(queue, 0, sizeof(*queue)); 
    4846        INIT_LIST_HEAD(&queue->head); 
     47        spin_lock_init(&queue->lock); 
    4948        atomic64_set(&queue->nr_queued, 0); 
    5049        atomic64_set(&queue->nr_written, 0); 
     
    288287        ksyslog_queue_init(&write_queue); 
    289288 
    290         spin_lock_bh(&ksyslog_queue_lock); 
     289        spin_lock_bh(&ksyslog_queue.lock); 
    291290        ksyslog_entry_migrate(&ksyslog_queue, &write_queue); 
    292         spin_unlock_bh(&ksyslog_queue_lock); 
     291        spin_unlock_bh(&ksyslog_queue.lock); 
    293292 
    294293        if (atomic64_read(&write_queue.nr_queued) <= 0) 
     
    301300                spin_unlock(&ksyslog_vfs_lock); 
    302301 
    303                 spin_lock_bh(&ksyslog_queue_lock); 
     302                spin_lock_bh(&ksyslog_queue.lock); 
    304303                ksyslog_entry_migrate(&write_queue, &ksyslog_queue); 
    305                 spin_unlock_bh(&ksyslog_queue_lock); 
     304                spin_unlock_bh(&ksyslog_queue.lock); 
    306305 
    307306                goto out; 
     
    329328 
    330329restore: 
    331                 spin_lock_bh(&ksyslog_queue_lock); 
     330                spin_lock_bh(&ksyslog_queue.lock); 
    332331                if (unlikely(ksyslog_entry_add(&ksyslog_queue, entry))) { 
    333332                        atomic64_inc(&ksyslog_queue.nr_dropped); 
     
    335334                        call_rcu(&entry->rcu, ksyslog_entry_free); 
    336335                } 
    337                 spin_unlock_bh(&ksyslog_queue_lock); 
     336                spin_unlock_bh(&ksyslog_queue.lock); 
    338337        } 
    339338 
     
    366365                goto err; 
    367366 
    368         spin_lock_bh(&ksyslog_queue_lock); 
     367        spin_lock_bh(&ksyslog_queue.lock); 
    369368        err = ksyslog_entry_add(&ksyslog_queue, entry); 
    370         spin_unlock_bh(&ksyslog_queue_lock); 
     369        spin_unlock_bh(&ksyslog_queue.lock); 
    371370 
    372371        if (unlikely(err)) { 
  • ksyslog/trunk/ksyslog.h

    r241 r242  
    7474struct ksyslog_queue { 
    7575        struct list_head head; 
     76        spinlock_t lock; 
    7677        atomic64_t nr_queued; 
    7778        atomic64_t nr_written; 
Note: See TracChangeset for help on using the changeset viewer.