Merge branch 'master'
authorSteven Whitehouse <swhiteho@redhat.com>
Fri, 31 Mar 2006 20:34:58 +0000 (15:34 -0500)
committerSteven Whitehouse <swhiteho@redhat.com>
Fri, 31 Mar 2006 20:34:58 +0000 (15:34 -0500)
1  2 
Documentation/ioctl-number.txt
fs/Kconfig
fs/Makefile
include/linux/fs.h
include/linux/kernel.h
kernel/printk.c
mm/filemap.c
mm/readahead.c

index 7d5ce496f39f5698096304f6c98a5432a3abc933,171a44ebd939175e4bf1f8ff0821773babd0eb9e..93a86ac23cddb21180f3a39b4e002fcda43aa4f3
@@@ -78,8 -78,6 +78,6 @@@ Code  Seq#    Include File            Comment
  '#'   00-3F   IEEE 1394 Subsystem     Block for the entire subsystem
  '1'   00-1F   <linux/timepps.h>       PPS kit from Ulrich Windl
                                        <ftp://ftp.de.kernel.org/pub/linux/daemons/ntp/PPS/>
- '6'   00-10   <asm-i386/processor.h>  Intel IA32 microcode update driver
-                                       <mailto:tigran@veritas.com>
  '8'   all                             SNP8023 advanced NIC card
                                        <mailto:mcr@solidum.com>
  'A'   00-1F   linux/apm_bios.h
  'e'   00-1F   linux/video_encoder.h   conflict!
  'e'   00-1F   net/irda/irtty.h        conflict!
  'f'   00-1F   linux/ext2_fs.h
 +'g'   00-1F   linux/gfs2_ioctl.h
  'h'   00-7F                           Charon filesystem
                                        <mailto:zapman@interlan.net>
  'i'   00-3F   linux/i2o.h
diff --combined fs/Kconfig
index 14bcce80034670922f87d5de16efeea1a4390da7,e207be68d4cadb63eb4e90570110fb92f50449ba..62ee097776f0cede02b98c3ff935b95109a66ae1
@@@ -323,7 -323,6 +323,7 @@@ config FS_POSIX_AC
        default n
  
  source "fs/xfs/Kconfig"
 +source "fs/gfs2/Kconfig"
  
  config OCFS2_FS
        tristate "OCFS2 file system support (EXPERIMENTAL)"
@@@ -860,18 -859,6 +860,6 @@@ config RAMF
          To compile this as a module, choose M here: the module will be called
          ramfs.
  
- config RELAYFS_FS
-       tristate "Relayfs file system support"
-       ---help---
-         Relayfs is a high-speed data relay filesystem designed to provide
-         an efficient mechanism for tools and facilities to relay large
-         amounts of data from kernel space to user space.
-         To compile this code as a module, choose M here: the module will be
-         called relayfs.
-         If unsure, say N.
  config CONFIGFS_FS
        tristate "Userspace-driven configuration filesystem (EXPERIMENTAL)"
        depends on EXPERIMENTAL
@@@ -1568,6 -1555,7 +1556,7 @@@ config RPCSEC_GSS_SPKM
        select CRYPTO
        select CRYPTO_MD5
        select CRYPTO_DES
+       select CRYPTO_CAST5
        help
          Provides for secure RPC calls by means of a gss-api
          mechanism based on the SPKM3 public-key mechanism.
@@@ -1829,7 -1817,6 +1818,7 @@@ source "fs/partitions/Kconfig
  endmenu
  
  source "fs/nls/Kconfig"
 +source "fs/dlm/Kconfig"
  
  endmenu
  
diff --combined fs/Makefile
index b298f4fdc6f2faa7d6f56eb294923d92718dd346,f3a4f7077175484429b9b856f57e1419e84ab57b..414484ac48c1a85e0f7f9a466e51b85a6fa7715f
@@@ -10,7 -10,7 +10,7 @@@ obj-y :=      open.o read_write.o file_table
                ioctl.o readdir.o select.o fifo.o locks.o dcache.o inode.o \
                attr.o bad_inode.o file.o filesystems.o namespace.o aio.o \
                seq_file.o xattr.o libfs.o fs-writeback.o mpage.o direct-io.o \
-               ioprio.o pnode.o drop_caches.o
+               ioprio.o pnode.o drop_caches.o splice.o
  
  obj-$(CONFIG_INOTIFY)         += inotify.o
  obj-$(CONFIG_EPOLL)           += eventpoll.o
