* [PATCH 1/1] reiserfs:Adding tmpfile support
@ 2013-12-25 13:23 Fabian Frederick
2013-12-25 13:39 ` Richard Weinberger
0 siblings, 1 reply; 3+ messages in thread
From: Fabian Frederick @ 2013-12-25 13:23 UTC (permalink / raw)
To: linux-kernel; +Cc: linux-fsdevel, akpm, viro, jeffm, jack
This patch is largely based on reiserfs_create function.
-Removing dquot_initialize (cf ext2/tmpfile)
-Removing add_entry code.
-Adding d_tmpfile generic call.
It was not extensively tested; other solutions would
be to work with hidden entries or merge
creation - tmpfile process.
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
fs/reiserfs/namei.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index dc5236f..125060b 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -637,6 +637,65 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
return retval;
}
+
+/* tmpfile function based on reiserfs_create without filename entry
+*/
+
+static int reiserfs_tmpfile(struct inode *dir, struct dentry *dentry,
+ umode_t mode)
+{
+ int retval;
+ struct inode *inode;
+ int jbegin_count =
+ JOURNAL_PER_BALANCE_CNT * 2 +
+ 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
+ REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
+ struct reiserfs_transaction_handle th;
+ struct reiserfs_security_handle security;
+
+ inode = new_inode(dir->i_sb);
+ if (!inode)
+ return -ENOMEM;
+
+ new_inode_init(inode, dir, mode);
+
+ jbegin_count += reiserfs_cache_default_acl(dir);
+ retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security);
+ if (retval < 0) {
+ drop_new_inode(inode);
+ return retval;
+ }
+ jbegin_count += retval;
+ reiserfs_write_lock(dir->i_sb);
+
+ retval = journal_begin(&th, dir->i_sb, jbegin_count);
+ if (retval) {
+ drop_new_inode(inode);
+ goto out_failed;
+ }
+
+ retval =
+ reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
+ inode, &security);
+ if (retval)
+ goto out_failed;
+
+ inode->i_op = &reiserfs_file_inode_operations;
+ inode->i_fop = &reiserfs_file_operations;
+ inode->i_mapping->a_ops = &reiserfs_address_space_operations;
+
+ reiserfs_update_inode_transaction(inode);
+ reiserfs_update_inode_transaction(dir);
+
+ unlock_new_inode(inode);
+ d_tmpfile(dentry, inode);
+ retval = journal_end(&th, dir->i_sb, jbegin_count);
+
+ out_failed:
+ reiserfs_write_unlock(dir->i_sb);
+ return retval;
+}
+
static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
dev_t rdev)
{
@@ -1522,6 +1581,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
.removexattr = reiserfs_removexattr,
.permission = reiserfs_permission,
.get_acl = reiserfs_get_acl,
+ .tmpfile = reiserfs_tmpfile,
};
/*
--
1.8.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] reiserfs:Adding tmpfile support
2013-12-25 13:23 [PATCH 1/1] reiserfs:Adding tmpfile support Fabian Frederick
@ 2013-12-25 13:39 ` Richard Weinberger
2013-12-26 9:02 ` Christoph Hellwig
0 siblings, 1 reply; 3+ messages in thread
From: Richard Weinberger @ 2013-12-25 13:39 UTC (permalink / raw)
To: Fabian Frederick
Cc: LKML, linux-fsdevel, Andrew Morton, Al Viro, Jeff Mahoney,
Jan Kara
On Wed, Dec 25, 2013 at 2:23 PM, Fabian Frederick <fabf@skynet.be> wrote:
> This patch is largely based on reiserfs_create function.
> -Removing dquot_initialize (cf ext2/tmpfile)
> -Removing add_entry code.
> -Adding d_tmpfile generic call.
>
> It was not extensively tested; other solutions would
> be to work with hidden entries or merge
> creation - tmpfile process.
Is it worth adding new features to a legacy file system like reiserfs?
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> fs/reiserfs/namei.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
>
> diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
> index dc5236f..125060b 100644
> --- a/fs/reiserfs/namei.c
> +++ b/fs/reiserfs/namei.c
> @@ -637,6 +637,65 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
> return retval;
> }
>
> +
> +/* tmpfile function based on reiserfs_create without filename entry
> +*/
> +
> +static int reiserfs_tmpfile(struct inode *dir, struct dentry *dentry,
> + umode_t mode)
> +{
> + int retval;
> + struct inode *inode;
> + int jbegin_count =
> + JOURNAL_PER_BALANCE_CNT * 2 +
> + 2 * (REISERFS_QUOTA_INIT_BLOCKS(dir->i_sb) +
> + REISERFS_QUOTA_TRANS_BLOCKS(dir->i_sb));
> + struct reiserfs_transaction_handle th;
> + struct reiserfs_security_handle security;
> +
> + inode = new_inode(dir->i_sb);
> + if (!inode)
> + return -ENOMEM;
> +
> + new_inode_init(inode, dir, mode);
> +
> + jbegin_count += reiserfs_cache_default_acl(dir);
> + retval = reiserfs_security_init(dir, inode, &dentry->d_name, &security);
> + if (retval < 0) {
> + drop_new_inode(inode);
> + return retval;
> + }
> + jbegin_count += retval;
> + reiserfs_write_lock(dir->i_sb);
> +
> + retval = journal_begin(&th, dir->i_sb, jbegin_count);
> + if (retval) {
> + drop_new_inode(inode);
> + goto out_failed;
> + }
> +
> + retval =
> + reiserfs_new_inode(&th, dir, mode, NULL, 0 /*i_size */ , dentry,
> + inode, &security);
> + if (retval)
> + goto out_failed;
> +
> + inode->i_op = &reiserfs_file_inode_operations;
> + inode->i_fop = &reiserfs_file_operations;
> + inode->i_mapping->a_ops = &reiserfs_address_space_operations;
> +
> + reiserfs_update_inode_transaction(inode);
> + reiserfs_update_inode_transaction(dir);
> +
> + unlock_new_inode(inode);
> + d_tmpfile(dentry, inode);
> + retval = journal_end(&th, dir->i_sb, jbegin_count);
> +
> + out_failed:
> + reiserfs_write_unlock(dir->i_sb);
> + return retval;
> +}
> +
> static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode,
> dev_t rdev)
> {
> @@ -1522,6 +1581,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
> .removexattr = reiserfs_removexattr,
> .permission = reiserfs_permission,
> .get_acl = reiserfs_get_acl,
> + .tmpfile = reiserfs_tmpfile,
> };
>
> /*
> --
> 1.8.1.4
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
--
Thanks,
//richard
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/1] reiserfs:Adding tmpfile support
2013-12-25 13:39 ` Richard Weinberger
@ 2013-12-26 9:02 ` Christoph Hellwig
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2013-12-26 9:02 UTC (permalink / raw)
To: Richard Weinberger
Cc: Fabian Frederick, LKML, linux-fsdevel, Andrew Morton, Al Viro,
Jeff Mahoney, Jan Kara
On Wed, Dec 25, 2013 at 02:39:48PM +0100, Richard Weinberger wrote:
> On Wed, Dec 25, 2013 at 2:23 PM, Fabian Frederick <fabf@skynet.be> wrote:
> > This patch is largely based on reiserfs_create function.
> > -Removing dquot_initialize (cf ext2/tmpfile)
> > -Removing add_entry code.
> > -Adding d_tmpfile generic call.
> >
> > It was not extensively tested; other solutions would
> > be to work with hidden entries or merge
> > creation - tmpfile process.
>
> Is it worth adding new features to a legacy file system like reiserfs?
Having user API parity is always a good thing, especially if it doesn't
require on-disk format changes. Same case as FIEMAP or
SEEK_DATA/SEEK_HOLE to mention some recent features.
That being said this needs to follow them model of ext3/ext3/xfs and
add the inode to the unlink/orphan inode list on tmpfile creation and
move it out on flink.
We'll also need a proper verifier for the expected behaviour, which I
hope we'll get out of the work in progress XFS support.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-26 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-25 13:23 [PATCH 1/1] reiserfs:Adding tmpfile support Fabian Frederick
2013-12-25 13:39 ` Richard Weinberger
2013-12-26 9:02 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).