mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Jan Blunck <j.blunck@tu-harburg.de>
Cc: torvalds@osdl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ramfs: pretend dirent sizes
Date: Thu, 14 Jul 2005 20:11:20 -0700	[thread overview]
Message-ID: <20050714201120.73570316.akpm@osdl.org> (raw)
In-Reply-To: <42D72705.8010306@tu-harburg.de>

Jan Blunck <j.blunck@tu-harburg.de> wrote:
>
> This patch adds bogo dirent sizes for ramfs like already available for 
> tmpfs.
> 
> Although i_size of directories isn't covered by the POSIX standard it is 
> a bad idea to always set it to zero. Therefore pretend a bogo dirent 
> size for directory i_sizes.
> 

Does it really matter?

+static int ramfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
> +{
> +	dir->i_size += BOGO_DIRENT_SIZE;
> +	return simple_link(old_dentry, dir, dentry);
> +}
> +
> +static int ramfs_unlink(struct inode *dir, struct dentry *dentry)
> +{
> +	dir->i_size -= BOGO_DIRENT_SIZE;
> +	return simple_unlink(dir, dentry);
> +}
> +
> +static int ramfs_rmdir(struct inode *dir, struct dentry *dentry)
> +{
> +	int ret;
> +
> +	ret = simple_rmdir(dir, dentry);
> +	if (ret != -ENOTEMPTY)
> +		dir->i_size -= BOGO_DIRENT_SIZE;
> +
> +	return ret;
> +}
> +
> +static int ramfs_rename(struct inode *old_dir, struct dentry *old_dentry,
> +			struct inode *new_dir, struct dentry *new_dentry)
> +{
> +	int ret;
> +
> +	ret = simple_rename(old_dir, old_dentry, new_dir, new_dentry);
> +	if (ret != -ENOTEMPTY) {
> +		old_dir->i_size -= BOGO_DIRENT_SIZE;
> +		new_dir->i_size += BOGO_DIRENT_SIZE;
> +	}
> +
> +	return ret;
> +}
> +

I wonder if these should be in libfs - sysfs has the same problem, for
example and someone might want to come along and fix that up too.

  reply	other threads:[~2005-07-15  3:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-15  3:01 Jan Blunck
2005-07-15  3:11 ` Andrew Morton [this message]
2005-07-15 10:16   ` Jan Blunck
2005-07-15 18:52 ` Linus Torvalds
2005-07-16  0:39   ` Chris Wedgwood
2005-07-19  9:28     ` Jan Blunck
2005-07-19 16:16       ` Chris Wedgwood
2005-07-19 18:22         ` Jan Blunck
2005-07-19 18:32           ` Chris Wedgwood
2005-07-19 19:14             ` Jan Blunck
2005-07-19 19:16               ` Chris Wedgwood
2005-07-20 11:21                 ` Jörn Engel
2005-07-20 18:11                   ` Chris Wedgwood
2005-07-20 18:48                     ` Jan Blunck
2005-07-20 18:52                       ` Peter Staubach
2005-07-21  7:26                       ` Jörn Engel
2005-07-21  7:20                     ` Jörn Engel
2005-07-21  7:25                       ` Chris Wedgwood
2005-07-21  7:27                         ` Jörn Engel
2005-07-20 18:24                 ` Jan Blunck
2005-07-20 18:50                   ` Peter Staubach
2005-07-19  9:46   ` Jan Blunck
     [not found] <4qoKs-6yv-13@gated-at.bofh.it>
     [not found] ` <4qoU5-6CQ-3@gated-at.bofh.it>
     [not found]   ` <4qvsI-32Y-17@gated-at.bofh.it>
2005-07-15 13:12     ` Bodo Eggert
2005-07-19  9:13       ` Jan Blunck

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=20050714201120.73570316.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=j.blunck@tu-harburg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®