All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] xfs: add O_TMPFILE support
@ 2013-12-13 14:27 ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

HI, folks

  It's time to post out the first formal version, welcome to any constructive comment, thanks.

  If anyone is interested in playing with it, you can get this patchset from my dev git on github:
  git://github.com/wuzhy/kernel.git xfs_tmpfile

  The patchset was tests agaist the code snippet from Andy Lutomirski and other test cases:
  http://lwn.net/Articles/562296/
  If you have any other better test cases, please let me know, thanks.

#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

#define __O_TMPFILE 020000000
#define O_DIRECTORY 0200000
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define AT_EMPTY_PATH 0x1000

int main(int argc, char **argv)
{
   char buf[128];

   if (argc != 3)
     errx(1, "Usage: flinktest PATH linkat|proc");

   int fd = open(".", O_TMPFILE | O_RDWR, 0600);
   if (fd == -1)
     err(1, "O_TMPFILE");
   else
     printf("fd #: %d\n", fd);

   write(fd, "test", 4);

   if (!strcmp(argv[2], "linkat")) {
     if (linkat(fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) != 0)
       err(1, "linkat");
   } else if (!strcmp(argv[2], "proc")) {
     sprintf(buf, "/proc/self/fd/%d", fd);
     if (linkat(AT_FDCWD, buf, AT_FDCWD, argv[1], AT_SYMLINK_FOLLOW) != 0)
       err(1, "linkat");
   } else {
     errx(1, "invalid mode");
   }

   return 0;
}


Changelog from rfc:
 - Addressed the comments from Dave Chinner and Christoph Hellwig.

Zhi Yong Wu (5):
  xfs: factor prid related codes into xfs_get_initial_prid()
  xfs: adjust the interface of xfs_qm_vop_dqalloc()
  xfs: add xfs_create_tmpfile() for O_TMPFILE support
  xfs: add a new method xfs_vn_tmpfile()
  xfs: allow linkat() on O_TMPFILE files

 fs/xfs/xfs_inode.c      |  142 ++++++++++++++++++++++++++++++++++++++++++++---
 fs/xfs/xfs_inode.h      |    2 +
 fs/xfs/xfs_ioctl.c      |    2 +-
 fs/xfs/xfs_iops.c       |   25 ++++++++-
 fs/xfs/xfs_qm.c         |   50 ++++++++++------
 fs/xfs/xfs_quota.h      |    6 +-
 fs/xfs/xfs_shared.h     |    4 +-
 fs/xfs/xfs_symlink.c    |    2 +-
 fs/xfs/xfs_trans_resv.c |   51 +++++++++++++++++
 fs/xfs/xfs_trans_resv.h |    4 +
 10 files changed, 255 insertions(+), 33 deletions(-)

-- 
1.7.6.5


^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 0/5] xfs: add O_TMPFILE support
@ 2013-12-13 14:27 ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

HI, folks

  It's time to post out the first formal version, welcome to any constructive comment, thanks.

  If anyone is interested in playing with it, you can get this patchset from my dev git on github:
  git://github.com/wuzhy/kernel.git xfs_tmpfile

  The patchset was tests agaist the code snippet from Andy Lutomirski and other test cases:
  http://lwn.net/Articles/562296/
  If you have any other better test cases, please let me know, thanks.

#include <stdio.h>
#include <err.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

#define __O_TMPFILE 020000000
#define O_DIRECTORY 0200000
#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
#define AT_EMPTY_PATH 0x1000

int main(int argc, char **argv)
{
   char buf[128];

   if (argc != 3)
     errx(1, "Usage: flinktest PATH linkat|proc");

   int fd = open(".", O_TMPFILE | O_RDWR, 0600);
   if (fd == -1)
     err(1, "O_TMPFILE");
   else
     printf("fd #: %d\n", fd);

   write(fd, "test", 4);

   if (!strcmp(argv[2], "linkat")) {
     if (linkat(fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) != 0)
       err(1, "linkat");
   } else if (!strcmp(argv[2], "proc")) {
     sprintf(buf, "/proc/self/fd/%d", fd);
     if (linkat(AT_FDCWD, buf, AT_FDCWD, argv[1], AT_SYMLINK_FOLLOW) != 0)
       err(1, "linkat");
   } else {
     errx(1, "invalid mode");
   }

   return 0;
}


Changelog from rfc:
 - Addressed the comments from Dave Chinner and Christoph Hellwig.

Zhi Yong Wu (5):
  xfs: factor prid related codes into xfs_get_initial_prid()
  xfs: adjust the interface of xfs_qm_vop_dqalloc()
  xfs: add xfs_create_tmpfile() for O_TMPFILE support
  xfs: add a new method xfs_vn_tmpfile()
  xfs: allow linkat() on O_TMPFILE files

 fs/xfs/xfs_inode.c      |  142 ++++++++++++++++++++++++++++++++++++++++++++---
 fs/xfs/xfs_inode.h      |    2 +
 fs/xfs/xfs_ioctl.c      |    2 +-
 fs/xfs/xfs_iops.c       |   25 ++++++++-
 fs/xfs/xfs_qm.c         |   50 ++++++++++------
 fs/xfs/xfs_quota.h      |    6 +-
 fs/xfs/xfs_shared.h     |    4 +-
 fs/xfs/xfs_symlink.c    |    2 +-
 fs/xfs/xfs_trans_resv.c |   51 +++++++++++++++++
 fs/xfs/xfs_trans_resv.h |    4 +
 10 files changed, 255 insertions(+), 33 deletions(-)

-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
  2013-12-13 14:27 ` Zhi Yong Wu
@ 2013-12-13 14:27   ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

It will be reused by the O_TMPFILE creation function.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 001aa89..e8b9a68 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1139,6 +1139,14 @@ xfs_bumplink(
 	return 0;
 }
 
+static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
+{
+	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
+		return xfs_get_projid(dp);
+	else
+		return XFS_PROJID_DEFAULT;
+}
+
 int
 xfs_create(
 	xfs_inode_t		*dp,
@@ -1169,10 +1177,7 @@ xfs_create(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return XFS_ERROR(EIO);
 
-	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
-		prid = xfs_get_projid(dp);
-	else
-		prid = XFS_PROJID_DEFAULT;
+	prid = xfs_get_initial_prid(dp);
 
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
@ 2013-12-13 14:27   ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

It will be reused by the O_TMPFILE creation function.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 001aa89..e8b9a68 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1139,6 +1139,14 @@ xfs_bumplink(
 	return 0;
 }
 
+static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
+{
+	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
+		return xfs_get_projid(dp);
+	else
+		return XFS_PROJID_DEFAULT;
+}
+
 int
 xfs_create(
 	xfs_inode_t		*dp,
@@ -1169,10 +1177,7 @@ xfs_create(
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return XFS_ERROR(EIO);
 
-	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
-		prid = xfs_get_projid(dp);
-	else
-		prid = XFS_PROJID_DEFAULT;
+	prid = xfs_get_initial_prid(dp);
 
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
  2013-12-13 14:27 ` Zhi Yong Wu
@ 2013-12-13 14:27   ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

