Release 4.11 fs/udf/ialloc.c
/*
* ialloc.c
*
* PURPOSE
* Inode allocation handling routines for the OSTA-UDF(tm) filesystem.
*
* COPYRIGHT
* This file is distributed under the terms of the GNU General Public
* License (GPL). Copies of the GPL can be obtained from:
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*
* (C) 1998-2001 Ben Fennema
*
* HISTORY
*
* 02/24/99 blf Created.
*
*/
#include "udfdecl.h"
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include "udf_i.h"
#include "udf_sb.h"
void udf_free_inode(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);
struct logicalVolIntegrityDescImpUse *lvidiu = udf_sb_lvidiu(sb);
if (lvidiu) {
mutex_lock(&sbi->s_alloc_mutex);
if (S_ISDIR(inode->i_mode))
le32_add_cpu(&lvidiu->numDirs, -1);
else
le32_add_cpu(&lvidiu->numFiles, -1);
udf_updated_lvid(sb);
mutex_unlock(&sbi->s_alloc_mutex);
}
udf_free_blocks(sb, NULL, &UDF_I(inode)->i_location, 0, 1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 56 | 47.86% | 1 | 10.00% |
Marcin Ślusarz | 20 | 17.09% | 3 | 30.00% |
Christoph Hellwig | 18 | 15.38% | 1 | 10.00% |
Jan Kara | 17 | 14.53% | 2 | 20.00% |
Linus Torvalds | 3 | 2.56% | 1 | 10.00% |
Ingo Molnar | 2 | 1.71% | 1 | 10.00% |
Pekka J Enberg | 1 | 0.85% | 1 | 10.00% |
Total | 117 | 100.00% | 10 | 100.00% |
struct inode *udf_new_inode(struct inode *dir, umode_t mode)
{
struct super_block *sb = dir->i_sb;
struct udf_sb_info *sbi = UDF_SB(sb);
struct inode *inode;
int block;
uint32_t start = UDF_I(dir)->i_location.logicalBlockNum;
struct udf_inode_info *iinfo;
struct udf_inode_info *dinfo = UDF_I(dir);
struct logicalVolIntegrityDescImpUse *lvidiu;
int err;
inode = new_inode(sb);
if (!inode)
return ERR_PTR(-ENOMEM);
iinfo = UDF_I(inode);
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_EXTENDED_FE)) {
iinfo->i_efe = 1;
if (UDF_VERS_USE_EXTENDED_FE > sbi->s_udfrev)
sbi->s_udfrev = UDF_VERS_USE_EXTENDED_FE;
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
sizeof(struct extendedFileEntry),
GFP_KERNEL);
} else {
iinfo->i_efe = 0;
iinfo->i_ext.i_data = kzalloc(inode->i_sb->s_blocksize -
sizeof(struct fileEntry),
GFP_KERNEL);
}
if (!iinfo->i_ext.i_data) {
iput(inode);
return ERR_PTR(-ENOMEM);
}
err = -ENOSPC;
block = udf_new_block(dir->i_sb, NULL,
dinfo->i_location.partitionReferenceNum,
start, &err);
if (err) {
iput(inode);
return ERR_PTR(err);
}
lvidiu = udf_sb_lvidiu(sb);
if (lvidiu) {
iinfo->i_unique = lvid_get_unique_id(sb);
inode->i_generation = iinfo->i_unique;
mutex_lock(&sbi->s_alloc_mutex);
if (S_ISDIR(mode))
le32_add_cpu(&lvidiu->numDirs, 1);
else
le32_add_cpu(&lvidiu->numFiles, 1);
udf_updated_lvid(sb);
mutex_unlock(&sbi->s_alloc_mutex);
}
inode_init_owner(inode, dir, mode);
iinfo->i_location.logicalBlockNum = block;
iinfo->i_location.partitionReferenceNum =
dinfo->i_location.partitionReferenceNum;
inode->i_ino = udf_get_lb_pblock(sb, &iinfo->i_location, 0);
inode->i_blocks = 0;
iinfo->i_lenEAttr = 0;
iinfo->i_lenAlloc = 0;
iinfo->i_use = 0;
iinfo->i_checkpoint = 1;
if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_AD_IN_ICB))
iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
else if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_USE_SHORT_AD))
iinfo->i_alloc_type = ICBTAG_FLAG_AD_SHORT;
else
iinfo->i_alloc_type = ICBTAG_FLAG_AD_LONG;
inode->i_mtime = inode->i_atime = inode->i_ctime =
iinfo->i_crtime = current_time(inode);
if (unlikely(insert_inode_locked(inode) < 0)) {
make_bad_inode(inode);
iput(inode);
return ERR_PTR(-EIO);
}
mark_inode_dirty(inode);
return inode;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 199 | 38.72% | 3 | 11.11% |
Jan Kara | 135 | 26.26% | 6 | 22.22% |
Marcin Ślusarz | 78 | 15.18% | 4 | 14.81% |
Al Viro | 49 | 9.53% | 3 | 11.11% |
Christoph Hellwig | 14 | 2.72% | 1 | 3.70% |
Eric Sandeen | 12 | 2.33% | 1 | 3.70% |
Ben Fennema | 7 | 1.36% | 2 | 7.41% |
Steve Nickel | 6 | 1.17% | 1 | 3.70% |
Linus Torvalds | 5 | 0.97% | 2 | 7.41% |
Dmitriy Monakhov | 4 | 0.78% | 1 | 3.70% |
Andi Kleen | 3 | 0.58% | 1 | 3.70% |
Deepa Dinamani | 1 | 0.19% | 1 | 3.70% |
Pekka J Enberg | 1 | 0.19% | 1 | 3.70% |
Total | 514 | 100.00% | 27 | 100.00% |
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Linus Torvalds (pre-git) | 267 | 41.08% | 3 | 10.00% |
Jan Kara | 152 | 23.38% | 6 | 20.00% |
Marcin Ślusarz | 98 | 15.08% | 4 | 13.33% |
Al Viro | 49 | 7.54% | 3 | 10.00% |
Christoph Hellwig | 35 | 5.38% | 2 | 6.67% |
Eric Sandeen | 12 | 1.85% | 1 | 3.33% |
Ben Fennema | 10 | 1.54% | 2 | 6.67% |
Linus Torvalds | 8 | 1.23% | 2 | 6.67% |
Steve Nickel | 6 | 0.92% | 1 | 3.33% |
Dmitriy Monakhov | 4 | 0.62% | 1 | 3.33% |
Andi Kleen | 3 | 0.46% | 1 | 3.33% |
Pekka J Enberg | 2 | 0.31% | 1 | 3.33% |
Ingo Molnar | 2 | 0.31% | 1 | 3.33% |
Adrian Bunk | 1 | 0.15% | 1 | 3.33% |
Deepa Dinamani | 1 | 0.15% | 1 | 3.33% |
Total | 650 | 100.00% | 30 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.