@@@ -48,7 -48,6 +48,7 @@@ obj-$(CONFIG_SYSFS)           += sysfs
  obj-y                         += devpts/
  
  obj-$(CONFIG_PROFILING)               += dcookies.o
 +obj-$(CONFIG_DLM)             += dlm/
   
  # Do not add any filesystems before this line
  obj-$(CONFIG_REISERFS_FS)     += reiserfs/
@@@ -92,7 -91,6 +92,6 @@@ obj-$(CONFIG_AUTOFS4_FS)      += autofs4
  obj-$(CONFIG_ADFS_FS)         += adfs/
  obj-$(CONFIG_FUSE_FS)         += fuse/
  obj-$(CONFIG_UDF_FS)          += udf/
- obj-$(CONFIG_RELAYFS_FS)      += relayfs/
  obj-$(CONFIG_SUN_OPENPROMFS)  += openpromfs/
  obj-$(CONFIG_JFS_FS)          += jfs/
  obj-$(CONFIG_XFS_FS)          += xfs/
@@@ -104,4 -102,3 +103,4 @@@ obj-$(CONFIG_HPPFS)                += hppfs
  obj-$(CONFIG_DEBUG_FS)                += debugfs/
  obj-$(CONFIG_CONFIGFS_FS)     += configfs/
  obj-$(CONFIG_OCFS2_FS)                += ocfs2/
 +obj-$(CONFIG_GFS2_FS)           += gfs2/
diff --combined include/linux/fs.h
index 1cc2518f008c94c6455424745558d292f43f0320,20fa5f6d7269f8ccfed3bafc93eda805959d7ce8..e5ce62e9676d337ce5aff991f8356a970c03002a
@@@ -65,6 -65,11 +65,11 @@@ extern int dir_notify_enable
  #define FMODE_PREAD   8
  #define FMODE_PWRITE  FMODE_PREAD     /* These go hand in hand */
  
+ /* File is being opened for execution. Primary users of this flag are
+    distributed filesystems that can use it to achieve correct ETXTBUSY
+    behavior for cross-node execution/opening_for_writing of files */
+ #define FMODE_EXEC    16
  #define RW_MASK               1
  #define RWA_MASK      2
  #define READ 0
  #define MS_BIND               4096
  #define MS_MOVE               8192
  #define MS_REC                16384
- #define MS_VERBOSE    32768
+ #define MS_VERBOSE    32768   /* War is peace. Verbosity is silence.
+                                  MS_VERBOSE is deprecated. */
+ #define MS_SILENT     32768
  #define MS_POSIXACL   (1<<16) /* VFS does not apply the umask */
  #define MS_UNBINDABLE (1<<17) /* change to unbindable */
  #define MS_PRIVATE    (1<<18) /* change to private */
  #define BLKBSZGET  _IOR(0x12,112,size_t)
  #define BLKBSZSET  _IOW(0x12,113,size_t)
  #define BLKGETSIZE64 _IOR(0x12,114,size_t)    /* return device size in bytes (u64 *arg) */
+ #define BLKTRACESETUP _IOWR(0x12,115,struct blk_user_trace_setup)
+ #define BLKTRACESTART _IO(0x12,116)
+ #define BLKTRACESTOP _IO(0x12,117)
+ #define BLKTRACETEARDOWN _IO(0x12,118)
  
  #define BMAP_IOCTL 1          /* obsolete - kept for compatibility */
  #define FIBMAP           _IO(0x00,1)  /* bmap access */
@@@ -241,9 -252,6 +252,6 @@@ extern void __init files_init(unsigned 
  struct buffer_head;
  typedef int (get_block_t)(struct inode *inode, sector_t iblock,
                        struct buffer_head *bh_result, int create);
- typedef int (get_blocks_t)(struct inode *inode, sector_t iblock,
-                       unsigned long max_blocks,
-                       struct buffer_head *bh_result, int create);
  typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
                        ssize_t bytes, void *private);
  
