Whamcloud - gitweb
Branch b1_4
authoradilger <adilger>
Wed, 25 May 2005 19:38:15 +0000 (19:38 +0000)
committeradilger <adilger>
Wed, 25 May 2005 19:38:15 +0000 (19:38 +0000)
Quiet spurious lov_iocontrol() error messages for PPC64 TCGETS, et. al.  ioctls.
Print file offsets in both decimal and hex for debugging.
b=5947

lustre/llite/dir.c
lustre/llite/file.c

index 1849853..8a0b74e 100644 (file)
@@ -298,7 +298,7 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir)
         unsigned long n = pos >> PAGE_CACHE_SHIFT;
         unsigned long npages = dir_pages(inode);
         unsigned chunk_mask = ~(ext2_chunk_size(inode)-1);
-        unsigned char *types = NULL;
+        unsigned char *types = ext2_filetype_table;
         int need_revalidate = (filp->f_version != inode->i_version);
         int rc = 0;
         ENTRY;
@@ -341,16 +341,15 @@ int ll_readdir(struct file * filp, void * dirent, filldir_t filldir)
                 for ( ;(char*)de <= limit; de = ext2_next_entry(de)) {
                         if (de->inode) {
                                 int over;
-                                unsigned char d_type = DT_UNKNOWN;
 
                                 rc = 0; /* no error if we return something */
-                                if (types && de->file_type < EXT2_FT_MAX)
-                                        d_type = types[de->file_type];
 
                                 offset = (char *)de - kaddr;
                                 over = filldir(dirent, de->name, de->name_len,
                                                (n<<PAGE_CACHE_SHIFT) | offset,
-                                               le32_to_cpu(de->inode), d_type);
+                                               le32_to_cpu(de->inode),
+                                               types[de->file_type &
+                                                     (EXT2_FT_MAX - 1)]);
                                 if (over) {
                                         ext2_put_page(page);
                                         GOTO(done, rc);
@@ -398,7 +397,8 @@ static int ll_dir_ioctl(struct inode *inode, struct file *file,
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), cmd=%#x\n",
                inode->i_ino, inode->i_generation, inode, cmd);
 
-        if (_IOC_TYPE(cmd) == 'T') /* tty ioctls */
+        /* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */
+        if (_IOC_TYPE(cmd) == 'T' || _IOC_TYPE(cmd) == 't') /* tty ioctls */
                 return -ENOTTY;
 
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_IOCTL);
index cc1e5ba..40af36b 100644 (file)
@@ -376,7 +376,7 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm,
         CDEBUG(D_INODE|D_PAGE, "walking page indices start: %lu j: %lu "
                "count: %lu skip: %lu end: %lu%s\n", start, start % count,
                count, skip, end, discard ? " (DISCARDING)" : "");
-        
+
         /* walk through the vmas on the inode and tear down mmaped pages that
          * intersect with the lock.  this stops immediately if there are no
          * mmap()ed regions of the file.  This is not efficient at all and
@@ -386,7 +386,7 @@ void ll_pgcache_remove_extent(struct inode *inode, struct lov_stripe_md *lsm,
                 j = min(count - (i % count), end - i + 1);
                 LASSERT(j > 0);
                 LASSERT(inode->i_mapping);
-                if (ll_teardown_mmaps(inode->i_mapping, 
+                if (ll_teardown_mmaps(inode->i_mapping,
                                       (__u64)i << PAGE_CACHE_SHIFT,
                                       ((__u64)(i+j) << PAGE_CACHE_SHIFT) - 1) )
                         break;
@@ -764,8 +764,8 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
         ssize_t retval;
         __u64 kms;
         ENTRY;
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size=%lu,offset=%Ld=%#Lx\n",
+               inode->i_ino, inode->i_generation,inode,(long)count,*ppos,*ppos);
 
         /* "If nbyte is 0, read() will return 0 and have no other results."
          *                      -- Single Unix Spec */
@@ -800,11 +800,10 @@ static ssize_t ll_file_read(struct file *filp, char *buf, size_t count,
                         RETURN(-EFAULT);
                 RETURN(count);
         }
-        
-        node = ll_node_from_inode(inode, *ppos, *ppos  + count - 1, 
-                                  LCK_PR);
+
+        node = ll_node_from_inode(inode, *ppos, *ppos + count - 1, LCK_PR);
         tree.lt_fd = filp->private_data;
-        rc = ll_tree_lock(&tree, node, buf, count, 
+        rc = ll_tree_lock(&tree, node, buf, count,
                           filp->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0);
         if (rc != 0)
                 RETURN(rc);
@@ -853,8 +852,8 @@ static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
         ssize_t retval;
         int rc;
         ENTRY;
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
-               inode->i_ino, inode->i_generation, inode, count, *ppos);
+        CDEBUG(D_VFSTRACE,"VFS Op:inode=%lu/%u(%p),size=%lu,offset=%Ld=%#Lx\n",
+               inode->i_ino, inode->i_generation,inode,(long)count,*ppos,*ppos);
 
         SIGNAL_MASK_ASSERT(); /* XXX BUG 1511 */
 
@@ -867,18 +866,18 @@ static ssize_t ll_file_write(struct file *file, const char *buf, size_t count,
         if (file->f_flags & O_LOV_DELAY_CREATE && lsm == NULL)
                 RETURN(-EBADF);
 
-        LASSERT(lsm);
-        
+        LASSERT(lsm != NULL);
+
         if (file->f_flags & O_APPEND)
                 node = ll_node_from_inode(inode, 0, OBD_OBJECT_EOF, LCK_PW);
         else
-                node = ll_node_from_inode(inode, *ppos, *ppos  + count - 1, 
+                node = ll_node_from_inode(inode, *ppos, *ppos  + count - 1,
                                           LCK_PW);
         if (IS_ERR(node))
                 RETURN(PTR_ERR(node));
 
         tree.lt_fd = file->private_data;
-        rc = ll_tree_lock(&tree, node, buf, count, 
+        rc = ll_tree_lock(&tree, node, buf, count,
                           file->f_flags & O_NONBLOCK ? LDLM_FL_BLOCK_NOWAIT :0);
         if (rc != 0)
                 RETURN(rc);
@@ -1096,7 +1095,8 @@ int ll_file_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),cmd=%x\n", inode->i_ino,
                inode->i_generation, inode, cmd);
 
-        if (_IOC_TYPE(cmd) == 'T') /* tty ioctls */
+        /* asm-ppc{,64} declares TCGETS, et. al. as type 't' not 'T' */
+        if (_IOC_TYPE(cmd) == 'T' || _IOC_TYPE(cmd) == 't') /* tty ioctls */
                 RETURN(-ENOTTY);
 
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_IOCTL);
@@ -1152,10 +1152,10 @@ loff_t ll_file_seek(struct file *file, loff_t offset, int origin)
         struct lustre_handle lockh = {0};
         loff_t retval;
         ENTRY;
-        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), to=%llu(%s)\n",
-               inode->i_ino, inode->i_generation, inode,
-               offset + ((origin == 2) ? inode->i_size :
-                         (origin == 1) ? file->f_pos : 0),
+        retval = offset + ((origin == 2) ? inode->i_size :
+                           (origin == 1) ? file->f_pos : 0);
+        CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), to=%Lu=%#Lx(%s)\n",
+               inode->i_ino, inode->i_generation, inode, retval, retval,
                origin == 2 ? "SEEK_END": origin == 1 ? "SEEK_CUR" : "SEEK_SET");
 
         lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_LLSEEK);