1. 12 11月, 2013 2 次提交
  2. 01 9月, 2013 6 次提交
    • A
      btrfs: reuse kbasename helper · ed84885d
      Andy Shevchenko 提交于
      To get name of the file from a pathname let's use kbasename() helper. It allows
      to simplify code a bit.
      Signed-off-by: NAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      ed84885d
    • J
      Btrfs: fix send to deal with sparse files properly · 57cfd462
      Josef Bacik 提交于
      Send was just sending everything it found, even if the extent was a hole.  This
      is unpleasant for users, so just skip holes when we are sending.  This will also
      skip sending prealloc extents since the send spec doesn't have a prealloc
      command.  Eventually we will add a prealloc command and rev the send version so
      we can send down the prealloc info.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      57cfd462
    • S
      Btrfs: get rid of sparse warnings · 35a3621b
      Stefan Behrens 提交于
      make C=2 fs/btrfs/ CF=-D__CHECK_ENDIAN__
      
      I tried to filter out the warnings for which patches have already
      been sent to the mailing list, pending for inclusion in btrfs-next.
      
      All these changes should be obviously safe.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      35a3621b
    • J
      Btrfs: fix send issues related to inode number reuse · ba5e8f2e
      Josef Bacik 提交于
      If you are sending a snapshot and specifying a parent snapshot we will walk the
      trees and figure out where they differ and send the differences only.  The way
      we check for differences are if the leaves aren't the same and if the keys are
      not the same within the leaves.  So if neither leaf is the same (ie the leaf has
      been cow'ed from the parent snapshot) we walk each item in the send root and
      check it against the parent root.  If the items match exactly then we don't do
      anything.  This doesn't quite work for inode refs, since they will just have the
      name and the parent objectid.  If you move the file from a directory and then
      remove that directory and re-create a directory with the same inode number as
      the old directory and then move that file back into that directory we will
      assume that nothing changed and you will get errors when you try to receive.
      
      In order to fix this we need to do extra checking to see if the inode ref really
      is the same or not.  So do this by passing down BTRFS_COMPARE_TREE_SAME if the
      items match.  Then if the key type is an inode ref we can do some extra
      checking, otherwise we just keep processing.  The extra checking is to look up
      the generation of the directory in the parent volume and compare it to the
      generation of the send volume.  If they match then they are the same directory
      and we are good to go.  If they don't we have to add them to the changed refs
      list.
      
      This means we have to track the generation of the ref we're trying to lookup
      when we iterate all the refs for a particular inode.  So in the case of looking
      for new refs we have to get the generation from the parent volume, and in the
      case of looking for deleted refs we have to get the generation from the send
      volume to compare with.
      
      There was also the issue of using a ulist to keep track of the directories we
      needed to check.  Because we can get a deleted ref and a new ref for the same
      inode number the ulist won't work since it indexes based on the value.  So
      instead just dup any directory ref we find and add it to a local list, and then
      process that list as normal and do away with using a ulist for this altogether.
      
      Before we would fail all of the tests in the far-progs that related to moving
      directories (test group 32).  With this patch we now pass these tests, and all
      of the tests in the far-progs send testing suite.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      ba5e8f2e
    • J
      Btrfs: skip subvol entries when checking if we've created a dir already · a0525414
      Josef Bacik 提交于
      We have logic to see if we've already created a parent directory by check to see
      if an inode inside of that directory has a lower inode number than the one we
      are currently processing.  The logic is that if there is a lower inode number
      then we would have had to made sure the directory was created at that previous
      point.  The problem is that subvols inode numbers count from the lowest objectid
      in the root tree, which may be less than our current progress.  So just skip if
      our dir item key is a root item.  This fixes the original test and the xfstest
      version I made that added an extra subvol create.  Thanks,
      Reported-by: NEmil Karlson <jekarlson@gmail.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      a0525414
    • J
      Btrfs: check our parent dir when doing a compare send · ebdad913
      Josef Bacik 提交于
      When doing a send with a parent subvol we will check to see if the file we are
      acting on is being overwritten and move it if we think it may be needed further
      down the line during the send.  We check this by checking its directory and
      making sure it existed in the parent and making sure the file existed in the
      parent.  The problem with this check is that if we create a directory and a file
      in that directory, and then snapshot, and then remove and re-create that same
      directory and file with different inode numbers and then try to snapshot and
      send with the original parent we will try and save the original file inside of
      that directory.  This is a problem because during the receive we move the
      directory out of the way because it is a completely new inode, which makes us
      unable to find the old file inside of the directory when we try to move that out
      of the way for the overwrite.  We fix this by checking the parent directory of
      the inode we think we are overwriting.  If the parent directory generation in
      the send root != the parent directory generation in the parent root then we know
      it is a completely new directory and we need not bother with moving the file out
      of the way because it would have been completely destroyed.  This fixes bz
      60673.  Thanks,
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      Signed-off-by: NChris Mason <chris.mason@fusionio.com>
      ebdad913
  3. 20 8月, 2013 1 次提交
  4. 14 6月, 2013 4 次提交
  5. 07 5月, 2013 4 次提交
    • E
      btrfs: make static code static & remove dead code · 48a3b636
      Eric Sandeen 提交于
      Big patch, but all it does is add statics to functions which
      are in fact static, then remove the associated dead-code fallout.
      
      removed functions:
      
      btrfs_iref_to_path()
      __btrfs_lookup_delayed_deletion_item()
      __btrfs_search_delayed_insertion_item()
      __btrfs_search_delayed_deletion_item()
      find_eb_for_page()
      btrfs_find_block_group()
      range_straddles_pages()
      extent_range_uptodate()
      btrfs_file_extent_length()
      btrfs_scrub_cancel_devid()
      btrfs_start_transaction_lflush()
      
      btrfs_print_tree() is left because it is used for debugging.
      btrfs_start_transaction_lflush() and btrfs_reada_detach() are
      left for symmetry.
      
      ulist.c functions are left, another patch will take care of those.
      Signed-off-by: NEric Sandeen <sandeen@redhat.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      48a3b636
    • T
      Btrfs: fix error handling in btrfs_ioctl_send() · ecc7ada7
      Tsutomu Itoh 提交于
      fget() returns NULL if error. So, we should check NULL or not.
      Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      ecc7ada7
    • T
      Btrfs: remove unused variable in __process_changed_new_xattr() · ba1eeaac
      Tsutomu Itoh 提交于
      Variable 'p' is not used any more. So, remove it.
      Signed-off-by: NTsutomu Itoh <t-itoh@jp.fujitsu.com>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      ba1eeaac
    • S
      Btrfs: allow omitting stream header and end-cmd for btrfs send · c2c71324
      Stefan Behrens 提交于
      Two new flags are added to allow omitting the stream header and the
      end command for btrfs send streams. This is used in cases where you
      send multiple snapshots back-to-back in one stream.
      
      This used to be encoded like this (with 2 snapshots in this example):
      <stream header> + <sequence of commands> + <end cmd> +
      <stream header> + <sequence of commands> + <end cmd> + EOF
      
      The new format (if the two new flags are used) is this one:
      <stream header> + <sequence of commands> +
                        <sequence of commands> + <end cmd>
      
      Note that the currently existing receivers treat <end cmd> only as
      an indication that a new <stream header> is following. This means,
      you can just skip the sequence <end cmd> <stream header> without
      loosing compatibility. As long as an EOF is following, the currently
      existing receivers handle the new format (if the two new flags are
      used) exactly as the old one.
      
      So what is the benefit of this change? The goal is to be able to use
      a single stream (one TCP connection) to multiplex a request/response
      handshake plus Btrfs send streams, all in the same stream. In this
      case you cannot evaluate an EOF condition as an end of the Btrfs send
      stream. You need something else, and the <end cmd> is just perfect
      for this purpose.
      
      The summary is:
      The format change is driven by the need to send several Btrfs send
      streams over a single TCP connections, with the ability for a repeated
      request/response handshake in the middle. And this format change does
      not break any existing tool, it is completely compatible.
      
      You could compare the old behaviour of the Btrfs send stream to the
      one of ftp where you need a seperate request/response channel and
      newly opened data transfer channels for each file, while the new
      behaviour is more like http using a single stream for everything.
      Signed-off-by: NStefan Behrens <sbehrens@giantdisaster.de>
      Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
      c2c71324
  6. 28 3月, 2013 1 次提交
  7. 23 2月, 2013 1 次提交
  8. 21 2月, 2013 2 次提交
  9. 15 1月, 2013 1 次提交
  10. 17 12月, 2012 1 次提交
  11. 26 10月, 2012 3 次提交
  12. 04 10月, 2012 1 次提交
  13. 02 10月, 2012 13 次提交