[OpenAFS] Re: OpenAFS 1.4.2fc2 and Vanilla Linux kernel 2.6.18

Marc Dionne dionne@cs.wisc.edu
Sat, 14 Oct 2006 21:17:15 -0400


This is a multi-part message in MIME format.

--Boundary_(ID_vZQwU5IalY4WZDA29oJRsw)
Content-type: text/plain; charset=ISO-8859-1; format=flowed
Content-transfer-encoding: 7BIT

Ok, how about the patch below.

- get_sb now returns an int instead of a struct super_block * (this 
probably didn't cause any problems)
- statfs is now passed a dentry structure instead of a super_block.  We 
were getting the block size from the wrong structure - not surprising 
that we got unexpected values
- a new configure test is introduced to check the statfs arguments.  A 
regen is needed to rebuild the configure files
- note: the diffs also include an unrelated configure test for 
linux/config.h which was needed to compile on FC6 (I see Chas has a 
patch for this in RT #42662)

With this patch, df output looks better :

Filesystem           1K-blocks      Used Available Use% Mounted on
AFS                    9000000         0   9000000   0% /afs

and stat -f /afs shows a block size of 1024 :

  File: "/afs"
     ID: 6300001234 Namelen: 256     Type: UNKNOWN (0x0)
Block size: 1024       Fundamental block size: 1024
Blocks: Total: 9000000    Free: 9000000    Available: 9000000
Inodes: Total: 9000000    Free: 9000000

Marc

--Boundary_(ID_vZQwU5IalY4WZDA29oJRsw)
Content-type: text/plain; CHARSET=US-ASCII; name=patch_statfs
Content-transfer-encoding: 7BIT
Content-disposition: inline; filename=patch_statfs

*** openafs-1.4.2fc4-orig/acinclude.m4	2006-09-19 18:23:00.000000000 -0400
--- openafs/acinclude.m4	2006-10-14 20:18:28.000000000 -0400
***************
*** 565,571 ****
--- 565,573 ----
  	           [LINUX_BUILD_VNODE_FROM_INODE(${srcdir}/src/config,src/afs/LINUX,${srcdir}/src/afs/LINUX)]
  	         )
  
+ 		 LINUX_STATFS_HAS_DENTRY
  		 LINUX_COMPLETION_H_EXISTS
+ 		 LINUX_CONFIG_H_EXISTS
  		 LINUX_DEFINES_FOR_EACH_PROCESS
  		 LINUX_DEFINES_PREV_TASK
  		 LINUX_FS_STRUCT_SUPER_HAS_ALLOC_INODE
***************
*** 678,683 ****
--- 680,688 ----
  		 if test "x$ac_cv_linux_completion_h_exists" = "xyes" ; then
  		  AC_DEFINE(COMPLETION_H_EXISTS, 1, [define if completion_h exists])
  		 fi
+ 		 if test "x$ac_cv_linux_config_h_exists" = "xyes" ; then
+ 		  AC_DEFINE(CONFIG_H_EXISTS, 1, [define if config_h exists])
+ 		 fi
  		 if test "x$ac_cv_linux_defines_for_each_process" = "xyes" ; then
  		  AC_DEFINE(DEFINED_FOR_EACH_PROCESS, 1, [define if for_each_process defined])
  		 fi
***************
*** 774,779 ****
--- 779,787 ----
  		 if test "x$ac_cv_linux_get_sb_has_struct_vfsmount" = "xyes"; then
  		  AC_DEFINE(GET_SB_HAS_STRUCT_VFSMOUNT, 1, [define if your get_sb_nodev needs a struct vfsmount argument])
  		 fi
+ 		 if test "x$ac_cv_linux_statfs_has_dentry" = "xyes"; then
+ 		  AC_DEFINE(STATFS_HAS_DENTRY, 1, [define if your statfs takes a dentry argument])
+ 		 fi
  		 if test "x$ac_cv_linux_func_a_writepage_takes_writeback_control" = "xyes" ; then
  		  AC_DEFINE(AOP_WRITEPAGE_TAKES_WRITEBACK_CONTROL, 1, [define if your aops.writepage takes a struct writeback_control argument])
  		 fi
*** openafs-1.4.2fc4-orig/src/cf/linux-test4.m4	2006-09-06 16:57:17.000000000 -0400
--- openafs/src/cf/linux-test4.m4	2006-10-14 20:20:27.000000000 -0400
***************
*** 608,613 ****
--- 608,626 ----
        ac_cv_linux_get_sb_has_struct_vfsmount=no)])
    AC_MSG_RESULT($ac_cv_linux_get_sb_has_struct_vfsmount)])
  
