All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhi Yong Wu <zwu.kernel@gmail.com>
To: xfs@oss.sgi.com
Cc: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Subject: [PATCH v2 0/3] xfs: add O_TMPFILE support
Date: Wed, 18 Dec 2013 08:15:42 +0800	[thread overview]
Message-ID: <1387325745-22003-1-git-send-email-zwu.kernel@gmail.com> (raw)

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

HI, folks

  It's time to post the latest revision out, 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 tested against 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 v1:
 - Fixed one chunk of the comments from Christoph Hellwig and Jeff Liu.

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

Zhi Yong Wu (3):
  xfs: factor prid related codes into xfs_get_initial_prid()
  xfs: add O_TMPFILE support
  xfs: allow linkat() on O_TMPFILE files

 fs/xfs/xfs_inode.c      |  123 ++++++++++++++++++++++++++++++++++++++++++++--
 fs/xfs/xfs_inode.h      |   12 +++++
 fs/xfs/xfs_iops.c       |   16 ++++++
 fs/xfs/xfs_shared.h     |    4 +-
 fs/xfs/xfs_symlink.c    |    5 +--
 fs/xfs/xfs_trans_resv.c |   55 +++++++++++++++++++--
 fs/xfs/xfs_trans_resv.h |    3 +
 7 files changed, 203 insertions(+), 15 deletions(-)

-- 
1.7.6.5

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

             reply	other threads:[~2013-12-18  0:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-18  0:15 Zhi Yong Wu [this message]
2013-12-18  0:15 ` [PATCH v2 1/3] xfs: factor prid related codes into xfs_get_initial_prid() Zhi Yong Wu
2013-12-18  0:15 ` [PATCH v2 2/3] xfs: add O_TMPFILE support Zhi Yong Wu
2013-12-18  0:15 ` [PATCH v2 3/3] xfs: allow linkat() on O_TMPFILE files Zhi Yong Wu
2013-12-18  0:22 [PATCH v2 0/3] xfs: add O_TMPFILE support Zhi Yong Wu
2013-12-23  1:45 ` Zhi Yong Wu
2013-12-26  8:51 ` Christoph Hellwig
2013-12-28 10:04   ` Zhi Yong Wu
2013-12-28 10:04     ` Zhi Yong Wu
2014-01-07 20:49   ` Ben Myers
2014-01-07 20:51     ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1387325745-22003-1-git-send-email-zwu.kernel@gmail.com \
    --to=zwu.kernel@gmail.com \
    --cc=wuzhy@linux.vnet.ibm.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.