mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 08/14] fs: implement iget_locked and iget_failed
Date: Tue,  2 Oct 2018 16:03:57 +0200	[thread overview]
Message-ID: <20181002140403.3735-9-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20181002140403.3735-1-s.hauer@pengutronix.de>

Implement in fs core rather than using a private version in UBIFS.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 fs/fs.c            | 24 ++++++++++++++++++++++++
 fs/ubifs/super.c   | 29 -----------------------------
 include/linux/fs.h |  2 ++
 3 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/fs/fs.c b/fs/fs.c
index 5bfc6f8b78..12851b7ae3 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -1051,6 +1051,30 @@ struct inode *new_inode(struct super_block *sb)
 	return inode;
 }
 
+struct inode *iget_locked(struct super_block *sb, unsigned long ino)
+{
+	struct inode *inode;
+
+	list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
+		if (inode->i_ino == ino)
+			return iget(inode);
+	}
+
+	inode = new_inode(sb);
+	if (!inode)
+		return NULL;
+
+	inode->i_state = I_NEW;
+	inode->i_ino = ino;
+
+	return inode;
+}
+
+void iget_failed(struct inode *inode)
+{
+	iput(inode);
+}
+
 void iput(struct inode *inode)
 {
 	if (!inode->i_count)
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index bfc0a4714a..8bd1803bce 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -55,26 +55,6 @@ int set_anon_super(struct super_block *s, void *data)
 	return 0;
 }
 
-struct inode *iget_locked(struct super_block *sb, unsigned long ino)
-{
-	struct inode *inode;
-
-	inode = (struct inode *)kzalloc(
-			sizeof(struct ubifs_inode), 0);
-	if (inode) {
-		inode->i_ino = ino;
-		inode->i_sb = sb;
-		list_add(&inode->i_sb_list, &sb->s_inodes);
-		inode->i_state = I_SYNC | I_NEW;
-	}
-
-	return inode;
-}
-
-void iget_failed(struct inode *inode)
-{
-}
-
 int ubifs_iput(struct inode *inode)
 {
 	list_del_init(&inode->i_sb_list);
@@ -2574,15 +2554,6 @@ int ubifs_get_super(struct device_d *dev, struct ubi_volume_desc *ubi, int silen
 	}
 	sb->s_dev = c->vi.cdev;
 
-	if (c->rw_incompat) {
-		ubifs_err(c, "the file-system is not R/W-compatible");
-		ubifs_msg(c, "on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d",
-			  c->fmt_version, c->ro_compat_version,
-			  UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION);
-		err = -EROFS;
-		goto out;
-	}
-
 	return 0;
 out:
 	kfree(c);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a29fd8fe4a..d38dc12872 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -482,5 +482,7 @@ int simple_rmdir(struct inode *dir, struct dentry *dentry);
 struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
 int dcache_readdir(struct file *, struct dir_context *);
 const char *simple_get_link(struct dentry *dentry, struct inode *inode);
+struct inode *iget_locked(struct super_block *, unsigned long);
+void iget_failed(struct inode *inode);
 
 #endif /* _LINUX_FS_H */
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-10-02 14:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02 14:03 [PATCH 00/14] UBIFS update Sascha Hauer
2018-10-02 14:03 ` [PATCH 01/14] Add linux/slab.h Sascha Hauer
2018-10-02 14:03 ` [PATCH 02/14] Add kmemdup Sascha Hauer
2018-10-02 14:03 ` [PATCH 03/14] Add more mutex no-ops Sascha Hauer
2018-10-02 14:03 ` [PATCH 04/14] fs: let dir_emit_dots return int Sascha Hauer
2018-10-02 14:03 ` [PATCH 05/14] fs: Add fscrypt no-op headers Sascha Hauer
2018-10-02 14:03 ` [PATCH 06/14] fs: Add SB_* flags Sascha Hauer
2018-10-02 14:03 ` [PATCH 07/14] fs: implement file_inode Sascha Hauer
2018-10-02 14:03 ` Sascha Hauer [this message]
2018-10-02 14:03 ` [PATCH 09/14] fs: implement clear_nlink and set_nlink Sascha Hauer
2018-10-02 14:03 ` [PATCH 10/14] fs: ubifs: remove not needed code Sascha Hauer
2018-10-02 14:04 ` [PATCH 11/14] compiler: Update to v4.19-rc6 Sascha Hauer
2018-10-02 14:04 ` [PATCH 12/14] vsprintf: implement %pV Sascha Hauer
2018-10-02 14:04 ` [PATCH 13/14] ubifs: Update to v4.18-rc6 Sascha Hauer
2018-10-02 14:04 ` [PATCH 14/14] fs: ubifs: optionally allow to mount UBIFS images with encrypted files Sascha Hauer
2018-10-03 20:50 ` [PATCH 00/14] UBIFS update Sam Ravnborg
2018-10-08  7:36   ` Sascha Hauer
2018-10-09 15:19     ` Sam Ravnborg

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=20181002140403.3735-9-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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