1. 25 10月, 2011 5 次提交
    • B
      ore: Enable RAID5 mounts · 44231e68
      Boaz Harrosh 提交于
      Now that we support raid5 Enable it at mount. Raid6 will come next
      raid4 is not demanded for so it will probably not be enabled.
      (Until some one wants it)
      
      NOTE: That mkfs.exofs had support for raid5/6 since long time
      ago. (Making an empty raidX FS is just as easy as raid0 ;-} )
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      44231e68
    • B
      exofs: Support for RAID5 read-4-write interface. · dd296619
      Boaz Harrosh 提交于
      The ore need suplied a r4w_get_page/r4w_put_page API
      from Filesystem so it can get cache pages to read-into when
      writing parial stripes.
      
      Also I commented out and NULLed the .writepage (singular)
      vector. Because it gives terrible write pattern to raid
      and is apparently not needed. Even in OOM conditions the
      system copes (even better) with out it.
      
      TODO: How to specify to write_cache_pages() to start
            or include a certain page?
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      dd296619
    • B
      ore: RAID5 Write · 769ba8d9
      Boaz Harrosh 提交于
      This is finally the RAID5 Write support.
      
      The bigger part of this patch is not the XOR engine itself, But the
      read4write logic, which is a complete mini prepare_for_striping
      reading engine that can read scattered pages of a stripe into cache
      so it can be used for XOR calculation. That is, if the write was not
      stripe aligned.
      
      The main algorithm behind the XOR engine is the 2 dimensional array:
      	struct __stripe_pages_2d.
      A drawing might save 1000 words
      ---
      
      __stripe_pages_2d
             |
       n = pages_in_stripe_unit;
       w = group_width - parity;
             |                            pages array presented to the XOR lib
             |                                                |
             V                                                |
       __1_page_stripe[0].pages --> [c0][c1]..[cw][c_par] <---|
             |                                                |
       __1_page_stripe[1].pages --> [c0][c1]..[cw][c_par] <---
             |
      ...    |                         ...
             |
       __1_page_stripe[n].pages --> [c0][c1]..[cw][c_par]
                                     ^
                                     |
                 data added columns first then row
      
      ---
      The pages are put on this array columns first. .i.e:
      	p0-of-c0, p1-of-c0, ... pn-of-c0, p0-of-c1, ...
      So we are doing a corner turn of the pages.
      
      Note that pages will zigzag down and left. but are put sequentially
      in growing order. So when the time comes to XOR the stripe, only the
      beginning and end of the array need be checked. We scan the array
      and any NULL spot will be field by pages-to-be-read.
      
      The FS that wants to support RAID5 needs to supply an
      operations-vector that searches a given page in cache, and specifies
      if the page is uptodate or need reading. All these pages to be read
      are put on a slave ore_io_state and synchronously read. All the pages
      of a stripe are read in one IO, using the scatter gather mechanism.
      
      In write we constrain our IO to only be incomplete on a single
      stripe. Meaning either the complete IO is within a single stripe so
      we might have pages to read from both beginning  or end of the
      strip. Or we have some reading to do at beginning but end at strip
      boundary. The left over pages are pushed to the next IO by the API
      already established by previous work, where an IO offset/length
      combination presented to the ORE might get the length truncated and
      the user must re-submit the leftover pages. (Both exofs and NFS
      support this)
      
      But any ORE user should make it's best effort to align it's IO
      before hand and avoid complications. A cached ore_layout->stripe_size
      member can be used for that calculation. (NOTE: that ORE demands
      that stripe_size may not be bigger then 32bit)
      
      What else? Well read it and tell me.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      769ba8d9
    • B
      ore: RAID5 read · a1fec1db
      Boaz Harrosh 提交于
      This patch introduces the first stage of RAID5 support
      mainly the skip-over-raid-units when reading. For
      writes it inserts BLANK units, into where XOR blocks
      should be calculated and written to.
      
      It introduces the new "general raid maths", and the main
      additional parameters and components needed for raid5.
      
      Since at this stage it could corrupt future version that
      actually do support raid5. The enablement of raid5
      mounting and setting of parity-count > 0 is disabled. So
      the raid5 code will never be used. Mounting of raid5 is
      only enabled later once the basic XOR write is also in.
      But if the patch "enable RAID5" is applied this code has
      been tested to be able to properly read raid5 volumes
      and is according to standard.
      
      Also it has been tested that the new maths still properly
      supports RAID0 and grouping code just as before.
      (BTW: I have found more bugs in the pnfs-obj RAID math
       fixed here)
      
      The ore.c file is getting too big, so new ore_raid.[hc]
      files are added that will include the special raid stuff
      that are not used in striping and mirrors. In future write
      support these will get bigger.
      When adding the ore_raid.c to Kbuild file I was forced to
      rename ore.ko to libore.ko. Is it possible to keep source
      file, say ore.c and module file ore.ko the same even if there
      are multiple files inside ore.ko?
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      a1fec1db
    • B
      ore: Make ore_calc_stripe_info EXPORT_SYMBOL · 611d7a5d
      Boaz Harrosh 提交于
      ore_calc_stripe_info is needed by exofs::export.c
      for the layout calculations. Make it exportable
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      611d7a5d
  2. 15 10月, 2011 8 次提交
    • B
      ore/exofs: Change ore_check_io API · 4b46c9f5
      Boaz Harrosh 提交于
      Current ore_check_io API receives a residual
      pointer, to report partial IO. But it is actually
      not used, because in a multiple devices IO there
      is never a linearity in the IO failure.
      
      On the other hand if every failing device is reported
      through a received callback measures can be taken to
      handle only failed devices. One at a time.
      
      This will also be needed by the objects-layout-driver
      for it's error reporting facility.
      
      Exofs is not currently using the new information and
      keeps the old behaviour of failing the complete IO in
      case of an error. (No partial completion)
      
      TODO: Use an ore_check_io callback to set_page_error only
      the failing pages. And re-dirty write pages.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      4b46c9f5
    • B
      ore/exofs: Define new ore_verify_layout · 5a51c0c7
      Boaz Harrosh 提交于
      All users of the ore will need to check if current code
      supports the given layout. For example RAID5/6 is not
      currently supported.
      
      So move all the checks from exofs/super.c to a new
      ore_verify_layout() to be used by ore users.
      
      Note that any new layout should be passed through the
      ore_verify_layout() because the ore engine will prepare
      and verify some internal members of ore_layout, and
      assumes it's called.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      5a51c0c7
    • B
      ore: Support for partial component table · 3bd98568
      Boaz Harrosh 提交于
      Users like the objlayout-driver would like to only pass
      a partial device table that covers the IO in question.
      For example exofs divides the file into raid-group-sized
      chunks and only serves group_width number of devices at
      a time.
      
      The partiality is communicated by setting
      ore_componets->first_dev and the array covers all logical
      devices from oc->first_dev upto (oc->first_dev + oc->numdevs)
      
      The ore_comp_dev() API receives a logical device index
      and returns the actual present device in the table.
      An out-of-range dev_index will BUG.
      
      Logical device index is the theoretical device index as if
      all the devices of a file are present. .i.e:
      	total_devs = group_width * mirror_p1 * group_count
      	0 <= dev_index < total_devs
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      3bd98568
    • B
      ore: Support for short read/writes · bbf9a31b
      Boaz Harrosh 提交于
      Memory conditions and max_bio constraints might cause us to
      not comply to the full length of the requested IO. Instead of
      failing the complete IO we can issue a shorter read/write and
      report how much was actually executed in the ios->length
      member.
      
      All users must check ios->length at IO_done or upon return of
      ore_read/write and re-issue the reminder of the bytes. Because
      other wise there is no error returned like before.
      
      This is part of the effort to support the pnfs-obj layout driver.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      bbf9a31b
    • B
      exofs: Support for short read/writes · 154a9300
      Boaz Harrosh 提交于
      If at read/write_done the actual IO was shorter then requested,
      reported in returned ios->length. It is not an error. The reminder
      of the pages should just be unlocked but not marked uptodate or
      end_page_writeback. They will be re issued later by the VFS.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      154a9300
    • B
      ore: Remove check for ios->kern_buff in _prepare_for_striping to later · 6851a5e5
      Boaz Harrosh 提交于
      Move the check and preparation of the ios->kern_buff case to
      later inside _write_mirror().
      
      Since read was never used with ios->kern_buff its support is removed
      instead of fixed.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      6851a5e5
    • B
      ore: cleanup: Embed an ore_striping_info inside ore_io_state · 98260754
      Boaz Harrosh 提交于
      Now that each ore_io_state covers only a single raid group.
      A single striping_info math is needed. Embed one inside
      ore_io_state to cache the calculation results and eliminate
      an extra call.
      
      Also the outer _prepare_for_striping is removed since it does nothing.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      98260754
    • B
      ore: Only IO one group at a time (API change) · b916c5cd
      Boaz Harrosh 提交于
      Usually a single IO is confined to one group of devices
      (group_width) and at the boundary of a raid group it can
      spill into a second group. Current code would allocate a
      full device_table size array at each io_state so it can
      comply to requests that span two groups. Needless to say
      that is very wasteful, specially when device_table count
      can get very large (hundreds even thousands), while a
      group_width is usually 8 or 10.
      
      * Change ore API to trim on IO that spans two raid groups.
        The user passes offset+length to ore_get_rw_state, the
        ore might trim on that length if spanning a group boundary.
        The user must check ios->length or ios->nrpages to see
        how much IO will be preformed. It is the responsibility
        of the user to re-issue the reminder of the IO.
      
      * Modify exofs To copy spilled pages on to the next IO.
        This means one last kick is needed after all coalescing
        of pages is done.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      b916c5cd
  3. 04 10月, 2011 1 次提交
    • B
      ore/exofs: Change the type of the devices array (API change) · d866d875
      Boaz Harrosh 提交于
      In the pNFS obj-LD the device table at the layout level needs
      to point to a device_cache node, where it is possible and likely
      that many layouts will point to the same device-nodes.
      
      In Exofs we have a more orderly structure where we have a single
      array of devices that repeats twice for a round-robin view of the
      device table
      
      This patch moves to a model that can be used by the pNFS obj-LD
      where struct ore_components holds an array of ore_dev-pointers.
      (ore_dev is newly defined and contains a struct osd_dev *od
       member)
      
      Each pointer in the array of pointers will point to a bigger
      user-defined dev_struct. That can be accessed by use of the
      container_of macro.
      
      In Exofs an __alloc_dev_table() function allocates the
      ore_dev-pointers array as well as an exofs_dev array, in one
      allocation and does the addresses dance to set everything pointing
      correctly. It still keeps the double allocation trick for the
      inodes round-robin view of the table.
      
      The device table is always allocated dynamically, also for the
      single device case. So it is unconditionally freed at umount.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      d866d875
  4. 03 10月, 2011 5 次提交
  5. 07 8月, 2011 5 次提交
    • B
      ore: Make ore its own module · cf283ade
      Boaz Harrosh 提交于
      Export everything from ore need exporting. Change Kbuild and Kconfig
      to build ore.ko as an independent module. Import ore from exofs
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      cf283ade
    • B
      exofs: Rename raid engine from exofs/ios.c => ore · 8ff660ab
      Boaz Harrosh 提交于
      ORE stands for "Objects Raid Engine"
      
      This patch is a mechanical rename of everything that was in ios.c
      and its API declaration to an ore.c and an osd_ore.h header. The ore
      engine will later be used by the pnfs objects layout driver.
      
      * File ios.c => ore.c
      
      * Declaration of types and API are moved from exofs.h to a new
        osd_ore.h
      
      * All used types are prefixed by ore_ from their exofs_ name.
      
      * Shift includes from exofs.h to osd_ore.h so osd_ore.h is
        independent, include it from exofs.h.
      
      Other than a pure rename there are no other changes. Next patch
      will move the ore into it's own module and will export the API
      to be used by exofs and later the layout driver
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      8ff660ab
    • B
      exofs: ios: Move to a per inode components & device-table · 9e9db456
      Boaz Harrosh 提交于
      Exofs raid engine was saving on memory space by having a single layout-info,
      single pid, and a single device-table, global to the filesystem. Then passing
      a credential and object_id info at the io_state level, private for each
      inode. It would also devise this contraption of rotating the device table
      view for each inode->ino to spread out the device usage.
      
      This is not compatible with the pnfs-objects standard, demanding that
      each inode can have it's own layout-info, device-table, and each object
      component it's own pid, oid and creds.
      
      So: Bring exofs raid engine to be usable for generic pnfs-objects use by:
      
      * Define an exofs_comp structure that holds obj_id and credential info.
      
      * Break up exofs_layout struct to an exofs_components structure that holds a
        possible array of exofs_comp and the array of devices + the size of the
        arrays.
      
      * Add a "comps" parameter to get_io_state() that specifies the ids creds
        and device array to use for each IO.
      
        This enables to keep the layout global, but the device-table view, creds
        and IDs at the inode level. It only adds two 64bit to each inode, since
        some of these members already existed in another form.
      
      * ios raid engine now access layout-info and comps-info through the passed
        pointers. Everything is pre-prepared by caller for generic access of
        these structures and arrays.
      
      At the exofs Level:
      
      * Super block holds an exofs_components struct that holds the device
        array, previously in layout. The devices there are in device-table
        order. The device-array is twice bigger and repeats the device-table
        twice so now each inode's device array can point to a random device
        and have a round-robin view of the table, making it compatible to
        previous exofs versions.
      
      * Each inode has an exofs_components struct that is initialized at
        load time, with it's own view of the device table IDs and creds.
        When doing IO this gets passed to the io_state together with the
        layout.
      
      While preforming this change. Bugs where found where credentials with the
      wrong IDs where used to access the different SB objects (super.c). As well
      as some dead code. It was never noticed because the target we use does not
      check the credentials.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9e9db456
    • B
      exofs: Move exofs specific osd operations out of ios.c · 85e44df4
      Boaz Harrosh 提交于
      ios.c will be moving to an external library, for use by the
      objects-layout-driver. Remove from it some exofs specific functions.
      
      Also g_attr_logical_length is used both by inode.c and ios.c
      move definition to the later, to keep it independent
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      85e44df4
    • B
      exofs: Add offset/length to exofs_get_io_state · e1042ba0
      Boaz Harrosh 提交于
      In future raid code we will need to know the IO offset/length
      and if it's a read or write to determine some of the array
      sizes we'll need.
      
      So add a new exofs_get_rw_state() API for use when
      writeing/reading. All other simple cases are left using the
      old way.
      
      The major change to this is that now we need to call
      exofs_get_io_state later at inode.c::read_exec and
      inode.c::write_exec when we actually know these things. So this
      patch is kept separate so I can test things apart from other
      changes.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      e1042ba0
  6. 05 8月, 2011 4 次提交
    • B
      exofs: Fix truncate for the raid-groups case · 16f75bb3
      Boaz Harrosh 提交于
      In the general raid-group case the truncate was wrong in that
      it did not also fix the object length of the neighboring groups.
      
      There are two bad cases in the old code:
      1. Space that should be freed was not.
      2. If a file That was big is truncated small, then made bigger
         again, the holes would not contain zeros but could expose old data.
         (If the growing of the file expands to more than a full
          groups cycle + group size (> S + T))
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      16f75bb3
    • B
      exofs: Small cleanup of exofs_fill_super · 9ce73047
      Boaz Harrosh 提交于
      Small cleanup that unifies duplicated code used in both the
      error and success cases
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9ce73047
    • B
      exofs: BUG: Avoid sbi realloc · 6d4073e8
      Boaz Harrosh 提交于
      Since the beginning we realloced the sbi structure when a bigger
      then one device table was specified. (I know that was really stupid).
      
      Then much later when "register bdi" was added (By Jens) it was
      registering the pointer to sbi->bdi before the realloc.
      
      We never saw this problem because up till now the realloc did not
      do anything since the device table was small enough to fit in the
      original allocation. But once we starting testing with large device
      tables (Bigger then 28) we noticed the crash of writeback operating
      on a deallocated pointer.
      
      * Avoid the all mess by allocating the device-table as a second array
        and get rid of the variable-sized structure and the rest of this
        mess.
      * Take the chance to clean near by structures and comments.
      * Add a needed dprint on startup to indicate the loaded layout.
      * Also move the bdi registration to the very end because it will
        only fail in a low memory, which will probably fail before hand.
        There are many more likely causes to not load before that. This
        way the error handling is made simpler. (Just doing this would be
        enough to fix the BUG)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      6d4073e8
    • B
      exofs: Remove pnfs-osd private definitions · 26ae93c2
      Boaz Harrosh 提交于
      Now that pnfs-osd has hit mainline we can remove exofs's
      private header. (And the FIXME comment)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      26ae93c2
  7. 21 7月, 2011 1 次提交
    • J
      fs: push i_mutex and filemap_write_and_wait down into ->fsync() handlers · 02c24a82
      Josef Bacik 提交于
      Btrfs needs to be able to control how filemap_write_and_wait_range() is called
      in fsync to make it less of a painful operation, so push down taking i_mutex and
      the calling of filemap_write_and_wait() down into the ->fsync() handlers.  Some
      file systems can drop taking the i_mutex altogether it seems, like ext3 and
      ocfs2.  For correctness sake I just pushed everything down in all cases to make
      sure that we keep the current behavior the same for everybody, and then each
      individual fs maintainer can make up their mind about what to do from there.
      Thanks,
      Acked-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      02c24a82
  8. 20 7月, 2011 1 次提交
  9. 18 7月, 2011 1 次提交
  10. 26 5月, 2011 3 次提交
  11. 31 3月, 2011 1 次提交
  12. 15 3月, 2011 5 次提交
    • B
      exofs: deprecate the commands pending counter · a49fb4c3
      Boaz Harrosh 提交于
      One leftover from the days of IBM's original code, is an SB counter
      that counts in-flight asynchronous commands. And a piece of code that
      waits for the counter to reach zero at unmount. I guess it might have
      been needed then, cause of some reference missing or something.
      
      I'm not removing it yet but am putting a warning message if ever this
      counter triggers at unmount. If I'll never see it triggers or reported
      I'll remove the counter for good.
      (I had this print as a debug output for a long time and never had it
       trigger)
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      a49fb4c3
    • B
      exofs: Write sbi->s_nextid as part of the Create command · 1cea312a
      Boaz Harrosh 提交于
      Before when creating a new inode, we'd set the sb->s_dirt flag,
      and sometime later the system would write out s_nextid as part
      of the sb_info. Also on inode sync we would force the sb sync
      as well.
      
      Define the s_nextid as a new partition attribute and set it
      every time we create a new object.
      At mount we read it from it's new place.
      
      We now never set sb->s_dirt anywhere in exofs. write_super
      is actually never called. The call to exofs_write_super from
      exofs_put_super is also removed because the VFS always calls
      ->sync_fs before calling ->put_super twice.
      
      To stay backward-and-forward compatible we also write the old
      s_nextid in the super_block object at unmount, and support zero
      length attribute on mount.
      
      This also fixes a BUG where in layouts when group_width was not
      a divisor of EXOFS_SUPER_ID (0x10000) the s_nextid was not read
      from the device it was written to. Because of the sliding window
      layout trick, and because the read was always done from the 0
      device but the write was done via the raid engine that might slide
      the device view. Now we read and write through the raid engine.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      1cea312a
    • B
      exofs: Add option to mount by osdname · 9ed96484
      Boaz Harrosh 提交于
      If /dev/osd* devices are shuffled because more devices
      where added, and/or login order has changed. It is hard to
      mount the FS you want.
      
      Add an option to mount by osdname. osdname is any osd-device's
      osdname as specified to the mkfs.exofs command when formatting
      the osd-devices.
      The new mount format is:
      	OPT="osdname=$UUID0,pid=$PID,_netdev"
      	mount -t exofs -o $OPT $DEV_OSD0 $MOUNTDIR
      
      if "osdname=" is specified in options above $DEV_OSD0 is
      ignored and can be empty.
      
      Also while at it: Removed some old unused Opt_* enums.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      9ed96484
    • B
      exofs: Override read-ahead to align on stripe_size · 66cd6cad
      bharrosh@panasas.com 提交于
      * Set all inode->i_mapping->backing_dev_info to point to
        the per super-block sb->s_bdi.
      
      * Calculating a read_ahead that is:
        - preferable 2 stripes long
          (Future patch will add a mount option to override this)
        - Minimum 128K aligned up to stripe-size
        - Caped to maximum-IO-sizes round down to stripe_size.
          (Max sizes are governed by max bio-size that fits in a page
           times number-of-devices)
      
      CC: Marc Dionne <marc.c.dionne@gmail.com>
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      66cd6cad
    • N
      exofs: simple fsync race fix · 97178b7b
      Nick Piggin 提交于
      It is incorrect to test inode dirty bits without participating in the inode
      writeback protocol. Inode writeback sets I_SYNC and clears I_DIRTY_?, then
      writes out the particular bits, then clears I_SYNC when it is done. BTW. it
      may not completely write all pages out, so I_DIRTY_PAGES would get set
      again.
      
      This is a standard pattern used throughout the kernel's writeback caches
      (I_SYNC ~= I_WRITEBACK, if that makes it clearer).
      
      And so it is not possible to determine an inode's dirty status just by
      checking I_DIRTY bits. Especially not for the purpose of data integrity
      syncs.
      
      Missing the check for these bits means that fsync can complete while
      writeback to the inode is underway. Inode writeback functions get this
      right, so call into them rather than try to shortcut things by testing
      dirty state improperly.
      Signed-off-by: NNick Piggin <npiggin@kernel.dk>
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      97178b7b