Commit 0a33358c authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] FAT: Use just printk() instead of unneeded fat_fs_panic()

From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

- uses just printk() instead of unneeded fat_fs_panic()
- removes the debug printk
- less verbose on error path
- uses correct a error number on error path
parent 26b88587
...@@ -1226,10 +1226,10 @@ void fat_write_inode(struct inode *inode, int wait) ...@@ -1226,10 +1226,10 @@ void fat_write_inode(struct inode *inode, int wait)
} }
lock_kernel(); lock_kernel();
if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) { if (!(bh = sb_bread(sb, i_pos >> MSDOS_SB(sb)->dir_per_block_bits))) {
fat_fs_panic(sb, "unable to read i-node block (i_pos %lld)", printk(KERN_ERR "FAT: unable to read inode block "
i_pos); "for updating (i_pos %lld)", i_pos);
unlock_kernel(); unlock_kernel();
return; return /* -EIO */;
} }
spin_lock(&fat_inode_lock); spin_lock(&fat_inode_lock);
if (i_pos != MSDOS_I(inode)->i_pos) { if (i_pos != MSDOS_I(inode)->i_pos) {
......
...@@ -244,13 +244,14 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name, ...@@ -244,13 +244,14 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
*/ */
dir->i_ctime = dir->i_mtime = CURRENT_TIME; dir->i_ctime = dir->i_mtime = CURRENT_TIME;
mark_inode_dirty(dir); mark_inode_dirty(dir);
memcpy((*de)->name,name,MSDOS_NAME);
memcpy((*de)->name, name, MSDOS_NAME);
(*de)->attr = is_dir ? ATTR_DIR : ATTR_ARCH; (*de)->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
if (is_hid) if (is_hid)
(*de)->attr |= ATTR_HIDDEN; (*de)->attr |= ATTR_HIDDEN;
(*de)->start = 0; (*de)->start = 0;
(*de)->starthi = 0; (*de)->starthi = 0;
fat_date_unix2dos(dir->i_mtime.tv_sec,&(*de)->time,&(*de)->date); fat_date_unix2dos(dir->i_mtime.tv_sec, &(*de)->time, &(*de)->date);
(*de)->size = 0; (*de)->size = 0;
mark_buffer_dirty(*bh); mark_buffer_dirty(*bh);
return 0; return 0;
...@@ -393,7 +394,6 @@ int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode) ...@@ -393,7 +394,6 @@ int msdos_mkdir(struct inode *dir,struct dentry *dentry,int mode)
return res; return res;
mkdir_error: mkdir_error:
printk(KERN_WARNING "msdos_mkdir: error=%d, attempting cleanup\n", res);
inode->i_nlink = 0; inode->i_nlink = 0;
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
dir->i_nlink--; dir->i_nlink--;
...@@ -468,13 +468,9 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name, ...@@ -468,13 +468,9 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
if (error) if (error)
goto out; goto out;
} }
error = fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh, if (fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
&dotdot_de, &dotdot_i_pos); &dotdot_de, &dotdot_i_pos) < 0) {
if (error < 0) { error = -EIO;
printk(KERN_WARNING
"MSDOS: %s/%s, get dotdot failed, ret=%d\n",
old_dentry->d_parent->d_name.name,
old_dentry->d_name.name, error);
goto out; goto out;
} }
} }
......
...@@ -25,23 +25,6 @@ ...@@ -25,23 +25,6 @@
#include <linux/buffer_head.h> #include <linux/buffer_head.h>
#include <linux/namei.h> #include <linux/namei.h>
#define DEBUG_LEVEL 0
#if (DEBUG_LEVEL >= 1)
# define PRINTK1(x) printk x
#else
# define PRINTK1(x)
#endif
#if (DEBUG_LEVEL >= 2)
# define PRINTK2(x) printk x
#else
# define PRINTK2(x)
#endif
#if (DEBUG_LEVEL >= 3)
# define PRINTK3(x) printk x
#else
# define PRINTK3(x)
#endif
static int vfat_hashi(struct dentry *parent, struct qstr *qstr); static int vfat_hashi(struct dentry *parent, struct qstr *qstr);
static int vfat_hash(struct dentry *parent, struct qstr *qstr); static int vfat_hash(struct dentry *parent, struct qstr *qstr);
static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b); static int vfat_cmpi(struct dentry *dentry, struct qstr *a, struct qstr *b);
...@@ -699,7 +682,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, ...@@ -699,7 +682,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
for (cksum = i = 0; i < 11; i++) { for (cksum = i = 0; i < 11; i++) {
cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i]; cksum = (((cksum&1)<<7)|((cksum&0xfe)>>1)) + msdos_name[i];
} }
PRINTK3(("vfat_fill_slots 3: slots=%d\n",*slots));
for (ps = ds, slot = *slots; slot > 0; slot--, ps++) { for (ps = ds, slot = *slots; slot > 0; slot--, ps++) {
ps->id = slot; ps->id = slot;
...@@ -716,7 +698,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name, ...@@ -716,7 +698,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
de = (struct msdos_dir_entry *) ps; de = (struct msdos_dir_entry *) ps;
shortname: shortname:
PRINTK3(("vfat_fill_slots 9\n"));
/* build the entry of 8.3 alias name */ /* build the entry of 8.3 alias name */
(*slots)++; (*slots)++;
memcpy(de->name, msdos_name, MSDOS_NAME); memcpy(de->name, msdos_name, MSDOS_NAME);
...@@ -834,9 +815,6 @@ struct dentry *vfat_lookup(struct inode *dir,struct dentry *dentry, struct namei ...@@ -834,9 +815,6 @@ struct dentry *vfat_lookup(struct inode *dir,struct dentry *dentry, struct namei
struct msdos_dir_entry *de; struct msdos_dir_entry *de;
int table; int table;
PRINTK2(("vfat_lookup: name=%s, len=%d\n",
dentry->d_name.name, dentry->d_name.len));
lock_kernel(); lock_kernel();
table = (MSDOS_SB(dir->i_sb)->options.name_check == 's') ? 2 : 0; table = (MSDOS_SB(dir->i_sb)->options.name_check == 's') ? 2 : 0;
dentry->d_op = &vfat_dentry_ops[table]; dentry->d_op = &vfat_dentry_ops[table];
...@@ -969,7 +947,6 @@ int vfat_unlink(struct inode *dir, struct dentry* dentry) ...@@ -969,7 +947,6 @@ int vfat_unlink(struct inode *dir, struct dentry* dentry)
struct buffer_head *bh = NULL; struct buffer_head *bh = NULL;
struct msdos_dir_entry *de; struct msdos_dir_entry *de;
PRINTK1(("vfat_unlink: %s\n", dentry->d_name.name));
lock_kernel(); lock_kernel();
res = vfat_find(dir,&dentry->d_name,&sinfo,&bh,&de); res = vfat_find(dir,&dentry->d_name,&sinfo,&bh,&de);
if (res < 0) { if (res < 0) {
...@@ -1050,14 +1027,18 @@ int vfat_rename(struct inode *old_dir,struct dentry *old_dentry, ...@@ -1050,14 +1027,18 @@ int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
new_inode = new_dentry->d_inode; new_inode = new_dentry->d_inode;
lock_kernel(); lock_kernel();
res = vfat_find(old_dir,&old_dentry->d_name,&old_sinfo,&old_bh,&old_de); res = vfat_find(old_dir,&old_dentry->d_name,&old_sinfo,&old_bh,&old_de);
PRINTK3(("vfat_rename 2\n")); if (res < 0)
if (res < 0) goto rename_done; goto rename_done;
is_dir = S_ISDIR(old_inode->i_mode); is_dir = S_ISDIR(old_inode->i_mode);
if (is_dir && (res = fat_scan(old_inode,MSDOS_DOTDOT,&dotdot_bh, if (is_dir) {
&dotdot_de,&dotdot_i_pos)) < 0) if (fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
goto rename_done; &dotdot_de, &dotdot_i_pos) < 0) {
res = -EIO;
goto rename_done;
}
}
if (new_dentry->d_inode) { if (new_dentry->d_inode) {
res = vfat_find(new_dir,&new_dentry->d_name,&sinfo,&new_bh, res = vfat_find(new_dir,&new_dentry->d_name,&sinfo,&new_bh,
......
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