]> git.hungrycats.org Git - linux/commitdiff
[PATCH] FAT: Use just printk() instead of unneeded fat_fs_panic()
authorAndrew Morton <akpm@osdl.org>
Tue, 30 Dec 2003 07:46:14 +0000 (23:46 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Tue, 30 Dec 2003 07:46:14 +0000 (23:46 -0800)
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

fs/fat/inode.c
fs/msdos/namei.c
fs/vfat/namei.c

index 065b12513bf916accf93c085ff927fb2469cc603..e5930b49ec7748bb52bec5e91fae57764b9b9f67 100644 (file)
@@ -1226,10 +1226,10 @@ retry:
        }
        lock_kernel();
        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)",
-                            i_pos);
+               printk(KERN_ERR "FAT: unable to read inode block "
+                      "for updating (i_pos %lld)", i_pos);
                unlock_kernel();
-               return;
+               return /* -EIO */;
        }
        spin_lock(&fat_inode_lock);
        if (i_pos != MSDOS_I(inode)->i_pos) {
index 690fc68b7f6c33fa93ce8f6c91244bf0e6ff596e..62a24f67ae83938dc7eddd59836bc8129531f8fd 100644 (file)
@@ -244,13 +244,14 @@ static int msdos_add_entry(struct inode *dir, const unsigned char *name,
         */
        dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        mark_inode_dirty(dir);
-       memcpy((*de)->name,name,MSDOS_NAME);
+
+       memcpy((*de)->name, name, MSDOS_NAME);
        (*de)->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
        if (is_hid)
                (*de)->attr |= ATTR_HIDDEN;
        (*de)->start = 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;
        mark_buffer_dirty(*bh);
        return 0;
@@ -393,7 +394,6 @@ out_unlock:
        return res;
 
 mkdir_error:
-       printk(KERN_WARNING "msdos_mkdir: error=%d, attempting cleanup\n", res);
        inode->i_nlink = 0;
        inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
        dir->i_nlink--;
@@ -468,13 +468,9 @@ static int do_msdos_rename(struct inode *old_dir, unsigned char *old_name,
                        if (error)
                                goto out;
                }
-               error = fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
-                               &dotdot_de, &dotdot_i_pos);
-               if (error < 0) {
-                       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);
+               if (fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
+                            &dotdot_de, &dotdot_i_pos) < 0) {
+                       error = -EIO;
                        goto out;
                }
        }
index 7085ac36c9d718ce750c3f7f7f520b03e85321fc..e363da852a3e3200f56f6613eb3a5b414ea5b62c 100644 (file)
 #include <linux/buffer_head.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_hash(struct dentry *parent, struct qstr *qstr);
 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,
        for (cksum = i = 0; i < 11; 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++) {
                ps->id = slot;
@@ -716,7 +698,6 @@ static int vfat_build_slots(struct inode *dir, const unsigned char *name,
        de = (struct msdos_dir_entry *) ps;
 
 shortname:
-       PRINTK3(("vfat_fill_slots 9\n"));
        /* build the entry of 8.3 alias name */
        (*slots)++;
        memcpy(de->name, msdos_name, MSDOS_NAME);
@@ -834,9 +815,6 @@ struct dentry *vfat_lookup(struct inode *dir,struct dentry *dentry, struct namei
        struct msdos_dir_entry *de;
        int table;
        
-       PRINTK2(("vfat_lookup: name=%s, len=%d\n", 
-                dentry->d_name.name, dentry->d_name.len));
-
        lock_kernel();
        table = (MSDOS_SB(dir->i_sb)->options.name_check == 's') ? 2 : 0;
        dentry->d_op = &vfat_dentry_ops[table];
@@ -969,7 +947,6 @@ int vfat_unlink(struct inode *dir, struct dentry* dentry)
        struct buffer_head *bh = NULL;
        struct msdos_dir_entry *de;
 
-       PRINTK1(("vfat_unlink: %s\n", dentry->d_name.name));
        lock_kernel();
        res = vfat_find(dir,&dentry->d_name,&sinfo,&bh,&de);
        if (res < 0) {
@@ -1050,14 +1027,18 @@ int vfat_rename(struct inode *old_dir,struct dentry *old_dentry,
        new_inode = new_dentry->d_inode;
        lock_kernel();
        res = vfat_find(old_dir,&old_dentry->d_name,&old_sinfo,&old_bh,&old_de);
-       PRINTK3(("vfat_rename 2\n"));
-       if (res < 0) goto rename_done;
+       if (res < 0)
+               goto rename_done;
 
        is_dir = S_ISDIR(old_inode->i_mode);
 
-       if (is_dir && (res = fat_scan(old_inode,MSDOS_DOTDOT,&dotdot_bh,
-                               &dotdot_de,&dotdot_i_pos)) < 0)
-               goto rename_done;
+       if (is_dir) {
+               if (fat_scan(old_inode, MSDOS_DOTDOT, &dotdot_bh,
+                            &dotdot_de, &dotdot_i_pos) < 0) {
+                       res = -EIO;
+                       goto rename_done;
+               }
+       }
 
        if (new_dentry->d_inode) {
                res = vfat_find(new_dir,&new_dentry->d_name,&sinfo,&new_bh,