Linux-Fsdevel Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up
@ 2017-01-09 19:12 Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino() Fabian Frederick
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

This small patchset makes AFFS work with NFS for standard operations.
V2 adds a new patch suggested by Alexander Viro in order to work with cold dcache.

Fabian Frederick (7):
  fs/affs: remove reference to affs_parent_ino()
  fs/affs: add validation block function
  fs/affs: make affs exportable
  fs/affs: use octal for permissions
  fs/affs: add prefix to some functions
  fs/affs/namei.c: forward declarations clean-up
  fs/affs: make export work with cold dcache

 fs/affs/affs.h     | 22 ++++++++-----
 fs/affs/amigaffs.c | 42 ++++++++++++------------
 fs/affs/inode.c    |  9 +++---
 fs/affs/namei.c    | 95 +++++++++++++++++++++++++++++++++++++++++-------------
 fs/affs/super.c    |  3 +-
 5 files changed, 114 insertions(+), 57 deletions(-)

-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino()
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 2/7 linux-next] fs/affs: add validation block function Fabian Frederick
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

That function was removed a long time ago.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/affs.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 2f08877..899256b 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -178,7 +178,6 @@ extern int	affs_rename(struct inode *old_dir, struct dentry *old_dentry,
 
 /* inode.c */
 
-extern unsigned long		 affs_parent_ino(struct inode *dir);
 extern struct inode		*affs_new_inode(struct inode *dir);
 extern int			 affs_notify_change(struct dentry *dentry, struct iattr *attr);
 extern void			 affs_evict_inode(struct inode *inode);
-- 
2.9.3

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 2/7 linux-next] fs/affs: add validation block function
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino() Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 3/7 linux-next] fs/affs: make affs exportable Fabian Frederick
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

avoid repeating 4 times the same calculation.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/affs.h | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 899256b..efe6839 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -212,6 +212,12 @@ extern const struct address_space_operations	 affs_aops_ofs;
 extern const struct dentry_operations	 affs_dentry_operations;
 extern const struct dentry_operations	 affs_intl_dentry_operations;
 
+static inline bool affs_validblock(struct super_block *sb, int block)
+{
+	return(block >= AFFS_SB(sb)->s_reserved &&
+	       block < AFFS_SB(sb)->s_partition_size);
+}
+
 static inline void
 affs_set_blocksize(struct super_block *sb, int size)
 {
@@ -221,7 +227,7 @@ static inline struct buffer_head *
 affs_bread(struct super_block *sb, int block)
 {
 	pr_debug("%s: %d\n", __func__, block);
-	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
+	if (affs_validblock(sb, block))
 		return sb_bread(sb, block);
 	return NULL;
 }
@@ -229,7 +235,7 @@ static inline struct buffer_head *
 affs_getblk(struct super_block *sb, int block)
 {
 	pr_debug("%s: %d\n", __func__, block);
-	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size)
+	if (affs_validblock(sb, block))
 		return sb_getblk(sb, block);
 	return NULL;
 }