@@@ -339,12 -347,12 +347,12 @@@ struct writeback_control
  struct address_space_operations {
        int (*writepage)(struct page *page, struct writeback_control *wbc);
        int (*readpage)(struct file *, struct page *);
-       int (*sync_page)(struct page *);
+       void (*sync_page)(struct page *);
  
        /* Write back some dirty pages from this mapping. */
        int (*writepages)(struct address_space *, struct writeback_control *);
  
-       /* Set a page dirty */
+       /* Set a page dirty.  Return true if this dirtied it */
        int (*set_page_dirty)(struct page *page);
  
        int (*readpages)(struct file *filp, struct address_space *mapping,
        int (*commit_write)(struct file *, struct page *, unsigned, unsigned);
        /* Unfortunately this kludge is needed for FIBMAP. Don't use it */
        sector_t (*bmap)(struct address_space *, sector_t);
-       int (*invalidatepage) (struct page *, unsigned long);
+       void (*invalidatepage) (struct page *, unsigned long);
        int (*releasepage) (struct page *, gfp_t);
        ssize_t (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
                        loff_t offset, unsigned long nr_segs);
@@@ -397,11 -405,14 +405,14 @@@ struct block_device 
        dev_t                   bd_dev;  /* not a kdev_t - it's a search key */
        struct inode *          bd_inode;       /* will die */
        int                     bd_openers;
-       struct semaphore        bd_sem; /* open/close mutex */
-       struct semaphore        bd_mount_sem;   /* mount mutex */
+       struct mutex            bd_mutex;       /* open/close mutex */
+       struct mutex            bd_mount_mutex; /* mount mutex */
        struct list_head        bd_inodes;
        void *                  bd_holder;
        int                     bd_holders;
+ #ifdef CONFIG_SYSFS
+       struct list_head        bd_holder_list;
+ #endif
        struct block_device *   bd_contains;
        unsigned                bd_block_size;
        struct hd_struct *      bd_part;
@@@ -479,13 -490,13 +490,13 @@@ struct inode 
        unsigned int            i_blkbits;
        unsigned long           i_blksize;
        unsigned long           i_version;
-       unsigned long           i_blocks;
+       blkcnt_t                i_blocks;
        unsigned short          i_bytes;
        spinlock_t              i_lock; /* i_blocks, i_bytes, maybe i_size */
        struct mutex            i_mutex;
        struct rw_semaphore     i_alloc_sem;
        struct inode_operations *i_op;
-       struct file_operations  *i_fop; /* former ->i_op->default_file_ops */
+       const struct file_operations    *i_fop; /* former ->i_op->default_file_ops */
        struct super_block      *i_sb;
        struct file_lock        *i_flock;
        struct address_space    *i_mapping;
  
  #ifdef CONFIG_INOTIFY
        struct list_head        inotify_watches; /* watches on this inode */
-       struct semaphore        inotify_sem;    /* protects the watches list */
+       struct mutex            inotify_mutex;  /* protects the watches list */
  #endif
  
        unsigned long           i_state;
@@@ -625,7 -636,7 +636,7 @@@ struct file 
        } f_u;
        struct dentry           *f_dentry;
        struct vfsmount         *f_vfsmnt;
-       struct file_operations  *f_op;
+       const struct file_operations    *f_op;
        atomic_t                f_count;
        unsigned int            f_flags;
        mode_t                  f_mode;
@@@ -667,7 -678,6 +678,6 @@@ extern spinlock_t files_lock
  #define FL_POSIX      1
  #define FL_FLOCK      2
  #define FL_ACCESS     8       /* not trying to lock, just looking */
- #define FL_LOCKD      16      /* lock held by rpc.lockd */
  #define FL_LEASE      32      /* lease held on this file */
  #define FL_SLEEP      128     /* A blocking lock */
  
@@@ -731,8 -741,6 +741,6 @@@ struct file_lock 
  #define OFFT_OFFSET_MAX       INT_LIMIT(off_t)
  #endif
  
- extern struct list_head file_lock_list;
  #include <linux/fcntl.h>
  
  extern int fcntl_getlk(struct file *, struct flock __user *);
@@@ -754,10 -762,10 +762,10 @@@ extern void locks_init_lock(struct file
  extern void locks_copy_lock(struct file_lock *, struct file_lock *);
  extern void locks_remove_posix(struct file *, fl_owner_t);
  extern void locks_remove_flock(struct file *);
- extern struct file_lock *posix_test_lock(struct file *, struct file_lock *);
+ extern int posix_test_lock(struct file *, struct file_lock *, struct file_lock *);
+ extern int posix_lock_file_conf(struct file *, struct file_lock *, struct file_lock *);
  extern int posix_lock_file(struct file *, struct file_lock *);
  extern int posix_lock_file_wait(struct file *, struct file_lock *);
- extern void posix_block_lock(struct file_lock *, struct file_lock *);
  extern int posix_unblock_lock(struct file *, struct file_lock *);
  extern int posix_locks_deadlock(struct file_lock *, struct file_lock *);
  extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
@@@ -847,7 -855,7 +855,7 @@@ struct super_block 
         * The next field is for VFS *only*. No filesystems have any business
         * even looking at it. You had been warned.
         */
-       struct semaphore s_vfs_rename_sem;      /* Kludge */
+       struct mutex s_vfs_rename_mutex;        /* Kludge */
  
        /* Granuality of c/m/atime in ns.
           Cannot be worse than a second */
@@@ -1024,6 -1032,8 +1032,8 @@@ struct file_operations 
        int (*check_flags)(int);
        int (*dir_notify)(struct file *filp, unsigned long arg);
        int (*flock) (struct file *, int, struct file_lock *);
+       ssize_t (*splice_write)(struct inode *, struct file *, size_t, unsigned int);
+       ssize_t (*splice_read)(struct file *, struct inode *, size_t, unsigned int);
  };
  
  struct inode_operations {
@@@ -1086,6 -1096,7 +1096,7 @@@ struct super_operations 
        void (*umount_begin) (struct super_block *);
  
        int (*show_options)(struct seq_file *, struct vfsmount *);
+       int (*show_stats)(struct seq_file *, struct vfsmount *);
  
        ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
        ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
@@@ -1115,6 -1126,18 +1126,18 @@@ static inline void mark_inode_dirty_syn
        __mark_inode_dirty(inode, I_DIRTY_SYNC);
  }
  
+ static inline void inode_inc_link_count(struct inode *inode)
+ {
+       inode->i_nlink++;
+       mark_inode_dirty(inode);
+ }
+ static inline void inode_dec_link_count(struct inode *inode)
+ {
+       inode->i_nlink--;
+       mark_inode_dirty(inode);
+ }
  extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
  static inline void file_accessed(struct file *file)
  {
@@@ -1299,9 -1322,6 +1322,9 @@@ extern struct subsystem fs_subsys
  #define FLOCK_VERIFY_READ  1
  #define FLOCK_VERIFY_WRITE 2
  
 +/* /sys/fs */
 +extern struct subsystem fs_subsys;
 +
  extern int locks_mandatory_locked(struct inode *);
  extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
  
@@@ -1372,11 -1392,11 +1395,11 @@@ extern void bd_set_size(struct block_de
  extern void bd_forget(struct inode *inode);
  extern void bdput(struct block_device *);
  extern struct block_device *open_by_devnum(dev_t, unsigned);
- extern struct file_operations def_blk_fops;
+ extern const struct file_operations def_blk_fops;
  extern struct address_space_operations def_blk_aops;
- extern struct file_operations def_chr_fops;
- extern struct file_operations bad_sock_fops;
- extern struct file_operations def_fifo_fops;
+ extern const struct file_operations def_chr_fops;
+ extern const struct file_operations bad_sock_fops;
+ extern const struct file_operations def_fifo_fops;
  extern int ioctl_by_bdev(struct block_device *, unsigned, unsigned long);
  extern int blkdev_ioctl(struct inode *, struct file *, unsigned, unsigned long);
  extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
@@@ -1384,12 -1404,19 +1407,19 @@@ extern int blkdev_get(struct block_devi
  extern int blkdev_put(struct block_device *);
  extern int bd_claim(struct block_device *, void *);
  extern void bd_release(struct block_device *);
+ #ifdef CONFIG_SYSFS
+ extern int bd_claim_by_disk(struct block_device *, void *, struct gendisk *);
+ extern void bd_release_from_disk(struct block_device *, struct gendisk *);
+ #else
+ #define bd_claim_by_disk(bdev, holder, disk)  bd_claim(bdev, holder)
+ #define bd_release_from_disk(bdev, disk)      bd_release(bdev)
+ #endif
  
  /* fs/char_dev.c */
  extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *);
  extern int register_chrdev_region(dev_t, unsigned, const char *);
  extern int register_chrdev(unsigned int, const char *,
-                          struct file_operations *);
+                          const struct file_operations *);
  extern int unregister_chrdev(unsigned int, const char *);
  extern void unregister_chrdev_region(dev_t, unsigned);
  extern int chrdev_open(struct inode *, struct file *);
@@@ -1419,9 -1446,9 +1449,9 @@@ extern void init_special_inode(struct i
  extern void make_bad_inode(struct inode *);
  extern int is_bad_inode(struct inode *);
  
- extern struct file_operations read_fifo_fops;
- extern struct file_operations write_fifo_fops;
- extern struct file_operations rdwr_fifo_fops;
+ extern const struct file_operations read_fifo_fops;
+ extern const struct file_operations write_fifo_fops;
+ extern const struct file_operations rdwr_fifo_fops;
  
  extern int fs_may_remount_ro(struct super_block *);
  
@@@ -1458,6 -1485,12 +1488,12 @@@ extern int filemap_fdatawait(struct add
  extern int filemap_write_and_wait(struct address_space *mapping);
  extern int filemap_write_and_wait_range(struct address_space *mapping,
                                        loff_t lstart, loff_t lend);
+ extern int wait_on_page_writeback_range(struct address_space *mapping,
+                               pgoff_t start, pgoff_t end);
+ extern int __filemap_fdatawrite_range(struct address_space *mapping,
+                               loff_t start, loff_t end, int sync_mode);
+ extern long do_fsync(struct file *file, int datasync);
  extern void sync_supers(void);
  extern void sync_filesystems(int wait);
  extern void emergency_sync(void);
@@@ -1537,7 -1570,6 +1573,6 @@@ extern void destroy_inode(struct inode 
  extern struct inode *new_inode(struct super_block *);
  extern int remove_suid(struct dentry *);
  extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
- extern struct semaphore iprune_sem;
  
  extern void __insert_inode_hash(struct inode *, unsigned long hashval);
  extern void remove_inode_hash(struct inode *);
@@@ -1579,6 -1611,8 +1614,8 @@@ extern ssize_t generic_file_sendfile(st
  extern void do_generic_mapping_read(struct address_space *mapping,
                                    struct file_ra_state *, struct file *,
                                    loff_t *, read_descriptor_t *, read_actor_t);
+ extern ssize_t generic_file_splice_read(struct file *, struct inode *, size_t, unsigned int);
+ extern ssize_t generic_file_splice_write(struct inode *, struct file *, size_t, unsigned int);
  extern void
  file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
  extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, 
@@@ -1622,7 -1656,7 +1659,7 @@@ static inline void do_generic_file_read
  
  ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
        struct block_device *bdev, const struct iovec *iov, loff_t offset,
-       unsigned long nr_segs, get_blocks_t get_blocks, dio_iodone_t end_io,
+       unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
        int lock_type);
  
  enum {
  
  static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
        struct inode *inode, struct block_device *bdev, const struct iovec *iov,
-       loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks,
+       loff_t offset, unsigned long nr_segs, get_block_t get_block,
        dio_iodone_t end_io)
  {
        return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
-                               nr_segs, get_blocks, end_io, DIO_LOCKING);
+                               nr_segs, get_block, end_io, DIO_LOCKING);
  }
  
  static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
        struct inode *inode, struct block_device *bdev, const struct iovec *iov,
-       loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks,
+       loff_t offset, unsigned long nr_segs, get_block_t get_block,
        dio_iodone_t end_io)
  {
        return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
-                               nr_segs, get_blocks, end_io, DIO_NO_LOCKING);
+                               nr_segs, get_block, end_io, DIO_NO_LOCKING);
  }
  
  static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
        struct inode *inode, struct block_device *bdev, const struct iovec *iov,
