]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - include/linux/fs.h
readahead: combine file_ra_state.prev_index/prev_offset into prev_pos
[linux-2.6.git] / include / linux / fs.h
index d33beadd9a43a0f14a85217d9f0ee852a70e15e0..500ffc0e4ac7856f4cd9487794f2cdd9ed35195e 100644 (file)
@@ -697,16 +697,14 @@ struct fown_struct {
  * Track a single file's readahead state
  */
 struct file_ra_state {
-       pgoff_t start;                  /* where readahead started */
-       unsigned long size;             /* # of readahead pages */
-       unsigned long async_size;       /* do asynchronous readahead when
+       pgoff_t start;                  /* where readahead started */
+       unsigned int size;              /* # of readahead pages */
+       unsigned int async_size;        /* do asynchronous readahead when
                                           there are only # of pages ahead */
 
-       unsigned long ra_pages;         /* Maximum readahead window */
-       unsigned long mmap_hit;         /* Cache hit stat for mmap accesses */
-       unsigned long mmap_miss;        /* Cache miss stat for mmap accesses */
-       unsigned long prev_index;       /* Cache last read() position */
-       unsigned int prev_offset;       /* Offset where last read() ended in a page */
+       unsigned int ra_pages;          /* Maximum readahead window */
+       int mmap_miss;                  /* Cache miss stat for mmap accesses */
+       loff_t prev_pos;                /* Cache last read() position */
 };
 
 /*
@@ -878,11 +876,12 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
-extern int setlease(struct file *, long, struct file_lock **);
+extern int generic_setlease(struct file *, long, struct file_lock **);
 extern int vfs_setlease(struct file *, long, struct file_lock **);
 extern int lease_modify(struct file_lock **, int);
 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
 extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
+extern struct seq_operations locks_seq_operations;
 
 struct fasync_struct {
        int     magic;
@@ -1302,8 +1301,14 @@ struct file_system_type {
        struct module *owner;
        struct file_system_type * next;
        struct list_head fs_supers;
+
        struct lock_class_key s_lock_key;
        struct lock_class_key s_umount_key;
+
+       struct lock_class_key i_lock_key;
+       struct lock_class_key i_mutex_key;
+       struct lock_class_key i_mutex_dir_key;
+       struct lock_class_key i_alloc_sem_key;
 };
 
 extern int get_sb_bdev(struct file_system_type *fs_type,
@@ -1369,12 +1374,25 @@ extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size
  * Candidates for mandatory locking have the setgid bit set
  * but no group execute bit -  an otherwise meaningless combination.
  */
-#define MANDATORY_LOCK(inode) \
-       (IS_MANDLOCK(inode) && ((inode)->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID)
+
+static inline int __mandatory_lock(struct inode *ino)
+{
+       return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+}
+
+/*
+ * ... and these candidates should be on MS_MANDLOCK mounted fs,
+ * otherwise these will be advisory locks
+ */
+
+static inline int mandatory_lock(struct inode *ino)
+{
+       return IS_MANDLOCK(ino) && __mandatory_lock(ino);
+}
 
 static inline int locks_verify_locked(struct inode *inode)
 {
-       if (MANDATORY_LOCK(inode))
+       if (mandatory_lock(inode))
                return locks_mandatory_locked(inode);
        return 0;
 }
@@ -1385,7 +1403,7 @@ static inline int locks_verify_truncate(struct inode *inode,
                                    struct file *filp,
                                    loff_t size)
 {
-       if (inode->i_flock && MANDATORY_LOCK(inode))
+       if (inode->i_flock && mandatory_lock(inode))
                return locks_mandatory_area(
                        FLOCK_VERIFY_WRITE, inode, filp,
                        size < inode->i_size ? size : inode->i_size,
@@ -1659,7 +1677,6 @@ extern int sb_min_blocksize(struct super_block *, int);
 extern int generic_file_mmap(struct file *, struct vm_area_struct *);
 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
-extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);