Skip to content

Commit

Permalink
Merge tag 'xfs-4.15-merge-3' of git://git.kernel.org/pub/scm/fs/xfs/x…
Browse files Browse the repository at this point in the history
…fs-linux

Pull xfs fixes from Darrick Wong:

 - Fix a memory leak in the new in-core extent map

 - Refactor the xfs_dev_t conversions for easier xfsprogs porting

* tag 'xfs-4.15-merge-3' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
  xfs: abstract out dev_t conversions
  xfs: fix memory leak in xfs_iext_free_last_leaf
  • Loading branch information
torvalds committed Nov 23, 2017
2 parents 2753278 + 274e0a1 commit 3f3211e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion fs/xfs/libxfs/xfs_iext_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,9 @@ static void
xfs_iext_free_last_leaf(
struct xfs_ifork *ifp)
{
ifp->if_u1.if_root = NULL;
ifp->if_height--;
kmem_free(ifp->if_u1.if_root);
ifp->if_u1.if_root = NULL;
}

void
Expand Down
8 changes: 2 additions & 6 deletions fs/xfs/libxfs/xfs_inode_fork.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ STATIC int xfs_iformat_local(xfs_inode_t *, xfs_dinode_t *, int, int);
STATIC int xfs_iformat_extents(xfs_inode_t *, xfs_dinode_t *, int);
STATIC int xfs_iformat_btree(xfs_inode_t *, xfs_dinode_t *, int);

static inline dev_t xfs_to_linux_dev_t(xfs_dev_t dev)
{
return MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
}

/*
* Copy inode type and data and attr format specific information from the
* on-disk inode to the in-core inode and fork structures. For fifos, devices,
Expand Down Expand Up @@ -792,7 +787,8 @@ xfs_iflush_fork(
case XFS_DINODE_FMT_DEV:
if (iip->ili_fields & XFS_ILOG_DEV) {
ASSERT(whichfork == XFS_DATA_FORK);
xfs_dinode_put_rdev(dip, sysv_encode_dev(VFS_I(ip)->i_rdev));
xfs_dinode_put_rdev(dip,
linux_to_xfs_dev_t(VFS_I(ip)->i_rdev));
}
break;

Expand Down
10 changes: 10 additions & 0 deletions fs/xfs/xfs_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,16 @@ static inline kgid_t xfs_gid_to_kgid(uint32_t gid)
return make_kgid(&init_user_ns, gid);
}

static inline dev_t xfs_to_linux_dev_t(xfs_dev_t dev)
{
return MKDEV(sysv_major(dev) & 0x1ff, sysv_minor(dev));
}

static inline xfs_dev_t linux_to_xfs_dev_t(dev_t dev)
{
return sysv_encode_dev(dev);
}

/*
* Various platform dependent calls that don't fit anywhere else
*/
Expand Down

0 comments on commit 3f3211e

Please sign in to comment.