-       loff_t offset, unsigned long nr_segs, get_blocks_t get_blocks,
+       loff_t offset, unsigned long nr_segs, get_block_t get_block,
        dio_iodone_t end_io)
  {
        return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
-                               nr_segs, get_blocks, end_io, DIO_OWN_LOCKING);
+                               nr_segs, get_block, end_io, DIO_OWN_LOCKING);
  }
  
- extern struct file_operations generic_ro_fops;
+ extern const struct file_operations generic_ro_fops;
  
  #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m))
  
@@@ -1714,9 -1748,9 +1751,9 @@@ extern int simple_commit_write(struct f
  
  extern struct dentry *simple_lookup(struct inode *, struct dentry *, struct nameidata *);
  extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);
- extern struct file_operations simple_dir_operations;
+ extern const struct file_operations simple_dir_operations;
  extern struct inode_operations simple_dir_inode_operations;
- struct tree_descr { char *name; struct file_operations *ops; int mode; };
+ struct tree_descr { char *name; const struct file_operations *ops; int mode; };
  struct dentry *d_alloc_name(struct dentry *, const char *);
  extern int simple_fill_super(struct super_block *, int, struct tree_descr *);
  extern int simple_pin_fs(char *name, struct vfsmount **mount, int *count);
diff --combined include/linux/kernel.h
index f789278a625aebe881ecc37bcdf6d34889541445,a3720f973ea58f5ce6515366de2e95acff03f667..c73ed0b05591ab97ba07e61d7020e53a10dbee5f
@@@ -29,7 -29,6 +29,7 @@@ extern const char linux_banner[]
  
  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
  #define ALIGN(x,a) (((x)+(a)-1)&~((a)-1))
 +#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
  
  #define       KERN_EMERG      "<0>"   /* system is unusable                   */
  #define       KERN_ALERT      "<1>"   /* action must be taken immediately     */
