1. 04 Jun, 2020 2 commits
  2. 24 Sep, 2019 1 commit
  3. 05 Jun, 2019 1 commit
  4. 01 Feb, 2018 1 commit
  5. 04 Sep, 2015 1 commit
  6. 11 Sep, 2013 2 commits
    • Jie Liu's avatar
      ocfs2: fix the end cluster offset of FIEMAP · 28e8be31
      Jie Liu authored
      Call fiemap ioctl(2) with given start offset as well as an desired mapping
      range should show extents if possible.  However, we somehow figure out the
      end offset of mapping via 'mapping_end -= cpos' before iterating the
      extent records which would cause problems if the given fiemap length is
      too small to a cluster size, e.g,
      Cluster size 4096:
      debugfs.ocfs2 1.6.3
              Block Size Bits: 12   Cluster Size Bits: 12
      The extended fiemap test utility From David:
      # dd if=/dev/urandom of=/ocfs2/test_file bs=1M count=1000
      # ./fiemap /ocfs2/test_file 4096 10
      start: 4096, length: 10
      File /ocfs2/test_file has 0 extents:
      #	Logical          Physical         Length           Flags
      	^^^^^ <-- No extent is shown
      In this case, at ocfs2_fiemap(): cpos == mapping_end == 1. Hence the
      loop of searching extent records was not executed at all.
      This patch remove the in question 'mapping_end -= cpos', and loops
      until the cpos is larger than the mapping_end as usual.
      # ./fiemap /ocfs2/test_file 4096 10
      start: 4096, length: 10
      File /ocfs2/test_file has 1 extents:
      #	Logical          Physical         Length           Flags
      0:	0000000000000000 0000000056a01000 0000000006a00000 0000
      Signed-off-by: default avatarJie Liu <jeff.liu@oracle.com>
      Reported-by: default avatarDavid Weber <wb@munzinger.de>
      Tested-by: default avatarDavid Weber <wb@munzinger.de>
      Cc: Sunil Mushran <sunil.mushran@gmail.com>
      Cc: Mark Fashen <mfasheh@suse.de>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    • Junxiao Bi's avatar
      ocfs2: use i_size_read() to access i_size · f17c20dd
      Junxiao Bi authored
      Though ocfs2 uses inode->i_mutex to protect i_size, there are both
      i_size_read/write() and direct accesses.  Clean up all direct access to
      eliminate confusion.
      Signed-off-by: default avatarJunxiao Bi <junxiao.bi@oracle.com>
      Cc: Jie Liu <jeff.liu@oracle.com>
      Cc: Mark Fasheh <mfasheh@suse.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
  7. 24 May, 2013 1 commit
  8. 22 Feb, 2013 1 commit
  9. 18 Dec, 2012 1 commit
  10. 04 Jul, 2012 1 commit
    • Jeff Liu's avatar
      ocfs2: for SEEK_DATA/SEEK_HOLE, return internal error unchanged if... · 65622e64
      Jeff Liu authored
      ocfs2: for SEEK_DATA/SEEK_HOLE, return internal error unchanged if ocfs2_get_clusters_nocache() or ocfs2_inode_lock() call failed.
      Since ENXIO only means "offset beyond EOF" for SEEK_DATA/SEEK_HOLE,
      Hence we should return the internal error unchanged if ocfs2_inode_lock() or
      ocfs2_get_clusters_nocache() call failed rather than ENXIO.
      Otherwise, it will confuse the user applications when they trying to understand the root cause.
      Thanks Dave for pointing this out.
      Cc: Dave Chinner <david@fromorbit.com>
      Signed-off-by: default avatarJie Liu <jeff.liu@oracle.com>
      Signed-off-by: default avatarJoel Becker <jlbec@evilplan.org>
  11. 25 Jul, 2011 1 commit
    • Sunil Mushran's avatar
      ocfs2: Implement llseek() · 93862d5e
      Sunil Mushran authored
      ocfs2 implements its own llseek() to provide the SEEK_HOLE/SEEK_DATA
      SEEK_HOLE sets the file pointer to the start of either a hole or an unwritten
      (preallocated) extent, that is greater than or equal to the supplied offset.
      SEEK_DATA sets the file pointer to the start of an allocated extent (not
      unwritten) that is greater than or equal to the supplied offset.
      If the supplied offset is on a desired region, then the file pointer is set
      to it. Offsets greater than or equal to the file size return -ENXIO.
      Unwritten (preallocated) extents are considered holes because the file system
      treats reads to such regions in the same way as it does to holes.
      Signed-off-by: default avatarSunil Mushran <sunil.mushran@oracle.com>
  12. 22 Feb, 2011 1 commit
  13. 07 Mar, 2011 1 commit
    • Tao Ma's avatar
      ocfs2: Remove EXIT from masklog. · c1e8d35e
      Tao Ma authored
      mlog_exit is used to record the exit status of a function.
      But because it is added in so many functions, if we enable it,
      the system logs get filled up quickly and cause too much I/O.
      So actually no one can open it for a production system or even
      for a test.
      This patch just try to remove it or change it. So:
      1. if all the error paths already use mlog_errno, it is just removed.
         Otherwise, it will be replaced by mlog_errno.
      2. if it is used to print some return value, it is replaced with
      mlog_exit_ptr is changed to mlog(0.
      All those mlog(0,...) will be replaced with trace events later.
      Signed-off-by: default avatarTao Ma <boyu.mt@taobao.com>
  14. 21 Feb, 2011 1 commit
    • Tao Ma's avatar
      ocfs2: Remove ENTRY from masklog. · ef6b689b
      Tao Ma authored
      ENTRY is used to record the entry of a function.
      But because it is added in so many functions, if we enable it,
      the system logs get filled up quickly and cause too much I/O.
      So actually no one can open it for a production system or even
      for a test.
      So for mlog_entry_void, we just remove it.
      for mlog_entry(...), we replace it with mlog(0,...), and they
      will be replace by trace event later.
      Signed-off-by: default avatarTao Ma <boyu.mt@taobao.com>
  15. 30 Mar, 2010 1 commit
    • Tejun Heo's avatar
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo authored
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      The script does the followings.
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
      The conversion was done in the following steps.
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
      6. percpu.h was updated not to include slab.h.
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Guess-its-ok-by: default avatarChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
  16. 09 Feb, 2010 1 commit
  17. 05 Feb, 2010 1 commit
  18. 24 Dec, 2009 1 commit
  19. 18 Dec, 2009 1 commit
  20. 23 Sep, 2009 2 commits
  21. 04 Sep, 2009 3 commits
  22. 05 Jan, 2009 3 commits
    • Joel Becker's avatar
      ocfs2: Wrap virtual block reads in ocfs2_read_virt_blocks() · a8549fb5
      Joel Becker authored
      The ocfs2_read_dir_block() function really maps an inode's virtual
      blocks to physical ones before calling ocfs2_read_blocks().  Let's
      extract that to common code, because other places might want to do that.
      Other than the block number being virtual, ocfs2_read_virt_blocks()
      takes the same arguments as ocfs2_read_blocks().  It converts those
      virtual block numbers to physical before calling ocfs2_read_blocks()
      directly.  If the blocks asked for are discontiguous, this can mean
      multiple calls to ocfs2_read_blocks(), but this is mostly hidden from
      the caller.
      Like ocfs2_read_blocks(), the caller can pass in an existing
      buffer_head.  This is usually done to pick up some readahead I/O.
      ocfs2_read_virt_blocks() checks the buffer_head's block number
      against the extent map - it must match.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Joel Becker's avatar
      ocfs2: Wrap extent block reads in a dedicated function. · 5e96581a
      Joel Becker authored
      We weren't consistently checking extent blocks after we read them.
      Most places checked the signature, but none checked h_blkno or
      h_fs_signature.  Create a toplevel ocfs2_read_extent_block() that does
      the read and the validation.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
    • Joel Becker's avatar
      ocfs2: Wrap inode block reads in a dedicated function. · b657c95c
      Joel Becker authored
      The ocfs2 code currently reads inodes off disk with a simple
      ocfs2_read_block() call.  Each place that does this has a different set
      of sanity checks it performs.  Some check only the signature.  A couple
      validate the block number (the block read vs di->i_blkno).  A couple
      others check for VALID_FL.  Only one place validates i_fs_generation.  A
      couple check nothing.  Even when an error is found, they don't all do
      the same thing.
      We wrap inode reading into ocfs2_read_inode_block().  This will validate
      all the above fields, going readonly if they are invalid (they never
      should be).  ocfs2_read_inode_block_full() is provided for the places
      that want to pass read_block flags.  Every caller is passing a struct
      inode with a valid ip_blkno, so we don't need a separate blkno argument
      We will remove the validation checks from the rest of the code in a
      later commit, as they are no longer necessary.
      Signed-off-by: default avatarJoel Becker <joel.becker@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
  23. 14 Oct, 2008 2 commits
  24. 13 Oct, 2008 1 commit
    • Tao Ma's avatar
      ocfs2: Add extent tree operation for xattr value btrees · f56654c4
      Tao Ma authored
      Add some thin wrappers around ocfs2_insert_extent() for each of the 3
      different btree types, ocfs2_inode_insert_extent(),
      ocfs2_xattr_value_insert_extent() and ocfs2_xattr_tree_insert_extent(). The
      last is for the xattr index btree, which will be used in a followup patch.
      All the old callers in file.c etc will call ocfs2_dinode_insert_extent(),
      while the other two handle the xattr issue. And the init of extent tree are
      handled by these functions.
      When storing xattr value which is too large, we will allocate some clusters
      for it and here ocfs2_extent_list and ocfs2_extent_rec will also be used. In
      order to re-use the b-tree operation code, a new parameter named "private"
      is added into ocfs2_extent_tree and it is used to indicate the root of
      ocfs2_exent_list. The reason is that we can't deduce the root from the
      buffer_head now. It may be in an inode, an ocfs2_xattr_block or even worse,
      in any place in an ocfs2_xattr_bucket.
      Signed-off-by: default avatarTao Ma <tao.ma@oracle.com>
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
  25. 03 Oct, 2008 1 commit
    • Mark Fasheh's avatar
      ocfs2: fiemap support · 00dc417f
      Mark Fasheh authored
      Plug ocfs2 into ->fiemap. Some portions of ocfs2_get_clusters() had to be
      refactored so that the extent cache can be skipped in favor of going
      directly to the on-disk records. This makes it easier for us to determine
      which extent is the last one in the btree. Also, I'm not sure we want to be
      caching fiemap lookups anyway as they're not directly related to data
      Signed-off-by: default avatarMark Fasheh <mfasheh@suse.com>
      Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
      Cc: ocfs2-devel@oss.oracle.com
      Cc: linux-fsdevel@vger.kernel.org
  26. 12 Oct, 2007 1 commit
  27. 11 Jul, 2007 2 commits
  28. 26 Apr, 2007 4 commits
    • Mark Fasheh's avatar
      ocfs2: Cache extent records · 83418978
      Mark Fasheh authored
      The extent map code was ripped out earlier because of an inability to deal
      with holes. This patch adds back a simpler caching scheme requiring far less
      Our old extent map caching was designed back when meta data block caching in
      Ocfs2 didn't work very well, resulting in many disk reads. These days our
      metadata caching is much better, resulting in no un-necessary disk reads. As
      a result, extent caching doesn't have to be as fancy, nor does it have to
      cache as many extents. Keeping the last 3 extents seen should be sufficient
      to give us a small performance boost on some streaming workloads.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: Fix extent lookup to return true size of holes · 4f902c37
      Mark Fasheh authored
      Initially, we had wired things to return a size '1' of holes. Cook up a
      small amount of code to find the next extent and calculate the number of
      clusters between the virtual offset and the next allocated extent.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: Read from an unwritten extent returns zeros · 49cb8d2d
      Mark Fasheh authored
      Return an optional extent flags field from our lookup functions and wire up
      callers to treat unwritten regions as holes for the purpose of returning
      zeros to the user.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>
    • Mark Fasheh's avatar
      ocfs2: make room for unwritten extents flag · e48edee2
      Mark Fasheh authored
      Due to the size of our group bitmaps, we'll never have a leaf node extent
      record with more than 16 bits worth of clusters. Split e_clusters up so that
      leaf nodes can get a flags field where we can mark unwritten extents.
      Interior nodes whose length references all the child nodes beneath it can't
      split their e_clusters field, so we use a union to preserve sizing there.
      Signed-off-by: default avatarMark Fasheh <mark.fasheh@oracle.com>