There may be not a parent inode or a name for O_TMPFILE support, but will pass
a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
adjusted in order that O_TMPFILE creation function can also use it.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c   |    2 +-
 fs/xfs/xfs_ioctl.c   |    2 +-
 fs/xfs/xfs_iops.c    |    3 ++-
 fs/xfs/xfs_qm.c      |   50 +++++++++++++++++++++++++++++++-------------------
 fs/xfs/xfs_quota.h   |    6 ++++--
 fs/xfs/xfs_symlink.c |    2 +-
 6 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index e8b9a68..71a8186 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1182,7 +1182,7 @@ xfs_create(
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
-	error = xfs_qm_vop_dqalloc(dp, xfs_kuid_to_uid(current_fsuid()),
+	error = xfs_qm_vop_dqalloc(dp, mp, xfs_kuid_to_uid(current_fsuid()),
 					xfs_kgid_to_gid(current_fsgid()), prid,
 					XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
 					&udqp, &gdqp, &pdqp);
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 33ad9a7..eac84bd 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1090,7 +1090,7 @@ xfs_ioctl_setattr(
 	 * because the i_*dquot fields will get updated anyway.
 	 */
 	if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
-		code = xfs_qm_vop_dqalloc(ip, ip->i_d.di_uid,
+		code = xfs_qm_vop_dqalloc(ip, ip->i_mount, ip->i_d.di_uid,
 					 ip->i_d.di_gid, fa->fsx_projid,
 					 XFS_QMOPT_PQUOTA, &udqp, NULL, &pdqp);
 		if (code)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 27e0e54..eb55be5 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -540,7 +540,8 @@ xfs_setattr_nonsize(
 		 */
 		ASSERT(udqp == NULL);
 		ASSERT(gdqp == NULL);
-		error = xfs_qm_vop_dqalloc(ip, xfs_kuid_to_uid(uid),
+		error = xfs_qm_vop_dqalloc(ip, ip->i_mount,
+					   xfs_kuid_to_uid(uid),
 					   xfs_kgid_to_gid(gid),
 					   xfs_get_projid(ip),
 					   qflags, &udqp, &gdqp, NULL);
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 14a4996..1f13e82 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1765,6 +1765,7 @@ xfs_qm_write_sb_changes(
 int
 xfs_qm_vop_dqalloc(
 	struct xfs_inode	*ip,
+	struct xfs_mount	*mp,
 	xfs_dqid_t		uid,
 	xfs_dqid_t		gid,
 	prid_t			prid,
@@ -1773,7 +1774,6 @@ xfs_qm_vop_dqalloc(
 	struct xfs_dquot	**O_gdqpp,
 	struct xfs_dquot	**O_pdqpp)
 {
-	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_dquot	*uq = NULL;
 	struct xfs_dquot	*gq = NULL;
 	struct xfs_dquot	*pq = NULL;
@@ -1783,17 +1783,19 @@ xfs_qm_vop_dqalloc(
 	if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
 		return 0;
 
-	lockflags = XFS_ILOCK_EXCL;
-	xfs_ilock(ip, lockflags);
+	if (ip) {
+		lockflags = XFS_ILOCK_EXCL;
+		xfs_ilock(ip, lockflags);
 
-	if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
-		gid = ip->i_d.di_gid;
+		if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
+			gid = ip->i_d.di_gid;
+	}
 
 	/*
 	 * Attach the dquot(s) to this inode, doing a dquot allocation
 	 * if necessary. The dquot(s) will not be locked.
 	 */
-	if (XFS_NOT_DQATTACHED(mp, ip)) {
+	if (ip && XFS_NOT_DQATTACHED(mp, ip)) {
 		error = xfs_qm_dqattach_locked(ip, XFS_QMOPT_DQALLOC);
 		if (error) {
 			xfs_iunlock(ip, lockflags);
@@ -1802,7 +1804,7 @@ xfs_qm_vop_dqalloc(
 	}
 
 	if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) {
-		if (ip->i_d.di_uid != uid) {
+		if (ip || (ip->i_d.di_uid != uid)) {
 			/*
 			 * What we need is the dquot that has this uid, and
 			 * if we send the inode to dqget, the uid of the inode
@@ -1812,7 +1814,8 @@ xfs_qm_vop_dqalloc(
 			 * we'll deadlock by doing trans_reserve while
 			 * holding ilock.
 			 */
-			xfs_iunlock(ip, lockflags);
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, uid,
 						 XFS_DQ_USER,
 						 XFS_QMOPT_DQALLOC |
@@ -1826,8 +1829,10 @@ xfs_qm_vop_dqalloc(
 			 * Get the ilock in the right order.
 			 */
 			xfs_dqunlock(uq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			/*
 			 * Take an extra reference, because we'll return
@@ -1838,8 +1843,9 @@ xfs_qm_vop_dqalloc(
 		}
 	}
 	if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) {
-		if (ip->i_d.di_gid != gid) {
-			xfs_iunlock(ip, lockflags);
+		if (ip && (ip->i_d.di_gid != gid)) {
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, gid,
 						 XFS_DQ_GROUP,
 						 XFS_QMOPT_DQALLOC |
@@ -1850,16 +1856,19 @@ xfs_qm_vop_dqalloc(
 				goto error_rele;
 			}
 			xfs_dqunlock(gq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			ASSERT(ip->i_gdquot);
 			gq = xfs_qm_dqhold(ip->i_gdquot);
 		}
 	}
 	if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
-		if (xfs_get_projid(ip) != prid) {
-			xfs_iunlock(ip, lockflags);
+		if (ip || (xfs_get_projid(ip) != prid)) {
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid,
 						 XFS_DQ_PROJ,
 						 XFS_QMOPT_DQALLOC |
@@ -1870,8 +1879,10 @@ xfs_qm_vop_dqalloc(
 				goto error_rele;
 			}
 			xfs_dqunlock(pq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			ASSERT(ip->i_pdquot);
 			pq = xfs_qm_dqhold(ip->i_pdquot);
@@ -1880,7 +1891,8 @@ xfs_qm_vop_dqalloc(
 	if (uq)
 		trace_xfs_dquot_dqalloc(ip);
 
-	xfs_iunlock(ip, lockflags);
+	if (ip)
+		xfs_iunlock(ip, lockflags);
 	if (O_udqpp)
 		*O_udqpp = uq;
 	else if (uq)
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index 5376dd4..c898ad2 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -80,7 +80,8 @@ extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
 		struct xfs_mount *, struct xfs_dquot *,
 		struct xfs_dquot *, struct xfs_dquot *, long, long, uint);
 
-extern int xfs_qm_vop_dqalloc(struct xfs_inode *, xfs_dqid_t, xfs_dqid_t,
+extern int xfs_qm_vop_dqalloc(struct xfs_inode *, struct xfs_mount *,
+		xfs_dqid_t, xfs_dqid_t,
 		prid_t, uint, struct xfs_dquot **, struct xfs_dquot **,
 		struct xfs_dquot **);
 extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode *,
@@ -103,7 +104,8 @@ extern void xfs_qm_unmount_quotas(struct xfs_mount *);
 
 #else
 static inline int
-xfs_qm_vop_dqalloc(struct xfs_inode *ip, xfs_dqid_t uid, xfs_dqid_t gid,
+xfs_qm_vop_dqalloc(struct xfs_inode *ip, struct xfs_mount *mp,
+		xfs_dqid_t uid, xfs_dqid_t gid,
 		prid_t prid, uint flags, struct xfs_dquot **udqp,
 		struct xfs_dquot **gdqp, struct xfs_dquot **pdqp)
 {
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 14e58f2..dcb26692 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -216,7 +216,7 @@ xfs_symlink(
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
-	error = xfs_qm_vop_dqalloc(dp,
+	error = xfs_qm_vop_dqalloc(dp, mp,
 			xfs_kuid_to_uid(current_fsuid()),
 			xfs_kgid_to_gid(current_fsgid()), prid,
 			XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
@ 2013-12-13 14:27   ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

There may be not a parent inode or a name for O_TMPFILE support, but will pass
a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
adjusted in order that O_TMPFILE creation function can also use it.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c   |    2 +-
 fs/xfs/xfs_ioctl.c   |    2 +-
 fs/xfs/xfs_iops.c    |    3 ++-
 fs/xfs/xfs_qm.c      |   50 +++++++++++++++++++++++++++++++-------------------
 fs/xfs/xfs_quota.h   |    6 ++++--
 fs/xfs/xfs_symlink.c |    2 +-
 6 files changed, 40 insertions(+), 25 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index e8b9a68..71a8186 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1182,7 +1182,7 @@ xfs_create(
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
-	error = xfs_qm_vop_dqalloc(dp, xfs_kuid_to_uid(current_fsuid()),
+	error = xfs_qm_vop_dqalloc(dp, mp, xfs_kuid_to_uid(current_fsuid()),
 					xfs_kgid_to_gid(current_fsgid()), prid,
 					XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
 					&udqp, &gdqp, &pdqp);
diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index 33ad9a7..eac84bd 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -1090,7 +1090,7 @@ xfs_ioctl_setattr(
 	 * because the i_*dquot fields will get updated anyway.
 	 */
 	if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
-		code = xfs_qm_vop_dqalloc(ip, ip->i_d.di_uid,
+		code = xfs_qm_vop_dqalloc(ip, ip->i_mount, ip->i_d.di_uid,
 					 ip->i_d.di_gid, fa->fsx_projid,
 					 XFS_QMOPT_PQUOTA, &udqp, NULL, &pdqp);
 		if (code)
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 27e0e54..eb55be5 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -540,7 +540,8 @@ xfs_setattr_nonsize(
 		 */
 		ASSERT(udqp == NULL);
 		ASSERT(gdqp == NULL);
-		error = xfs_qm_vop_dqalloc(ip, xfs_kuid_to_uid(uid),
+		error = xfs_qm_vop_dqalloc(ip, ip->i_mount,
+					   xfs_kuid_to_uid(uid),
 					   xfs_kgid_to_gid(gid),
 					   xfs_get_projid(ip),
 					   qflags, &udqp, &gdqp, NULL);
diff --git a/fs/xfs/xfs_qm.c b/fs/xfs/xfs_qm.c
index 14a4996..1f13e82 100644
--- a/fs/xfs/xfs_qm.c
+++ b/fs/xfs/xfs_qm.c
@@ -1765,6 +1765,7 @@ xfs_qm_write_sb_changes(
 int
 xfs_qm_vop_dqalloc(
 	struct xfs_inode	*ip,
+	struct xfs_mount	*mp,
 	xfs_dqid_t		uid,
 	xfs_dqid_t		gid,
 	prid_t			prid,
@@ -1773,7 +1774,6 @@ xfs_qm_vop_dqalloc(
 	struct xfs_dquot	**O_gdqpp,
 	struct xfs_dquot	**O_pdqpp)
 {
-	struct xfs_mount	*mp = ip->i_mount;
 	struct xfs_dquot	*uq = NULL;
 	struct xfs_dquot	*gq = NULL;
 	struct xfs_dquot	*pq = NULL;
@@ -1783,17 +1783,19 @@ xfs_qm_vop_dqalloc(
 	if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp))
 		return 0;
 
-	lockflags = XFS_ILOCK_EXCL;
-	xfs_ilock(ip, lockflags);
+	if (ip) {
+		lockflags = XFS_ILOCK_EXCL;
+		xfs_ilock(ip, lockflags);
 
-	if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
-		gid = ip->i_d.di_gid;
+		if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
+			gid = ip->i_d.di_gid;
+	}
 
 	/*
 	 * Attach the dquot(s) to this inode, doing a dquot allocation
 	 * if necessary. The dquot(s) will not be locked.
 	 */
-	if (XFS_NOT_DQATTACHED(mp, ip)) {
+	if (ip && XFS_NOT_DQATTACHED(mp, ip)) {
 		error = xfs_qm_dqattach_locked(ip, XFS_QMOPT_DQALLOC);
 		if (error) {
 			xfs_iunlock(ip, lockflags);
@@ -1802,7 +1804,7 @@ xfs_qm_vop_dqalloc(
 	}
 
 	if ((flags & XFS_QMOPT_UQUOTA) && XFS_IS_UQUOTA_ON(mp)) {
-		if (ip->i_d.di_uid != uid) {
+		if (ip || (ip->i_d.di_uid != uid)) {
 			/*
 			 * What we need is the dquot that has this uid, and
 			 * if we send the inode to dqget, the uid of the inode
@@ -1812,7 +1814,8 @@ xfs_qm_vop_dqalloc(
 			 * we'll deadlock by doing trans_reserve while
 			 * holding ilock.
 			 */
-			xfs_iunlock(ip, lockflags);
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, uid,
 						 XFS_DQ_USER,
 						 XFS_QMOPT_DQALLOC |
@@ -1826,8 +1829,10 @@ xfs_qm_vop_dqalloc(
 			 * Get the ilock in the right order.
 			 */
 			xfs_dqunlock(uq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			/*
 			 * Take an extra reference, because we'll return
@@ -1838,8 +1843,9 @@ xfs_qm_vop_dqalloc(
 		}
 	}
 	if ((flags & XFS_QMOPT_GQUOTA) && XFS_IS_GQUOTA_ON(mp)) {
-		if (ip->i_d.di_gid != gid) {
-			xfs_iunlock(ip, lockflags);
+		if (ip && (ip->i_d.di_gid != gid)) {
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, gid,
 						 XFS_DQ_GROUP,
 						 XFS_QMOPT_DQALLOC |
@@ -1850,16 +1856,19 @@ xfs_qm_vop_dqalloc(
 				goto error_rele;
 			}
 			xfs_dqunlock(gq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			ASSERT(ip->i_gdquot);
 			gq = xfs_qm_dqhold(ip->i_gdquot);
 		}
 	}
 	if ((flags & XFS_QMOPT_PQUOTA) && XFS_IS_PQUOTA_ON(mp)) {
-		if (xfs_get_projid(ip) != prid) {
-			xfs_iunlock(ip, lockflags);
+		if (ip || (xfs_get_projid(ip) != prid)) {
+			if (ip)
+				xfs_iunlock(ip, lockflags);
 			error = xfs_qm_dqget(mp, NULL, (xfs_dqid_t)prid,
 						 XFS_DQ_PROJ,
 						 XFS_QMOPT_DQALLOC |
@@ -1870,8 +1879,10 @@ xfs_qm_vop_dqalloc(
 				goto error_rele;
 			}
 			xfs_dqunlock(pq);
-			lockflags = XFS_ILOCK_SHARED;
-			xfs_ilock(ip, lockflags);
+			if (ip) {
+				lockflags = XFS_ILOCK_SHARED;
+				xfs_ilock(ip, lockflags);
+			}
 		} else {
 			ASSERT(ip->i_pdquot);
 			pq = xfs_qm_dqhold(ip->i_pdquot);
@@ -1880,7 +1891,8 @@ xfs_qm_vop_dqalloc(
 	if (uq)
 		trace_xfs_dquot_dqalloc(ip);
 
-	xfs_iunlock(ip, lockflags);
+	if (ip)
+		xfs_iunlock(ip, lockflags);
 	if (O_udqpp)
 		*O_udqpp = uq;
 	else if (uq)
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h
index 5376dd4..c898ad2 100644
--- a/fs/xfs/xfs_quota.h
+++ b/fs/xfs/xfs_quota.h
@@ -80,7 +80,8 @@ extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *,
 		struct xfs_mount *, struct xfs_dquot *,
 		struct xfs_dquot *, struct xfs_dquot *, long, long, uint);
 
-extern int xfs_qm_vop_dqalloc(struct xfs_inode *, xfs_dqid_t, xfs_dqid_t,
+extern int xfs_qm_vop_dqalloc(struct xfs_inode *, struct xfs_mount *,
+		xfs_dqid_t, xfs_dqid_t,
 		prid_t, uint, struct xfs_dquot **, struct xfs_dquot **,
 		struct xfs_dquot **);
 extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode *,
@@ -103,7 +104,8 @@ extern void xfs_qm_unmount_quotas(struct xfs_mount *);
 
 #else
 static inline int
-xfs_qm_vop_dqalloc(struct xfs_inode *ip, xfs_dqid_t uid, xfs_dqid_t gid,
+xfs_qm_vop_dqalloc(struct xfs_inode *ip, struct xfs_mount *mp,
+		xfs_dqid_t uid, xfs_dqid_t gid,
 		prid_t prid, uint flags, struct xfs_dquot **udqp,
 		struct xfs_dquot **gdqp, struct xfs_dquot **pdqp)
 {
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 14e58f2..dcb26692 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -216,7 +216,7 @@ xfs_symlink(
 	/*
 	 * Make sure that we have allocated dquot(s) on disk.
 	 */
-	error = xfs_qm_vop_dqalloc(dp,
+	error = xfs_qm_vop_dqalloc(dp, mp,
 			xfs_kuid_to_uid(current_fsuid()),
 			xfs_kgid_to_gid(current_fsgid()), prid,
 			XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
  2013-12-13 14:27 ` Zhi Yong Wu
@ 2013-12-13 14:27   ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

The function is used to create one O_TMPFILE file.
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00339.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c      |  106 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_inode.h      |    2 +
 fs/xfs/xfs_shared.h     |    4 +-
 fs/xfs/xfs_trans_resv.c |   31 ++++++++++++++
 fs/xfs/xfs_trans_resv.h |    2 +
 5 files changed, 144 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 71a8186..48e09c5 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1342,6 +1342,112 @@ xfs_create(
 }
 
 int
+xfs_create_tmpfile(
+	struct xfs_inode	*dp,
+	struct xfs_mount	*mp,
+	umode_t			mode,
+	dev_t			rdev,
+	struct xfs_inode	**ipp)
+{
+	struct xfs_inode	*ip = NULL;
+	struct xfs_trans	*tp = NULL;
+	int			error;
+	uint			cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
+	struct xfs_dquot	*udqp = NULL;
+	struct xfs_dquot	*gdqp = NULL;
+	struct xfs_dquot	*pdqp = NULL;
+	struct xfs_trans_res	*tres;
+	uint			resblks;
+
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return XFS_ERROR(EIO);
+
+	/*
+	 * Make sure that we have allocated dquot(s) on disk.
+	 */
+	error = xfs_qm_vop_dqalloc(dp, mp, xfs_kuid_to_uid(current_fsuid()),
+					xfs_kgid_to_gid(current_fsgid()),
+					xfs_get_initial_prid(dp),
+					XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
+					&udqp, &gdqp, &pdqp);
+	if (error)
+		return error;
+
+	resblks = XFS_IALLOC_SPACE_RES(mp);
+	tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE_TMPFILE);
+
+	tres = &M_RES(mp)->tr_create_tmpfile;
+	error = xfs_trans_reserve(tp, tres, resblks, 0);
+	if (error == ENOSPC) {
+		/* No space at all so try a "no-allocation" reservation */
+		resblks = 0;
+		error = xfs_trans_reserve(tp, tres, 0, 0);
+	}
+	if (error) {
+		cancel_flags = 0;
+		goto out_trans_cancel;
+	}
+
+	error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp,
+						pdqp, resblks, 1, 0);
+	if (error)
+		goto out_trans_cancel;
+
+	error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,
+				XFS_PROJID_DEFAULT, resblks > 0,
+				&ip, NULL);
+	if (error) {
+		if (error == ENOSPC)
+			goto out_trans_cancel;
+		goto out_trans_abort;
+	}
+
+	if (mp->m_flags & XFS_MOUNT_WSYNC)
+		xfs_trans_set_sync(tp);
+
+	/*
+	 * Attach the dquot(s) to the inodes and modify them incore.
+	 * These ids of the inode couldn't have changed since the new
+	 * inode has been locked ever since it was created.
+	 */
+	xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp);
+
+	error = xfs_iunlink(tp, ip);
+	if (error)
+		goto out_trans_abort;
+
+	error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
+	if (error)
+		goto out_release_inode;
+
+	xfs_qm_dqrele(udqp);
+	xfs_qm_dqrele(gdqp);
+	xfs_qm_dqrele(pdqp);
+
+	*ipp = ip;
+	return 0;
+
+ out_trans_abort:
+	cancel_flags |= XFS_TRANS_ABORT;
+ out_trans_cancel:
+	xfs_trans_cancel(tp, cancel_flags);
+ out_release_inode:
+	/*
+	 * Wait until after the current transaction is aborted to
+	 * release the inode.  This prevents recursive transactions
+	 * and deadlocks from xfs_inactive.
+	 */
+	if (ip)
+		IRELE(ip);
+
+	xfs_qm_dqrele(udqp);
+	xfs_qm_dqrele(gdqp);
+	xfs_qm_dqrele(pdqp);
+
+	return error;
+}
+
+int
 xfs_link(
 	xfs_inode_t		*tdp,
 	xfs_inode_t		*sip,
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 9e6efccb..5699cc6 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -323,6 +323,8 @@ int		xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
 			   struct xfs_inode **ipp, struct xfs_name *ci_name);
 int		xfs_create(struct xfs_inode *dp, struct xfs_name *name,
 			   umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp);
+int		xfs_create_tmpfile(struct xfs_inode *dp, struct xfs_mount *mp,
+			   umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp);
 int		xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
 			   struct xfs_inode *ip);
 int		xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
diff --git a/fs/xfs/xfs_shared.h b/fs/xfs/xfs_shared.h
index 8c5035a1..4484e51 100644
--- a/fs/xfs/xfs_shared.h
+++ b/fs/xfs/xfs_shared.h
@@ -104,7 +104,8 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 #define	XFS_TRANS_SB_COUNT		41
 #define	XFS_TRANS_CHECKPOINT		42
 #define	XFS_TRANS_ICREATE		43
-#define	XFS_TRANS_TYPE_MAX		43
+#define	XFS_TRANS_CREATE_TMPFILE	44
+#define	XFS_TRANS_TYPE_MAX		44
 /* new transaction types need to be reflected in xfs_logprint(8) */
 
 #define XFS_TRANS_TYPES \
@@ -112,6 +113,7 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 	{ XFS_TRANS_SETATTR_SIZE,	"SETATTR_SIZE" }, \
 	{ XFS_TRANS_INACTIVE,		"INACTIVE" }, \
 	{ XFS_TRANS_CREATE,		"CREATE" }, \
+	{ XFS_TRANS_CREATE_TMPFILE,	"CREATE_TMPFILE" }, \
 	{ XFS_TRANS_CREATE_TRUNC,	"CREATE_TRUNC" }, \
 	{ XFS_TRANS_TRUNCATE_FILE,	"TRUNCATE_FILE" }, \
 	{ XFS_TRANS_REMOVE,		"REMOVE" }, \
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c
index 2fd59c0..04519a9 100644
--- a/fs/xfs/xfs_trans_resv.c
+++ b/fs/xfs/xfs_trans_resv.c
@@ -344,6 +344,32 @@ xfs_calc_create_reservation(
 }
 
 /*
+ * For adding an inode to unlinked list we can modify:
+ *    the agi hash list: sector size
+ *    the unlinked inode: inode size
+ */
+STATIC uint
+xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
+{
+	return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
+		     xfs_calc_inode_res(mp, 1);
+}
+
+STATIC uint
+xfs_calc_create_tmpfile_reservation(
+	struct xfs_mount        *mp)
+{
+	uint	res = XFS_DQUOT_LOGRES(mp);
+
+	if (xfs_sb_version_hascrc(&mp->m_sb))
+		res += xfs_calc_icreate_resv_alloc(mp);
+	else
+		res += xfs_calc_create_resv_alloc(mp);
+
+	return res + xfs_calc_iunlink_add_reservation(mp);
+}
+
+/*
  * Making a new directory is the same as creating a new file.
  */
 STATIC uint
@@ -729,6 +755,11 @@ xfs_trans_resv_calc(
 	resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
 	resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
 
+	resp->tr_create_tmpfile.tr_logres =
+			xfs_calc_create_tmpfile_reservation(mp);
+	resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
+	resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
+
 	resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
 	resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
 	resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
diff --git a/fs/xfs/xfs_trans_resv.h b/fs/xfs/xfs_trans_resv.h
index de7de9a..285621d 100644
--- a/fs/xfs/xfs_trans_resv.h
+++ b/fs/xfs/xfs_trans_resv.h
@@ -38,6 +38,7 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_remove;	/* unlink trans */
 	struct xfs_trans_res	tr_symlink;	/* symlink trans */
 	struct xfs_trans_res	tr_create;	/* create trans */
+	struct xfs_trans_res	tr_create_tmpfile; /* create O_TMPFILE trans */
 	struct xfs_trans_res	tr_mkdir;	/* mkdir trans */
 	struct xfs_trans_res	tr_ifree;	/* inode free trans */
 	struct xfs_trans_res	tr_ichange;	/* inode update trans */
@@ -100,6 +101,7 @@ struct xfs_trans_resv {
 #define	XFS_ITRUNCATE_LOG_COUNT		2
 #define XFS_INACTIVE_LOG_COUNT		2
 #define	XFS_CREATE_LOG_COUNT		2
+#define	XFS_CREATE_TMPFILE_LOG_COUNT	2
 #define	XFS_MKDIR_LOG_COUNT		3
 #define	XFS_SYMLINK_LOG_COUNT		3
 #define	XFS_REMOVE_LOG_COUNT		2
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
@ 2013-12-13 14:27   ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

The function is used to create one O_TMPFILE file.
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00339.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c      |  106 +++++++++++++++++++++++++++++++++++++++++++++++
 fs/xfs/xfs_inode.h      |    2 +
 fs/xfs/xfs_shared.h     |    4 +-
 fs/xfs/xfs_trans_resv.c |   31 ++++++++++++++
 fs/xfs/xfs_trans_resv.h |    2 +
 5 files changed, 144 insertions(+), 1 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 71a8186..48e09c5 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1342,6 +1342,112 @@ xfs_create(
 }
 
 int
+xfs_create_tmpfile(
+	struct xfs_inode	*dp,
+	struct xfs_mount	*mp,
+	umode_t			mode,
+	dev_t			rdev,
+	struct xfs_inode	**ipp)
+{
+	struct xfs_inode	*ip = NULL;
+	struct xfs_trans	*tp = NULL;
+	int			error;
+	uint			cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
+	struct xfs_dquot	*udqp = NULL;
+	struct xfs_dquot	*gdqp = NULL;
+	struct xfs_dquot	*pdqp = NULL;
+	struct xfs_trans_res	*tres;
+	uint			resblks;
+
+	if (XFS_FORCED_SHUTDOWN(mp))
+		return XFS_ERROR(EIO);
+
+	/*
+	 * Make sure that we have allocated dquot(s) on disk.
+	 */
+	error = xfs_qm_vop_dqalloc(dp, mp, xfs_kuid_to_uid(current_fsuid()),
+					xfs_kgid_to_gid(current_fsgid()),
+					xfs_get_initial_prid(dp),
+					XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT,
+					&udqp, &gdqp, &pdqp);
+	if (error)
+		return error;
+
+	resblks = XFS_IALLOC_SPACE_RES(mp);
+	tp = xfs_trans_alloc(mp, XFS_TRANS_CREATE_TMPFILE);
+
+	tres = &M_RES(mp)->tr_create_tmpfile;
+	error = xfs_trans_reserve(tp, tres, resblks, 0);
+	if (error == ENOSPC) {
+		/* No space at all so try a "no-allocation" reservation */
+		resblks = 0;
+		error = xfs_trans_reserve(tp, tres, 0, 0);
+	}
+	if (error) {
+		cancel_flags = 0;
+		goto out_trans_cancel;
+	}
+
+	error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp,
+						pdqp, resblks, 1, 0);
+	if (error)
+		goto out_trans_cancel;
+
+	error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,
+				XFS_PROJID_DEFAULT, resblks > 0,
+				&ip, NULL);
+	if (error) {
+		if (error == ENOSPC)
+			goto out_trans_cancel;
+		goto out_trans_abort;
+	}
+
+	if (mp->m_flags & XFS_MOUNT_WSYNC)
+		xfs_trans_set_sync(tp);
+
+	/*
+	 * Attach the dquot(s) to the inodes and modify them incore.
+	 * These ids of the inode couldn't have changed since the new
+	 * inode has been locked ever since it was created.
+	 */
+	xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp, pdqp);
+
+	error = xfs_iunlink(tp, ip);
+	if (error)
+		goto out_trans_abort;
+
+	error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES);
+	if (error)
+		goto out_release_inode;
+
+	xfs_qm_dqrele(udqp);
+	xfs_qm_dqrele(gdqp);
+	xfs_qm_dqrele(pdqp);
+
+	*ipp = ip;
+	return 0;
+
+ out_trans_abort:
+	cancel_flags |= XFS_TRANS_ABORT;
+ out_trans_cancel:
+	xfs_trans_cancel(tp, cancel_flags);
+ out_release_inode:
+	/*
+	 * Wait until after the current transaction is aborted to
+	 * release the inode.  This prevents recursive transactions
+	 * and deadlocks from xfs_inactive.
+	 */
+	if (ip)
+		IRELE(ip);
+
+	xfs_qm_dqrele(udqp);
+	xfs_qm_dqrele(gdqp);
+	xfs_qm_dqrele(pdqp);
+
+	return error;
+}
+
+int
 xfs_link(
 	xfs_inode_t		*tdp,
 	xfs_inode_t		*sip,
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 9e6efccb..5699cc6 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -323,6 +323,8 @@ int		xfs_lookup(struct xfs_inode *dp, struct xfs_name *name,
 			   struct xfs_inode **ipp, struct xfs_name *ci_name);
 int		xfs_create(struct xfs_inode *dp, struct xfs_name *name,
 			   umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp);
+int		xfs_create_tmpfile(struct xfs_inode *dp, struct xfs_mount *mp,
+			   umode_t mode, xfs_dev_t rdev, struct xfs_inode **ipp);
 int		xfs_remove(struct xfs_inode *dp, struct xfs_name *name,
 			   struct xfs_inode *ip);
 int		xfs_link(struct xfs_inode *tdp, struct xfs_inode *sip,
diff --git a/fs/xfs/xfs_shared.h b/fs/xfs/xfs_shared.h
index 8c5035a1..4484e51 100644
--- a/fs/xfs/xfs_shared.h
+++ b/fs/xfs/xfs_shared.h
@@ -104,7 +104,8 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 #define	XFS_TRANS_SB_COUNT		41
 #define	XFS_TRANS_CHECKPOINT		42
 #define	XFS_TRANS_ICREATE		43
-#define	XFS_TRANS_TYPE_MAX		43
+#define	XFS_TRANS_CREATE_TMPFILE	44
+#define	XFS_TRANS_TYPE_MAX		44
 /* new transaction types need to be reflected in xfs_logprint(8) */
 
 #define XFS_TRANS_TYPES \
@@ -112,6 +113,7 @@ extern const struct xfs_buf_ops xfs_symlink_buf_ops;
 	{ XFS_TRANS_SETATTR_SIZE,	"SETATTR_SIZE" }, \
 	{ XFS_TRANS_INACTIVE,		"INACTIVE" }, \
 	{ XFS_TRANS_CREATE,		"CREATE" }, \
+	{ XFS_TRANS_CREATE_TMPFILE,	"CREATE_TMPFILE" }, \
 	{ XFS_TRANS_CREATE_TRUNC,	"CREATE_TRUNC" }, \
 	{ XFS_TRANS_TRUNCATE_FILE,	"TRUNCATE_FILE" }, \
 	{ XFS_TRANS_REMOVE,		"REMOVE" }, \
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c
index 2fd59c0..04519a9 100644
--- a/fs/xfs/xfs_trans_resv.c
+++ b/fs/xfs/xfs_trans_resv.c
@@ -344,6 +344,32 @@ xfs_calc_create_reservation(
 }
 
 /*
+ * For adding an inode to unlinked list we can modify:
+ *    the agi hash list: sector size
+ *    the unlinked inode: inode size
+ */
+STATIC uint
+xfs_calc_iunlink_add_reservation(xfs_mount_t *mp)
+{
+	return xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
+		     xfs_calc_inode_res(mp, 1);
+}
+
+STATIC uint
+xfs_calc_create_tmpfile_reservation(
+	struct xfs_mount        *mp)
+{
+	uint	res = XFS_DQUOT_LOGRES(mp);
+
+	if (xfs_sb_version_hascrc(&mp->m_sb))
+		res += xfs_calc_icreate_resv_alloc(mp);
+	else
+		res += xfs_calc_create_resv_alloc(mp);
+
+	return res + xfs_calc_iunlink_add_reservation(mp);
+}
+
+/*
  * Making a new directory is the same as creating a new file.
  */
 STATIC uint
@@ -729,6 +755,11 @@ xfs_trans_resv_calc(
 	resp->tr_create.tr_logcount = XFS_CREATE_LOG_COUNT;
 	resp->tr_create.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
 
+	resp->tr_create_tmpfile.tr_logres =
+			xfs_calc_create_tmpfile_reservation(mp);
+	resp->tr_create_tmpfile.tr_logcount = XFS_CREATE_TMPFILE_LOG_COUNT;
+	resp->tr_create_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
+
 	resp->tr_mkdir.tr_logres = xfs_calc_mkdir_reservation(mp);
 	resp->tr_mkdir.tr_logcount = XFS_MKDIR_LOG_COUNT;
 	resp->tr_mkdir.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
diff --git a/fs/xfs/xfs_trans_resv.h b/fs/xfs/xfs_trans_resv.h
index de7de9a..285621d 100644
--- a/fs/xfs/xfs_trans_resv.h
+++ b/fs/xfs/xfs_trans_resv.h
@@ -38,6 +38,7 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_remove;	/* unlink trans */
 	struct xfs_trans_res	tr_symlink;	/* symlink trans */
 	struct xfs_trans_res	tr_create;	/* create trans */
+	struct xfs_trans_res	tr_create_tmpfile; /* create O_TMPFILE trans */
 	struct xfs_trans_res	tr_mkdir;	/* mkdir trans */
 	struct xfs_trans_res	tr_ifree;	/* inode free trans */
 	struct xfs_trans_res	tr_ichange;	/* inode update trans */
@@ -100,6 +101,7 @@ struct xfs_trans_resv {
 #define	XFS_ITRUNCATE_LOG_COUNT		2
 #define XFS_INACTIVE_LOG_COUNT		2
 #define	XFS_CREATE_LOG_COUNT		2
+#define	XFS_CREATE_TMPFILE_LOG_COUNT	2
 #define	XFS_MKDIR_LOG_COUNT		3
 #define	XFS_SYMLINK_LOG_COUNT		3
 #define	XFS_REMOVE_LOG_COUNT		2
-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
  2013-12-13 14:27 ` Zhi Yong Wu
@ 2013-12-13 14:27   ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Add a new O_TMPFILE method to VFS inteface.
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00336.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index eb55be5..b57cd89 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -39,6 +39,7 @@
 #include "xfs_da_btree.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_dinode.h"
+#include "xfs_trans_space.h"
 
 #include <linux/capability.h>
 #include <linux/xattr.h>
@@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
 	return 0;
 }
 
+STATIC int
+xfs_vn_tmpfile(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	umode_t		mode)
+{
+	struct xfs_inode *ip = NULL;
+	int		error;
+
+	error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,
+				mode, 0, &ip);
+	if (error)
+		return -error;
+
+	d_instantiate(dentry, VFS_I(ip));
+
+	return -error;
+}
+
 static const struct inode_operations xfs_inode_operations = {
 	.get_acl		= xfs_get_acl,
 	.getattr		= xfs_vn_getattr,
@@ -1087,6 +1107,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
 	.removexattr		= generic_removexattr,
 	.listxattr		= xfs_vn_listxattr,
 	.update_time		= xfs_vn_update_time,
+	.tmpfile		= xfs_vn_tmpfile,
 };
 
 static const struct inode_operations xfs_dir_ci_inode_operations = {
@@ -1113,6 +1134,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
 	.removexattr		= generic_removexattr,
 	.listxattr		= xfs_vn_listxattr,
 	.update_time		= xfs_vn_update_time,
+	.tmpfile		= xfs_vn_tmpfile,
 };
 
 static const struct inode_operations xfs_symlink_inode_operations = {
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
@ 2013-12-13 14:27   ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Add a new O_TMPFILE method to VFS inteface.
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00336.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index eb55be5..b57cd89 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -39,6 +39,7 @@
 #include "xfs_da_btree.h"
 #include "xfs_dir2_priv.h"
 #include "xfs_dinode.h"
+#include "xfs_trans_space.h"
 
 #include <linux/capability.h>
 #include <linux/xattr.h>
@@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
 	return 0;
 }
 
+STATIC int
+xfs_vn_tmpfile(
+	struct inode	*dir,
+	struct dentry	*dentry,
+	umode_t		mode)
+{
+	struct xfs_inode *ip = NULL;
+	int		error;
+
+	error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,
+				mode, 0, &ip);
+	if (error)
+		return -error;
+
+	d_instantiate(dentry, VFS_I(ip));
+
+	return -error;
+}
+
 static const struct inode_operations xfs_inode_operations = {
 	.get_acl		= xfs_get_acl,
 	.getattr		= xfs_vn_getattr,
@@ -1087,6 +1107,7 @@ static const struct inode_operations xfs_dir_inode_operations = {
 	.removexattr		= generic_removexattr,
 	.listxattr		= xfs_vn_listxattr,
 	.update_time		= xfs_vn_update_time,
+	.tmpfile		= xfs_vn_tmpfile,
 };
 
 static const struct inode_operations xfs_dir_ci_inode_operations = {
@@ -1113,6 +1134,7 @@ static const struct inode_operations xfs_dir_ci_inode_operations = {
 	.removexattr		= generic_removexattr,
 	.listxattr		= xfs_vn_listxattr,
 	.update_time		= xfs_vn_update_time,
+	.tmpfile		= xfs_vn_tmpfile,
 };
 
 static const struct inode_operations xfs_symlink_inode_operations = {
-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
  2013-12-13 14:27 ` Zhi Yong Wu
@ 2013-12-13 14:27   ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, linux-kernel, Zhi Yong Wu

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Enable O_TMPFILE support in linkat().
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00341.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c      |   21 ++++++++++++++++++---
 fs/xfs/xfs_trans_resv.c |   20 ++++++++++++++++++++
 fs/xfs/xfs_trans_resv.h |    2 ++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 48e09c5..2e1fd96 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -62,6 +62,8 @@ kmem_zone_t *xfs_inode_zone;
 
 STATIC int xfs_iflush_int(xfs_inode_t *, xfs_buf_t *);
 
+STATIC int xfs_iunlink_remove(xfs_trans_t *, xfs_inode_t *);
+
 /*
  * helper function to extract extent size hint from inode
  */
@@ -1119,7 +1121,7 @@ xfs_bumplink(
 {
 	xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
 
-	ASSERT(ip->i_d.di_nlink > 0);
+	ASSERT(ip->i_d.di_nlink > 0 || (VFS_I(ip)->i_state & I_LINKABLE));
 	ip->i_d.di_nlink++;
 	inc_nlink(VFS_I(ip));
 	if ((ip->i_d.di_version == 1) &&
@@ -1455,6 +1457,7 @@ xfs_link(
 {
 	xfs_mount_t		*mp = tdp->i_mount;
 	xfs_trans_t		*tp;
+	struct xfs_trans_res	*tres;
 	int			error;
 	xfs_bmap_free_t         free_list;
 	xfs_fsblock_t           first_block;
@@ -1480,10 +1483,16 @@ xfs_link(
 	tp = xfs_trans_alloc(mp, XFS_TRANS_LINK);
 	cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
 	resblks = XFS_LINK_SPACE_RES(mp, target_name->len);
-	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_link, resblks, 0);
+
+	if (sip->i_d.di_nlink == 0)
+		tres = &M_RES(mp)->tr_link_tmpfile;
+	else
+		tres = &M_RES(mp)->tr_link;
+
+	error = xfs_trans_reserve(tp, tres, resblks, 0);
 	if (error == ENOSPC) {
 		resblks = 0;
-		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_link, 0, 0);
+		error = xfs_trans_reserve(tp, tres, 0, 0);
 	}
 	if (error) {
 		cancel_flags = 0;
@@ -1512,6 +1521,12 @@ xfs_link(
 
 	xfs_bmap_init(&free_list, &first_block);
 
+	if (sip->i_d.di_nlink == 0) {
+		error = xfs_iunlink_remove(tp, sip);
+		if (error)
+			goto abort_return;
+	}
+
 	error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino,
 					&first_block, &free_list, resblks);
 	if (error)
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c
index 04519a9..f2da7f4 100644
--- a/fs/xfs/xfs_trans_resv.c
+++ b/fs/xfs/xfs_trans_resv.c
@@ -228,6 +228,22 @@ xfs_calc_link_reservation(
 				      XFS_FSB_TO_B(mp, 1))));
 }
 
+/* For creating a link to an O_TMPFILE inode, except modifying
+ * those metadata for regular inode, we still need to remove an inode
+ * from unlinked list at first. That is,  we can modify:
+ *    the agi hash list and counters: sector size
+ *    the on disk inode before ours in the agi hash list: inode cluster size
+ */
+STATIC uint
+xfs_calc_link_tmpfile_reservation(
+	struct xfs_mount        *mp)
+{
+	return xfs_calc_link_reservation(mp) +
+		xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
+		MAX((__uint16_t)XFS_FSB_TO_B(mp, 1),
+		    (__uint16_t)XFS_INODE_CLUSTER_SIZE(mp));
+}
+
 /*
  * For removing a directory entry we can modify:
  *    the parent directory inode: inode size
@@ -743,6 +759,10 @@ xfs_trans_resv_calc(
 	resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT;
 	resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
 
+	resp->tr_link_tmpfile.tr_logres = xfs_calc_link_tmpfile_reservation(mp);
+	resp->tr_link_tmpfile.tr_logcount = XFS_LINK_TMPFILE_LOG_COUNT;
+	resp->tr_link_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
+
 	resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp);
 	resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT;
 	resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
diff --git a/fs/xfs/xfs_trans_resv.h b/fs/xfs/xfs_trans_resv.h
index 285621d..86a0daf 100644
--- a/fs/xfs/xfs_trans_resv.h
+++ b/fs/xfs/xfs_trans_resv.h
@@ -35,6 +35,7 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_itruncate;	/* truncate trans */
 	struct xfs_trans_res	tr_rename;	/* rename trans */
 	struct xfs_trans_res	tr_link;	/* link trans */
+	struct xfs_trans_res	tr_link_tmpfile; /* link O_TMPFILE trans */
 	struct xfs_trans_res	tr_remove;	/* unlink trans */
 	struct xfs_trans_res	tr_symlink;	/* symlink trans */
 	struct xfs_trans_res	tr_create;	/* create trans */
@@ -106,6 +107,7 @@ struct xfs_trans_resv {
 #define	XFS_SYMLINK_LOG_COUNT		3
 #define	XFS_REMOVE_LOG_COUNT		2
 #define	XFS_LINK_LOG_COUNT		2
+#define	XFS_LINK_TMPFILE_LOG_COUNT	2
 #define	XFS_RENAME_LOG_COUNT		2
 #define	XFS_WRITE_LOG_COUNT		2
 #define	XFS_ADDAFORK_LOG_COUNT		2
-- 
1.7.6.5


^ permalink raw reply related	[flat|nested] 38+ messages in thread

* [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
@ 2013-12-13 14:27   ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 14:27 UTC (permalink / raw)
  To: xfs; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel

From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

Enable O_TMPFILE support in linkat().
For more info, please refer to:
  http://oss.sgi.com/archives/xfs/2013-08/msg00341.html

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
---
 fs/xfs/xfs_inode.c      |   21 ++++++++++++++++++---
 fs/xfs/xfs_trans_resv.c |   20 ++++++++++++++++++++
 fs/xfs/xfs_trans_resv.h |    2 ++
 3 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 48e09c5..2e1fd96 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -62,6 +62,8 @@ kmem_zone_t *xfs_inode_zone;
 
 STATIC int xfs_iflush_int(xfs_inode_t *, xfs_buf_t *);
 
+STATIC int xfs_iunlink_remove(xfs_trans_t *, xfs_inode_t *);
+
 /*
  * helper function to extract extent size hint from inode
  */
@@ -1119,7 +1121,7 @@ xfs_bumplink(
 {
 	xfs_trans_ichgtime(tp, ip, XFS_ICHGTIME_CHG);
 
-	ASSERT(ip->i_d.di_nlink > 0);
+	ASSERT(ip->i_d.di_nlink > 0 || (VFS_I(ip)->i_state & I_LINKABLE));
 	ip->i_d.di_nlink++;
 	inc_nlink(VFS_I(ip));
 	if ((ip->i_d.di_version == 1) &&
@@ -1455,6 +1457,7 @@ xfs_link(
 {
 	xfs_mount_t		*mp = tdp->i_mount;
 	xfs_trans_t		*tp;
+	struct xfs_trans_res	*tres;
 	int			error;
 	xfs_bmap_free_t         free_list;
 	xfs_fsblock_t           first_block;
@@ -1480,10 +1483,16 @@ xfs_link(
 	tp = xfs_trans_alloc(mp, XFS_TRANS_LINK);
 	cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
 	resblks = XFS_LINK_SPACE_RES(mp, target_name->len);
-	error = xfs_trans_reserve(tp, &M_RES(mp)->tr_link, resblks, 0);
+
+	if (sip->i_d.di_nlink == 0)
+		tres = &M_RES(mp)->tr_link_tmpfile;
+	else
+		tres = &M_RES(mp)->tr_link;
+
+	error = xfs_trans_reserve(tp, tres, resblks, 0);
 	if (error == ENOSPC) {
 		resblks = 0;
-		error = xfs_trans_reserve(tp, &M_RES(mp)->tr_link, 0, 0);
+		error = xfs_trans_reserve(tp, tres, 0, 0);
 	}
 	if (error) {
 		cancel_flags = 0;
@@ -1512,6 +1521,12 @@ xfs_link(
 
 	xfs_bmap_init(&free_list, &first_block);
 
+	if (sip->i_d.di_nlink == 0) {
+		error = xfs_iunlink_remove(tp, sip);
+		if (error)
+			goto abort_return;
+	}
+
 	error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino,
 					&first_block, &free_list, resblks);
 	if (error)
diff --git a/fs/xfs/xfs_trans_resv.c b/fs/xfs/xfs_trans_resv.c
index 04519a9..f2da7f4 100644
--- a/fs/xfs/xfs_trans_resv.c
+++ b/fs/xfs/xfs_trans_resv.c
@@ -228,6 +228,22 @@ xfs_calc_link_reservation(
 				      XFS_FSB_TO_B(mp, 1))));
 }
 
+/* For creating a link to an O_TMPFILE inode, except modifying
+ * those metadata for regular inode, we still need to remove an inode
+ * from unlinked list at first. That is,  we can modify:
+ *    the agi hash list and counters: sector size
+ *    the on disk inode before ours in the agi hash list: inode cluster size
+ */
+STATIC uint
+xfs_calc_link_tmpfile_reservation(
+	struct xfs_mount        *mp)
+{
+	return xfs_calc_link_reservation(mp) +
+		xfs_calc_buf_res(1, mp->m_sb.sb_sectsize) +
+		MAX((__uint16_t)XFS_FSB_TO_B(mp, 1),
+		    (__uint16_t)XFS_INODE_CLUSTER_SIZE(mp));
+}
+
 /*
  * For removing a directory entry we can modify:
  *    the parent directory inode: inode size
@@ -743,6 +759,10 @@ xfs_trans_resv_calc(
 	resp->tr_link.tr_logcount = XFS_LINK_LOG_COUNT;
 	resp->tr_link.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
 
+	resp->tr_link_tmpfile.tr_logres = xfs_calc_link_tmpfile_reservation(mp);
+	resp->tr_link_tmpfile.tr_logcount = XFS_LINK_TMPFILE_LOG_COUNT;
+	resp->tr_link_tmpfile.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
+
 	resp->tr_remove.tr_logres = xfs_calc_remove_reservation(mp);
 	resp->tr_remove.tr_logcount = XFS_REMOVE_LOG_COUNT;
 	resp->tr_remove.tr_logflags |= XFS_TRANS_PERM_LOG_RES;
diff --git a/fs/xfs/xfs_trans_resv.h b/fs/xfs/xfs_trans_resv.h
index 285621d..86a0daf 100644
--- a/fs/xfs/xfs_trans_resv.h
+++ b/fs/xfs/xfs_trans_resv.h
@@ -35,6 +35,7 @@ struct xfs_trans_resv {
 	struct xfs_trans_res	tr_itruncate;	/* truncate trans */
 	struct xfs_trans_res	tr_rename;	/* rename trans */
 	struct xfs_trans_res	tr_link;	/* link trans */
+	struct xfs_trans_res	tr_link_tmpfile; /* link O_TMPFILE trans */
 	struct xfs_trans_res	tr_remove;	/* unlink trans */
 	struct xfs_trans_res	tr_symlink;	/* symlink trans */
 	struct xfs_trans_res	tr_create;	/* create trans */
@@ -106,6 +107,7 @@ struct xfs_trans_resv {
 #define	XFS_SYMLINK_LOG_COUNT		3
 #define	XFS_REMOVE_LOG_COUNT		2
 #define	XFS_LINK_LOG_COUNT		2
+#define	XFS_LINK_TMPFILE_LOG_COUNT	2
 #define	XFS_RENAME_LOG_COUNT		2
 #define	XFS_WRITE_LOG_COUNT		2
 #define	XFS_ADDAFORK_LOG_COUNT		2
-- 
1.7.6.5

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
  2013-12-13 14:27   ` Zhi Yong Wu
@ 2013-12-13 16:32     ` Christoph Hellwig
  -1 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:32 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
> +{
> +	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
> +		return xfs_get_projid(dp);
> +	else
> +		return XFS_PROJID_DEFAULT;
> +}

You could skip the else here.

Otherwise looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
@ 2013-12-13 16:32     ` Christoph Hellwig
  0 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:32 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
> +{
> +	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
> +		return xfs_get_projid(dp);
> +	else
> +		return XFS_PROJID_DEFAULT;
> +}

You could skip the else here.

Otherwise looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
  2013-12-13 14:27   ` Zhi Yong Wu
@ 2013-12-13 16:32     ` Christoph Hellwig
  -1 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:32 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

On Fri, Dec 13, 2013 at 10:27:50PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> There may be not a parent inode or a name for O_TMPFILE support, but will pass
> a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
> adjusted in order that O_TMPFILE creation function can also use it.
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

This patch is not actually needed, as we do get passed a parent.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
@ 2013-12-13 16:32     ` Christoph Hellwig
  0 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:32 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

On Fri, Dec 13, 2013 at 10:27:50PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> There may be not a parent inode or a name for O_TMPFILE support, but will pass
> a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
> adjusted in order that O_TMPFILE creation function can also use it.
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>

This patch is not actually needed, as we do get passed a parent.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
  2013-12-13 14:27   ` Zhi Yong Wu
@ 2013-12-13 16:37     ` Christoph Hellwig
  -1 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:37 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

> +	error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,

please pass the parent inode pointer here.

> +				XFS_PROJID_DEFAULT, resblks > 0,

and pass the project id that you inherited from the parent here.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
@ 2013-12-13 16:37     ` Christoph Hellwig
  0 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:37 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

> +	error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,

please pass the parent inode pointer here.

> +				XFS_PROJID_DEFAULT, resblks > 0,

and pass the project id that you inherited from the parent here.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
  2013-12-13 14:27   ` Zhi Yong Wu
@ 2013-12-13 16:39     ` Christoph Hellwig
  -1 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:39 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

On Fri, Dec 13, 2013 at 10:27:52PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Add a new O_TMPFILE method to VFS inteface.
> For more info, please refer to:
>   http://oss.sgi.com/archives/xfs/2013-08/msg00336.html
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> ---
>  fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index eb55be5..b57cd89 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -39,6 +39,7 @@
>  #include "xfs_da_btree.h"
>  #include "xfs_dir2_priv.h"
>  #include "xfs_dinode.h"
> +#include "xfs_trans_space.h"
>  
>  #include <linux/capability.h>
>  #include <linux/xattr.h>
> @@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
>  	return 0;
>  }
>  
> +STATIC int
> +xfs_vn_tmpfile(
> +	struct inode	*dir,
> +	struct dentry	*dentry,
> +	umode_t		mode)
> +{
> +	struct xfs_inode *ip = NULL;
> +	int		error;
> +
> +	error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,

No need to pass in the mount point here, the client can get it easily.

> +				mode, 0, &ip);

Also no need for an always-zero argument.

> +	if (error)
> +		return -error;
> +
> +	d_instantiate(dentry, VFS_I(ip));

Shouldn't this be a call to d_tmpfile() instead?

Also I'd suggest mergin this into the previous patch, so that we have
one that actually adds O_TMPFILE support, and once place to write a nice
good changelog.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
@ 2013-12-13 16:39     ` Christoph Hellwig
  0 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:39 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

On Fri, Dec 13, 2013 at 10:27:52PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Add a new O_TMPFILE method to VFS inteface.
> For more info, please refer to:
>   http://oss.sgi.com/archives/xfs/2013-08/msg00336.html
> 
> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> ---
>  fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
>  1 files changed, 22 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
> index eb55be5..b57cd89 100644
> --- a/fs/xfs/xfs_iops.c
> +++ b/fs/xfs/xfs_iops.c
> @@ -39,6 +39,7 @@
>  #include "xfs_da_btree.h"
>  #include "xfs_dir2_priv.h"
>  #include "xfs_dinode.h"
> +#include "xfs_trans_space.h"
>  
>  #include <linux/capability.h>
>  #include <linux/xattr.h>
> @@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
>  	return 0;
>  }
>  
> +STATIC int
> +xfs_vn_tmpfile(
> +	struct inode	*dir,
> +	struct dentry	*dentry,
> +	umode_t		mode)
> +{
> +	struct xfs_inode *ip = NULL;
> +	int		error;
> +
> +	error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,

No need to pass in the mount point here, the client can get it easily.

> +				mode, 0, &ip);

Also no need for an always-zero argument.

> +	if (error)
> +		return -error;
> +
> +	d_instantiate(dentry, VFS_I(ip));

Shouldn't this be a call to d_tmpfile() instead?

Also I'd suggest mergin this into the previous patch, so that we have
one that actually adds O_TMPFILE support, and once place to write a nice
good changelog.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
  2013-12-13 14:27   ` Zhi Yong Wu
@ 2013-12-13 16:41     ` Christoph Hellwig
  -1 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:41 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Enable O_TMPFILE support in linkat().
> For more info, please refer to:
>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html

Generall you should provide all reasonable information in the changelog
instead of linking to it.

> +	if (sip->i_d.di_nlink == 0)
> +		tres = &M_RES(mp)->tr_link_tmpfile;
> +	else
> +		tres = &M_RES(mp)->tr_link;

As mentioned before I think Dave wanted you to always use the same
reservation, but I'll leave that discussion to him.

> +/* For creating a link to an O_TMPFILE inode, except modifying
> + * those metadata for regular inode, we still need to remove an inode
> + * from unlinked list at first. That is,  we can modify:
> + *    the agi hash list and counters: sector size
> + *    the on disk inode before ours in the agi hash list: inode cluster size
> + */

We always have an emptry content

/*

line at the beginning of comments in XFS and the Linux kernel in
general.


^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
@ 2013-12-13 16:41     ` Christoph Hellwig
  0 siblings, 0 replies; 38+ messages in thread
From: Christoph Hellwig @ 2013-12-13 16:41 UTC (permalink / raw)
  To: Zhi Yong Wu; +Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> 
> Enable O_TMPFILE support in linkat().
> For more info, please refer to:
>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html

Generall you should provide all reasonable information in the changelog
instead of linking to it.

> +	if (sip->i_d.di_nlink == 0)
> +		tres = &M_RES(mp)->tr_link_tmpfile;
> +	else
> +		tres = &M_RES(mp)->tr_link;

As mentioned before I think Dave wanted you to always use the same
reservation, but I'll leave that discussion to him.

> +/* For creating a link to an O_TMPFILE inode, except modifying
> + * those metadata for regular inode, we still need to remove an inode
> + * from unlinked list at first. That is,  we can modify:
> + *    the agi hash list and counters: sector size
> + *    the on disk inode before ours in the agi hash list: inode cluster size
> + */

We always have an emptry content

/*

line at the beginning of comments in XFS and the Linux kernel in
general.

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
  2013-12-13 16:32     ` Christoph Hellwig
@ 2013-12-13 17:29       ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: xfstests, linux-fsdevel, Zhi Yong Wu, linux-kernel mlist

On Sat, Dec 14, 2013 at 12:32 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:50PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> There may be not a parent inode or a name for O_TMPFILE support, but will pass
>> a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
>> adjusted in order that O_TMPFILE creation function can also use it.
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>
> This patch is not actually needed, as we do get passed a parent.
Discarded, thanks.

>



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc()
@ 2013-12-13 17:29       ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 12:32 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:50PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> There may be not a parent inode or a name for O_TMPFILE support, but will pass
>> a struct xfs_mount to xfs_qm_vop_dqalloc(). So its interface need to be
>> adjusted in order that O_TMPFILE creation function can also use it.
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>
> This patch is not actually needed, as we do get passed a parent.
Discarded, thanks.

>



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
  2013-12-13 16:37     ` Christoph Hellwig
@ 2013-12-13 17:29       ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: xfstests, linux-fsdevel, Zhi Yong Wu, linux-kernel mlist

Fixed them, thanks.

On Sat, Dec 14, 2013 at 12:37 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> +     error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,
>
> please pass the parent inode pointer here.
>
>> +                             XFS_PROJID_DEFAULT, resblks > 0,
>
> and pass the project id that you inherited from the parent here.
>



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support
@ 2013-12-13 17:29       ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:29 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

Fixed them, thanks.

On Sat, Dec 14, 2013 at 12:37 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> +     error = xfs_dir_ialloc(&tp, NULL, mode, 0, rdev,
>
> please pass the parent inode pointer here.
>
>> +                             XFS_PROJID_DEFAULT, resblks > 0,
>
> and pass the project id that you inherited from the parent here.
>



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
  2013-12-13 16:39     ` Christoph Hellwig
@ 2013-12-13 17:32       ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: xfstests, linux-fsdevel, Zhi Yong Wu, linux-kernel mlist

On Sat, Dec 14, 2013 at 12:39 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:52PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Add a new O_TMPFILE method to VFS inteface.
>> For more info, please refer to:
>>   http://oss.sgi.com/archives/xfs/2013-08/msg00336.html
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
>>  1 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
>> index eb55be5..b57cd89 100644
>> --- a/fs/xfs/xfs_iops.c
>> +++ b/fs/xfs/xfs_iops.c
>> @@ -39,6 +39,7 @@
>>  #include "xfs_da_btree.h"
>>  #include "xfs_dir2_priv.h"
>>  #include "xfs_dinode.h"
>> +#include "xfs_trans_space.h"
>>
>>  #include <linux/capability.h>
>>  #include <linux/xattr.h>
>> @@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
>>       return 0;
>>  }
>>
>> +STATIC int
>> +xfs_vn_tmpfile(
>> +     struct inode    *dir,
>> +     struct dentry   *dentry,
>> +     umode_t         mode)
>> +{
>> +     struct xfs_inode *ip = NULL;
>> +     int             error;
>> +
>> +     error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,
>
> No need to pass in the mount point here, the client can get it easily.
>
>> +                             mode, 0, &ip);
>
> Also no need for an always-zero argument.
Fixed, thanks.
>
>> +     if (error)
>> +             return -error;
>> +
>> +     d_instantiate(dentry, VFS_I(ip));
>
> Shouldn't this be a call to d_tmpfile() instead?
Yes, then it need to be called in xfs_create_tmpfile() just before
xfs_iunlink() is called.
>
> Also I'd suggest mergin this into the previous patch, so that we have
> one that actually adds O_TMPFILE support, and once place to write a nice
Merged them, thanks.
> good changelog.



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile()
@ 2013-12-13 17:32       ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:32 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 12:39 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:52PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Add a new O_TMPFILE method to VFS inteface.
>> For more info, please refer to:
>>   http://oss.sgi.com/archives/xfs/2013-08/msg00336.html
>>
>> Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> ---
>>  fs/xfs/xfs_iops.c |   22 ++++++++++++++++++++++
>>  1 files changed, 22 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
>> index eb55be5..b57cd89 100644
>> --- a/fs/xfs/xfs_iops.c
>> +++ b/fs/xfs/xfs_iops.c
>> @@ -39,6 +39,7 @@
>>  #include "xfs_da_btree.h"
>>  #include "xfs_dir2_priv.h"
>>  #include "xfs_dinode.h"
>> +#include "xfs_trans_space.h"
>>
>>  #include <linux/capability.h>
>>  #include <linux/xattr.h>
>> @@ -1051,6 +1052,25 @@ xfs_vn_fiemap(
>>       return 0;
>>  }
>>
>> +STATIC int
>> +xfs_vn_tmpfile(
>> +     struct inode    *dir,
>> +     struct dentry   *dentry,
>> +     umode_t         mode)
>> +{
>> +     struct xfs_inode *ip = NULL;
>> +     int             error;
>> +
>> +     error = xfs_create_tmpfile(XFS_I(dir), XFS_I(dir)->i_mount,
>
> No need to pass in the mount point here, the client can get it easily.
>
>> +                             mode, 0, &ip);
>
> Also no need for an always-zero argument.
Fixed, thanks.
>
>> +     if (error)
>> +             return -error;
>> +
>> +     d_instantiate(dentry, VFS_I(ip));
>
> Shouldn't this be a call to d_tmpfile() instead?
Yes, then it need to be called in xfs_create_tmpfile() just before
xfs_iunlink() is called.
>
> Also I'd suggest mergin this into the previous patch, so that we have
> one that actually adds O_TMPFILE support, and once place to write a nice
Merged them, thanks.
> good changelog.



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
  2013-12-13 16:41     ` Christoph Hellwig
@ 2013-12-13 17:36       ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: xfstests, linux-fsdevel, Zhi Yong Wu, linux-kernel mlist

On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Enable O_TMPFILE support in linkat().
>> For more info, please refer to:
>>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
>
> Generall you should provide all reasonable information in the changelog
> instead of linking to it.
will apply this, thanks.
>
>> +     if (sip->i_d.di_nlink == 0)
>> +             tres = &M_RES(mp)->tr_link_tmpfile;
>> +     else
>> +             tres = &M_RES(mp)->tr_link;
>
> As mentioned before I think Dave wanted you to always use the same
> reservation, but I'll leave that discussion to him.
If as you said, when some tons of regular files are created, it won't
waste some disk space? e.g. some files want to reserve some space, but
get NOSPACE due to other files reserving additional space?

>
>> +/* For creating a link to an O_TMPFILE inode, except modifying
>> + * those metadata for regular inode, we still need to remove an inode
>> + * from unlinked list at first. That is,  we can modify:
>> + *    the agi hash list and counters: sector size
>> + *    the on disk inode before ours in the agi hash list: inode cluster size
>> + */
>
> We always have an emptry content
Done, thanks.
>
> /*
>
> line at the beginning of comments in XFS and the Linux kernel in
> general.
>



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
@ 2013-12-13 17:36       ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-13 17:36 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
>> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>>
>> Enable O_TMPFILE support in linkat().
>> For more info, please refer to:
>>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
>
> Generall you should provide all reasonable information in the changelog
> instead of linking to it.
will apply this, thanks.
>
>> +     if (sip->i_d.di_nlink == 0)
>> +             tres = &M_RES(mp)->tr_link_tmpfile;
>> +     else
>> +             tres = &M_RES(mp)->tr_link;
>
> As mentioned before I think Dave wanted you to always use the same
> reservation, but I'll leave that discussion to him.
If as you said, when some tons of regular files are created, it won't
waste some disk space? e.g. some files want to reserve some space, but
get NOSPACE due to other files reserving additional space?

>
>> +/* For creating a link to an O_TMPFILE inode, except modifying
>> + * those metadata for regular inode, we still need to remove an inode
>> + * from unlinked list at first. That is,  we can modify:
>> + *    the agi hash list and counters: sector size
>> + *    the on disk inode before ours in the agi hash list: inode cluster size
>> + */
>
> We always have an emptry content
Done, thanks.
>
> /*
>
> line at the beginning of comments in XFS and the Linux kernel in
> general.
>



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
  2013-12-13 17:36       ` Zhi Yong Wu
@ 2013-12-14  8:19         ` Dave Chinner
  -1 siblings, 0 replies; 38+ messages in thread
From: Dave Chinner @ 2013-12-14  8:19 UTC (permalink / raw)
  To: Zhi Yong Wu
  Cc: Christoph Hellwig, linux-fsdevel, Zhi Yong Wu,
	linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 01:36:47AM +0800, Zhi Yong Wu wrote:
> On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >>
> >> Enable O_TMPFILE support in linkat().
> >> For more info, please refer to:
> >>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
> >
> > Generall you should provide all reasonable information in the changelog
> > instead of linking to it.
> will apply this, thanks.
> >
> >> +     if (sip->i_d.di_nlink == 0)
> >> +             tres = &M_RES(mp)->tr_link_tmpfile;
> >> +     else
> >> +             tres = &M_RES(mp)->tr_link;
> >
> > As mentioned before I think Dave wanted you to always use the same
> > reservation, but I'll leave that discussion to him.
> If as you said, when some tons of regular files are created, it won't
> waste some disk space? e.g. some files want to reserve some space, but
> get NOSPACE due to other files reserving additional space?

This is a log space reservation, not a disk space reservation. End
either way, what is unused by the transaction is returned to the
free space pool at the end of the transaction. So for simplicity,
we should just use the one reservation for the link transaction -
take whichever is larger at calculation time.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
@ 2013-12-14  8:19         ` Dave Chinner
  0 siblings, 0 replies; 38+ messages in thread
From: Dave Chinner @ 2013-12-14  8:19 UTC (permalink / raw)
  To: Zhi Yong Wu
  Cc: Christoph Hellwig, linux-fsdevel, Zhi Yong Wu,
	linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 01:36:47AM +0800, Zhi Yong Wu wrote:
> On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
> > On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
> >>
> >> Enable O_TMPFILE support in linkat().
> >> For more info, please refer to:
> >>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
> >
> > Generall you should provide all reasonable information in the changelog
> > instead of linking to it.
> will apply this, thanks.
> >
> >> +     if (sip->i_d.di_nlink == 0)
> >> +             tres = &M_RES(mp)->tr_link_tmpfile;
> >> +     else
> >> +             tres = &M_RES(mp)->tr_link;
> >
> > As mentioned before I think Dave wanted you to always use the same
> > reservation, but I'll leave that discussion to him.
> If as you said, when some tons of regular files are created, it won't
> waste some disk space? e.g. some files want to reserve some space, but
> get NOSPACE due to other files reserving additional space?

This is a log space reservation, not a disk space reservation. End
either way, what is unused by the transaction is returned to the
free space pool at the end of the transaction. So for simplicity,
we should just use the one reservation for the link transaction -
take whichever is larger at calculation time.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
  2013-12-14  8:19         ` Dave Chinner
@ 2013-12-14  9:58           ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-14  9:58 UTC (permalink / raw)
  To: Dave Chinner, Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 4:19 PM, Dave Chinner <david@fromorbit.com> wrote:
> On Sat, Dec 14, 2013 at 01:36:47AM +0800, Zhi Yong Wu wrote:
>> On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> > On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
>> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >>
>> >> Enable O_TMPFILE support in linkat().
>> >> For more info, please refer to:
>> >>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
>> >
>> > Generall you should provide all reasonable information in the changelog
>> > instead of linking to it.
>> will apply this, thanks.
>> >
>> >> +     if (sip->i_d.di_nlink == 0)
>> >> +             tres = &M_RES(mp)->tr_link_tmpfile;
>> >> +     else
>> >> +             tres = &M_RES(mp)->tr_link;
>> >
>> > As mentioned before I think Dave wanted you to always use the same
>> > reservation, but I'll leave that discussion to him.
>> If as you said, when some tons of regular files are created, it won't
>> waste some disk space? e.g. some files want to reserve some space, but
>> get NOSPACE due to other files reserving additional space?
>
> This is a log space reservation, not a disk space reservation. End
> either way, what is unused by the transaction is returned to the
> free space pool at the end of the transaction. So for simplicity,
> we should just use the one reservation for the link transaction -
> take whichever is larger at calculation time.
Good explaination, thanks Dave and Christoph. By the way, can you help
check if the log reservation for adding/removing one inode to/from
unlinked list is correct? or  will you check after i post next version
out?

>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files
@ 2013-12-14  9:58           ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-14  9:58 UTC (permalink / raw)
  To: Dave Chinner, Christoph Hellwig
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 4:19 PM, Dave Chinner <david@fromorbit.com> wrote:
> On Sat, Dec 14, 2013 at 01:36:47AM +0800, Zhi Yong Wu wrote:
>> On Sat, Dec 14, 2013 at 12:41 AM, Christoph Hellwig <hch@infradead.org> wrote:
>> > On Fri, Dec 13, 2013 at 10:27:53PM +0800, Zhi Yong Wu wrote:
>> >> From: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
>> >>
>> >> Enable O_TMPFILE support in linkat().
>> >> For more info, please refer to:
>> >>   http://oss.sgi.com/archives/xfs/2013-08/msg00341.html
>> >
>> > Generall you should provide all reasonable information in the changelog
>> > instead of linking to it.
>> will apply this, thanks.
>> >
>> >> +     if (sip->i_d.di_nlink == 0)
>> >> +             tres = &M_RES(mp)->tr_link_tmpfile;
>> >> +     else
>> >> +             tres = &M_RES(mp)->tr_link;
>> >
>> > As mentioned before I think Dave wanted you to always use the same
>> > reservation, but I'll leave that discussion to him.
>> If as you said, when some tons of regular files are created, it won't
>> waste some disk space? e.g. some files want to reserve some space, but
>> get NOSPACE due to other files reserving additional space?
>
> This is a log space reservation, not a disk space reservation. End
> either way, what is unused by the transaction is returned to the
> free space pool at the end of the transaction. So for simplicity,
> we should just use the one reservation for the link transaction -
> take whichever is larger at calculation time.
Good explaination, thanks Dave and Christoph. By the way, can you help
check if the log reservation for adding/removing one inode to/from
unlinked list is correct? or  will you check after i post next version
out?

>
> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
  2013-12-13 16:32     ` Christoph Hellwig
@ 2013-12-14 11:20       ` Jeff Liu
  -1 siblings, 0 replies; 38+ messages in thread
From: Jeff Liu @ 2013-12-14 11:20 UTC (permalink / raw)
  To: Christoph Hellwig, Zhi Yong Wu
  Cc: xfs, linux-fsdevel, Zhi Yong Wu, linux-kernel

On 12/14 2013 00:32 AM, Christoph Hellwig wrote:
>> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
>> +{
>> +	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
>> +		return xfs_get_projid(dp);
>> +	else
>> +		return XFS_PROJID_DEFAULT;
>> +}
> 
> You could skip the else here.
Except that, I'd suggest we move this helper to proper header file with
further refactoring in xfs_symlink(), and it could be a separate patch.

Thanks,
-Jeff

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
@ 2013-12-14 11:20       ` Jeff Liu
  0 siblings, 0 replies; 38+ messages in thread
From: Jeff Liu @ 2013-12-14 11:20 UTC (permalink / raw)
  To: Christoph Hellwig, Zhi Yong Wu
  Cc: linux-fsdevel, Zhi Yong Wu, linux-kernel, xfs

On 12/14 2013 00:32 AM, Christoph Hellwig wrote:
>> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
>> +{
>> +	if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
>> +		return xfs_get_projid(dp);
>> +	else
>> +		return XFS_PROJID_DEFAULT;
>> +}
> 
> You could skip the else here.
Except that, I'd suggest we move this helper to proper header file with
further refactoring in xfs_symlink(), and it could be a separate patch.

Thanks,
-Jeff

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
  2013-12-14 11:20       ` Jeff Liu
@ 2013-12-14 11:43         ` Zhi Yong Wu
  -1 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-14 11:43 UTC (permalink / raw)
  To: Jeff Liu
  Cc: Christoph Hellwig, xfstests, linux-fsdevel, Zhi Yong Wu,
	linux-kernel mlist

On Sat, Dec 14, 2013 at 7:20 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
> On 12/14 2013 00:32 AM, Christoph Hellwig wrote:
>>> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
>>> +{
>>> +    if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
>>> +            return xfs_get_projid(dp);
>>> +    else
>>> +            return XFS_PROJID_DEFAULT;
>>> +}
>>
>> You could skip the else here.
> Except that, I'd suggest we move this helper to proper header file with
> further refactoring in xfs_symlink(), and it could be a separate patch.
Good point, will apply it, thanks.

>
> Thanks,
> -Jeff



-- 
Regards,

Zhi Yong Wu

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid()
@ 2013-12-14 11:43         ` Zhi Yong Wu
  0 siblings, 0 replies; 38+ messages in thread
From: Zhi Yong Wu @ 2013-12-14 11:43 UTC (permalink / raw)
  To: Jeff Liu
  Cc: Christoph Hellwig, linux-fsdevel, Zhi Yong Wu,
	linux-kernel mlist, xfstests

On Sat, Dec 14, 2013 at 7:20 PM, Jeff Liu <jeff.liu@oracle.com> wrote:
> On 12/14 2013 00:32 AM, Christoph Hellwig wrote:
>>> +static inline prid_t xfs_get_initial_prid(struct xfs_inode *dp)
>>> +{
>>> +    if (dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT)
>>> +            return xfs_get_projid(dp);
>>> +    else
>>> +            return XFS_PROJID_DEFAULT;
>>> +}
>>
>> You could skip the else here.
> Except that, I'd suggest we move this helper to proper header file with
> further refactoring in xfs_symlink(), and it could be a separate patch.
Good point, will apply it, thanks.

>
> Thanks,
> -Jeff



-- 
Regards,

Zhi Yong Wu

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2013-12-14 11:44 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-12-13 14:27 [PATCH 0/5] xfs: add O_TMPFILE support Zhi Yong Wu
2013-12-13 14:27 ` Zhi Yong Wu
2013-12-13 14:27 ` [PATCH 1/5] xfs: factor prid related codes into xfs_get_initial_prid() Zhi Yong Wu
2013-12-13 14:27   ` Zhi Yong Wu
2013-12-13 16:32   ` Christoph Hellwig
2013-12-13 16:32     ` Christoph Hellwig
2013-12-14 11:20     ` Jeff Liu
2013-12-14 11:20       ` Jeff Liu
2013-12-14 11:43       ` Zhi Yong Wu
2013-12-14 11:43         ` Zhi Yong Wu
2013-12-13 14:27 ` [PATCH 2/5] xfs: adjust the interface of xfs_qm_vop_dqalloc() Zhi Yong Wu
2013-12-13 14:27   ` Zhi Yong Wu
2013-12-13 16:32   ` Christoph Hellwig
2013-12-13 16:32     ` Christoph Hellwig
2013-12-13 17:29     ` Zhi Yong Wu
2013-12-13 17:29       ` Zhi Yong Wu
2013-12-13 14:27 ` [PATCH 3/5] xfs: add xfs_create_tmpfile() for O_TMPFILE support Zhi Yong Wu
2013-12-13 14:27   ` Zhi Yong Wu
2013-12-13 16:37   ` Christoph Hellwig
2013-12-13 16:37     ` Christoph Hellwig
2013-12-13 17:29     ` Zhi Yong Wu
2013-12-13 17:29       ` Zhi Yong Wu
2013-12-13 14:27 ` [PATCH 4/5] xfs: add a new method xfs_vn_tmpfile() Zhi Yong Wu
2013-12-13 14:27   ` Zhi Yong Wu
2013-12-13 16:39   ` Christoph Hellwig
2013-12-13 16:39     ` Christoph Hellwig
2013-12-13 17:32     ` Zhi Yong Wu
2013-12-13 17:32       ` Zhi Yong Wu
2013-12-13 14:27 ` [PATCH 5/5] xfs: allow linkat() on O_TMPFILE files Zhi Yong Wu
2013-12-13 14:27   ` Zhi Yong Wu
2013-12-13 16:41   ` Christoph Hellwig
2013-12-13 16:41     ` Christoph Hellwig
2013-12-13 17:36     ` Zhi Yong Wu
2013-12-13 17:36       ` Zhi Yong Wu
2013-12-14  8:19       ` Dave Chinner
2013-12-14  8:19         ` Dave Chinner
2013-12-14  9:58         ` Zhi Yong Wu
2013-12-14  9:58           ` Zhi Yong Wu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.