@@ -238,7 +244,7 @@ affs_getzeroblk(struct super_block *sb, int block)
 {
 	struct buffer_head *bh;
 	pr_debug("%s: %d\n", __func__, block);
-	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
+	if (affs_validblock(sb, block)) {
 		bh = sb_getblk(sb, block);
 		lock_buffer(bh);
 		memset(bh->b_data, 0 , sb->s_blocksize);
@@ -253,7 +259,7 @@ affs_getemptyblk(struct super_block *sb, int block)
 {
 	struct buffer_head *bh;
 	pr_debug("%s: %d\n", __func__, block);
-	if (block >= AFFS_SB(sb)->s_reserved && block < AFFS_SB(sb)->s_partition_size) {
+	if (affs_validblock(sb, block)) {
 		bh = sb_getblk(sb, block);
 		wait_on_buffer(bh);
 		set_buffer_uptodate(bh);
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 3/7 linux-next] fs/affs: make affs exportable
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino() Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 2/7 linux-next] fs/affs: add validation block function Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 4/7 linux-next] fs/affs: use octal for permissions Fabian Frederick
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

Add standard functions making AFFS work with NFS.

Functions based on ext4 implementation.
Tested on loop device.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/affs.h  |  1 +
 fs/affs/namei.c | 40 ++++++++++++++++++++++++++++++++++++++++
 fs/affs/super.c |  1 +
 3 files changed, 42 insertions(+)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index efe6839..1b55428 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -162,6 +162,7 @@ extern void	affs_free_bitmap(struct super_block *sb);
 
 /* namei.c */
 
+extern const struct export_operations affs_export_ops;
 extern int	affs_hash_name(struct super_block *sb, const u8 *name, unsigned int len);
 extern struct dentry *affs_lookup(struct inode *dir, struct dentry *dentry, unsigned int);
 extern int	affs_unlink(struct inode *dir, struct dentry *dentry);
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 29186d2..04c3156f 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -9,6 +9,7 @@
  */
 
 #include "affs.h"
+#include <linux/exportfs.h>
 
 typedef int (*toupper_t)(int);
 
@@ -465,3 +466,42 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	affs_brelse(bh);
 	return retval;
 }
+
+static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino,
+					u32 generation)
+{
+	struct inode *inode;
+
+	if (!affs_validblock(sb, ino))
+		return ERR_PTR(-ESTALE);
+
+	inode = affs_iget(sb, ino);
+	if (IS_ERR(inode))
+		return ERR_CAST(inode);
+
+	if (generation && inode->i_generation != generation) {
+		iput(inode);
+		return ERR_PTR(-ESTALE);
+	}
+
+	return inode;
+}
+
+static struct dentry *affs_fh_to_dentry(struct super_block *sb, struct fid *fid,
+					int fh_len, int fh_type)
+{
+	return generic_fh_to_dentry(sb, fid, fh_len, fh_type,
+				    affs_nfs_get_inode);
+}
+
+static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid,
+					int fh_len, int fh_type)
+{
+	return generic_fh_to_parent(sb, fid, fh_len, fh_type,
+				    affs_nfs_get_inode);
+}
+
+const struct export_operations affs_export_ops = {
+	.fh_to_dentry = affs_fh_to_dentry,
+	.fh_to_parent = affs_fh_to_parent,
+};
diff --git a/fs/affs/super.c b/fs/affs/super.c
index d638486..98bd952 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -507,6 +507,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
 		return -ENOMEM;
 	}
 
+	sb->s_export_op = &affs_export_ops;
 	pr_debug("s_flags=%lX\n", sb->s_flags);
 	return 0;
 }
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 4/7 linux-next] fs/affs: use octal for permissions
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
                   ` (2 preceding siblings ...)
  2017-01-09 19:12 ` [PATCH V2 3/7 linux-next] fs/affs: make affs exportable Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 5/7 linux-next] fs/affs: add prefix to some functions Fabian Frederick
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

According to commit f90774e1fd27
("checkpatch: look for symbolic permissions and suggest octal instead")

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/amigaffs.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index 0ec65c1..fd7a754 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -391,23 +391,23 @@ prot_to_mode(u32 prot)
 	umode_t mode = 0;
 
 	if (!(prot & FIBF_NOWRITE))
-		mode |= S_IWUSR;
+		mode |= 0200;
 	if (!(prot & FIBF_NOREAD))
-		mode |= S_IRUSR;
+		mode |= 0400;
 	if (!(prot & FIBF_NOEXECUTE))
-		mode |= S_IXUSR;
+		mode |= 0100;
 	if (prot & FIBF_GRP_WRITE)
-		mode |= S_IWGRP;
+		mode |= 0020;
 	if (prot & FIBF_GRP_READ)
-		mode |= S_IRGRP;
+		mode |= 0040;
 	if (prot & FIBF_GRP_EXECUTE)
-		mode |= S_IXGRP;
+		mode |= 0010;
 	if (prot & FIBF_OTR_WRITE)
-		mode |= S_IWOTH;
+		mode |= 0002;
 	if (prot & FIBF_OTR_READ)
-		mode |= S_IROTH;
+		mode |= 0004;
 	if (prot & FIBF_OTR_EXECUTE)
-		mode |= S_IXOTH;
+		mode |= 0001;
 
 	return mode;
 }
@@ -418,23 +418,23 @@ mode_to_prot(struct inode *inode)
 	u32 prot = AFFS_I(inode)->i_protect;
 	umode_t mode = inode->i_mode;
 
-	if (!(mode & S_IXUSR))
+	if (!(mode & 0100))
 		prot |= FIBF_NOEXECUTE;
-	if (!(mode & S_IRUSR))
+	if (!(mode & 0400))
 		prot |= FIBF_NOREAD;
-	if (!(mode & S_IWUSR))
+	if (!(mode & 0200))
 		prot |= FIBF_NOWRITE;
-	if (mode & S_IXGRP)
+	if (mode & 0010)
 		prot |= FIBF_GRP_EXECUTE;
-	if (mode & S_IRGRP)
+	if (mode & 0040)
 		prot |= FIBF_GRP_READ;
-	if (mode & S_IWGRP)
+	if (mode & 0020)
 		prot |= FIBF_GRP_WRITE;
