* [PATCH] xfs_io: add support for O_TMPFILE opens
@ 2014-02-20 22:00 Christoph Hellwig
2014-02-20 22:15 ` Dave Chinner
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-20 22:00 UTC (permalink / raw)
To: xfs
Add a new -T argument to the open command that supports using the
O_TMPFILE flag.
Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/io/io.h b/io/io.h
index 6c3f627..0d2d768 100644
--- a/io/io.h
+++ b/io/io.h
@@ -35,6 +35,7 @@
#define IO_TRUNC (1<<6)
#define IO_FOREIGN (1<<7)
#define IO_NONBLOCK (1<<8)
+#define IO_TMPFILE (1<<9)
/*
* Regular file I/O control
diff --git a/io/open.c b/io/open.c
index cc677e6..c97968e 100644
--- a/io/open.c
+++ b/io/open.c
@@ -22,6 +22,22 @@
#include "init.h"
#include "io.h"
+#ifndef __O_TMPFILE
+#if defined __alpha__
+#define __O_TMPFILE 0100000000
+#elif defined(__hppa__)
+#define __O_TMPFILE 040000000
+#elif defined(__sparc__)
+#define __O_TMPFILE 0x2000000
+#else
+#define __O_TMPFILE 020000000
+#endif
+#endif /* __O_TMPFILE */
+
+#ifndef O_TMPFILE
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+
static cmdinfo_t open_cmd;
static cmdinfo_t stat_cmd;
static cmdinfo_t close_cmd;
@@ -143,10 +159,13 @@ openfile(
oflags |= O_TRUNC;
if (flags & IO_NONBLOCK)
oflags |= O_NONBLOCK;
+ if (flags & IO_TMPFILE)
+ oflags |= O_TMPFILE;
fd = open(path, oflags, mode);
if (fd < 0) {
- if ((errno == EISDIR) && (oflags & O_RDWR)) {
+ if (errno == EISDIR &&
+ ((oflags & (O_RDWR|O_TMPFILE)) == O_RDWR)) {
/* make it as if we asked for O_RDONLY & try again */
oflags &= ~O_RDWR;
oflags |= O_RDONLY;
@@ -248,6 +267,7 @@ open_help(void)
" -s -- open with O_SYNC\n"
" -t -- open with O_TRUNC (truncate the file to zero length if it exists)\n"
" -R -- mark the file as a realtime XFS file immediately after opening it\n"
+" -T -- open with O_TMPFILE (create a file not visible in the namespace)\n"
" Note1: usually read/write direct IO requests must be blocksize aligned;\n"
" some kernels, however, allow sectorsize alignment for direct IO.\n"
" Note2: the bmap for non-regular files can be obtained provided the file\n"
@@ -272,7 +292,7 @@ open_f(
return 0;
}
- while ((c = getopt(argc, argv, "FRacdfm:nrstx")) != EOF) {
+ while ((c = getopt(argc, argv, "FRTacdfm:nrstx")) != EOF) {
switch (c) {
case 'F':
/* Ignored / deprecated now, handled automatically */
@@ -310,6 +330,9 @@ open_f(
case 'x': /* backwards compatibility */
flags |= IO_REALTIME;
break;
+ case 'T':
+ flags |= IO_TMPFILE;
+ break;
default:
return command_usage(&open_cmd);
}
@@ -325,6 +348,11 @@ open_f(
if (!platform_test_xfs_fd(fd))
flags |= IO_FOREIGN;
+ if ((flags & (IO_READONLY|IO_TMPFILE)) == (IO_READONLY|IO_TMPFILE)) {
+ fprintf(stderr, _("-T and -r options are incompatible\n"));
+ return -1;
+ }
+
addfile(argv[optind], fd, &geometry, flags);
return 0;
}
@@ -731,7 +759,7 @@ open_init(void)
open_cmd.argmin = 0;
open_cmd.argmax = -1;
open_cmd.flags = CMD_NOMAP_OK | CMD_NOFILE_OK | CMD_FOREIGN_OK;
- open_cmd.args = _("[-acdrstx] [path]");
+ open_cmd.args = _("[-acdrstxT] [path]");
open_cmd.oneline = _("open the file specified by path");
open_cmd.help = open_help;
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 9543b20..124360d 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -88,7 +88,7 @@ command for more details on any command.
Display a list of all open files and (optionally) switch to an alternate
current open file.
.TP
-.BI "open [[ \-acdfrstR ] " path " ]"
+.BI "open [[ \-acdfrstRT ] " path " ]"
Closes the current file, and opens the file specified by
.I path
instead. Without any arguments, displays statistics about the current
@@ -119,6 +119,14 @@ truncates on open (O_TRUNC).
.B \-n
opens in non-blocking mode if possible (O_NONBLOCK).
.TP
+.B \-T
+create a temporary file not linked into the filesystem namepspace
+(O_TMPFILE). The pathname passed must refer to a directory which
+is treated as virtual parent for the newly created invisible file.
+Can not be used together with the
+.B \-r
+option.
+.TP
.B \-R
marks the file as a realtime XFS file after
opening it, if it is not already marked as such.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] xfs_io: add support for O_TMPFILE opens
2014-02-20 22:00 [PATCH] xfs_io: add support for O_TMPFILE opens Christoph Hellwig
@ 2014-02-20 22:15 ` Dave Chinner
2014-02-20 22:40 ` Christoph Hellwig
2014-02-21 0:16 ` Shaun Gosse
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2014-02-20 22:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, Feb 20, 2014 at 02:00:00PM -0800, Christoph Hellwig wrote:
> Add a new -T argument to the open command that supports using the
> O_TMPFILE flag.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Can you also push this into the main CLI interface similar to how
all the other open flags can be specified? i.e.
$ xfs_io -d -c "pwrite 0 4k" foo
will open "foo" with O_DIRECT. Be nice just to be able to do
$ xfs_io -dT -c "pwrite 0 4k" foo/
to be able to test O_TMPFILE functionality
FWIW, any plans to add a "link" command to be able to link the
tmpfile into the namespace once it is created?
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] 14+ messages in thread
* Re: [PATCH] xfs_io: add support for O_TMPFILE opens
2014-02-20 22:15 ` Dave Chinner
@ 2014-02-20 22:40 ` Christoph Hellwig
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-20 22:40 UTC (permalink / raw)
To: Dave Chinner; +Cc: Christoph Hellwig, xfs
On Fri, Feb 21, 2014 at 09:15:18AM +1100, Dave Chinner wrote:
> Can you also push this into the main CLI interface similar to how
> all the other open flags can be specified?
Sure.
> FWIW, any plans to add a "link" command to be able to link the
> tmpfile into the namespace once it is created?
I was planning to do that, but as pointed out in my next mail it seems
we don't actually have any other namespace commands in xfs_io, so I'm
starting to wonder if it's the right place.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* RE: [PATCH] xfs_io: add support for O_TMPFILE opens
2014-02-20 22:00 [PATCH] xfs_io: add support for O_TMPFILE opens Christoph Hellwig
2014-02-20 22:15 ` Dave Chinner
@ 2014-02-21 0:16 ` Shaun Gosse
2014-02-21 0:20 ` Christoph Hellwig
2014-02-21 0:30 ` [PATCH v2] " Christoph Hellwig
2014-02-21 0:49 ` [PATCH] xfs_io: add support for flink Christoph Hellwig
3 siblings, 1 reply; 14+ messages in thread
From: Shaun Gosse @ 2014-02-21 0:16 UTC (permalink / raw)
To: Christoph Hellwig, xfs@oss.sgi.com
Very minor point, but you've got a typo in the documentation portion of your patch.
+create a temporary file not linked into the filesystem namepspace
Should be "namespace" of course.
Cheers,
-Shaun
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] xfs_io: add support for O_TMPFILE opens
2014-02-21 0:16 ` Shaun Gosse
@ 2014-02-21 0:20 ` Christoph Hellwig
0 siblings, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-21 0:20 UTC (permalink / raw)
To: Shaun Gosse; +Cc: Christoph Hellwig, xfs@oss.sgi.com
On Fri, Feb 21, 2014 at 12:16:58AM +0000, Shaun Gosse wrote:
> Very minor point, but you've got a typo in the documentation portion of your patch.
>
> +create a temporary file not linked into the filesystem namepspace
>
> Should be "namespace" of course.
Thanks Shaun, I'll fix it for the next version.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2] xfs_io: add support for O_TMPFILE opens
2014-02-20 22:00 [PATCH] xfs_io: add support for O_TMPFILE opens Christoph Hellwig
2014-02-20 22:15 ` Dave Chinner
2014-02-21 0:16 ` Shaun Gosse
@ 2014-02-21 0:30 ` Christoph Hellwig
2014-02-23 21:01 ` Dave Chinner
2014-02-21 0:49 ` [PATCH] xfs_io: add support for flink Christoph Hellwig
3 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-21 0:30 UTC (permalink / raw)
To: xfs
On Thu, Feb 20, 2014 at 02:00:00PM -0800, Christoph Hellwig wrote:
Add a new -T argument to the open command that supports using the
O_TMPFILE flag.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
Changes from V1:
- fix typo in the man page
- add -T option to the main option parser
- handle IO_TMPFILE in the file and stat commands
diff --git a/io/file.c b/io/file.c
index db85ffc..73b893f 100644
--- a/io/file.c
+++ b/io/file.c
@@ -36,7 +36,7 @@ print_fileio(
int index,
int braces)
{
- printf(_("%c%03d%c %-14s (%s,%s,%s,%s%s%s%s)\n"),
+ printf(_("%c%03d%c %-14s (%s,%s,%s,%s%s%s%s%s)\n"),
braces? '[' : ' ', index, braces? ']' : ' ', file->name,
file->flags & IO_FOREIGN ? _("foreign") : _("xfs"),
file->flags & IO_OSYNC ? _("sync") : _("non-sync"),
@@ -44,7 +44,8 @@ print_fileio(
file->flags & IO_READONLY ? _("read-only") : _("read-write"),
file->flags & IO_REALTIME ? _(",real-time") : "",
file->flags & IO_APPEND ? _(",append-only") : "",
- file->flags & IO_NONBLOCK ? _(",non-block") : "");
+ file->flags & IO_NONBLOCK ? _(",non-block") : "",
+ file->flags & IO_TMPFILE ? _(",tmpfile") : "");
}
int
diff --git a/io/init.c b/io/init.c
index ef9e4cb..fd1a52f 100644
--- a/io/init.c
+++ b/io/init.c
@@ -136,7 +136,7 @@ init(
pagesize = getpagesize();
gettimeofday(&stopwatch, NULL);
- while ((c = getopt(argc, argv, "ac:dFfmp:nrRstVx")) != EOF) {
+ while ((c = getopt(argc, argv, "ac:dFfmp:nrRstTVx")) != EOF) {
switch (c) {
case 'a':
flags |= IO_APPEND;
@@ -179,6 +179,8 @@ init(
case 'R':
flags |= IO_REALTIME;
break;
+ case 'T':
+ flags |= IO_TMPFILE;
case 'x':
expert = 1;
break;
diff --git a/io/io.h b/io/io.h
index 6c3f627..0d2d768 100644
--- a/io/io.h
+++ b/io/io.h
@@ -35,6 +35,7 @@
#define IO_TRUNC (1<<6)
#define IO_FOREIGN (1<<7)
#define IO_NONBLOCK (1<<8)
+#define IO_TMPFILE (1<<9)
/*
* Regular file I/O control
diff --git a/io/open.c b/io/open.c
index cc677e6..6bb0d46 100644
--- a/io/open.c
+++ b/io/open.c
@@ -22,6 +22,22 @@
#include "init.h"
#include "io.h"
+#ifndef __O_TMPFILE
+#if defined __alpha__
+#define __O_TMPFILE 0100000000
+#elif defined(__hppa__)
+#define __O_TMPFILE 040000000
+#elif defined(__sparc__)
+#define __O_TMPFILE 0x2000000
+#else
+#define __O_TMPFILE 020000000
+#endif
+#endif /* __O_TMPFILE */
+
+#ifndef O_TMPFILE
+#define O_TMPFILE (__O_TMPFILE | O_DIRECTORY)
+#endif
+
static cmdinfo_t open_cmd;
static cmdinfo_t stat_cmd;
static cmdinfo_t close_cmd;
@@ -77,13 +93,14 @@ stat_f(
int verbose = (argc == 2 && !strcmp(argv[1], "-v"));
printf(_("fd.path = \"%s\"\n"), file->name);
- printf(_("fd.flags = %s,%s,%s%s%s%s\n"),
+ printf(_("fd.flags = %s,%s,%s%s%s%s%s\n"),
file->flags & IO_OSYNC ? _("sync") : _("non-sync"),
file->flags & IO_DIRECT ? _("direct") : _("non-direct"),
file->flags & IO_READONLY ? _("read-only") : _("read-write"),
file->flags & IO_REALTIME ? _(",real-time") : "",
file->flags & IO_APPEND ? _(",append-only") : "",
- file->flags & IO_NONBLOCK ? _(",non-block") : "");
+ file->flags & IO_NONBLOCK ? _(",non-block") : "",
+ file->flags & IO_TMPFILE ? _(",tmpfile") : "");
if (fstat64(file->fd, &st) < 0) {
perror("fstat64");
} else {
@@ -143,10 +160,13 @@ openfile(
oflags |= O_TRUNC;
if (flags & IO_NONBLOCK)
oflags |= O_NONBLOCK;
+ if (flags & IO_TMPFILE)
+ oflags |= O_TMPFILE;
fd = open(path, oflags, mode);
if (fd < 0) {
- if ((errno == EISDIR) && (oflags & O_RDWR)) {
+ if (errno == EISDIR &&
+ ((oflags & (O_RDWR|O_TMPFILE)) == O_RDWR)) {
/* make it as if we asked for O_RDONLY & try again */
oflags &= ~O_RDWR;
oflags |= O_RDONLY;
@@ -248,6 +268,7 @@ open_help(void)
" -s -- open with O_SYNC\n"
" -t -- open with O_TRUNC (truncate the file to zero length if it exists)\n"
" -R -- mark the file as a realtime XFS file immediately after opening it\n"
+" -T -- open with O_TMPFILE (create a file not visible in the namespace)\n"
" Note1: usually read/write direct IO requests must be blocksize aligned;\n"
" some kernels, however, allow sectorsize alignment for direct IO.\n"
" Note2: the bmap for non-regular files can be obtained provided the file\n"
@@ -272,7 +293,7 @@ open_f(
return 0;
}
- while ((c = getopt(argc, argv, "FRacdfm:nrstx")) != EOF) {
+ while ((c = getopt(argc, argv, "FRTacdfm:nrstx")) != EOF) {
switch (c) {
case 'F':
/* Ignored / deprecated now, handled automatically */
@@ -310,6 +331,9 @@ open_f(
case 'x': /* backwards compatibility */
flags |= IO_REALTIME;
break;
+ case 'T':
+ flags |= IO_TMPFILE;
+ break;
default:
return command_usage(&open_cmd);
}
@@ -325,6 +349,11 @@ open_f(
if (!platform_test_xfs_fd(fd))
flags |= IO_FOREIGN;
+ if ((flags & (IO_READONLY|IO_TMPFILE)) == (IO_READONLY|IO_TMPFILE)) {
+ fprintf(stderr, _("-T and -r options are incompatible\n"));
+ return -1;
+ }
+
addfile(argv[optind], fd, &geometry, flags);
return 0;
}
@@ -731,7 +760,7 @@ open_init(void)
open_cmd.argmin = 0;
open_cmd.argmax = -1;
open_cmd.flags = CMD_NOMAP_OK | CMD_NOFILE_OK | CMD_FOREIGN_OK;
- open_cmd.args = _("[-acdrstx] [path]");
+ open_cmd.args = _("[-acdrstxT] [path]");
open_cmd.oneline = _("open the file specified by path");
open_cmd.help = open_help;
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 9543b20..7a92ff6 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -4,7 +4,7 @@ xfs_io \- debug the I/O path of an XFS filesystem
.SH SYNOPSIS
.B xfs_io
[
-.B \-adfmrRstx
+.B \-adfmrRstxT
] [
.B \-c
.I cmd
@@ -88,7 +88,7 @@ command for more details on any command.
Display a list of all open files and (optionally) switch to an alternate
current open file.
.TP
-.BI "open [[ \-acdfrstR ] " path " ]"
+.BI "open [[ \-acdfrstRT ] " path " ]"
Closes the current file, and opens the file specified by
.I path
instead. Without any arguments, displays statistics about the current
@@ -119,6 +119,14 @@ truncates on open (O_TRUNC).
.B \-n
opens in non-blocking mode if possible (O_NONBLOCK).
.TP
+.B \-T
+create a temporary file not linked into the filesystem namespace
+(O_TMPFILE). The pathname passed must refer to a directory which
+is treated as virtual parent for the newly created invisible file.
+Can not be used together with the
+.B \-r
+option.
+.TP
.B \-R
marks the file as a realtime XFS file after
opening it, if it is not already marked as such.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH] xfs_io: add support for flink
2014-02-20 22:00 [PATCH] xfs_io: add support for O_TMPFILE opens Christoph Hellwig
` (2 preceding siblings ...)
2014-02-21 0:30 ` [PATCH v2] " Christoph Hellwig
@ 2014-02-21 0:49 ` Christoph Hellwig
2014-02-23 21:06 ` Dave Chinner
2014-02-25 19:52 ` [PATCH v2] " Christoph Hellwig
3 siblings, 2 replies; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-21 0:49 UTC (permalink / raw)
To: xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/io/Makefile b/io/Makefile
index eaeb5b2..c16af87 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -9,8 +9,8 @@ LTCOMMAND = xfs_io
LSRCFILES = xfs_bmap.sh xfs_freeze.sh xfs_mkfile.sh
HFILES = init.h io.h
CFILES = init.c \
- attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c mmap.c \
- open.c parent.c pread.c prealloc.c pwrite.c seek.c shutdown.c \
+ attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c link.c \
+ mmap.c open.c parent.c pread.c prealloc.c pwrite.c seek.c shutdown.c \
truncate.c
LLDLIBS = $(LIBXCMD) $(LIBHANDLE)
diff --git a/io/init.c b/io/init.c
index fd1a52f..7d7bb89 100644
--- a/io/init.c
+++ b/io/init.c
@@ -58,6 +58,7 @@ init_commands(void)
bmap_init();
fadvise_init();
file_init();
+ flink_init();
freeze_init();
fsync_init();
getrusage_init();
diff --git a/io/io.h b/io/io.h
index 0d2d768..1b3bca1 100644
--- a/io/io.h
+++ b/io/io.h
@@ -93,6 +93,7 @@ extern void dump_buffer(off64_t, ssize_t);
extern void attr_init(void);
extern void bmap_init(void);
extern void file_init(void);
+extern void flink_init(void);
extern void freeze_init(void);
extern void fsync_init(void);
extern void getrusage_init(void);
diff --git a/io/link.c b/io/link.c
new file mode 100644
index 0000000..49ca6a5
--- /dev/null
+++ b/io/link.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 Christoph Hellwig.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <xfs/xfs.h>
+#include <xfs/command.h>
+#include <xfs/input.h>
+#include "init.h"
+#include "io.h"
+
+#ifndef AT_EMPTY_PATH
+#define AT_EMPTY_PATH 0x1000
+#endif
+
+static cmdinfo_t flink_cmd;
+
+static void
+flink_help(void)
+{
+ printf(_(
+"\n"
+"link the open file descriptor into the filesystem\n"
+"\n"
+"\n"));
+}
+
+static int
+flink_f(
+ int argc,
+ char **argv)
+{
+ if (argc != 2)
+ return command_usage(&flink_cmd);
+
+ if (linkat(file->fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) < 0) {
+ perror("flink");
+ return 0;
+ }
+ return 0;
+}
+
+void
+flink_init(void)
+{
+ flink_cmd.name = "flink";
+ flink_cmd.cfunc = flink_f;
+ flink_cmd.argmin = 1;
+ flink_cmd.argmax = 1;
+ flink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+ flink_cmd.args = _("filename");
+ flink_cmd.oneline =
+ _("link the open file descriptor into the filesystem");
+ flink_cmd.help = flink_help;
+
+ add_command(&flink_cmd);
+}
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 7a92ff6..7d0c792 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -638,6 +638,9 @@ Only available in expert mode and requires privileges.
Undo the effects of a filesystem freeze operation.
Only available in expert mode and requires privileges.
.TP
+.B flink
+Link the currently open file descriptor into the filesystem namespace.
+.TP
.BI "inject [ " tag " ]"
Inject errors into a filesystem to observe filesystem behavior at
specific points under adverse conditions. Without the
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2] xfs_io: add support for O_TMPFILE opens
2014-02-21 0:30 ` [PATCH v2] " Christoph Hellwig
@ 2014-02-23 21:01 ` Dave Chinner
0 siblings, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2014-02-23 21:01 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, Feb 20, 2014 at 04:30:15PM -0800, Christoph Hellwig wrote:
> On Thu, Feb 20, 2014 at 02:00:00PM -0800, Christoph Hellwig wrote:
> Add a new -T argument to the open command that supports using the
> O_TMPFILE flag.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
Looks good.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
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] 14+ messages in thread
* Re: [PATCH] xfs_io: add support for flink
2014-02-21 0:49 ` [PATCH] xfs_io: add support for flink Christoph Hellwig
@ 2014-02-23 21:06 ` Dave Chinner
2014-02-25 19:52 ` [PATCH v2] " Christoph Hellwig
1 sibling, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2014-02-23 21:06 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, Feb 20, 2014 at 04:49:33PM -0800, Christoph Hellwig wrote:
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
.....
> +static cmdinfo_t flink_cmd;
> +
> +static void
> +flink_help(void)
> +{
> + printf(_(
> +"\n"
> +"link the open file descriptor into the filesystem\n"
> +"\n"
> +"\n"));
> +}
"link the open file descriptor to the supplied filename\n"
?
> +void
> +flink_init(void)
> +{
> + flink_cmd.name = "flink";
> + flink_cmd.cfunc = flink_f;
> + flink_cmd.argmin = 1;
> + flink_cmd.argmax = 1;
> + flink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
> + flink_cmd.args = _("filename");
> + flink_cmd.oneline =
> + _("link the open file descriptor into the filesystem");
> + flink_cmd.help = flink_help;
> +
> + add_command(&flink_cmd);
> +}
> diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
> index 7a92ff6..7d0c792 100644
> --- a/man/man8/xfs_io.8
> +++ b/man/man8/xfs_io.8
> @@ -638,6 +638,9 @@ Only available in expert mode and requires privileges.
> Undo the effects of a filesystem freeze operation.
> Only available in expert mode and requires privileges.
> .TP
> +.B flink
> +Link the currently open file descriptor into the filesystem namespace.
> +.TP
And that needs to indicate that a filename needs to be provided,
too.
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] 14+ messages in thread
* [PATCH v2] xfs_io: add support for flink
2014-02-21 0:49 ` [PATCH] xfs_io: add support for flink Christoph Hellwig
2014-02-23 21:06 ` Dave Chinner
@ 2014-02-25 19:52 ` Christoph Hellwig
2014-02-25 23:35 ` Dave Chinner
1 sibling, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2014-02-25 19:52 UTC (permalink / raw)
To: xfs
Signed-off-by: Christoph Hellwig <hch@lst.de>
diff --git a/io/Makefile b/io/Makefile
index eaeb5b2..c16af87 100644
--- a/io/Makefile
+++ b/io/Makefile
@@ -9,8 +9,8 @@ LTCOMMAND = xfs_io
LSRCFILES = xfs_bmap.sh xfs_freeze.sh xfs_mkfile.sh
HFILES = init.h io.h
CFILES = init.c \
- attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c mmap.c \
- open.c parent.c pread.c prealloc.c pwrite.c seek.c shutdown.c \
+ attr.c bmap.c file.c freeze.c fsync.c getrusage.c imap.c link.c \
+ mmap.c open.c parent.c pread.c prealloc.c pwrite.c seek.c shutdown.c \
truncate.c
LLDLIBS = $(LIBXCMD) $(LIBHANDLE)
diff --git a/io/init.c b/io/init.c
index fd1a52f..7d7bb89 100644
--- a/io/init.c
+++ b/io/init.c
@@ -58,6 +58,7 @@ init_commands(void)
bmap_init();
fadvise_init();
file_init();
+ flink_init();
freeze_init();
fsync_init();
getrusage_init();
diff --git a/io/io.h b/io/io.h
index 0d2d768..1b3bca1 100644
--- a/io/io.h
+++ b/io/io.h
@@ -93,6 +93,7 @@ extern void dump_buffer(off64_t, ssize_t);
extern void attr_init(void);
extern void bmap_init(void);
extern void file_init(void);
+extern void flink_init(void);
extern void freeze_init(void);
extern void fsync_init(void);
extern void getrusage_init(void);
diff --git a/io/link.c b/io/link.c
new file mode 100644
index 0000000..9c2d1f8
--- /dev/null
+++ b/io/link.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014 Christoph Hellwig.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <xfs/xfs.h>
+#include <xfs/command.h>
+#include <xfs/input.h>
+#include "init.h"
+#include "io.h"
+
+#ifndef AT_EMPTY_PATH
+#define AT_EMPTY_PATH 0x1000
+#endif
+
+static cmdinfo_t flink_cmd;
+
+static void
+flink_help(void)
+{
+ printf(_(
+"\n"
+"link the open file descriptor to the supplied filename\n"
+"\n"
+"\n"));
+}
+
+static int
+flink_f(
+ int argc,
+ char **argv)
+{
+ if (argc != 2)
+ return command_usage(&flink_cmd);
+
+ if (linkat(file->fd, "", AT_FDCWD, argv[1], AT_EMPTY_PATH) < 0) {
+ perror("flink");
+ return 0;
+ }
+ return 0;
+}
+
+void
+flink_init(void)
+{
+ flink_cmd.name = "flink";
+ flink_cmd.cfunc = flink_f;
+ flink_cmd.argmin = 1;
+ flink_cmd.argmax = 1;
+ flink_cmd.flags = CMD_NOMAP_OK | CMD_FOREIGN_OK;
+ flink_cmd.args = _("filename");
+ flink_cmd.oneline =
+ _("link the open file descriptor to the supplied filename");
+ flink_cmd.help = flink_help;
+
+ add_command(&flink_cmd);
+}
diff --git a/man/man8/xfs_io.8 b/man/man8/xfs_io.8
index 7a92ff6..72f8210 100644
--- a/man/man8/xfs_io.8
+++ b/man/man8/xfs_io.8
@@ -638,6 +638,10 @@ Only available in expert mode and requires privileges.
Undo the effects of a filesystem freeze operation.
Only available in expert mode and requires privileges.
.TP
+.BI "flink " path
+Reads a range of bytes in a specified blocksize from the given
+Link the currently open file descriptor into the filesystem namespace.
+.TP
.BI "inject [ " tag " ]"
Inject errors into a filesystem to observe filesystem behavior at
specific points under adverse conditions. Without the
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH v2] xfs_io: add support for flink
2014-02-25 19:52 ` [PATCH v2] " Christoph Hellwig
@ 2014-02-25 23:35 ` Dave Chinner
2014-03-13 10:09 ` Christoph Hellwig
0 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2014-02-25 23:35 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Tue, Feb 25, 2014 at 11:52:18AM -0800, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
....
> --- a/man/man8/xfs_io.8
> +++ b/man/man8/xfs_io.8
> @@ -638,6 +638,10 @@ Only available in expert mode and requires privileges.
> Undo the effects of a filesystem freeze operation.
> Only available in expert mode and requires privileges.
> .TP
> +.BI "flink " path
> +Reads a range of bytes in a specified blocksize from the given
> +Link the currently open file descriptor into the filesystem namespace.
> +.TP
Looks like some noise got into that hunk. Other than that:
Reviewed-by: Dave Chinner <dchinner@redhat.com>
I'll remove that extra line when I commit it.
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] 14+ messages in thread
* Re: [PATCH v2] xfs_io: add support for flink
2014-02-25 23:35 ` Dave Chinner
@ 2014-03-13 10:09 ` Christoph Hellwig
2014-03-13 10:21 ` Dave Chinner
0 siblings, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2014-03-13 10:09 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Wed, Feb 26, 2014 at 10:35:57AM +1100, Dave Chinner wrote:
> Looks like some noise got into that hunk. Other than that:
>
> Reviewed-by: Dave Chinner <dchinner@redhat.com>
>
> I'll remove that extra line when I commit it.
ping?
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] xfs_io: add support for flink
2014-03-13 10:09 ` Christoph Hellwig
@ 2014-03-13 10:21 ` Dave Chinner
2014-03-13 10:42 ` Dave Chinner
0 siblings, 1 reply; 14+ messages in thread
From: Dave Chinner @ 2014-03-13 10:21 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, Mar 13, 2014 at 03:09:33AM -0700, Christoph Hellwig wrote:
> On Wed, Feb 26, 2014 at 10:35:57AM +1100, Dave Chinner wrote:
> > Looks like some noise got into that hunk. Other than that:
> >
> > Reviewed-by: Dave Chinner <dchinner@redhat.com>
> >
> > I'll remove that extra line when I commit it.
>
> ping?
Sorry, I missed them in the last round of commits. I'll sort it out.
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] 14+ messages in thread
* Re: [PATCH v2] xfs_io: add support for flink
2014-03-13 10:21 ` Dave Chinner
@ 2014-03-13 10:42 ` Dave Chinner
0 siblings, 0 replies; 14+ messages in thread
From: Dave Chinner @ 2014-03-13 10:42 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: xfs
On Thu, Mar 13, 2014 at 09:21:08PM +1100, Dave Chinner wrote:
> On Thu, Mar 13, 2014 at 03:09:33AM -0700, Christoph Hellwig wrote:
> > On Wed, Feb 26, 2014 at 10:35:57AM +1100, Dave Chinner wrote:
> > > Looks like some noise got into that hunk. Other than that:
> > >
> > > Reviewed-by: Dave Chinner <dchinner@redhat.com>
> > >
> > > I'll remove that extra line when I commit it.
> >
> > ping?
>
> Sorry, I missed them in the last round of commits. I'll sort it out.
OK, committed and pushed - aa210c4 should be the new head.
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] 14+ messages in thread
end of thread, other threads:[~2014-03-13 10:43 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-20 22:00 [PATCH] xfs_io: add support for O_TMPFILE opens Christoph Hellwig
2014-02-20 22:15 ` Dave Chinner
2014-02-20 22:40 ` Christoph Hellwig
2014-02-21 0:16 ` Shaun Gosse
2014-02-21 0:20 ` Christoph Hellwig
2014-02-21 0:30 ` [PATCH v2] " Christoph Hellwig
2014-02-23 21:01 ` Dave Chinner
2014-02-21 0:49 ` [PATCH] xfs_io: add support for flink Christoph Hellwig
2014-02-23 21:06 ` Dave Chinner
2014-02-25 19:52 ` [PATCH v2] " Christoph Hellwig
2014-02-25 23:35 ` Dave Chinner
2014-03-13 10:09 ` Christoph Hellwig
2014-03-13 10:21 ` Dave Chinner
2014-03-13 10:42 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox