lkml.org 
[lkml]   [2005]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ramfs: pretend dirent sizes
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.
-
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/

\
 
 \ /
  Last update: 2005-07-15 05:18    [W:0.100 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site