-	if (mode & S_IXOTH)
+	if (mode & 0001)
 		prot |= FIBF_OTR_EXECUTE;
-	if (mode & S_IROTH)
+	if (mode & 0004)
 		prot |= FIBF_OTR_READ;
-	if (mode & S_IWOTH)
+	if (mode & 0002)
 		prot |= FIBF_OTR_WRITE;
 
 	AFFS_I(inode)->i_protect = prot;
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 5/7 linux-next] fs/affs: add prefix to some functions
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
                   ` (3 preceding siblings ...)
  2017-01-09 19:12 ` [PATCH V2 4/7 linux-next] fs/affs: use octal for permissions Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 6/7 linux-next] fs/affs/namei.c: forward declarations clean-up Fabian Frederick
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

secs_to_datestamp(time64_t secs, struct affs_date *ds);
prot_to_mode(u32 prot);
mode_to_prot(struct inode *inode);

were declared without affs_ prefix

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/affs.h     | 6 +++---
 fs/affs/amigaffs.c | 6 +++---
 fs/affs/inode.c    | 9 +++++----
 fs/affs/namei.c    | 6 +++---
 fs/affs/super.c    | 2 +-
 5 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/fs/affs/affs.h b/fs/affs/affs.h
index 1b55428..2f8bab3 100644
--- a/fs/affs/affs.h
+++ b/fs/affs/affs.h
@@ -138,9 +138,9 @@ extern int	affs_remove_hash(struct inode *dir, struct buffer_head *rem_bh);
 extern int	affs_remove_header(struct dentry *dentry);
 extern u32	affs_checksum_block(struct super_block *sb, struct buffer_head *bh);
 extern void	affs_fix_checksum(struct super_block *sb, struct buffer_head *bh);
-extern void	secs_to_datestamp(time64_t secs, struct affs_date *ds);
-extern umode_t	prot_to_mode(u32 prot);
-extern void	mode_to_prot(struct inode *inode);
+extern void	affs_secs_to_datestamp(time64_t secs, struct affs_date *ds);
+extern umode_t	affs_prot_to_mode(u32 prot);
+extern void	affs_mode_to_prot(struct inode *inode);
 __printf(3, 4)
 extern void	affs_error(struct super_block *sb, const char *function,
 			   const char *fmt, ...);
diff --git a/fs/affs/amigaffs.c b/fs/affs/amigaffs.c
index fd7a754..b573c3b 100644
--- a/fs/affs/amigaffs.c
+++ b/fs/affs/amigaffs.c
@@ -367,7 +367,7 @@ affs_fix_checksum(struct super_block *sb, struct buffer_head *bh)
 }
 
 void
-secs_to_datestamp(time64_t secs, struct affs_date *ds)
+affs_secs_to_datestamp(time64_t secs, struct affs_date *ds)
 {
 	u32	 days;
 	u32	 minute;
@@ -386,7 +386,7 @@ secs_to_datestamp(time64_t secs, struct affs_date *ds)
 }
 
 umode_t
-prot_to_mode(u32 prot)
+affs_prot_to_mode(u32 prot)
 {
 	umode_t mode = 0;
 
@@ -413,7 +413,7 @@ prot_to_mode(u32 prot)
 }
 
 void
