hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/fs/orangefs/super.c
....@@ -10,6 +10,7 @@
1010 #include "orangefs-bufmap.h"
1111
1212 #include <linux/parser.h>
13
+#include <linux/hashtable.h>
1314
1415 /* a cache for orangefs-inode objects (i.e. orangefs inode private data) */
1516 static struct kmem_cache *orangefs_inode_cache;
....@@ -124,10 +125,18 @@
124125 return &orangefs_inode->vfs_inode;
125126 }
126127
127
-static void orangefs_i_callback(struct rcu_head *head)
128
+static void orangefs_free_inode(struct inode *inode)
128129 {
129
- struct inode *inode = container_of(head, struct inode, i_rcu);
130130 struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode);
131
+ struct orangefs_cached_xattr *cx;
132
+ struct hlist_node *tmp;
133
+ int i;
134
+
135
+ hash_for_each_safe(orangefs_inode->xattr_cache, i, tmp, cx, node) {
136
+ hlist_del(&cx->node);
137
+ kfree(cx);
138
+ }
139
+
131140 kmem_cache_free(orangefs_inode_cache, orangefs_inode);
132141 }
133142
....@@ -138,8 +147,13 @@
138147 gossip_debug(GOSSIP_SUPER_DEBUG,
139148 "%s: deallocated %p destroying inode %pU\n",
140149 __func__, orangefs_inode, get_khandle_from_ino(inode));
150
+}
141151
142
- call_rcu(&inode->i_rcu, orangefs_i_callback);
152
+static int orangefs_write_inode(struct inode *inode,
153
+ struct writeback_control *wbc)
154
+{
155
+ gossip_debug(GOSSIP_SUPER_DEBUG, "orangefs_write_inode\n");
156
+ return orangefs_inode_setattr(inode);
143157 }
144158
145159 /*
....@@ -299,7 +313,9 @@
299313
300314 static const struct super_operations orangefs_s_ops = {
301315 .alloc_inode = orangefs_alloc_inode,
316
+ .free_inode = orangefs_free_inode,
302317 .destroy_inode = orangefs_destroy_inode,
318
+ .write_inode = orangefs_write_inode,
303319 .drop_inode = generic_delete_inode,
304320 .statfs = orangefs_statfs,
305321 .remount_fs = orangefs_remount_fs,
....@@ -397,15 +413,11 @@
397413 struct orangefs_fs_mount_response *fs_mount,
398414 void *data, int silent)
399415 {
400
- int ret = -EINVAL;
401
- struct inode *root = NULL;
402
- struct dentry *root_dentry = NULL;
416
+ int ret;
417
+ struct inode *root;
418
+ struct dentry *root_dentry;
403419 struct orangefs_object_kref root_object;
404420
405
- /* alloc and init our private orangefs sb info */
406
- sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL);
407
- if (!ORANGEFS_SB(sb))
408
- return -ENOMEM;
409421 ORANGEFS_SB(sb)->sb = sb;
410422
411423 ORANGEFS_SB(sb)->root_khandle = fs_mount->root_khandle;
....@@ -427,6 +439,10 @@
427439 sb->s_blocksize = PAGE_SIZE;
428440 sb->s_blocksize_bits = PAGE_SHIFT;
429441 sb->s_maxbytes = MAX_LFS_FILESIZE;
442
+
443
+ ret = super_setup_bdi(sb);
444
+ if (ret)
445
+ return ret;
430446
431447 root_object.khandle = ORANGEFS_SB(sb)->root_khandle;
432448 root_object.fs_id = ORANGEFS_SB(sb)->fs_id;
....@@ -506,6 +522,13 @@
506522 goto free_op;
507523 }
508524
525
+ /* alloc and init our private orangefs sb info */
526
+ sb->s_fs_info = kzalloc(sizeof(struct orangefs_sb_info_s), GFP_KERNEL);
527
+ if (!ORANGEFS_SB(sb)) {
528
+ d = ERR_PTR(-ENOMEM);
529
+ goto free_op;
530
+ }
531
+
509532 ret = orangefs_fill_sb(sb,
510533 &new_op->downcall.resp.fs_mount, data,
511534 flags & SB_SILENT ? 1 : 0);