@@@ -88,10 -87,13 +88,13 @@@ extern int cond_resched(void)
                (__x < 0) ? -__x : __x;         \
        })
  
- extern struct notifier_block *panic_notifier_list;
+ extern struct atomic_notifier_head panic_notifier_list;
  extern long (*panic_blink)(long time);
  NORET_TYPE void panic(const char * fmt, ...)
        __attribute__ ((NORET_AND format (printf, 1, 2)));
+ extern void oops_enter(void);
+ extern void oops_exit(void);
+ extern int oops_may_print(void);
  fastcall NORET_TYPE void do_exit(long error_code)
        ATTRIB_NORET;
  NORET_TYPE void complete_and_exit(struct completion *, long)
@@@ -152,9 -154,10 +155,10 @@@ static inline int __attribute_pure__ lo
        return r;
  }
  
- static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x)
+ static inline unsigned long
+ __attribute_const__ roundup_pow_of_two(unsigned long x)
  {
-       return (1UL << fls(x - 1));
+       return 1UL << fls_long(x - 1);
  }
  
  extern int printk_ratelimit(void);
diff --combined kernel/printk.c
index 7ba79ad895e4c41e9b4b658b10a37ab496008c51,8cc19431e74ba1d5c52095e7c0f97c56f6018734..891f7a7140371d08fa28ff6ea851f15d4475ed94
@@@ -122,44 -122,6 +122,6 @@@ static char *log_buf = __log_buf
  static int log_buf_len = __LOG_BUF_LEN;
  static unsigned long logged_chars; /* Number of chars produced since last read+clear operation */
  