+ AC_DEFUN([LINUX_STATFS_HAS_DENTRY], [
+   AC_MSG_CHECKING([for dentry in statfs])
+   AC_CACHE_VAL([ac_cv_linux_statfs_has_dentry], [
+     AC_TRY_KBUILD(
+ [#include <linux/fs.h>
+ #include <linux/statfs.h>],
+ [struct dentry _dentry;
+ struct kstatfs _kstatfs;
+ vfs_statfs(&_dentry, &_kstatfs);],
+       ac_cv_linux_statfs_has_dentry=yes,
+       ac_cv_linux_statfs_has_dentry=no)])
+   AC_MSG_RESULT($ac_cv_linux_statfs_has_dentry)])
+ 
  AC_DEFUN([LINUX_LINUX_KEYRING_SUPPORT], [
    AC_MSG_CHECKING([for linux kernel keyring support])
    AC_CACHE_VAL([ac_cv_linux_keyring_support], [
***************
*** 644,646 ****
--- 657,670 ----
    if test "x$ac_cv_key_alloc_needs_struct_task" = "xyes"; then
      AC_DEFINE([KEY_ALLOC_NEEDS_STRUCT_TASK], 1, [define if key_alloc takes a struct task *])
    fi])
+ 
+ AC_DEFUN([LINUX_CONFIG_H_EXISTS], [
+   AC_MSG_CHECKING([for linux/config.h existance])
+   AC_CACHE_VAL([ac_cv_linux_config_h_exists], [
+     AC_TRY_KBUILD(
+ [#include <linux/config.h>],
+ [],
+       ac_cv_linux_config_h_exists=yes,
+       ac_cv_linux_config_h_exists=no)])
+   AC_MSG_RESULT($ac_cv_linux_config_h_exists)])
+ 
*** openafs-1.4.2fc4-orig/src/afs/LINUX/osi_vfsops.c	2006-08-20 01:34:18.000000000 -0400
--- openafs/src/afs/LINUX/osi_vfsops.c	2006-10-14 20:58:14.000000000 -0400
***************
*** 64,74 ****
   * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super.
   */
  #if defined(AFS_LINUX26_ENV)
- static struct super_block *
  #ifdef GET_SB_HAS_STRUCT_VFSMOUNT
  afs_get_sb(struct file_system_type *fs_type, int flags,
  	   const char *dev_name, void *data, struct vfsmount *mnt)
  #else
  afs_get_sb(struct file_system_type *fs_type, int flags,
  	   const char *dev_name, void *data)
  #endif
--- 64,75 ----
   * dev, covered, s_rd_only, s_dirt, and s_type will be set by read_super.
   */
  #if defined(AFS_LINUX26_ENV)
  #ifdef GET_SB_HAS_STRUCT_VFSMOUNT
+ int
  afs_get_sb(struct file_system_type *fs_type, int flags,
  	   const char *dev_name, void *data, struct vfsmount *mnt)
  #else
+ static struct superblock *
  afs_get_sb(struct file_system_type *fs_type, int flags,
  	   const char *dev_name, void *data)
  #endif
***************
*** 386,392 ****
--- 387,397 ----
   */
  #if defined(AFS_LINUX26_ENV)
  int
+ #if defined(STATFS_HAS_DENTRY)
+ afs_statfs(struct dentry *dentry, struct kstatfs *statp)
+ #else
  afs_statfs(struct super_block *sbp, struct kstatfs *statp)
+ #endif
  #elif defined(AFS_LINUX24_ENV)
  int
  afs_statfs(struct super_block *sbp, struct statfs *statp)
***************
*** 410,416 ****
--- 415,425 ----
      AFS_STATCNT(afs_statfs);
  
      statp->f_type = 0;		/* Can we get a real type sometime? */
+ #if defined(STATFS_HAS_DENTRY)
+     statp->f_bsize = dentry->d_sb->s_blocksize;
+ #else
      statp->f_bsize = sbp->s_blocksize;
+ #endif
      statp->f_blocks = statp->f_bfree = statp->f_bavail = statp->f_files =
  	statp->f_ffree = 9000000;
      statp->f_fsid.val[0] = AFS_VFSMAGIC;

--Boundary_(ID_vZQwU5IalY4WZDA29oJRsw)--