Skip to content

xfs: add O_TMPFILE support

Zhi Yong Wu linux-api linux-xfs 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest posting 2/23 patches 8 repliesIn review
  2. v2 posting 1/23 patches 0 repliesSuperseded
  3. v15 patches 13 repliesSuperseded

Changes in v2 from the cover letter

- Fixed one chunk of the comments from Christoph Hellwig and Jeff Liu.

Patches in v2 posting 2/2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3xfs: factor prid related codes into xfs_get_initial_prid()fs/xfs/xfs_inode.c fs/xfs/xfs_inode.h fs/xfs/xfs_symlink.c+12 -90 replies
2/3xfs: add O_TMPFILE supportfs/xfs/xfs_inode.c fs/xfs/xfs_inode.h fs/xfs/xfs_iops.c +3 more+164 -32 replies
3/3xfs: allow linkat() on O_TMPFILE filesfs/xfs/xfs_inode.c fs/xfs/xfs_trans_resv.c+26 -31 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph HellwigDave Chinner
SeriesR-b
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/3] xfs: add O_TMPFILE support

From: Zhi Yong Wu <[email protected]>

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 |    2 +
 7 files changed, 202 insertions(+), 15 deletions(-)
Signature · 6 lines
1.7.6.5

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs