| .. | .. |
|---|
| 10 | 10 | #include "orangefs-bufmap.h" |
|---|
| 11 | 11 | |
|---|
| 12 | 12 | #include <linux/parser.h> |
|---|
| 13 | +#include <linux/hashtable.h> |
|---|
| 13 | 14 | |
|---|
| 14 | 15 | /* a cache for orangefs-inode objects (i.e. orangefs inode private data) */ |
|---|
| 15 | 16 | static struct kmem_cache *orangefs_inode_cache; |
|---|
| .. | .. |
|---|
| 124 | 125 | return &orangefs_inode->vfs_inode; |
|---|
| 125 | 126 | } |
|---|
| 126 | 127 | |
|---|
| 127 | | -static void orangefs_i_callback(struct rcu_head *head) |
|---|
| 128 | +static void orangefs_free_inode(struct inode *inode) |
|---|
| 128 | 129 | { |
|---|
| 129 | | - struct inode *inode = container_of(head, struct inode, i_rcu); |
|---|
| 130 | 130 | 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 | + |
|---|
| 131 | 140 | kmem_cache_free(orangefs_inode_cache, orangefs_inode); |
|---|
| 132 | 141 | } |
|---|
| 133 | 142 | |
|---|
| .. | .. |
|---|
| 138 | 147 | gossip_debug(GOSSIP_SUPER_DEBUG, |
|---|
| 139 | 148 | "%s: deallocated %p destroying inode %pU\n", |
|---|
| 140 | 149 | __func__, orangefs_inode, get_khandle_from_ino(inode)); |
|---|
| 150 | +} |
|---|
| 141 | 151 | |
|---|
| 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); |
|---|
| 143 | 157 | } |
|---|
| 144 | 158 | |
|---|
| 145 | 159 | /* |
|---|
| .. | .. |
|---|
| 299 | 313 | |
|---|
| 300 | 314 | static const struct super_operations orangefs_s_ops = { |
|---|
| 301 | 315 | .alloc_inode = orangefs_alloc_inode, |
|---|
| 316 | + .free_inode = orangefs_free_inode, |
|---|
| 302 | 317 | .destroy_inode = orangefs_destroy_inode, |
|---|
| 318 | + .write_inode = orangefs_write_inode, |
|---|
| 303 | 319 | .drop_inode = generic_delete_inode, |
|---|
| 304 | 320 | .statfs = orangefs_statfs, |
|---|
| 305 | 321 | .remount_fs = orangefs_remount_fs, |
|---|
| .. | .. |
|---|
| 397 | 413 | struct orangefs_fs_mount_response *fs_mount, |
|---|
| 398 | 414 | void *data, int silent) |
|---|
| 399 | 415 | { |
|---|
| 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; |
|---|
| 403 | 419 | struct orangefs_object_kref root_object; |
|---|
| 404 | 420 | |
|---|
| 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; |
|---|
| 409 | 421 | ORANGEFS_SB(sb)->sb = sb; |
|---|
| 410 | 422 | |
|---|
| 411 | 423 | ORANGEFS_SB(sb)->root_khandle = fs_mount->root_khandle; |
|---|
| .. | .. |
|---|
| 427 | 439 | sb->s_blocksize = PAGE_SIZE; |
|---|
| 428 | 440 | sb->s_blocksize_bits = PAGE_SHIFT; |
|---|
| 429 | 441 | sb->s_maxbytes = MAX_LFS_FILESIZE; |
|---|
| 442 | + |
|---|
| 443 | + ret = super_setup_bdi(sb); |
|---|
| 444 | + if (ret) |
|---|
| 445 | + return ret; |
|---|
| 430 | 446 | |
|---|
| 431 | 447 | root_object.khandle = ORANGEFS_SB(sb)->root_khandle; |
|---|
| 432 | 448 | root_object.fs_id = ORANGEFS_SB(sb)->fs_id; |
|---|
| .. | .. |
|---|
| 506 | 522 | goto free_op; |
|---|
| 507 | 523 | } |
|---|
| 508 | 524 | |
|---|
| 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 | + |
|---|
| 509 | 532 | ret = orangefs_fill_sb(sb, |
|---|
| 510 | 533 | &new_op->downcall.resp.fs_mount, data, |
|---|
| 511 | 534 | flags & SB_SILENT ? 1 : 0); |
|---|