Commit 586985c4 authored by Oleg Drokin's avatar Oleg Drokin

reiserfs_fs_sb.h, reiserfs_fs.h, super.c, namei.c, inode.c, dir.c, bitmap.c:

  reiserfs: comment cleanups and a switch to new mount option parsing code.  REISERFS_MAX_NAME_LEN changed to REISERFS_MAX_NAME. hash= mount option support removed. By Vladimir Saveliev.
parent cb591b78
...@@ -670,10 +670,7 @@ int reiserfs_new_unf_blocknrs2 (struct reiserfs_transaction_handle *th, ...@@ -670,10 +670,7 @@ int reiserfs_new_unf_blocknrs2 (struct reiserfs_transaction_handle *th,
return ret; return ret;
} }
//
// a portion of this function, was derived from minix or ext2's
// analog. You should be able to tell which portion by looking at the
// ext2 code and comparing.
static void __discard_prealloc (struct reiserfs_transaction_handle * th, static void __discard_prealloc (struct reiserfs_transaction_handle * th,
struct reiserfs_inode_info *ei) struct reiserfs_inode_info *ei)
{ {
......
...@@ -109,7 +109,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -109,7 +109,7 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
if (!d_name[d_reclen - 1]) if (!d_name[d_reclen - 1])
d_reclen = strlen (d_name); d_reclen = strlen (d_name);
if (d_reclen > REISERFS_MAX_NAME_LEN(inode->i_sb->s_blocksize)){ if (d_reclen > REISERFS_MAX_NAME(inode->i_sb->s_blocksize)){
/* too big to send back to VFS */ /* too big to send back to VFS */
continue ; continue ;
} }
...@@ -181,7 +181,6 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -181,7 +181,6 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
end: end:
// FIXME: ext2_readdir does not reset f_pos
filp->f_pos = next_pos; filp->f_pos = next_pos;
pathrelse (&path_to_entry); pathrelse (&path_to_entry);
reiserfs_check_path(&path_to_entry) ; reiserfs_check_path(&path_to_entry) ;
......
...@@ -20,10 +20,7 @@ ...@@ -20,10 +20,7 @@
static int reiserfs_get_block (struct inode * inode, sector_t block, static int reiserfs_get_block (struct inode * inode, sector_t block,
struct buffer_head * bh_result, int create); struct buffer_head * bh_result, int create);
//
// initially this function was derived from minix or ext2's analog and
// evolved as the prototype did
//
void reiserfs_delete_inode (struct inode * inode) void reiserfs_delete_inode (struct inode * inode)
{ {
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2;
...@@ -112,8 +109,7 @@ static void add_to_flushlist(struct inode *inode, struct buffer_head *bh) { ...@@ -112,8 +109,7 @@ static void add_to_flushlist(struct inode *inode, struct buffer_head *bh) {
} }
// //
// FIXME: we might cache recently accessed indirect item (or at least // FIXME: we might cache recently accessed indirect item
// first 15 pointers just like ext2 does
// Ugh. Not too eager for that.... // Ugh. Not too eager for that....
// I cut the code until such time as I see a convincing argument (benchmark). // I cut the code until such time as I see a convincing argument (benchmark).
...@@ -521,12 +517,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th, ...@@ -521,12 +517,7 @@ static inline int _allocate_block(struct reiserfs_transaction_handle *th,
#endif #endif
return reiserfs_new_unf_blocknrs (th, allocated_block_nr, tag); return reiserfs_new_unf_blocknrs (th, allocated_block_nr, tag);
} }
//
// initially this function was derived from ext2's analog and evolved
// as the prototype did. You'll need to look at the ext2 version to
// determine which parts are derivative, if any, understanding that
// there are only so many ways to code to a given interface.
//
int reiserfs_get_block (struct inode * inode, sector_t block, int reiserfs_get_block (struct inode * inode, sector_t block,
struct buffer_head * bh_result, int create) struct buffer_head * bh_result, int create)
{ {
...@@ -1353,10 +1344,6 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 *data, int *lenp, int need_p ...@@ -1353,10 +1344,6 @@ int reiserfs_encode_fh(struct dentry *dentry, __u32 *data, int *lenp, int need_p
} }
//
// initially this function was derived from minix or ext2's analog and
// evolved as the prototype did
//
/* looks for stat data, then copies fields to it, marks the buffer /* looks for stat data, then copies fields to it, marks the buffer
containing stat data as dirty */ containing stat data as dirty */
/* reiserfs inodes are never really dirty, since the dirty inode call /* reiserfs inodes are never really dirty, since the dirty inode call
...@@ -2034,18 +2021,13 @@ static int reiserfs_write_full_page(struct page *page) { ...@@ -2034,18 +2021,13 @@ static int reiserfs_write_full_page(struct page *page) {
return error ; return error ;
} }
//
// this is exactly what 2.3.99-pre9's ext2_readpage is
//
static int reiserfs_readpage (struct file *f, struct page * page) static int reiserfs_readpage (struct file *f, struct page * page)
{ {
return block_read_full_page (page, reiserfs_get_block); return block_read_full_page (page, reiserfs_get_block);
} }
//
// modified from ext2_writepage is
//
static int reiserfs_writepage (struct page * page) static int reiserfs_writepage (struct page * page)
{ {
struct inode *inode = page->mapping->host ; struct inode *inode = page->mapping->host ;
...@@ -2054,9 +2036,6 @@ static int reiserfs_writepage (struct page * page) ...@@ -2054,9 +2036,6 @@ static int reiserfs_writepage (struct page * page)
} }
//
// from ext2_prepare_write, but modified
//
int reiserfs_prepare_write(struct file *f, struct page *page, int reiserfs_prepare_write(struct file *f, struct page *page,
unsigned from, unsigned to) { unsigned from, unsigned to) {
struct inode *inode = page->mapping->host ; struct inode *inode = page->mapping->host ;
...@@ -2066,9 +2045,6 @@ int reiserfs_prepare_write(struct file *f, struct page *page, ...@@ -2066,9 +2045,6 @@ int reiserfs_prepare_write(struct file *f, struct page *page,
} }
//
// this is exactly what 2.3.99-pre9's ext2_bmap is
//
static int reiserfs_aop_bmap(struct address_space *as, long block) { static int reiserfs_aop_bmap(struct address_space *as, long block) {
return generic_block_bmap(as, block, reiserfs_bmap) ; return generic_block_bmap(as, block, reiserfs_bmap) ;
} }
......
...@@ -195,13 +195,6 @@ static __u32 get_third_component (struct super_block * s, ...@@ -195,13 +195,6 @@ static __u32 get_third_component (struct super_block * s,
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_match (struct reiserfs_dir_entry * de, static int reiserfs_match (struct reiserfs_dir_entry * de,
const char * name, int namelen) const char * name, int namelen)
{ {
...@@ -284,13 +277,6 @@ static int linear_search_in_dir_item (struct cpu_key * key, struct reiserfs_dir_ ...@@ -284,13 +277,6 @@ static int linear_search_in_dir_item (struct cpu_key * key, struct reiserfs_dir_
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
// may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND // may return NAME_FOUND, NAME_FOUND_INVISIBLE, NAME_NOT_FOUND
// FIXME: should add something like IOERROR // FIXME: should add something like IOERROR
static int reiserfs_find_entry (struct inode * dir, const char * name, int namelen, static int reiserfs_find_entry (struct inode * dir, const char * name, int namelen,
...@@ -300,7 +286,7 @@ static int reiserfs_find_entry (struct inode * dir, const char * name, int namel ...@@ -300,7 +286,7 @@ static int reiserfs_find_entry (struct inode * dir, const char * name, int namel
int retval; int retval;
if (namelen > REISERFS_MAX_NAME_LEN (dir->i_sb->s_blocksize)) if (namelen > REISERFS_MAX_NAME (dir->i_sb->s_blocksize))
return NAME_NOT_FOUND; return NAME_NOT_FOUND;
/* we will search for this key in the tree */ /* we will search for this key in the tree */
...@@ -330,13 +316,6 @@ static int reiserfs_find_entry (struct inode * dir, const char * name, int namel ...@@ -330,13 +316,6 @@ static int reiserfs_find_entry (struct inode * dir, const char * name, int namel
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dentry) static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dentry)
{ {
int retval; int retval;
...@@ -344,7 +323,7 @@ static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dent ...@@ -344,7 +323,7 @@ static struct dentry * reiserfs_lookup (struct inode * dir, struct dentry * dent
struct reiserfs_dir_entry de; struct reiserfs_dir_entry de;
INITIALIZE_PATH (path_to_entry); INITIALIZE_PATH (path_to_entry);
if (dentry->d_name.len > REISERFS_MAX_NAME_LEN (dir->i_sb->s_blocksize)) if (REISERFS_MAX_NAME (dir->i_sb->s_blocksize) < dentry->d_name.len)
return ERR_PTR(-ENAMETOOLONG); return ERR_PTR(-ENAMETOOLONG);
lock_kernel(); lock_kernel();
...@@ -412,14 +391,6 @@ struct dentry *reiserfs_get_parent(struct dentry *child) ...@@ -412,14 +391,6 @@ struct dentry *reiserfs_get_parent(struct dentry *child)
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
/* add entry to the directory (entry can be hidden). /* add entry to the directory (entry can be hidden).
insert definition of when hidden directories are used here -Hans insert definition of when hidden directories are used here -Hans
...@@ -447,7 +418,7 @@ static int reiserfs_add_entry (struct reiserfs_transaction_handle *th, struct in ...@@ -447,7 +418,7 @@ static int reiserfs_add_entry (struct reiserfs_transaction_handle *th, struct in
if (!namelen) if (!namelen)
return -EINVAL; return -EINVAL;
if (namelen > REISERFS_MAX_NAME_LEN (dir->i_sb->s_blocksize)) if (namelen > REISERFS_MAX_NAME (dir->i_sb->s_blocksize))
return -ENAMETOOLONG; return -ENAMETOOLONG;
/* each entry has unique key. compose it */ /* each entry has unique key. compose it */
...@@ -587,13 +558,6 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode) { ...@@ -587,13 +558,6 @@ static int new_inode_init(struct inode *inode, struct inode *dir, int mode) {
return 0 ; return 0 ;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode) static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode)
{ {
int retval; int retval;
...@@ -601,8 +565,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode) ...@@ -601,8 +565,7 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode)
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 ; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 2 ;
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
inode = new_inode(dir->i_sb) ; if (!(inode = new_inode(dir->i_sb))) {
if (!inode) {
return -ENOMEM ; return -ENOMEM ;
} }
retval = new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
...@@ -642,13 +605,6 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode) ...@@ -642,13 +605,6 @@ static int reiserfs_create (struct inode * dir, struct dentry *dentry, int mode)
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev) static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, int rdev)
{ {
int retval; int retval;
...@@ -656,8 +612,7 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, ...@@ -656,8 +612,7 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode,
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
inode = new_inode(dir->i_sb) ; if (!(inode = new_inode(dir->i_sb))) {
if (!inode) {
return -ENOMEM ; return -ENOMEM ;
} }
retval = new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
...@@ -699,13 +654,6 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode, ...@@ -699,13 +654,6 @@ static int reiserfs_mknod (struct inode * dir, struct dentry *dentry, int mode,
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode) static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
{ {
int retval; int retval;
...@@ -714,8 +662,7 @@ static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode) ...@@ -714,8 +662,7 @@ static int reiserfs_mkdir (struct inode * dir, struct dentry *dentry, int mode)
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
mode = S_IFDIR | mode; mode = S_IFDIR | mode;
inode = new_inode(dir->i_sb) ; if (!(inode = new_inode(dir->i_sb))) {
if (!inode) {
return -ENOMEM ; return -ENOMEM ;
} }
retval = new_inode_init(inode, dir, mode); retval = new_inode_init(inode, dir, mode);
...@@ -779,14 +726,6 @@ static inline int reiserfs_empty_dir(struct inode *inode) { ...@@ -779,14 +726,6 @@ static inline int reiserfs_empty_dir(struct inode *inode) {
return 1 ; return 1 ;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry) static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry)
{ {
int retval; int retval;
...@@ -869,14 +808,6 @@ static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry) ...@@ -869,14 +808,6 @@ static int reiserfs_rmdir (struct inode * dir, struct dentry *dentry)
return retval; return retval;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_unlink (struct inode * dir, struct dentry *dentry) static int reiserfs_unlink (struct inode * dir, struct dentry *dentry)
{ {
int retval; int retval;
...@@ -954,15 +885,8 @@ static int reiserfs_unlink (struct inode * dir, struct dentry *dentry) ...@@ -954,15 +885,8 @@ static int reiserfs_unlink (struct inode * dir, struct dentry *dentry)
return retval; return retval;
} }
static int reiserfs_symlink (struct inode * parent_dir,
// struct dentry * dentry, const char * symname)
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const char * symname)
{ {
int retval; int retval;
struct inode * inode; struct inode * inode;
...@@ -972,24 +896,23 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c ...@@ -972,24 +896,23 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c
int mode = S_IFLNK | S_IRWXUGO; int mode = S_IFLNK | S_IRWXUGO;
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
inode = new_inode(dir->i_sb) ; if (!(inode = new_inode(parent_dir->i_sb))) {
if (!inode) {
return -ENOMEM ; return -ENOMEM ;
} }
retval = new_inode_init(inode, dir, mode); retval = new_inode_init(inode, parent_dir, mode);
if (retval) { if (retval) {
return retval; return retval;
} }
lock_kernel(); lock_kernel();
item_len = ROUND_UP (strlen (symname)); item_len = ROUND_UP (strlen (symname));
if (item_len > MAX_DIRECT_ITEM_LEN (dir->i_sb->s_blocksize)) { if (item_len > MAX_DIRECT_ITEM_LEN (parent_dir->i_sb->s_blocksize)) {
retval = -ENAMETOOLONG; retval = -ENAMETOOLONG;
drop_new_inode(inode); drop_new_inode(inode);
goto out_failed; goto out_failed;
} }
name = reiserfs_kmalloc (item_len, GFP_NOFS, dir->i_sb); name = reiserfs_kmalloc (item_len, GFP_NOFS, parent_dir->i_sb);
if (!name) { if (!name) {
drop_new_inode(inode); drop_new_inode(inode);
retval = -ENOMEM; retval = -ENOMEM;
...@@ -998,17 +921,17 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c ...@@ -998,17 +921,17 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c
memcpy (name, symname, strlen (symname)); memcpy (name, symname, strlen (symname));
padd_item (name, item_len, strlen (symname)); padd_item (name, item_len, strlen (symname));
journal_begin(&th, dir->i_sb, jbegin_count) ; journal_begin(&th, parent_dir->i_sb, jbegin_count) ;
retval = reiserfs_new_inode (&th, dir, mode, name, strlen (symname), retval = reiserfs_new_inode (&th, parent_dir, mode, name, strlen (symname),
dentry, inode); dentry, inode);
reiserfs_kfree (name, item_len, dir->i_sb); reiserfs_kfree (name, item_len, parent_dir->i_sb);
if (retval) { /* reiserfs_new_inode iputs for us */ if (retval) { /* reiserfs_new_inode iputs for us */
goto out_failed; goto out_failed;
} }
reiserfs_update_inode_transaction(inode) ; reiserfs_update_inode_transaction(inode) ;
reiserfs_update_inode_transaction(dir) ; reiserfs_update_inode_transaction(parent_dir) ;
inode->i_op = &page_symlink_inode_operations; inode->i_op = &page_symlink_inode_operations;
inode->i_mapping->a_ops = &reiserfs_address_space_operations; inode->i_mapping->a_ops = &reiserfs_address_space_operations;
...@@ -1017,31 +940,23 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c ...@@ -1017,31 +940,23 @@ static int reiserfs_symlink (struct inode * dir, struct dentry * dentry, const c
// //
//reiserfs_update_sd (&th, inode, READ_BLOCKS); //reiserfs_update_sd (&th, inode, READ_BLOCKS);
retval = reiserfs_add_entry (&th, dir, dentry->d_name.name, dentry->d_name.len, retval = reiserfs_add_entry (&th, parent_dir, dentry->d_name.name,
inode, 1/*visible*/); dentry->d_name.len, inode, 1/*visible*/);
if (retval) { if (retval) {
inode->i_nlink--; inode->i_nlink--;
reiserfs_update_sd (&th, inode); reiserfs_update_sd (&th, inode);
journal_end(&th, dir->i_sb, jbegin_count) ; journal_end(&th, parent_dir->i_sb, jbegin_count) ;
iput (inode); iput (inode);
goto out_failed; goto out_failed;
} }
d_instantiate(dentry, inode); d_instantiate(dentry, inode);
journal_end(&th, dir->i_sb, jbegin_count) ; journal_end(&th, parent_dir->i_sb, jbegin_count) ;
out_failed: out_failed:
unlock_kernel(); unlock_kernel();
return retval; return retval;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct dentry * dentry) static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct dentry * dentry)
{ {
int retval; int retval;
...@@ -1049,6 +964,7 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct ...@@ -1049,6 +964,7 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct
int windex ; int windex ;
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3; int jbegin_count = JOURNAL_PER_BALANCE_CNT * 3;
time_t ctime;
lock_kernel(); lock_kernel();
if (inode->i_nlink >= REISERFS_LINK_MAX) { if (inode->i_nlink >= REISERFS_LINK_MAX) {
...@@ -1075,7 +991,8 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct ...@@ -1075,7 +991,8 @@ static int reiserfs_link (struct dentry * old_dentry, struct inode * dir, struct
} }
inode->i_nlink++; inode->i_nlink++;
inode->i_ctime = CURRENT_TIME; ctime = CURRENT_TIME;
inode->i_ctime = ctime;
reiserfs_update_sd (&th, inode); reiserfs_update_sd (&th, inode);
atomic_inc(&inode->i_count) ; atomic_inc(&inode->i_count) ;
...@@ -1129,14 +1046,6 @@ static void set_ino_in_dir_entry (struct reiserfs_dir_entry * de, struct key * k ...@@ -1129,14 +1046,6 @@ static void set_ino_in_dir_entry (struct reiserfs_dir_entry * de, struct key * k
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
/* /*
* process, that is going to call fix_nodes/do_balance must hold only * process, that is going to call fix_nodes/do_balance must hold only
* one path. If it holds 2 or more, it can get into endless waiting in * one path. If it holds 2 or more, it can get into endless waiting in
...@@ -1151,10 +1060,12 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1151,10 +1060,12 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
INITIALIZE_PATH (dot_dot_entry_path); INITIALIZE_PATH (dot_dot_entry_path);
struct item_head new_entry_ih, old_entry_ih, dot_dot_ih ; struct item_head new_entry_ih, old_entry_ih, dot_dot_ih ;
struct reiserfs_dir_entry old_de, new_de, dot_dot_de; struct reiserfs_dir_entry old_de, new_de, dot_dot_de;
struct inode * old_inode, * new_inode; struct inode * old_inode, * new_dentry_inode;
int windex ; int windex ;
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
int jbegin_count ; int jbegin_count ;
umode_t old_inode_mode;
time_t ctime;
/* two balancings: old name removal, new name insertion or "save" link, /* two balancings: old name removal, new name insertion or "save" link,
...@@ -1163,7 +1074,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1163,7 +1074,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 3; jbegin_count = JOURNAL_PER_BALANCE_CNT * 3 + 3;
old_inode = old_dentry->d_inode; old_inode = old_dentry->d_inode;
new_inode = new_dentry->d_inode; new_dentry_inode = new_dentry->d_inode;
// make sure, that oldname still exists and points to an object we // make sure, that oldname still exists and points to an object we
// are going to rename // are going to rename
...@@ -1182,13 +1093,14 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1182,13 +1093,14 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
return -ENOENT; return -ENOENT;
} }
if (S_ISDIR(old_inode->i_mode)) { old_inode_mode = old_inode->i_mode;
if (S_ISDIR(old_inode_mode)) {
// make sure, that directory being renamed has correct ".." // make sure, that directory being renamed has correct ".."
// and that its new parent directory has not too many links // and that its new parent directory has not too many links
// already // already
if (new_inode) { if (new_dentry_inode) {
if (!reiserfs_empty_dir(new_inode)) { if (!reiserfs_empty_dir(new_dentry_inode)) {
unlock_kernel(); unlock_kernel();
return -ENOTEMPTY; return -ENOTEMPTY;
} }
...@@ -1219,9 +1131,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1219,9 +1131,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
retval = reiserfs_add_entry (&th, new_dir, new_dentry->d_name.name, new_dentry->d_name.len, retval = reiserfs_add_entry (&th, new_dir, new_dentry->d_name.name, new_dentry->d_name.len,
old_inode, 0); old_inode, 0);
if (retval == -EEXIST) { if (retval == -EEXIST) {
// FIXME: is it possible, that new_inode == 0 here? If yes, it if (!new_dentry_inode) {
// is not clear how does ext2 handle that
if (!new_inode) {
reiserfs_panic (old_dir->i_sb, reiserfs_panic (old_dir->i_sb,
"vs-7050: new entry is found, new inode == 0\n"); "vs-7050: new entry is found, new inode == 0\n");
} }
...@@ -1240,8 +1150,8 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1240,8 +1150,8 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
*/ */
reiserfs_update_inode_transaction(old_inode) ; reiserfs_update_inode_transaction(old_inode) ;
if (new_inode) if (new_dentry_inode)
reiserfs_update_inode_transaction(new_inode) ; reiserfs_update_inode_transaction(new_dentry_inode) ;
while (1) { while (1) {
// look for old name using corresponding entry key (found by reiserfs_find_entry) // look for old name using corresponding entry key (found by reiserfs_find_entry)
...@@ -1288,18 +1198,18 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1288,18 +1198,18 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
if (item_moved(&new_entry_ih, &new_entry_path) || if (item_moved(&new_entry_ih, &new_entry_path) ||
!entry_points_to_object(new_dentry->d_name.name, !entry_points_to_object(new_dentry->d_name.name,
new_dentry->d_name.len, new_dentry->d_name.len,
&new_de, new_inode) || &new_de, new_dentry_inode) ||
item_moved(&old_entry_ih, &old_entry_path) || item_moved(&old_entry_ih, &old_entry_path) ||
!entry_points_to_object (old_dentry->d_name.name, !entry_points_to_object (old_dentry->d_name.name,
old_dentry->d_name.len, old_dentry->d_name.len,
&old_de, old_inode)) { &old_de, old_inode)) {
reiserfs_restore_prepared_buffer (old_inode->i_sb, new_de.de_bh); reiserfs_restore_prepared_buffer (old_inode->i_sb, new_de.de_bh);
reiserfs_restore_prepared_buffer (old_inode->i_sb, old_de.de_bh); reiserfs_restore_prepared_buffer (old_inode->i_sb, old_de.de_bh);
if (S_ISDIR(old_inode->i_mode)) if (S_ISDIR(old_inode_mode))
reiserfs_restore_prepared_buffer (old_inode->i_sb, dot_dot_de.de_bh); reiserfs_restore_prepared_buffer (old_inode->i_sb, dot_dot_de.de_bh);
continue; continue;
} }
if (S_ISDIR(old_inode->i_mode)) { if (S_ISDIR(old_inode_mode)) {
if ( item_moved(&dot_dot_ih, &dot_dot_entry_path) || if ( item_moved(&dot_dot_ih, &dot_dot_entry_path) ||
!entry_points_to_object ( "..", 2, &dot_dot_de, old_dir) ) { !entry_points_to_object ( "..", 2, &dot_dot_de, old_dir) ) {
reiserfs_restore_prepared_buffer (old_inode->i_sb, old_de.de_bh); reiserfs_restore_prepared_buffer (old_inode->i_sb, old_de.de_bh);
...@@ -1309,7 +1219,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1309,7 +1219,7 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
} }
} }
RFALSE( S_ISDIR(old_inode->i_mode) && RFALSE( S_ISDIR(old_inode_mode) &&
!reiserfs_buffer_prepared(dot_dot_de.de_bh), "" ); !reiserfs_buffer_prepared(dot_dot_de.de_bh), "" );
break; break;
...@@ -1327,22 +1237,23 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1327,22 +1237,23 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME; old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME; new_dir->i_ctime = new_dir->i_mtime = CURRENT_TIME;
if (new_inode) { if (new_dentry_inode) {
// adjust link number of the victim // adjust link number of the victim
if (S_ISDIR(new_inode->i_mode)) { if (S_ISDIR(new_dentry_inode->i_mode)) {
new_inode->i_nlink = 0; new_dentry_inode->i_nlink = 0;
} else { } else {
new_inode->i_nlink--; new_dentry_inode->i_nlink--;
} }
new_inode->i_ctime = CURRENT_TIME; ctime = CURRENT_TIME;
new_dentry_inode->i_ctime = ctime;
} }
if (S_ISDIR(old_inode->i_mode)) { if (S_ISDIR(old_inode_mode)) {
// adjust ".." of renamed directory // adjust ".." of renamed directory
set_ino_in_dir_entry (&dot_dot_de, INODE_PKEY (new_dir)); set_ino_in_dir_entry (&dot_dot_de, INODE_PKEY (new_dir));
journal_mark_dirty (&th, new_dir->i_sb, dot_dot_de.de_bh); journal_mark_dirty (&th, new_dir->i_sb, dot_dot_de.de_bh);
if (!new_inode) if (!new_dentry_inode)
/* there (in new_dir) was no directory, so it got new link /* there (in new_dir) was no directory, so it got new link
(".." of renamed directory) */ (".." of renamed directory) */
INC_DIR_INODE_NLINK(new_dir); INC_DIR_INODE_NLINK(new_dir);
...@@ -1367,10 +1278,10 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry, ...@@ -1367,10 +1278,10 @@ static int reiserfs_rename (struct inode * old_dir, struct dentry *old_dentry,
reiserfs_update_sd (&th, old_dir); reiserfs_update_sd (&th, old_dir);
reiserfs_update_sd (&th, new_dir); reiserfs_update_sd (&th, new_dir);
if (new_inode) { if (new_dentry_inode) {
if (new_inode->i_nlink == 0) if (new_dentry_inode->i_nlink == 0)
add_save_link (&th, new_inode, 0/* not truncate */); add_save_link (&th, new_dentry_inode, 0/* not truncate */);
reiserfs_update_sd (&th, new_inode); reiserfs_update_sd (&th, new_dentry_inode);
} }
pop_journal_writer(windex) ; pop_journal_writer(windex) ;
......
...@@ -65,13 +65,6 @@ int is_reiserfs_super (struct super_block *s) ...@@ -65,13 +65,6 @@ int is_reiserfs_super (struct super_block *s)
static int reiserfs_remount (struct super_block * s, int * flags, char * data); static int reiserfs_remount (struct super_block * s, int * flags, char * data);
static int reiserfs_statfs (struct super_block * s, struct statfs * buf); static int reiserfs_statfs (struct super_block * s, struct statfs * buf);
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static void reiserfs_write_super (struct super_block * s) static void reiserfs_write_super (struct super_block * s)
{ {
...@@ -84,13 +77,6 @@ static void reiserfs_write_super (struct super_block * s) ...@@ -84,13 +77,6 @@ static void reiserfs_write_super (struct super_block * s)
unlock_kernel() ; unlock_kernel() ;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static void reiserfs_write_super_lockfs (struct super_block * s) static void reiserfs_write_super_lockfs (struct super_block * s)
{ {
...@@ -369,13 +355,6 @@ void remove_save_link (struct inode * inode, int truncate) ...@@ -369,13 +355,6 @@ void remove_save_link (struct inode * inode, int truncate)
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static void reiserfs_put_super (struct super_block * s) static void reiserfs_put_super (struct super_block * s)
{ {
int i; int i;
...@@ -510,100 +489,190 @@ static struct export_operations reiserfs_export_ops = { ...@@ -510,100 +489,190 @@ static struct export_operations reiserfs_export_ops = {
get_dentry: reiserfs_get_dentry, get_dentry: reiserfs_get_dentry,
} ; } ;
/* this was (ext2)parse_options */ /* this struct is used in reiserfs_getopt () for containing the value for those
static int parse_options (char * options, unsigned long * mount_options, unsigned long * blocks, char **jdev_name) mount options that have values rather than being toggles. */
{ typedef struct {
char * this_char;
char * value; char * value;
int bitmask; /* bit which is to be set in mount_options bitmask when this
value is found, 0 is no bits are to be set */
} arg_desc_t;
/* this struct is used in reiserfs_getopt() for describing the set of reiserfs
mount options */
typedef struct {
char * option_name;
int arg_required; /* 0 if argument is not required, not 0 otherwise */
const arg_desc_t * values; /* list of values accepted by an option */
int bitmask; /* bit which is to be set in mount_options bitmask when this
option is selected, 0 is not bits are to be set */
} opt_desc_t;
/* possible values for "-o block-allocator=" and bits which are to be set in
s_mount_opt of reiserfs specific part of in-core super block */
const arg_desc_t balloc[] = {
{"noborder", REISERFS_NO_BORDER},
{"no_unhashed_relocation", REISERFS_NO_UNHASHED_RELOCATION},
{"hashed_relocation", REISERFS_HASHED_RELOCATION},
{"test4", REISERFS_TEST4},
{NULL, -1}
};
/* proceed only one option from a list *cur - string containing of mount options
opts - array of options which are accepted
opt_arg - if option is found and requires an argument and if it is specifed
in the input - pointer to the argument is stored here
bit_flags - if option requires to set a certain bit - it is set here
return -1 if unknown option is found, opt->arg_required otherwise */
static int reiserfs_getopt (char ** cur, opt_desc_t * opts, char ** opt_arg,
unsigned long * bit_flags)
{
char * p;
/* foo=bar,
^ ^ ^
| | +-- option_end
| +-- arg_start
+-- option_start
*/
const opt_desc_t * opt;
const arg_desc_t * arg;
p = *cur;
/* assume argument cannot contain commas */
*cur = strchr (p, ',');
if (*cur) {
*(*cur) = '\0';
(*cur) ++;
}
/* for every option in the list */
for (opt = opts; opt->option_name; opt ++) {
if (!strncmp (p, opt->option_name, strlen (opt->option_name))) {
if (bit_flags && opt->bitmask != -1)
set_bit (opt->bitmask, bit_flags);
break;
}
}
if (!opt->option_name) {
printk ("reiserfs_getopt: unknown option \"%s\"\n", p);
return -1;
}
p += strlen (opt->option_name);
switch (*p) {
case '=':
if (!opt->arg_required) {
printk ("reiserfs_getopt: the option \"%s\" does not require an argument\n",
opt->option_name);
return -1;
}
break;
case 0:
if (opt->arg_required) {
printk ("reiserfs_getopt: the option \"%s\" requires an argument\n", opt->option_name);
return -1;
}
break;
default:
printk ("reiserfs_getopt: head of option \"%s\" is only correct\n", opt->option_name);
return -1;
}
/* move to the argument, or to next option if argument is not required */
p ++;
if ( opt->arg_required && !strlen (p) ) {
/* this catches "option=," */
printk ("reiserfs_getopt: empty argument for \"%s\"\n", opt->option_name);
return -1;
}
if (!opt->values) {
/* *opt_arg contains pointer to argument */
*opt_arg = p;
return opt->arg_required;
}
/* values possible for this option are listed in opt->values */
for (arg = opt->values; arg->value; arg ++) {
if (!strcmp (p, arg->value)) {
if (bit_flags && arg->bitmask != -1 )
set_bit (arg->bitmask, bit_flags);
return opt->arg_required;
}
}
printk ("reiserfs_getopt: bad value \"%s\" for option \"%s\"\n", p, opt->option_name);
return -1;
}
/* returns 0 if something is wrong in option string, 1 - otherwise */
static int reiserfs_parse_options (char * options, /* string given via mount's -o */
unsigned long * mount_options,
/* after the parsing phase, contains the
collection of bitflags defining what
mount options were selected. */
unsigned long * blocks, /* strtol-ed from NNN of resize=NNN */
char ** jdev_name)
{
int c;
char * arg = NULL;
char * pos;
opt_desc_t opts[] = {
{"notail", 0, 0, NOTAIL},
{"conv", 0, 0, REISERFS_CONVERT},
{"attrs", 0, 0, REISERFS_ATTRS},
{"nolog", 0, 0, -1},
{"replayonly", 0, 0, REPLAYONLY},
{"block-allocator", 'a', balloc, -1},
{"resize", 'r', 0, -1},
{"jdev", 'j', 0, -1},
{NULL, 0, 0, -1}
};
*blocks = 0; *blocks = 0;
if (!options) if (!options || !*options)
/* use default configuration: create tails, journaling on, no /* use default configuration: create tails, journaling on, no
conversion to newest format */ conversion to newest format */
return 1; return 1;
while ((this_char = strsep (&options, ",")) != NULL) {
if (!*this_char) for (pos = options; pos; ) {
continue; c = reiserfs_getopt (&pos, opts, &arg, mount_options);
if ((value = strchr (this_char, '=')) != NULL) if (c == -1)
*value++ = 0; /* wrong option is given */
if (!strcmp (this_char, "notail")) { return 0;
set_bit (NOTAIL, mount_options);
} else if (!strcmp (this_char, "conv")) { if (c == 'r') {
// if this is set, we update super block such that char * p;
// the partition will not be mounable by 3.5.x anymore
set_bit (REISERFS_CONVERT, mount_options); p = 0;
} else if (!strcmp (this_char, "noborder")) { /* "resize=NNN" */
/* this is used for benchmarking *blocks = simple_strtoul (arg, &p, 0);
experimental variations, it is not if (*p != '\0') {
intended for users to use, only for /* NNN does not look like a number */
developers who want to casually printk ("reiserfs_parse_options: bad value %s\n", arg);
hack in something to test */
set_bit (REISERFS_NO_BORDER, mount_options);
} else if (!strcmp (this_char, "no_unhashed_relocation")) {
set_bit (REISERFS_NO_UNHASHED_RELOCATION, mount_options);
} else if (!strcmp (this_char, "hashed_relocation")) {
set_bit (REISERFS_HASHED_RELOCATION, mount_options);
} else if (!strcmp (this_char, "test4")) {
set_bit (REISERFS_TEST4, mount_options);
} else if (!strcmp (this_char, "nolog")) {
reiserfs_warning("reiserfs: nolog mount option not supported yet\n");
} else if (!strcmp (this_char, "replayonly")) {
set_bit (REPLAYONLY, mount_options);
} else if (!strcmp (this_char, "resize")) {
if (value && *value){
*blocks = simple_strtoul (value, &value, 0);
} else {
printk("reiserfs: resize option requires a value\n");
return 0; return 0;
} }
} else if (!strcmp (this_char, "hash")) {
if (value && *value) {
/* if they specify any hash option, we force detection
** to make sure they aren't using the wrong hash
*/
if (!strcmp(value, "rupasov")) {
set_bit (FORCE_RUPASOV_HASH, mount_options);
set_bit (FORCE_HASH_DETECT, mount_options);
} else if (!strcmp(value, "tea")) {
set_bit (FORCE_TEA_HASH, mount_options);
set_bit (FORCE_HASH_DETECT, mount_options);
} else if (!strcmp(value, "r5")) {
set_bit (FORCE_R5_HASH, mount_options);
set_bit (FORCE_HASH_DETECT, mount_options);
} else if (!strcmp(value, "detect")) {
set_bit (FORCE_HASH_DETECT, mount_options);
} else {
printk("reiserfs: invalid hash function specified\n") ;
return 0 ;
}
} else {
printk("reiserfs: hash option requires a value\n");
return 0 ;
} }
} else if (!strcmp (this_char, "jdev")) {
if (value && *value && jdev_name) { if (c == 'j') {
*jdev_name = value; if (arg && *arg && jdev_name) {
} else { *jdev_name = arg;
printk("reiserfs: jdev option requires a value\n");
return 0 ;
} }
} else {
printk ("reiserfs: Unrecognized mount option %s\n", this_char);
return 0;
} }
} }
return 1; return 1;
} }
static int reiserfs_remount (struct super_block * s, int * mount_flags, char * arg)
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_remount (struct super_block * s, int * flags, char * data)
{ {
struct reiserfs_super_block * rs; struct reiserfs_super_block * rs;
struct reiserfs_transaction_handle th ; struct reiserfs_transaction_handle th ;
...@@ -611,8 +680,9 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data) ...@@ -611,8 +680,9 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data)
unsigned long mount_options; unsigned long mount_options;
rs = SB_DISK_SUPER_BLOCK (s); rs = SB_DISK_SUPER_BLOCK (s);
if (!parse_options(data, &mount_options, &blocks, NULL))
return 0; if (!reiserfs_parse_options(arg, &mount_options, &blocks, NULL))
return -EINVAL;
if(blocks) { if(blocks) {
int rc = reiserfs_resize(s, blocks); int rc = reiserfs_resize(s, blocks);
...@@ -620,12 +690,11 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data) ...@@ -620,12 +690,11 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data)
return rc; return rc;
} }
if ((unsigned long)(*flags & MS_RDONLY) == (s->s_flags & MS_RDONLY)) { if (*mount_flags & MS_RDONLY) {
/* there is nothing to do to remount read-only fs as read-only fs */ /* remount rean-only */
if (s->s_flags & MS_RDONLY)
/* it is read-only already */
return 0; return 0;
}
if (*flags & MS_RDONLY) {
/* try to remount file system with read-only permissions */ /* try to remount file system with read-only permissions */
if (sb_umount_state(rs) == REISERFS_VALID_FS || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) { if (sb_umount_state(rs) == REISERFS_VALID_FS || REISERFS_SB(s)->s_mount_state != REISERFS_VALID_FS) {
return 0; return 0;
...@@ -656,7 +725,7 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data) ...@@ -656,7 +725,7 @@ static int reiserfs_remount (struct super_block * s, int * flags, char * data)
SB_JOURNAL(s)->j_must_wait = 1 ; SB_JOURNAL(s)->j_must_wait = 1 ;
journal_end(&th, s, 10) ; journal_end(&th, s, 10) ;
if (!( *flags & MS_RDONLY ) ) if (!( *mount_flags & MS_RDONLY ) )
finish_unfinished( s ); finish_unfinished( s );
return 0; return 0;
...@@ -997,13 +1066,6 @@ int function2code (hashf_t func) ...@@ -997,13 +1066,6 @@ int function2code (hashf_t func)
return 0; return 0;
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_fill_super (struct super_block * s, void * data, int silent) static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
{ {
struct inode *root_inode; struct inode *root_inode;
...@@ -1027,7 +1089,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1027,7 +1089,7 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
memset (sbi, 0, sizeof (struct reiserfs_sb_info)); memset (sbi, 0, sizeof (struct reiserfs_sb_info));
jdev_name = NULL; jdev_name = NULL;
if (parse_options ((char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) { if (reiserfs_parse_options ((char *) data, &(sbi->s_mount_opt), &blocks, &jdev_name) == 0) {
goto error; goto error;
} }
...@@ -1191,26 +1253,19 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent) ...@@ -1191,26 +1253,19 @@ static int reiserfs_fill_super (struct super_block * s, void * data, int silent)
} }
//
// a portion of this function, particularly the VFS interface portion,
// was derived from minix or ext2's analog and evolved as the
// prototype did. You should be able to tell which portion by looking
// at the ext2 code and comparing. It's subfunctions contain no code
// used as a template unless they are so labeled.
//
static int reiserfs_statfs (struct super_block * s, struct statfs * buf) static int reiserfs_statfs (struct super_block * s, struct statfs * buf)
{ {
struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
/* changed to accomodate gcc folks.*/ buf->f_namelen = (REISERFS_MAX_NAME (s->s_blocksize));
buf->f_type = REISERFS_SUPER_MAGIC; buf->f_ffree = -1;
buf->f_bsize = s->s_blocksize; buf->f_files = -1;
buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1;
buf->f_bfree = sb_free_blocks(rs); buf->f_bfree = sb_free_blocks(rs);
buf->f_bavail = buf->f_bfree; buf->f_bavail = buf->f_bfree;
buf->f_files = -1; buf->f_blocks = sb_block_count(rs) - sb_bmap_nr(rs) - 1;
buf->f_ffree = -1; buf->f_bsize = s->s_blocksize;
buf->f_namelen = (REISERFS_MAX_NAME_LEN (s->s_blocksize)); /* changed to accomodate gcc folks.*/
buf->f_type = REISERFS_SUPER_MAGIC;
return 0; return 0;
} }
......
...@@ -1062,9 +1062,7 @@ static inline int entry_length (const struct buffer_head * bh, ...@@ -1062,9 +1062,7 @@ static inline int entry_length (const struct buffer_head * bh,
#define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num)))) #define B_I_E_NAME(bh,ih,entry_num) ((char *)(bh->b_data + ih_location(ih) + deh_location(B_I_DEH(bh,ih)+(entry_num))))
// two entries per block (at least) // two entries per block (at least)
//#define REISERFS_MAX_NAME_LEN(block_size) #define REISERFS_MAX_NAME(block_size) 255
//((block_size - BLKH_SIZE - IH_SIZE - DEH_SIZE * 2) / 2)
#define REISERFS_MAX_NAME_LEN(block_size) 255
/* this structure is used for operations on directory entries. It is /* this structure is used for operations on directory entries. It is
......
...@@ -408,6 +408,8 @@ struct reiserfs_sb_info ...@@ -408,6 +408,8 @@ struct reiserfs_sb_info
#define REISERFS_HASHED_RELOCATION 13 #define REISERFS_HASHED_RELOCATION 13
#define REISERFS_TEST4 14 #define REISERFS_TEST4 14
#define REISERFS_ATTRS 15
#define REISERFS_TEST1 11 #define REISERFS_TEST1 11
#define REISERFS_TEST2 12 #define REISERFS_TEST2 12
#define REISERFS_TEST3 13 #define REISERFS_TEST3 13
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment