1. 26 7月, 2012 1 次提交
    • A
      Btrfs: introduce subvol uuids and times · 8ea05e3a
      Alexander Block 提交于
      This patch introduces uuids for subvolumes. Each
      subvolume has it's own uuid. In case it was snapshotted,
      it also contains parent_uuid. In case it was received,
      it also contains received_uuid.
      
      It also introduces subvolume ctime/otime/stime/rtime. The
      first two are comparable to the times found in inodes. otime
      is the origin/creation time and ctime is the change time.
      stime/rtime are only valid on received subvolumes.
      stime is the time of the subvolume when it was
      sent. rtime is the time of the subvolume when it was
      received.
      
      Additionally to the times, we have a transid for each
      time. They are updated at the same place as the times.
      
      btrfs receive uses stransid and rtransid to find out
      if a received subvolume changed in the meantime.
      
      If an older kernel mounts a filesystem with the
      extented fields, all fields become invalid. The next
      mount with a new kernel will detect this and reset the
      fields.
      Signed-off-by: NAlexander Block <ablock84@googlemail.com>
      Reviewed-by: NDavid Sterba <dave@jikos.cz>
      Reviewed-by: NArne Jansen <sensille@gmx.net>
      Reviewed-by: NJan Schmidt <list.btrfs@jan-o-sch.net>
      Reviewed-by: NAlex Lyakas <alex.bolshoy.btrfs@gmail.com>
      8ea05e3a
  2. 03 7月, 2012 1 次提交
  3. 30 5月, 2012 2 次提交
  4. 05 5月, 2012 1 次提交
  5. 17 1月, 2012 4 次提交
    • I
      Btrfs: add balance progress reporting · 19a39dce
      Ilya Dryomov 提交于
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      19a39dce
    • I
      Btrfs: allow for canceling restriper · a7e99c69
      Ilya Dryomov 提交于
      Implement an ioctl for canceling restriper.  Currently we wait until
      relocation of the current block group is finished, in future this can be
      done by triggering a commit.  Balance item is deleted and no memory
      about the interrupted balance is kept.
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      a7e99c69
    • I
      Btrfs: allow for pausing restriper · 837d5b6e
      Ilya Dryomov 提交于
      Implement an ioctl for pausing restriper.  This pauses the relocation,
      but balance is still considered to be "in progress": balance item is
      not deleted, other volume operations cannot be started, etc.  If paused
      in the middle of profile changing operation we will continue making
      allocations with the target profile.
      
      Add a hook to close_ctree() to pause restriper and free its data
      structures on unmount.  (It's safe to unmount when restriper is in
      "paused" state, we will resume with the same parameters on the next
      mount)
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      837d5b6e
    • I
      Btrfs: add basic restriper infrastructure · c9e9f97b
      Ilya Dryomov 提交于
      Add basic restriper infrastructure: extended balancing ioctl and all
      related ioctl data structures, add data structure for tracking
      restriper's state to fs_info, etc.  The semantics of the old balancing
      ioctl are fully preserved.
      
      Explicitly disallow any volume operations when balance is in progress.
      Signed-off-by: NIlya Dryomov <idryomov@gmail.com>
      c9e9f97b
  6. 06 11月, 2011 1 次提交
  7. 29 9月, 2011 2 次提交
  8. 27 5月, 2011 1 次提交
  9. 12 5月, 2011 3 次提交
    • A
      btrfs: add readonly flag · 8628764e
      Arne Jansen 提交于
      setting the readonly flag prevents writes in case an error is detected
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      8628764e
    • J
      btrfs: new ioctls for scrub · 475f6387
      Jan Schmidt 提交于
      adds ioctls necessary to start and cancel scrubs, to get current
      progress and to get info about devices to be scrubbed.
      Note that the scrub is done per-device and that the ioctl only
      returns after the scrub for this devices is finished or has been
      canceled.
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      475f6387
    • A
      btrfs: scrub · a2de733c
      Arne Jansen 提交于
      This adds an initial implementation for scrub. It works quite
      straightforward. The usermode issues an ioctl for each device in the
      fs. For each device, it enumerates the allocated device chunks. For
      each chunk, the contained extents are enumerated and the data checksums
      fetched. The extents are read sequentially and the checksums verified.
      If an error occurs (checksum or EIO), a good copy is searched for. If
      one is found, the bad copy will be rewritten.
      All enumerations happen from the commit roots. During a transaction
      commit, the scrubs get paused and afterwards continue from the new
      roots.
      
      This commit is based on the series originally posted to linux-btrfs
      with some improvements that resulted from comments from David Sterba,
      Ilya Dryomov and Jan Schmidt.
      Signed-off-by: NArne Jansen <sensille@gmx.net>
      a2de733c
  10. 23 12月, 2010 2 次提交
    • L
      Btrfs: Add BTRFS_IOC_SUBVOL_GETFLAGS/SETFLAGS ioctls · 0caa102d
      Li Zefan 提交于
      This allows us to set a snapshot or a subvolume readonly or writable
      on the fly.
      
      Usage:
      
      Set BTRFS_SUBVOL_RDONLY of btrfs_ioctl_vol_arg_v2->flags, and then
      call ioctl(BTRFS_IOCTL_SUBVOL_SETFLAGS);
      
      Changelog for v3:
      
      - Change to pass __u64 as ioctl parameter.
      
      Changelog for v2:
      
      - Add _GETFLAGS ioctl.
      - Check if the passed fd is the root of a subvolume.
      - Change the name from _SNAP_SETFLAGS to _SUBVOL_SETFLAGS.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      0caa102d
    • L
      Btrfs: Add readonly snapshots support · b83cc969
      Li Zefan 提交于
      Usage:
      
      Set BTRFS_SUBVOL_RDONLY of btrfs_ioctl_vol_arg_v2->flags, and call
      ioctl(BTRFS_I0CTL_SNAP_CREATE_V2).
      
      Implementation:
      
      - Set readonly bit of btrfs_root_item->flags.
      - Add readonly checks in btrfs_permission (inode_permission),
      btrfs_setattr, btrfs_set/remove_xattr and some ioctls.
      
      Changelog for v3:
      
      - Eliminate btrfs_root->readonly, but check btrfs_root->root_item.flags.
      - Rename BTRFS_ROOT_SNAP_RDONLY to BTRFS_ROOT_SUBVOL_RDONLY.
      Signed-off-by: NLi Zefan <lizf@cn.fujitsu.com>
      b83cc969
  11. 22 12月, 2010 1 次提交
  12. 11 12月, 2010 1 次提交
  13. 30 10月, 2010 2 次提交
    • S
      Btrfs: add SNAP_CREATE_ASYNC ioctl · 72fd032e
      Sage Weil 提交于
      Create a snap without waiting for it to commit to disk.  The ioctl is
      ordered such that subsequent operations will not be contained by the
      created snapshot, and the commit is initiated, but the ioctl does not
      wait for the snapshot to commit to disk.
      
      We return the specific transid to userspace so that an application can wait
      for this specific snapshot creation to commit via the WAIT_SYNC ioctl.
      Signed-off-by: NSage Weil <sage@newdream.net>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      72fd032e
    • S
      Btrfs: add START_SYNC, WAIT_SYNC ioctls · 46204592
      Sage Weil 提交于
      START_SYNC will start a sync/commit, but not wait for it to
      complete.  Any modification started after the ioctl returns is
      guaranteed not to be included in the commit.  If a non-NULL
      pointer is passed, the transaction id will be returned to
      userspace.
      
      WAIT_SYNC will wait for any in-progress commit to complete.  If a
      transaction id is specified, the ioctl will block and then
      return (success) when the specified transaction has committed.
      If it has already committed when we call the ioctl, it returns
      immediately.  If the specified transaction doesn't exist, it
      returns EINVAL.
      
      If no transaction id is specified, WAIT_SYNC will wait for the
      currently committing transaction to finish it's commit to disk.
      If there is no currently committing transaction, it returns
      success.
      
      These ioctls are useful for applications which want to impose an
      ordering on when fs modifications reach disk, but do not want to
      wait for the full (slow) commit process to do so.
      
      Picky callers can take the transid returned by START_SYNC and
      feed it to WAIT_SYNC, and be certain to wait only as long as
      necessary for the transaction _they_ started to reach disk.
      
      Sloppy callers can START_SYNC and WAIT_SYNC without a transid,
      and provided they didn't wait too long between the calls, they
      will get the same result.  However, if a second commit starts
      before they call WAIT_SYNC, they may end up waiting longer for
      it to commit as well.  Even so, a START_SYNC+WAIT_SYNC still
      guarantees that any operation completed before the START_SYNC
      reaches disk.
      Signed-off-by: NSage Weil <sage@newdream.net>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      46204592
  14. 17 3月, 2010 1 次提交
  15. 15 3月, 2010 4 次提交
    • J
      Btrfs: add a "df" ioctl for btrfs · 1406e432
      Josef Bacik 提交于
      df is a very loaded question in btrfs.  This gives us a way to get the per-space
      usage information so we can tell exactly what is in use where.  This will help
      us figure out ENOSPC problems, and help users better understand where their disk
      space is going.
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      1406e432
    • C
      Btrfs: add new defrag-range ioctl. · 1e701a32
      Chris Mason 提交于
      The btrfs defrag ioctl was limited to doing the entire file.  This
      commit adds a new interface that can defrag a specific range inside
      the file.
      
      It can also force compression on the file, allowing you to selectively
      compress individual files after they were created, even when mount -o
      compress isn't turned on.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      1e701a32
    • J
      Btrfs: add ioctl and incompat flag to set the default mount subvol · 6ef5ed0d
      Josef Bacik 提交于
      This patch needs to go along with my previous patch.  This lets us set the
      default dir item's location to whatever root we want to use as our default
      mounting subvol.  With this we don't have to use mount -o subvol=<tree id>
      anymore to mount a different subvol, we can just set the new one and it will
      just magically work.  I've done some moderate testing with this, mostly just
      switching the default mount around, mounting subvols and the default mount at
      the same time and such, everything seems to work.  Thanks,
      
      Older kernels would generally be able to still mount the filesystem with the
      default subvolume set, but it would result in a different volume being mounted,
      which could be an even more unpleasant suprise for users.  So if you set your
      default subvolume, you can't go back to older kernels.  Thanks,
      Signed-off-by: NJosef Bacik <josef@redhat.com>
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      6ef5ed0d
    • C
      Btrfs: add search and inode lookup ioctls · ac8e9819
      Chris Mason 提交于
      The search ioctl is a generic tool for doing btree searches from
      userland applications.  The first user of the search ioctl is a
      subvolume listing feature, but we'll also use it to find new
      files in a subvolume.
      
      The search ioctl allows you to specify min and max keys to search for,
      along with min and max transid.  It returns the items along with a
      header that includes the item key.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      ac8e9819
  16. 22 9月, 2009 1 次提交
  17. 17 1月, 2009 1 次提交
    • C
      Btrfs: fix ioctl arg size (userland incompatible change!) · c071fcfd
      Chris Mason 提交于
      The structure used to send device in btrfs ioctl calls was not
      properly aligned, and so 32 bit ioctls would not work properly on
      64 bit kernels.
      
      We could fix this with compat ioctls, but we're just one byte away
      and it doesn't make sense at this stage to carry about the compat ioctls
      forever at this stage in the project.
      
      This patch brings the ioctl arg up to an evenly aligned 4k.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c071fcfd
  18. 18 11月, 2008 1 次提交
    • C
      Btrfs: Allow subvolumes and snapshots anywhere in the directory tree · 3de4586c
      Chris Mason 提交于
      Before, all snapshots and subvolumes lived in a single flat directory.  This
      was awkward and confusing because the single flat directory was only writable
      with the ioctls.
      
      This commit changes the ioctls to create subvols and snapshots at any
      point in the directory tree.  This requires making separate ioctls for
      snapshot and subvol creation instead of a combining them into one.
      
      The subvol ioctl does:
      
      btrfsctl -S subvol_name parent_dir
      
      After the ioctl is done subvol_name lives inside parent_dir.
      
      The snapshot ioctl does:
      
      btrfsctl -s path_for_snapshot root_to_snapshot
      
      path_for_snapshot can be an absolute or relative path.  btrfsctl breaks it up
      into directory and basename components.
      
      root_to_snapshot can be any file or directory in the FS.  The snapshot
      is taken of the entire root where that file lives.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      3de4586c
  19. 13 11月, 2008 1 次提交
    • S
      Btrfs: allow clone of an arbitrary file range · c5c9cd4d
      Sage Weil 提交于
      This patch adds an additional CLONE_RANGE ioctl to clone an arbitrary 
      (block-aligned) file range to another file.  The original CLONE ioctl 
      becomes a special case of cloning the entire file range.  The logic is a 
      bit more complex now since ranges may be cloned to different offsets, and 
      because we may only be cloning the beginning or end of a particular extent 
      or checksum item.
      
      An additional sanity check ensures the source and destination files aren't 
      the same (which would previously deadlock), although eventually this could 
      be extended to allow the duplication of file data at a different offset 
      within the same file.
      
      Any extents within the destination range in the target file are dropped.
      
      We currently do not cope with the case where a compressed inline extent 
      needs to be split.  This will probably require decompressing the extent 
      into a temporary address_space, and inserting just the cloned portion as a 
      new compressed inline extent.  For now, just return -EINVAL in this case.  
      Note that this never comes up in the more common case of cloning an entire 
      file.
      Signed-off-by: NChris Mason <chris.mason@oracle.com>
      c5c9cd4d
  20. 25 9月, 2008 5 次提交
  21. 08 8月, 2007 1 次提交
  22. 12 6月, 2007 1 次提交
  23. 12 4月, 2007 1 次提交
  24. 10 4月, 2007 1 次提交