-mode_to_prot(struct inode *inode)
+affs_mode_to_prot(struct inode *inode)
 {
 	u32 prot = AFFS_I(inode)->i_protect;
 	umode_t mode = inode->i_mode;
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index fe4e129..a5e6097 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -69,7 +69,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
 	if (affs_test_opt(sbi->s_flags, SF_SETMODE))
 		inode->i_mode = sbi->s_mode;
 	else
-		inode->i_mode = prot_to_mode(prot);
+		inode->i_mode = affs_prot_to_mode(prot);
 
 	id = be16_to_cpu(tail->uid);
 	if (id == 0 || affs_test_opt(sbi->s_flags, SF_SETUID))
@@ -184,11 +184,12 @@ affs_write_inode(struct inode *inode, struct writeback_control *wbc)
 	}
 	tail = AFFS_TAIL(sb, bh);
 	if (tail->stype == cpu_to_be32(ST_ROOT)) {
-		secs_to_datestamp(inode->i_mtime.tv_sec,&AFFS_ROOT_TAIL(sb, bh)->root_change);
+		affs_secs_to_datestamp(inode->i_mtime.tv_sec,
+				       &AFFS_ROOT_TAIL(sb, bh)->root_change);
 	} else {
 		tail->protect = cpu_to_be32(AFFS_I(inode)->i_protect);
 		tail->size = cpu_to_be32(inode->i_size);
-		secs_to_datestamp(inode->i_mtime.tv_sec,&tail->change);
+		affs_secs_to_datestamp(inode->i_mtime.tv_sec, &tail->change);
 		if (!(inode->i_ino == AFFS_SB(sb)->s_root_block)) {
 			uid = i_uid_read(inode);
 			gid = i_gid_read(inode);
@@ -249,7 +250,7 @@ affs_notify_change(struct dentry *dentry, struct iattr *attr)
 	mark_inode_dirty(inode);
 
 	if (attr->ia_valid & ATTR_MODE)
-		mode_to_prot(inode);
+		affs_mode_to_prot(inode);
 out:
 	return error;
 }
diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 04c3156f..906ff5b 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -272,7 +272,7 @@ affs_create(struct inode *dir, struct dentry *dentry, umode_t mode, bool excl)
 		return -ENOSPC;
 
 	inode->i_mode = mode;
-	mode_to_prot(inode);
+	affs_mode_to_prot(inode);
 	mark_inode_dirty(inode);
 
 	inode->i_op = &affs_file_inode_operations;
@@ -302,7 +302,7 @@ affs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 		return -ENOSPC;
 
 	inode->i_mode = S_IFDIR | mode;
-	mode_to_prot(inode);
+	affs_mode_to_prot(inode);
 
 	inode->i_op = &affs_dir_inode_operations;
 	inode->i_fop = &affs_dir_operations;
@@ -348,7 +348,7 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
 	inode_nohighmem(inode);
 	inode->i_data.a_ops = &affs_symlink_aops;
 	inode->i_mode = S_IFLNK | 0777;
-	mode_to_prot(inode);
+	affs_mode_to_prot(inode);
 
 	error = -EIO;
 	bh = affs_bread(sb, inode->i_ino);
diff --git a/fs/affs/super.c b/fs/affs/super.c
index 98bd952..37532538 100644
--- a/fs/affs/super.c
+++ b/fs/affs/super.c
@@ -32,7 +32,7 @@ affs_commit_super(struct super_block *sb, int wait)
 	struct affs_root_tail *tail = AFFS_ROOT_TAIL(sb, bh);
 
 	lock_buffer(bh);
-	secs_to_datestamp(ktime_get_real_seconds(), &tail->disk_change);
+	affs_secs_to_datestamp(ktime_get_real_seconds(), &tail->disk_change);
 	affs_fix_checksum(sb, bh);
 	unlock_buffer(bh);
 
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 6/7 linux-next] fs/affs/namei.c: forward declarations clean-up
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
                   ` (4 preceding siblings ...)
  2017-01-09 19:12 ` [PATCH V2 5/7 linux-next] fs/affs: add prefix to some functions Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-09 19:12 ` [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache Fabian Frederick
  2017-01-18 18:46 ` [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

move dentry_operations structures and remove
forward declarations

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/namei.c | 30 ++++++++++--------------------
 1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index 906ff5b..fb88446 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -13,26 +13,6 @@
 
 typedef int (*toupper_t)(int);
 
-static int	 affs_toupper(int ch);
-static int	 affs_hash_dentry(const struct dentry *, struct qstr *);
-static int       affs_compare_dentry(const struct dentry *dentry,
-		unsigned int len, const char *str, const struct qstr *name);
-static int	 affs_intl_toupper(int ch);
-static int	 affs_intl_hash_dentry(const struct dentry *, struct qstr *);
-static int       affs_intl_compare_dentry(const struct dentry *dentry,
-		unsigned int len, const char *str, const struct qstr *name);
-
-const struct dentry_operations affs_dentry_operations = {
-	.d_hash		= affs_hash_dentry,
-	.d_compare	= affs_compare_dentry,
-};
-
-const struct dentry_operations affs_intl_dentry_operations = {
-	.d_hash		= affs_intl_hash_dentry,
-	.d_compare	= affs_intl_compare_dentry,
-};
-
-
 /* Simple toupper() for DOS\1 */
 
 static int
@@ -505,3 +485,13 @@ const struct export_operations affs_export_ops = {
 	.fh_to_dentry = affs_fh_to_dentry,
 	.fh_to_parent = affs_fh_to_parent,
 };
+
+const struct dentry_operations affs_dentry_operations = {
+	.d_hash		= affs_hash_dentry,
+	.d_compare	= affs_compare_dentry,
+};
+
+const struct dentry_operations affs_intl_dentry_operations = {
+	.d_hash		= affs_intl_hash_dentry,
+	.d_compare	= affs_intl_compare_dentry,
+};
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
                   ` (5 preceding siblings ...)
  2017-01-09 19:12 ` [PATCH V2 6/7 linux-next] fs/affs/namei.c: forward declarations clean-up Fabian Frederick
@ 2017-01-09 19:12 ` Fabian Frederick
  2017-01-18 18:46 ` [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-09 19:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Jan Kara, Alexander Viro, linux-kernel, linux-fsdevel, fabf

This adds get_parent function so that nfs client
can still work after cache drop (Tested on NFS v4
with echo 3 > /proc/sys/vm/drop_caches)

Suggested-by: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/affs/namei.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/fs/affs/namei.c b/fs/affs/namei.c
index fb88446..a3df8a6 100644
--- a/fs/affs/namei.c
+++ b/fs/affs/namei.c
@@ -447,6 +447,24 @@ affs_rename(struct inode *old_dir, struct dentry *old_dentry,
 	return retval;
 }
 
+static struct dentry *affs_get_parent(struct dentry *child)
+{
+	struct inode *parent;
+	struct buffer_head *bh;
+
+	bh = affs_bread(child->d_sb, d_inode(child)->i_ino);
+	if (IS_ERR(bh))
+		return ERR_CAST(bh);
+
+	parent = affs_iget(child->d_sb,
+			   be32_to_cpu(AFFS_TAIL(child->d_sb, bh)->parent));
+	brelse(bh);
+	if (IS_ERR(parent))
+		return ERR_CAST(parent);
+
+	return d_obtain_alias(parent);
+}
+
 static struct inode *affs_nfs_get_inode(struct super_block *sb, u64 ino,
 					u32 generation)
 {
@@ -484,6 +502,7 @@ static struct dentry *affs_fh_to_parent(struct super_block *sb, struct fid *fid,
 const struct export_operations affs_export_ops = {
 	.fh_to_dentry = affs_fh_to_dentry,
 	.fh_to_parent = affs_fh_to_parent,
+	.get_parent = affs_get_parent,
 };
 
 const struct dentry_operations affs_dentry_operations = {
-- 
2.9.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up
  2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
                   ` (6 preceding siblings ...)
  2017-01-09 19:12 ` [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache Fabian Frederick
@ 2017-01-18 18:46 ` Fabian Frederick
  7 siblings, 0 replies; 9+ messages in thread
From: Fabian Frederick @ 2017-01-18 18:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Jan Kara, Alexander Viro, linux-fsdevel



> On 09 January 2017 at 20:12 Fabian Frederick <fabf@skynet.be> wrote:
>
>
> This small patchset makes AFFS work with NFS for standard operations.
> V2 adds a new patch suggested by Alexander Viro in order to work with cold
> dcache.
>
> Fabian Frederick (7):
>   fs/affs: remove reference to affs_parent_ino()
>   fs/affs: add validation block function
>   fs/affs: make affs exportable
>   fs/affs: use octal for permissions
>   fs/affs: add prefix to some functions
>   fs/affs/namei.c: forward declarations clean-up
>   fs/affs: make export work with cold dcache
>
>  fs/affs/affs.h     | 22 ++++++++-----
>  fs/affs/amigaffs.c | 42 ++++++++++++------------
>  fs/affs/inode.c    |  9 +++---
>  fs/affs/namei.c    | 95
>+++++++++++++++++++++++++++++++++++++++++-------------
>  fs/affs/super.c    |  3 +-
>  5 files changed, 114 insertions(+), 57 deletions(-)
>
> --
> 2.9.3
>

Hi Andrew,

   Do I have to CC someone else to apply these patches ?

Regards,
Fabian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-09 19:12 [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 1/7 linux-next] fs/affs: remove reference to affs_parent_ino() Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 2/7 linux-next] fs/affs: add validation block function Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 3/7 linux-next] fs/affs: make affs exportable Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 4/7 linux-next] fs/affs: use octal for permissions Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 5/7 linux-next] fs/affs: add prefix to some functions Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 6/7 linux-next] fs/affs/namei.c: forward declarations clean-up Fabian Frederick
2017-01-09 19:12 ` [PATCH V2 7/7 linux-next] fs/affs: make export work with cold dcache Fabian Frederick
2017-01-18 18:46 ` [PATCH V2 0/7 linux-next] make FS exportable plus some clean-up Fabian Frederick

Linux-Fsdevel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-fsdevel/0 linux-fsdevel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-fsdevel linux-fsdevel/ https://lore.kernel.org/linux-fsdevel \
		linux-fsdevel@vger.kernel.org
	public-inbox-index linux-fsdevel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-fsdevel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git