diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2018-10-02 11:58:09 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-10-08 08:36:58 +0200 |
commit | 22d8660e7b77250a12ecf76dc4f20588e3f9257e (patch) | |
tree | fca169cef3c79af0658fe97e6be422d9013debf7 /fs | |
parent | 46ade6ebdc0ab5a24ca44ed132579523a48a4493 (diff) | |
download | barebox-22d8660e7b77250a12ecf76dc4f20588e3f9257e.tar.gz barebox-22d8660e7b77250a12ecf76dc4f20588e3f9257e.tar.xz |
fs: implement iget_locked and iget_failed
Implement in fs core rather than using a private version in UBIFS.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fs.c | 24 | ||||
-rw-r--r-- | fs/ubifs/super.c | 29 |
2 files changed, 24 insertions, 29 deletions
@@ -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); |