[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Opinions on what to do about STATFS



There's no more room for flags in the f_flags field of statfs. I need
some way of indicating that a mounted file system has soft updates
enabled and running on it. Here are two proposals:

1) Have the combination (MNT_SYNCHRONOUS | MNT_ASYNC) mean that soft
updates is enabled. 

Advantages: Don't have to touch statfs structure 
Disadvantages:
Programs that don't know about this hack might get confused about the
actual semantics of file system updates.

2) Take over one of the spare fields in statfs for an f_eflags
register. Since spare[0] is already being used by cd9660 to pass its
mount flags back, I suggest hijaacking spare[1]. Here is the diff:

struct statfs {
	short	f_type;			/* type of file system (unused; zero) */
	short	f_flags;		/* copy of mount flags */
	long	f_bsize;		/* fundamental file system block size */
	long	f_iosize;		/* optimal transfer block size */
	long	f_blocks;		/* total data blocks in file system */
	long	f_bfree;		/* free blocks in fs */
	long	f_bavail;		/* free blocks avail to non-superuser */
	long	f_files;		/* total file nodes in file system */
	long	f_ffree;		/* free file nodes in fs */
	fsid_t	f_fsid;			/* file system id */
	uid_t	f_owner;		/* user that mounted the file system */
	long    f_syncwrites;           /* count of sync writes since mount */
	long    f_asyncwrites;          /* count of async writes since mount */
-	long	spare[2];
+	long    f_fsspecflags;          /* FS specific flags */
+	long    f_eflags;               /* extra flags */
	char	f_fstypename[MFSNAMELEN]; /* fs type name */
	char	f_mntonname[MNAMELEN];	  /* directory on which mounted */
	char	f_mntfromname[MNAMELEN];  /* mounted file system */
};

The f_eflags field will be populated by flags starting with the STATFS_
prefix. For example,

#define STATFS_SOFTUPD  0x00000001

Advantages of this approach: Clarity, simplicity
Disadvantages: We've used up all the spare bits in statfs. If somebody
else comes along with a great new feature for statfs, more radical
surgery will be necessary. 

Feedback on the choice of names/approach would be appreciated.

-Costa