diff options
author | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-12 08:42:04 -0500 |
---|---|---|
committer | Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp> | 2009-11-19 20:05:48 -0500 |
commit | 5731e191f254af9135ad843119804a500528ecf3 (patch) | |
tree | 1ababce01647674af0e9c6bfb36f5ab5e96ab76c /fs/nilfs2/mdt.c | |
parent | 9cb4e0d2b99e8b0e5e269d898ae6ab1967647c5a (diff) |
nilfs2: add size option of private object to metadata file allocator
This adds an optional "object size" argument to nilfs_mdt_new_common()
function; the argument specifies the size of private object attached
to a newly allocated metadata file inode.
This will afford space to keep local variables for meta data files.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Diffstat (limited to 'fs/nilfs2/mdt.c')
-rw-r--r-- | fs/nilfs2/mdt.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/fs/nilfs2/mdt.c b/fs/nilfs2/mdt.c index f6326112d647..62074e8d25cb 100644 --- a/fs/nilfs2/mdt.c +++ b/fs/nilfs2/mdt.c | |||
@@ -445,9 +445,17 @@ static const struct file_operations def_mdt_fops; | |||
445 | * longer than those of the super block structs; they may continue for | 445 | * longer than those of the super block structs; they may continue for |
446 | * several consecutive mounts/umounts. This would need discussions. | 446 | * several consecutive mounts/umounts. This would need discussions. |
447 | */ | 447 | */ |
448 | /** | ||
449 | * nilfs_mdt_new_common - allocate a pseudo inode for metadata file | ||
450 | * @nilfs: nilfs object | ||
451 | * @sb: super block instance the metadata file belongs to | ||
452 | * @ino: inode number | ||
453 | * @gfp_mask: gfp mask for data pages | ||
454 | * @objsz: size of the private object attached to inode->i_private | ||
455 | */ | ||
448 | struct inode * | 456 | struct inode * |
449 | nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb, | 457 | nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb, |
450 | ino_t ino, gfp_t gfp_mask) | 458 | ino_t ino, gfp_t gfp_mask, size_t objsz) |
451 | { | 459 | { |
452 | struct inode *inode = nilfs_alloc_inode_common(nilfs); | 460 | struct inode *inode = nilfs_alloc_inode_common(nilfs); |
453 | 461 | ||
@@ -455,8 +463,9 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb, | |||
455 | return NULL; | 463 | return NULL; |
456 | else { | 464 | else { |
457 | struct address_space * const mapping = &inode->i_data; | 465 | struct address_space * const mapping = &inode->i_data; |
458 | struct nilfs_mdt_info *mi = kzalloc(sizeof(*mi), GFP_NOFS); | 466 | struct nilfs_mdt_info *mi; |
459 | 467 | ||
468 | mi = kzalloc(max(sizeof(*mi), objsz), GFP_NOFS); | ||
460 | if (!mi) { | 469 | if (!mi) { |
461 | nilfs_destroy_inode(inode); | 470 | nilfs_destroy_inode(inode); |
462 | return NULL; | 471 | return NULL; |
@@ -513,11 +522,11 @@ nilfs_mdt_new_common(struct the_nilfs *nilfs, struct super_block *sb, | |||
513 | } | 522 | } |
514 | 523 | ||
515 | struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb, | 524 | struct inode *nilfs_mdt_new(struct the_nilfs *nilfs, struct super_block *sb, |
516 | ino_t ino) | 525 | ino_t ino, size_t objsz) |
517 | { | 526 | { |
518 | struct inode *inode = nilfs_mdt_new_common(nilfs, sb, ino, | 527 | struct inode *inode; |
519 | NILFS_MDT_GFP); | ||
520 | 528 | ||
529 | inode = nilfs_mdt_new_common(nilfs, sb, ino, NILFS_MDT_GFP, objsz); | ||
521 | if (!inode) | 530 | if (!inode) |
522 | return NULL; | 531 | return NULL; |
523 | 532 | ||