* [PATCH] xfs: abstract out dev_t conversions
@ 2017-11-20 9:33 Christoph Hellwig
2017-11-21 1:48 ` Darrick J. Wong
0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2017-11-20 9:33 UTC (permalink / raw)
To: linux-xfs
And move them to xfs_linux.h so that xfsprogs can stub them out more
easily.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
This should make life for xfsprogs a lot easier. And it's mostly trivial
so it should be ok for 4.15.
fs/xfs/libxfs/xfs_inode_fork.c | 8 ++------
fs/xfs/xfs_linux.h | 10 ++++++++++
2 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
index 1c90ec41e9df..c79a1616b79d 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.c
+++ b/fs/xfs/libxfs/xfs_inode_fork.c
@@ -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,
@@ -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;
diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
index 6282bfc1afa9..99562ec0de56 100644
--- a/fs/xfs/xfs_linux.h
+++ b/fs/xfs/xfs_linux.h
@@ -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
*/
--
2.14.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: abstract out dev_t conversions
2017-11-20 9:33 [PATCH] xfs: abstract out dev_t conversions Christoph Hellwig
@ 2017-11-21 1:48 ` Darrick J. Wong
2017-11-21 2:16 ` Eric Sandeen
0 siblings, 1 reply; 3+ messages in thread
From: Darrick J. Wong @ 2017-11-21 1:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-xfs, Eric Sandeen
On Mon, Nov 20, 2017 at 10:33:56AM +0100, Christoph Hellwig wrote:
> And move them to xfs_linux.h so that xfsprogs can stub them out more
> easily.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks ok, but I want Eric to have a quick look at this because he's the
stuckee on this one. :P
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
--D
> ---
>
> This should make life for xfsprogs a lot easier. And it's mostly trivial
> so it should be ok for 4.15.
>
> fs/xfs/libxfs/xfs_inode_fork.c | 8 ++------
> fs/xfs/xfs_linux.h | 10 ++++++++++
> 2 files changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
> index 1c90ec41e9df..c79a1616b79d 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.c
> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
> @@ -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,
> @@ -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;
>
> diff --git a/fs/xfs/xfs_linux.h b/fs/xfs/xfs_linux.h
> index 6282bfc1afa9..99562ec0de56 100644
> --- a/fs/xfs/xfs_linux.h
> +++ b/fs/xfs/xfs_linux.h
> @@ -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
> */
> --
> 2.14.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfs: abstract out dev_t conversions
2017-11-21 1:48 ` Darrick J. Wong
@ 2017-11-21 2:16 ` Eric Sandeen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sandeen @ 2017-11-21 2:16 UTC (permalink / raw)
To: Darrick J. Wong, Christoph Hellwig; +Cc: linux-xfs, Eric Sandeen
On 11/20/17 7:48 PM, Darrick J. Wong wrote:
> On Mon, Nov 20, 2017 at 10:33:56AM +0100, Christoph Hellwig wrote:
>> And move them to xfs_linux.h so that xfsprogs can stub them out more
>> easily.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Looks ok, but I want Eric to have a quick look at this because he's the
> stuckee on this one. :P
>
> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
I'm probably slow but I'm seeing neither big problems nor big solutions
from this patch; IOWS - fine by me? :)
-Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-11-21 2:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-20 9:33 [PATCH] xfs: abstract out dev_t conversions Christoph Hellwig
2017-11-21 1:48 ` Darrick J. Wong
2017-11-21 2:16 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).