git: sys/vfs/hammer: Try to fix hammer_ioc_pfs_iterate() [1/2]

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sat Apr 18 05:59:43 PDT 2015


commit d8c56f70efa21a3b3ee7e17377a6cf0f7e040134
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Wed Apr 15 23:21:38 2015 +0900

    sys/vfs/hammer: Try to fix hammer_ioc_pfs_iterate() [1/2]
    
    - The ioctl HAMMERIOC_PFS_ITERATE added in commit 29d31c2d has
      several design issues. This commit and the next one try to fix
      them. Since it's been exposed to userspace, some of them are
      left as it is with comments.
    
    - The name hammer_ioc_pfs_iterate::pos (pi->pos) is misleading.
      It should have been 'pfs_id'. Users will have no idea what
      the 'pos' is supposed to be.
    
    - pi->pos is unsigned.
    
    - Don't shift pi->pos (Don't ip localize pi->pos). Copy it to a
      local variable and then shift that.
    
    - cursor.key_end fields are necessary only when iterating btree.
      This function has 'iterate' in its name but all it does is
      a single btree lookup.
    
    - Don't |= HAMMER_PFSD_DELETED with pi->head.flags. pi->head.flags
      is for HAMMER_IOC_XXX macros, but not for ondisk pfs status
      (it was lucky PFSD_DELETED does not conflict with those values).
      Users get pfs status from cursor.data->pfsd.mirror_flags copied
      to userspace. libhammer code that is based on this wrong flag
      checking is fixed accordingly.
    
    - Check if pi->ondisk is allocated.
    
    - Copy ondisk pfs data regardless of ondisk pfs delete flag bit.
      The delete flag doesn't mean the data is gone.

Summary of changes:
 lib/libhammer/info.c          |  3 +--
 sys/vfs/hammer/hammer_ioctl.c | 38 ++++++++++++++++++++++----------------
 sys/vfs/hammer/hammer_ioctl.h |  2 +-
 3 files changed, 24 insertions(+), 19 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/d8c56f70efa21a3b3ee7e17377a6cf0f7e040134


-- 
DragonFly BSD source repository



More information about the Commits mailing list