1. 03 11月, 2011 10 次提交
  2. 02 11月, 2011 1 次提交
    • E
      sysfs: Make sysfs_rename safe with sysfs_dirents in rbtrees. · f6d90b4f
      Eric W. Biederman 提交于
      In sysfs_rename we need to remove the optimization of not calling
      sysfs_unlink_sibling and sysfs_link_sibling if the renamed parent
      directory is not changing.  This optimization is no longer valid now
      that sysfs dirents are stored in an rbtree sorted by name.
      
      Move the assignment of s_ns before the call of sysfs_link_sibling.  With
      no sysfs_dirent fields changing after the call of sysfs_link_sibling
      this allows sysfs_link_sibling to take any of the directory entries into
      account when it builds the rbtrees, and s_ns looks like a prime canidate
      to be used in the rbtree in the future.
      Signed-off-by: NEric W. Biederman <ebiederm@xmission.com>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: David Miller <davem@davemloft.net>
      Cc: Mikulas Patocka <mpatocka@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f6d90b4f
  3. 01 11月, 2011 14 次提交
  4. 31 10月, 2011 5 次提交
  5. 28 10月, 2011 10 次提交
    • J
      leases: fix write-open/read-lease race · f3c7691e
      J. Bruce Fields 提交于
      In setlease, we use i_writecount to decide whether we can give out a
      read lease.
      
      In open, we break leases before incrementing i_writecount.
      
      There is therefore a window between the break lease and the i_writecount
      increment when setlease could add a new read lease.
      
      This would leave us with a simultaneous write open and read lease, which
      shouldn't happen.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      f3c7691e
    • A
      nfs: drop unnecessary locking in llseek · 79835a71
      Andi Kleen 提交于
      This makes NFS follow the standard generic_file_llseek locking scheme.
      
      Cc: Trond.Myklebust@netapp.com
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      79835a71
    • A
      ext4: replace cut'n'pasted llseek code with generic_file_llseek_size · 4cce0e28
      Andi Kleen 提交于
      This gives ext4 the benefits of unlocked llseek.
      
      Cc: tytso@mit.edu
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      4cce0e28
    • A
      vfs: add generic_file_llseek_size · 5760495a
      Andi Kleen 提交于
      Add a generic_file_llseek variant to the VFS that allows passing in
      the maximum file size of the file system, instead of always
      using maxbytes from the superblock.
      
      This can be used to eliminate some cut'n'paste seek code in ext4.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      5760495a
    • A
      vfs: do (nearly) lockless generic_file_llseek · ef3d0fd2
      Andi Kleen 提交于
      The i_mutex lock use of generic _file_llseek hurts.  Independent processes
      accessing the same file synchronize over a single lock, even though
      they have no need for synchronization at all.
      
      Under high utilization this can cause llseek to scale very poorly on larger
      systems.
      
      This patch does some rethinking of the llseek locking model:
      
      First the 64bit f_pos is not necessarily atomic without locks
      on 32bit systems. This can already cause races with read() today.
      This was discussed on linux-kernel in the past and deemed acceptable.
      The patch does not change that.
      
      Let's look at the different seek variants:
      
      SEEK_SET: Doesn't really need any locking.
      If there's a race one writer wins, the other loses.
      
      For 32bit the non atomic update races against read()
      stay the same. Without a lock they can also happen
      against write() now.  The read() race was deemed
      acceptable in past discussions, and I think if it's
      ok for read it's ok for write too.
      
      => Don't need a lock.
      
      SEEK_END: This behaves like SEEK_SET plus it reads
      the maximum size too. Reading the maximum size would have the
      32bit atomic problem. But luckily we already have a way to read
      the maximum size without locking (i_size_read), so we
      can just use that instead.
      
      Without i_mutex there is no synchronization with write() anymore,
      however since the write() update is atomic on 64bit it just behaves
      like another racy SEEK_SET.  On non atomic 32bit it's the same
      as SEEK_SET.
      
      => Don't need a lock, but need to use i_size_read()
      
      SEEK_CUR: This has a read-modify-write race window
      on the same file. One could argue that any application
      doing unsynchronized seeks on the same file is already broken.
      But for the sake of not adding a regression here I'm
      using the file->f_lock to synchronize this. Using this
      lock is much better than the inode mutex because it doesn't
      synchronize between processes.
      
      => So still need a lock, but can use a f_lock.
      
      This patch implements this new scheme in generic_file_llseek.
      I dropped generic_file_llseek_unlocked and changed all callers.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      ef3d0fd2
    • A
      direct-io: merge direct_io_walker into __blockdev_direct_IO · 847cc637
      Andi Kleen 提交于
      This doesn't change anything for the compiler, but hch thought it would
      make the code clearer.
      
      I moved the reference counting into its own little inline.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      847cc637
    • A
      direct-io: inline the complete submission path · ba253fbf
      Andi Kleen 提交于
      Add inlines to all the submission path functions. While this increases
      code size it also gives gcc a lot of optimization opportunities
      in this critical hotpath.
      
      In particular -- together with some other changes -- this
      allows gcc to get rid of the unnecessary clearing of
      sdio at the beginning and optimize the messy parameter passing.
      Any non inlining of a function which takes a sdio parameter
      would break this optimization because they cannot be done if the
      address of a structure is taken.
      
      Note that benefits are only seen with CONFIG_OPTIMIZE_INLINING
      and CONFIG_CC_OPTIMIZE_FOR_SIZE both set to off.
      
      This gives about 2.2% improvement on a large database benchmark
      with a high IOPS rate.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      ba253fbf
    • A
      direct-io: separate map_bh from dio · 18772641
      Andi Kleen 提交于
      Only a single b_private field in the map_bh buffer head is needed after
      the submission path. Move map_bh separately to avoid storing
      this information in the long term slab.
      
      This avoids the weird 104 byte hole in struct dio_submit which also needed
      to be memseted early.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      18772641
    • A
      direct-io: use a slab cache for struct dio · 6e8267f5
      Andi Kleen 提交于
      A direct slab call is slightly faster than kmalloc and can be better cached
      per CPU. It also avoids rounding to the next kmalloc slab.
      
      In addition this enforces cache line alignment for struct dio to avoid
      any false sharing.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      6e8267f5
    • A
      direct-io: rearrange fields in dio/dio_submit to avoid holes · 0dc2bc49
      Andi Kleen 提交于
      Fix most problems reported by pahole.
      
      There is still a weird 104 byte hole after map_bh. I'm not sure what
      causes this.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Acked-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      0dc2bc49