]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - include/linux/fs.h
fs: scale files_lock
[net-next-2.6.git] / include / linux / fs.h
index a8ccf85b8691af9d5890aea18f255c905ca580ed..76041b6147582ef62eb0daedafbf1771a8e844c6 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/limits.h>
 #include <linux/ioctl.h>
+#include <linux/blk_types.h>
 
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -92,7 +93,7 @@ struct inodes_stat_t {
 #define FMODE_RANDOM           ((__force fmode_t)0x1000)
 
 /* File was opened by fanotify and shouldn't generate fanotify events */
-#define FMODE_NONOTIFY         ((__force fmode_t)16777216) /* 0x1000000 */
+#define FMODE_NONOTIFY         ((__force fmode_t)0x1000000)
 
 /*
  * The below are the various read and write types that we support. Some of
@@ -121,12 +122,9 @@ struct inodes_stat_t {
  *                     immediately wait on this read without caring about
  *                     unplugging.
  * READA               Used for read-ahead operations. Lower priority, and the
- *                      block layer could (in theory) choose to ignore this
+ *                     block layer could (in theory) choose to ignore this
  *                     request if it runs into resource problems.
  * WRITE               A normal async write. Device will be plugged.
- * SWRITE              Like WRITE, but a special case for ll_rw_block() that
- *                     tells it to lock the buffer first. Normally a buffer
- *                     must be locked before doing IO.
  * WRITE_SYNC_PLUG     Synchronous write. Identical to WRITE, but passes down
  *                     the hint that someone will be waiting on this IO
  *                     shortly. The device must still be unplugged explicitly,
@@ -137,10 +135,7 @@ struct inodes_stat_t {
  *                     immediately after submission. The write equivalent
  *                     of READ_SYNC.
  * WRITE_ODIRECT_PLUG  Special case write for O_DIRECT only.
- * SWRITE_SYNC
- * SWRITE_SYNC_PLUG    Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
- *                     See SWRITE.
- * WRITE_BARRIER       Like WRITE, but tells the block layer that all
+ * WRITE_BARRIER       Like WRITE_SYNC, but tells the block layer that all
  *                     previously submitted writes must be safely on storage
  *                     before this one is started. Also guarantees that when
  *                     this write is complete, it itself is also safely on
@@ -148,29 +143,29 @@ struct inodes_stat_t {
  *                     of this IO.
  *
  */
-#define RW_MASK                1
-#define RWA_MASK       2
-#define READ 0
-#define WRITE 1
-#define READA 2                /* read-ahead  - don't block if no resources */
-#define SWRITE 3       /* for ll_rw_block() - wait for buffer lock */
-#define READ_SYNC      (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
-#define READ_META      (READ | (1 << BIO_RW_META))
-#define WRITE_SYNC_PLUG        (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
-#define WRITE_SYNC     (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
-#define WRITE_ODIRECT_PLUG     (WRITE | (1 << BIO_RW_SYNCIO))
-#define WRITE_META     (WRITE | (1 << BIO_RW_META))
-#define SWRITE_SYNC_PLUG       \
-                       (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
-#define SWRITE_SYNC    (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
-#define WRITE_BARRIER  (WRITE | (1 << BIO_RW_BARRIER))
+#define RW_MASK                        REQ_WRITE
+#define RWA_MASK               REQ_RAHEAD
+
+#define READ                   0
+#define WRITE                  RW_MASK
+#define READA                  RWA_MASK
+
+#define READ_SYNC              (READ | REQ_SYNC | REQ_UNPLUG)
+#define READ_META              (READ | REQ_META)
+#define WRITE_SYNC_PLUG                (WRITE | REQ_SYNC | REQ_NOIDLE)
+#define WRITE_SYNC             (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
+#define WRITE_ODIRECT_PLUG     (WRITE | REQ_SYNC)
+#define WRITE_META             (WRITE | REQ_META)
+#define WRITE_BARRIER          (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
+                                REQ_HARDBARRIER)
 
 /*
  * These aren't really reads or writes, they pass down information about
  * parts of device that are now unused by the file system.
  */
-#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD))
-#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER))
+#define DISCARD_NOBARRIER      (WRITE | REQ_DISCARD)
+#define DISCARD_BARRIER                (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
+#define DISCARD_SECURE         (DISCARD_NOBARRIER | REQ_SECURE)
 
 #define SEL_IN         1
 #define SEL_OUT                2
@@ -314,6 +309,7 @@ struct inodes_stat_t {
 #define BLKALIGNOFF _IO(0x12,122)
 #define BLKPBSZGET _IO(0x12,123)
 #define BLKDISCARDZEROES _IO(0x12,124)
+#define BLKSECDISCARD _IO(0x12,125)
 
 #define BMAP_IOCTL 1           /* obsolete - kept for compatibility */
 #define FIBMAP    _IO(0x00,1)  /* bmap access */
@@ -924,6 +920,9 @@ struct file {
 #define f_vfsmnt       f_path.mnt
        const struct file_operations    *f_op;
        spinlock_t              f_lock;  /* f_ep_links, f_flags, no IRQ */
+#ifdef CONFIG_SMP
+       int                     f_sb_list_cpu;
+#endif
        atomic_long_t           f_count;
        unsigned int            f_flags;
        fmode_t                 f_mode;
@@ -948,9 +947,6 @@ struct file {
        unsigned long f_mnt_write_state;
 #endif
 };
-extern spinlock_t files_lock;
-#define file_list_lock() spin_lock(&files_lock);
-#define file_list_unlock() spin_unlock(&files_lock);
 
 #define get_file(x)    atomic_long_inc(&(x)->f_count)
 #define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
@@ -1341,7 +1337,11 @@ struct super_block {
 
        struct list_head        s_inodes;       /* all inodes */
        struct hlist_head       s_anon;         /* anonymous dentries for (nfs) exporting */
+#ifdef CONFIG_SMP
+       struct list_head __percpu *s_files;
+#else
        struct list_head        s_files;
+#endif
        /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
        struct list_head        s_dentry_lru;   /* unused dentry lru */
        int                     s_nr_dentry_unused;     /* # of dentry on lru */
@@ -1478,8 +1478,8 @@ struct block_device_operations;
 
 /*
  * NOTE:
- * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl
- * can be called without the big kernel lock held in all filesystems.
+ * all file operations except setlease can be called without
+ * the big kernel lock held in all filesystems.
  */
 struct file_operations {
        struct module *owner;
@@ -1490,7 +1490,6 @@ struct file_operations {
        ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
        int (*readdir) (struct file *, void *, filldir_t);
        unsigned int (*poll) (struct file *, struct poll_table_struct *);
-       int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
@@ -2193,10 +2192,7 @@ static inline void insert_inode_hash(struct inode *inode) {
        __insert_inode_hash(inode, inode->i_ino);
 }
 
-extern void file_move(struct file *f, struct list_head *list);
-extern void file_kill(struct file *f);
 #ifdef CONFIG_BLOCK
-struct bio;
 extern void submit_bio(int, struct bio *);
 extern int bdev_read_only(struct block_device *);
 #endif
@@ -2263,7 +2259,6 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
 #endif
 
 #ifdef CONFIG_BLOCK
-struct bio;
 typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
                            loff_t file_offset);
 
@@ -2317,10 +2312,10 @@ void inode_set_bytes(struct inode *inode, loff_t bytes);
 
 extern int vfs_readdir(struct file *, filldir_t, void *);
 
-extern int vfs_stat(char __user *, struct kstat *);
-extern int vfs_lstat(char __user *, struct kstat *);
+extern int vfs_stat(const char __user *, struct kstat *);
+extern int vfs_lstat(const char __user *, struct kstat *);
 extern int vfs_fstat(unsigned int, struct kstat *);
-extern int vfs_fstatat(int , char __user *, struct kstat *, int);
+extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
 
 extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
                    unsigned long arg);