- /*
-  *    Setup a list of consoles. Called from init/main.c
-  */
- static int __init console_setup(char *str)
- {
-       char name[sizeof(console_cmdline[0].name)];
-       char *s, *options;
-       int idx;
-       /*
-        *      Decode str into name, index, options.
-        */
-       if (str[0] >= '0' && str[0] <= '9') {
-               strcpy(name, "ttyS");
-               strncpy(name + 4, str, sizeof(name) - 5);
-       } else
-               strncpy(name, str, sizeof(name) - 1);
-       name[sizeof(name) - 1] = 0;
-       if ((options = strchr(str, ',')) != NULL)
-               *(options++) = 0;
- #ifdef __sparc__
-       if (!strcmp(str, "ttya"))
-               strcpy(name, "ttyS0");
-       if (!strcmp(str, "ttyb"))
-               strcpy(name, "ttyS1");
- #endif
-       for (s = name; *s; s++)
-               if ((*s >= '0' && *s <= '9') || *s == ',')
-                       break;
-       idx = simple_strtoul(s, NULL, 10);
-       *s = 0;
-       add_preferred_console(name, idx, options);
-       return 1;
- }
- __setup("console=", console_setup);
  static int __init log_buf_len_setup(char *str)
  {
        unsigned long size = memparse(str, &str);
@@@ -659,6 -621,44 +621,44 @@@ static void call_console_drivers(unsign
  
  #endif
  
+ /*
+  * Set up a list of consoles.  Called from init/main.c
+  */
+ static int __init console_setup(char *str)
+ {
+       char name[sizeof(console_cmdline[0].name)];
+       char *s, *options;
+       int idx;
+       /*
+        * Decode str into name, index, options.
+        */
+       if (str[0] >= '0' && str[0] <= '9') {
+               strcpy(name, "ttyS");
+               strncpy(name + 4, str, sizeof(name) - 5);
+       } else {
+               strncpy(name, str, sizeof(name) - 1);
+       }
+       name[sizeof(name) - 1] = 0;
+       if ((options = strchr(str, ',')) != NULL)
+               *(options++) = 0;
+ #ifdef __sparc__
+       if (!strcmp(str, "ttya"))
+               strcpy(name, "ttyS0");
+       if (!strcmp(str, "ttyb"))
+               strcpy(name, "ttyS1");
+ #endif
+       for (s = name; *s; s++)
+               if ((*s >= '0' && *s <= '9') || *s == ',')
+                       break;
+       idx = simple_strtoul(s, NULL, 10);
+       *s = 0;
+       add_preferred_console(name, idx, options);
+       return 1;
+ }
+ __setup("console=", console_setup);
  /**
   * add_preferred_console - add a device to the list of preferred consoles.
   * @name: device name
@@@ -999,7 -999,6 +999,7 @@@ void tty_write_message(struct tty_struc
                tty->driver->write(tty, msg, strlen(msg));
        return;
  }
 +EXPORT_SYMBOL_GPL(tty_write_message);
  
  /*
   * printk rate limiting, lifted from the networking subsystem.
diff --combined mm/filemap.c
index 7624c26fcea68cd53991298793c364cf707a3415,3ef20739e7252232c5822cbeed6e22eaa5247d0c..1120338a5d0f5d8273339ccdc59c5142f64603ff
  #include <linux/blkdev.h>
  #include <linux/security.h>
  #include <linux/syscalls.h>
+ #include <linux/cpuset.h>
  #include "filemap.h"
+ #include "internal.h"
  /*
   * FIXME: remove all knowledge of the buffer layer from the core VM
   */
@@@ -172,7 -175,7 +175,7 @@@ static int sync_page(void *word
   * dirty pages that lie within the byte offsets <start, end>
   * @mapping:  address space structure to write
   * @start:    offset in bytes where the range starts
-  * @end:      offset in bytes where the range ends
+  * @end:      offset in bytes where the range ends (inclusive)
   * @sync_mode:        enable synchronous operation
   *
   * If sync_mode is WB_SYNC_ALL then this is a "data integrity" operation, as
   * these two operations is that if a dirty page/buffer is encountered, it must
   * be waited upon, and not just skipped over.
   */
static int __filemap_fdatawrite_range(struct address_space *mapping,
-       loff_t start, loff_t end, int sync_mode)
int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
+                               loff_t end, int sync_mode)
  {
        int ret;
        struct writeback_control wbc = {
@@@ -210,8 -213,8 +213,8 @@@ int filemap_fdatawrite(struct address_s
  }
  EXPORT_SYMBOL(filemap_fdatawrite);
  
- static int filemap_fdatawrite_range(struct address_space *mapping,
-       loff_t start, loff_t end)
+ static int filemap_fdatawrite_range(struct address_space *mapping, loff_t start,
+                               loff_t end)
  {
        return __filemap_fdatawrite_range(mapping, start, end, WB_SYNC_ALL);
  }
@@@ -230,7 -233,7 +233,7 @@@ EXPORT_SYMBOL(filemap_flush)
   * Wait for writeback to complete against pages indexed by start->end
   * inclusive
   */
static int wait_on_page_writeback_range(struct address_space *mapping,
+ int wait_on_page_writeback_range(struct address_space *mapping,
                                pgoff_t start, pgoff_t end)
  {
        struct pagevec pvec;
@@@ -365,6 -368,12 +368,12 @@@ int filemap_write_and_wait(struct addre
  }
  EXPORT_SYMBOL(filemap_write_and_wait);
  
+ /*
+  * Write out and wait upon file offsets lstart->lend, inclusive.
+  *
+  * Note that `lend' is inclusive (describes the last byte to be written) so
+  * that this function can be used to write to the very end-of-file (end = -1).
+  */
  int filemap_write_and_wait_range(struct address_space *mapping,
                                 loff_t lstart, loff_t lend)
  {
@@@ -425,6 -434,28 +434,28 @@@ int add_to_page_cache_lru(struct page *
        return ret;
  }
  
+ #ifdef CONFIG_NUMA
+ struct page *page_cache_alloc(struct address_space *x)
+ {
+       if (cpuset_do_page_mem_spread()) {
+               int n = cpuset_mem_spread_node();
+               return alloc_pages_node(n, mapping_gfp_mask(x), 0);
+       }
+       return alloc_pages(mapping_gfp_mask(x), 0);
+ }
+ EXPORT_SYMBOL(page_cache_alloc);
+ struct page *page_cache_alloc_cold(struct address_space *x)
+ {
+       if (cpuset_do_page_mem_spread()) {
+               int n = cpuset_mem_spread_node();
+               return alloc_pages_node(n, mapping_gfp_mask(x)|__GFP_COLD, 0);
+       }
+       return alloc_pages(mapping_gfp_mask(x)|__GFP_COLD, 0);
+ }
+ EXPORT_SYMBOL(page_cache_alloc_cold);
+ #endif
  /*
   * In order to wait for pages to become available there must be
   * waitqueues associated with pages. By using a hash table of
@@@ -981,7 -1012,6 +1012,7 @@@ success
        desc->arg.buf += size;
        return size;
  }
 +EXPORT_SYMBOL(file_read_actor);
  
  /*
   * This is the "read()" routine for all filesystems
diff --combined mm/readahead.c
index 9f0b98227b41c63873ca295c4da76f125af0ea3f,0f142a40984b1674228e067f491159d42b13f32d..ba7db816f4c8306e5ab305f472a048db134c3dfa
@@@ -38,7 -38,6 +38,7 @@@ file_ra_state_init(struct file_ra_stat
        ra->ra_pages = mapping->backing_dev_info->ra_pages;
        ra->prev_page = -1;
  }
 +EXPORT_SYMBOL_GPL(file_ra_state_init);
  
  /*
   * Return max readahead size for this inode in number-of-pages.
@@@ -53,13 -52,24 +53,24 @@@ static inline unsigned long get_min_rea
        return (VM_MIN_READAHEAD * 1024) / PAGE_CACHE_SIZE;
  }
  
+ static inline void reset_ahead_window(struct file_ra_state *ra)
+ {
+       /*
+        * ... but preserve ahead_start + ahead_size value,
+        * see 'recheck:' label in page_cache_readahead().
+        * Note: We never use ->ahead_size as rvalue without
+        * checking ->ahead_start != 0 first.
+        */
+       ra->ahead_size += ra->ahead_start;
+       ra->ahead_start = 0;
+ }
  static inline void ra_off(struct file_ra_state *ra)
  {
        ra->start = 0;
        ra->flags = 0;
        ra->size = 0;
-       ra->ahead_start = 0;
-       ra->ahead_size = 0;
+       reset_ahead_window(ra);
        return;
  }
  
@@@ -73,10 -83,10 +84,10 @@@ static unsigned long get_init_ra_size(u
  {
        unsigned long newsize = roundup_pow_of_two(size);
  
-       if (newsize <= max / 64)
-               newsize = newsize * newsize;
+       if (newsize <= max / 32)
+               newsize = newsize * 4;
        else if (newsize <= max / 4)
-               newsize = max / 4;
+               newsize = newsize * 2;
        else
                newsize = max;
        return newsize;
@@@ -427,8 -437,7 +438,7 @@@ static int make_ahead_window(struct add
                 * congestion.  The ahead window will any way be closed
                 * in case we failed due to excessive page cache hits.
                 */
-               ra->ahead_start = 0;
-               ra->ahead_size = 0;
+               reset_ahead_window(ra);
        }
  
        return ret;
@@@ -521,11 -530,11 +531,11 @@@ page_cache_readahead(struct address_spa
         * If we get here we are doing sequential IO and this was not the first
         * occurence (ie we have an existing window)
         */
        if (ra->ahead_start == 0) {      /* no ahead window yet */
                if (!make_ahead_window(mapping, filp, ra, 0))
-                       goto out;
+                       goto recheck;
        }
        /*
         * Already have an ahead window, check if we crossed into it.
         * If so, shift windows and issue a new ahead window.
                ra->start = ra->ahead_start;
                ra->size = ra->ahead_size;
                make_ahead_window(mapping, filp, ra, 0);
+ recheck:
+               /* prev_page shouldn't overrun the ahead window */
+               ra->prev_page = min(ra->prev_page,
+                       ra->ahead_start + ra->ahead_size - 1);
        }
  
  out:
        return ra->prev_page + 1;
  }
+ EXPORT_SYMBOL_GPL(page_cache_readahead);
  
  /*
   * handle_ra_miss() is called when it is known that a page which should have