aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/9p/Kconfig10
-rw-r--r--fs/Kconfig1401
-rw-r--r--fs/adfs/Kconfig27
-rw-r--r--fs/affs/Kconfig21
-rw-r--r--fs/afs/Kconfig21
-rw-r--r--fs/autofs/Kconfig21
-rw-r--r--fs/autofs4/Kconfig20
-rw-r--r--fs/befs/Kconfig26
-rw-r--r--fs/bfs/Kconfig19
-rw-r--r--fs/bio-integrity.c26
-rw-r--r--fs/btrfs/Kconfig18
-rw-r--r--fs/cifs/CHANGES4
-rw-r--r--fs/cifs/cifsencrypt.c18
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/connect.c24
-rw-r--r--fs/cifs/dir.c56
-rw-r--r--fs/cifs/inode.c5
-rw-r--r--fs/cifs/md5.c38
-rw-r--r--fs/cifs/md5.h6
-rw-r--r--fs/cifs/transport.c127
-rw-r--r--fs/coda/Kconfig21
-rw-r--r--fs/compat_ioctl.c7
-rw-r--r--fs/configfs/Kconfig11
-rw-r--r--fs/cramfs/Kconfig19
-rw-r--r--fs/dlm/plock.c6
-rw-r--r--fs/dquot.c218
-rw-r--r--fs/ecryptfs/Kconfig11
-rw-r--r--fs/efs/Kconfig14
-rw-r--r--fs/eventpoll.c22
-rw-r--r--fs/ext3/namei.c20
-rw-r--r--fs/ext4/balloc.c6
-rw-r--r--fs/ext4/ext4.h7
-rw-r--r--fs/ext4/extents.c2
-rw-r--r--fs/ext4/inode.c9
-rw-r--r--fs/ext4/mballoc.c2
-rw-r--r--fs/ext4/namei.c21
-rw-r--r--fs/ext4/resize.c3
-rw-r--r--fs/fat/Kconfig97
-rw-r--r--fs/freevxfs/Kconfig16
-rw-r--r--fs/fuse/Kconfig15
-rw-r--r--fs/fuse/dev.c16
-rw-r--r--fs/fuse/file.c2
-rw-r--r--fs/fuse/inode.c30
-rw-r--r--fs/hfs/Kconfig12
-rw-r--r--fs/hfsplus/Kconfig13
-rw-r--r--fs/hpfs/Kconfig14
-rw-r--r--fs/isofs/Kconfig39
-rw-r--r--fs/jbd2/journal.c6
-rw-r--r--fs/jfs/Kconfig49
-rw-r--r--fs/minix/Kconfig17
-rw-r--r--fs/ncpfs/Kconfig21
-rw-r--r--fs/nfs/Kconfig86
-rw-r--r--fs/nfsd/Kconfig80
-rw-r--r--fs/nfsd/auth.c3
-rw-r--r--fs/nfsd/nfs4state.c1
-rw-r--r--fs/notify/inotify/inotify_user.c135
-rw-r--r--fs/ntfs/Kconfig78
-rw-r--r--fs/ocfs2/Kconfig85
-rw-r--r--fs/ocfs2/quota_global.c169
-rw-r--r--fs/omfs/Kconfig13
-rw-r--r--fs/qnx4/Kconfig25
-rw-r--r--fs/reiserfs/Kconfig85
-rw-r--r--fs/romfs/Kconfig16
-rw-r--r--fs/smbfs/Kconfig55
-rw-r--r--fs/squashfs/Kconfig51
-rw-r--r--fs/sysfs/Kconfig23
-rw-r--r--fs/sysfs/bin.c6
-rw-r--r--fs/sysv/Kconfig36
-rw-r--r--fs/udf/Kconfig18
-rw-r--r--fs/ufs/Kconfig43
-rw-r--r--fs/xfs/Kconfig1
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c305
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.h15
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c184
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c17
-rw-r--r--fs/xfs/quota/xfs_dquot.c38
-rw-r--r--fs/xfs/quota/xfs_dquot.h10
-rw-r--r--fs/xfs/quota/xfs_qm.c9
-rw-r--r--fs/xfs/xfs_ag.h6
-rw-r--r--fs/xfs/xfs_alloc_btree.c2
-rw-r--r--fs/xfs/xfs_attr.c26
-rw-r--r--fs/xfs/xfs_bmap.c166
-rw-r--r--fs/xfs/xfs_bmap.h2
-rw-r--r--fs/xfs/xfs_bmap_btree.c10
-rw-r--r--fs/xfs/xfs_bmap_btree.h4
-rw-r--r--fs/xfs/xfs_btree.c16
-rw-r--r--fs/xfs/xfs_da_btree.c8
-rw-r--r--fs/xfs/xfs_ialloc.c6
-rw-r--r--fs/xfs/xfs_ialloc.h2
-rw-r--r--fs/xfs/xfs_ialloc_btree.h1
-rw-r--r--fs/xfs/xfs_inode.c19
-rw-r--r--fs/xfs/xfs_inode_item.h4
-rw-r--r--fs/xfs/xfs_iomap.c10
-rw-r--r--fs/xfs/xfs_itable.c6
-rw-r--r--fs/xfs/xfs_mount.c26
-rw-r--r--fs/xfs/xfs_mount.h9
-rw-r--r--fs/xfs/xfs_rename.c2
-rw-r--r--fs/xfs/xfs_rtalloc.c2
-rw-r--r--fs/xfs/xfs_rw.h1
-rw-r--r--fs/xfs/xfs_sb.h2
-rw-r--r--fs/xfs/xfs_vnodeops.c20
101 files changed, 2160 insertions, 2415 deletions
diff --git a/fs/9p/Kconfig b/fs/9p/Kconfig
new file mode 100644
index 000000000000..74e0723e90bc
--- /dev/null
+++ b/fs/9p/Kconfig
@@ -0,0 +1,10 @@
1config 9P_FS
2 tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)"
3 depends on INET && NET_9P && EXPERIMENTAL
4 help
5 If you say Y here, you will get experimental support for
6 Plan 9 resource sharing via the 9P2000 protocol.
7
8 See <http://v9fs.sf.net> for more information.
9
10 If unsure, say N.
diff --git a/fs/Kconfig b/fs/Kconfig
index 51307b0fdf0f..93945dd0b1ae 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -27,141 +27,8 @@ config FS_MBCACHE
27 default y if EXT4_FS=y && EXT4_FS_XATTR 27 default y if EXT4_FS=y && EXT4_FS_XATTR
28 default m if EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4_FS_XATTR 28 default m if EXT2_FS_XATTR || EXT3_FS_XATTR || EXT4_FS_XATTR
29 29
30config REISERFS_FS 30source "fs/reiserfs/Kconfig"
31 tristate "Reiserfs support" 31source "fs/jfs/Kconfig"
32 help
33 Stores not just filenames but the files themselves in a balanced
34 tree. Uses journalling.
35
36 Balanced trees are more efficient than traditional file system
37 architectural foundations.
38
39 In general, ReiserFS is as fast as ext2, but is very efficient with
40 large directories and small files. Additional patches are needed
41 for NFS and quotas, please see <http://www.namesys.com/> for links.
42
43 It is more easily extended to have features currently found in
44 database and keyword search systems than block allocation based file
45 systems are. The next version will be so extended, and will support
46 plugins consistent with our motto ``It takes more than a license to
47 make source code open.''
48
49 Read <http://www.namesys.com/> to learn more about reiserfs.
50
51 Sponsored by Threshold Networks, Emusic.com, and Bigstorage.com.
52
53 If you like it, you can pay us to add new features to it that you
54 need, buy a support contract, or pay us to port it to another OS.
55
56config REISERFS_CHECK
57 bool "Enable reiserfs debug mode"
58 depends on REISERFS_FS
59 help
60 If you set this to Y, then ReiserFS will perform every check it can
61 possibly imagine of its internal consistency throughout its
62 operation. It will also go substantially slower. More than once we
63 have forgotten that this was on, and then gone despondent over the
64 latest benchmarks.:-) Use of this option allows our team to go all
65 out in checking for consistency when debugging without fear of its
66 effect on end users. If you are on the verge of sending in a bug
67 report, say Y and you might get a useful error message. Almost
68 everyone should say N.
69
70config REISERFS_PROC_INFO
71 bool "Stats in /proc/fs/reiserfs"
72 depends on REISERFS_FS && PROC_FS
73 help
74 Create under /proc/fs/reiserfs a hierarchy of files, displaying
75 various ReiserFS statistics and internal data at the expense of
76 making your kernel or module slightly larger (+8 KB). This also
77 increases the amount of kernel memory required for each mount.
78 Almost everyone but ReiserFS developers and people fine-tuning
79 reiserfs or tracing problems should say N.
80
81config REISERFS_FS_XATTR
82 bool "ReiserFS extended attributes"
83 depends on REISERFS_FS
84 help
85 Extended attributes are name:value pairs associated with inodes by
86 the kernel or by users (see the attr(5) manual page, or visit
87 <http://acl.bestbits.at/> for details).
88
89 If unsure, say N.
90
91config REISERFS_FS_POSIX_ACL
92 bool "ReiserFS POSIX Access Control Lists"
93 depends on REISERFS_FS_XATTR
94 select FS_POSIX_ACL
95 help
96 Posix Access Control Lists (ACLs) support permissions for users and
97 groups beyond the owner/group/world scheme.
98
99 To learn more about Access Control Lists, visit the Posix ACLs for
100 Linux website <http://acl.bestbits.at/>.
101
102 If you don't know what Access Control Lists are, say N
103
104config REISERFS_FS_SECURITY
105 bool "ReiserFS Security Labels"
106 depends on REISERFS_FS_XATTR
107 help
108 Security labels support alternative access control models
109 implemented by security modules like SELinux. This option
110 enables an extended attribute handler for file security
111 labels in the ReiserFS filesystem.
112
113 If you are not using a security module that requires using
114 extended attributes for file security labels, say N.
115
116config JFS_FS
117 tristate "JFS filesystem support"
118 select NLS
119 help
120 This is a port of IBM's Journaled Filesystem . More information is
121 available in the file <file:Documentation/filesystems/jfs.txt>.
122
123 If you do not intend to use the JFS filesystem, say N.
124
125config JFS_POSIX_ACL
126 bool "JFS POSIX Access Control Lists"
127 depends on JFS_FS
128 select FS_POSIX_ACL
129 help
130 Posix Access Control Lists (ACLs) support permissions for users and
131 groups beyond the owner/group/world scheme.
132
133 To learn more about Access Control Lists, visit the Posix ACLs for
134 Linux website <http://acl.bestbits.at/>.
135
136 If you don't know what Access Control Lists are, say N
137
138config JFS_SECURITY
139 bool "JFS Security Labels"
140 depends on JFS_FS
141 help
142 Security labels support alternative access control models
143 implemented by security modules like SELinux. This option
144 enables an extended attribute handler for file security
145 labels in the jfs filesystem.
146
147 If you are not using a security module that requires using
148 extended attributes for file security labels, say N.
149
150config JFS_DEBUG
151 bool "JFS debugging"
152 depends on JFS_FS
153 help
154 If you are experiencing any problems with the JFS filesystem, say
155 Y here. This will result in additional debugging messages to be
156 written to the system log. Under normal circumstances, this
157 results in very little overhead.
158
159config JFS_STATISTICS
160 bool "JFS statistics"
161 depends on JFS_FS
162 help
163 Enabling this option will cause statistics from the JFS file system
164 to be made available to the user in the /proc/fs/jfs/ directory.
165 32
166config FS_POSIX_ACL 33config FS_POSIX_ACL
167# Posix ACL utility routines (for now, only ext2/ext3/jfs/reiserfs/nfs4) 34# Posix ACL utility routines (for now, only ext2/ext3/jfs/reiserfs/nfs4)
@@ -182,111 +49,8 @@ config FILE_LOCKING
182 49
183source "fs/xfs/Kconfig" 50source "fs/xfs/Kconfig"
184source "fs/gfs2/Kconfig" 51source "fs/gfs2/Kconfig"
185 52source "fs/ocfs2/Kconfig"
186config OCFS2_FS 53source "fs/btrfs/Kconfig"
187 tristate "OCFS2 file system support"
188 depends on NET && SYSFS
189 select CONFIGFS_FS
190 select JBD2
191 select CRC32
192 select QUOTA
193 select QUOTA_TREE
194 help
195 OCFS2 is a general purpose extent based shared disk cluster file
196 system with many similarities to ext3. It supports 64 bit inode
197 numbers, and has automatically extending metadata groups which may
198 also make it attractive for non-clustered use.
199
200 You'll want to install the ocfs2-tools package in order to at least
201 get "mount.ocfs2".
202
203 Project web page: http://oss.oracle.com/projects/ocfs2
204 Tools web page: http://oss.oracle.com/projects/ocfs2-tools
205 OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/
206
207 For more information on OCFS2, see the file
208 <file:Documentation/filesystems/ocfs2.txt>.
209
210config OCFS2_FS_O2CB
211 tristate "O2CB Kernelspace Clustering"
212 depends on OCFS2_FS
213 default y
214 help
215 OCFS2 includes a simple kernelspace clustering package, the OCFS2
216 Cluster Base. It only requires a very small userspace component
217 to configure it. This comes with the standard ocfs2-tools package.
218 O2CB is limited to maintaining a cluster for OCFS2 file systems.
219 It cannot manage any other cluster applications.
220
221 It is always safe to say Y here, as the clustering method is
222 run-time selectable.
223
224config OCFS2_FS_USERSPACE_CLUSTER
225 tristate "OCFS2 Userspace Clustering"
226 depends on OCFS2_FS && DLM
227 default y
228 help
229 This option will allow OCFS2 to use userspace clustering services
230 in conjunction with the DLM in fs/dlm. If you are using a
231 userspace cluster manager, say Y here.
232
233 It is safe to say Y, as the clustering method is run-time
234 selectable.
235
236config OCFS2_FS_STATS
237 bool "OCFS2 statistics"
238 depends on OCFS2_FS
239 default y
240 help
241 This option allows some fs statistics to be captured. Enabling
242 this option may increase the memory consumption.
243
244config OCFS2_DEBUG_MASKLOG
245 bool "OCFS2 logging support"
246 depends on OCFS2_FS
247 default y
248 help
249 The ocfs2 filesystem has an extensive logging system. The system
250 allows selection of events to log via files in /sys/o2cb/logmask/.
251 This option will enlarge your kernel, but it allows debugging of
252 ocfs2 filesystem issues.
253
254config OCFS2_DEBUG_FS
255 bool "OCFS2 expensive checks"
256 depends on OCFS2_FS
257 default n
258 help
259 This option will enable expensive consistency checks. Enable
260 this option for debugging only as it is likely to decrease
261 performance of the filesystem.
262
263config OCFS2_FS_POSIX_ACL
264 bool "OCFS2 POSIX Access Control Lists"
265 depends on OCFS2_FS
266 select FS_POSIX_ACL
267 default n
268 help
269 Posix Access Control Lists (ACLs) support permissions for users and
270 groups beyond the owner/group/world scheme.
271
272config BTRFS_FS
273 tristate "Btrfs filesystem (EXPERIMENTAL) Unstable disk format"
274 depends on EXPERIMENTAL
275 select LIBCRC32C
276 select ZLIB_INFLATE
277 select ZLIB_DEFLATE
278 help
279 Btrfs is a new filesystem with extents, writable snapshotting,
280 support for multiple devices and many more features.
281
282 Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET
283 FINALIZED. You should say N here unless you are interested in
284 testing Btrfs with non-critical data.
285
286 To compile this file system support as a module, choose M here. The
287 module will be called btrfs.
288
289 If unsure, say N.
290 54
291endif # BLOCK 55endif # BLOCK
292 56
@@ -348,64 +112,9 @@ config QUOTACTL
348 depends on XFS_QUOTA || QUOTA 112 depends on XFS_QUOTA || QUOTA
349 default y 113 default y
350 114
351config AUTOFS_FS 115source "fs/autofs/Kconfig"
352 tristate "Kernel automounter support" 116source "fs/autofs4/Kconfig"
353 help 117source "fs/fuse/Kconfig"
354 The automounter is a tool to automatically mount remote file systems
355 on demand. This implementation is partially kernel-based to reduce
356 overhead in the already-mounted case; this is unlike the BSD
357 automounter (amd), which is a pure user space daemon.
358
359 To use the automounter you need the user-space tools from the autofs
360 package; you can find the location in <file:Documentation/Changes>.
361 You also want to answer Y to "NFS file system support", below.
362
363 If you want to use the newer version of the automounter with more
364 features, say N here and say Y to "Kernel automounter v4 support",
365 below.
366
367 To compile this support as a module, choose M here: the module will be
368 called autofs.
369
370 If you are not a part of a fairly large, distributed network, you
371 probably do not need an automounter, and can say N here.
372
373config AUTOFS4_FS
374 tristate "Kernel automounter version 4 support (also supports v3)"
375 help
376 The automounter is a tool to automatically mount remote file systems
377 on demand. This implementation is partially kernel-based to reduce
378 overhead in the already-mounted case; this is unlike the BSD
379 automounter (amd), which is a pure user space daemon.
380
381 To use the automounter you need the user-space tools from
382 <ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/>; you also
383 want to answer Y to "NFS file system support", below.
384
385 To compile this support as a module, choose M here: the module will be
386 called autofs4. You will need to add "alias autofs autofs4" to your
387 modules configuration file.
388
389 If you are not a part of a fairly large, distributed network or
390 don't have a laptop which needs to dynamically reconfigure to the
391 local network, you probably do not need an automounter, and can say
392 N here.
393
394config FUSE_FS
395 tristate "FUSE (Filesystem in Userspace) support"
396 help
397 With FUSE it is possible to implement a fully functional filesystem
398 in a userspace program.
399
400 There's also companion library: libfuse. This library along with
401 utilities is available from the FUSE homepage:
402 <http://fuse.sourceforge.net/>
403
404 See <file:Documentation/filesystems/fuse.txt> for more information.
405 See <file:Documentation/Changes> for needed library/utility version.
406
407 If you want to develop a userspace FS, or if you want to use
408 a filesystem based on FUSE, answer Y or M.
409 118
410config GENERIC_ACL 119config GENERIC_ACL
411 bool 120 bool
@@ -414,64 +123,8 @@ config GENERIC_ACL
414if BLOCK 123if BLOCK
415menu "CD-ROM/DVD Filesystems" 124menu "CD-ROM/DVD Filesystems"
416 125
417config ISO9660_FS 126source "fs/isofs/Kconfig"
418 tristate "ISO 9660 CDROM file system support" 127source "fs/udf/Kconfig"
419 help
420 This is the standard file system used on CD-ROMs. It was previously
421 known as "High Sierra File System" and is called "hsfs" on other
422 Unix systems. The so-called Rock-Ridge extensions which allow for
423 long Unix filenames and symbolic links are also supported by this
424 driver. If you have a CD-ROM drive and want to do more with it than
425 just listen to audio CDs and watch its LEDs, say Y (and read
426 <file:Documentation/filesystems/isofs.txt> and the CD-ROM-HOWTO,
427 available from <http://www.tldp.org/docs.html#howto>), thereby
428 enlarging your kernel by about 27 KB; otherwise say N.
429
430 To compile this file system support as a module, choose M here: the
431 module will be called isofs.
432
433config JOLIET
434 bool "Microsoft Joliet CDROM extensions"
435 depends on ISO9660_FS
436 select NLS
437 help
438 Joliet is a Microsoft extension for the ISO 9660 CD-ROM file system
439 which allows for long filenames in unicode format (unicode is the
440 new 16 bit character code, successor to ASCII, which encodes the
441 characters of almost all languages of the world; see
442 <http://www.unicode.org/> for more information). Say Y here if you
443 want to be able to read Joliet CD-ROMs under Linux.
444
445config ZISOFS
446 bool "Transparent decompression extension"
447 depends on ISO9660_FS
448 select ZLIB_INFLATE
449 help
450 This is a Linux-specific extension to RockRidge which lets you store
451 data in compressed form on a CD-ROM and have it transparently
452 decompressed when the CD-ROM is accessed. See
453 <http://www.kernel.org/pub/linux/utils/fs/zisofs/> for the tools
454 necessary to create such a filesystem. Say Y here if you want to be
455 able to read such compressed CD-ROMs.
456
457config UDF_FS
458 tristate "UDF file system support"
459 select CRC_ITU_T
460 help
461 This is the new file system used on some CD-ROMs and DVDs. Say Y if
462 you intend to mount DVD discs or CDRW's written in packet mode, or
463 if written to by other UDF utilities, such as DirectCD.
464 Please read <file:Documentation/filesystems/udf.txt>.
465
466 To compile this file system support as a module, choose M here: the
467 module will be called udf.
468
469 If unsure, say N.
470
471config UDF_NLS
472 bool
473 default y
474 depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y)
475 128
476endmenu 129endmenu
477endif # BLOCK 130endif # BLOCK
@@ -479,182 +132,8 @@ endif # BLOCK
479if BLOCK 132if BLOCK
480menu "DOS/FAT/NT Filesystems" 133menu "DOS/FAT/NT Filesystems"
481 134
482config FAT_FS 135source "fs/fat/Kconfig"
483 tristate 136source "fs/ntfs/Kconfig"
484 select NLS
485 help
486 If you want to use one of the FAT-based file systems (the MS-DOS and
487 VFAT (Windows 95) file systems), then you must say Y or M here
488 to include FAT support. You will then be able to mount partitions or
489 diskettes with FAT-based file systems and transparently access the
490 files on them, i.e. MSDOS files will look and behave just like all
491 other Unix files.
492
493 This FAT support is not a file system in itself, it only provides
494 the foundation for the other file systems. You will have to say Y or
495 M to at least one of "MSDOS fs support" or "VFAT fs support" in
496 order to make use of it.
497
498 Another way to read and write MSDOS floppies and hard drive
499 partitions from within Linux (but not transparently) is with the
500 mtools ("man mtools") program suite. You don't need to say Y here in
501 order to do that.
502
503 If you need to move large files on floppies between a DOS and a
504 Linux box, say Y here, mount the floppy under Linux with an MSDOS
505 file system and use GNU tar's M option. GNU tar is a program
506 available for Unix and DOS ("man tar" or "info tar").
507
508 The FAT support will enlarge your kernel by about 37 KB. If unsure,
509 say Y.
510
511 To compile this as a module, choose M here: the module will be called
512 fat. Note that if you compile the FAT support as a module, you
513 cannot compile any of the FAT-based file systems into the kernel
514 -- they will have to be modules as well.
515
516config MSDOS_FS
517 tristate "MSDOS fs support"
518 select FAT_FS
519 help
520 This allows you to mount MSDOS partitions of your hard drive (unless
521 they are compressed; to access compressed MSDOS partitions under
522 Linux, you can either use the DOS emulator DOSEMU, described in the
523 DOSEMU-HOWTO, available from
524 <http://www.tldp.org/docs.html#howto>, or try dmsdosfs in
525 <ftp://ibiblio.org/pub/Linux/system/filesystems/dosfs/>. If you
526 intend to use dosemu with a non-compressed MSDOS partition, say Y
527 here) and MSDOS floppies. This means that file access becomes
528 transparent, i.e. the MSDOS files look and behave just like all
529 other Unix files.
530
531 If you have Windows 95 or Windows NT installed on your MSDOS
532 partitions, you should use the VFAT file system (say Y to "VFAT fs
533 support" below), or you will not be able to see the long filenames
534 generated by Windows 95 / Windows NT.
535
536 This option will enlarge your kernel by about 7 KB. If unsure,
537 answer Y. This will only work if you said Y to "DOS FAT fs support"
538 as well. To compile this as a module, choose M here: the module will
539 be called msdos.
540
541config VFAT_FS
542 tristate "VFAT (Windows-95) fs support"
543 select FAT_FS
544 help
545 This option provides support for normal Windows file systems with
546 long filenames. That includes non-compressed FAT-based file systems
547 used by Windows 95, Windows 98, Windows NT 4.0, and the Unix
548 programs from the mtools package.
549
550 The VFAT support enlarges your kernel by about 10 KB and it only
551 works if you said Y to the "DOS FAT fs support" above. Please read
552 the file <file:Documentation/filesystems/vfat.txt> for details. If
553 unsure, say Y.
554
555 To compile this as a module, choose M here: the module will be called
556 vfat.
557
558config FAT_DEFAULT_CODEPAGE
559 int "Default codepage for FAT"
560 depends on MSDOS_FS || VFAT_FS
561 default 437
562 help
563 This option should be set to the codepage of your FAT filesystems.
564 It can be overridden with the "codepage" mount option.
565 See <file:Documentation/filesystems/vfat.txt> for more information.
566
567config FAT_DEFAULT_IOCHARSET
568 string "Default iocharset for FAT"
569 depends on VFAT_FS
570 default "iso8859-1"
571 help
572 Set this to the default input/output character set you'd
573 like FAT to use. It should probably match the character set
574 that most of your FAT filesystems use, and can be overridden
575 with the "iocharset" mount option for FAT filesystems.
576 Note that "utf8" is not recommended for FAT filesystems.
577 If unsure, you shouldn't set "utf8" here.
578 See <file:Documentation/filesystems/vfat.txt> for more information.
579
580config NTFS_FS
581 tristate "NTFS file system support"
582 select NLS
583 help
584 NTFS is the file system of Microsoft Windows NT, 2000, XP and 2003.
585
586 Saying Y or M here enables read support. There is partial, but
587 safe, write support available. For write support you must also
588 say Y to "NTFS write support" below.
589
590 There are also a number of user-space tools available, called
591 ntfsprogs. These include ntfsundelete and ntfsresize, that work
592 without NTFS support enabled in the kernel.
593
594 This is a rewrite from scratch of Linux NTFS support and replaced
595 the old NTFS code starting with Linux 2.5.11. A backport to
596 the Linux 2.4 kernel series is separately available as a patch
597 from the project web site.
598
599 For more information see <file:Documentation/filesystems/ntfs.txt>
600 and <http://www.linux-ntfs.org/>.
601
602 To compile this file system support as a module, choose M here: the
603 module will be called ntfs.
604
605 If you are not using Windows NT, 2000, XP or 2003 in addition to
606 Linux on your computer it is safe to say N.
607
608config NTFS_DEBUG
609 bool "NTFS debugging support"
610 depends on NTFS_FS
611 help
612 If you are experiencing any problems with the NTFS file system, say
613 Y here. This will result in additional consistency checks to be
614 performed by the driver as well as additional debugging messages to
615 be written to the system log. Note that debugging messages are
616 disabled by default. To enable them, supply the option debug_msgs=1
617 at the kernel command line when booting the kernel or as an option
618 to insmod when loading the ntfs module. Once the driver is active,
619 you can enable debugging messages by doing (as root):
620 echo 1 > /proc/sys/fs/ntfs-debug
621 Replacing the "1" with "0" would disable debug messages.
622
623 If you leave debugging messages disabled, this results in little
624 overhead, but enabling debug messages results in very significant
625 slowdown of the system.
626
627 When reporting bugs, please try to have available a full dump of
628 debugging messages while the misbehaviour was occurring.
629
630config NTFS_RW
631 bool "NTFS write support"
632 depends on NTFS_FS
633 help
634 This enables the partial, but safe, write support in the NTFS driver.
635
636 The only supported operation is overwriting existing files, without
637 changing the file length. No file or directory creation, deletion or
638 renaming is possible. Note only non-resident files can be written to
639 so you may find that some very small files (<500 bytes or so) cannot
640 be written to.
641
642 While we cannot guarantee that it will not damage any data, we have
643 so far not received a single report where the driver would have
644 damaged someones data so we assume it is perfectly safe to use.
645
646 Note: While write support is safe in this version (a rewrite from
647 scratch of the NTFS support), it should be noted that the old NTFS
648 write support, included in Linux 2.5.10 and before (since 1997),
649 is not safe.
650
651 This is currently useful with TopologiLinux. TopologiLinux is run
652 on top of any DOS/Microsoft Windows system without partitioning your
653 hard disk. Unlike other Linux distributions TopologiLinux does not
654 need its own partition. For more information see
655 <http://topologi-linux.sourceforge.net/>
656
657 It is perfectly safe to say N here.
658 137
659endmenu 138endmenu
660endif # BLOCK 139endif # BLOCK
@@ -662,30 +141,7 @@ endif # BLOCK
662menu "Pseudo filesystems" 141menu "Pseudo filesystems"
663 142
664source "fs/proc/Kconfig" 143source "fs/proc/Kconfig"
665 144source "fs/sysfs/Kconfig"
666config SYSFS
667 bool "sysfs file system support" if EMBEDDED
668 default y
669 help
670 The sysfs filesystem is a virtual filesystem that the kernel uses to
671 export internal kernel objects, their attributes, and their
672 relationships to one another.
673
674 Users can use sysfs to ascertain useful information about the running
675 kernel, such as the devices the kernel has discovered on each bus and
676 which driver each is bound to. sysfs can also be used to tune devices
677 and other kernel subsystems.
678
679 Some system agents rely on the information in sysfs to operate.
680 /sbin/hotplug uses device and object attributes in sysfs to assist in
681 delegating policy decisions, like persistently naming devices.
682
683 sysfs is currently used by the block subsystem to mount the root
684 partition. If sysfs is disabled you must specify the boot device on
685 the kernel boot command line via its major and minor numbers. For
686 example, "root=03:01" for /dev/hda1.
687
688 Designers of embedded systems may wish to say N here to conserve space.
689 145
690config TMPFS 146config TMPFS
691 bool "Virtual memory file system support (former shm fs)" 147 bool "Virtual memory file system support (former shm fs)"
@@ -726,17 +182,7 @@ config HUGETLBFS
726config HUGETLB_PAGE 182config HUGETLB_PAGE
727 def_bool HUGETLBFS 183 def_bool HUGETLBFS
728 184
729config CONFIGFS_FS 185source "fs/configfs/Kconfig"
730 tristate "Userspace-driven configuration filesystem"
731 depends on SYSFS
732 help
733 configfs is a ram-based filesystem that provides the converse
734 of sysfs's functionality. Where sysfs is a filesystem-based
735 view of kernel objects, configfs is a filesystem-based manager
736 of kernel objects, or config_items.
737
738 Both sysfs and configfs can and should exist together on the
739 same system. One is not a replacement for the other.
740 186
741endmenu 187endmenu
742 188
@@ -755,425 +201,27 @@ menuconfig MISC_FILESYSTEMS
755 201
756if MISC_FILESYSTEMS 202if MISC_FILESYSTEMS
757 203
758config ADFS_FS 204source "fs/adfs/Kconfig"
759 tristate "ADFS file system support (EXPERIMENTAL)" 205source "fs/affs/Kconfig"
760 depends on BLOCK && EXPERIMENTAL 206source "fs/ecryptfs/Kconfig"
761 help 207source "fs/hfs/Kconfig"
762 The Acorn Disc Filing System is the standard file system of the 208source "fs/hfsplus/Kconfig"
763 RiscOS operating system which runs on Acorn's ARM-based Risc PC 209source "fs/befs/Kconfig"
764 systems and the Acorn Archimedes range of machines. If you say Y 210source "fs/bfs/Kconfig"
765 here, Linux will be able to read from ADFS partitions on hard drives 211source "fs/efs/Kconfig"
766 and from ADFS-formatted floppy discs. If you also want to be able to
767 write to those devices, say Y to "ADFS write support" below.
768
769 The ADFS partition should be the first partition (i.e.,
770 /dev/[hs]d?1) on each of your drives. Please read the file
771 <file:Documentation/filesystems/adfs.txt> for further details.
772
773 To compile this code as a module, choose M here: the module will be
774 called adfs.
775
776 If unsure, say N.
777
778config ADFS_FS_RW
779 bool "ADFS write support (DANGEROUS)"
780 depends on ADFS_FS
781 help
782 If you say Y here, you will be able to write to ADFS partitions on
783 hard drives and ADFS-formatted floppy disks. This is experimental
784 codes, so if you're unsure, say N.
785
786config AFFS_FS
787 tristate "Amiga FFS file system support (EXPERIMENTAL)"
788 depends on BLOCK && EXPERIMENTAL
789 help
790 The Fast File System (FFS) is the common file system used on hard
791 disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y
792 if you want to be able to read and write files from and to an Amiga
793 FFS partition on your hard drive. Amiga floppies however cannot be
794 read with this driver due to an incompatibility of the floppy
795 controller used in an Amiga and the standard floppy controller in
796 PCs and workstations. Read <file:Documentation/filesystems/affs.txt>
797 and <file:fs/affs/Changes>.
798
799 With this driver you can also mount disk files used by Bernd
800 Schmidt's Un*X Amiga Emulator
801 (<http://www.freiburg.linux.de/~uae/>).
802 If you want to do this, you will also need to say Y or M to "Loop
803 device support", above.
804
805 To compile this file system support as a module, choose M here: the
806 module will be called affs. If unsure, say N.
807
808config ECRYPT_FS
809 tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
810 depends on EXPERIMENTAL && KEYS && CRYPTO && NET
811 help
812 Encrypted filesystem that operates on the VFS layer. See
813 <file:Documentation/filesystems/ecryptfs.txt> to learn more about
814 eCryptfs. Userspace components are required and can be
815 obtained from <http://ecryptfs.sf.net>.
816
817 To compile this file system support as a module, choose M here: the
818 module will be called ecryptfs.
819
820config HFS_FS
821 tristate "Apple Macintosh file system support (EXPERIMENTAL)"
822 depends on BLOCK && EXPERIMENTAL
823 select NLS
824 help
825 If you say Y here, you will be able to mount Macintosh-formatted
826 floppy disks and hard drive partitions with full read-write access.
827 Please read <file:Documentation/filesystems/hfs.txt> to learn about
828 the available mount options.
829
830 To compile this file system support as a module, choose M here: the
831 module will be called hfs.
832
833config HFSPLUS_FS
834 tristate "Apple Extended HFS file system support"
835 depends on BLOCK
836 select NLS
837 select NLS_UTF8
838 help
839 If you say Y here, you will be able to mount extended format
840 Macintosh-formatted hard drive partitions with full read-write access.
841
842 This file system is often called HFS+ and was introduced with
843 MacOS 8. It includes all Mac specific filesystem data such as
844 data forks and creator codes, but it also has several UNIX
845 style features such as file ownership and permissions.
846
847config BEFS_FS
848 tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)"
849 depends on BLOCK && EXPERIMENTAL
850 select NLS
851 help
852 The BeOS File System (BeFS) is the native file system of Be, Inc's
853 BeOS. Notable features include support for arbitrary attributes
854 on files and directories, and database-like indices on selected
855 attributes. (Also note that this driver doesn't make those features
856 available at this time). It is a 64 bit filesystem, so it supports
857 extremely large volumes and files.
858
859 If you use this filesystem, you should also say Y to at least one
860 of the NLS (native language support) options below.
861
862 If you don't know what this is about, say N.
863
864 To compile this as a module, choose M here: the module will be
865 called befs.
866
867config BEFS_DEBUG
868 bool "Debug BeFS"
869 depends on BEFS_FS
870 help
871 If you say Y here, you can use the 'debug' mount option to enable
872 debugging output from the driver.
873
874config BFS_FS
875 tristate "BFS file system support (EXPERIMENTAL)"
876 depends on BLOCK && EXPERIMENTAL
877 help
878 Boot File System (BFS) is a file system used under SCO UnixWare to
879 allow the bootloader access to the kernel image and other important
880 files during the boot process. It is usually mounted under /stand
881 and corresponds to the slice marked as "STAND" in the UnixWare
882 partition. You should say Y if you want to read or write the files
883 on your /stand slice from within Linux. You then also need to say Y
884 to "UnixWare slices support", below. More information about the BFS
885 file system is contained in the file
886 <file:Documentation/filesystems/bfs.txt>.
887
888 If you don't know what this is about, say N.
889
890 To compile this as a module, choose M here: the module will be called
891 bfs. Note that the file system of your root partition (the one
892 containing the directory /) cannot be compiled as a module.
893
894
895
896config EFS_FS
897 tristate "EFS file system support (read only) (EXPERIMENTAL)"
898 depends on BLOCK && EXPERIMENTAL
899 help
900 EFS is an older file system used for non-ISO9660 CD-ROMs and hard
901 disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer
902 uses the XFS file system for hard disk partitions however).
903
904 This implementation only offers read-only access. If you don't know
905 what all this is about, it's safe to say N. For more information
906 about EFS see its home page at <http://aeschi.ch.eu.org/efs/>.
907
908 To compile the EFS file system support as a module, choose M here: the
909 module will be called efs.
910
911source "fs/jffs2/Kconfig" 212source "fs/jffs2/Kconfig"
912# UBIFS File system configuration 213# UBIFS File system configuration
913source "fs/ubifs/Kconfig" 214source "fs/ubifs/Kconfig"
914 215source "fs/cramfs/Kconfig"
915config CRAMFS 216source "fs/squashfs/Kconfig"
916 tristate "Compressed ROM file system support (cramfs)" 217source "fs/freevxfs/Kconfig"
917 depends on BLOCK 218source "fs/minix/Kconfig"
918 select ZLIB_INFLATE 219source "fs/omfs/Kconfig"
919 help 220source "fs/hpfs/Kconfig"
920 Saying Y here includes support for CramFs (Compressed ROM File 221source "fs/qnx4/Kconfig"
921 System). CramFs is designed to be a simple, small, and compressed 222source "fs/romfs/Kconfig"
922 file system for ROM based embedded systems. CramFs is read-only, 223source "fs/sysv/Kconfig"
923 limited to 256MB file systems (with 16MB files), and doesn't support 224source "fs/ufs/Kconfig"
924 16/32 bits uid/gid, hard links and timestamps.
925
926 See <file:Documentation/filesystems/cramfs.txt> and
927 <file:fs/cramfs/README> for further information.
928
929 To compile this as a module, choose M here: the module will be called
930 cramfs. Note that the root file system (the one containing the
931 directory /) cannot be compiled as a module.
932
933 If unsure, say N.
934
935config SQUASHFS
936 tristate "SquashFS 4.0 - Squashed file system support"
937 depends on BLOCK
938 select ZLIB_INFLATE
939 help
940 Saying Y here includes support for SquashFS 4.0 (a Compressed
941 Read-Only File System). Squashfs is a highly compressed read-only
942 filesystem for Linux. It uses zlib compression to compress both
943 files, inodes and directories. Inodes in the system are very small
944 and all blocks are packed to minimise data overhead. Block sizes
945 greater than 4K are supported up to a maximum of 1 Mbytes (default
946 block size 128K). SquashFS 4.0 supports 64 bit filesystems and files
947 (larger than 4GB), full uid/gid information, hard links and
948 timestamps.
949
950 Squashfs is intended for general read-only filesystem use, for
951 archival use (i.e. in cases where a .tar.gz file may be used), and in
952 embedded systems where low overhead is needed. Further information
953 and tools are available from http://squashfs.sourceforge.net.
954
955 If you want to compile this as a module ( = code which can be
956 inserted in and removed from the running kernel whenever you want),
957 say M here and read <file:Documentation/modules.txt>. The module
958 will be called squashfs. Note that the root file system (the one
959 containing the directory /) cannot be compiled as a module.
960
961 If unsure, say N.
962
963config SQUASHFS_EMBEDDED
964
965 bool "Additional option for memory-constrained systems"
966 depends on SQUASHFS
967 default n
968 help
969 Saying Y here allows you to specify cache size.
970
971 If unsure, say N.
972
973config SQUASHFS_FRAGMENT_CACHE_SIZE
974 int "Number of fragments cached" if SQUASHFS_EMBEDDED
975 depends on SQUASHFS
976 default "3"
977 help
978 By default SquashFS caches the last 3 fragments read from
979 the filesystem. Increasing this amount may mean SquashFS
980 has to re-read fragments less often from disk, at the expense
981 of extra system memory. Decreasing this amount will mean
982 SquashFS uses less memory at the expense of extra reads from disk.
983
984 Note there must be at least one cached fragment. Anything
985 much more than three will probably not make much difference.
986
987config VXFS_FS
988 tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
989 depends on BLOCK
990 help
991 FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
992 file system format. VERITAS VxFS(TM) is the standard file system
993 of SCO UnixWare (and possibly others) and optionally available
994 for Sunsoft Solaris, HP-UX and many other operating systems.
995 Currently only readonly access is supported.
996
997 NOTE: the file system type as used by mount(1), mount(2) and
998 fstab(5) is 'vxfs' as it describes the file system format, not
999 the actual driver.
1000
1001 To compile this as a module, choose M here: the module will be
1002 called freevxfs. If unsure, say N.
1003
1004config MINIX_FS
1005 tristate "Minix file system support"
1006 depends on BLOCK
1007 help
1008 Minix is a simple operating system used in many classes about OS's.
1009 The minix file system (method to organize files on a hard disk
1010 partition or a floppy disk) was the original file system for Linux,
1011 but has been superseded by the second extended file system ext2fs.
1012 You don't want to use the minix file system on your hard disk
1013 because of certain built-in restrictions, but it is sometimes found
1014 on older Linux floppy disks. This option will enlarge your kernel
1015 by about 28 KB. If unsure, say N.
1016
1017 To compile this file system support as a module, choose M here: the
1018 module will be called minix. Note that the file system of your root
1019 partition (the one containing the directory /) cannot be compiled as
1020 a module.
1021
1022config OMFS_FS
1023 tristate "SonicBlue Optimized MPEG File System support"
1024 depends on BLOCK
1025 select CRC_ITU_T
1026 help
1027 This is the proprietary file system used by the Rio Karma music
1028 player and ReplayTV DVR. Despite the name, this filesystem is not
1029 more efficient than a standard FS for MPEG files, in fact likely
1030 the opposite is true. Say Y if you have either of these devices
1031 and wish to mount its disk.
1032
1033 To compile this file system support as a module, choose M here: the
1034 module will be called omfs. If unsure, say N.
1035
1036config HPFS_FS
1037 tristate "OS/2 HPFS file system support"
1038 depends on BLOCK
1039 help
1040 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
1041 is the file system used for organizing files on OS/2 hard disk
1042 partitions. Say Y if you want to be able to read files from and
1043 write files to an OS/2 HPFS partition on your hard drive. OS/2
1044 floppies however are in regular MSDOS format, so you don't need this
1045 option in order to be able to read them. Read
1046 <file:Documentation/filesystems/hpfs.txt>.
1047
1048 To compile this file system support as a module, choose M here: the
1049 module will be called hpfs. If unsure, say N.
1050
1051
1052config QNX4FS_FS
1053 tristate "QNX4 file system support (read only)"
1054 depends on BLOCK
1055 help
1056 This is the file system used by the real-time operating systems
1057 QNX 4 and QNX 6 (the latter is also called QNX RTP).
1058 Further information is available at <http://www.qnx.com/>.
1059 Say Y if you intend to mount QNX hard disks or floppies.
1060 Unless you say Y to "QNX4FS read-write support" below, you will
1061 only be able to read these file systems.
1062
1063 To compile this file system support as a module, choose M here: the
1064 module will be called qnx4.
1065
1066 If you don't know whether you need it, then you don't need it:
1067 answer N.
1068
1069config QNX4FS_RW
1070 bool "QNX4FS write support (DANGEROUS)"
1071 depends on QNX4FS_FS && EXPERIMENTAL && BROKEN
1072 help
1073 Say Y if you want to test write support for QNX4 file systems.
1074
1075 It's currently broken, so for now:
1076 answer N.
1077
1078config ROMFS_FS
1079 tristate "ROM file system support"
1080 depends on BLOCK
1081 ---help---
1082 This is a very small read-only file system mainly intended for
1083 initial ram disks of installation disks, but it could be used for
1084 other read-only media as well. Read
1085 <file:Documentation/filesystems/romfs.txt> for details.
1086
1087 To compile this file system support as a module, choose M here: the
1088 module will be called romfs. Note that the file system of your
1089 root partition (the one containing the directory /) cannot be a
1090 module.
1091
1092 If you don't know whether you need it, then you don't need it:
1093 answer N.
1094
1095
1096config SYSV_FS
1097 tristate "System V/Xenix/V7/Coherent file system support"
1098 depends on BLOCK
1099 help
1100 SCO, Xenix and Coherent are commercial Unix systems for Intel
1101 machines, and Version 7 was used on the DEC PDP-11. Saying Y
1102 here would allow you to read from their floppies and hard disk
1103 partitions.
1104
1105 If you have floppies or hard disk partitions like that, it is likely
1106 that they contain binaries from those other Unix systems; in order
1107 to run these binaries, you will want to install linux-abi which is
1108 a set of kernel modules that lets you run SCO, Xenix, Wyse,
1109 UnixWare, Dell Unix and System V programs under Linux. It is
1110 available via FTP (user: ftp) from
1111 <ftp://ftp.openlinux.org/pub/people/hch/linux-abi/>).
1112 NOTE: that will work only for binaries from Intel-based systems;
1113 PDP ones will have to wait until somebody ports Linux to -11 ;-)
1114
1115 If you only intend to mount files from some other Unix over the
1116 network using NFS, you don't need the System V file system support
1117 (but you need NFS file system support obviously).
1118
1119 Note that this option is generally not needed for floppies, since a
1120 good portable way to transport files and directories between unixes
1121 (and even other operating systems) is given by the tar program ("man
1122 tar" or preferably "info tar"). Note also that this option has
1123 nothing whatsoever to do with the option "System V IPC". Read about
1124 the System V file system in
1125 <file:Documentation/filesystems/sysv-fs.txt>.
1126 Saying Y here will enlarge your kernel by about 27 KB.
1127
1128 To compile this as a module, choose M here: the module will be called
1129 sysv.
1130
1131 If you haven't heard about all of this before, it's safe to say N.
1132
1133
1134config UFS_FS
1135 tristate "UFS file system support (read only)"
1136 depends on BLOCK
1137 help
1138 BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
1139 OpenBSD and NeXTstep) use a file system called UFS. Some System V
1140 Unixes can create and mount hard disk partitions and diskettes using
1141 this file system as well. Saying Y here will allow you to read from
1142 these partitions; if you also want to write to them, say Y to the
1143 experimental "UFS file system write support", below. Please read the
1144 file <file:Documentation/filesystems/ufs.txt> for more information.
1145
1146 The recently released UFS2 variant (used in FreeBSD 5.x) is
1147 READ-ONLY supported.
1148
1149 Note that this option is generally not needed for floppies, since a
1150 good portable way to transport files and directories between unixes
1151 (and even other operating systems) is given by the tar program ("man
1152 tar" or preferably "info tar").
1153
1154 When accessing NeXTstep files, you may need to convert them from the
1155 NeXT character set to the Latin1 character set; use the program
1156 recode ("info recode") for this purpose.
1157
1158 To compile the UFS file system support as a module, choose M here: the
1159 module will be called ufs.
1160
1161 If you haven't heard about all of this before, it's safe to say N.
1162
1163config UFS_FS_WRITE
1164 bool "UFS file system write support (DANGEROUS)"
1165 depends on UFS_FS && EXPERIMENTAL
1166 help
1167 Say Y here if you want to try writing to UFS partitions. This is
1168 experimental, so you should back up your UFS partitions beforehand.
1169
1170config UFS_DEBUG
1171 bool "UFS debugging"
1172 depends on UFS_FS
1173 help
1174 If you are experiencing any problems with the UFS filesystem, say
1175 Y here. This will result in _many_ additional debugging messages to be
1176 written to the system log.
1177 225
1178endif # MISC_FILESYSTEMS 226endif # MISC_FILESYSTEMS
1179 227
@@ -1193,173 +241,8 @@ menuconfig NETWORK_FILESYSTEMS
1193 241
1194if NETWORK_FILESYSTEMS 242if NETWORK_FILESYSTEMS
1195 243
1196config NFS_FS 244source "fs/nfs/Kconfig"
1197 tristate "NFS client support" 245source "fs/nfsd/Kconfig"
1198 depends on INET
1199 select LOCKD
1200 select SUNRPC
1201 select NFS_ACL_SUPPORT if NFS_V3_ACL
1202 help
1203 Choose Y here if you want to access files residing on other
1204 computers using Sun's Network File System protocol. To compile
1205 this file system support as a module, choose M here: the module
1206 will be called nfs.
1207
1208 To mount file systems exported by NFS servers, you also need to
1209 install the user space mount.nfs command which can be found in
1210 the Linux nfs-utils package, available from http://linux-nfs.org/.
1211 Information about using the mount command is available in the
1212 mount(8) man page. More detail about the Linux NFS client
1213 implementation is available via the nfs(5) man page.
1214
1215 Below you can choose which versions of the NFS protocol are
1216 available in the kernel to mount NFS servers. Support for NFS
1217 version 2 (RFC 1094) is always available when NFS_FS is selected.
1218
1219 To configure a system which mounts its root file system via NFS
1220 at boot time, say Y here, select "Kernel level IP
1221 autoconfiguration" in the NETWORK menu, and select "Root file
1222 system on NFS" below. You cannot compile this file system as a
1223 module in this case.
1224
1225 If unsure, say N.
1226
1227config NFS_V3
1228 bool "NFS client support for NFS version 3"
1229 depends on NFS_FS
1230 help
1231 This option enables support for version 3 of the NFS protocol
1232 (RFC 1813) in the kernel's NFS client.
1233
1234 If unsure, say Y.
1235
1236config NFS_V3_ACL
1237 bool "NFS client support for the NFSv3 ACL protocol extension"
1238 depends on NFS_V3
1239 help
1240 Some NFS servers support an auxiliary NFSv3 ACL protocol that
1241 Sun added to Solaris but never became an official part of the
1242 NFS version 3 protocol. This protocol extension allows
1243 applications on NFS clients to manipulate POSIX Access Control
1244 Lists on files residing on NFS servers. NFS servers enforce
1245 ACLs on local files whether this protocol is available or not.
1246
1247 Choose Y here if your NFS server supports the Solaris NFSv3 ACL
1248 protocol extension and you want your NFS client to allow
1249 applications to access and modify ACLs on files on the server.
1250
1251 Most NFS servers don't support the Solaris NFSv3 ACL protocol
1252 extension. You can choose N here or specify the "noacl" mount
1253 option to prevent your NFS client from trying to use the NFSv3
1254 ACL protocol.
1255
1256 If unsure, say N.
1257
1258config NFS_V4
1259 bool "NFS client support for NFS version 4 (EXPERIMENTAL)"
1260 depends on NFS_FS && EXPERIMENTAL
1261 select RPCSEC_GSS_KRB5
1262 help
1263 This option enables support for version 4 of the NFS protocol
1264 (RFC 3530) in the kernel's NFS client.
1265
1266 To mount NFS servers using NFSv4, you also need to install user
1267 space programs which can be found in the Linux nfs-utils package,
1268 available from http://linux-nfs.org/.
1269
1270 If unsure, say N.
1271
1272config ROOT_NFS
1273 bool "Root file system on NFS"
1274 depends on NFS_FS=y && IP_PNP
1275 help
1276 If you want your system to mount its root file system via NFS,
1277 choose Y here. This is common practice for managing systems
1278 without local permanent storage. For details, read
1279 <file:Documentation/filesystems/nfsroot.txt>.
1280
1281 Most people say N here.
1282
1283config NFSD
1284 tristate "NFS server support"
1285 depends on INET
1286 select LOCKD
1287 select SUNRPC
1288 select EXPORTFS
1289 select NFS_ACL_SUPPORT if NFSD_V2_ACL
1290 help
1291 Choose Y here if you want to allow other computers to access
1292 files residing on this system using Sun's Network File System
1293 protocol. To compile the NFS server support as a module,
1294 choose M here: the module will be called nfsd.
1295
1296 You may choose to use a user-space NFS server instead, in which
1297 case you can choose N here.
1298
1299 To export local file systems using NFS, you also need to install
1300 user space programs which can be found in the Linux nfs-utils
1301 package, available from http://linux-nfs.org/. More detail about
1302 the Linux NFS server implementation is available via the
1303 exports(5) man page.
1304
1305 Below you can choose which versions of the NFS protocol are
1306 available to clients mounting the NFS server on this system.
1307 Support for NFS version 2 (RFC 1094) is always available when
1308 CONFIG_NFSD is selected.
1309
1310 If unsure, say N.
1311
1312config NFSD_V2_ACL
1313 bool
1314 depends on NFSD
1315
1316config NFSD_V3
1317 bool "NFS server support for NFS version 3"
1318 depends on NFSD
1319 help
1320 This option enables support in your system's NFS server for
1321 version 3 of the NFS protocol (RFC 1813).
1322
1323 If unsure, say Y.
1324
1325config NFSD_V3_ACL
1326 bool "NFS server support for the NFSv3 ACL protocol extension"
1327 depends on NFSD_V3
1328 select NFSD_V2_ACL
1329 help
1330 Solaris NFS servers support an auxiliary NFSv3 ACL protocol that
1331 never became an official part of the NFS version 3 protocol.
1332 This protocol extension allows applications on NFS clients to
1333 manipulate POSIX Access Control Lists on files residing on NFS
1334 servers. NFS servers enforce POSIX ACLs on local files whether
1335 this protocol is available or not.
1336
1337 This option enables support in your system's NFS server for the
1338 NFSv3 ACL protocol extension allowing NFS clients to manipulate
1339 POSIX ACLs on files exported by your system's NFS server. NFS
1340 clients which support the Solaris NFSv3 ACL protocol can then
1341 access and modify ACLs on your NFS server.
1342
1343 To store ACLs on your NFS server, you also need to enable ACL-
1344 related CONFIG options for your local file systems of choice.
1345
1346 If unsure, say N.
1347
1348config NFSD_V4
1349 bool "NFS server support for NFS version 4 (EXPERIMENTAL)"
1350 depends on NFSD && PROC_FS && EXPERIMENTAL
1351 select NFSD_V3
1352 select FS_POSIX_ACL
1353 select RPCSEC_GSS_KRB5
1354 help
1355 This option enables support in your system's NFS server for
1356 version 4 of the NFS protocol (RFC 3530).
1357
1358 To export files using NFSv4, you need to install additional user
1359 space programs which can be found in the Linux nfs-utils package,
1360 available from http://linux-nfs.org/.
1361
1362 If unsure, say N.
1363 246
1364config LOCKD 247config LOCKD
1365 tristate 248 tristate
@@ -1381,221 +264,13 @@ config NFS_COMMON
1381 depends on NFSD || NFS_FS 264 depends on NFSD || NFS_FS
1382 default y 265 default y
1383 266
1384config SUNRPC 267source "net/sunrpc/Kconfig"
1385 tristate 268source "fs/smbfs/Kconfig"
1386
1387config SUNRPC_GSS
1388 tristate
1389
1390config SUNRPC_XPRT_RDMA
1391 tristate
1392 depends on SUNRPC && INFINIBAND && EXPERIMENTAL
1393 default SUNRPC && INFINIBAND
1394 help
1395 This option enables an RPC client transport capability that
1396 allows the NFS client to mount servers via an RDMA-enabled
1397 transport.
1398
1399 To compile RPC client RDMA transport support as a module,
1400 choose M here: the module will be called xprtrdma.
1401
1402 If unsure, say N.
1403
1404config SUNRPC_REGISTER_V4
1405 bool "Register local RPC services via rpcbind v4 (EXPERIMENTAL)"
1406 depends on SUNRPC && EXPERIMENTAL
1407 default n
1408 help
1409 Sun added support for registering RPC services at an IPv6
1410 address by creating two new versions of the rpcbind protocol
1411 (RFC 1833).
1412
1413 This option enables support in the kernel RPC server for
1414 registering kernel RPC services via version 4 of the rpcbind
1415 protocol. If you enable this option, you must run a portmapper
1416 daemon that supports rpcbind protocol version 4.
1417
1418 Serving NFS over IPv6 from knfsd (the kernel's NFS server)
1419 requires that you enable this option and use a portmapper that
1420 supports rpcbind version 4.
1421
1422 If unsure, say N to get traditional behavior (register kernel
1423 RPC services using only rpcbind version 2). Distributions
1424 using the legacy Linux portmapper daemon must say N here.
1425
1426config RPCSEC_GSS_KRB5
1427 tristate "Secure RPC: Kerberos V mechanism (EXPERIMENTAL)"
1428 depends on SUNRPC && EXPERIMENTAL
1429 select SUNRPC_GSS
1430 select CRYPTO
1431 select CRYPTO_MD5
1432 select CRYPTO_DES
1433 select CRYPTO_CBC
1434 help
1435 Choose Y here to enable Secure RPC using the Kerberos version 5
1436 GSS-API mechanism (RFC 1964).
1437
1438 Secure RPC calls with Kerberos require an auxiliary user-space
1439 daemon which may be found in the Linux nfs-utils package
1440 available from http://linux-nfs.org/. In addition, user-space
1441 Kerberos support should be installed.
1442
1443 If unsure, say N.
1444
1445config RPCSEC_GSS_SPKM3
1446 tristate "Secure RPC: SPKM3 mechanism (EXPERIMENTAL)"
1447 depends on SUNRPC && EXPERIMENTAL
1448 select SUNRPC_GSS
1449 select CRYPTO
1450 select CRYPTO_MD5
1451 select CRYPTO_DES
1452 select CRYPTO_CAST5
1453 select CRYPTO_CBC
1454 help
1455 Choose Y here to enable Secure RPC using the SPKM3 public key
1456 GSS-API mechansim (RFC 2025).
1457
1458 Secure RPC calls with SPKM3 require an auxiliary userspace
1459 daemon which may be found in the Linux nfs-utils package
1460 available from http://linux-nfs.org/.
1461
1462 If unsure, say N.
1463
1464config SMB_FS
1465 tristate "SMB file system support (OBSOLETE, please use CIFS)"
1466 depends on INET
1467 select NLS
1468 help
1469 SMB (Server Message Block) is the protocol Windows for Workgroups
1470 (WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share
1471 files and printers over local networks. Saying Y here allows you to
1472 mount their file systems (often called "shares" in this context) and
1473 access them just like any other Unix directory. Currently, this
1474 works only if the Windows machines use TCP/IP as the underlying
1475 transport protocol, and not NetBEUI. For details, read
1476 <file:Documentation/filesystems/smbfs.txt> and the SMB-HOWTO,
1477 available from <http://www.tldp.org/docs.html#howto>.
1478
1479 Note: if you just want your box to act as an SMB *server* and make
1480 files and printing services available to Windows clients (which need
1481 to have a TCP/IP stack), you don't need to say Y here; you can use
1482 the program SAMBA (available from <ftp://ftp.samba.org/pub/samba/>)
1483 for that.
1484
1485 General information about how to connect Linux, Windows machines and
1486 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
1487
1488 To compile the SMB support as a module, choose M here:
1489 the module will be called smbfs. Most people say N, however.
1490
1491config SMB_NLS_DEFAULT
1492 bool "Use a default NLS"
1493 depends on SMB_FS
1494 help
1495 Enabling this will make smbfs use nls translations by default. You
1496 need to specify the local charset (CONFIG_NLS_DEFAULT) in the nls
1497 settings and you need to give the default nls for the SMB server as
1498 CONFIG_SMB_NLS_REMOTE.
1499
1500 The nls settings can be changed at mount time, if your smbmount
1501 supports that, using the codepage and iocharset parameters.
1502
1503 smbmount from samba 2.2.0 or later supports this.
1504
1505config SMB_NLS_REMOTE
1506 string "Default Remote NLS Option"
1507 depends on SMB_NLS_DEFAULT
1508 default "cp437"
1509 help
1510 This setting allows you to specify a default value for which
1511 codepage the server uses. If this field is left blank no
1512 translations will be done by default. The local codepage/charset
1513 default to CONFIG_NLS_DEFAULT.
1514
1515 The nls settings can be changed at mount time, if your smbmount
1516 supports that, using the codepage and iocharset parameters.
1517
1518 smbmount from samba 2.2.0 or later supports this.
1519
1520source "fs/cifs/Kconfig" 269source "fs/cifs/Kconfig"
1521
1522config NCP_FS
1523 tristate "NCP file system support (to mount NetWare volumes)"
1524 depends on IPX!=n || INET
1525 help
1526 NCP (NetWare Core Protocol) is a protocol that runs over IPX and is
1527 used by Novell NetWare clients to talk to file servers. It is to
1528 IPX what NFS is to TCP/IP, if that helps. Saying Y here allows you
1529 to mount NetWare file server volumes and to access them just like
1530 any other Unix directory. For details, please read the file
1531 <file:Documentation/filesystems/ncpfs.txt> in the kernel source and
1532 the IPX-HOWTO from <http://www.tldp.org/docs.html#howto>.
1533
1534 You do not have to say Y here if you want your Linux box to act as a
1535 file *server* for Novell NetWare clients.
1536
1537 General information about how to connect Linux, Windows machines and
1538 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
1539
1540 To compile this as a module, choose M here: the module will be called
1541 ncpfs. Say N unless you are connected to a Novell network.
1542
1543source "fs/ncpfs/Kconfig" 270source "fs/ncpfs/Kconfig"
1544 271source "fs/coda/Kconfig"
1545config CODA_FS 272source "fs/afs/Kconfig"
1546 tristate "Coda file system support (advanced network fs)" 273source "fs/9p/Kconfig"
1547 depends on INET
1548 help
1549 Coda is an advanced network file system, similar to NFS in that it
1550 enables you to mount file systems of a remote server and access them
1551 with regular Unix commands as if they were sitting on your hard
1552 disk. Coda has several advantages over NFS: support for
1553 disconnected operation (e.g. for laptops), read/write server
1554 replication, security model for authentication and encryption,
1555 persistent client caches and write back caching.
1556
1557 If you say Y here, your Linux box will be able to act as a Coda
1558 *client*. You will need user level code as well, both for the
1559 client and server. Servers are currently user level, i.e. they need
1560 no kernel support. Please read
1561 <file:Documentation/filesystems/coda.txt> and check out the Coda
1562 home page <http://www.coda.cs.cmu.edu/>.
1563
1564 To compile the coda client support as a module, choose M here: the
1565 module will be called coda.
1566
1567config AFS_FS
1568 tristate "Andrew File System support (AFS) (EXPERIMENTAL)"
1569 depends on INET && EXPERIMENTAL
1570 select AF_RXRPC
1571 help
1572 If you say Y here, you will get an experimental Andrew File System
1573 driver. It currently only supports unsecured read-only AFS access.
1574
1575 See <file:Documentation/filesystems/afs.txt> for more information.
1576
1577 If unsure, say N.
1578
1579config AFS_DEBUG
1580 bool "AFS dynamic debugging"
1581 depends on AFS_FS
1582 help
1583 Say Y here to make runtime controllable debugging messages appear.
1584
1585 See <file:Documentation/filesystems/afs.txt> for more information.
1586
1587 If unsure, say N.
1588
1589config 9P_FS
1590 tristate "Plan 9 Resource Sharing Support (9P2000) (Experimental)"
1591 depends on INET && NET_9P && EXPERIMENTAL
1592 help
1593 If you say Y here, you will get experimental support for
1594 Plan 9 resource sharing via the 9P2000 protocol.
1595
1596 See <http://v9fs.sf.net> for more information.
1597
1598 If unsure, say N.
1599 274
1600endif # NETWORK_FILESYSTEMS 275endif # NETWORK_FILESYSTEMS
1601 276
diff --git a/fs/adfs/Kconfig b/fs/adfs/Kconfig
new file mode 100644
index 000000000000..e55182a74605
--- /dev/null
+++ b/fs/adfs/Kconfig
@@ -0,0 +1,27 @@
1config ADFS_FS
2 tristate "ADFS file system support (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 help
5 The Acorn Disc Filing System is the standard file system of the
6 RiscOS operating system which runs on Acorn's ARM-based Risc PC
7 systems and the Acorn Archimedes range of machines. If you say Y
8 here, Linux will be able to read from ADFS partitions on hard drives
9 and from ADFS-formatted floppy discs. If you also want to be able to
10 write to those devices, say Y to "ADFS write support" below.
11
12 The ADFS partition should be the first partition (i.e.,
13 /dev/[hs]d?1) on each of your drives. Please read the file
14 <file:Documentation/filesystems/adfs.txt> for further details.
15
16 To compile this code as a module, choose M here: the module will be
17 called adfs.
18
19 If unsure, say N.
20
21config ADFS_FS_RW
22 bool "ADFS write support (DANGEROUS)"
23 depends on ADFS_FS
24 help
25 If you say Y here, you will be able to write to ADFS partitions on
26 hard drives and ADFS-formatted floppy disks. This is experimental
27 codes, so if you're unsure, say N.
diff --git a/fs/affs/Kconfig b/fs/affs/Kconfig
new file mode 100644
index 000000000000..cfad9afb4762
--- /dev/null
+++ b/fs/affs/Kconfig
@@ -0,0 +1,21 @@
1config AFFS_FS
2 tristate "Amiga FFS file system support (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 help
5 The Fast File System (FFS) is the common file system used on hard
6 disks by Amiga(tm) systems since AmigaOS Version 1.3 (34.20). Say Y
7 if you want to be able to read and write files from and to an Amiga
8 FFS partition on your hard drive. Amiga floppies however cannot be
9 read with this driver due to an incompatibility of the floppy
10 controller used in an Amiga and the standard floppy controller in
11 PCs and workstations. Read <file:Documentation/filesystems/affs.txt>
12 and <file:fs/affs/Changes>.
13
14 With this driver you can also mount disk files used by Bernd
15 Schmidt's Un*X Amiga Emulator
16 (<http://www.freiburg.linux.de/~uae/>).
17 If you want to do this, you will also need to say Y or M to "Loop
18 device support", above.
19
20 To compile this file system support as a module, choose M here: the
21 module will be called affs. If unsure, say N.
diff --git a/fs/afs/Kconfig b/fs/afs/Kconfig
new file mode 100644
index 000000000000..e7b522fe15e1
--- /dev/null
+++ b/fs/afs/Kconfig
@@ -0,0 +1,21 @@
1config AFS_FS
2 tristate "Andrew File System support (AFS) (EXPERIMENTAL)"
3 depends on INET && EXPERIMENTAL
4 select AF_RXRPC
5 help
6 If you say Y here, you will get an experimental Andrew File System
7 driver. It currently only supports unsecured read-only AFS access.
8
9 See <file:Documentation/filesystems/afs.txt> for more information.
10
11 If unsure, say N.
12
13config AFS_DEBUG
14 bool "AFS dynamic debugging"
15 depends on AFS_FS
16 help
17 Say Y here to make runtime controllable debugging messages appear.
18
19 See <file:Documentation/filesystems/afs.txt> for more information.
20
21 If unsure, say N.
diff --git a/fs/autofs/Kconfig b/fs/autofs/Kconfig
new file mode 100644
index 000000000000..5f3bea90911e
--- /dev/null
+++ b/fs/autofs/Kconfig
@@ -0,0 +1,21 @@
1config AUTOFS_FS
2 tristate "Kernel automounter support"
3 help
4 The automounter is a tool to automatically mount remote file systems
5 on demand. This implementation is partially kernel-based to reduce
6 overhead in the already-mounted case; this is unlike the BSD
7 automounter (amd), which is a pure user space daemon.
8
9 To use the automounter you need the user-space tools from the autofs
10 package; you can find the location in <file:Documentation/Changes>.
11 You also want to answer Y to "NFS file system support", below.
12
13 If you want to use the newer version of the automounter with more
14 features, say N here and say Y to "Kernel automounter v4 support",
15 below.
16
17 To compile this support as a module, choose M here: the module will be
18 called autofs.
19
20 If you are not a part of a fairly large, distributed network, you
21 probably do not need an automounter, and can say N here.
diff --git a/fs/autofs4/Kconfig b/fs/autofs4/Kconfig
new file mode 100644
index 000000000000..1204d6384d39
--- /dev/null
+++ b/fs/autofs4/Kconfig
@@ -0,0 +1,20 @@
1config AUTOFS4_FS
2 tristate "Kernel automounter version 4 support (also supports v3)"
3 help
4 The automounter is a tool to automatically mount remote file systems
5 on demand. This implementation is partially kernel-based to reduce
6 overhead in the already-mounted case; this is unlike the BSD
7 automounter (amd), which is a pure user space daemon.
8
9 To use the automounter you need the user-space tools from
10 <ftp://ftp.kernel.org/pub/linux/daemons/autofs/v4/>; you also
11 want to answer Y to "NFS file system support", below.
12
13 To compile this support as a module, choose M here: the module will be
14 called autofs4. You will need to add "alias autofs autofs4" to your
15 modules configuration file.
16
17 If you are not a part of a fairly large, distributed network or
18 don't have a laptop which needs to dynamically reconfigure to the
19 local network, you probably do not need an automounter, and can say
20 N here.
diff --git a/fs/befs/Kconfig b/fs/befs/Kconfig
new file mode 100644
index 000000000000..7835d30f211f
--- /dev/null
+++ b/fs/befs/Kconfig
@@ -0,0 +1,26 @@
1config BEFS_FS
2 tristate "BeOS file system (BeFS) support (read only) (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 select NLS
5 help
6 The BeOS File System (BeFS) is the native file system of Be, Inc's
7 BeOS. Notable features include support for arbitrary attributes
8 on files and directories, and database-like indices on selected
9 attributes. (Also note that this driver doesn't make those features
10 available at this time). It is a 64 bit filesystem, so it supports
11 extremely large volumes and files.
12
13 If you use this filesystem, you should also say Y to at least one
14 of the NLS (native language support) options below.
15
16 If you don't know what this is about, say N.
17
18 To compile this as a module, choose M here: the module will be
19 called befs.
20
21config BEFS_DEBUG
22 bool "Debug BeFS"
23 depends on BEFS_FS
24 help
25 If you say Y here, you can use the 'debug' mount option to enable
26 debugging output from the driver.
diff --git a/fs/bfs/Kconfig b/fs/bfs/Kconfig
new file mode 100644
index 000000000000..c2336c62024f
--- /dev/null
+++ b/fs/bfs/Kconfig
@@ -0,0 +1,19 @@
1config BFS_FS
2 tristate "BFS file system support (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 help
5 Boot File System (BFS) is a file system used under SCO UnixWare to
6 allow the bootloader access to the kernel image and other important
7 files during the boot process. It is usually mounted under /stand
8 and corresponds to the slice marked as "STAND" in the UnixWare
9 partition. You should say Y if you want to read or write the files
10 on your /stand slice from within Linux. You then also need to say Y
11 to "UnixWare slices support", below. More information about the BFS
12 file system is contained in the file
13 <file:Documentation/filesystems/bfs.txt>.
14
15 If you don't know what this is about, say N.
16
17 To compile this as a module, choose M here: the module will be called
18 bfs. Note that the file system of your root partition (the one
19 containing the directory /) cannot be compiled as a module.
diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
index 77ebc3c263d6..549b0144da11 100644
--- a/fs/bio-integrity.c
+++ b/fs/bio-integrity.c
@@ -140,7 +140,6 @@ int bio_integrity_add_page(struct bio *bio, struct page *page,
140 140
141 iv = bip_vec_idx(bip, bip->bip_vcnt); 141 iv = bip_vec_idx(bip, bip->bip_vcnt);
142 BUG_ON(iv == NULL); 142 BUG_ON(iv == NULL);
143 BUG_ON(iv->bv_page != NULL);
144 143
145 iv->bv_page = page; 144 iv->bv_page = page;
146 iv->bv_len = len; 145 iv->bv_len = len;
@@ -465,7 +464,7 @@ static int bio_integrity_verify(struct bio *bio)
465 464
466 if (ret) { 465 if (ret) {
467 kunmap_atomic(kaddr, KM_USER0); 466 kunmap_atomic(kaddr, KM_USER0);
468 break; 467 return ret;
469 } 468 }
470 469
471 sectors = bv->bv_len / bi->sector_size; 470 sectors = bv->bv_len / bi->sector_size;
@@ -493,18 +492,13 @@ static void bio_integrity_verify_fn(struct work_struct *work)
493 struct bio_integrity_payload *bip = 492 struct bio_integrity_payload *bip =
494 container_of(work, struct bio_integrity_payload, bip_work); 493 container_of(work, struct bio_integrity_payload, bip_work);
495 struct bio *bio = bip->bip_bio; 494 struct bio *bio = bip->bip_bio;
496 int error = bip->bip_error; 495 int error;
497 496
498 if (bio_integrity_verify(bio)) { 497 error = bio_integrity_verify(bio);
499 clear_bit(BIO_UPTODATE, &bio->bi_flags);
500 error = -EIO;
501 }
502 498
503 /* Restore original bio completion handler */ 499 /* Restore original bio completion handler */
504 bio->bi_end_io = bip->bip_end_io; 500 bio->bi_end_io = bip->bip_end_io;
505 501 bio_endio(bio, error);
506 if (bio->bi_end_io)
507 bio->bi_end_io(bio, error);
508} 502}
509 503
510/** 504/**
@@ -525,7 +519,17 @@ void bio_integrity_endio(struct bio *bio, int error)
525 519
526 BUG_ON(bip->bip_bio != bio); 520 BUG_ON(bip->bip_bio != bio);
527 521
528 bip->bip_error = error; 522 /* In case of an I/O error there is no point in verifying the
523 * integrity metadata. Restore original bio end_io handler
524 * and run it.
525 */
526 if (error) {
527 bio->bi_end_io = bip->bip_end_io;
528 bio_endio(bio, error);
529
530 return;
531 }
532
529 INIT_WORK(&bip->bip_work, bio_integrity_verify_fn); 533 INIT_WORK(&bip->bip_work, bio_integrity_verify_fn);
530 queue_work(kintegrityd_wq, &bip->bip_work); 534 queue_work(kintegrityd_wq, &bip->bip_work);
531} 535}
diff --git a/fs/btrfs/Kconfig b/fs/btrfs/Kconfig
new file mode 100644
index 000000000000..f8fcf999ea1b
--- /dev/null
+++ b/fs/btrfs/Kconfig
@@ -0,0 +1,18 @@
1config BTRFS_FS
2 tristate "Btrfs filesystem (EXPERIMENTAL) Unstable disk format"
3 depends on EXPERIMENTAL
4 select LIBCRC32C
5 select ZLIB_INFLATE
6 select ZLIB_DEFLATE
7 help
8 Btrfs is a new filesystem with extents, writable snapshotting,
9 support for multiple devices and many more features.
10
11 Btrfs is highly experimental, and THE DISK FORMAT IS NOT YET
12 FINALIZED. You should say N here unless you are interested in
13 testing Btrfs with non-critical data.
14
15 To compile this file system support as a module, choose M here. The
16 module will be called btrfs.
17
18 If unsure, say N.
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 080703a15f44..73ac7ebd1dfc 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -5,7 +5,9 @@ rather than posix (advisory) byte range locks, even though server would
5support posix byte range locks. Fix query of root inode when prefixpath 5support posix byte range locks. Fix query of root inode when prefixpath
6specified and user does not have access to query information about the 6specified and user does not have access to query information about the
7top of the share. Fix problem in 2.6.28 resolving DFS paths to 7top of the share. Fix problem in 2.6.28 resolving DFS paths to
8Samba servers (worked to Windows). 8Samba servers (worked to Windows). Fix rmdir so that pending search
9(readdir) requests do not get invalid results which include the now
10removed directory.
9 11
10Version 1.55 12Version 1.55
11------------ 13------------
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
index d4839cf0cb2c..7c9809523f42 100644
--- a/fs/cifs/cifsencrypt.c
+++ b/fs/cifs/cifsencrypt.c
@@ -48,11 +48,11 @@ static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu,
48 if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL)) 48 if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL))
49 return -EINVAL; 49 return -EINVAL;
50 50
51 MD5Init(&context); 51 cifs_MD5_init(&context);
52 MD5Update(&context, (char *)&key->data, key->len); 52 cifs_MD5_update(&context, (char *)&key->data, key->len);
53 MD5Update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length); 53 cifs_MD5_update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length);
54 54
55 MD5Final(signature, &context); 55 cifs_MD5_final(signature, &context);
56 return 0; 56 return 0;
57} 57}
58 58
@@ -96,8 +96,8 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
96 if ((iov == NULL) || (signature == NULL) || (key == NULL)) 96 if ((iov == NULL) || (signature == NULL) || (key == NULL))
97 return -EINVAL; 97 return -EINVAL;
98 98
99 MD5Init(&context); 99 cifs_MD5_init(&context);
100 MD5Update(&context, (char *)&key->data, key->len); 100 cifs_MD5_update(&context, (char *)&key->data, key->len);
101 for (i = 0; i < n_vec; i++) { 101 for (i = 0; i < n_vec; i++) {
102 if (iov[i].iov_len == 0) 102 if (iov[i].iov_len == 0)
103 continue; 103 continue;
@@ -110,13 +110,13 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec,
110 if (i == 0) { 110 if (i == 0) {
111 if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ 111 if (iov[0].iov_len <= 8) /* cmd field at offset 9 */
112 break; /* nothing to sign or corrupt header */ 112 break; /* nothing to sign or corrupt header */
113 MD5Update(&context, iov[0].iov_base+4, 113 cifs_MD5_update(&context, iov[0].iov_base+4,
114 iov[0].iov_len-4); 114 iov[0].iov_len-4);
115 } else 115 } else
116 MD5Update(&context, iov[i].iov_base, iov[i].iov_len); 116 cifs_MD5_update(&context, iov[i].iov_base, iov[i].iov_len);
117 } 117 }
118 118
119 MD5Final(signature, &context); 119 cifs_MD5_final(signature, &context);
120 120
121 return 0; 121 return 0;
122} 122}
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 06f6779988bf..382ba6298809 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -35,8 +35,8 @@ extern struct smb_hdr *cifs_buf_get(void);
35extern void cifs_buf_release(void *); 35extern void cifs_buf_release(void *);
36extern struct smb_hdr *cifs_small_buf_get(void); 36extern struct smb_hdr *cifs_small_buf_get(void);
37extern void cifs_small_buf_release(void *); 37extern void cifs_small_buf_release(void *);
38extern int smb_send(struct socket *, struct smb_hdr *, 38extern int smb_send(struct TCP_Server_Info *, struct smb_hdr *,
39 unsigned int /* length */ , struct sockaddr *, bool); 39 unsigned int /* length */);
40extern unsigned int _GetXid(void); 40extern unsigned int _GetXid(void);
41extern void _FreeXid(unsigned int); 41extern void _FreeXid(unsigned int);
42#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid())); 42#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid()));
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e9ea394ee075..2209be943051 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1354,7 +1354,7 @@ cifs_parse_mount_options(char *options, const char *devname,
1354} 1354}
1355 1355
1356static struct TCP_Server_Info * 1356static struct TCP_Server_Info *
1357cifs_find_tcp_session(struct sockaddr *addr) 1357cifs_find_tcp_session(struct sockaddr_storage *addr)
1358{ 1358{
1359 struct list_head *tmp; 1359 struct list_head *tmp;
1360 struct TCP_Server_Info *server; 1360 struct TCP_Server_Info *server;
@@ -1374,11 +1374,11 @@ cifs_find_tcp_session(struct sockaddr *addr)
1374 if (server->tcpStatus == CifsNew) 1374 if (server->tcpStatus == CifsNew)
1375 continue; 1375 continue;
1376 1376
1377 if (addr->sa_family == AF_INET && 1377 if (addr->ss_family == AF_INET &&
1378 (addr4->sin_addr.s_addr != 1378 (addr4->sin_addr.s_addr !=
1379 server->addr.sockAddr.sin_addr.s_addr)) 1379 server->addr.sockAddr.sin_addr.s_addr))
1380 continue; 1380 continue;
1381 else if (addr->sa_family == AF_INET6 && 1381 else if (addr->ss_family == AF_INET6 &&
1382 memcmp(&server->addr.sockAddr6.sin6_addr, 1382 memcmp(&server->addr.sockAddr6.sin6_addr,
1383 &addr6->sin6_addr, sizeof(addr6->sin6_addr))) 1383 &addr6->sin6_addr, sizeof(addr6->sin6_addr)))
1384 continue; 1384 continue;
@@ -1419,12 +1419,12 @@ static struct TCP_Server_Info *
1419cifs_get_tcp_session(struct smb_vol *volume_info) 1419cifs_get_tcp_session(struct smb_vol *volume_info)
1420{ 1420{
1421 struct TCP_Server_Info *tcp_ses = NULL; 1421 struct TCP_Server_Info *tcp_ses = NULL;
1422 struct sockaddr addr; 1422 struct sockaddr_storage addr;
1423 struct sockaddr_in *sin_server = (struct sockaddr_in *) &addr; 1423 struct sockaddr_in *sin_server = (struct sockaddr_in *) &addr;
1424 struct sockaddr_in6 *sin_server6 = (struct sockaddr_in6 *) &addr; 1424 struct sockaddr_in6 *sin_server6 = (struct sockaddr_in6 *) &addr;
1425 int rc; 1425 int rc;
1426 1426
1427 memset(&addr, 0, sizeof(struct sockaddr)); 1427 memset(&addr, 0, sizeof(struct sockaddr_storage));
1428 1428
1429 if (volume_info->UNCip && volume_info->UNC) { 1429 if (volume_info->UNCip && volume_info->UNC) {
1430 rc = cifs_inet_pton(AF_INET, volume_info->UNCip, 1430 rc = cifs_inet_pton(AF_INET, volume_info->UNCip,
@@ -1435,9 +1435,9 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1435 rc = cifs_inet_pton(AF_INET6, volume_info->UNCip, 1435 rc = cifs_inet_pton(AF_INET6, volume_info->UNCip,
1436 &sin_server6->sin6_addr.in6_u); 1436 &sin_server6->sin6_addr.in6_u);
1437 if (rc > 0) 1437 if (rc > 0)
1438 addr.sa_family = AF_INET6; 1438 addr.ss_family = AF_INET6;
1439 } else { 1439 } else {
1440 addr.sa_family = AF_INET; 1440 addr.ss_family = AF_INET;
1441 } 1441 }
1442 1442
1443 if (rc <= 0) { 1443 if (rc <= 0) {
@@ -1502,7 +1502,7 @@ cifs_get_tcp_session(struct smb_vol *volume_info)
1502 tcp_ses->tcpStatus = CifsNew; 1502 tcp_ses->tcpStatus = CifsNew;
1503 ++tcp_ses->srv_count; 1503 ++tcp_ses->srv_count;
1504 1504
1505 if (addr.sa_family == AF_INET6) { 1505 if (addr.ss_family == AF_INET6) {
1506 cFYI(1, ("attempting ipv6 connect")); 1506 cFYI(1, ("attempting ipv6 connect"));
1507 /* BB should we allow ipv6 on port 139? */ 1507 /* BB should we allow ipv6 on port 139? */
1508 /* other OS never observed in Wild doing 139 with v6 */ 1508 /* other OS never observed in Wild doing 139 with v6 */
@@ -1802,7 +1802,7 @@ ipv4_connect(struct TCP_Server_Info *server)
1802 * user space buffer 1802 * user space buffer
1803 */ 1803 */
1804 socket->sk->sk_rcvtimeo = 7 * HZ; 1804 socket->sk->sk_rcvtimeo = 7 * HZ;
1805 socket->sk->sk_sndtimeo = 3 * HZ; 1805 socket->sk->sk_sndtimeo = 5 * HZ;
1806 1806
1807 /* make the bufsizes depend on wsize/rsize and max requests */ 1807 /* make the bufsizes depend on wsize/rsize and max requests */
1808 if (server->noautotune) { 1808 if (server->noautotune) {
@@ -1860,9 +1860,7 @@ ipv4_connect(struct TCP_Server_Info *server)
1860 smb_buf = (struct smb_hdr *)ses_init_buf; 1860 smb_buf = (struct smb_hdr *)ses_init_buf;
1861 /* sizeof RFC1002_SESSION_REQUEST with no scope */ 1861 /* sizeof RFC1002_SESSION_REQUEST with no scope */
1862 smb_buf->smb_buf_length = 0x81000044; 1862 smb_buf->smb_buf_length = 0x81000044;
1863 rc = smb_send(socket, smb_buf, 0x44, 1863 rc = smb_send(server, smb_buf, 0x44);
1864 (struct sockaddr *) &server->addr.sockAddr,
1865 server->noblocksnd);
1866 kfree(ses_init_buf); 1864 kfree(ses_init_buf);
1867 msleep(1); /* RFC1001 layer in at least one server 1865 msleep(1); /* RFC1001 layer in at least one server
1868 requires very short break before negprot 1866 requires very short break before negprot
@@ -1955,7 +1953,7 @@ ipv6_connect(struct TCP_Server_Info *server)
1955 * user space buffer 1953 * user space buffer
1956 */ 1954 */
1957 socket->sk->sk_rcvtimeo = 7 * HZ; 1955 socket->sk->sk_rcvtimeo = 7 * HZ;
1958 socket->sk->sk_sndtimeo = 3 * HZ; 1956 socket->sk->sk_sndtimeo = 5 * HZ;
1959 server->ssocket = socket; 1957 server->ssocket = socket;
1960 1958
1961 return rc; 1959 return rc;
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 838d9c720a5c..964aad03c5ad 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -129,6 +129,17 @@ cifs_bp_rename_retry:
129 return full_path; 129 return full_path;
130} 130}
131 131
132static void setup_cifs_dentry(struct cifsTconInfo *tcon,
133 struct dentry *direntry,
134 struct inode *newinode)
135{
136 if (tcon->nocase)
137 direntry->d_op = &cifs_ci_dentry_ops;
138 else
139 direntry->d_op = &cifs_dentry_ops;
140 d_instantiate(direntry, newinode);
141}
142
132/* Inode operations in similar order to how they appear in Linux file fs.h */ 143/* Inode operations in similar order to how they appear in Linux file fs.h */
133 144
134int 145int
@@ -139,14 +150,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
139 int xid; 150 int xid;
140 int create_options = CREATE_NOT_DIR; 151 int create_options = CREATE_NOT_DIR;
141 int oplock = 0; 152 int oplock = 0;
153 /* BB below access is too much for the mknod to request */
142 int desiredAccess = GENERIC_READ | GENERIC_WRITE; 154 int desiredAccess = GENERIC_READ | GENERIC_WRITE;
143 __u16 fileHandle; 155 __u16 fileHandle;
144 struct cifs_sb_info *cifs_sb; 156 struct cifs_sb_info *cifs_sb;
145 struct cifsTconInfo *pTcon; 157 struct cifsTconInfo *tcon;
146 char *full_path = NULL; 158 char *full_path = NULL;
147 FILE_ALL_INFO *buf = NULL; 159 FILE_ALL_INFO *buf = NULL;
148 struct inode *newinode = NULL; 160 struct inode *newinode = NULL;
149 struct cifsFileInfo *pCifsFile = NULL;
150 struct cifsInodeInfo *pCifsInode; 161 struct cifsInodeInfo *pCifsInode;
151 int disposition = FILE_OVERWRITE_IF; 162 int disposition = FILE_OVERWRITE_IF;
152 bool write_only = false; 163 bool write_only = false;
@@ -154,7 +165,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
154 xid = GetXid(); 165 xid = GetXid();
155 166
156 cifs_sb = CIFS_SB(inode->i_sb); 167 cifs_sb = CIFS_SB(inode->i_sb);
157 pTcon = cifs_sb->tcon; 168 tcon = cifs_sb->tcon;
158 169
159 full_path = build_path_from_dentry(direntry); 170 full_path = build_path_from_dentry(direntry);
160 if (full_path == NULL) { 171 if (full_path == NULL) {
@@ -162,6 +173,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
162 return -ENOMEM; 173 return -ENOMEM;
163 } 174 }
164 175
176 mode &= ~current->fs->umask;
177
165 if (nd && (nd->flags & LOOKUP_OPEN)) { 178 if (nd && (nd->flags & LOOKUP_OPEN)) {
166 int oflags = nd->intent.open.flags; 179 int oflags = nd->intent.open.flags;
167 180
@@ -196,17 +209,15 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
196 return -ENOMEM; 209 return -ENOMEM;
197 } 210 }
198 211
199 mode &= ~current->fs->umask;
200
201 /* 212 /*
202 * if we're not using unix extensions, see if we need to set 213 * if we're not using unix extensions, see if we need to set
203 * ATTR_READONLY on the create call 214 * ATTR_READONLY on the create call
204 */ 215 */
205 if (!pTcon->unix_ext && (mode & S_IWUGO) == 0) 216 if (!tcon->unix_ext && (mode & S_IWUGO) == 0)
206 create_options |= CREATE_OPTION_READONLY; 217 create_options |= CREATE_OPTION_READONLY;
207 218
208 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS) 219 if (cifs_sb->tcon->ses->capabilities & CAP_NT_SMBS)
209 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, 220 rc = CIFSSMBOpen(xid, tcon, full_path, disposition,
210 desiredAccess, create_options, 221 desiredAccess, create_options,
211 &fileHandle, &oplock, buf, cifs_sb->local_nls, 222 &fileHandle, &oplock, buf, cifs_sb->local_nls,
212 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 223 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -215,7 +226,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
215 226
216 if (rc == -EIO) { 227 if (rc == -EIO) {
217 /* old server, retry the open legacy style */ 228 /* old server, retry the open legacy style */
218 rc = SMBLegacyOpen(xid, pTcon, full_path, disposition, 229 rc = SMBLegacyOpen(xid, tcon, full_path, disposition,
219 desiredAccess, create_options, 230 desiredAccess, create_options,
220 &fileHandle, &oplock, buf, cifs_sb->local_nls, 231 &fileHandle, &oplock, buf, cifs_sb->local_nls,
221 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 232 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
@@ -225,7 +236,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
225 } else { 236 } else {
226 /* If Open reported that we actually created a file 237 /* If Open reported that we actually created a file
227 then we now have to set the mode if possible */ 238 then we now have to set the mode if possible */
228 if ((pTcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) { 239 if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
229 struct cifs_unix_set_info_args args = { 240 struct cifs_unix_set_info_args args = {
230 .mode = mode, 241 .mode = mode,
231 .ctime = NO_CHANGE_64, 242 .ctime = NO_CHANGE_64,
@@ -244,20 +255,20 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
244 args.uid = NO_CHANGE_64; 255 args.uid = NO_CHANGE_64;
245 args.gid = NO_CHANGE_64; 256 args.gid = NO_CHANGE_64;
246 } 257 }
247 CIFSSMBUnixSetInfo(xid, pTcon, full_path, &args, 258 CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
248 cifs_sb->local_nls, 259 cifs_sb->local_nls,
249 cifs_sb->mnt_cifs_flags & 260 cifs_sb->mnt_cifs_flags &
250 CIFS_MOUNT_MAP_SPECIAL_CHR); 261 CIFS_MOUNT_MAP_SPECIAL_CHR);
251 } else { 262 } else {
252 /* BB implement mode setting via Windows security 263 /* BB implement mode setting via Windows security
253 descriptors e.g. */ 264 descriptors e.g. */
254 /* CIFSSMBWinSetPerms(xid,pTcon,path,mode,-1,-1,nls);*/ 265 /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
255 266
256 /* Could set r/o dos attribute if mode & 0222 == 0 */ 267 /* Could set r/o dos attribute if mode & 0222 == 0 */
257 } 268 }
258 269
259 /* server might mask mode so we have to query for it */ 270 /* server might mask mode so we have to query for it */
260 if (pTcon->unix_ext) 271 if (tcon->unix_ext)
261 rc = cifs_get_inode_info_unix(&newinode, full_path, 272 rc = cifs_get_inode_info_unix(&newinode, full_path,
262 inode->i_sb, xid); 273 inode->i_sb, xid);
263 else { 274 else {
@@ -283,22 +294,17 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
283 } 294 }
284 295
285 if (rc != 0) { 296 if (rc != 0) {
286 cFYI(1, 297 cFYI(1, ("Create worked, get_inode_info failed rc = %d",
287 ("Create worked but get_inode_info failed rc = %d", 298 rc));
288 rc)); 299 } else
289 } else { 300 setup_cifs_dentry(tcon, direntry, newinode);
290 if (pTcon->nocase) 301
291 direntry->d_op = &cifs_ci_dentry_ops;
292 else
293 direntry->d_op = &cifs_dentry_ops;
294 d_instantiate(direntry, newinode);
295 }
296 if ((nd == NULL /* nfsd case - nfs srv does not set nd */) || 302 if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
297 (!(nd->flags & LOOKUP_OPEN))) { 303 (!(nd->flags & LOOKUP_OPEN))) {
298 /* mknod case - do not leave file open */ 304 /* mknod case - do not leave file open */
299 CIFSSMBClose(xid, pTcon, fileHandle); 305 CIFSSMBClose(xid, tcon, fileHandle);
300 } else if (newinode) { 306 } else if (newinode) {
301 pCifsFile = 307 struct cifsFileInfo *pCifsFile =
302 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); 308 kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
303 309
304 if (pCifsFile == NULL) 310 if (pCifsFile == NULL)
@@ -316,7 +322,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
316 /* set the following in open now 322 /* set the following in open now
317 pCifsFile->pfile = file; */ 323 pCifsFile->pfile = file; */
318 write_lock(&GlobalSMBSeslock); 324 write_lock(&GlobalSMBSeslock);
319 list_add(&pCifsFile->tlist, &pTcon->openFileList); 325 list_add(&pCifsFile->tlist, &tcon->openFileList);
320 pCifsInode = CIFS_I(newinode); 326 pCifsInode = CIFS_I(newinode);
321 if (pCifsInode) { 327 if (pCifsInode) {
322 /* if readable file instance put first in list*/ 328 /* if readable file instance put first in list*/
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 5ab9896fdcb2..bcf7b5184664 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1285,6 +1285,11 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
1285 cifsInode = CIFS_I(direntry->d_inode); 1285 cifsInode = CIFS_I(direntry->d_inode);
1286 cifsInode->time = 0; /* force revalidate to go get info when 1286 cifsInode->time = 0; /* force revalidate to go get info when
1287 needed */ 1287 needed */
1288
1289 cifsInode = CIFS_I(inode);
1290 cifsInode->time = 0; /* force revalidate to get parent dir info
1291 since cached search results now invalid */
1292
1288 direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = 1293 direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime =
1289 current_fs_time(inode->i_sb); 1294 current_fs_time(inode->i_sb);
1290 1295
diff --git a/fs/cifs/md5.c b/fs/cifs/md5.c
index 462bbfefd4b6..98b66a54c319 100644
--- a/fs/cifs/md5.c
+++ b/fs/cifs/md5.c
@@ -10,8 +10,8 @@
10 * with every copy. 10 * with every copy.
11 * 11 *
12 * To compute the message digest of a chunk of bytes, declare an 12 * To compute the message digest of a chunk of bytes, declare an
13 * MD5Context structure, pass it to MD5Init, call MD5Update as 13 * MD5Context structure, pass it to cifs_MD5_init, call cifs_MD5_update as
14 * needed on buffers full of bytes, and then call MD5Final, which 14 * needed on buffers full of bytes, and then call cifs_MD5_final, which
15 * will fill a supplied 16-byte array with the digest. 15 * will fill a supplied 16-byte array with the digest.
16 */ 16 */
17 17
@@ -45,7 +45,7 @@ byteReverse(unsigned char *buf, unsigned longs)
45 * initialization constants. 45 * initialization constants.
46 */ 46 */
47void 47void
48MD5Init(struct MD5Context *ctx) 48cifs_MD5_init(struct MD5Context *ctx)
49{ 49{
50 ctx->buf[0] = 0x67452301; 50 ctx->buf[0] = 0x67452301;
51 ctx->buf[1] = 0xefcdab89; 51 ctx->buf[1] = 0xefcdab89;
@@ -61,7 +61,7 @@ MD5Init(struct MD5Context *ctx)
61 * of bytes. 61 * of bytes.
62 */ 62 */
63void 63void
64MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) 64cifs_MD5_update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
65{ 65{
66 register __u32 t; 66 register __u32 t;
67 67
@@ -110,7 +110,7 @@ MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len)
110 * 1 0* (64-bit count of bits processed, MSB-first) 110 * 1 0* (64-bit count of bits processed, MSB-first)
111 */ 111 */
112void 112void
113MD5Final(unsigned char digest[16], struct MD5Context *ctx) 113cifs_MD5_final(unsigned char digest[16], struct MD5Context *ctx)
114{ 114{
115 unsigned int count; 115 unsigned int count;
116 unsigned char *p; 116 unsigned char *p;
@@ -165,7 +165,7 @@ MD5Final(unsigned char digest[16], struct MD5Context *ctx)
165 165
166/* 166/*
167 * The core of the MD5 algorithm, this alters an existing MD5 hash to 167 * The core of the MD5 algorithm, this alters an existing MD5 hash to
168 * reflect the addition of 16 longwords of new data. MD5Update blocks 168 * reflect the addition of 16 longwords of new data. cifs_MD5_update blocks
169 * the data and converts bytes into longwords for this routine. 169 * the data and converts bytes into longwords for this routine.
170 */ 170 */
171static void 171static void
@@ -267,9 +267,9 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
267 unsigned char tk[16]; 267 unsigned char tk[16];
268 struct MD5Context tctx; 268 struct MD5Context tctx;
269 269
270 MD5Init(&tctx); 270 cifs_MD5_init(&tctx);
271 MD5Update(&tctx, key, key_len); 271 cifs_MD5_update(&tctx, key, key_len);
272 MD5Final(tk, &tctx); 272 cifs_MD5_final(tk, &tctx);
273 273
274 key = tk; 274 key = tk;
275 key_len = 16; 275 key_len = 16;
@@ -287,8 +287,8 @@ hmac_md5_init_rfc2104(unsigned char *key, int key_len,
287 ctx->k_opad[i] ^= 0x5c; 287 ctx->k_opad[i] ^= 0x5c;
288 } 288 }
289 289
290 MD5Init(&ctx->ctx); 290 cifs_MD5_init(&ctx->ctx);
291 MD5Update(&ctx->ctx, ctx->k_ipad, 64); 291 cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64);
292} 292}
293#endif 293#endif
294 294
@@ -317,8 +317,8 @@ hmac_md5_init_limK_to_64(const unsigned char *key, int key_len,
317 ctx->k_opad[i] ^= 0x5c; 317 ctx->k_opad[i] ^= 0x5c;
318 } 318 }
319 319
320 MD5Init(&ctx->ctx); 320 cifs_MD5_init(&ctx->ctx);
321 MD5Update(&ctx->ctx, ctx->k_ipad, 64); 321 cifs_MD5_update(&ctx->ctx, ctx->k_ipad, 64);
322} 322}
323 323
324/*********************************************************************** 324/***********************************************************************
@@ -328,7 +328,7 @@ void
328hmac_md5_update(const unsigned char *text, int text_len, 328hmac_md5_update(const unsigned char *text, int text_len,
329 struct HMACMD5Context *ctx) 329 struct HMACMD5Context *ctx)
330{ 330{
331 MD5Update(&ctx->ctx, text, text_len); /* then text of datagram */ 331 cifs_MD5_update(&ctx->ctx, text, text_len); /* then text of datagram */
332} 332}
333 333
334/*********************************************************************** 334/***********************************************************************
@@ -339,12 +339,12 @@ hmac_md5_final(unsigned char *digest, struct HMACMD5Context *ctx)
339{ 339{
340 struct MD5Context ctx_o; 340 struct MD5Context ctx_o;
341 341
342 MD5Final(digest, &ctx->ctx); 342 cifs_MD5_final(digest, &ctx->ctx);
343 343
344 MD5Init(&ctx_o); 344 cifs_MD5_init(&ctx_o);
345 MD5Update(&ctx_o, ctx->k_opad, 64); 345 cifs_MD5_update(&ctx_o, ctx->k_opad, 64);
346 MD5Update(&ctx_o, digest, 16); 346 cifs_MD5_update(&ctx_o, digest, 16);
347 MD5Final(digest, &ctx_o); 347 cifs_MD5_final(digest, &ctx_o);
348} 348}
349 349
350/*********************************************************** 350/***********************************************************
diff --git a/fs/cifs/md5.h b/fs/cifs/md5.h
index f7d4f4197bac..6fba8cb402fd 100644
--- a/fs/cifs/md5.h
+++ b/fs/cifs/md5.h
@@ -20,10 +20,10 @@ struct HMACMD5Context {
20}; 20};
21#endif /* _HMAC_MD5_H */ 21#endif /* _HMAC_MD5_H */
22 22
23void MD5Init(struct MD5Context *context); 23void cifs_MD5_init(struct MD5Context *context);
24void MD5Update(struct MD5Context *context, unsigned char const *buf, 24void cifs_MD5_update(struct MD5Context *context, unsigned char const *buf,
25 unsigned len); 25 unsigned len);
26void MD5Final(unsigned char digest[16], struct MD5Context *context); 26void cifs_MD5_final(unsigned char digest[16], struct MD5Context *context);
27 27
28/* The following definitions come from lib/hmacmd5.c */ 28/* The following definitions come from lib/hmacmd5.c */
29 29
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 7ebe6599ed3a..0ad3e2d116a6 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -154,81 +154,8 @@ void DeleteTconOplockQEntries(struct cifsTconInfo *tcon)
154 spin_unlock(&GlobalMid_Lock); 154 spin_unlock(&GlobalMid_Lock);
155} 155}
156 156
157int
158smb_send(struct socket *ssocket, struct smb_hdr *smb_buffer,
159 unsigned int smb_buf_length, struct sockaddr *sin, bool noblocksnd)
160{
161 int rc = 0;
162 int i = 0;
163 struct msghdr smb_msg;
164 struct kvec iov;
165 unsigned len = smb_buf_length + 4;
166
167 if (ssocket == NULL)
168 return -ENOTSOCK; /* BB eventually add reconnect code here */
169 iov.iov_base = smb_buffer;
170 iov.iov_len = len;
171
172 smb_msg.msg_name = sin;
173 smb_msg.msg_namelen = sizeof(struct sockaddr);
174 smb_msg.msg_control = NULL;
175 smb_msg.msg_controllen = 0;
176 if (noblocksnd)
177 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
178 else
179 smb_msg.msg_flags = MSG_NOSIGNAL;
180
181 /* smb header is converted in header_assemble. bcc and rest of SMB word
182 area, and byte area if necessary, is converted to littleendian in
183 cifssmb.c and RFC1001 len is converted to bigendian in smb_send
184 Flags2 is converted in SendReceive */
185
186 smb_buffer->smb_buf_length = cpu_to_be32(smb_buffer->smb_buf_length);
187 cFYI(1, ("Sending smb of length %d", smb_buf_length));
188 dump_smb(smb_buffer, len);
189
190 while (len > 0) {
191 rc = kernel_sendmsg(ssocket, &smb_msg, &iov, 1, len);
192 if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
193 i++;
194 /* smaller timeout here than send2 since smaller size */
195 /* Although it may not be required, this also is smaller
196 oplock break time */
197 if (i > 12) {
198 cERROR(1,
199 ("sends on sock %p stuck for 7 seconds",
200 ssocket));
201 rc = -EAGAIN;
202 break;
203 }
204 msleep(1 << i);
205 continue;
206 }
207 if (rc < 0)
208 break;
209 else
210 i = 0; /* reset i after each successful send */
211 iov.iov_base += rc;
212 iov.iov_len -= rc;
213 len -= rc;
214 }
215
216 if (rc < 0) {
217 cERROR(1, ("Error %d sending data on socket to server", rc));
218 } else {
219 rc = 0;
220 }
221
222 /* Don't want to modify the buffer as a
223 side effect of this call. */
224 smb_buffer->smb_buf_length = smb_buf_length;
225
226 return rc;
227}
228
229static int 157static int
230smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec, 158smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
231 struct sockaddr *sin, bool noblocksnd)
232{ 159{
233 int rc = 0; 160 int rc = 0;
234 int i = 0; 161 int i = 0;
@@ -243,11 +170,11 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
243 if (ssocket == NULL) 170 if (ssocket == NULL)
244 return -ENOTSOCK; /* BB eventually add reconnect code here */ 171 return -ENOTSOCK; /* BB eventually add reconnect code here */
245 172
246 smb_msg.msg_name = sin; 173 smb_msg.msg_name = (struct sockaddr *) &server->addr.sockAddr;
247 smb_msg.msg_namelen = sizeof(struct sockaddr); 174 smb_msg.msg_namelen = sizeof(struct sockaddr);
248 smb_msg.msg_control = NULL; 175 smb_msg.msg_control = NULL;
249 smb_msg.msg_controllen = 0; 176 smb_msg.msg_controllen = 0;
250 if (noblocksnd) 177 if (server->noblocksnd)
251 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL; 178 smb_msg.msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
252 else 179 else
253 smb_msg.msg_flags = MSG_NOSIGNAL; 180 smb_msg.msg_flags = MSG_NOSIGNAL;
@@ -272,7 +199,25 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
272 n_vec - first_vec, total_len); 199 n_vec - first_vec, total_len);
273 if ((rc == -ENOSPC) || (rc == -EAGAIN)) { 200 if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
274 i++; 201 i++;
275 if (i >= 14) { 202 /* if blocking send we try 3 times, since each can block
203 for 5 seconds. For nonblocking we have to try more
204 but wait increasing amounts of time allowing time for
205 socket to clear. The overall time we wait in either
206 case to send on the socket is about 15 seconds.
207 Similarly we wait for 15 seconds for
208 a response from the server in SendReceive[2]
209 for the server to send a response back for
210 most types of requests (except SMB Write
211 past end of file which can be slow, and
212 blocking lock operations). NFS waits slightly longer
213 than CIFS, but this can make it take longer for
214 nonresponsive servers to be detected and 15 seconds
215 is more than enough time for modern networks to
216 send a packet. In most cases if we fail to send
217 after the retries we will kill the socket and
218 reconnect which may clear the network problem.
219 */
220 if ((i >= 14) || (!server->noblocksnd && (i > 2))) {
276 cERROR(1, 221 cERROR(1,
277 ("sends on sock %p stuck for 15 seconds", 222 ("sends on sock %p stuck for 15 seconds",
278 ssocket)); 223 ssocket));
@@ -339,6 +284,18 @@ smb_send2(struct TCP_Server_Info *server, struct kvec *iov, int n_vec,
339 return rc; 284 return rc;
340} 285}
341 286
287int
288smb_send(struct TCP_Server_Info *server, struct smb_hdr *smb_buffer,
289 unsigned int smb_buf_length)
290{
291 struct kvec iov;
292
293 iov.iov_base = smb_buffer;
294 iov.iov_len = smb_buf_length + 4;
295
296 return smb_sendv(server, &iov, 1);
297}
298
342static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op) 299static int wait_for_free_request(struct cifsSesInfo *ses, const int long_op)
343{ 300{
344 if (long_op == CIFS_ASYNC_OP) { 301 if (long_op == CIFS_ASYNC_OP) {
@@ -540,9 +497,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses,
540#ifdef CONFIG_CIFS_STATS2 497#ifdef CONFIG_CIFS_STATS2
541 atomic_inc(&ses->server->inSend); 498 atomic_inc(&ses->server->inSend);
542#endif 499#endif
543 rc = smb_send2(ses->server, iov, n_vec, 500 rc = smb_sendv(ses->server, iov, n_vec);
544 (struct sockaddr *) &(ses->server->addr.sockAddr),
545 ses->server->noblocksnd);
546#ifdef CONFIG_CIFS_STATS2 501#ifdef CONFIG_CIFS_STATS2
547 atomic_dec(&ses->server->inSend); 502 atomic_dec(&ses->server->inSend);
548 midQ->when_sent = jiffies; 503 midQ->when_sent = jiffies;
@@ -736,9 +691,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
736#ifdef CONFIG_CIFS_STATS2 691#ifdef CONFIG_CIFS_STATS2
737 atomic_inc(&ses->server->inSend); 692 atomic_inc(&ses->server->inSend);
738#endif 693#endif
739 rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 694 rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
740 (struct sockaddr *) &(ses->server->addr.sockAddr),
741 ses->server->noblocksnd);
742#ifdef CONFIG_CIFS_STATS2 695#ifdef CONFIG_CIFS_STATS2
743 atomic_dec(&ses->server->inSend); 696 atomic_dec(&ses->server->inSend);
744 midQ->when_sent = jiffies; 697 midQ->when_sent = jiffies;
@@ -879,9 +832,7 @@ send_nt_cancel(struct cifsTconInfo *tcon, struct smb_hdr *in_buf,
879 mutex_unlock(&ses->server->srv_mutex); 832 mutex_unlock(&ses->server->srv_mutex);
880 return rc; 833 return rc;
881 } 834 }
882 rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 835 rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
883 (struct sockaddr *) &(ses->server->addr.sockAddr),
884 ses->server->noblocksnd);
885 mutex_unlock(&ses->server->srv_mutex); 836 mutex_unlock(&ses->server->srv_mutex);
886 return rc; 837 return rc;
887} 838}
@@ -973,9 +924,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon,
973#ifdef CONFIG_CIFS_STATS2 924#ifdef CONFIG_CIFS_STATS2
974 atomic_inc(&ses->server->inSend); 925 atomic_inc(&ses->server->inSend);
975#endif 926#endif
976 rc = smb_send(ses->server->ssocket, in_buf, in_buf->smb_buf_length, 927 rc = smb_send(ses->server, in_buf, in_buf->smb_buf_length);
977 (struct sockaddr *) &(ses->server->addr.sockAddr),
978 ses->server->noblocksnd);
979#ifdef CONFIG_CIFS_STATS2 928#ifdef CONFIG_CIFS_STATS2
980 atomic_dec(&ses->server->inSend); 929 atomic_dec(&ses->server->inSend);
981 midQ->when_sent = jiffies; 930 midQ->when_sent = jiffies;
diff --git a/fs/coda/Kconfig b/fs/coda/Kconfig
new file mode 100644
index 000000000000..c0e5a7fad06d
--- /dev/null
+++ b/fs/coda/Kconfig
@@ -0,0 +1,21 @@
1config CODA_FS
2 tristate "Coda file system support (advanced network fs)"
3 depends on INET
4 help
5 Coda is an advanced network file system, similar to NFS in that it
6 enables you to mount file systems of a remote server and access them
7 with regular Unix commands as if they were sitting on your hard
8 disk. Coda has several advantages over NFS: support for
9 disconnected operation (e.g. for laptops), read/write server
10 replication, security model for authentication and encryption,
11 persistent client caches and write back caching.
12
13 If you say Y here, your Linux box will be able to act as a Coda
14 *client*. You will need user level code as well, both for the
15 client and server. Servers are currently user level, i.e. they need
16 no kernel support. Please read
17 <file:Documentation/filesystems/coda.txt> and check out the Coda
18 home page <http://www.coda.cs.cmu.edu/>.
19
20 To compile the coda client support as a module, choose M here: the
21 module will be called coda.
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index 5235c67e7594..c8f8d5904f5e 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -538,6 +538,7 @@ static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
538 * cannot be fixed without breaking all existing apps. 538 * cannot be fixed without breaking all existing apps.
539 */ 539 */
540 case TUNSETIFF: 540 case TUNSETIFF:
541 case TUNGETIFF:
541 case SIOCGIFFLAGS: 542 case SIOCGIFFLAGS:
542 case SIOCGIFMETRIC: 543 case SIOCGIFMETRIC:
543 case SIOCGIFMTU: 544 case SIOCGIFMTU:
@@ -1982,6 +1983,11 @@ COMPATIBLE_IOCTL(TUNSETNOCSUM)
1982COMPATIBLE_IOCTL(TUNSETDEBUG) 1983COMPATIBLE_IOCTL(TUNSETDEBUG)
1983COMPATIBLE_IOCTL(TUNSETPERSIST) 1984COMPATIBLE_IOCTL(TUNSETPERSIST)
1984COMPATIBLE_IOCTL(TUNSETOWNER) 1985COMPATIBLE_IOCTL(TUNSETOWNER)
1986COMPATIBLE_IOCTL(TUNSETLINK)
1987COMPATIBLE_IOCTL(TUNSETGROUP)
1988COMPATIBLE_IOCTL(TUNGETFEATURES)
1989COMPATIBLE_IOCTL(TUNSETOFFLOAD)
1990COMPATIBLE_IOCTL(TUNSETTXFILTER)
1985/* Big V */ 1991/* Big V */
1986COMPATIBLE_IOCTL(VT_SETMODE) 1992COMPATIBLE_IOCTL(VT_SETMODE)
1987COMPATIBLE_IOCTL(VT_GETMODE) 1993COMPATIBLE_IOCTL(VT_GETMODE)
@@ -2573,6 +2579,7 @@ HANDLE_IOCTL(SIOCGIFPFLAGS, dev_ifsioc)
2573HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc) 2579HANDLE_IOCTL(SIOCGIFTXQLEN, dev_ifsioc)
2574HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc) 2580HANDLE_IOCTL(SIOCSIFTXQLEN, dev_ifsioc)
2575HANDLE_IOCTL(TUNSETIFF, dev_ifsioc) 2581HANDLE_IOCTL(TUNSETIFF, dev_ifsioc)
2582HANDLE_IOCTL(TUNGETIFF, dev_ifsioc)
2576HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl) 2583HANDLE_IOCTL(SIOCETHTOOL, ethtool_ioctl)
2577HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl) 2584HANDLE_IOCTL(SIOCBONDENSLAVE, bond_ioctl)
2578HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl) 2585HANDLE_IOCTL(SIOCBONDRELEASE, bond_ioctl)
diff --git a/fs/configfs/Kconfig b/fs/configfs/Kconfig
new file mode 100644
index 000000000000..13587cc97a0b
--- /dev/null
+++ b/fs/configfs/Kconfig
@@ -0,0 +1,11 @@
1config CONFIGFS_FS
2 tristate "Userspace-driven configuration filesystem"
3 depends on SYSFS
4 help
5 configfs is a ram-based filesystem that provides the converse
6 of sysfs's functionality. Where sysfs is a filesystem-based
7 view of kernel objects, configfs is a filesystem-based manager
8 of kernel objects, or config_items.
9
10 Both sysfs and configfs can and should exist together on the
11 same system. One is not a replacement for the other.
diff --git a/fs/cramfs/Kconfig b/fs/cramfs/Kconfig
new file mode 100644
index 000000000000..cd06466f365e
--- /dev/null
+++ b/fs/cramfs/Kconfig
@@ -0,0 +1,19 @@
1config CRAMFS
2 tristate "Compressed ROM file system support (cramfs)"
3 depends on BLOCK
4 select ZLIB_INFLATE
5 help
6 Saying Y here includes support for CramFs (Compressed ROM File
7 System). CramFs is designed to be a simple, small, and compressed
8 file system for ROM based embedded systems. CramFs is read-only,
9 limited to 256MB file systems (with 16MB files), and doesn't support
10 16/32 bits uid/gid, hard links and timestamps.
11
12 See <file:Documentation/filesystems/cramfs.txt> and
13 <file:fs/cramfs/README> for further information.
14
15 To compile this as a module, choose M here: the module will be called
16 cramfs. Note that the root file system (the one containing the
17 directory /) cannot be compiled as a module.
18
19 If unsure, say N.
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
index eba87ff3177b..894a32d438d5 100644
--- a/fs/dlm/plock.c
+++ b/fs/dlm/plock.c
@@ -168,7 +168,7 @@ static int dlm_plock_callback(struct plock_op *op)
168 notify = xop->callback; 168 notify = xop->callback;
169 169
170 if (op->info.rv) { 170 if (op->info.rv) {
171 notify(flc, NULL, op->info.rv); 171 notify(fl, NULL, op->info.rv);
172 goto out; 172 goto out;
173 } 173 }
174 174
@@ -187,7 +187,7 @@ static int dlm_plock_callback(struct plock_op *op)
187 (unsigned long long)op->info.number, file, fl); 187 (unsigned long long)op->info.number, file, fl);
188 } 188 }
189 189
190 rv = notify(flc, NULL, 0); 190 rv = notify(fl, NULL, 0);
191 if (rv) { 191 if (rv) {
192 /* XXX: We need to cancel the fs lock here: */ 192 /* XXX: We need to cancel the fs lock here: */
193 log_print("dlm_plock_callback: lock granted after lock request " 193 log_print("dlm_plock_callback: lock granted after lock request "
@@ -304,7 +304,9 @@ int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file,
304 if (rv == -ENOENT) 304 if (rv == -ENOENT)
305 rv = 0; 305 rv = 0;
306 else if (rv > 0) { 306 else if (rv > 0) {
307 locks_init_lock(fl);
307 fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK; 308 fl->fl_type = (op->info.ex) ? F_WRLCK : F_RDLCK;
309 fl->fl_flags = FL_POSIX;
308 fl->fl_pid = op->info.pid; 310 fl->fl_pid = op->info.pid;
309 fl->fl_start = op->info.start; 311 fl->fl_start = op->info.start;
310 fl->fl_end = op->info.end; 312 fl->fl_end = op->info.end;
diff --git a/fs/dquot.c b/fs/dquot.c
index 48c0571f831d..bca3cac4bee7 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -87,14 +87,17 @@
87#define __DQUOT_PARANOIA 87#define __DQUOT_PARANOIA
88 88
89/* 89/*
90 * There are two quota SMP locks. dq_list_lock protects all lists with quotas 90 * There are three quota SMP locks. dq_list_lock protects all lists with quotas
91 * and quota formats and also dqstats structure containing statistics about the 91 * and quota formats, dqstats structure containing statistics about the lists
92 * lists. dq_data_lock protects data from dq_dqb and also mem_dqinfo structures 92 * dq_data_lock protects data from dq_dqb and also mem_dqinfo structures and
93 * and also guards consistency of dquot->dq_dqb with inode->i_blocks, i_bytes. 93 * also guards consistency of dquot->dq_dqb with inode->i_blocks, i_bytes.
94 * i_blocks and i_bytes updates itself are guarded by i_lock acquired directly 94 * i_blocks and i_bytes updates itself are guarded by i_lock acquired directly
95 * in inode_add_bytes() and inode_sub_bytes(). 95 * in inode_add_bytes() and inode_sub_bytes(). dq_state_lock protects
96 * modifications of quota state (on quotaon and quotaoff) and readers who care
97 * about latest values take it as well.
96 * 98 *
97 * The spinlock ordering is hence: dq_data_lock > dq_list_lock > i_lock 99 * The spinlock ordering is hence: dq_data_lock > dq_list_lock > i_lock,
100 * dq_list_lock > dq_state_lock
98 * 101 *
99 * Note that some things (eg. sb pointer, type, id) doesn't change during 102 * Note that some things (eg. sb pointer, type, id) doesn't change during
100 * the life of the dquot structure and so needn't to be protected by a lock 103 * the life of the dquot structure and so needn't to be protected by a lock
@@ -103,12 +106,7 @@
103 * operation is just reading pointers from inode (or not using them at all) the 106 * operation is just reading pointers from inode (or not using them at all) the
104 * read lock is enough. If pointers are altered function must hold write lock 107 * read lock is enough. If pointers are altered function must hold write lock
105 * (these locking rules also apply for S_NOQUOTA flag in the inode - note that 108 * (these locking rules also apply for S_NOQUOTA flag in the inode - note that
106 * for altering the flag i_mutex is also needed). If operation is holding 109 * for altering the flag i_mutex is also needed).
107 * reference to dquot in other way (e.g. quotactl ops) it must be guarded by
108 * dqonoff_mutex.
109 * This locking assures that:
110 * a) update/access to dquot pointers in inode is serialized
111 * b) everyone is guarded against invalidate_dquots()
112 * 110 *
113 * Each dquot has its dq_lock mutex. Locked dquots might not be referenced 111 * Each dquot has its dq_lock mutex. Locked dquots might not be referenced
114 * from inodes (dquot_alloc_space() and such don't check the dq_lock). 112 * from inodes (dquot_alloc_space() and such don't check the dq_lock).
@@ -122,10 +120,17 @@
122 * Lock ordering (including related VFS locks) is the following: 120 * Lock ordering (including related VFS locks) is the following:
123 * i_mutex > dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_lock > 121 * i_mutex > dqonoff_sem > journal_lock > dqptr_sem > dquot->dq_lock >
124 * dqio_mutex 122 * dqio_mutex
123 * The lock ordering of dqptr_sem imposed by quota code is only dqonoff_sem >
124 * dqptr_sem. But filesystem has to count with the fact that functions such as
125 * dquot_alloc_space() acquire dqptr_sem and they usually have to be called
126 * from inside a transaction to keep filesystem consistency after a crash. Also
127 * filesystems usually want to do some IO on dquot from ->mark_dirty which is
128 * called with dqptr_sem held.
125 * i_mutex on quota files is special (it's below dqio_mutex) 129 * i_mutex on quota files is special (it's below dqio_mutex)
126 */ 130 */
127 131
128static DEFINE_SPINLOCK(dq_list_lock); 132static DEFINE_SPINLOCK(dq_list_lock);
133static DEFINE_SPINLOCK(dq_state_lock);
129DEFINE_SPINLOCK(dq_data_lock); 134DEFINE_SPINLOCK(dq_data_lock);
130 135
131static char *quotatypes[] = INITQFNAMES; 136static char *quotatypes[] = INITQFNAMES;
@@ -428,7 +433,7 @@ static inline void do_destroy_dquot(struct dquot *dquot)
428 * quota is disabled and pointers from inodes removed so there cannot be new 433 * quota is disabled and pointers from inodes removed so there cannot be new
429 * quota users. There can still be some users of quotas due to inodes being 434 * quota users. There can still be some users of quotas due to inodes being
430 * just deleted or pruned by prune_icache() (those are not attached to any 435 * just deleted or pruned by prune_icache() (those are not attached to any
431 * list). We have to wait for such users. 436 * list) or parallel quotactl call. We have to wait for such users.
432 */ 437 */
433static void invalidate_dquots(struct super_block *sb, int type) 438static void invalidate_dquots(struct super_block *sb, int type)
434{ 439{
@@ -600,7 +605,6 @@ static struct shrinker dqcache_shrinker = {
600/* 605/*
601 * Put reference to dquot 606 * Put reference to dquot
602 * NOTE: If you change this function please check whether dqput_blocks() works right... 607 * NOTE: If you change this function please check whether dqput_blocks() works right...
603 * MUST be called with either dqptr_sem or dqonoff_mutex held
604 */ 608 */
605void dqput(struct dquot *dquot) 609void dqput(struct dquot *dquot)
606{ 610{
@@ -697,36 +701,30 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
697} 701}
698 702
699/* 703/*
700 * Check whether dquot is in memory.
701 * MUST be called with either dqptr_sem or dqonoff_mutex held
702 */
703int dquot_is_cached(struct super_block *sb, unsigned int id, int type)
704{
705 unsigned int hashent = hashfn(sb, id, type);
706 int ret = 0;
707
708 if (!sb_has_quota_active(sb, type))
709 return 0;
710 spin_lock(&dq_list_lock);
711 if (find_dquot(hashent, sb, id, type) != NODQUOT)
712 ret = 1;
713 spin_unlock(&dq_list_lock);
714 return ret;
715}
716
717/*
718 * Get reference to dquot 704 * Get reference to dquot
719 * MUST be called with either dqptr_sem or dqonoff_mutex held 705 *
706 * Locking is slightly tricky here. We are guarded from parallel quotaoff()
707 * destroying our dquot by:
708 * a) checking for quota flags under dq_list_lock and
709 * b) getting a reference to dquot before we release dq_list_lock
720 */ 710 */
721struct dquot *dqget(struct super_block *sb, unsigned int id, int type) 711struct dquot *dqget(struct super_block *sb, unsigned int id, int type)
722{ 712{
723 unsigned int hashent = hashfn(sb, id, type); 713 unsigned int hashent = hashfn(sb, id, type);
724 struct dquot *dquot, *empty = NODQUOT; 714 struct dquot *dquot = NODQUOT, *empty = NODQUOT;
725 715
726 if (!sb_has_quota_active(sb, type)) 716 if (!sb_has_quota_active(sb, type))
727 return NODQUOT; 717 return NODQUOT;
728we_slept: 718we_slept:
729 spin_lock(&dq_list_lock); 719 spin_lock(&dq_list_lock);
720 spin_lock(&dq_state_lock);
721 if (!sb_has_quota_active(sb, type)) {
722 spin_unlock(&dq_state_lock);
723 spin_unlock(&dq_list_lock);
724 goto out;
725 }
726 spin_unlock(&dq_state_lock);
727
730 if ((dquot = find_dquot(hashent, sb, id, type)) == NODQUOT) { 728 if ((dquot = find_dquot(hashent, sb, id, type)) == NODQUOT) {
731 if (empty == NODQUOT) { 729 if (empty == NODQUOT) {
732 spin_unlock(&dq_list_lock); 730 spin_unlock(&dq_list_lock);
@@ -735,6 +733,7 @@ we_slept:
735 goto we_slept; 733 goto we_slept;
736 } 734 }
737 dquot = empty; 735 dquot = empty;
736 empty = NODQUOT;
738 dquot->dq_id = id; 737 dquot->dq_id = id;
739 /* all dquots go on the inuse_list */ 738 /* all dquots go on the inuse_list */
740 put_inuse(dquot); 739 put_inuse(dquot);
@@ -749,8 +748,6 @@ we_slept:
749 dqstats.cache_hits++; 748 dqstats.cache_hits++;
750 dqstats.lookups++; 749 dqstats.lookups++;
751 spin_unlock(&dq_list_lock); 750 spin_unlock(&dq_list_lock);
752 if (empty)
753 do_destroy_dquot(empty);
754 } 751 }
755 /* Wait for dq_lock - after this we know that either dquot_release() is already 752 /* Wait for dq_lock - after this we know that either dquot_release() is already
756 * finished or it will be canceled due to dq_count > 1 test */ 753 * finished or it will be canceled due to dq_count > 1 test */
@@ -758,11 +755,15 @@ we_slept:
758 /* Read the dquot and instantiate it (everything done only if needed) */ 755 /* Read the dquot and instantiate it (everything done only if needed) */
759 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && sb->dq_op->acquire_dquot(dquot) < 0) { 756 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && sb->dq_op->acquire_dquot(dquot) < 0) {
760 dqput(dquot); 757 dqput(dquot);
761 return NODQUOT; 758 dquot = NODQUOT;
759 goto out;
762 } 760 }
763#ifdef __DQUOT_PARANOIA 761#ifdef __DQUOT_PARANOIA
764 BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */ 762 BUG_ON(!dquot->dq_sb); /* Has somebody invalidated entry under us? */
765#endif 763#endif
764out:
765 if (empty)
766 do_destroy_dquot(empty);
766 767
767 return dquot; 768 return dquot;
768} 769}
@@ -1198,63 +1199,76 @@ static int info_bdq_free(struct dquot *dquot, qsize_t space)
1198} 1199}
1199/* 1200/*
1200 * Initialize quota pointers in inode 1201 * Initialize quota pointers in inode
1201 * Transaction must be started at entry 1202 * We do things in a bit complicated way but by that we avoid calling
1203 * dqget() and thus filesystem callbacks under dqptr_sem.
1202 */ 1204 */
1203int dquot_initialize(struct inode *inode, int type) 1205int dquot_initialize(struct inode *inode, int type)
1204{ 1206{
1205 unsigned int id = 0; 1207 unsigned int id = 0;
1206 int cnt, ret = 0; 1208 int cnt, ret = 0;
1209 struct dquot *got[MAXQUOTAS] = { NODQUOT, NODQUOT };
1210 struct super_block *sb = inode->i_sb;
1207 1211
1208 /* First test before acquiring mutex - solves deadlocks when we 1212 /* First test before acquiring mutex - solves deadlocks when we
1209 * re-enter the quota code and are already holding the mutex */ 1213 * re-enter the quota code and are already holding the mutex */
1210 if (IS_NOQUOTA(inode)) 1214 if (IS_NOQUOTA(inode))
1211 return 0; 1215 return 0;
1212 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1216
1217 /* First get references to structures we might need. */
1218 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1219 if (type != -1 && cnt != type)
1220 continue;
1221 switch (cnt) {
1222 case USRQUOTA:
1223 id = inode->i_uid;
1224 break;
1225 case GRPQUOTA:
1226 id = inode->i_gid;
1227 break;
1228 }
1229 got[cnt] = dqget(sb, id, cnt);
1230 }
1231
1232 down_write(&sb_dqopt(sb)->dqptr_sem);
1213 /* Having dqptr_sem we know NOQUOTA flags can't be altered... */ 1233 /* Having dqptr_sem we know NOQUOTA flags can't be altered... */
1214 if (IS_NOQUOTA(inode)) 1234 if (IS_NOQUOTA(inode))
1215 goto out_err; 1235 goto out_err;
1216 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1236 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1217 if (type != -1 && cnt != type) 1237 if (type != -1 && cnt != type)
1218 continue; 1238 continue;
1239 /* Avoid races with quotaoff() */
1240 if (!sb_has_quota_active(sb, cnt))
1241 continue;
1219 if (inode->i_dquot[cnt] == NODQUOT) { 1242 if (inode->i_dquot[cnt] == NODQUOT) {
1220 switch (cnt) { 1243 inode->i_dquot[cnt] = got[cnt];
1221 case USRQUOTA: 1244 got[cnt] = NODQUOT;
1222 id = inode->i_uid;
1223 break;
1224 case GRPQUOTA:
1225 id = inode->i_gid;
1226 break;
1227 }
1228 inode->i_dquot[cnt] = dqget(inode->i_sb, id, cnt);
1229 } 1245 }
1230 } 1246 }
1231out_err: 1247out_err:
1232 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1248 up_write(&sb_dqopt(sb)->dqptr_sem);
1249 /* Drop unused references */
1250 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1251 dqput(got[cnt]);
1233 return ret; 1252 return ret;
1234} 1253}
1235 1254
1236/* 1255/*
1237 * Release all quotas referenced by inode 1256 * Release all quotas referenced by inode
1238 * Transaction must be started at an entry
1239 */ 1257 */
1240int dquot_drop_locked(struct inode *inode) 1258int dquot_drop(struct inode *inode)
1241{ 1259{
1242 int cnt; 1260 int cnt;
1261 struct dquot *put[MAXQUOTAS];
1243 1262
1263 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1244 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1264 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1245 if (inode->i_dquot[cnt] != NODQUOT) { 1265 put[cnt] = inode->i_dquot[cnt];
1246 dqput(inode->i_dquot[cnt]); 1266 inode->i_dquot[cnt] = NODQUOT;
1247 inode->i_dquot[cnt] = NODQUOT;
1248 }
1249 } 1267 }
1250 return 0;
1251}
1252
1253int dquot_drop(struct inode *inode)
1254{
1255 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1256 dquot_drop_locked(inode);
1257 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1268 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1269
1270 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1271 dqput(put[cnt]);
1258 return 0; 1272 return 0;
1259} 1273}
1260 1274
@@ -1470,8 +1484,9 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1470 qsize_t space; 1484 qsize_t space;
1471 struct dquot *transfer_from[MAXQUOTAS]; 1485 struct dquot *transfer_from[MAXQUOTAS];
1472 struct dquot *transfer_to[MAXQUOTAS]; 1486 struct dquot *transfer_to[MAXQUOTAS];
1473 int cnt, ret = NO_QUOTA, chuid = (iattr->ia_valid & ATTR_UID) && inode->i_uid != iattr->ia_uid, 1487 int cnt, ret = QUOTA_OK;
1474 chgid = (iattr->ia_valid & ATTR_GID) && inode->i_gid != iattr->ia_gid; 1488 int chuid = iattr->ia_valid & ATTR_UID && inode->i_uid != iattr->ia_uid,
1489 chgid = iattr->ia_valid & ATTR_GID && inode->i_gid != iattr->ia_gid;
1475 char warntype_to[MAXQUOTAS]; 1490 char warntype_to[MAXQUOTAS];
1476 char warntype_from_inodes[MAXQUOTAS], warntype_from_space[MAXQUOTAS]; 1491 char warntype_from_inodes[MAXQUOTAS], warntype_from_space[MAXQUOTAS];
1477 1492
@@ -1479,21 +1494,11 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1479 * re-enter the quota code and are already holding the mutex */ 1494 * re-enter the quota code and are already holding the mutex */
1480 if (IS_NOQUOTA(inode)) 1495 if (IS_NOQUOTA(inode))
1481 return QUOTA_OK; 1496 return QUOTA_OK;
1482 /* Clear the arrays */ 1497 /* Initialize the arrays */
1483 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1498 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1484 transfer_to[cnt] = transfer_from[cnt] = NODQUOT; 1499 transfer_from[cnt] = NODQUOT;
1500 transfer_to[cnt] = NODQUOT;
1485 warntype_to[cnt] = QUOTA_NL_NOWARN; 1501 warntype_to[cnt] = QUOTA_NL_NOWARN;
1486 }
1487 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1488 /* Now recheck reliably when holding dqptr_sem */
1489 if (IS_NOQUOTA(inode)) { /* File without quota accounting? */
1490 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1491 return QUOTA_OK;
1492 }
1493 /* First build the transfer_to list - here we can block on
1494 * reading/instantiating of dquots. We know that the transaction for
1495 * us was already started so we don't violate lock ranking here */
1496 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1497 switch (cnt) { 1502 switch (cnt) {
1498 case USRQUOTA: 1503 case USRQUOTA:
1499 if (!chuid) 1504 if (!chuid)
@@ -1507,6 +1512,13 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1507 break; 1512 break;
1508 } 1513 }
1509 } 1514 }
1515
1516 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1517 /* Now recheck reliably when holding dqptr_sem */
1518 if (IS_NOQUOTA(inode)) { /* File without quota accounting? */
1519 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1520 goto put_all;
1521 }
1510 spin_lock(&dq_data_lock); 1522 spin_lock(&dq_data_lock);
1511 space = inode_get_bytes(inode); 1523 space = inode_get_bytes(inode);
1512 /* Build the transfer_from list and check the limits */ 1524 /* Build the transfer_from list and check the limits */
@@ -1517,7 +1529,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1517 if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) == 1529 if (check_idq(transfer_to[cnt], 1, warntype_to + cnt) ==
1518 NO_QUOTA || check_bdq(transfer_to[cnt], space, 0, 1530 NO_QUOTA || check_bdq(transfer_to[cnt], space, 0,
1519 warntype_to + cnt) == NO_QUOTA) 1531 warntype_to + cnt) == NO_QUOTA)
1520 goto warn_put_all; 1532 goto over_quota;
1521 } 1533 }
1522 1534
1523 /* 1535 /*
@@ -1545,28 +1557,37 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
1545 1557
1546 inode->i_dquot[cnt] = transfer_to[cnt]; 1558 inode->i_dquot[cnt] = transfer_to[cnt];
1547 } 1559 }
1548 ret = QUOTA_OK;
1549warn_put_all:
1550 spin_unlock(&dq_data_lock); 1560 spin_unlock(&dq_data_lock);
1561 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1562
1551 /* Dirtify all the dquots - this can block when journalling */ 1563 /* Dirtify all the dquots - this can block when journalling */
1552 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1564 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1553 if (transfer_from[cnt]) 1565 if (transfer_from[cnt])
1554 mark_dquot_dirty(transfer_from[cnt]); 1566 mark_dquot_dirty(transfer_from[cnt]);
1555 if (transfer_to[cnt]) 1567 if (transfer_to[cnt]) {
1556 mark_dquot_dirty(transfer_to[cnt]); 1568 mark_dquot_dirty(transfer_to[cnt]);
1569 /* The reference we got is transferred to the inode */
1570 transfer_to[cnt] = NODQUOT;
1571 }
1557 } 1572 }
1573warn_put_all:
1558 flush_warnings(transfer_to, warntype_to); 1574 flush_warnings(transfer_to, warntype_to);
1559 flush_warnings(transfer_from, warntype_from_inodes); 1575 flush_warnings(transfer_from, warntype_from_inodes);
1560 flush_warnings(transfer_from, warntype_from_space); 1576 flush_warnings(transfer_from, warntype_from_space);
1561 1577put_all:
1562 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1578 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1563 if (ret == QUOTA_OK && transfer_from[cnt] != NODQUOT) 1579 dqput(transfer_from[cnt]);
1564 dqput(transfer_from[cnt]); 1580 dqput(transfer_to[cnt]);
1565 if (ret == NO_QUOTA && transfer_to[cnt] != NODQUOT)
1566 dqput(transfer_to[cnt]);
1567 } 1581 }
1568 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1569 return ret; 1582 return ret;
1583over_quota:
1584 spin_unlock(&dq_data_lock);
1585 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1586 /* Clear dquot pointers we don't want to dqput() */
1587 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1588 transfer_from[cnt] = NODQUOT;
1589 ret = NO_QUOTA;
1590 goto warn_put_all;
1570} 1591}
1571 1592
1572/* Wrapper for transferring ownership of an inode */ 1593/* Wrapper for transferring ownership of an inode */
@@ -1651,19 +1672,24 @@ int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)
1651 continue; 1672 continue;
1652 1673
1653 if (flags & DQUOT_SUSPENDED) { 1674 if (flags & DQUOT_SUSPENDED) {
1675 spin_lock(&dq_state_lock);
1654 dqopt->flags |= 1676 dqopt->flags |=
1655 dquot_state_flag(DQUOT_SUSPENDED, cnt); 1677 dquot_state_flag(DQUOT_SUSPENDED, cnt);
1678 spin_unlock(&dq_state_lock);
1656 } else { 1679 } else {
1680 spin_lock(&dq_state_lock);
1657 dqopt->flags &= ~dquot_state_flag(flags, cnt); 1681 dqopt->flags &= ~dquot_state_flag(flags, cnt);
1658 /* Turning off suspended quotas? */ 1682 /* Turning off suspended quotas? */
1659 if (!sb_has_quota_loaded(sb, cnt) && 1683 if (!sb_has_quota_loaded(sb, cnt) &&
1660 sb_has_quota_suspended(sb, cnt)) { 1684 sb_has_quota_suspended(sb, cnt)) {
1661 dqopt->flags &= ~dquot_state_flag( 1685 dqopt->flags &= ~dquot_state_flag(
1662 DQUOT_SUSPENDED, cnt); 1686 DQUOT_SUSPENDED, cnt);
1687 spin_unlock(&dq_state_lock);
1663 iput(dqopt->files[cnt]); 1688 iput(dqopt->files[cnt]);
1664 dqopt->files[cnt] = NULL; 1689 dqopt->files[cnt] = NULL;
1665 continue; 1690 continue;
1666 } 1691 }
1692 spin_unlock(&dq_state_lock);
1667 } 1693 }
1668 1694
1669 /* We still have to keep quota loaded? */ 1695 /* We still have to keep quota loaded? */
@@ -1830,7 +1856,9 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
1830 } 1856 }
1831 mutex_unlock(&dqopt->dqio_mutex); 1857 mutex_unlock(&dqopt->dqio_mutex);
1832 mutex_unlock(&inode->i_mutex); 1858 mutex_unlock(&inode->i_mutex);
1859 spin_lock(&dq_state_lock);
1833 dqopt->flags |= dquot_state_flag(flags, type); 1860 dqopt->flags |= dquot_state_flag(flags, type);
1861 spin_unlock(&dq_state_lock);
1834 1862
1835 add_dquot_ref(sb, type); 1863 add_dquot_ref(sb, type);
1836 mutex_unlock(&dqopt->dqonoff_mutex); 1864 mutex_unlock(&dqopt->dqonoff_mutex);
@@ -1872,9 +1900,11 @@ static int vfs_quota_on_remount(struct super_block *sb, int type)
1872 } 1900 }
1873 inode = dqopt->files[type]; 1901 inode = dqopt->files[type];
1874 dqopt->files[type] = NULL; 1902 dqopt->files[type] = NULL;
1903 spin_lock(&dq_state_lock);
1875 flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED | 1904 flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
1876 DQUOT_LIMITS_ENABLED, type); 1905 DQUOT_LIMITS_ENABLED, type);
1877 dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type); 1906 dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type);
1907 spin_unlock(&dq_state_lock);
1878 mutex_unlock(&dqopt->dqonoff_mutex); 1908 mutex_unlock(&dqopt->dqonoff_mutex);
1879 1909
1880 flags = dquot_generic_flag(flags, type); 1910 flags = dquot_generic_flag(flags, type);
@@ -1952,7 +1982,9 @@ int vfs_quota_enable(struct inode *inode, int type, int format_id,
1952 ret = -EBUSY; 1982 ret = -EBUSY;
1953 goto out_lock; 1983 goto out_lock;
1954 } 1984 }
1985 spin_lock(&dq_state_lock);
1955 sb_dqopt(sb)->flags |= dquot_state_flag(flags, type); 1986 sb_dqopt(sb)->flags |= dquot_state_flag(flags, type);
1987 spin_unlock(&dq_state_lock);
1956out_lock: 1988out_lock:
1957 mutex_unlock(&dqopt->dqonoff_mutex); 1989 mutex_unlock(&dqopt->dqonoff_mutex);
1958 return ret; 1990 return ret;
@@ -2039,14 +2071,12 @@ int vfs_get_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *d
2039{ 2071{
2040 struct dquot *dquot; 2072 struct dquot *dquot;
2041 2073
2042 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); 2074 dquot = dqget(sb, id, type);
2043 if (!(dquot = dqget(sb, id, type))) { 2075 if (dquot == NODQUOT)
2044 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
2045 return -ESRCH; 2076 return -ESRCH;
2046 }
2047 do_get_dqblk(dquot, di); 2077 do_get_dqblk(dquot, di);
2048 dqput(dquot); 2078 dqput(dquot);
2049 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2079
2050 return 0; 2080 return 0;
2051} 2081}
2052 2082
@@ -2130,7 +2160,6 @@ int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *d
2130 struct dquot *dquot; 2160 struct dquot *dquot;
2131 int rc; 2161 int rc;
2132 2162
2133 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
2134 dquot = dqget(sb, id, type); 2163 dquot = dqget(sb, id, type);
2135 if (!dquot) { 2164 if (!dquot) {
2136 rc = -ESRCH; 2165 rc = -ESRCH;
@@ -2139,7 +2168,6 @@ int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *d
2139 rc = do_set_dqblk(dquot, di); 2168 rc = do_set_dqblk(dquot, di);
2140 dqput(dquot); 2169 dqput(dquot);
2141out: 2170out:
2142 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
2143 return rc; 2171 return rc;
2144} 2172}
2145 2173
@@ -2370,11 +2398,9 @@ EXPORT_SYMBOL(dquot_release);
2370EXPORT_SYMBOL(dquot_mark_dquot_dirty); 2398EXPORT_SYMBOL(dquot_mark_dquot_dirty);
2371EXPORT_SYMBOL(dquot_initialize); 2399EXPORT_SYMBOL(dquot_initialize);
2372EXPORT_SYMBOL(dquot_drop); 2400EXPORT_SYMBOL(dquot_drop);
2373EXPORT_SYMBOL(dquot_drop_locked);
2374EXPORT_SYMBOL(vfs_dq_drop); 2401EXPORT_SYMBOL(vfs_dq_drop);
2375EXPORT_SYMBOL(dqget); 2402EXPORT_SYMBOL(dqget);
2376EXPORT_SYMBOL(dqput); 2403EXPORT_SYMBOL(dqput);
2377EXPORT_SYMBOL(dquot_is_cached);
2378EXPORT_SYMBOL(dquot_alloc_space); 2404EXPORT_SYMBOL(dquot_alloc_space);
2379EXPORT_SYMBOL(dquot_alloc_inode); 2405EXPORT_SYMBOL(dquot_alloc_inode);
2380EXPORT_SYMBOL(dquot_free_space); 2406EXPORT_SYMBOL(dquot_free_space);
diff --git a/fs/ecryptfs/Kconfig b/fs/ecryptfs/Kconfig
new file mode 100644
index 000000000000..0c754e64232b
--- /dev/null
+++ b/fs/ecryptfs/Kconfig
@@ -0,0 +1,11 @@
1config ECRYPT_FS
2 tristate "eCrypt filesystem layer support (EXPERIMENTAL)"
3 depends on EXPERIMENTAL && KEYS && CRYPTO && NET
4 help
5 Encrypted filesystem that operates on the VFS layer. See
6 <file:Documentation/filesystems/ecryptfs.txt> to learn more about
7 eCryptfs. Userspace components are required and can be
8 obtained from <http://ecryptfs.sf.net>.
9
10 To compile this file system support as a module, choose M here: the
11 module will be called ecryptfs.
diff --git a/fs/efs/Kconfig b/fs/efs/Kconfig
new file mode 100644
index 000000000000..6ebfc1c207a8
--- /dev/null
+++ b/fs/efs/Kconfig
@@ -0,0 +1,14 @@
1config EFS_FS
2 tristate "EFS file system support (read only) (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 help
5 EFS is an older file system used for non-ISO9660 CD-ROMs and hard
6 disk partitions by SGI's IRIX operating system (IRIX 6.0 and newer
7 uses the XFS file system for hard disk partitions however).
8
9 This implementation only offers read-only access. If you don't know
10 what all this is about, it's safe to say N. For more information
11 about EFS see its home page at <http://aeschi.ch.eu.org/efs/>.
12
13 To compile the EFS file system support as a module, choose M here: the
14 module will be called efs.
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index ba2f9ec71192..011b9b8c90c6 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -234,8 +234,6 @@ struct ep_pqueue {
234/* 234/*
235 * Configuration options available inside /proc/sys/fs/epoll/ 235 * Configuration options available inside /proc/sys/fs/epoll/
236 */ 236 */
237/* Maximum number of epoll devices, per user */
238static int max_user_instances __read_mostly;
239/* Maximum number of epoll watched descriptors, per user */ 237/* Maximum number of epoll watched descriptors, per user */
240static int max_user_watches __read_mostly; 238static int max_user_watches __read_mostly;
241 239
@@ -261,14 +259,6 @@ static int zero;
261 259
262ctl_table epoll_table[] = { 260ctl_table epoll_table[] = {
263 { 261 {
264 .procname = "max_user_instances",
265 .data = &max_user_instances,
266 .maxlen = sizeof(int),
267 .mode = 0644,
268 .proc_handler = &proc_dointvec_minmax,
269 .extra1 = &zero,
270 },
271 {
272 .procname = "max_user_watches", 262 .procname = "max_user_watches",
273 .data = &max_user_watches, 263 .data = &max_user_watches,
274 .maxlen = sizeof(int), 264 .maxlen = sizeof(int),
@@ -491,7 +481,6 @@ static void ep_free(struct eventpoll *ep)
491 481
492 mutex_unlock(&epmutex); 482 mutex_unlock(&epmutex);
493 mutex_destroy(&ep->mtx); 483 mutex_destroy(&ep->mtx);
494 atomic_dec(&ep->user->epoll_devs);
495 free_uid(ep->user); 484 free_uid(ep->user);
496 kfree(ep); 485 kfree(ep);
497} 486}
@@ -581,10 +570,6 @@ static int ep_alloc(struct eventpoll **pep)
581 struct eventpoll *ep; 570 struct eventpoll *ep;
582 571
583 user = get_current_user(); 572 user = get_current_user();
584 error = -EMFILE;
585 if (unlikely(atomic_read(&user->epoll_devs) >=
586 max_user_instances))
587 goto free_uid;
588 error = -ENOMEM; 573 error = -ENOMEM;
589 ep = kzalloc(sizeof(*ep), GFP_KERNEL); 574 ep = kzalloc(sizeof(*ep), GFP_KERNEL);
590 if (unlikely(!ep)) 575 if (unlikely(!ep))
@@ -1141,7 +1126,6 @@ SYSCALL_DEFINE1(epoll_create1, int, flags)
1141 flags & O_CLOEXEC); 1126 flags & O_CLOEXEC);
1142 if (fd < 0) 1127 if (fd < 0)
1143 ep_free(ep); 1128 ep_free(ep);
1144 atomic_inc(&ep->user->epoll_devs);
1145 1129
1146error_return: 1130error_return:
1147 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n", 1131 DNPRINTK(3, (KERN_INFO "[%p] eventpoll: sys_epoll_create(%d) = %d\n",
@@ -1366,8 +1350,10 @@ static int __init eventpoll_init(void)
1366 struct sysinfo si; 1350 struct sysinfo si;
1367 1351
1368 si_meminfo(&si); 1352 si_meminfo(&si);
1369 max_user_instances = 128; 1353 /*
1370 max_user_watches = (((si.totalram - si.totalhigh) / 32) << PAGE_SHIFT) / 1354 * Allows top 4% of lomem to be allocated for epoll watches (per user).
1355 */
1356 max_user_watches = (((si.totalram - si.totalhigh) / 25) << PAGE_SHIFT) /
1371 EP_ITEM_COST; 1357 EP_ITEM_COST;
1372 1358
1373 /* Initialize the structure used to perform safe poll wait head wake ups */ 1359 /* Initialize the structure used to perform safe poll wait head wake ups */
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 69a3d19ca9fd..4db4ffa1edad 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1358,7 +1358,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1358 struct fake_dirent *fde; 1358 struct fake_dirent *fde;
1359 1359
1360 blocksize = dir->i_sb->s_blocksize; 1360 blocksize = dir->i_sb->s_blocksize;
1361 dxtrace(printk("Creating index\n")); 1361 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
1362 retval = ext3_journal_get_write_access(handle, bh); 1362 retval = ext3_journal_get_write_access(handle, bh);
1363 if (retval) { 1363 if (retval) {
1364 ext3_std_error(dir->i_sb, retval); 1364 ext3_std_error(dir->i_sb, retval);
@@ -1367,6 +1367,19 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1367 } 1367 }
1368 root = (struct dx_root *) bh->b_data; 1368 root = (struct dx_root *) bh->b_data;
1369 1369
1370 /* The 0th block becomes the root, move the dirents out */
1371 fde = &root->dotdot;
1372 de = (struct ext3_dir_entry_2 *)((char *)fde +
1373 ext3_rec_len_from_disk(fde->rec_len));
1374 if ((char *) de >= (((char *) root) + blocksize)) {
1375 ext3_error(dir->i_sb, __func__,
1376 "invalid rec_len for '..' in inode %lu",
1377 dir->i_ino);
1378 brelse(bh);
1379 return -EIO;
1380 }
1381 len = ((char *) root) + blocksize - (char *) de;
1382
1370 bh2 = ext3_append (handle, dir, &block, &retval); 1383 bh2 = ext3_append (handle, dir, &block, &retval);
1371 if (!(bh2)) { 1384 if (!(bh2)) {
1372 brelse(bh); 1385 brelse(bh);
@@ -1375,11 +1388,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1375 EXT3_I(dir)->i_flags |= EXT3_INDEX_FL; 1388 EXT3_I(dir)->i_flags |= EXT3_INDEX_FL;
1376 data1 = bh2->b_data; 1389 data1 = bh2->b_data;
1377 1390
1378 /* The 0th block becomes the root, move the dirents out */
1379 fde = &root->dotdot;
1380 de = (struct ext3_dir_entry_2 *)((char *)fde +
1381 ext3_rec_len_from_disk(fde->rec_len));
1382 len = ((char *) root) + blocksize - (char *) de;
1383 memcpy (data1, de, len); 1391 memcpy (data1, de, len);
1384 de = (struct ext3_dir_entry_2 *) data1; 1392 de = (struct ext3_dir_entry_2 *) data1;
1385 top = data1 + len; 1393 top = data1 + len;
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
index 6bba06b09dd1..9a50b8052dcf 100644
--- a/fs/ext4/balloc.c
+++ b/fs/ext4/balloc.c
@@ -684,15 +684,15 @@ ext4_fsblk_t ext4_count_free_blocks(struct super_block *sb)
684 gdp = ext4_get_group_desc(sb, i, NULL); 684 gdp = ext4_get_group_desc(sb, i, NULL);
685 if (!gdp) 685 if (!gdp)
686 continue; 686 continue;
687 desc_count += le16_to_cpu(gdp->bg_free_blocks_count); 687 desc_count += ext4_free_blks_count(sb, gdp);
688 brelse(bitmap_bh); 688 brelse(bitmap_bh);
689 bitmap_bh = ext4_read_block_bitmap(sb, i); 689 bitmap_bh = ext4_read_block_bitmap(sb, i);
690 if (bitmap_bh == NULL) 690 if (bitmap_bh == NULL)
691 continue; 691 continue;
692 692
693 x = ext4_count_free(bitmap_bh, sb->s_blocksize); 693 x = ext4_count_free(bitmap_bh, sb->s_blocksize);
694 printk(KERN_DEBUG "group %lu: stored = %d, counted = %u\n", 694 printk(KERN_DEBUG "group %u: stored = %d, counted = %u\n",
695 i, le16_to_cpu(gdp->bg_free_blocks_count), x); 695 i, ext4_free_blks_count(sb, gdp), x);
696 bitmap_count += x; 696 bitmap_count += x;
697 } 697 }
698 brelse(bitmap_bh); 698 brelse(bitmap_bh);
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index c668e4377d76..aafc9eba1c25 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -1206,8 +1206,11 @@ static inline void ext4_r_blocks_count_set(struct ext4_super_block *es,
1206 1206
1207static inline loff_t ext4_isize(struct ext4_inode *raw_inode) 1207static inline loff_t ext4_isize(struct ext4_inode *raw_inode)
1208{ 1208{
1209 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) | 1209 if (S_ISREG(le16_to_cpu(raw_inode->i_mode)))
1210 le32_to_cpu(raw_inode->i_size_lo); 1210 return ((loff_t)le32_to_cpu(raw_inode->i_size_high) << 32) |
1211 le32_to_cpu(raw_inode->i_size_lo);
1212 else
1213 return (loff_t) le32_to_cpu(raw_inode->i_size_lo);
1211} 1214}
1212 1215
1213static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size) 1216static inline void ext4_isize_set(struct ext4_inode *raw_inode, loff_t i_size)
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 54bf0623a9ae..e2eab196875f 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -3048,7 +3048,7 @@ retry:
3048 WARN_ON(ret <= 0); 3048 WARN_ON(ret <= 0);
3049 printk(KERN_ERR "%s: ext4_ext_get_blocks " 3049 printk(KERN_ERR "%s: ext4_ext_get_blocks "
3050 "returned error inode#%lu, block=%u, " 3050 "returned error inode#%lu, block=%u, "
3051 "max_blocks=%lu", __func__, 3051 "max_blocks=%u", __func__,
3052 inode->i_ino, block, max_blocks); 3052 inode->i_ino, block, max_blocks);
3053#endif 3053#endif
3054 ext4_mark_inode_dirty(handle, inode); 3054 ext4_mark_inode_dirty(handle, inode);
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index a6444cee0c7e..03ba20be1329 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -360,9 +360,9 @@ static int ext4_block_to_path(struct inode *inode,
360 final = ptrs; 360 final = ptrs;
361 } else { 361 } else {
362 ext4_warning(inode->i_sb, "ext4_block_to_path", 362 ext4_warning(inode->i_sb, "ext4_block_to_path",
363 "block %lu > max", 363 "block %lu > max in inode %lu",
364 i_block + direct_blocks + 364 i_block + direct_blocks +
365 indirect_blocks + double_blocks); 365 indirect_blocks + double_blocks, inode->i_ino);
366 } 366 }
367 if (boundary) 367 if (boundary)
368 *boundary = final - 1 - (i_block & (ptrs - 1)); 368 *boundary = final - 1 - (i_block & (ptrs - 1));
@@ -2821,9 +2821,6 @@ static sector_t ext4_bmap(struct address_space *mapping, sector_t block)
2821 filemap_write_and_wait(mapping); 2821 filemap_write_and_wait(mapping);
2822 } 2822 }
2823 2823
2824 BUG_ON(!EXT4_JOURNAL(inode) &&
2825 EXT4_I(inode)->i_state & EXT4_STATE_JDATA);
2826
2827 if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) { 2824 if (EXT4_JOURNAL(inode) && EXT4_I(inode)->i_state & EXT4_STATE_JDATA) {
2828 /* 2825 /*
2829 * This is a REALLY heavyweight approach, but the use of 2826 * This is a REALLY heavyweight approach, but the use of
@@ -3622,7 +3619,7 @@ static void ext4_free_data(handle_t *handle, struct inode *inode,
3622 * block pointed to itself, it would have been detached when 3619 * block pointed to itself, it would have been detached when
3623 * the block was cleared. Check for this instead of OOPSing. 3620 * the block was cleared. Check for this instead of OOPSing.
3624 */ 3621 */
3625 if (bh2jh(this_bh)) 3622 if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh))
3626 ext4_handle_dirty_metadata(handle, inode, this_bh); 3623 ext4_handle_dirty_metadata(handle, inode, this_bh);
3627 else 3624 else
3628 ext4_error(inode->i_sb, __func__, 3625 ext4_error(inode->i_sb, __func__,
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 918aec0c8a11..deba54f6cbed 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -3025,7 +3025,7 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
3025 goto out_err; 3025 goto out_err;
3026 3026
3027 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group, 3027 ext4_debug("using block group %u(%d)\n", ac->ac_b_ex.fe_group,
3028 gdp->bg_free_blocks_count); 3028 ext4_free_blks_count(sb, gdp));
3029 3029
3030 err = ext4_journal_get_write_access(handle, gdp_bh); 3030 err = ext4_journal_get_write_access(handle, gdp_bh);
3031 if (err) 3031 if (err)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index fec0b4c2f5f1..ba702bd7910d 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -1368,7 +1368,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1368 struct fake_dirent *fde; 1368 struct fake_dirent *fde;
1369 1369
1370 blocksize = dir->i_sb->s_blocksize; 1370 blocksize = dir->i_sb->s_blocksize;
1371 dxtrace(printk(KERN_DEBUG "Creating index\n")); 1371 dxtrace(printk(KERN_DEBUG "Creating index: inode %lu\n", dir->i_ino));
1372 retval = ext4_journal_get_write_access(handle, bh); 1372 retval = ext4_journal_get_write_access(handle, bh);
1373 if (retval) { 1373 if (retval) {
1374 ext4_std_error(dir->i_sb, retval); 1374 ext4_std_error(dir->i_sb, retval);
@@ -1377,6 +1377,20 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1377 } 1377 }
1378 root = (struct dx_root *) bh->b_data; 1378 root = (struct dx_root *) bh->b_data;
1379 1379
1380 /* The 0th block becomes the root, move the dirents out */
1381 fde = &root->dotdot;
1382 de = (struct ext4_dir_entry_2 *)((char *)fde +
1383 ext4_rec_len_from_disk(fde->rec_len));
1384 if ((char *) de >= (((char *) root) + blocksize)) {
1385 ext4_error(dir->i_sb, __func__,
1386 "invalid rec_len for '..' in inode %lu",
1387 dir->i_ino);
1388 brelse(bh);
1389 return -EIO;
1390 }
1391 len = ((char *) root) + blocksize - (char *) de;
1392
1393 /* Allocate new block for the 0th block's dirents */
1380 bh2 = ext4_append(handle, dir, &block, &retval); 1394 bh2 = ext4_append(handle, dir, &block, &retval);
1381 if (!(bh2)) { 1395 if (!(bh2)) {
1382 brelse(bh); 1396 brelse(bh);
@@ -1385,11 +1399,6 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1385 EXT4_I(dir)->i_flags |= EXT4_INDEX_FL; 1399 EXT4_I(dir)->i_flags |= EXT4_INDEX_FL;
1386 data1 = bh2->b_data; 1400 data1 = bh2->b_data;
1387 1401
1388 /* The 0th block becomes the root, move the dirents out */
1389 fde = &root->dotdot;
1390 de = (struct ext4_dir_entry_2 *)((char *)fde +
1391 ext4_rec_len_from_disk(fde->rec_len));
1392 len = ((char *) root) + blocksize - (char *) de;
1393 memcpy (data1, de, len); 1402 memcpy (data1, de, len);
1394 de = (struct ext4_dir_entry_2 *) data1; 1403 de = (struct ext4_dir_entry_2 *) data1;
1395 top = data1 + len; 1404 top = data1 + len;
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
index c328be5d6885..c06886abd658 100644
--- a/fs/ext4/resize.c
+++ b/fs/ext4/resize.c
@@ -861,12 +861,13 @@ int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)
861 gdp = (struct ext4_group_desc *)((char *)primary->b_data + 861 gdp = (struct ext4_group_desc *)((char *)primary->b_data +
862 gdb_off * EXT4_DESC_SIZE(sb)); 862 gdb_off * EXT4_DESC_SIZE(sb));
863 863
864 memset(gdp, 0, EXT4_DESC_SIZE(sb));
864 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */ 865 ext4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */
865 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */ 866 ext4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */
866 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */ 867 ext4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */
867 ext4_free_blks_set(sb, gdp, input->free_blocks_count); 868 ext4_free_blks_set(sb, gdp, input->free_blocks_count);
868 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb)); 869 ext4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));
869 gdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED); 870 gdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED);
870 gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp); 871 gdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);
871 872
872 /* 873 /*
diff --git a/fs/fat/Kconfig b/fs/fat/Kconfig
new file mode 100644
index 000000000000..d0a69ff25375
--- /dev/null
+++ b/fs/fat/Kconfig
@@ -0,0 +1,97 @@
1config FAT_FS
2 tristate
3 select NLS
4 help
5 If you want to use one of the FAT-based file systems (the MS-DOS and
6 VFAT (Windows 95) file systems), then you must say Y or M here
7 to include FAT support. You will then be able to mount partitions or
8 diskettes with FAT-based file systems and transparently access the
9 files on them, i.e. MSDOS files will look and behave just like all
10 other Unix files.
11
12 This FAT support is not a file system in itself, it only provides
13 the foundation for the other file systems. You will have to say Y or
14 M to at least one of "MSDOS fs support" or "VFAT fs support" in
15 order to make use of it.
16
17 Another way to read and write MSDOS floppies and hard drive
18 partitions from within Linux (but not transparently) is with the
19 mtools ("man mtools") program suite. You don't need to say Y here in
20 order to do that.
21
22 If you need to move large files on floppies between a DOS and a
23 Linux box, say Y here, mount the floppy under Linux with an MSDOS
24 file system and use GNU tar's M option. GNU tar is a program
25 available for Unix and DOS ("man tar" or "info tar").
26
27 The FAT support will enlarge your kernel by about 37 KB. If unsure,
28 say Y.
29
30 To compile this as a module, choose M here: the module will be called
31 fat. Note that if you compile the FAT support as a module, you
32 cannot compile any of the FAT-based file systems into the kernel
33 -- they will have to be modules as well.
34
35config MSDOS_FS
36 tristate "MSDOS fs support"
37 select FAT_FS
38 help
39 This allows you to mount MSDOS partitions of your hard drive (unless
40 they are compressed; to access compressed MSDOS partitions under
41 Linux, you can either use the DOS emulator DOSEMU, described in the
42 DOSEMU-HOWTO, available from
43 <http://www.tldp.org/docs.html#howto>, or try dmsdosfs in
44 <ftp://ibiblio.org/pub/Linux/system/filesystems/dosfs/>. If you
45 intend to use dosemu with a non-compressed MSDOS partition, say Y
46 here) and MSDOS floppies. This means that file access becomes
47 transparent, i.e. the MSDOS files look and behave just like all
48 other Unix files.
49
50 If you have Windows 95 or Windows NT installed on your MSDOS
51 partitions, you should use the VFAT file system (say Y to "VFAT fs
52 support" below), or you will not be able to see the long filenames
53 generated by Windows 95 / Windows NT.
54
55 This option will enlarge your kernel by about 7 KB. If unsure,
56 answer Y. This will only work if you said Y to "DOS FAT fs support"
57 as well. To compile this as a module, choose M here: the module will
58 be called msdos.
59
60config VFAT_FS
61 tristate "VFAT (Windows-95) fs support"
62 select FAT_FS
63 help
64 This option provides support for normal Windows file systems with
65 long filenames. That includes non-compressed FAT-based file systems
66 used by Windows 95, Windows 98, Windows NT 4.0, and the Unix
67 programs from the mtools package.
68
69 The VFAT support enlarges your kernel by about 10 KB and it only
70 works if you said Y to the "DOS FAT fs support" above. Please read
71 the file <file:Documentation/filesystems/vfat.txt> for details. If
72 unsure, say Y.
73
74 To compile this as a module, choose M here: the module will be called
75 vfat.
76
77config FAT_DEFAULT_CODEPAGE
78 int "Default codepage for FAT"
79 depends on MSDOS_FS || VFAT_FS
80 default 437
81 help
82 This option should be set to the codepage of your FAT filesystems.
83 It can be overridden with the "codepage" mount option.
84 See <file:Documentation/filesystems/vfat.txt> for more information.
85
86config FAT_DEFAULT_IOCHARSET
87 string "Default iocharset for FAT"
88 depends on VFAT_FS
89 default "iso8859-1"
90 help
91 Set this to the default input/output character set you'd
92 like FAT to use. It should probably match the character set
93 that most of your FAT filesystems use, and can be overridden
94 with the "iocharset" mount option for FAT filesystems.
95 Note that "utf8" is not recommended for FAT filesystems.
96 If unsure, you shouldn't set "utf8" here.
97 See <file:Documentation/filesystems/vfat.txt> for more information.
diff --git a/fs/freevxfs/Kconfig b/fs/freevxfs/Kconfig
new file mode 100644
index 000000000000..8dc1cd5c1efe
--- /dev/null
+++ b/fs/freevxfs/Kconfig
@@ -0,0 +1,16 @@
1config VXFS_FS
2 tristate "FreeVxFS file system support (VERITAS VxFS(TM) compatible)"
3 depends on BLOCK
4 help
5 FreeVxFS is a file system driver that support the VERITAS VxFS(TM)
6 file system format. VERITAS VxFS(TM) is the standard file system
7 of SCO UnixWare (and possibly others) and optionally available
8 for Sunsoft Solaris, HP-UX and many other operating systems.
9 Currently only readonly access is supported.
10
11 NOTE: the file system type as used by mount(1), mount(2) and
12 fstab(5) is 'vxfs' as it describes the file system format, not
13 the actual driver.
14
15 To compile this as a module, choose M here: the module will be
16 called freevxfs. If unsure, say N.
diff --git a/fs/fuse/Kconfig b/fs/fuse/Kconfig
new file mode 100644
index 000000000000..0cf160a94eda
--- /dev/null
+++ b/fs/fuse/Kconfig
@@ -0,0 +1,15 @@
1config FUSE_FS
2 tristate "FUSE (Filesystem in Userspace) support"
3 help
4 With FUSE it is possible to implement a fully functional filesystem
5 in a userspace program.
6
7 There's also companion library: libfuse. This library along with
8 utilities is available from the FUSE homepage:
9 <http://fuse.sourceforge.net/>
10
11 See <file:Documentation/filesystems/fuse.txt> for more information.
12 See <file:Documentation/Changes> for needed library/utility version.
13
14 If you want to develop a userspace FS, or if you want to use
15 a filesystem based on FUSE, answer Y or M.
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index e0c7ada08a1f..ba76b68c52ff 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -281,7 +281,8 @@ __releases(&fc->lock)
281 fc->blocked = 0; 281 fc->blocked = 0;
282 wake_up_all(&fc->blocked_waitq); 282 wake_up_all(&fc->blocked_waitq);
283 } 283 }
284 if (fc->num_background == FUSE_CONGESTION_THRESHOLD) { 284 if (fc->num_background == FUSE_CONGESTION_THRESHOLD &&
285 fc->connected) {
285 clear_bdi_congested(&fc->bdi, READ); 286 clear_bdi_congested(&fc->bdi, READ);
286 clear_bdi_congested(&fc->bdi, WRITE); 287 clear_bdi_congested(&fc->bdi, WRITE);
287 } 288 }
@@ -825,16 +826,21 @@ static int fuse_notify_poll(struct fuse_conn *fc, unsigned int size,
825 struct fuse_copy_state *cs) 826 struct fuse_copy_state *cs)
826{ 827{
827 struct fuse_notify_poll_wakeup_out outarg; 828 struct fuse_notify_poll_wakeup_out outarg;
828 int err; 829 int err = -EINVAL;
829 830
830 if (size != sizeof(outarg)) 831 if (size != sizeof(outarg))
831 return -EINVAL; 832 goto err;
832 833
833 err = fuse_copy_one(cs, &outarg, sizeof(outarg)); 834 err = fuse_copy_one(cs, &outarg, sizeof(outarg));
834 if (err) 835 if (err)
835 return err; 836 goto err;
836 837
838 fuse_copy_finish(cs);
837 return fuse_notify_poll_wakeup(fc, &outarg); 839 return fuse_notify_poll_wakeup(fc, &outarg);
840
841err:
842 fuse_copy_finish(cs);
843 return err;
838} 844}
839 845
840static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, 846static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
@@ -845,6 +851,7 @@ static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code,
845 return fuse_notify_poll(fc, size, cs); 851 return fuse_notify_poll(fc, size, cs);
846 852
847 default: 853 default:
854 fuse_copy_finish(cs);
848 return -EINVAL; 855 return -EINVAL;
849 } 856 }
850} 857}
@@ -923,7 +930,6 @@ static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
923 */ 930 */
924 if (!oh.unique) { 931 if (!oh.unique) {
925 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs); 932 err = fuse_notify(fc, oh.error, nbytes - sizeof(oh), &cs);
926 fuse_copy_finish(&cs);
927 return err ? err : nbytes; 933 return err ? err : nbytes;
928 } 934 }
929 935
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index e8162646a9b5..d9fdb7cec538 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -54,7 +54,7 @@ struct fuse_file *fuse_file_alloc(struct fuse_conn *fc)
54 ff->reserved_req = fuse_request_alloc(); 54 ff->reserved_req = fuse_request_alloc();
55 if (!ff->reserved_req) { 55 if (!ff->reserved_req) {
56 kfree(ff); 56 kfree(ff);
57 ff = NULL; 57 return NULL;
58 } else { 58 } else {
59 INIT_LIST_HEAD(&ff->write_entry); 59 INIT_LIST_HEAD(&ff->write_entry);
60 atomic_set(&ff->count, 0); 60 atomic_set(&ff->count, 0);
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 47c96fdca1ac..459b73dd45e1 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -292,6 +292,7 @@ static void fuse_put_super(struct super_block *sb)
292 list_del(&fc->entry); 292 list_del(&fc->entry);
293 fuse_ctl_remove_conn(fc); 293 fuse_ctl_remove_conn(fc);
294 mutex_unlock(&fuse_mutex); 294 mutex_unlock(&fuse_mutex);
295 bdi_destroy(&fc->bdi);
295 fuse_conn_put(fc); 296 fuse_conn_put(fc);
296} 297}
297 298
@@ -532,7 +533,6 @@ void fuse_conn_put(struct fuse_conn *fc)
532 if (fc->destroy_req) 533 if (fc->destroy_req)
533 fuse_request_free(fc->destroy_req); 534 fuse_request_free(fc->destroy_req);
534 mutex_destroy(&fc->inst_mutex); 535 mutex_destroy(&fc->inst_mutex);
535 bdi_destroy(&fc->bdi);
536 fc->release(fc); 536 fc->release(fc);
537 } 537 }
538} 538}
@@ -805,16 +805,18 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
805 int err; 805 int err;
806 int is_bdev = sb->s_bdev != NULL; 806 int is_bdev = sb->s_bdev != NULL;
807 807
808 err = -EINVAL;
808 if (sb->s_flags & MS_MANDLOCK) 809 if (sb->s_flags & MS_MANDLOCK)
809 return -EINVAL; 810 goto err;
810 811
811 if (!parse_fuse_opt((char *) data, &d, is_bdev)) 812 if (!parse_fuse_opt((char *) data, &d, is_bdev))
812 return -EINVAL; 813 goto err;
813 814
814 if (is_bdev) { 815 if (is_bdev) {
815#ifdef CONFIG_BLOCK 816#ifdef CONFIG_BLOCK
817 err = -EINVAL;
816 if (!sb_set_blocksize(sb, d.blksize)) 818 if (!sb_set_blocksize(sb, d.blksize))
817 return -EINVAL; 819 goto err;
818#endif 820#endif
819 } else { 821 } else {
820 sb->s_blocksize = PAGE_CACHE_SIZE; 822 sb->s_blocksize = PAGE_CACHE_SIZE;
@@ -826,20 +828,22 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
826 sb->s_export_op = &fuse_export_operations; 828 sb->s_export_op = &fuse_export_operations;
827 829
828 file = fget(d.fd); 830 file = fget(d.fd);
831 err = -EINVAL;
829 if (!file) 832 if (!file)
830 return -EINVAL; 833 goto err;
831 834
832 if (file->f_op != &fuse_dev_operations) 835 if (file->f_op != &fuse_dev_operations)
833 return -EINVAL; 836 goto err_fput;
834 837
835 fc = kmalloc(sizeof(*fc), GFP_KERNEL); 838 fc = kmalloc(sizeof(*fc), GFP_KERNEL);
839 err = -ENOMEM;
836 if (!fc) 840 if (!fc)
837 return -ENOMEM; 841 goto err_fput;
838 842
839 err = fuse_conn_init(fc, sb); 843 err = fuse_conn_init(fc, sb);
840 if (err) { 844 if (err) {
841 kfree(fc); 845 kfree(fc);
842 return err; 846 goto err_fput;
843 } 847 }
844 848
845 fc->release = fuse_free_conn; 849 fc->release = fuse_free_conn;
@@ -854,12 +858,12 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
854 err = -ENOMEM; 858 err = -ENOMEM;
855 root = fuse_get_root_inode(sb, d.rootmode); 859 root = fuse_get_root_inode(sb, d.rootmode);
856 if (!root) 860 if (!root)
857 goto err; 861 goto err_put_conn;
858 862
859 root_dentry = d_alloc_root(root); 863 root_dentry = d_alloc_root(root);
860 if (!root_dentry) { 864 if (!root_dentry) {
861 iput(root); 865 iput(root);
862 goto err; 866 goto err_put_conn;
863 } 867 }
864 868
865 init_req = fuse_request_alloc(); 869 init_req = fuse_request_alloc();
@@ -903,9 +907,11 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
903 fuse_request_free(init_req); 907 fuse_request_free(init_req);
904 err_put_root: 908 err_put_root:
905 dput(root_dentry); 909 dput(root_dentry);
906 err: 910 err_put_conn:
907 fput(file);
908 fuse_conn_put(fc); 911 fuse_conn_put(fc);
912 err_fput:
913 fput(file);
914 err:
909 return err; 915 return err;
910} 916}
911 917
diff --git a/fs/hfs/Kconfig b/fs/hfs/Kconfig
new file mode 100644
index 000000000000..b77c5bc20f8a
--- /dev/null
+++ b/fs/hfs/Kconfig
@@ -0,0 +1,12 @@
1config HFS_FS
2 tristate "Apple Macintosh file system support (EXPERIMENTAL)"
3 depends on BLOCK && EXPERIMENTAL
4 select NLS
5 help
6 If you say Y here, you will be able to mount Macintosh-formatted
7 floppy disks and hard drive partitions with full read-write access.
8 Please read <file:Documentation/filesystems/hfs.txt> to learn about
9 the available mount options.
10
11 To compile this file system support as a module, choose M here: the
12 module will be called hfs.
diff --git a/fs/hfsplus/Kconfig b/fs/hfsplus/Kconfig
new file mode 100644
index 000000000000..a63371815aab
--- /dev/null
+++ b/fs/hfsplus/Kconfig
@@ -0,0 +1,13 @@
1config HFSPLUS_FS
2 tristate "Apple Extended HFS file system support"
3 depends on BLOCK
4 select NLS
5 select NLS_UTF8
6 help
7 If you say Y here, you will be able to mount extended format
8 Macintosh-formatted hard drive partitions with full read-write access.
9
10 This file system is often called HFS+ and was introduced with
11 MacOS 8. It includes all Mac specific filesystem data such as
12 data forks and creator codes, but it also has several UNIX
13 style features such as file ownership and permissions.
diff --git a/fs/hpfs/Kconfig b/fs/hpfs/Kconfig
new file mode 100644
index 000000000000..56bd15c5bf6c
--- /dev/null
+++ b/fs/hpfs/Kconfig
@@ -0,0 +1,14 @@
1config HPFS_FS
2 tristate "OS/2 HPFS file system support"
3 depends on BLOCK
4 help
5 OS/2 is IBM's operating system for PC's, the same as Warp, and HPFS
6 is the file system used for organizing files on OS/2 hard disk
7 partitions. Say Y if you want to be able to read files from and
8 write files to an OS/2 HPFS partition on your hard drive. OS/2
9 floppies however are in regular MSDOS format, so you don't need this
10 option in order to be able to read them. Read
11 <file:Documentation/filesystems/hpfs.txt>.
12
13 To compile this file system support as a module, choose M here: the
14 module will be called hpfs. If unsure, say N.
diff --git a/fs/isofs/Kconfig b/fs/isofs/Kconfig
new file mode 100644
index 000000000000..8ab9878e3671
--- /dev/null
+++ b/fs/isofs/Kconfig
@@ -0,0 +1,39 @@
1config ISO9660_FS
2 tristate "ISO 9660 CDROM file system support"
3 help
4 This is the standard file system used on CD-ROMs. It was previously
5 known as "High Sierra File System" and is called "hsfs" on other
6 Unix systems. The so-called Rock-Ridge extensions which allow for
7 long Unix filenames and symbolic links are also supported by this
8 driver. If you have a CD-ROM drive and want to do more with it than
9 just listen to audio CDs and watch its LEDs, say Y (and read
10 <file:Documentation/filesystems/isofs.txt> and the CD-ROM-HOWTO,
11 available from <http://www.tldp.org/docs.html#howto>), thereby
12 enlarging your kernel by about 27 KB; otherwise say N.
13
14 To compile this file system support as a module, choose M here: the
15 module will be called isofs.
16
17config JOLIET
18 bool "Microsoft Joliet CDROM extensions"
19 depends on ISO9660_FS
20 select NLS
21 help
22 Joliet is a Microsoft extension for the ISO 9660 CD-ROM file system
23 which allows for long filenames in unicode format (unicode is the
24 new 16 bit character code, successor to ASCII, which encodes the
25 characters of almost all languages of the world; see
26 <http://www.unicode.org/> for more information). Say Y here if you
27 want to be able to read Joliet CD-ROMs under Linux.
28
29config ZISOFS
30 bool "Transparent decompression extension"
31 depends on ISO9660_FS
32 select ZLIB_INFLATE
33 help
34 This is a Linux-specific extension to RockRidge which lets you store
35 data in compressed form on a CD-ROM and have it transparently
36 decompressed when the CD-ROM is accessed. See
37 <http://www.kernel.org/pub/linux/utils/fs/zisofs/> for the tools
38 necessary to create such a filesystem. Say Y here if you want to be
39 able to read such compressed CD-ROMs.
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 56675306ed81..eb343008eded 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -37,10 +37,10 @@
37#include <linux/proc_fs.h> 37#include <linux/proc_fs.h>
38#include <linux/debugfs.h> 38#include <linux/debugfs.h>
39#include <linux/seq_file.h> 39#include <linux/seq_file.h>
40#include <linux/math64.h>
40 41
41#include <asm/uaccess.h> 42#include <asm/uaccess.h>
42#include <asm/page.h> 43#include <asm/page.h>
43#include <asm/div64.h>
44 44
45EXPORT_SYMBOL(jbd2_journal_start); 45EXPORT_SYMBOL(jbd2_journal_start);
46EXPORT_SYMBOL(jbd2_journal_restart); 46EXPORT_SYMBOL(jbd2_journal_restart);
@@ -846,8 +846,8 @@ static int jbd2_seq_info_show(struct seq_file *seq, void *v)
846 jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid)); 846 jiffies_to_msecs(s->stats->u.run.rs_flushing / s->stats->ts_tid));
847 seq_printf(seq, " %ums logging transaction\n", 847 seq_printf(seq, " %ums logging transaction\n",
848 jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid)); 848 jiffies_to_msecs(s->stats->u.run.rs_logging / s->stats->ts_tid));
849 seq_printf(seq, " %luus average transaction commit time\n", 849 seq_printf(seq, " %lluus average transaction commit time\n",
850 do_div(s->journal->j_average_commit_time, 1000)); 850 div_u64(s->journal->j_average_commit_time, 1000));
851 seq_printf(seq, " %lu handles per transaction\n", 851 seq_printf(seq, " %lu handles per transaction\n",
852 s->stats->u.run.rs_handle_count / s->stats->ts_tid); 852 s->stats->u.run.rs_handle_count / s->stats->ts_tid);
853 seq_printf(seq, " %lu blocks per transaction\n", 853 seq_printf(seq, " %lu blocks per transaction\n",
diff --git a/fs/jfs/Kconfig b/fs/jfs/Kconfig
new file mode 100644
index 000000000000..9ff619a6f9cc
--- /dev/null
+++ b/fs/jfs/Kconfig
@@ -0,0 +1,49 @@
1config JFS_FS
2 tristate "JFS filesystem support"
3 select NLS
4 help
5 This is a port of IBM's Journaled Filesystem . More information is
6 available in the file <file:Documentation/filesystems/jfs.txt>.
7
8 If you do not intend to use the JFS filesystem, say N.
9
10config JFS_POSIX_ACL
11 bool "JFS POSIX Access Control Lists"
12 depends on JFS_FS
13 select FS_POSIX_ACL
14 help
15 Posix Access Control Lists (ACLs) support permissions for users and
16 groups beyond the owner/group/world scheme.
17
18 To learn more about Access Control Lists, visit the Posix ACLs for
19 Linux website <http://acl.bestbits.at/>.
20
21 If you don't know what Access Control Lists are, say N
22
23config JFS_SECURITY
24 bool "JFS Security Labels"
25 depends on JFS_FS
26 help
27 Security labels support alternative access control models
28 implemented by security modules like SELinux. This option
29 enables an extended attribute handler for file security
30 labels in the jfs filesystem.
31
32 If you are not using a security module that requires using
33 extended attributes for file security labels, say N.
34
35config JFS_DEBUG
36 bool "JFS debugging"
37 depends on JFS_FS
38 help
39 If you are experiencing any problems with the JFS filesystem, say
40 Y here. This will result in additional debugging messages to be
41 written to the system log. Under normal circumstances, this
42 results in very little overhead.
43
44config JFS_STATISTICS
45 bool "JFS statistics"
46 depends on JFS_FS
47 help
48 Enabling this option will cause statistics from the JFS file system
49 to be made available to the user in the /proc/fs/jfs/ directory.
diff --git a/fs/minix/Kconfig b/fs/minix/Kconfig
new file mode 100644
index 000000000000..0fd7ca994264
--- /dev/null
+++ b/fs/minix/Kconfig
@@ -0,0 +1,17 @@
1config MINIX_FS
2 tristate "Minix file system support"
3 depends on BLOCK
4 help
5 Minix is a simple operating system used in many classes about OS's.
6 The minix file system (method to organize files on a hard disk
7 partition or a floppy disk) was the original file system for Linux,
8 but has been superseded by the second extended file system ext2fs.
9 You don't want to use the minix file system on your hard disk
10 because of certain built-in restrictions, but it is sometimes found
11 on older Linux floppy disks. This option will enlarge your kernel
12 by about 28 KB. If unsure, say N.
13
14 To compile this file system support as a module, choose M here: the
15 module will be called minix. Note that the file system of your root
16 partition (the one containing the directory /) cannot be compiled as
17 a module.
diff --git a/fs/ncpfs/Kconfig b/fs/ncpfs/Kconfig
index 142808427b25..c931cf22a1f6 100644
--- a/fs/ncpfs/Kconfig
+++ b/fs/ncpfs/Kconfig
@@ -1,6 +1,27 @@
1# 1#
2# NCP Filesystem configuration 2# NCP Filesystem configuration
3# 3#
4config NCP_FS
5 tristate "NCP file system support (to mount NetWare volumes)"
6 depends on IPX!=n || INET
7 help
8 NCP (NetWare Core Protocol) is a protocol that runs over IPX and is
9 used by Novell NetWare clients to talk to file servers. It is to
10 IPX what NFS is to TCP/IP, if that helps. Saying Y here allows you
11 to mount NetWare file server volumes and to access them just like
12 any other Unix directory. For details, please read the file
13 <file:Documentation/filesystems/ncpfs.txt> in the kernel source and
14 the IPX-HOWTO from <http://www.tldp.org/docs.html#howto>.
15
16 You do not have to say Y here if you want your Linux box to act as a
17 file *server* for Novell NetWare clients.
18
19 General information about how to connect Linux, Windows machines and
20 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
21
22 To compile this as a module, choose M here: the module will be called
23 ncpfs. Say N unless you are connected to a Novell network.
24
4config NCPFS_PACKET_SIGNING 25config NCPFS_PACKET_SIGNING
5 bool "Packet signatures" 26 bool "Packet signatures"
6 depends on NCP_FS 27 depends on NCP_FS
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig
new file mode 100644
index 000000000000..36fe20d6eba2
--- /dev/null
+++ b/fs/nfs/Kconfig
@@ -0,0 +1,86 @@
1config NFS_FS
2 tristate "NFS client support"
3 depends on INET
4 select LOCKD
5 select SUNRPC
6 select NFS_ACL_SUPPORT if NFS_V3_ACL
7 help
8 Choose Y here if you want to access files residing on other
9 computers using Sun's Network File System protocol. To compile
10 this file system support as a module, choose M here: the module
11 will be called nfs.
12
13 To mount file systems exported by NFS servers, you also need to
14 install the user space mount.nfs command which can be found in
15 the Linux nfs-utils package, available from http://linux-nfs.org/.
16 Information about using the mount command is available in the
17 mount(8) man page. More detail about the Linux NFS client
18 implementation is available via the nfs(5) man page.
19
20 Below you can choose which versions of the NFS protocol are
21 available in the kernel to mount NFS servers. Support for NFS
22 version 2 (RFC 1094) is always available when NFS_FS is selected.
23
24 To configure a system which mounts its root file system via NFS
25 at boot time, say Y here, select "Kernel level IP
26 autoconfiguration" in the NETWORK menu, and select "Root file
27 system on NFS" below. You cannot compile this file system as a
28 module in this case.
29
30 If unsure, say N.
31
32config NFS_V3
33 bool "NFS client support for NFS version 3"
34 depends on NFS_FS
35 help
36 This option enables support for version 3 of the NFS protocol
37 (RFC 1813) in the kernel's NFS client.
38
39 If unsure, say Y.
40
41config NFS_V3_ACL
42 bool "NFS client support for the NFSv3 ACL protocol extension"
43 depends on NFS_V3
44 help
45 Some NFS servers support an auxiliary NFSv3 ACL protocol that
46 Sun added to Solaris but never became an official part of the
47 NFS version 3 protocol. This protocol extension allows
48 applications on NFS clients to manipulate POSIX Access Control
49 Lists on files residing on NFS servers. NFS servers enforce
50 ACLs on local files whether this protocol is available or not.
51
52 Choose Y here if your NFS server supports the Solaris NFSv3 ACL
53 protocol extension and you want your NFS client to allow
54 applications to access and modify ACLs on files on the server.
55
56 Most NFS servers don't support the Solaris NFSv3 ACL protocol
57 extension. You can choose N here or specify the "noacl" mount
58 option to prevent your NFS client from trying to use the NFSv3
59 ACL protocol.
60
61 If unsure, say N.
62
63config NFS_V4
64 bool "NFS client support for NFS version 4 (EXPERIMENTAL)"
65 depends on NFS_FS && EXPERIMENTAL
66 select RPCSEC_GSS_KRB5
67 help
68 This option enables support for version 4 of the NFS protocol
69 (RFC 3530) in the kernel's NFS client.
70
71 To mount NFS servers using NFSv4, you also need to install user
72 space programs which can be found in the Linux nfs-utils package,
73 available from http://linux-nfs.org/.
74
75 If unsure, say N.
76
77config ROOT_NFS
78 bool "Root file system on NFS"
79 depends on NFS_FS=y && IP_PNP
80 help
81 If you want your system to mount its root file system via NFS,
82 choose Y here. This is common practice for managing systems
83 without local permanent storage. For details, read
84 <file:Documentation/filesystems/nfsroot.txt>.
85
86 Most people say N here.
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig
new file mode 100644
index 000000000000..44d7d04dab95
--- /dev/null
+++ b/fs/nfsd/Kconfig
@@ -0,0 +1,80 @@
1config NFSD
2 tristate "NFS server support"
3 depends on INET
4 select LOCKD
5 select SUNRPC
6 select EXPORTFS
7 select NFS_ACL_SUPPORT if NFSD_V2_ACL
8 help
9 Choose Y here if you want to allow other computers to access
10 files residing on this system using Sun's Network File System
11 protocol. To compile the NFS server support as a module,
12 choose M here: the module will be called nfsd.
13
14 You may choose to use a user-space NFS server instead, in which
15 case you can choose N here.
16
17 To export local file systems using NFS, you also need to install
18 user space programs which can be found in the Linux nfs-utils
19 package, available from http://linux-nfs.org/. More detail about
20 the Linux NFS server implementation is available via the
21 exports(5) man page.
22
23 Below you can choose which versions of the NFS protocol are
24 available to clients mounting the NFS server on this system.
25 Support for NFS version 2 (RFC 1094) is always available when
26 CONFIG_NFSD is selected.
27
28 If unsure, say N.
29
30config NFSD_V2_ACL
31 bool
32 depends on NFSD
33
34config NFSD_V3
35 bool "NFS server support for NFS version 3"
36 depends on NFSD
37 help
38 This option enables support in your system's NFS server for
39 version 3 of the NFS protocol (RFC 1813).
40
41 If unsure, say Y.
42
43config NFSD_V3_ACL
44 bool "NFS server support for the NFSv3 ACL protocol extension"
45 depends on NFSD_V3
46 select NFSD_V2_ACL
47 help
48 Solaris NFS servers support an auxiliary NFSv3 ACL protocol that
49 never became an official part of the NFS version 3 protocol.
50 This protocol extension allows applications on NFS clients to
51 manipulate POSIX Access Control Lists on files residing on NFS
52 servers. NFS servers enforce POSIX ACLs on local files whether
53 this protocol is available or not.
54
55 This option enables support in your system's NFS server for the
56 NFSv3 ACL protocol extension allowing NFS clients to manipulate
57 POSIX ACLs on files exported by your system's NFS server. NFS
58 clients which support the Solaris NFSv3 ACL protocol can then
59 access and modify ACLs on your NFS server.
60
61 To store ACLs on your NFS server, you also need to enable ACL-
62 related CONFIG options for your local file systems of choice.
63
64 If unsure, say N.
65
66config NFSD_V4
67 bool "NFS server support for NFS version 4 (EXPERIMENTAL)"
68 depends on NFSD && PROC_FS && EXPERIMENTAL
69 select NFSD_V3
70 select FS_POSIX_ACL
71 select RPCSEC_GSS_KRB5
72 help
73 This option enables support in your system's NFS server for
74 version 4 of the NFS protocol (RFC 3530).
75
76 To export files using NFSv4, you need to install additional user
77 space programs which can be found in the Linux nfs-utils package,
78 available from http://linux-nfs.org/.
79
80 If unsure, say N.
diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
index c903e04aa217..5573508f707f 100644
--- a/fs/nfsd/auth.c
+++ b/fs/nfsd/auth.c
@@ -49,6 +49,8 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
49 new->fsuid = exp->ex_anon_uid; 49 new->fsuid = exp->ex_anon_uid;
50 new->fsgid = exp->ex_anon_gid; 50 new->fsgid = exp->ex_anon_gid;
51 gi = groups_alloc(0); 51 gi = groups_alloc(0);
52 if (!gi)
53 goto oom;
52 } else if (flags & NFSEXP_ROOTSQUASH) { 54 } else if (flags & NFSEXP_ROOTSQUASH) {
53 if (!new->fsuid) 55 if (!new->fsuid)
54 new->fsuid = exp->ex_anon_uid; 56 new->fsuid = exp->ex_anon_uid;
@@ -85,6 +87,7 @@ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
85 new->cap_effective = cap_raise_nfsd_set(new->cap_effective, 87 new->cap_effective = cap_raise_nfsd_set(new->cap_effective,
86 new->cap_permitted); 88 new->cap_permitted);
87 put_cred(override_creds(new)); 89 put_cred(override_creds(new));
90 put_cred(new);
88 return 0; 91 return 0;
89 92
90oom: 93oom:
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 88db7d3ec120..b6f60f48e94b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2871,7 +2871,6 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2871 file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner; 2871 file_lock.fl_owner = (fl_owner_t)lockt->lt_stateowner;
2872 file_lock.fl_pid = current->tgid; 2872 file_lock.fl_pid = current->tgid;
2873 file_lock.fl_flags = FL_POSIX; 2873 file_lock.fl_flags = FL_POSIX;
2874 file_lock.fl_lmops = &nfsd_posix_mng_ops;
2875 2874
2876 file_lock.fl_start = lockt->lt_offset; 2875 file_lock.fl_start = lockt->lt_offset;
2877 file_lock.fl_end = last_byte_offset(lockt->lt_offset, lockt->lt_length); 2876 file_lock.fl_end = last_byte_offset(lockt->lt_offset, lockt->lt_length);
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index d53a1838d6e8..bed766e435b5 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -427,10 +427,61 @@ static unsigned int inotify_poll(struct file *file, poll_table *wait)
427 return ret; 427 return ret;
428} 428}
429 429
430/*
431 * Get an inotify_kernel_event if one exists and is small
432 * enough to fit in "count". Return an error pointer if
433 * not large enough.
434 *
435 * Called with the device ev_mutex held.
436 */
437static struct inotify_kernel_event *get_one_event(struct inotify_device *dev,
438 size_t count)
439{
440 size_t event_size = sizeof(struct inotify_event);
441 struct inotify_kernel_event *kevent;
442
443 if (list_empty(&dev->events))
444 return NULL;
445
446 kevent = inotify_dev_get_event(dev);
447 if (kevent->name)
448 event_size += kevent->event.len;
449
450 if (event_size > count)
451 return ERR_PTR(-EINVAL);
452
453 remove_kevent(dev, kevent);
454 return kevent;
455}
456
457/*
458 * Copy an event to user space, returning how much we copied.
459 *
460 * We already checked that the event size is smaller than the
461 * buffer we had in "get_one_event()" above.
462 */
463static ssize_t copy_event_to_user(struct inotify_kernel_event *kevent,
464 char __user *buf)
465{
466 size_t event_size = sizeof(struct inotify_event);
467
468 if (copy_to_user(buf, &kevent->event, event_size))
469 return -EFAULT;
470
471 if (kevent->name) {
472 buf += event_size;
473
474 if (copy_to_user(buf, kevent->name, kevent->event.len))
475 return -EFAULT;
476
477 event_size += kevent->event.len;
478 }
479 return event_size;
480}
481
430static ssize_t inotify_read(struct file *file, char __user *buf, 482static ssize_t inotify_read(struct file *file, char __user *buf,
431 size_t count, loff_t *pos) 483 size_t count, loff_t *pos)
432{ 484{
433 size_t event_size = sizeof (struct inotify_event);
434 struct inotify_device *dev; 485 struct inotify_device *dev;
435 char __user *start; 486 char __user *start;
436 int ret; 487 int ret;
@@ -440,81 +491,43 @@ static ssize_t inotify_read(struct file *file, char __user *buf,
440 dev = file->private_data; 491 dev = file->private_data;
441 492
442 while (1) { 493 while (1) {
494 struct inotify_kernel_event *kevent;
443 495
444 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE); 496 prepare_to_wait(&dev->wq, &wait, TASK_INTERRUPTIBLE);
445 497
446 mutex_lock(&dev->ev_mutex); 498 mutex_lock(&dev->ev_mutex);
447 if (!list_empty(&dev->events)) { 499 kevent = get_one_event(dev, count);
448 ret = 0;
449 break;
450 }
451 mutex_unlock(&dev->ev_mutex); 500 mutex_unlock(&dev->ev_mutex);
452 501
453 if (file->f_flags & O_NONBLOCK) { 502 if (kevent) {
454 ret = -EAGAIN; 503 ret = PTR_ERR(kevent);
455 break; 504 if (IS_ERR(kevent))
456 } 505 break;
457 506 ret = copy_event_to_user(kevent, buf);
458 if (signal_pending(current)) { 507 free_kevent(kevent);
459 ret = -EINTR; 508 if (ret < 0)
460 break; 509 break;
510 buf += ret;
511 count -= ret;
512 continue;
461 } 513 }
462 514
463 schedule(); 515 ret = -EAGAIN;
464 } 516 if (file->f_flags & O_NONBLOCK)
465
466 finish_wait(&dev->wq, &wait);
467 if (ret)
468 return ret;
469
470 while (1) {
471 struct inotify_kernel_event *kevent;
472
473 ret = buf - start;
474 if (list_empty(&dev->events))
475 break; 517 break;
476 518 ret = -EINTR;
477 kevent = inotify_dev_get_event(dev); 519 if (signal_pending(current))
478 if (event_size + kevent->event.len > count) {
479 if (ret == 0 && count > 0) {
480 /*
481 * could not get a single event because we
482 * didn't have enough buffer space.
483 */
484 ret = -EINVAL;
485 }
486 break; 520 break;
487 }
488 remove_kevent(dev, kevent);
489 521
490 /* 522 if (start != buf)
491 * Must perform the copy_to_user outside the mutex in order
492 * to avoid a lock order reversal with mmap_sem.
493 */
494 mutex_unlock(&dev->ev_mutex);
495
496 if (copy_to_user(buf, &kevent->event, event_size)) {
497 ret = -EFAULT;
498 break; 523 break;
499 }
500 buf += event_size;
501 count -= event_size;
502
503 if (kevent->name) {
504 if (copy_to_user(buf, kevent->name, kevent->event.len)){
505 ret = -EFAULT;
506 break;
507 }
508 buf += kevent->event.len;
509 count -= kevent->event.len;
510 }
511
512 free_kevent(kevent);
513 524
514 mutex_lock(&dev->ev_mutex); 525 schedule();
515 } 526 }
516 mutex_unlock(&dev->ev_mutex);
517 527
528 finish_wait(&dev->wq, &wait);
529 if (start != buf && ret != -EFAULT)
530 ret = buf - start;
518 return ret; 531 return ret;
519} 532}
520 533
diff --git a/fs/ntfs/Kconfig b/fs/ntfs/Kconfig
new file mode 100644
index 000000000000..f5a868cc9152
--- /dev/null
+++ b/fs/ntfs/Kconfig
@@ -0,0 +1,78 @@
1config NTFS_FS
2 tristate "NTFS file system support"
3 select NLS
4 help
5 NTFS is the file system of Microsoft Windows NT, 2000, XP and 2003.
6
7 Saying Y or M here enables read support. There is partial, but
8 safe, write support available. For write support you must also
9 say Y to "NTFS write support" below.
10
11 There are also a number of user-space tools available, called
12 ntfsprogs. These include ntfsundelete and ntfsresize, that work
13 without NTFS support enabled in the kernel.
14
15 This is a rewrite from scratch of Linux NTFS support and replaced
16 the old NTFS code starting with Linux 2.5.11. A backport to
17 the Linux 2.4 kernel series is separately available as a patch
18 from the project web site.
19
20 For more information see <file:Documentation/filesystems/ntfs.txt>
21 and <http://www.linux-ntfs.org/>.
22
23 To compile this file system support as a module, choose M here: the
24 module will be called ntfs.
25
26 If you are not using Windows NT, 2000, XP or 2003 in addition to
27 Linux on your computer it is safe to say N.
28
29config NTFS_DEBUG
30 bool "NTFS debugging support"
31 depends on NTFS_FS
32 help
33 If you are experiencing any problems with the NTFS file system, say
34 Y here. This will result in additional consistency checks to be
35 performed by the driver as well as additional debugging messages to
36 be written to the system log. Note that debugging messages are
37 disabled by default. To enable them, supply the option debug_msgs=1
38 at the kernel command line when booting the kernel or as an option
39 to insmod when loading the ntfs module. Once the driver is active,
40 you can enable debugging messages by doing (as root):
41 echo 1 > /proc/sys/fs/ntfs-debug
42 Replacing the "1" with "0" would disable debug messages.
43
44 If you leave debugging messages disabled, this results in little
45 overhead, but enabling debug messages results in very significant
46 slowdown of the system.
47
48 When reporting bugs, please try to have available a full dump of
49 debugging messages while the misbehaviour was occurring.
50
51config NTFS_RW
52 bool "NTFS write support"
53 depends on NTFS_FS
54 help
55 This enables the partial, but safe, write support in the NTFS driver.
56
57 The only supported operation is overwriting existing files, without
58 changing the file length. No file or directory creation, deletion or
59 renaming is possible. Note only non-resident files can be written to
60 so you may find that some very small files (<500 bytes or so) cannot
61 be written to.
62
63 While we cannot guarantee that it will not damage any data, we have
64 so far not received a single report where the driver would have
65 damaged someones data so we assume it is perfectly safe to use.
66
67 Note: While write support is safe in this version (a rewrite from
68 scratch of the NTFS support), it should be noted that the old NTFS
69 write support, included in Linux 2.5.10 and before (since 1997),
70 is not safe.
71
72 This is currently useful with TopologiLinux. TopologiLinux is run
73 on top of any DOS/Microsoft Windows system without partitioning your
74 hard disk. Unlike other Linux distributions TopologiLinux does not
75 need its own partition. For more information see
76 <http://topologi-linux.sourceforge.net/>
77
78 It is perfectly safe to say N here.
diff --git a/fs/ocfs2/Kconfig b/fs/ocfs2/Kconfig
new file mode 100644
index 000000000000..701b7a3a872e
--- /dev/null
+++ b/fs/ocfs2/Kconfig
@@ -0,0 +1,85 @@
1config OCFS2_FS
2 tristate "OCFS2 file system support"
3 depends on NET && SYSFS
4 select CONFIGFS_FS
5 select JBD2
6 select CRC32
7 select QUOTA
8 select QUOTA_TREE
9 help
10 OCFS2 is a general purpose extent based shared disk cluster file
11 system with many similarities to ext3. It supports 64 bit inode
12 numbers, and has automatically extending metadata groups which may
13 also make it attractive for non-clustered use.
14
15 You'll want to install the ocfs2-tools package in order to at least
16 get "mount.ocfs2".
17
18 Project web page: http://oss.oracle.com/projects/ocfs2
19 Tools web page: http://oss.oracle.com/projects/ocfs2-tools
20 OCFS2 mailing lists: http://oss.oracle.com/projects/ocfs2/mailman/
21
22 For more information on OCFS2, see the file
23 <file:Documentation/filesystems/ocfs2.txt>.
24
25config OCFS2_FS_O2CB
26 tristate "O2CB Kernelspace Clustering"
27 depends on OCFS2_FS
28 default y
29 help
30 OCFS2 includes a simple kernelspace clustering package, the OCFS2
31 Cluster Base. It only requires a very small userspace component
32 to configure it. This comes with the standard ocfs2-tools package.
33 O2CB is limited to maintaining a cluster for OCFS2 file systems.
34 It cannot manage any other cluster applications.
35
36 It is always safe to say Y here, as the clustering method is
37 run-time selectable.
38
39config OCFS2_FS_USERSPACE_CLUSTER
40 tristate "OCFS2 Userspace Clustering"
41 depends on OCFS2_FS && DLM
42 default y
43 help
44 This option will allow OCFS2 to use userspace clustering services
45 in conjunction with the DLM in fs/dlm. If you are using a
46 userspace cluster manager, say Y here.
47
48 It is safe to say Y, as the clustering method is run-time
49 selectable.
50
51config OCFS2_FS_STATS
52 bool "OCFS2 statistics"
53 depends on OCFS2_FS
54 default y
55 help
56 This option allows some fs statistics to be captured. Enabling
57 this option may increase the memory consumption.
58
59config OCFS2_DEBUG_MASKLOG
60 bool "OCFS2 logging support"
61 depends on OCFS2_FS
62 default y
63 help
64 The ocfs2 filesystem has an extensive logging system. The system
65 allows selection of events to log via files in /sys/o2cb/logmask/.
66 This option will enlarge your kernel, but it allows debugging of
67 ocfs2 filesystem issues.
68
69config OCFS2_DEBUG_FS
70 bool "OCFS2 expensive checks"
71 depends on OCFS2_FS
72 default n
73 help
74 This option will enable expensive consistency checks. Enable
75 this option for debugging only as it is likely to decrease
76 performance of the filesystem.
77
78config OCFS2_FS_POSIX_ACL
79 bool "OCFS2 POSIX Access Control Lists"
80 depends on OCFS2_FS
81 select FS_POSIX_ACL
82 default n
83 help
84 Posix Access Control Lists (ACLs) support permissions for users and
85 groups beyond the owner/group/world scheme.
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
index 6aff8f2d3e49..f4efa89baee5 100644
--- a/fs/ocfs2/quota_global.c
+++ b/fs/ocfs2/quota_global.c
@@ -810,171 +810,6 @@ out:
810 return status; 810 return status;
811} 811}
812 812
813/* This is difficult. We have to lock quota inode and start transaction
814 * in this function but we don't want to take the penalty of exlusive
815 * quota file lock when we are just going to use cached structures. So
816 * we just take read lock check whether we have dquot cached and if so,
817 * we don't have to take the write lock... */
818static int ocfs2_dquot_initialize(struct inode *inode, int type)
819{
820 handle_t *handle = NULL;
821 int status = 0;
822 struct super_block *sb = inode->i_sb;
823 struct ocfs2_mem_dqinfo *oinfo;
824 int exclusive = 0;
825 int cnt;
826 qid_t id;
827
828 mlog_entry_void();
829
830 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
831 if (type != -1 && cnt != type)
832 continue;
833 if (!sb_has_quota_active(sb, cnt))
834 continue;
835 oinfo = sb_dqinfo(sb, cnt)->dqi_priv;
836 status = ocfs2_lock_global_qf(oinfo, 0);
837 if (status < 0)
838 goto out;
839 /* This is just a performance optimization not a reliable test.
840 * Since we hold an inode lock, noone can actually release
841 * the structure until we are finished with initialization. */
842 if (inode->i_dquot[cnt] != NODQUOT) {
843 ocfs2_unlock_global_qf(oinfo, 0);
844 continue;
845 }
846 /* When we have inode lock, we know that no dquot_release() can
847 * run and thus we can safely check whether we need to
848 * read+modify global file to get quota information or whether
849 * our node already has it. */
850 if (cnt == USRQUOTA)
851 id = inode->i_uid;
852 else if (cnt == GRPQUOTA)
853 id = inode->i_gid;
854 else
855 BUG();
856 /* Obtain exclusion from quota off... */
857 down_write(&sb_dqopt(sb)->dqptr_sem);
858 exclusive = !dquot_is_cached(sb, id, cnt);
859 up_write(&sb_dqopt(sb)->dqptr_sem);
860 if (exclusive) {
861 status = ocfs2_lock_global_qf(oinfo, 1);
862 if (status < 0) {
863 exclusive = 0;
864 mlog_errno(status);
865 goto out_ilock;
866 }
867 handle = ocfs2_start_trans(OCFS2_SB(sb),
868 ocfs2_calc_qinit_credits(sb, cnt));
869 if (IS_ERR(handle)) {
870 status = PTR_ERR(handle);
871 mlog_errno(status);
872 goto out_ilock;
873 }
874 }
875 dquot_initialize(inode, cnt);
876 if (exclusive) {
877 ocfs2_commit_trans(OCFS2_SB(sb), handle);
878 ocfs2_unlock_global_qf(oinfo, 1);
879 }
880 ocfs2_unlock_global_qf(oinfo, 0);
881 }
882 mlog_exit(0);
883 return 0;
884out_ilock:
885 if (exclusive)
886 ocfs2_unlock_global_qf(oinfo, 1);
887 ocfs2_unlock_global_qf(oinfo, 0);
888out:
889 mlog_exit(status);
890 return status;
891}
892
893static int ocfs2_dquot_drop_slow(struct inode *inode)
894{
895 int status = 0;
896 int cnt;
897 int got_lock[MAXQUOTAS] = {0, 0};
898 handle_t *handle;
899 struct super_block *sb = inode->i_sb;
900 struct ocfs2_mem_dqinfo *oinfo;
901
902 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
903 if (!sb_has_quota_active(sb, cnt))
904 continue;
905 oinfo = sb_dqinfo(sb, cnt)->dqi_priv;
906 status = ocfs2_lock_global_qf(oinfo, 1);
907 if (status < 0)
908 goto out;
909 got_lock[cnt] = 1;
910 }
911 handle = ocfs2_start_trans(OCFS2_SB(sb),
912 ocfs2_calc_qinit_credits(sb, USRQUOTA) +
913 ocfs2_calc_qinit_credits(sb, GRPQUOTA));
914 if (IS_ERR(handle)) {
915 status = PTR_ERR(handle);
916 mlog_errno(status);
917 goto out;
918 }
919 dquot_drop(inode);
920 ocfs2_commit_trans(OCFS2_SB(sb), handle);
921out:
922 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
923 if (got_lock[cnt]) {
924 oinfo = sb_dqinfo(sb, cnt)->dqi_priv;
925 ocfs2_unlock_global_qf(oinfo, 1);
926 }
927 return status;
928}
929
930/* See the comment before ocfs2_dquot_initialize. */
931static int ocfs2_dquot_drop(struct inode *inode)
932{
933 int status = 0;
934 struct super_block *sb = inode->i_sb;
935 struct ocfs2_mem_dqinfo *oinfo;
936 int exclusive = 0;
937 int cnt;
938 int got_lock[MAXQUOTAS] = {0, 0};
939
940 mlog_entry_void();
941 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
942 if (!sb_has_quota_active(sb, cnt))
943 continue;
944 oinfo = sb_dqinfo(sb, cnt)->dqi_priv;
945 status = ocfs2_lock_global_qf(oinfo, 0);
946 if (status < 0)
947 goto out;
948 got_lock[cnt] = 1;
949 }
950 /* Lock against anyone releasing references so that when when we check
951 * we know we are not going to be last ones to release dquot */
952 down_write(&sb_dqopt(sb)->dqptr_sem);
953 /* Urgh, this is a terrible hack :( */
954 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
955 if (inode->i_dquot[cnt] != NODQUOT &&
956 atomic_read(&inode->i_dquot[cnt]->dq_count) > 1) {
957 exclusive = 1;
958 break;
959 }
960 }
961 if (!exclusive)
962 dquot_drop_locked(inode);
963 up_write(&sb_dqopt(sb)->dqptr_sem);
964out:
965 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
966 if (got_lock[cnt]) {
967 oinfo = sb_dqinfo(sb, cnt)->dqi_priv;
968 ocfs2_unlock_global_qf(oinfo, 0);
969 }
970 /* In case we bailed out because we had to do expensive locking
971 * do it now... */
972 if (exclusive)
973 status = ocfs2_dquot_drop_slow(inode);
974 mlog_exit(status);
975 return status;
976}
977
978static struct dquot *ocfs2_alloc_dquot(struct super_block *sb, int type) 813static struct dquot *ocfs2_alloc_dquot(struct super_block *sb, int type)
979{ 814{
980 struct ocfs2_dquot *dquot = 815 struct ocfs2_dquot *dquot =
@@ -991,8 +826,8 @@ static void ocfs2_destroy_dquot(struct dquot *dquot)
991} 826}
992 827
993struct dquot_operations ocfs2_quota_operations = { 828struct dquot_operations ocfs2_quota_operations = {
994 .initialize = ocfs2_dquot_initialize, 829 .initialize = dquot_initialize,
995 .drop = ocfs2_dquot_drop, 830 .drop = dquot_drop,
996 .alloc_space = dquot_alloc_space, 831 .alloc_space = dquot_alloc_space,
997 .alloc_inode = dquot_alloc_inode, 832 .alloc_inode = dquot_alloc_inode,
998 .free_space = dquot_free_space, 833 .free_space = dquot_free_space,
diff --git a/fs/omfs/Kconfig b/fs/omfs/Kconfig
new file mode 100644
index 000000000000..b1b9a0aba6fd
--- /dev/null
+++ b/fs/omfs/Kconfig
@@ -0,0 +1,13 @@
1config OMFS_FS
2 tristate "SonicBlue Optimized MPEG File System support"
3 depends on BLOCK
4 select CRC_ITU_T
5 help
6 This is the proprietary file system used by the Rio Karma music
7 player and ReplayTV DVR. Despite the name, this filesystem is not
8 more efficient than a standard FS for MPEG files, in fact likely
9 the opposite is true. Say Y if you have either of these devices
10 and wish to mount its disk.
11
12 To compile this file system support as a module, choose M here: the
13 module will be called omfs. If unsure, say N.
diff --git a/fs/qnx4/Kconfig b/fs/qnx4/Kconfig
new file mode 100644
index 000000000000..be8e0e1445b6
--- /dev/null
+++ b/fs/qnx4/Kconfig
@@ -0,0 +1,25 @@
1config QNX4FS_FS
2 tristate "QNX4 file system support (read only)"
3 depends on BLOCK
4 help
5 This is the file system used by the real-time operating systems
6 QNX 4 and QNX 6 (the latter is also called QNX RTP).
7 Further information is available at <http://www.qnx.com/>.
8 Say Y if you intend to mount QNX hard disks or floppies.
9 Unless you say Y to "QNX4FS read-write support" below, you will
10 only be able to read these file systems.
11
12 To compile this file system support as a module, choose M here: the
13 module will be called qnx4.
14
15 If you don't know whether you need it, then you don't need it:
16 answer N.
17
18config QNX4FS_RW
19 bool "QNX4FS write support (DANGEROUS)"
20 depends on QNX4FS_FS && EXPERIMENTAL && BROKEN
21 help
22 Say Y if you want to test write support for QNX4 file systems.
23
24 It's currently broken, so for now:
25 answer N.
diff --git a/fs/reiserfs/Kconfig b/fs/reiserfs/Kconfig
new file mode 100644
index 000000000000..949b8c6addc8
--- /dev/null
+++ b/fs/reiserfs/Kconfig
@@ -0,0 +1,85 @@
1config REISERFS_FS
2 tristate "Reiserfs support"
3 help
4 Stores not just filenames but the files themselves in a balanced
5 tree. Uses journalling.
6
7 Balanced trees are more efficient than traditional file system
8 architectural foundations.
9
10 In general, ReiserFS is as fast as ext2, but is very efficient with
11 large directories and small files. Additional patches are needed
12 for NFS and quotas, please see <http://www.namesys.com/> for links.
13
14 It is more easily extended to have features currently found in
15 database and keyword search systems than block allocation based file
16 systems are. The next version will be so extended, and will support
17 plugins consistent with our motto ``It takes more than a license to
18 make source code open.''
19
20 Read <http://www.namesys.com/> to learn more about reiserfs.
21
22 Sponsored by Threshold Networks, Emusic.com, and Bigstorage.com.
23
24 If you like it, you can pay us to add new features to it that you
25 need, buy a support contract, or pay us to port it to another OS.
26
27config REISERFS_CHECK
28 bool "Enable reiserfs debug mode"
29 depends on REISERFS_FS
30 help
31 If you set this to Y, then ReiserFS will perform every check it can
32 possibly imagine of its internal consistency throughout its
33 operation. It will also go substantially slower. More than once we
34 have forgotten that this was on, and then gone despondent over the
35 latest benchmarks.:-) Use of this option allows our team to go all
36 out in checking for consistency when debugging without fear of its
37 effect on end users. If you are on the verge of sending in a bug
38 report, say Y and you might get a useful error message. Almost
39 everyone should say N.
40
41config REISERFS_PROC_INFO
42 bool "Stats in /proc/fs/reiserfs"
43 depends on REISERFS_FS && PROC_FS
44 help
45 Create under /proc/fs/reiserfs a hierarchy of files, displaying
46 various ReiserFS statistics and internal data at the expense of
47 making your kernel or module slightly larger (+8 KB). This also
48 increases the amount of kernel memory required for each mount.
49 Almost everyone but ReiserFS developers and people fine-tuning
50 reiserfs or tracing problems should say N.
51
52config REISERFS_FS_XATTR
53 bool "ReiserFS extended attributes"
54 depends on REISERFS_FS
55 help
56 Extended attributes are name:value pairs associated with inodes by
57 the kernel or by users (see the attr(5) manual page, or visit
58 <http://acl.bestbits.at/> for details).
59
60 If unsure, say N.
61
62config REISERFS_FS_POSIX_ACL
63 bool "ReiserFS POSIX Access Control Lists"
64 depends on REISERFS_FS_XATTR
65 select FS_POSIX_ACL
66 help
67 Posix Access Control Lists (ACLs) support permissions for users and
68 groups beyond the owner/group/world scheme.
69
70 To learn more about Access Control Lists, visit the Posix ACLs for
71 Linux website <http://acl.bestbits.at/>.
72
73 If you don't know what Access Control Lists are, say N
74
75config REISERFS_FS_SECURITY
76 bool "ReiserFS Security Labels"
77 depends on REISERFS_FS_XATTR
78 help
79 Security labels support alternative access control models
80 implemented by security modules like SELinux. This option
81 enables an extended attribute handler for file security
82 labels in the ReiserFS filesystem.
83
84 If you are not using a security module that requires using
85 extended attributes for file security labels, say N.
diff --git a/fs/romfs/Kconfig b/fs/romfs/Kconfig
new file mode 100644
index 000000000000..1a17020f9faf
--- /dev/null
+++ b/fs/romfs/Kconfig
@@ -0,0 +1,16 @@
1config ROMFS_FS
2 tristate "ROM file system support"
3 depends on BLOCK
4 ---help---
5 This is a very small read-only file system mainly intended for
6 initial ram disks of installation disks, but it could be used for
7 other read-only media as well. Read
8 <file:Documentation/filesystems/romfs.txt> for details.
9
10 To compile this file system support as a module, choose M here: the
11 module will be called romfs. Note that the file system of your
12 root partition (the one containing the directory /) cannot be a
13 module.
14
15 If you don't know whether you need it, then you don't need it:
16 answer N.
diff --git a/fs/smbfs/Kconfig b/fs/smbfs/Kconfig
new file mode 100644
index 000000000000..e668127c8b2e
--- /dev/null
+++ b/fs/smbfs/Kconfig
@@ -0,0 +1,55 @@
1config SMB_FS
2 tristate "SMB file system support (OBSOLETE, please use CIFS)"
3 depends on INET
4 select NLS
5 help
6 SMB (Server Message Block) is the protocol Windows for Workgroups
7 (WfW), Windows 95/98, Windows NT and OS/2 Lan Manager use to share
8 files and printers over local networks. Saying Y here allows you to
9 mount their file systems (often called "shares" in this context) and
10 access them just like any other Unix directory. Currently, this
11 works only if the Windows machines use TCP/IP as the underlying
12 transport protocol, and not NetBEUI. For details, read
13 <file:Documentation/filesystems/smbfs.txt> and the SMB-HOWTO,
14 available from <http://www.tldp.org/docs.html#howto>.
15
16 Note: if you just want your box to act as an SMB *server* and make
17 files and printing services available to Windows clients (which need
18 to have a TCP/IP stack), you don't need to say Y here; you can use
19 the program SAMBA (available from <ftp://ftp.samba.org/pub/samba/>)
20 for that.
21
22 General information about how to connect Linux, Windows machines and
23 Macs is on the WWW at <http://www.eats.com/linux_mac_win.html>.
24
25 To compile the SMB support as a module, choose M here:
26 the module will be called smbfs. Most people say N, however.
27
28config SMB_NLS_DEFAULT
29 bool "Use a default NLS"
30 depends on SMB_FS
31 help
32 Enabling this will make smbfs use nls translations by default. You
33 need to specify the local charset (CONFIG_NLS_DEFAULT) in the nls
34 settings and you need to give the default nls for the SMB server as
35 CONFIG_SMB_NLS_REMOTE.
36
37 The nls settings can be changed at mount time, if your smbmount
38 supports that, using the codepage and iocharset parameters.
39
40 smbmount from samba 2.2.0 or later supports this.
41
42config SMB_NLS_REMOTE
43 string "Default Remote NLS Option"
44 depends on SMB_NLS_DEFAULT
45 default "cp437"
46 help
47 This setting allows you to specify a default value for which
48 codepage the server uses. If this field is left blank no
49 translations will be done by default. The local codepage/charset
50 default to CONFIG_NLS_DEFAULT.
51
52 The nls settings can be changed at mount time, if your smbmount
53 supports that, using the codepage and iocharset parameters.
54
55 smbmount from samba 2.2.0 or later supports this.
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
new file mode 100644
index 000000000000..25a00d19d686
--- /dev/null
+++ b/fs/squashfs/Kconfig
@@ -0,0 +1,51 @@
1config SQUASHFS
2 tristate "SquashFS 4.0 - Squashed file system support"
3 depends on BLOCK
4 select ZLIB_INFLATE
5 help
6 Saying Y here includes support for SquashFS 4.0 (a Compressed
7 Read-Only File System). Squashfs is a highly compressed read-only
8 filesystem for Linux. It uses zlib compression to compress both
9 files, inodes and directories. Inodes in the system are very small
10 and all blocks are packed to minimise data overhead. Block sizes
11 greater than 4K are supported up to a maximum of 1 Mbytes (default
12 block size 128K). SquashFS 4.0 supports 64 bit filesystems and files
13 (larger than 4GB), full uid/gid information, hard links and
14 timestamps.
15
16 Squashfs is intended for general read-only filesystem use, for
17 archival use (i.e. in cases where a .tar.gz file may be used), and in
18 embedded systems where low overhead is needed. Further information
19 and tools are available from http://squashfs.sourceforge.net.
20
21 If you want to compile this as a module ( = code which can be
22 inserted in and removed from the running kernel whenever you want),
23 say M here and read <file:Documentation/modules.txt>. The module
24 will be called squashfs. Note that the root file system (the one
25 containing the directory /) cannot be compiled as a module.
26
27 If unsure, say N.
28
29config SQUASHFS_EMBEDDED
30
31 bool "Additional option for memory-constrained systems"
32 depends on SQUASHFS
33 default n
34 help
35 Saying Y here allows you to specify cache size.
36
37 If unsure, say N.
38
39config SQUASHFS_FRAGMENT_CACHE_SIZE
40 int "Number of fragments cached" if SQUASHFS_EMBEDDED
41 depends on SQUASHFS
42 default "3"
43 help
44 By default SquashFS caches the last 3 fragments read from
45 the filesystem. Increasing this amount may mean SquashFS
46 has to re-read fragments less often from disk, at the expense
47 of extra system memory. Decreasing this amount will mean
48 SquashFS uses less memory at the expense of extra reads from disk.
49
50 Note there must be at least one cached fragment. Anything
51 much more than three will probably not make much difference.
diff --git a/fs/sysfs/Kconfig b/fs/sysfs/Kconfig
new file mode 100644
index 000000000000..f4b67588b9d6
--- /dev/null
+++ b/fs/sysfs/Kconfig
@@ -0,0 +1,23 @@
1config SYSFS
2 bool "sysfs file system support" if EMBEDDED
3 default y
4 help
5 The sysfs filesystem is a virtual filesystem that the kernel uses to
6 export internal kernel objects, their attributes, and their
7 relationships to one another.
8
9 Users can use sysfs to ascertain useful information about the running
10 kernel, such as the devices the kernel has discovered on each bus and
11 which driver each is bound to. sysfs can also be used to tune devices
12 and other kernel subsystems.
13
14 Some system agents rely on the information in sysfs to operate.
15 /sbin/hotplug uses device and object attributes in sysfs to assist in
16 delegating policy decisions, like persistently naming devices.
17
18 sysfs is currently used by the block subsystem to mount the root
19 partition. If sysfs is disabled you must specify the boot device on
20 the kernel boot command line via its major and minor numbers. For
21 example, "root=03:01" for /dev/hda1.
22
23 Designers of embedded systems may wish to say N here to conserve space.
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c
index 66f6e58a7e4b..f2c478c3424e 100644
--- a/fs/sysfs/bin.c
+++ b/fs/sysfs/bin.c
@@ -63,6 +63,9 @@ read(struct file *file, char __user *userbuf, size_t bytes, loff_t *off)
63 int count = min_t(size_t, bytes, PAGE_SIZE); 63 int count = min_t(size_t, bytes, PAGE_SIZE);
64 char *temp; 64 char *temp;
65 65
66 if (!bytes)
67 return 0;
68
66 if (size) { 69 if (size) {
67 if (offs > size) 70 if (offs > size)
68 return 0; 71 return 0;
@@ -131,6 +134,9 @@ static ssize_t write(struct file *file, const char __user *userbuf,
131 int count = min_t(size_t, bytes, PAGE_SIZE); 134 int count = min_t(size_t, bytes, PAGE_SIZE);
132 char *temp; 135 char *temp;
133 136
137 if (!bytes)
138 return 0;
139
134 if (size) { 140 if (size) {
135 if (offs > size) 141 if (offs > size)
136 return 0; 142 return 0;
diff --git a/fs/sysv/Kconfig b/fs/sysv/Kconfig
new file mode 100644
index 000000000000..33aeb4b75db1
--- /dev/null
+++ b/fs/sysv/Kconfig
@@ -0,0 +1,36 @@
1config SYSV_FS
2 tristate "System V/Xenix/V7/Coherent file system support"
3 depends on BLOCK
4 help
5 SCO, Xenix and Coherent are commercial Unix systems for Intel
6 machines, and Version 7 was used on the DEC PDP-11. Saying Y
7 here would allow you to read from their floppies and hard disk
8 partitions.
9
10 If you have floppies or hard disk partitions like that, it is likely
11 that they contain binaries from those other Unix systems; in order
12 to run these binaries, you will want to install linux-abi which is
13 a set of kernel modules that lets you run SCO, Xenix, Wyse,
14 UnixWare, Dell Unix and System V programs under Linux. It is
15 available via FTP (user: ftp) from
16 <ftp://ftp.openlinux.org/pub/people/hch/linux-abi/>).
17 NOTE: that will work only for binaries from Intel-based systems;
18 PDP ones will have to wait until somebody ports Linux to -11 ;-)
19
20 If you only intend to mount files from some other Unix over the
21 network using NFS, you don't need the System V file system support
22 (but you need NFS file system support obviously).
23
24 Note that this option is generally not needed for floppies, since a
25 good portable way to transport files and directories between unixes
26 (and even other operating systems) is given by the tar program ("man
27 tar" or preferably "info tar"). Note also that this option has
28 nothing whatsoever to do with the option "System V IPC". Read about
29 the System V file system in
30 <file:Documentation/filesystems/sysv-fs.txt>.
31 Saying Y here will enlarge your kernel by about 27 KB.
32
33 To compile this as a module, choose M here: the module will be called
34 sysv.
35
36 If you haven't heard about all of this before, it's safe to say N.
diff --git a/fs/udf/Kconfig b/fs/udf/Kconfig
new file mode 100644
index 000000000000..0e0e99bd6bce
--- /dev/null
+++ b/fs/udf/Kconfig
@@ -0,0 +1,18 @@
1config UDF_FS
2 tristate "UDF file system support"
3 select CRC_ITU_T
4 help
5 This is the new file system used on some CD-ROMs and DVDs. Say Y if
6 you intend to mount DVD discs or CDRW's written in packet mode, or
7 if written to by other UDF utilities, such as DirectCD.
8 Please read <file:Documentation/filesystems/udf.txt>.
9
10 To compile this file system support as a module, choose M here: the
11 module will be called udf.
12
13 If unsure, say N.
14
15config UDF_NLS
16 bool
17 default y
18 depends on (UDF_FS=m && NLS) || (UDF_FS=y && NLS=y)
diff --git a/fs/ufs/Kconfig b/fs/ufs/Kconfig
new file mode 100644
index 000000000000..e4f10a40768a
--- /dev/null
+++ b/fs/ufs/Kconfig
@@ -0,0 +1,43 @@
1config UFS_FS
2 tristate "UFS file system support (read only)"
3 depends on BLOCK
4 help
5 BSD and derivate versions of Unix (such as SunOS, FreeBSD, NetBSD,
6 OpenBSD and NeXTstep) use a file system called UFS. Some System V
7 Unixes can create and mount hard disk partitions and diskettes using
8 this file system as well. Saying Y here will allow you to read from
9 these partitions; if you also want to write to them, say Y to the
10 experimental "UFS file system write support", below. Please read the
11 file <file:Documentation/filesystems/ufs.txt> for more information.
12
13 The recently released UFS2 variant (used in FreeBSD 5.x) is
14 READ-ONLY supported.
15
16 Note that this option is generally not needed for floppies, since a
17 good portable way to transport files and directories between unixes
18 (and even other operating systems) is given by the tar program ("man
19 tar" or preferably "info tar").
20
21 When accessing NeXTstep files, you may need to convert them from the
22 NeXT character set to the Latin1 character set; use the program
23 recode ("info recode") for this purpose.
24
25 To compile the UFS file system support as a module, choose M here: the
26 module will be called ufs.
27
28 If you haven't heard about all of this before, it's safe to say N.
29
30config UFS_FS_WRITE
31 bool "UFS file system write support (DANGEROUS)"
32 depends on UFS_FS && EXPERIMENTAL
33 help
34 Say Y here if you want to try writing to UFS partitions. This is
35 experimental, so you should back up your UFS partitions beforehand.
36
37config UFS_DEBUG
38 bool "UFS debugging"
39 depends on UFS_FS
40 help
41 If you are experiencing any problems with the UFS filesystem, say
42 Y here. This will result in _many_ additional debugging messages to be
43 written to the system log.
diff --git a/fs/xfs/Kconfig b/fs/xfs/Kconfig
index 3f53dd101f99..29228f5899cd 100644
--- a/fs/xfs/Kconfig
+++ b/fs/xfs/Kconfig
@@ -1,6 +1,7 @@
1config XFS_FS 1config XFS_FS
2 tristate "XFS filesystem support" 2 tristate "XFS filesystem support"
3 depends on BLOCK 3 depends on BLOCK
4 select EXPORTFS
4 help 5 help
5 XFS is a high performance journaling filesystem which originated 6 XFS is a high performance journaling filesystem which originated
6 on the SGI IRIX platform. It is completely multi-threaded, can 7 on the SGI IRIX platform. It is completely multi-threaded, can
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index e5be1e0be802..4bd112313f33 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -50,12 +50,14 @@
50#include "xfs_vnodeops.h" 50#include "xfs_vnodeops.h"
51#include "xfs_quota.h" 51#include "xfs_quota.h"
52#include "xfs_inode_item.h" 52#include "xfs_inode_item.h"
53#include "xfs_export.h"
53 54
54#include <linux/capability.h> 55#include <linux/capability.h>
55#include <linux/dcache.h> 56#include <linux/dcache.h>
56#include <linux/mount.h> 57#include <linux/mount.h>
57#include <linux/namei.h> 58#include <linux/namei.h>
58#include <linux/pagemap.h> 59#include <linux/pagemap.h>
60#include <linux/exportfs.h>
59 61
60/* 62/*
61 * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to 63 * xfs_find_handle maps from userspace xfs_fsop_handlereq structure to
@@ -164,97 +166,69 @@ xfs_find_handle(
164 return 0; 166 return 0;
165} 167}
166 168
167
168/* 169/*
169 * Convert userspace handle data into inode. 170 * No need to do permission checks on the various pathname components
170 * 171 * as the handle operations are privileged.
171 * We use the fact that all the fsop_handlereq ioctl calls have a data
172 * structure argument whose first component is always a xfs_fsop_handlereq_t,
173 * so we can pass that sub structure into this handy, shared routine.
174 *
175 * If no error, caller must always iput the returned inode.
176 */ 172 */
177STATIC int 173STATIC int
178xfs_vget_fsop_handlereq( 174xfs_handle_acceptable(
179 xfs_mount_t *mp, 175 void *context,
180 struct inode *parinode, /* parent inode pointer */ 176 struct dentry *dentry)
181 xfs_fsop_handlereq_t *hreq, 177{
182 struct inode **inode) 178 return 1;
179}
180
181/*
182 * Convert userspace handle data into a dentry.
183 */
184struct dentry *
185xfs_handle_to_dentry(
186 struct file *parfilp,
187 void __user *uhandle,
188 u32 hlen)
183{ 189{
184 void __user *hanp;
185 size_t hlen;
186 xfs_fid_t *xfid;
187 xfs_handle_t *handlep;
188 xfs_handle_t handle; 190 xfs_handle_t handle;
189 xfs_inode_t *ip; 191 struct xfs_fid64 fid;
190 xfs_ino_t ino;
191 __u32 igen;
192 int error;
193 192
194 /* 193 /*
195 * Only allow handle opens under a directory. 194 * Only allow handle opens under a directory.
196 */ 195 */
197 if (!S_ISDIR(parinode->i_mode)) 196 if (!S_ISDIR(parfilp->f_path.dentry->d_inode->i_mode))
198 return XFS_ERROR(ENOTDIR); 197 return ERR_PTR(-ENOTDIR);
199 198
200 hanp = hreq->ihandle; 199 if (hlen != sizeof(xfs_handle_t))
201 hlen = hreq->ihandlen; 200 return ERR_PTR(-EINVAL);
202 handlep = &handle; 201 if (copy_from_user(&handle, uhandle, hlen))
203 202 return ERR_PTR(-EFAULT);
204 if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep)) 203 if (handle.ha_fid.fid_len !=
205 return XFS_ERROR(EINVAL); 204 sizeof(handle.ha_fid) - sizeof(handle.ha_fid.fid_len))
206 if (copy_from_user(handlep, hanp, hlen)) 205 return ERR_PTR(-EINVAL);
207 return XFS_ERROR(EFAULT); 206
208 if (hlen < sizeof(*handlep)) 207 memset(&fid, 0, sizeof(struct fid));
209 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen); 208 fid.ino = handle.ha_fid.fid_ino;
210 if (hlen > sizeof(handlep->ha_fsid)) { 209 fid.gen = handle.ha_fid.fid_gen;
211 if (handlep->ha_fid.fid_len != 210
212 (hlen - sizeof(handlep->ha_fsid) - 211 return exportfs_decode_fh(parfilp->f_path.mnt, (struct fid *)&fid, 3,
213 sizeof(handlep->ha_fid.fid_len)) || 212 FILEID_INO32_GEN | XFS_FILEID_TYPE_64FLAG,
214 handlep->ha_fid.fid_pad) 213 xfs_handle_acceptable, NULL);
215 return XFS_ERROR(EINVAL); 214}
216 }
217
218 /*
219 * Crack the handle, obtain the inode # & generation #
220 */
221 xfid = (struct xfs_fid *)&handlep->ha_fid;
222 if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) {
223 ino = xfid->fid_ino;
224 igen = xfid->fid_gen;
225 } else {
226 return XFS_ERROR(EINVAL);
227 }
228
229 /*
230 * Get the XFS inode, building a Linux inode to go with it.
231 */
232 error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0);
233 if (error)
234 return error;
235 if (ip == NULL)
236 return XFS_ERROR(EIO);
237 if (ip->i_d.di_gen != igen) {
238 xfs_iput_new(ip, XFS_ILOCK_SHARED);
239 return XFS_ERROR(ENOENT);
240 }
241
242 xfs_iunlock(ip, XFS_ILOCK_SHARED);
243 215
244 *inode = VFS_I(ip); 216STATIC struct dentry *
245 return 0; 217xfs_handlereq_to_dentry(
218 struct file *parfilp,
219 xfs_fsop_handlereq_t *hreq)
220{
221 return xfs_handle_to_dentry(parfilp, hreq->ihandle, hreq->ihandlen);
246} 222}
247 223
248int 224int
249xfs_open_by_handle( 225xfs_open_by_handle(
250 xfs_mount_t *mp,
251 xfs_fsop_handlereq_t *hreq,
252 struct file *parfilp, 226 struct file *parfilp,
253 struct inode *parinode) 227 xfs_fsop_handlereq_t *hreq)
254{ 228{
255 const struct cred *cred = current_cred(); 229 const struct cred *cred = current_cred();
256 int error; 230 int error;
257 int new_fd; 231 int fd;
258 int permflag; 232 int permflag;
259 struct file *filp; 233 struct file *filp;
260 struct inode *inode; 234 struct inode *inode;
@@ -263,19 +237,21 @@ xfs_open_by_handle(
263 if (!capable(CAP_SYS_ADMIN)) 237 if (!capable(CAP_SYS_ADMIN))
264 return -XFS_ERROR(EPERM); 238 return -XFS_ERROR(EPERM);
265 239
266 error = xfs_vget_fsop_handlereq(mp, parinode, hreq, &inode); 240 dentry = xfs_handlereq_to_dentry(parfilp, hreq);
267 if (error) 241 if (IS_ERR(dentry))
268 return -error; 242 return PTR_ERR(dentry);
243 inode = dentry->d_inode;
269 244
270 /* Restrict xfs_open_by_handle to directories & regular files. */ 245 /* Restrict xfs_open_by_handle to directories & regular files. */
271 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) { 246 if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode))) {
272 iput(inode); 247 error = -XFS_ERROR(EPERM);
273 return -XFS_ERROR(EINVAL); 248 goto out_dput;
274 } 249 }
275 250
276#if BITS_PER_LONG != 32 251#if BITS_PER_LONG != 32
277 hreq->oflags |= O_LARGEFILE; 252 hreq->oflags |= O_LARGEFILE;
278#endif 253#endif
254
279 /* Put open permission in namei format. */ 255 /* Put open permission in namei format. */
280 permflag = hreq->oflags; 256 permflag = hreq->oflags;
281 if ((permflag+1) & O_ACCMODE) 257 if ((permflag+1) & O_ACCMODE)
@@ -285,50 +261,45 @@ xfs_open_by_handle(
285 261
286 if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) && 262 if ((!(permflag & O_APPEND) || (permflag & O_TRUNC)) &&
287 (permflag & FMODE_WRITE) && IS_APPEND(inode)) { 263 (permflag & FMODE_WRITE) && IS_APPEND(inode)) {
288 iput(inode); 264 error = -XFS_ERROR(EPERM);
289 return -XFS_ERROR(EPERM); 265 goto out_dput;
290 } 266 }
291 267
292 if ((permflag & FMODE_WRITE) && IS_IMMUTABLE(inode)) { 268 if ((permflag & FMODE_WRITE) && IS_IMMUTABLE(inode)) {
293 iput(inode); 269 error = -XFS_ERROR(EACCES);
294 return -XFS_ERROR(EACCES); 270 goto out_dput;
295 } 271 }
296 272
297 /* Can't write directories. */ 273 /* Can't write directories. */
298 if ( S_ISDIR(inode->i_mode) && (permflag & FMODE_WRITE)) { 274 if (S_ISDIR(inode->i_mode) && (permflag & FMODE_WRITE)) {
299 iput(inode); 275 error = -XFS_ERROR(EISDIR);
300 return -XFS_ERROR(EISDIR); 276 goto out_dput;
301 } 277 }
302 278
303 if ((new_fd = get_unused_fd()) < 0) { 279 fd = get_unused_fd();
304 iput(inode); 280 if (fd < 0) {
305 return new_fd; 281 error = fd;
282 goto out_dput;
306 } 283 }
307 284
308 dentry = d_obtain_alias(inode); 285 filp = dentry_open(dentry, mntget(parfilp->f_path.mnt),
309 if (IS_ERR(dentry)) { 286 hreq->oflags, cred);
310 put_unused_fd(new_fd);
311 return PTR_ERR(dentry);
312 }
313
314 /* Ensure umount returns EBUSY on umounts while this file is open. */
315 mntget(parfilp->f_path.mnt);
316
317 /* Create file pointer. */
318 filp = dentry_open(dentry, parfilp->f_path.mnt, hreq->oflags, cred);
319 if (IS_ERR(filp)) { 287 if (IS_ERR(filp)) {
320 put_unused_fd(new_fd); 288 put_unused_fd(fd);
321 return -XFS_ERROR(-PTR_ERR(filp)); 289 return PTR_ERR(filp);
322 } 290 }
323 291
324 if (inode->i_mode & S_IFREG) { 292 if (inode->i_mode & S_IFREG) {
325 /* invisible operation should not change atime */
326 filp->f_flags |= O_NOATIME; 293 filp->f_flags |= O_NOATIME;
327 filp->f_mode |= FMODE_NOCMTIME; 294 filp->f_mode |= FMODE_NOCMTIME;
328 } 295 }
329 296
330 fd_install(new_fd, filp); 297 fd_install(fd, filp);
331 return new_fd; 298 return fd;
299
300 out_dput:
301 dput(dentry);
302 return error;
332} 303}
333 304
334/* 305/*
@@ -359,11 +330,10 @@ do_readlink(
359 330
360int 331int
361xfs_readlink_by_handle( 332xfs_readlink_by_handle(
362 xfs_mount_t *mp, 333 struct file *parfilp,
363 xfs_fsop_handlereq_t *hreq, 334 xfs_fsop_handlereq_t *hreq)
364 struct inode *parinode)
365{ 335{
366 struct inode *inode; 336 struct dentry *dentry;
367 __u32 olen; 337 __u32 olen;
368 void *link; 338 void *link;
369 int error; 339 int error;
@@ -371,26 +341,28 @@ xfs_readlink_by_handle(
371 if (!capable(CAP_SYS_ADMIN)) 341 if (!capable(CAP_SYS_ADMIN))
372 return -XFS_ERROR(EPERM); 342 return -XFS_ERROR(EPERM);
373 343
374 error = xfs_vget_fsop_handlereq(mp, parinode, hreq, &inode); 344 dentry = xfs_handlereq_to_dentry(parfilp, hreq);
375 if (error) 345 if (IS_ERR(dentry))
376 return -error; 346 return PTR_ERR(dentry);
377 347
378 /* Restrict this handle operation to symlinks only. */ 348 /* Restrict this handle operation to symlinks only. */
379 if (!S_ISLNK(inode->i_mode)) { 349 if (!S_ISLNK(dentry->d_inode->i_mode)) {
380 error = -XFS_ERROR(EINVAL); 350 error = -XFS_ERROR(EINVAL);
381 goto out_iput; 351 goto out_dput;
382 } 352 }
383 353
384 if (copy_from_user(&olen, hreq->ohandlen, sizeof(__u32))) { 354 if (copy_from_user(&olen, hreq->ohandlen, sizeof(__u32))) {
385 error = -XFS_ERROR(EFAULT); 355 error = -XFS_ERROR(EFAULT);
386 goto out_iput; 356 goto out_dput;
387 } 357 }
388 358
389 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL); 359 link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
390 if (!link) 360 if (!link) {
391 goto out_iput; 361 error = -XFS_ERROR(ENOMEM);
362 goto out_dput;
363 }
392 364
393 error = -xfs_readlink(XFS_I(inode), link); 365 error = -xfs_readlink(XFS_I(dentry->d_inode), link);
394 if (error) 366 if (error)
395 goto out_kfree; 367 goto out_kfree;
396 error = do_readlink(hreq->ohandle, olen, link); 368 error = do_readlink(hreq->ohandle, olen, link);
@@ -399,32 +371,31 @@ xfs_readlink_by_handle(
399 371
400 out_kfree: 372 out_kfree:
401 kfree(link); 373 kfree(link);
402 out_iput: 374 out_dput:
403 iput(inode); 375 dput(dentry);
404 return error; 376 return error;
405} 377}
406 378
407STATIC int 379STATIC int
408xfs_fssetdm_by_handle( 380xfs_fssetdm_by_handle(
409 xfs_mount_t *mp, 381 struct file *parfilp,
410 void __user *arg, 382 void __user *arg)
411 struct inode *parinode)
412{ 383{
413 int error; 384 int error;
414 struct fsdmidata fsd; 385 struct fsdmidata fsd;
415 xfs_fsop_setdm_handlereq_t dmhreq; 386 xfs_fsop_setdm_handlereq_t dmhreq;
416 struct inode *inode; 387 struct dentry *dentry;
417 388
418 if (!capable(CAP_MKNOD)) 389 if (!capable(CAP_MKNOD))
419 return -XFS_ERROR(EPERM); 390 return -XFS_ERROR(EPERM);
420 if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t))) 391 if (copy_from_user(&dmhreq, arg, sizeof(xfs_fsop_setdm_handlereq_t)))
421 return -XFS_ERROR(EFAULT); 392 return -XFS_ERROR(EFAULT);
422 393
423 error = xfs_vget_fsop_handlereq(mp, parinode, &dmhreq.hreq, &inode); 394 dentry = xfs_handlereq_to_dentry(parfilp, &dmhreq.hreq);
424 if (error) 395 if (IS_ERR(dentry))
425 return -error; 396 return PTR_ERR(dentry);
426 397
427 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { 398 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
428 error = -XFS_ERROR(EPERM); 399 error = -XFS_ERROR(EPERM);
429 goto out; 400 goto out;
430 } 401 }
@@ -434,24 +405,23 @@ xfs_fssetdm_by_handle(
434 goto out; 405 goto out;
435 } 406 }
436 407
437 error = -xfs_set_dmattrs(XFS_I(inode), fsd.fsd_dmevmask, 408 error = -xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
438 fsd.fsd_dmstate); 409 fsd.fsd_dmstate);
439 410
440 out: 411 out:
441 iput(inode); 412 dput(dentry);
442 return error; 413 return error;
443} 414}
444 415
445STATIC int 416STATIC int
446xfs_attrlist_by_handle( 417xfs_attrlist_by_handle(
447 xfs_mount_t *mp, 418 struct file *parfilp,
448 void __user *arg, 419 void __user *arg)
449 struct inode *parinode)
450{ 420{
451 int error; 421 int error = -ENOMEM;
452 attrlist_cursor_kern_t *cursor; 422 attrlist_cursor_kern_t *cursor;
453 xfs_fsop_attrlist_handlereq_t al_hreq; 423 xfs_fsop_attrlist_handlereq_t al_hreq;
454 struct inode *inode; 424 struct dentry *dentry;
455 char *kbuf; 425 char *kbuf;
456 426
457 if (!capable(CAP_SYS_ADMIN)) 427 if (!capable(CAP_SYS_ADMIN))
@@ -467,16 +437,16 @@ xfs_attrlist_by_handle(
467 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) 437 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
468 return -XFS_ERROR(EINVAL); 438 return -XFS_ERROR(EINVAL);
469 439
470 error = xfs_vget_fsop_handlereq(mp, parinode, &al_hreq.hreq, &inode); 440 dentry = xfs_handlereq_to_dentry(parfilp, &al_hreq.hreq);
471 if (error) 441 if (IS_ERR(dentry))
472 goto out; 442 return PTR_ERR(dentry);
473 443
474 kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL); 444 kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL);
475 if (!kbuf) 445 if (!kbuf)
476 goto out_vn_rele; 446 goto out_dput;
477 447
478 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; 448 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
479 error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen, 449 error = -xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
480 al_hreq.flags, cursor); 450 al_hreq.flags, cursor);
481 if (error) 451 if (error)
482 goto out_kfree; 452 goto out_kfree;
@@ -486,10 +456,9 @@ xfs_attrlist_by_handle(
486 456
487 out_kfree: 457 out_kfree:
488 kfree(kbuf); 458 kfree(kbuf);
489 out_vn_rele: 459 out_dput:
490 iput(inode); 460 dput(dentry);
491 out: 461 return error;
492 return -error;
493} 462}
494 463
495int 464int
@@ -564,15 +533,13 @@ xfs_attrmulti_attr_remove(
564 533
565STATIC int 534STATIC int
566xfs_attrmulti_by_handle( 535xfs_attrmulti_by_handle(
567 xfs_mount_t *mp,
568 void __user *arg,
569 struct file *parfilp, 536 struct file *parfilp,
570 struct inode *parinode) 537 void __user *arg)
571{ 538{
572 int error; 539 int error;
573 xfs_attr_multiop_t *ops; 540 xfs_attr_multiop_t *ops;
574 xfs_fsop_attrmulti_handlereq_t am_hreq; 541 xfs_fsop_attrmulti_handlereq_t am_hreq;
575 struct inode *inode; 542 struct dentry *dentry;
576 unsigned int i, size; 543 unsigned int i, size;
577 char *attr_name; 544 char *attr_name;
578 545
@@ -581,19 +548,19 @@ xfs_attrmulti_by_handle(
581 if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t))) 548 if (copy_from_user(&am_hreq, arg, sizeof(xfs_fsop_attrmulti_handlereq_t)))
582 return -XFS_ERROR(EFAULT); 549 return -XFS_ERROR(EFAULT);
583 550
584 error = xfs_vget_fsop_handlereq(mp, parinode, &am_hreq.hreq, &inode); 551 dentry = xfs_handlereq_to_dentry(parfilp, &am_hreq.hreq);
585 if (error) 552 if (IS_ERR(dentry))
586 goto out; 553 return PTR_ERR(dentry);
587 554
588 error = E2BIG; 555 error = E2BIG;
589 size = am_hreq.opcount * sizeof(xfs_attr_multiop_t); 556 size = am_hreq.opcount * sizeof(xfs_attr_multiop_t);
590 if (!size || size > 16 * PAGE_SIZE) 557 if (!size || size > 16 * PAGE_SIZE)
591 goto out_vn_rele; 558 goto out_dput;
592 559
593 error = ENOMEM; 560 error = ENOMEM;
594 ops = kmalloc(size, GFP_KERNEL); 561 ops = kmalloc(size, GFP_KERNEL);
595 if (!ops) 562 if (!ops)
596 goto out_vn_rele; 563 goto out_dput;
597 564
598 error = EFAULT; 565 error = EFAULT;
599 if (copy_from_user(ops, am_hreq.ops, size)) 566 if (copy_from_user(ops, am_hreq.ops, size))
@@ -615,25 +582,28 @@ xfs_attrmulti_by_handle(
615 582
616 switch (ops[i].am_opcode) { 583 switch (ops[i].am_opcode) {
617 case ATTR_OP_GET: 584 case ATTR_OP_GET:
618 ops[i].am_error = xfs_attrmulti_attr_get(inode, 585 ops[i].am_error = xfs_attrmulti_attr_get(
619 attr_name, ops[i].am_attrvalue, 586 dentry->d_inode, attr_name,
620 &ops[i].am_length, ops[i].am_flags); 587 ops[i].am_attrvalue, &ops[i].am_length,
588 ops[i].am_flags);
621 break; 589 break;
622 case ATTR_OP_SET: 590 case ATTR_OP_SET:
623 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt); 591 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
624 if (ops[i].am_error) 592 if (ops[i].am_error)
625 break; 593 break;
626 ops[i].am_error = xfs_attrmulti_attr_set(inode, 594 ops[i].am_error = xfs_attrmulti_attr_set(
627 attr_name, ops[i].am_attrvalue, 595 dentry->d_inode, attr_name,
628 ops[i].am_length, ops[i].am_flags); 596 ops[i].am_attrvalue, ops[i].am_length,
597 ops[i].am_flags);
629 mnt_drop_write(parfilp->f_path.mnt); 598 mnt_drop_write(parfilp->f_path.mnt);
630 break; 599 break;
631 case ATTR_OP_REMOVE: 600 case ATTR_OP_REMOVE:
632 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt); 601 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
633 if (ops[i].am_error) 602 if (ops[i].am_error)
634 break; 603 break;
635 ops[i].am_error = xfs_attrmulti_attr_remove(inode, 604 ops[i].am_error = xfs_attrmulti_attr_remove(
636 attr_name, ops[i].am_flags); 605 dentry->d_inode, attr_name,
606 ops[i].am_flags);
637 mnt_drop_write(parfilp->f_path.mnt); 607 mnt_drop_write(parfilp->f_path.mnt);
638 break; 608 break;
639 default: 609 default:
@@ -647,9 +617,8 @@ xfs_attrmulti_by_handle(
647 kfree(attr_name); 617 kfree(attr_name);
648 out_kfree_ops: 618 out_kfree_ops:
649 kfree(ops); 619 kfree(ops);
650 out_vn_rele: 620 out_dput:
651 iput(inode); 621 dput(dentry);
652 out:
653 return -error; 622 return -error;
654} 623}
655 624
@@ -1440,23 +1409,23 @@ xfs_file_ioctl(
1440 1409
1441 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) 1410 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
1442 return -XFS_ERROR(EFAULT); 1411 return -XFS_ERROR(EFAULT);
1443 return xfs_open_by_handle(mp, &hreq, filp, inode); 1412 return xfs_open_by_handle(filp, &hreq);
1444 } 1413 }
1445 case XFS_IOC_FSSETDM_BY_HANDLE: 1414 case XFS_IOC_FSSETDM_BY_HANDLE:
1446 return xfs_fssetdm_by_handle(mp, arg, inode); 1415 return xfs_fssetdm_by_handle(filp, arg);
1447 1416
1448 case XFS_IOC_READLINK_BY_HANDLE: { 1417 case XFS_IOC_READLINK_BY_HANDLE: {
1449 xfs_fsop_handlereq_t hreq; 1418 xfs_fsop_handlereq_t hreq;
1450 1419
1451 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t))) 1420 if (copy_from_user(&hreq, arg, sizeof(xfs_fsop_handlereq_t)))
1452 return -XFS_ERROR(EFAULT); 1421 return -XFS_ERROR(EFAULT);
1453 return xfs_readlink_by_handle(mp, &hreq, inode); 1422 return xfs_readlink_by_handle(filp, &hreq);
1454 } 1423 }
1455 case XFS_IOC_ATTRLIST_BY_HANDLE: 1424 case XFS_IOC_ATTRLIST_BY_HANDLE:
1456 return xfs_attrlist_by_handle(mp, arg, inode); 1425 return xfs_attrlist_by_handle(filp, arg);
1457 1426
1458 case XFS_IOC_ATTRMULTI_BY_HANDLE: 1427 case XFS_IOC_ATTRMULTI_BY_HANDLE:
1459 return xfs_attrmulti_by_handle(mp, arg, filp, inode); 1428 return xfs_attrmulti_by_handle(filp, arg);
1460 1429
1461 case XFS_IOC_SWAPEXT: { 1430 case XFS_IOC_SWAPEXT: {
1462 struct xfs_swapext sxp; 1431 struct xfs_swapext sxp;
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.h b/fs/xfs/linux-2.6/xfs_ioctl.h
index 8c16bf2d7e03..7bd7c6afc1eb 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.h
+++ b/fs/xfs/linux-2.6/xfs_ioctl.h
@@ -34,16 +34,13 @@ xfs_find_handle(
34 34
35extern int 35extern int
36xfs_open_by_handle( 36xfs_open_by_handle(
37 xfs_mount_t *mp,
38 xfs_fsop_handlereq_t *hreq,
39 struct file *parfilp, 37 struct file *parfilp,
40 struct inode *parinode); 38 xfs_fsop_handlereq_t *hreq);
41 39
42extern int 40extern int
43xfs_readlink_by_handle( 41xfs_readlink_by_handle(
44 xfs_mount_t *mp, 42 struct file *parfilp,
45 xfs_fsop_handlereq_t *hreq, 43 xfs_fsop_handlereq_t *hreq);
46 struct inode *parinode);
47 44
48extern int 45extern int
49xfs_attrmulti_attr_get( 46xfs_attrmulti_attr_get(
@@ -67,6 +64,12 @@ xfs_attrmulti_attr_remove(
67 char *name, 64 char *name,
68 __uint32_t flags); 65 __uint32_t flags);
69 66
67extern struct dentry *
68xfs_handle_to_dentry(
69 struct file *parfilp,
70 void __user *uhandle,
71 u32 hlen);
72
70extern long 73extern long
71xfs_file_ioctl( 74xfs_file_ioctl(
72 struct file *filp, 75 struct file *filp,
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 50903ad3182e..c70c4e3db790 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -17,6 +17,7 @@
17 */ 17 */
18#include <linux/compat.h> 18#include <linux/compat.h>
19#include <linux/ioctl.h> 19#include <linux/ioctl.h>
20#include <linux/mount.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include "xfs.h" 22#include "xfs.h"
22#include "xfs_fs.h" 23#include "xfs_fs.h"
@@ -340,96 +341,24 @@ xfs_compat_handlereq_copyin(
340 return 0; 341 return 0;
341} 342}
342 343
343/* 344STATIC struct dentry *
344 * Convert userspace handle data into inode. 345xfs_compat_handlereq_to_dentry(
345 * 346 struct file *parfilp,
346 * We use the fact that all the fsop_handlereq ioctl calls have a data 347 compat_xfs_fsop_handlereq_t *hreq)
347 * structure argument whose first component is always a xfs_fsop_handlereq_t,
348 * so we can pass that sub structure into this handy, shared routine.
349 *
350 * If no error, caller must always iput the returned inode.
351 */
352STATIC int
353xfs_vget_fsop_handlereq_compat(
354 xfs_mount_t *mp,
355 struct inode *parinode, /* parent inode pointer */
356 compat_xfs_fsop_handlereq_t *hreq,
357 struct inode **inode)
358{ 348{
359 void __user *hanp; 349 return xfs_handle_to_dentry(parfilp,
360 size_t hlen; 350 compat_ptr(hreq->ihandle), hreq->ihandlen);
361 xfs_fid_t *xfid;
362 xfs_handle_t *handlep;
363 xfs_handle_t handle;
364 xfs_inode_t *ip;
365 xfs_ino_t ino;
366 __u32 igen;
367 int error;
368
369 /*
370 * Only allow handle opens under a directory.
371 */
372 if (!S_ISDIR(parinode->i_mode))
373 return XFS_ERROR(ENOTDIR);
374
375 hanp = compat_ptr(hreq->ihandle);
376 hlen = hreq->ihandlen;
377 handlep = &handle;
378
379 if (hlen < sizeof(handlep->ha_fsid) || hlen > sizeof(*handlep))
380 return XFS_ERROR(EINVAL);
381 if (copy_from_user(handlep, hanp, hlen))
382 return XFS_ERROR(EFAULT);
383 if (hlen < sizeof(*handlep))
384 memset(((char *)handlep) + hlen, 0, sizeof(*handlep) - hlen);
385 if (hlen > sizeof(handlep->ha_fsid)) {
386 if (handlep->ha_fid.fid_len !=
387 (hlen - sizeof(handlep->ha_fsid) -
388 sizeof(handlep->ha_fid.fid_len)) ||
389 handlep->ha_fid.fid_pad)
390 return XFS_ERROR(EINVAL);
391 }
392
393 /*
394 * Crack the handle, obtain the inode # & generation #
395 */
396 xfid = (struct xfs_fid *)&handlep->ha_fid;
397 if (xfid->fid_len == sizeof(*xfid) - sizeof(xfid->fid_len)) {
398 ino = xfid->fid_ino;
399 igen = xfid->fid_gen;
400 } else {
401 return XFS_ERROR(EINVAL);
402 }
403
404 /*
405 * Get the XFS inode, building a Linux inode to go with it.
406 */
407 error = xfs_iget(mp, NULL, ino, 0, XFS_ILOCK_SHARED, &ip, 0);
408 if (error)
409 return error;
410 if (ip == NULL)
411 return XFS_ERROR(EIO);
412 if (ip->i_d.di_gen != igen) {
413 xfs_iput_new(ip, XFS_ILOCK_SHARED);
414 return XFS_ERROR(ENOENT);
415 }
416
417 xfs_iunlock(ip, XFS_ILOCK_SHARED);
418
419 *inode = VFS_I(ip);
420 return 0;
421} 351}
422 352
423STATIC int 353STATIC int
424xfs_compat_attrlist_by_handle( 354xfs_compat_attrlist_by_handle(
425 xfs_mount_t *mp, 355 struct file *parfilp,
426 void __user *arg, 356 void __user *arg)
427 struct inode *parinode)
428{ 357{
429 int error; 358 int error;
430 attrlist_cursor_kern_t *cursor; 359 attrlist_cursor_kern_t *cursor;
431 compat_xfs_fsop_attrlist_handlereq_t al_hreq; 360 compat_xfs_fsop_attrlist_handlereq_t al_hreq;
432 struct inode *inode; 361 struct dentry *dentry;
433 char *kbuf; 362 char *kbuf;
434 363
435 if (!capable(CAP_SYS_ADMIN)) 364 if (!capable(CAP_SYS_ADMIN))
@@ -446,17 +375,17 @@ xfs_compat_attrlist_by_handle(
446 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE)) 375 if (al_hreq.flags & ~(ATTR_ROOT | ATTR_SECURE))
447 return -XFS_ERROR(EINVAL); 376 return -XFS_ERROR(EINVAL);
448 377
449 error = xfs_vget_fsop_handlereq_compat(mp, parinode, &al_hreq.hreq, 378 dentry = xfs_compat_handlereq_to_dentry(parfilp, &al_hreq.hreq);
450 &inode); 379 if (IS_ERR(dentry))
451 if (error) 380 return PTR_ERR(dentry);
452 goto out;
453 381
382 error = -ENOMEM;
454 kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL); 383 kbuf = kmalloc(al_hreq.buflen, GFP_KERNEL);
455 if (!kbuf) 384 if (!kbuf)
456 goto out_vn_rele; 385 goto out_dput;
457 386
458 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos; 387 cursor = (attrlist_cursor_kern_t *)&al_hreq.pos;
459 error = xfs_attr_list(XFS_I(inode), kbuf, al_hreq.buflen, 388 error = -xfs_attr_list(XFS_I(dentry->d_inode), kbuf, al_hreq.buflen,
460 al_hreq.flags, cursor); 389 al_hreq.flags, cursor);
461 if (error) 390 if (error)
462 goto out_kfree; 391 goto out_kfree;
@@ -466,22 +395,20 @@ xfs_compat_attrlist_by_handle(
466 395
467 out_kfree: 396 out_kfree:
468 kfree(kbuf); 397 kfree(kbuf);
469 out_vn_rele: 398 out_dput:
470 iput(inode); 399 dput(dentry);
471 out: 400 return error;
472 return -error;
473} 401}
474 402
475STATIC int 403STATIC int
476xfs_compat_attrmulti_by_handle( 404xfs_compat_attrmulti_by_handle(
477 xfs_mount_t *mp, 405 struct file *parfilp,
478 void __user *arg, 406 void __user *arg)
479 struct inode *parinode)
480{ 407{
481 int error; 408 int error;
482 compat_xfs_attr_multiop_t *ops; 409 compat_xfs_attr_multiop_t *ops;
483 compat_xfs_fsop_attrmulti_handlereq_t am_hreq; 410 compat_xfs_fsop_attrmulti_handlereq_t am_hreq;
484 struct inode *inode; 411 struct dentry *dentry;
485 unsigned int i, size; 412 unsigned int i, size;
486 char *attr_name; 413 char *attr_name;
487 414
@@ -491,20 +418,19 @@ xfs_compat_attrmulti_by_handle(
491 sizeof(compat_xfs_fsop_attrmulti_handlereq_t))) 418 sizeof(compat_xfs_fsop_attrmulti_handlereq_t)))
492 return -XFS_ERROR(EFAULT); 419 return -XFS_ERROR(EFAULT);
493 420
494 error = xfs_vget_fsop_handlereq_compat(mp, parinode, &am_hreq.hreq, 421 dentry = xfs_compat_handlereq_to_dentry(parfilp, &am_hreq.hreq);
495 &inode); 422 if (IS_ERR(dentry))
496 if (error) 423 return PTR_ERR(dentry);
497 goto out;
498 424
499 error = E2BIG; 425 error = E2BIG;
500 size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t); 426 size = am_hreq.opcount * sizeof(compat_xfs_attr_multiop_t);
501 if (!size || size > 16 * PAGE_SIZE) 427 if (!size || size > 16 * PAGE_SIZE)
502 goto out_vn_rele; 428 goto out_dput;
503 429
504 error = ENOMEM; 430 error = ENOMEM;
505 ops = kmalloc(size, GFP_KERNEL); 431 ops = kmalloc(size, GFP_KERNEL);
506 if (!ops) 432 if (!ops)
507 goto out_vn_rele; 433 goto out_dput;
508 434
509 error = EFAULT; 435 error = EFAULT;
510 if (copy_from_user(ops, compat_ptr(am_hreq.ops), size)) 436 if (copy_from_user(ops, compat_ptr(am_hreq.ops), size))
@@ -527,20 +453,29 @@ xfs_compat_attrmulti_by_handle(
527 453
528 switch (ops[i].am_opcode) { 454 switch (ops[i].am_opcode) {
529 case ATTR_OP_GET: 455 case ATTR_OP_GET:
530 ops[i].am_error = xfs_attrmulti_attr_get(inode, 456 ops[i].am_error = xfs_attrmulti_attr_get(
531 attr_name, 457 dentry->d_inode, attr_name,
532 compat_ptr(ops[i].am_attrvalue), 458 compat_ptr(ops[i].am_attrvalue),
533 &ops[i].am_length, ops[i].am_flags); 459 &ops[i].am_length, ops[i].am_flags);
534 break; 460 break;
535 case ATTR_OP_SET: 461 case ATTR_OP_SET:
536 ops[i].am_error = xfs_attrmulti_attr_set(inode, 462 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
537 attr_name, 463 if (ops[i].am_error)
464 break;
465 ops[i].am_error = xfs_attrmulti_attr_set(
466 dentry->d_inode, attr_name,
538 compat_ptr(ops[i].am_attrvalue), 467 compat_ptr(ops[i].am_attrvalue),
539 ops[i].am_length, ops[i].am_flags); 468 ops[i].am_length, ops[i].am_flags);
469 mnt_drop_write(parfilp->f_path.mnt);
540 break; 470 break;
541 case ATTR_OP_REMOVE: 471 case ATTR_OP_REMOVE:
542 ops[i].am_error = xfs_attrmulti_attr_remove(inode, 472 ops[i].am_error = mnt_want_write(parfilp->f_path.mnt);
543 attr_name, ops[i].am_flags); 473 if (ops[i].am_error)
474 break;
475 ops[i].am_error = xfs_attrmulti_attr_remove(
476 dentry->d_inode, attr_name,
477 ops[i].am_flags);
478 mnt_drop_write(parfilp->f_path.mnt);
544 break; 479 break;
545 default: 480 default:
546 ops[i].am_error = EINVAL; 481 ops[i].am_error = EINVAL;
@@ -553,22 +488,20 @@ xfs_compat_attrmulti_by_handle(
553 kfree(attr_name); 488 kfree(attr_name);
554 out_kfree_ops: 489 out_kfree_ops:
555 kfree(ops); 490 kfree(ops);
556 out_vn_rele: 491 out_dput:
557 iput(inode); 492 dput(dentry);
558 out:
559 return -error; 493 return -error;
560} 494}
561 495
562STATIC int 496STATIC int
563xfs_compat_fssetdm_by_handle( 497xfs_compat_fssetdm_by_handle(
564 xfs_mount_t *mp, 498 struct file *parfilp,
565 void __user *arg, 499 void __user *arg)
566 struct inode *parinode)
567{ 500{
568 int error; 501 int error;
569 struct fsdmidata fsd; 502 struct fsdmidata fsd;
570 compat_xfs_fsop_setdm_handlereq_t dmhreq; 503 compat_xfs_fsop_setdm_handlereq_t dmhreq;
571 struct inode *inode; 504 struct dentry *dentry;
572 505
573 if (!capable(CAP_MKNOD)) 506 if (!capable(CAP_MKNOD))
574 return -XFS_ERROR(EPERM); 507 return -XFS_ERROR(EPERM);
@@ -576,12 +509,11 @@ xfs_compat_fssetdm_by_handle(
576 sizeof(compat_xfs_fsop_setdm_handlereq_t))) 509 sizeof(compat_xfs_fsop_setdm_handlereq_t)))
577 return -XFS_ERROR(EFAULT); 510 return -XFS_ERROR(EFAULT);
578 511
579 error = xfs_vget_fsop_handlereq_compat(mp, parinode, &dmhreq.hreq, 512 dentry = xfs_compat_handlereq_to_dentry(parfilp, &dmhreq.hreq);
580 &inode); 513 if (IS_ERR(dentry))
581 if (error) 514 return PTR_ERR(dentry);
582 return -error;
583 515
584 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) { 516 if (IS_IMMUTABLE(dentry->d_inode) || IS_APPEND(dentry->d_inode)) {
585 error = -XFS_ERROR(EPERM); 517 error = -XFS_ERROR(EPERM);
586 goto out; 518 goto out;
587 } 519 }
@@ -591,11 +523,11 @@ xfs_compat_fssetdm_by_handle(
591 goto out; 523 goto out;
592 } 524 }
593 525
594 error = -xfs_set_dmattrs(XFS_I(inode), fsd.fsd_dmevmask, 526 error = -xfs_set_dmattrs(XFS_I(dentry->d_inode), fsd.fsd_dmevmask,
595 fsd.fsd_dmstate); 527 fsd.fsd_dmstate);
596 528
597out: 529out:
598 iput(inode); 530 dput(dentry);
599 return error; 531 return error;
600} 532}
601 533
@@ -722,21 +654,21 @@ xfs_file_compat_ioctl(
722 654
723 if (xfs_compat_handlereq_copyin(&hreq, arg)) 655 if (xfs_compat_handlereq_copyin(&hreq, arg))
724 return -XFS_ERROR(EFAULT); 656 return -XFS_ERROR(EFAULT);
725 return xfs_open_by_handle(mp, &hreq, filp, inode); 657 return xfs_open_by_handle(filp, &hreq);
726 } 658 }
727 case XFS_IOC_READLINK_BY_HANDLE_32: { 659 case XFS_IOC_READLINK_BY_HANDLE_32: {
728 struct xfs_fsop_handlereq hreq; 660 struct xfs_fsop_handlereq hreq;
729 661
730 if (xfs_compat_handlereq_copyin(&hreq, arg)) 662 if (xfs_compat_handlereq_copyin(&hreq, arg))
731 return -XFS_ERROR(EFAULT); 663 return -XFS_ERROR(EFAULT);
732 return xfs_readlink_by_handle(mp, &hreq, inode); 664 return xfs_readlink_by_handle(filp, &hreq);
733 } 665 }
734 case XFS_IOC_ATTRLIST_BY_HANDLE_32: 666 case XFS_IOC_ATTRLIST_BY_HANDLE_32:
735 return xfs_compat_attrlist_by_handle(mp, arg, inode); 667 return xfs_compat_attrlist_by_handle(filp, arg);
736 case XFS_IOC_ATTRMULTI_BY_HANDLE_32: 668 case XFS_IOC_ATTRMULTI_BY_HANDLE_32:
737 return xfs_compat_attrmulti_by_handle(mp, arg, inode); 669 return xfs_compat_attrmulti_by_handle(filp, arg);
738 case XFS_IOC_FSSETDM_BY_HANDLE_32: 670 case XFS_IOC_FSSETDM_BY_HANDLE_32:
739 return xfs_compat_fssetdm_by_handle(mp, arg, inode); 671 return xfs_compat_fssetdm_by_handle(filp, arg);
740 default: 672 default:
741 return -XFS_ERROR(ENOIOCTLCMD); 673 return -XFS_ERROR(ENOIOCTLCMD);
742 } 674 }
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 95a971080368..c71e226da7f5 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -1197,6 +1197,7 @@ xfs_fs_remount(
1197 struct xfs_mount *mp = XFS_M(sb); 1197 struct xfs_mount *mp = XFS_M(sb);
1198 substring_t args[MAX_OPT_ARGS]; 1198 substring_t args[MAX_OPT_ARGS];
1199 char *p; 1199 char *p;
1200 int error;
1200 1201
1201 while ((p = strsep(&options, ",")) != NULL) { 1202 while ((p = strsep(&options, ",")) != NULL) {
1202 int token; 1203 int token;
@@ -1247,11 +1248,25 @@ xfs_fs_remount(
1247 } 1248 }
1248 } 1249 }
1249 1250
1250 /* rw/ro -> rw */ 1251 /* ro -> rw */
1251 if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) { 1252 if ((mp->m_flags & XFS_MOUNT_RDONLY) && !(*flags & MS_RDONLY)) {
1252 mp->m_flags &= ~XFS_MOUNT_RDONLY; 1253 mp->m_flags &= ~XFS_MOUNT_RDONLY;
1253 if (mp->m_flags & XFS_MOUNT_BARRIER) 1254 if (mp->m_flags & XFS_MOUNT_BARRIER)
1254 xfs_mountfs_check_barriers(mp); 1255 xfs_mountfs_check_barriers(mp);
1256
1257 /*
1258 * If this is the first remount to writeable state we
1259 * might have some superblock changes to update.
1260 */
1261 if (mp->m_update_flags) {
1262 error = xfs_mount_log_sb(mp, mp->m_update_flags);
1263 if (error) {
1264 cmn_err(CE_WARN,
1265 "XFS: failed to write sb changes");
1266 return error;
1267 }
1268 mp->m_update_flags = 0;
1269 }
1255 } 1270 }
1256 1271
1257 /* rw -> ro */ 1272 /* rw -> ro */
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c
index 591ca6602bfb..6543c0b29753 100644
--- a/fs/xfs/quota/xfs_dquot.c
+++ b/fs/xfs/quota/xfs_dquot.c
@@ -73,6 +73,8 @@ int xfs_dqreq_num;
73int xfs_dqerror_mod = 33; 73int xfs_dqerror_mod = 33;
74#endif 74#endif
75 75
76static struct lock_class_key xfs_dquot_other_class;
77
76/* 78/*
77 * Allocate and initialize a dquot. We don't always allocate fresh memory; 79 * Allocate and initialize a dquot. We don't always allocate fresh memory;
78 * we try to reclaim a free dquot if the number of incore dquots are above 80 * we try to reclaim a free dquot if the number of incore dquots are above
@@ -139,7 +141,15 @@ xfs_qm_dqinit(
139 ASSERT(dqp->q_trace); 141 ASSERT(dqp->q_trace);
140 xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT"); 142 xfs_dqtrace_entry(dqp, "DQRECLAIMED_INIT");
141#endif 143#endif
142 } 144 }
145
146 /*
147 * In either case we need to make sure group quotas have a different
148 * lock class than user quotas, to make sure lockdep knows we can
149 * locks of one of each at the same time.
150 */
151 if (!(type & XFS_DQ_USER))
152 lockdep_set_class(&dqp->q_qlock, &xfs_dquot_other_class);
143 153
144 /* 154 /*
145 * log item gets initialized later 155 * log item gets initialized later
@@ -421,7 +431,7 @@ xfs_qm_dqalloc(
421 /* 431 /*
422 * Initialize the bmap freelist prior to calling bmapi code. 432 * Initialize the bmap freelist prior to calling bmapi code.
423 */ 433 */
424 XFS_BMAP_INIT(&flist, &firstblock); 434 xfs_bmap_init(&flist, &firstblock);
425 xfs_ilock(quotip, XFS_ILOCK_EXCL); 435 xfs_ilock(quotip, XFS_ILOCK_EXCL);
426 /* 436 /*
427 * Return if this type of quotas is turned off while we didn't 437 * Return if this type of quotas is turned off while we didn't
@@ -1383,6 +1393,12 @@ xfs_dqunlock_nonotify(
1383 mutex_unlock(&(dqp->q_qlock)); 1393 mutex_unlock(&(dqp->q_qlock));
1384} 1394}
1385 1395
1396/*
1397 * Lock two xfs_dquot structures.
1398 *
1399 * To avoid deadlocks we always lock the quota structure with
1400 * the lowerd id first.
1401 */
1386void 1402void
1387xfs_dqlock2( 1403xfs_dqlock2(
1388 xfs_dquot_t *d1, 1404 xfs_dquot_t *d1,
@@ -1392,18 +1408,16 @@ xfs_dqlock2(
1392 ASSERT(d1 != d2); 1408 ASSERT(d1 != d2);
1393 if (be32_to_cpu(d1->q_core.d_id) > 1409 if (be32_to_cpu(d1->q_core.d_id) >
1394 be32_to_cpu(d2->q_core.d_id)) { 1410 be32_to_cpu(d2->q_core.d_id)) {
1395 xfs_dqlock(d2); 1411 mutex_lock(&d2->q_qlock);
1396 xfs_dqlock(d1); 1412 mutex_lock_nested(&d1->q_qlock, XFS_QLOCK_NESTED);
1397 } else { 1413 } else {
1398 xfs_dqlock(d1); 1414 mutex_lock(&d1->q_qlock);
1399 xfs_dqlock(d2); 1415 mutex_lock_nested(&d2->q_qlock, XFS_QLOCK_NESTED);
1400 }
1401 } else {
1402 if (d1) {
1403 xfs_dqlock(d1);
1404 } else if (d2) {
1405 xfs_dqlock(d2);
1406 } 1416 }
1417 } else if (d1) {
1418 mutex_lock(&d1->q_qlock);
1419 } else if (d2) {
1420 mutex_lock(&d2->q_qlock);
1407 } 1421 }
1408} 1422}
1409 1423
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h
index 7e455337e2ba..d443e93b4331 100644
--- a/fs/xfs/quota/xfs_dquot.h
+++ b/fs/xfs/quota/xfs_dquot.h
@@ -97,6 +97,16 @@ typedef struct xfs_dquot {
97#define dq_hashlist q_lists.dqm_hashlist 97#define dq_hashlist q_lists.dqm_hashlist
98#define dq_flags q_lists.dqm_flags 98#define dq_flags q_lists.dqm_flags
99 99
100/*
101 * Lock hierachy for q_qlock:
102 * XFS_QLOCK_NORMAL is the implicit default,
103 * XFS_QLOCK_NESTED is the dquot with the higher id in xfs_dqlock2
104 */
105enum {
106 XFS_QLOCK_NORMAL = 0,
107 XFS_QLOCK_NESTED,
108};
109
100#define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++) 110#define XFS_DQHOLD(dqp) ((dqp)->q_nrefs++)
101 111
102#ifdef DEBUG 112#ifdef DEBUG
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 6b13960cf318..7a2beb64314f 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -1070,6 +1070,13 @@ xfs_qm_sync(
1070 return 0; 1070 return 0;
1071} 1071}
1072 1072
1073/*
1074 * The hash chains and the mplist use the same xfs_dqhash structure as
1075 * their list head, but we can take the mplist qh_lock and one of the
1076 * hash qh_locks at the same time without any problem as they aren't
1077 * related.
1078 */
1079static struct lock_class_key xfs_quota_mplist_class;
1073 1080
1074/* 1081/*
1075 * This initializes all the quota information that's kept in the 1082 * This initializes all the quota information that's kept in the
@@ -1105,6 +1112,8 @@ xfs_qm_init_quotainfo(
1105 } 1112 }
1106 1113
1107 xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0); 1114 xfs_qm_list_init(&qinf->qi_dqlist, "mpdqlist", 0);
1115 lockdep_set_class(&qinf->qi_dqlist.qh_lock, &xfs_quota_mplist_class);
1116
1108 qinf->qi_dqreclaims = 0; 1117 qinf->qi_dqreclaims = 0;
1109 1118
1110 /* mutex used to serialize quotaoffs */ 1119 /* mutex used to serialize quotaoffs */
diff --git a/fs/xfs/xfs_ag.h b/fs/xfs/xfs_ag.h
index d3b3cf742999..143d63ecb20a 100644
--- a/fs/xfs/xfs_ag.h
+++ b/fs/xfs/xfs_ag.h
@@ -244,8 +244,8 @@ typedef struct xfs_perag
244#define XFS_AG_CHECK_DADDR(mp,d,len) \ 244#define XFS_AG_CHECK_DADDR(mp,d,len) \
245 ((len) == 1 ? \ 245 ((len) == 1 ? \
246 ASSERT((d) == XFS_SB_DADDR || \ 246 ASSERT((d) == XFS_SB_DADDR || \
247 XFS_DADDR_TO_AGBNO(mp, d) != XFS_SB_DADDR) : \ 247 xfs_daddr_to_agbno(mp, d) != XFS_SB_DADDR) : \
248 ASSERT(XFS_DADDR_TO_AGNO(mp, d) == \ 248 ASSERT(xfs_daddr_to_agno(mp, d) == \
249 XFS_DADDR_TO_AGNO(mp, (d) + (len) - 1))) 249 xfs_daddr_to_agno(mp, (d) + (len) - 1)))
250 250
251#endif /* __XFS_AG_H__ */ 251#endif /* __XFS_AG_H__ */
diff --git a/fs/xfs/xfs_alloc_btree.c b/fs/xfs/xfs_alloc_btree.c
index 733cb75a8c5d..c10c3a292d30 100644
--- a/fs/xfs/xfs_alloc_btree.c
+++ b/fs/xfs/xfs_alloc_btree.c
@@ -115,7 +115,7 @@ xfs_allocbt_free_block(
115 xfs_agblock_t bno; 115 xfs_agblock_t bno;
116 int error; 116 int error;
117 117
118 bno = XFS_DADDR_TO_AGBNO(cur->bc_mp, XFS_BUF_ADDR(bp)); 118 bno = xfs_daddr_to_agbno(cur->bc_mp, XFS_BUF_ADDR(bp));
119 error = xfs_alloc_put_freelist(cur->bc_tp, agbp, NULL, bno, 1); 119 error = xfs_alloc_put_freelist(cur->bc_tp, agbp, NULL, bno, 1);
120 if (error) 120 if (error)
121 return error; 121 return error;
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c
index f7cdc28aff41..5fde1654b430 100644
--- a/fs/xfs/xfs_attr.c
+++ b/fs/xfs/xfs_attr.c
@@ -374,7 +374,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name,
374 * It won't fit in the shortform, transform to a leaf block. 374 * It won't fit in the shortform, transform to a leaf block.
375 * GROT: another possible req'mt for a double-split btree op. 375 * GROT: another possible req'mt for a double-split btree op.
376 */ 376 */
377 XFS_BMAP_INIT(args.flist, args.firstblock); 377 xfs_bmap_init(args.flist, args.firstblock);
378 error = xfs_attr_shortform_to_leaf(&args); 378 error = xfs_attr_shortform_to_leaf(&args);
379 if (!error) { 379 if (!error) {
380 error = xfs_bmap_finish(&args.trans, args.flist, 380 error = xfs_bmap_finish(&args.trans, args.flist,
@@ -956,7 +956,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
956 * Commit that transaction so that the node_addname() call 956 * Commit that transaction so that the node_addname() call
957 * can manage its own transactions. 957 * can manage its own transactions.
958 */ 958 */
959 XFS_BMAP_INIT(args->flist, args->firstblock); 959 xfs_bmap_init(args->flist, args->firstblock);
960 error = xfs_attr_leaf_to_node(args); 960 error = xfs_attr_leaf_to_node(args);
961 if (!error) { 961 if (!error) {
962 error = xfs_bmap_finish(&args->trans, args->flist, 962 error = xfs_bmap_finish(&args->trans, args->flist,
@@ -1057,7 +1057,7 @@ xfs_attr_leaf_addname(xfs_da_args_t *args)
1057 * If the result is small enough, shrink it all into the inode. 1057 * If the result is small enough, shrink it all into the inode.
1058 */ 1058 */
1059 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { 1059 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
1060 XFS_BMAP_INIT(args->flist, args->firstblock); 1060 xfs_bmap_init(args->flist, args->firstblock);
1061 error = xfs_attr_leaf_to_shortform(bp, args, forkoff); 1061 error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
1062 /* bp is gone due to xfs_da_shrink_inode */ 1062 /* bp is gone due to xfs_da_shrink_inode */
1063 if (!error) { 1063 if (!error) {
@@ -1135,7 +1135,7 @@ xfs_attr_leaf_removename(xfs_da_args_t *args)
1135 * If the result is small enough, shrink it all into the inode. 1135 * If the result is small enough, shrink it all into the inode.
1136 */ 1136 */
1137 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { 1137 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
1138 XFS_BMAP_INIT(args->flist, args->firstblock); 1138 xfs_bmap_init(args->flist, args->firstblock);
1139 error = xfs_attr_leaf_to_shortform(bp, args, forkoff); 1139 error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
1140 /* bp is gone due to xfs_da_shrink_inode */ 1140 /* bp is gone due to xfs_da_shrink_inode */
1141 if (!error) { 1141 if (!error) {
@@ -1290,7 +1290,7 @@ restart:
1290 * have been a b-tree. 1290 * have been a b-tree.
1291 */ 1291 */
1292 xfs_da_state_free(state); 1292 xfs_da_state_free(state);
1293 XFS_BMAP_INIT(args->flist, args->firstblock); 1293 xfs_bmap_init(args->flist, args->firstblock);
1294 error = xfs_attr_leaf_to_node(args); 1294 error = xfs_attr_leaf_to_node(args);
1295 if (!error) { 1295 if (!error) {
1296 error = xfs_bmap_finish(&args->trans, 1296 error = xfs_bmap_finish(&args->trans,
@@ -1331,7 +1331,7 @@ restart:
1331 * in the index/blkno/rmtblkno/rmtblkcnt fields and 1331 * in the index/blkno/rmtblkno/rmtblkcnt fields and
1332 * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields. 1332 * in the index2/blkno2/rmtblkno2/rmtblkcnt2 fields.
1333 */ 1333 */
1334 XFS_BMAP_INIT(args->flist, args->firstblock); 1334 xfs_bmap_init(args->flist, args->firstblock);
1335 error = xfs_da_split(state); 1335 error = xfs_da_split(state);
1336 if (!error) { 1336 if (!error) {
1337 error = xfs_bmap_finish(&args->trans, args->flist, 1337 error = xfs_bmap_finish(&args->trans, args->flist,
@@ -1443,7 +1443,7 @@ restart:
1443 * Check to see if the tree needs to be collapsed. 1443 * Check to see if the tree needs to be collapsed.
1444 */ 1444 */
1445 if (retval && (state->path.active > 1)) { 1445 if (retval && (state->path.active > 1)) {
1446 XFS_BMAP_INIT(args->flist, args->firstblock); 1446 xfs_bmap_init(args->flist, args->firstblock);
1447 error = xfs_da_join(state); 1447 error = xfs_da_join(state);
1448 if (!error) { 1448 if (!error) {
1449 error = xfs_bmap_finish(&args->trans, 1449 error = xfs_bmap_finish(&args->trans,
@@ -1579,7 +1579,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1579 * Check to see if the tree needs to be collapsed. 1579 * Check to see if the tree needs to be collapsed.
1580 */ 1580 */
1581 if (retval && (state->path.active > 1)) { 1581 if (retval && (state->path.active > 1)) {
1582 XFS_BMAP_INIT(args->flist, args->firstblock); 1582 xfs_bmap_init(args->flist, args->firstblock);
1583 error = xfs_da_join(state); 1583 error = xfs_da_join(state);
1584 if (!error) { 1584 if (!error) {
1585 error = xfs_bmap_finish(&args->trans, args->flist, 1585 error = xfs_bmap_finish(&args->trans, args->flist,
@@ -1630,7 +1630,7 @@ xfs_attr_node_removename(xfs_da_args_t *args)
1630 == XFS_ATTR_LEAF_MAGIC); 1630 == XFS_ATTR_LEAF_MAGIC);
1631 1631
1632 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { 1632 if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) {
1633 XFS_BMAP_INIT(args->flist, args->firstblock); 1633 xfs_bmap_init(args->flist, args->firstblock);
1634 error = xfs_attr_leaf_to_shortform(bp, args, forkoff); 1634 error = xfs_attr_leaf_to_shortform(bp, args, forkoff);
1635 /* bp is gone due to xfs_da_shrink_inode */ 1635 /* bp is gone due to xfs_da_shrink_inode */
1636 if (!error) { 1636 if (!error) {
@@ -2069,7 +2069,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2069 /* 2069 /*
2070 * Allocate a single extent, up to the size of the value. 2070 * Allocate a single extent, up to the size of the value.
2071 */ 2071 */
2072 XFS_BMAP_INIT(args->flist, args->firstblock); 2072 xfs_bmap_init(args->flist, args->firstblock);
2073 nmap = 1; 2073 nmap = 1;
2074 error = xfs_bmapi(args->trans, dp, (xfs_fileoff_t)lblkno, 2074 error = xfs_bmapi(args->trans, dp, (xfs_fileoff_t)lblkno,
2075 blkcnt, 2075 blkcnt,
@@ -2123,7 +2123,7 @@ xfs_attr_rmtval_set(xfs_da_args_t *args)
2123 /* 2123 /*
2124 * Try to remember where we decided to put the value. 2124 * Try to remember where we decided to put the value.
2125 */ 2125 */
2126 XFS_BMAP_INIT(args->flist, args->firstblock); 2126 xfs_bmap_init(args->flist, args->firstblock);
2127 nmap = 1; 2127 nmap = 1;
2128 error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno, 2128 error = xfs_bmapi(NULL, dp, (xfs_fileoff_t)lblkno,
2129 args->rmtblkcnt, 2129 args->rmtblkcnt,
@@ -2188,7 +2188,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
2188 /* 2188 /*
2189 * Try to remember where we decided to put the value. 2189 * Try to remember where we decided to put the value.
2190 */ 2190 */
2191 XFS_BMAP_INIT(args->flist, args->firstblock); 2191 xfs_bmap_init(args->flist, args->firstblock);
2192 nmap = 1; 2192 nmap = 1;
2193 error = xfs_bmapi(NULL, args->dp, (xfs_fileoff_t)lblkno, 2193 error = xfs_bmapi(NULL, args->dp, (xfs_fileoff_t)lblkno,
2194 args->rmtblkcnt, 2194 args->rmtblkcnt,
@@ -2229,7 +2229,7 @@ xfs_attr_rmtval_remove(xfs_da_args_t *args)
2229 blkcnt = args->rmtblkcnt; 2229 blkcnt = args->rmtblkcnt;
2230 done = 0; 2230 done = 0;
2231 while (!done) { 2231 while (!done) {
2232 XFS_BMAP_INIT(args->flist, args->firstblock); 2232 xfs_bmap_init(args->flist, args->firstblock);
2233 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt, 2233 error = xfs_bunmapi(args->trans, args->dp, lblkno, blkcnt,
2234 XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA, 2234 XFS_BMAPI_ATTRFORK | XFS_BMAPI_METADATA,
2235 1, args->firstblock, args->flist, 2235 1, args->firstblock, args->flist,
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c
index 138308e70d14..c852cd65aaea 100644
--- a/fs/xfs/xfs_bmap.c
+++ b/fs/xfs/xfs_bmap.c
@@ -595,9 +595,9 @@ xfs_bmap_add_extent(
595 xfs_iext_insert(ifp, 0, 1, new); 595 xfs_iext_insert(ifp, 0, 1, new);
596 ASSERT(cur == NULL); 596 ASSERT(cur == NULL);
597 ifp->if_lastex = 0; 597 ifp->if_lastex = 0;
598 if (!ISNULLSTARTBLOCK(new->br_startblock)) { 598 if (!isnullstartblock(new->br_startblock)) {
599 XFS_IFORK_NEXT_SET(ip, whichfork, 1); 599 XFS_IFORK_NEXT_SET(ip, whichfork, 1);
600 logflags = XFS_ILOG_CORE | XFS_ILOG_FEXT(whichfork); 600 logflags = XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
601 } else 601 } else
602 logflags = 0; 602 logflags = 0;
603 /* DELTA: single new extent */ 603 /* DELTA: single new extent */
@@ -613,7 +613,7 @@ xfs_bmap_add_extent(
613 /* 613 /*
614 * Any kind of new delayed allocation goes here. 614 * Any kind of new delayed allocation goes here.
615 */ 615 */
616 else if (ISNULLSTARTBLOCK(new->br_startblock)) { 616 else if (isnullstartblock(new->br_startblock)) {
617 if (cur) 617 if (cur)
618 ASSERT((cur->bc_private.b.flags & 618 ASSERT((cur->bc_private.b.flags &
619 XFS_BTCUR_BPRV_WASDEL) == 0); 619 XFS_BTCUR_BPRV_WASDEL) == 0);
@@ -644,11 +644,11 @@ xfs_bmap_add_extent(
644 * in a delayed or unwritten allocation with a real one, or 644 * in a delayed or unwritten allocation with a real one, or
645 * converting real back to unwritten. 645 * converting real back to unwritten.
646 */ 646 */
647 if (!ISNULLSTARTBLOCK(new->br_startblock) && 647 if (!isnullstartblock(new->br_startblock) &&
648 new->br_startoff + new->br_blockcount > prev.br_startoff) { 648 new->br_startoff + new->br_blockcount > prev.br_startoff) {
649 if (prev.br_state != XFS_EXT_UNWRITTEN && 649 if (prev.br_state != XFS_EXT_UNWRITTEN &&
650 ISNULLSTARTBLOCK(prev.br_startblock)) { 650 isnullstartblock(prev.br_startblock)) {
651 da_old = STARTBLOCKVAL(prev.br_startblock); 651 da_old = startblockval(prev.br_startblock);
652 if (cur) 652 if (cur)
653 ASSERT(cur->bc_private.b.flags & 653 ASSERT(cur->bc_private.b.flags &
654 XFS_BTCUR_BPRV_WASDEL); 654 XFS_BTCUR_BPRV_WASDEL);
@@ -803,7 +803,7 @@ xfs_bmap_add_extent_delay_real(
803 */ 803 */
804 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) { 804 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) {
805 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &LEFT); 805 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &LEFT);
806 STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(LEFT.br_startblock)); 806 STATE_SET(LEFT_DELAY, isnullstartblock(LEFT.br_startblock));
807 } 807 }
808 STATE_SET(LEFT_CONTIG, 808 STATE_SET(LEFT_CONTIG,
809 STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) && 809 STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) &&
@@ -820,7 +820,7 @@ xfs_bmap_add_extent_delay_real(
820 idx < 820 idx <
821 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1)) { 821 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1)) {
822 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx + 1), &RIGHT); 822 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx + 1), &RIGHT);
823 STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(RIGHT.br_startblock)); 823 STATE_SET(RIGHT_DELAY, isnullstartblock(RIGHT.br_startblock));
824 } 824 }
825 STATE_SET(RIGHT_CONTIG, 825 STATE_SET(RIGHT_CONTIG,
826 STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) && 826 STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) &&
@@ -1019,8 +1019,8 @@ xfs_bmap_add_extent_delay_real(
1019 goto done; 1019 goto done;
1020 } 1020 }
1021 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 1021 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1022 STARTBLOCKVAL(PREV.br_startblock)); 1022 startblockval(PREV.br_startblock));
1023 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 1023 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1024 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK); 1024 XFS_BMAP_TRACE_POST_UPDATE("LF|LC", ip, idx, XFS_DATA_FORK);
1025 *dnew = temp; 1025 *dnew = temp;
1026 /* DELTA: The boundary between two in-core extents moved. */ 1026 /* DELTA: The boundary between two in-core extents moved. */
@@ -1067,10 +1067,10 @@ xfs_bmap_add_extent_delay_real(
1067 goto done; 1067 goto done;
1068 } 1068 }
1069 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 1069 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1070 STARTBLOCKVAL(PREV.br_startblock) - 1070 startblockval(PREV.br_startblock) -
1071 (cur ? cur->bc_private.b.allocated : 0)); 1071 (cur ? cur->bc_private.b.allocated : 0));
1072 ep = xfs_iext_get_ext(ifp, idx + 1); 1072 ep = xfs_iext_get_ext(ifp, idx + 1);
1073 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 1073 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1074 XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx + 1, XFS_DATA_FORK); 1074 XFS_BMAP_TRACE_POST_UPDATE("LF", ip, idx + 1, XFS_DATA_FORK);
1075 *dnew = temp; 1075 *dnew = temp;
1076 /* DELTA: One in-core extent is split in two. */ 1076 /* DELTA: One in-core extent is split in two. */
@@ -1110,8 +1110,8 @@ xfs_bmap_add_extent_delay_real(
1110 goto done; 1110 goto done;
1111 } 1111 }
1112 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 1112 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1113 STARTBLOCKVAL(PREV.br_startblock)); 1113 startblockval(PREV.br_startblock));
1114 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 1114 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1115 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK); 1115 XFS_BMAP_TRACE_POST_UPDATE("RF|RC", ip, idx, XFS_DATA_FORK);
1116 *dnew = temp; 1116 *dnew = temp;
1117 /* DELTA: The boundary between two in-core extents moved. */ 1117 /* DELTA: The boundary between two in-core extents moved. */
@@ -1157,10 +1157,10 @@ xfs_bmap_add_extent_delay_real(
1157 goto done; 1157 goto done;
1158 } 1158 }
1159 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 1159 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
1160 STARTBLOCKVAL(PREV.br_startblock) - 1160 startblockval(PREV.br_startblock) -
1161 (cur ? cur->bc_private.b.allocated : 0)); 1161 (cur ? cur->bc_private.b.allocated : 0));
1162 ep = xfs_iext_get_ext(ifp, idx); 1162 ep = xfs_iext_get_ext(ifp, idx);
1163 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 1163 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1164 XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK); 1164 XFS_BMAP_TRACE_POST_UPDATE("RF", ip, idx, XFS_DATA_FORK);
1165 *dnew = temp; 1165 *dnew = temp;
1166 /* DELTA: One in-core extent is split in two. */ 1166 /* DELTA: One in-core extent is split in two. */
@@ -1213,7 +1213,7 @@ xfs_bmap_add_extent_delay_real(
1213 } 1213 }
1214 temp = xfs_bmap_worst_indlen(ip, temp); 1214 temp = xfs_bmap_worst_indlen(ip, temp);
1215 temp2 = xfs_bmap_worst_indlen(ip, temp2); 1215 temp2 = xfs_bmap_worst_indlen(ip, temp2);
1216 diff = (int)(temp + temp2 - STARTBLOCKVAL(PREV.br_startblock) - 1216 diff = (int)(temp + temp2 - startblockval(PREV.br_startblock) -
1217 (cur ? cur->bc_private.b.allocated : 0)); 1217 (cur ? cur->bc_private.b.allocated : 0));
1218 if (diff > 0 && 1218 if (diff > 0 &&
1219 xfs_mod_incore_sb(ip->i_mount, XFS_SBS_FDBLOCKS, -((int64_t)diff), rsvd)) { 1219 xfs_mod_incore_sb(ip->i_mount, XFS_SBS_FDBLOCKS, -((int64_t)diff), rsvd)) {
@@ -1241,11 +1241,11 @@ xfs_bmap_add_extent_delay_real(
1241 } 1241 }
1242 } 1242 }
1243 ep = xfs_iext_get_ext(ifp, idx); 1243 ep = xfs_iext_get_ext(ifp, idx);
1244 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 1244 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
1245 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK); 1245 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx, XFS_DATA_FORK);
1246 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); 1246 XFS_BMAP_TRACE_PRE_UPDATE("0", ip, idx + 2, XFS_DATA_FORK);
1247 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2), 1247 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx + 2),
1248 NULLSTARTBLOCK((int)temp2)); 1248 nullstartblock((int)temp2));
1249 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx + 2, XFS_DATA_FORK); 1249 XFS_BMAP_TRACE_POST_UPDATE("0", ip, idx + 2, XFS_DATA_FORK);
1250 *dnew = temp + temp2; 1250 *dnew = temp + temp2;
1251 /* DELTA: One in-core extent is split in three. */ 1251 /* DELTA: One in-core extent is split in three. */
@@ -1365,7 +1365,7 @@ xfs_bmap_add_extent_unwritten_real(
1365 */ 1365 */
1366 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) { 1366 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) {
1367 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &LEFT); 1367 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &LEFT);
1368 STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(LEFT.br_startblock)); 1368 STATE_SET(LEFT_DELAY, isnullstartblock(LEFT.br_startblock));
1369 } 1369 }
1370 STATE_SET(LEFT_CONTIG, 1370 STATE_SET(LEFT_CONTIG,
1371 STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) && 1371 STATE_TEST(LEFT_VALID) && !STATE_TEST(LEFT_DELAY) &&
@@ -1382,7 +1382,7 @@ xfs_bmap_add_extent_unwritten_real(
1382 idx < 1382 idx <
1383 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1)) { 1383 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t) - 1)) {
1384 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx + 1), &RIGHT); 1384 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx + 1), &RIGHT);
1385 STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(RIGHT.br_startblock)); 1385 STATE_SET(RIGHT_DELAY, isnullstartblock(RIGHT.br_startblock));
1386 } 1386 }
1387 STATE_SET(RIGHT_CONTIG, 1387 STATE_SET(RIGHT_CONTIG,
1388 STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) && 1388 STATE_TEST(RIGHT_VALID) && !STATE_TEST(RIGHT_DELAY) &&
@@ -1889,13 +1889,13 @@ xfs_bmap_add_extent_hole_delay(
1889 ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 1889 ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
1890 ep = xfs_iext_get_ext(ifp, idx); 1890 ep = xfs_iext_get_ext(ifp, idx);
1891 state = 0; 1891 state = 0;
1892 ASSERT(ISNULLSTARTBLOCK(new->br_startblock)); 1892 ASSERT(isnullstartblock(new->br_startblock));
1893 /* 1893 /*
1894 * Check and set flags if this segment has a left neighbor 1894 * Check and set flags if this segment has a left neighbor
1895 */ 1895 */
1896 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) { 1896 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) {
1897 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &left); 1897 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &left);
1898 STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(left.br_startblock)); 1898 STATE_SET(LEFT_DELAY, isnullstartblock(left.br_startblock));
1899 } 1899 }
1900 /* 1900 /*
1901 * Check and set flags if the current (right) segment exists. 1901 * Check and set flags if the current (right) segment exists.
@@ -1905,7 +1905,7 @@ xfs_bmap_add_extent_hole_delay(
1905 idx < 1905 idx <
1906 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t))) { 1906 ip->i_df.if_bytes / (uint)sizeof(xfs_bmbt_rec_t))) {
1907 xfs_bmbt_get_all(ep, &right); 1907 xfs_bmbt_get_all(ep, &right);
1908 STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(right.br_startblock)); 1908 STATE_SET(RIGHT_DELAY, isnullstartblock(right.br_startblock));
1909 } 1909 }
1910 /* 1910 /*
1911 * Set contiguity flags on the left and right neighbors. 1911 * Set contiguity flags on the left and right neighbors.
@@ -1938,12 +1938,12 @@ xfs_bmap_add_extent_hole_delay(
1938 XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1, 1938 XFS_BMAP_TRACE_PRE_UPDATE("LC|RC", ip, idx - 1,
1939 XFS_DATA_FORK); 1939 XFS_DATA_FORK);
1940 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); 1940 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp);
1941 oldlen = STARTBLOCKVAL(left.br_startblock) + 1941 oldlen = startblockval(left.br_startblock) +
1942 STARTBLOCKVAL(new->br_startblock) + 1942 startblockval(new->br_startblock) +
1943 STARTBLOCKVAL(right.br_startblock); 1943 startblockval(right.br_startblock);
1944 newlen = xfs_bmap_worst_indlen(ip, temp); 1944 newlen = xfs_bmap_worst_indlen(ip, temp);
1945 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), 1945 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1),
1946 NULLSTARTBLOCK((int)newlen)); 1946 nullstartblock((int)newlen));
1947 XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1, 1947 XFS_BMAP_TRACE_POST_UPDATE("LC|RC", ip, idx - 1,
1948 XFS_DATA_FORK); 1948 XFS_DATA_FORK);
1949 XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK); 1949 XFS_BMAP_TRACE_DELETE("LC|RC", ip, idx, 1, XFS_DATA_FORK);
@@ -1964,11 +1964,11 @@ xfs_bmap_add_extent_hole_delay(
1964 XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1, 1964 XFS_BMAP_TRACE_PRE_UPDATE("LC", ip, idx - 1,
1965 XFS_DATA_FORK); 1965 XFS_DATA_FORK);
1966 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp); 1966 xfs_bmbt_set_blockcount(xfs_iext_get_ext(ifp, idx - 1), temp);
1967 oldlen = STARTBLOCKVAL(left.br_startblock) + 1967 oldlen = startblockval(left.br_startblock) +
1968 STARTBLOCKVAL(new->br_startblock); 1968 startblockval(new->br_startblock);
1969 newlen = xfs_bmap_worst_indlen(ip, temp); 1969 newlen = xfs_bmap_worst_indlen(ip, temp);
1970 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1), 1970 xfs_bmbt_set_startblock(xfs_iext_get_ext(ifp, idx - 1),
1971 NULLSTARTBLOCK((int)newlen)); 1971 nullstartblock((int)newlen));
1972 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, 1972 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1,
1973 XFS_DATA_FORK); 1973 XFS_DATA_FORK);
1974 ip->i_df.if_lastex = idx - 1; 1974 ip->i_df.if_lastex = idx - 1;
@@ -1985,11 +1985,11 @@ xfs_bmap_add_extent_hole_delay(
1985 */ 1985 */
1986 XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, XFS_DATA_FORK); 1986 XFS_BMAP_TRACE_PRE_UPDATE("RC", ip, idx, XFS_DATA_FORK);
1987 temp = new->br_blockcount + right.br_blockcount; 1987 temp = new->br_blockcount + right.br_blockcount;
1988 oldlen = STARTBLOCKVAL(new->br_startblock) + 1988 oldlen = startblockval(new->br_startblock) +
1989 STARTBLOCKVAL(right.br_startblock); 1989 startblockval(right.br_startblock);
1990 newlen = xfs_bmap_worst_indlen(ip, temp); 1990 newlen = xfs_bmap_worst_indlen(ip, temp);
1991 xfs_bmbt_set_allf(ep, new->br_startoff, 1991 xfs_bmbt_set_allf(ep, new->br_startoff,
1992 NULLSTARTBLOCK((int)newlen), temp, right.br_state); 1992 nullstartblock((int)newlen), temp, right.br_state);
1993 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, XFS_DATA_FORK); 1993 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, XFS_DATA_FORK);
1994 ip->i_df.if_lastex = idx; 1994 ip->i_df.if_lastex = idx;
1995 /* DELTA: One in-core extent grew into a hole. */ 1995 /* DELTA: One in-core extent grew into a hole. */
@@ -2085,7 +2085,7 @@ xfs_bmap_add_extent_hole_real(
2085 */ 2085 */
2086 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) { 2086 if (STATE_SET_TEST(LEFT_VALID, idx > 0)) {
2087 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &left); 2087 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx - 1), &left);
2088 STATE_SET(LEFT_DELAY, ISNULLSTARTBLOCK(left.br_startblock)); 2088 STATE_SET(LEFT_DELAY, isnullstartblock(left.br_startblock));
2089 } 2089 }
2090 /* 2090 /*
2091 * Check and set flags if this segment has a current value. 2091 * Check and set flags if this segment has a current value.
@@ -2095,7 +2095,7 @@ xfs_bmap_add_extent_hole_real(
2095 idx < 2095 idx <
2096 ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))) { 2096 ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t))) {
2097 xfs_bmbt_get_all(ep, &right); 2097 xfs_bmbt_get_all(ep, &right);
2098 STATE_SET(RIGHT_DELAY, ISNULLSTARTBLOCK(right.br_startblock)); 2098 STATE_SET(RIGHT_DELAY, isnullstartblock(right.br_startblock));
2099 } 2099 }
2100 /* 2100 /*
2101 * We're inserting a real allocation between "left" and "right". 2101 * We're inserting a real allocation between "left" and "right".
@@ -2143,7 +2143,7 @@ xfs_bmap_add_extent_hole_real(
2143 XFS_IFORK_NEXT_SET(ip, whichfork, 2143 XFS_IFORK_NEXT_SET(ip, whichfork,
2144 XFS_IFORK_NEXTENTS(ip, whichfork) - 1); 2144 XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
2145 if (cur == NULL) { 2145 if (cur == NULL) {
2146 rval = XFS_ILOG_CORE | XFS_ILOG_FEXT(whichfork); 2146 rval = XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
2147 } else { 2147 } else {
2148 rval = XFS_ILOG_CORE; 2148 rval = XFS_ILOG_CORE;
2149 if ((error = xfs_bmbt_lookup_eq(cur, 2149 if ((error = xfs_bmbt_lookup_eq(cur,
@@ -2185,7 +2185,7 @@ xfs_bmap_add_extent_hole_real(
2185 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, whichfork); 2185 XFS_BMAP_TRACE_POST_UPDATE("LC", ip, idx - 1, whichfork);
2186 ifp->if_lastex = idx - 1; 2186 ifp->if_lastex = idx - 1;
2187 if (cur == NULL) { 2187 if (cur == NULL) {
2188 rval = XFS_ILOG_FEXT(whichfork); 2188 rval = xfs_ilog_fext(whichfork);
2189 } else { 2189 } else {
2190 rval = 0; 2190 rval = 0;
2191 if ((error = xfs_bmbt_lookup_eq(cur, 2191 if ((error = xfs_bmbt_lookup_eq(cur,
@@ -2220,7 +2220,7 @@ xfs_bmap_add_extent_hole_real(
2220 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, whichfork); 2220 XFS_BMAP_TRACE_POST_UPDATE("RC", ip, idx, whichfork);
2221 ifp->if_lastex = idx; 2221 ifp->if_lastex = idx;
2222 if (cur == NULL) { 2222 if (cur == NULL) {
2223 rval = XFS_ILOG_FEXT(whichfork); 2223 rval = xfs_ilog_fext(whichfork);
2224 } else { 2224 } else {
2225 rval = 0; 2225 rval = 0;
2226 if ((error = xfs_bmbt_lookup_eq(cur, 2226 if ((error = xfs_bmbt_lookup_eq(cur,
@@ -2254,7 +2254,7 @@ xfs_bmap_add_extent_hole_real(
2254 XFS_IFORK_NEXT_SET(ip, whichfork, 2254 XFS_IFORK_NEXT_SET(ip, whichfork,
2255 XFS_IFORK_NEXTENTS(ip, whichfork) + 1); 2255 XFS_IFORK_NEXTENTS(ip, whichfork) + 1);
2256 if (cur == NULL) { 2256 if (cur == NULL) {
2257 rval = XFS_ILOG_CORE | XFS_ILOG_FEXT(whichfork); 2257 rval = XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
2258 } else { 2258 } else {
2259 rval = XFS_ILOG_CORE; 2259 rval = XFS_ILOG_CORE;
2260 if ((error = xfs_bmbt_lookup_eq(cur, 2260 if ((error = xfs_bmbt_lookup_eq(cur,
@@ -2482,7 +2482,7 @@ xfs_bmap_adjacent(
2482 * try to use it's last block as our starting point. 2482 * try to use it's last block as our starting point.
2483 */ 2483 */
2484 if (ap->eof && ap->prevp->br_startoff != NULLFILEOFF && 2484 if (ap->eof && ap->prevp->br_startoff != NULLFILEOFF &&
2485 !ISNULLSTARTBLOCK(ap->prevp->br_startblock) && 2485 !isnullstartblock(ap->prevp->br_startblock) &&
2486 ISVALID(ap->prevp->br_startblock + ap->prevp->br_blockcount, 2486 ISVALID(ap->prevp->br_startblock + ap->prevp->br_blockcount,
2487 ap->prevp->br_startblock)) { 2487 ap->prevp->br_startblock)) {
2488 ap->rval = ap->prevp->br_startblock + ap->prevp->br_blockcount; 2488 ap->rval = ap->prevp->br_startblock + ap->prevp->br_blockcount;
@@ -2511,7 +2511,7 @@ xfs_bmap_adjacent(
2511 * start block based on it. 2511 * start block based on it.
2512 */ 2512 */
2513 if (ap->prevp->br_startoff != NULLFILEOFF && 2513 if (ap->prevp->br_startoff != NULLFILEOFF &&
2514 !ISNULLSTARTBLOCK(ap->prevp->br_startblock) && 2514 !isnullstartblock(ap->prevp->br_startblock) &&
2515 (prevbno = ap->prevp->br_startblock + 2515 (prevbno = ap->prevp->br_startblock +
2516 ap->prevp->br_blockcount) && 2516 ap->prevp->br_blockcount) &&
2517 ISVALID(prevbno, ap->prevp->br_startblock)) { 2517 ISVALID(prevbno, ap->prevp->br_startblock)) {
@@ -2552,7 +2552,7 @@ xfs_bmap_adjacent(
2552 * If there's a following (right) block, select a requested 2552 * If there's a following (right) block, select a requested
2553 * start block based on it. 2553 * start block based on it.
2554 */ 2554 */
2555 if (!ISNULLSTARTBLOCK(ap->gotp->br_startblock)) { 2555 if (!isnullstartblock(ap->gotp->br_startblock)) {
2556 /* 2556 /*
2557 * Calculate gap to start of next block. 2557 * Calculate gap to start of next block.
2558 */ 2558 */
@@ -3082,7 +3082,7 @@ xfs_bmap_btree_to_extents(
3082 ASSERT(ifp->if_broot == NULL); 3082 ASSERT(ifp->if_broot == NULL);
3083 ASSERT((ifp->if_flags & XFS_IFBROOT) == 0); 3083 ASSERT((ifp->if_flags & XFS_IFBROOT) == 0);
3084 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS); 3084 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_EXTENTS);
3085 *logflagsp = XFS_ILOG_CORE | XFS_ILOG_FEXT(whichfork); 3085 *logflagsp = XFS_ILOG_CORE | xfs_ilog_fext(whichfork);
3086 return 0; 3086 return 0;
3087} 3087}
3088 3088
@@ -3136,8 +3136,8 @@ xfs_bmap_del_extent(
3136 del_endoff = del->br_startoff + del->br_blockcount; 3136 del_endoff = del->br_startoff + del->br_blockcount;
3137 got_endoff = got.br_startoff + got.br_blockcount; 3137 got_endoff = got.br_startoff + got.br_blockcount;
3138 ASSERT(got_endoff >= del_endoff); 3138 ASSERT(got_endoff >= del_endoff);
3139 delay = ISNULLSTARTBLOCK(got.br_startblock); 3139 delay = isnullstartblock(got.br_startblock);
3140 ASSERT(ISNULLSTARTBLOCK(del->br_startblock) == delay); 3140 ASSERT(isnullstartblock(del->br_startblock) == delay);
3141 flags = 0; 3141 flags = 0;
3142 qfield = 0; 3142 qfield = 0;
3143 error = 0; 3143 error = 0;
@@ -3189,7 +3189,7 @@ xfs_bmap_del_extent(
3189 } 3189 }
3190 da_old = da_new = 0; 3190 da_old = da_new = 0;
3191 } else { 3191 } else {
3192 da_old = STARTBLOCKVAL(got.br_startblock); 3192 da_old = startblockval(got.br_startblock);
3193 da_new = 0; 3193 da_new = 0;
3194 nblks = 0; 3194 nblks = 0;
3195 do_fx = 0; 3195 do_fx = 0;
@@ -3213,7 +3213,7 @@ xfs_bmap_del_extent(
3213 XFS_IFORK_NEXTENTS(ip, whichfork) - 1); 3213 XFS_IFORK_NEXTENTS(ip, whichfork) - 1);
3214 flags |= XFS_ILOG_CORE; 3214 flags |= XFS_ILOG_CORE;
3215 if (!cur) { 3215 if (!cur) {
3216 flags |= XFS_ILOG_FEXT(whichfork); 3216 flags |= xfs_ilog_fext(whichfork);
3217 break; 3217 break;
3218 } 3218 }
3219 if ((error = xfs_btree_delete(cur, &i))) 3219 if ((error = xfs_btree_delete(cur, &i)))
@@ -3233,7 +3233,7 @@ xfs_bmap_del_extent(
3233 if (delay) { 3233 if (delay) {
3234 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 3234 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
3235 da_old); 3235 da_old);
3236 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 3236 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
3237 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, 3237 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx,
3238 whichfork); 3238 whichfork);
3239 da_new = temp; 3239 da_new = temp;
@@ -3242,7 +3242,7 @@ xfs_bmap_del_extent(
3242 xfs_bmbt_set_startblock(ep, del_endblock); 3242 xfs_bmbt_set_startblock(ep, del_endblock);
3243 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, whichfork); 3243 XFS_BMAP_TRACE_POST_UPDATE("2", ip, idx, whichfork);
3244 if (!cur) { 3244 if (!cur) {
3245 flags |= XFS_ILOG_FEXT(whichfork); 3245 flags |= xfs_ilog_fext(whichfork);
3246 break; 3246 break;
3247 } 3247 }
3248 if ((error = xfs_bmbt_update(cur, del_endoff, del_endblock, 3248 if ((error = xfs_bmbt_update(cur, del_endoff, del_endblock,
@@ -3262,7 +3262,7 @@ xfs_bmap_del_extent(
3262 if (delay) { 3262 if (delay) {
3263 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp), 3263 temp = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip, temp),
3264 da_old); 3264 da_old);
3265 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 3265 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
3266 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, 3266 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx,
3267 whichfork); 3267 whichfork);
3268 da_new = temp; 3268 da_new = temp;
@@ -3270,7 +3270,7 @@ xfs_bmap_del_extent(
3270 } 3270 }
3271 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, whichfork); 3271 XFS_BMAP_TRACE_POST_UPDATE("1", ip, idx, whichfork);
3272 if (!cur) { 3272 if (!cur) {
3273 flags |= XFS_ILOG_FEXT(whichfork); 3273 flags |= xfs_ilog_fext(whichfork);
3274 break; 3274 break;
3275 } 3275 }
3276 if ((error = xfs_bmbt_update(cur, got.br_startoff, 3276 if ((error = xfs_bmbt_update(cur, got.br_startoff,
@@ -3345,22 +3345,22 @@ xfs_bmap_del_extent(
3345 } 3345 }
3346 XFS_WANT_CORRUPTED_GOTO(i == 1, done); 3346 XFS_WANT_CORRUPTED_GOTO(i == 1, done);
3347 } else 3347 } else
3348 flags |= XFS_ILOG_FEXT(whichfork); 3348 flags |= xfs_ilog_fext(whichfork);
3349 XFS_IFORK_NEXT_SET(ip, whichfork, 3349 XFS_IFORK_NEXT_SET(ip, whichfork,
3350 XFS_IFORK_NEXTENTS(ip, whichfork) + 1); 3350 XFS_IFORK_NEXTENTS(ip, whichfork) + 1);
3351 } else { 3351 } else {
3352 ASSERT(whichfork == XFS_DATA_FORK); 3352 ASSERT(whichfork == XFS_DATA_FORK);
3353 temp = xfs_bmap_worst_indlen(ip, temp); 3353 temp = xfs_bmap_worst_indlen(ip, temp);
3354 xfs_bmbt_set_startblock(ep, NULLSTARTBLOCK((int)temp)); 3354 xfs_bmbt_set_startblock(ep, nullstartblock((int)temp));
3355 temp2 = xfs_bmap_worst_indlen(ip, temp2); 3355 temp2 = xfs_bmap_worst_indlen(ip, temp2);
3356 new.br_startblock = NULLSTARTBLOCK((int)temp2); 3356 new.br_startblock = nullstartblock((int)temp2);
3357 da_new = temp + temp2; 3357 da_new = temp + temp2;
3358 while (da_new > da_old) { 3358 while (da_new > da_old) {
3359 if (temp) { 3359 if (temp) {
3360 temp--; 3360 temp--;
3361 da_new--; 3361 da_new--;
3362 xfs_bmbt_set_startblock(ep, 3362 xfs_bmbt_set_startblock(ep,
3363 NULLSTARTBLOCK((int)temp)); 3363 nullstartblock((int)temp));
3364 } 3364 }
3365 if (da_new == da_old) 3365 if (da_new == da_old)
3366 break; 3366 break;
@@ -3368,7 +3368,7 @@ xfs_bmap_del_extent(
3368 temp2--; 3368 temp2--;
3369 da_new--; 3369 da_new--;
3370 new.br_startblock = 3370 new.br_startblock =
3371 NULLSTARTBLOCK((int)temp2); 3371 nullstartblock((int)temp2);
3372 } 3372 }
3373 } 3373 }
3374 } 3374 }
@@ -3545,7 +3545,7 @@ xfs_bmap_extents_to_btree(
3545 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t); 3545 nextents = ifp->if_bytes / (uint)sizeof(xfs_bmbt_rec_t);
3546 for (cnt = i = 0; i < nextents; i++) { 3546 for (cnt = i = 0; i < nextents; i++) {
3547 ep = xfs_iext_get_ext(ifp, i); 3547 ep = xfs_iext_get_ext(ifp, i);
3548 if (!ISNULLSTARTBLOCK(xfs_bmbt_get_startblock(ep))) { 3548 if (!isnullstartblock(xfs_bmbt_get_startblock(ep))) {
3549 arp->l0 = cpu_to_be64(ep->l0); 3549 arp->l0 = cpu_to_be64(ep->l0);
3550 arp->l1 = cpu_to_be64(ep->l1); 3550 arp->l1 = cpu_to_be64(ep->l1);
3551 arp++; cnt++; 3551 arp++; cnt++;
@@ -3572,7 +3572,7 @@ xfs_bmap_extents_to_btree(
3572 xfs_btree_log_recs(cur, abp, 1, be16_to_cpu(ablock->bb_numrecs)); 3572 xfs_btree_log_recs(cur, abp, 1, be16_to_cpu(ablock->bb_numrecs));
3573 ASSERT(*curp == NULL); 3573 ASSERT(*curp == NULL);
3574 *curp = cur; 3574 *curp = cur;
3575 *logflagsp = XFS_ILOG_CORE | XFS_ILOG_FBROOT(whichfork); 3575 *logflagsp = XFS_ILOG_CORE | xfs_ilog_fbroot(whichfork);
3576 return 0; 3576 return 0;
3577} 3577}
3578 3578
@@ -3676,7 +3676,7 @@ xfs_bmap_local_to_extents(
3676 ip->i_d.di_nblocks = 1; 3676 ip->i_d.di_nblocks = 1;
3677 XFS_TRANS_MOD_DQUOT_BYINO(args.mp, tp, ip, 3677 XFS_TRANS_MOD_DQUOT_BYINO(args.mp, tp, ip,
3678 XFS_TRANS_DQ_BCOUNT, 1L); 3678 XFS_TRANS_DQ_BCOUNT, 1L);
3679 flags |= XFS_ILOG_FEXT(whichfork); 3679 flags |= xfs_ilog_fext(whichfork);
3680 } else { 3680 } else {
3681 ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) == 0); 3681 ASSERT(XFS_IFORK_NEXTENTS(ip, whichfork) == 0);
3682 xfs_bmap_forkoff_reset(ip->i_mount, ip, whichfork); 3682 xfs_bmap_forkoff_reset(ip->i_mount, ip, whichfork);
@@ -4082,7 +4082,7 @@ xfs_bmap_add_attrfork(
4082 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t); 4082 XFS_IFORK_ASIZE(ip) / (uint)sizeof(xfs_bmbt_rec_t);
4083 ip->i_afp->if_flags = XFS_IFEXTENTS; 4083 ip->i_afp->if_flags = XFS_IFEXTENTS;
4084 logflags = 0; 4084 logflags = 0;
4085 XFS_BMAP_INIT(&flist, &firstblock); 4085 xfs_bmap_init(&flist, &firstblock);
4086 switch (ip->i_d.di_format) { 4086 switch (ip->i_d.di_format) {
4087 case XFS_DINODE_FMT_LOCAL: 4087 case XFS_DINODE_FMT_LOCAL:
4088 error = xfs_bmap_add_attrfork_local(tp, ip, &firstblock, &flist, 4088 error = xfs_bmap_add_attrfork_local(tp, ip, &firstblock, &flist,
@@ -4162,7 +4162,7 @@ xfs_bmap_add_free(
4162 ASSERT(bno != NULLFSBLOCK); 4162 ASSERT(bno != NULLFSBLOCK);
4163 ASSERT(len > 0); 4163 ASSERT(len > 0);
4164 ASSERT(len <= MAXEXTLEN); 4164 ASSERT(len <= MAXEXTLEN);
4165 ASSERT(!ISNULLSTARTBLOCK(bno)); 4165 ASSERT(!isnullstartblock(bno));
4166 agno = XFS_FSB_TO_AGNO(mp, bno); 4166 agno = XFS_FSB_TO_AGNO(mp, bno);
4167 agbno = XFS_FSB_TO_AGBNO(mp, bno); 4167 agbno = XFS_FSB_TO_AGBNO(mp, bno);
4168 ASSERT(agno < mp->m_sb.sb_agcount); 4168 ASSERT(agno < mp->m_sb.sb_agcount);
@@ -4909,7 +4909,7 @@ xfs_bmapi(
4909 got.br_startoff = end; 4909 got.br_startoff = end;
4910 inhole = eof || got.br_startoff > bno; 4910 inhole = eof || got.br_startoff > bno;
4911 wasdelay = wr && !inhole && !(flags & XFS_BMAPI_DELAY) && 4911 wasdelay = wr && !inhole && !(flags & XFS_BMAPI_DELAY) &&
4912 ISNULLSTARTBLOCK(got.br_startblock); 4912 isnullstartblock(got.br_startblock);
4913 /* 4913 /*
4914 * First, deal with the hole before the allocated space 4914 * First, deal with the hole before the allocated space
4915 * that we found, if any. 4915 * that we found, if any.
@@ -5028,7 +5028,7 @@ xfs_bmapi(
5028 } 5028 }
5029 5029
5030 ip->i_delayed_blks += alen; 5030 ip->i_delayed_blks += alen;
5031 abno = NULLSTARTBLOCK(indlen); 5031 abno = nullstartblock(indlen);
5032 } else { 5032 } else {
5033 /* 5033 /*
5034 * If first time, allocate and fill in 5034 * If first time, allocate and fill in
@@ -5144,8 +5144,8 @@ xfs_bmapi(
5144 aoff + alen); 5144 aoff + alen);
5145#ifdef DEBUG 5145#ifdef DEBUG
5146 if (flags & XFS_BMAPI_DELAY) { 5146 if (flags & XFS_BMAPI_DELAY) {
5147 ASSERT(ISNULLSTARTBLOCK(got.br_startblock)); 5147 ASSERT(isnullstartblock(got.br_startblock));
5148 ASSERT(STARTBLOCKVAL(got.br_startblock) > 0); 5148 ASSERT(startblockval(got.br_startblock) > 0);
5149 } 5149 }
5150 ASSERT(got.br_state == XFS_EXT_NORM || 5150 ASSERT(got.br_state == XFS_EXT_NORM ||
5151 got.br_state == XFS_EXT_UNWRITTEN); 5151 got.br_state == XFS_EXT_UNWRITTEN);
@@ -5179,7 +5179,7 @@ xfs_bmapi(
5179 ASSERT((bno >= obno) || (n == 0)); 5179 ASSERT((bno >= obno) || (n == 0));
5180 ASSERT(bno < end); 5180 ASSERT(bno < end);
5181 mval->br_startoff = bno; 5181 mval->br_startoff = bno;
5182 if (ISNULLSTARTBLOCK(got.br_startblock)) { 5182 if (isnullstartblock(got.br_startblock)) {
5183 ASSERT(!wr || (flags & XFS_BMAPI_DELAY)); 5183 ASSERT(!wr || (flags & XFS_BMAPI_DELAY));
5184 mval->br_startblock = DELAYSTARTBLOCK; 5184 mval->br_startblock = DELAYSTARTBLOCK;
5185 } else 5185 } else
@@ -5201,7 +5201,7 @@ xfs_bmapi(
5201 ASSERT(mval->br_blockcount <= len); 5201 ASSERT(mval->br_blockcount <= len);
5202 } else { 5202 } else {
5203 *mval = got; 5203 *mval = got;
5204 if (ISNULLSTARTBLOCK(mval->br_startblock)) { 5204 if (isnullstartblock(mval->br_startblock)) {
5205 ASSERT(!wr || (flags & XFS_BMAPI_DELAY)); 5205 ASSERT(!wr || (flags & XFS_BMAPI_DELAY));
5206 mval->br_startblock = DELAYSTARTBLOCK; 5206 mval->br_startblock = DELAYSTARTBLOCK;
5207 } 5207 }
@@ -5329,12 +5329,12 @@ error0:
5329 * Log everything. Do this after conversion, there's no point in 5329 * Log everything. Do this after conversion, there's no point in
5330 * logging the extent records if we've converted to btree format. 5330 * logging the extent records if we've converted to btree format.
5331 */ 5331 */
5332 if ((logflags & XFS_ILOG_FEXT(whichfork)) && 5332 if ((logflags & xfs_ilog_fext(whichfork)) &&
5333 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) 5333 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)
5334 logflags &= ~XFS_ILOG_FEXT(whichfork); 5334 logflags &= ~xfs_ilog_fext(whichfork);
5335 else if ((logflags & XFS_ILOG_FBROOT(whichfork)) && 5335 else if ((logflags & xfs_ilog_fbroot(whichfork)) &&
5336 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE) 5336 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)
5337 logflags &= ~XFS_ILOG_FBROOT(whichfork); 5337 logflags &= ~xfs_ilog_fbroot(whichfork);
5338 /* 5338 /*
5339 * Log whatever the flags say, even if error. Otherwise we might miss 5339 * Log whatever the flags say, even if error. Otherwise we might miss
5340 * detecting a case where the data is changed, there's an error, 5340 * detecting a case where the data is changed, there's an error,
@@ -5411,7 +5411,7 @@ xfs_bmapi_single(
5411 *fsb = NULLFSBLOCK; 5411 *fsb = NULLFSBLOCK;
5412 return 0; 5412 return 0;
5413 } 5413 }
5414 ASSERT(!ISNULLSTARTBLOCK(got.br_startblock)); 5414 ASSERT(!isnullstartblock(got.br_startblock));
5415 ASSERT(bno < got.br_startoff + got.br_blockcount); 5415 ASSERT(bno < got.br_startoff + got.br_blockcount);
5416 *fsb = got.br_startblock + (bno - got.br_startoff); 5416 *fsb = got.br_startblock + (bno - got.br_startoff);
5417 ifp->if_lastex = lastx; 5417 ifp->if_lastex = lastx;
@@ -5543,7 +5543,7 @@ xfs_bunmapi(
5543 */ 5543 */
5544 ASSERT(ep != NULL); 5544 ASSERT(ep != NULL);
5545 del = got; 5545 del = got;
5546 wasdel = ISNULLSTARTBLOCK(del.br_startblock); 5546 wasdel = isnullstartblock(del.br_startblock);
5547 if (got.br_startoff < start) { 5547 if (got.br_startoff < start) {
5548 del.br_startoff = start; 5548 del.br_startoff = start;
5549 del.br_blockcount -= start - got.br_startoff; 5549 del.br_blockcount -= start - got.br_startoff;
@@ -5638,7 +5638,7 @@ xfs_bunmapi(
5638 xfs_bmbt_get_all(xfs_iext_get_ext(ifp, 5638 xfs_bmbt_get_all(xfs_iext_get_ext(ifp,
5639 lastx - 1), &prev); 5639 lastx - 1), &prev);
5640 ASSERT(prev.br_state == XFS_EXT_NORM); 5640 ASSERT(prev.br_state == XFS_EXT_NORM);
5641 ASSERT(!ISNULLSTARTBLOCK(prev.br_startblock)); 5641 ASSERT(!isnullstartblock(prev.br_startblock));
5642 ASSERT(del.br_startblock == 5642 ASSERT(del.br_startblock ==
5643 prev.br_startblock + prev.br_blockcount); 5643 prev.br_startblock + prev.br_blockcount);
5644 if (prev.br_startoff < start) { 5644 if (prev.br_startoff < start) {
@@ -5666,7 +5666,7 @@ xfs_bunmapi(
5666 } 5666 }
5667 } 5667 }
5668 if (wasdel) { 5668 if (wasdel) {
5669 ASSERT(STARTBLOCKVAL(del.br_startblock) > 0); 5669 ASSERT(startblockval(del.br_startblock) > 0);
5670 /* Update realtime/data freespace, unreserve quota */ 5670 /* Update realtime/data freespace, unreserve quota */
5671 if (isrt) { 5671 if (isrt) {
5672 xfs_filblks_t rtexts; 5672 xfs_filblks_t rtexts;
@@ -5782,12 +5782,12 @@ error0:
5782 * Log everything. Do this after conversion, there's no point in 5782 * Log everything. Do this after conversion, there's no point in
5783 * logging the extent records if we've converted to btree format. 5783 * logging the extent records if we've converted to btree format.
5784 */ 5784 */
5785 if ((logflags & XFS_ILOG_FEXT(whichfork)) && 5785 if ((logflags & xfs_ilog_fext(whichfork)) &&
5786 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS) 5786 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_EXTENTS)
5787 logflags &= ~XFS_ILOG_FEXT(whichfork); 5787 logflags &= ~xfs_ilog_fext(whichfork);
5788 else if ((logflags & XFS_ILOG_FBROOT(whichfork)) && 5788 else if ((logflags & xfs_ilog_fbroot(whichfork)) &&
5789 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE) 5789 XFS_IFORK_FORMAT(ip, whichfork) != XFS_DINODE_FMT_BTREE)
5790 logflags &= ~XFS_ILOG_FBROOT(whichfork); 5790 logflags &= ~xfs_ilog_fbroot(whichfork);
5791 /* 5791 /*
5792 * Log inode even in the error case, if the transaction 5792 * Log inode even in the error case, if the transaction
5793 * is dirty we'll need to shut down the filesystem. 5793 * is dirty we'll need to shut down the filesystem.
@@ -5838,7 +5838,7 @@ xfs_getbmapx_fix_eof_hole(
5838 if (startblock == DELAYSTARTBLOCK) 5838 if (startblock == DELAYSTARTBLOCK)
5839 out->bmv_block = -2; 5839 out->bmv_block = -2;
5840 else 5840 else
5841 out->bmv_block = XFS_FSB_TO_DB(ip, startblock); 5841 out->bmv_block = xfs_fsb_to_db(ip, startblock);
5842 fileblock = XFS_BB_TO_FSB(ip->i_mount, out->bmv_offset); 5842 fileblock = XFS_BB_TO_FSB(ip->i_mount, out->bmv_offset);
5843 ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK); 5843 ifp = XFS_IFORK_PTR(ip, XFS_DATA_FORK);
5844 if (xfs_iext_bno_to_ext(ifp, fileblock, &lastx) && 5844 if (xfs_iext_bno_to_ext(ifp, fileblock, &lastx) &&
@@ -5979,7 +5979,7 @@ xfs_getbmap(
5979 if (nex > XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1) 5979 if (nex > XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1)
5980 nex = XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1; 5980 nex = XFS_IFORK_NEXTENTS(ip, whichfork) * 2 + 1;
5981 5981
5982 bmapi_flags = XFS_BMAPI_AFLAG(whichfork) | 5982 bmapi_flags = xfs_bmapi_aflag(whichfork) |
5983 ((iflags & BMV_IF_PREALLOC) ? 0 : XFS_BMAPI_IGSTATE); 5983 ((iflags & BMV_IF_PREALLOC) ? 0 : XFS_BMAPI_IGSTATE);
5984 5984
5985 /* 5985 /*
@@ -6098,7 +6098,7 @@ xfs_bmap_isaeof(
6098 */ 6098 */
6099 *aeof = (off >= s.br_startoff && 6099 *aeof = (off >= s.br_startoff &&
6100 off < s.br_startoff + s.br_blockcount && 6100 off < s.br_startoff + s.br_blockcount &&
6101 ISNULLSTARTBLOCK(s.br_startblock)) || 6101 isnullstartblock(s.br_startblock)) ||
6102 off >= s.br_startoff + s.br_blockcount; 6102 off >= s.br_startoff + s.br_blockcount;
6103 return 0; 6103 return 0;
6104} 6104}
diff --git a/fs/xfs/xfs_bmap.h b/fs/xfs/xfs_bmap.h
index 284571c05ed0..be2979d88d32 100644
--- a/fs/xfs/xfs_bmap.h
+++ b/fs/xfs/xfs_bmap.h
@@ -95,7 +95,6 @@ typedef struct xfs_bmap_free
95 /* need write cache flushing and no */ 95 /* need write cache flushing and no */
96 /* additional allocation alignments */ 96 /* additional allocation alignments */
97 97
98#define XFS_BMAPI_AFLAG(w) xfs_bmapi_aflag(w)
99static inline int xfs_bmapi_aflag(int w) 98static inline int xfs_bmapi_aflag(int w)
100{ 99{
101 return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0); 100 return (w == XFS_ATTR_FORK ? XFS_BMAPI_ATTRFORK : 0);
@@ -107,7 +106,6 @@ static inline int xfs_bmapi_aflag(int w)
107#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL) 106#define DELAYSTARTBLOCK ((xfs_fsblock_t)-1LL)
108#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL) 107#define HOLESTARTBLOCK ((xfs_fsblock_t)-2LL)
109 108
110#define XFS_BMAP_INIT(flp,fbp) xfs_bmap_init(flp,fbp)
111static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp) 109static inline void xfs_bmap_init(xfs_bmap_free_t *flp, xfs_fsblock_t *fbp)
112{ 110{
113 ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \ 111 ((flp)->xbf_first = NULL, (flp)->xbf_count = 0, \
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c
index ba6b08c2fb02..0760d352586f 100644
--- a/fs/xfs/xfs_bmap_btree.c
+++ b/fs/xfs/xfs_bmap_btree.c
@@ -121,7 +121,7 @@ __xfs_bmbt_get_all(
121 121
122 b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) | 122 b = (((xfs_dfsbno_t)l0 & xfs_mask64lo(9)) << 43) |
123 (((xfs_dfsbno_t)l1) >> 21); 123 (((xfs_dfsbno_t)l1) >> 21);
124 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 124 ASSERT((b >> 32) == 0 || isnulldstartblock(b));
125 s->br_startblock = (xfs_fsblock_t)b; 125 s->br_startblock = (xfs_fsblock_t)b;
126 } 126 }
127#else /* !DEBUG */ 127#else /* !DEBUG */
@@ -172,7 +172,7 @@ xfs_bmbt_get_startblock(
172 172
173 b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) | 173 b = (((xfs_dfsbno_t)r->l0 & xfs_mask64lo(9)) << 43) |
174 (((xfs_dfsbno_t)r->l1) >> 21); 174 (((xfs_dfsbno_t)r->l1) >> 21);
175 ASSERT((b >> 32) == 0 || ISNULLDSTARTBLOCK(b)); 175 ASSERT((b >> 32) == 0 || isnulldstartblock(b));
176 return (xfs_fsblock_t)b; 176 return (xfs_fsblock_t)b;
177#else /* !DEBUG */ 177#else /* !DEBUG */
178 return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21); 178 return (xfs_fsblock_t)(((xfs_dfsbno_t)r->l1) >> 21);
@@ -261,7 +261,7 @@ xfs_bmbt_set_allf(
261 ((xfs_bmbt_rec_base_t)blockcount & 261 ((xfs_bmbt_rec_base_t)blockcount &
262 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)); 262 (xfs_bmbt_rec_base_t)xfs_mask64lo(21));
263#else /* !XFS_BIG_BLKNOS */ 263#else /* !XFS_BIG_BLKNOS */
264 if (ISNULLSTARTBLOCK(startblock)) { 264 if (isnullstartblock(startblock)) {
265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) | 265 r->l0 = ((xfs_bmbt_rec_base_t)extent_flag << 63) |
266 ((xfs_bmbt_rec_base_t)startoff << 9) | 266 ((xfs_bmbt_rec_base_t)startoff << 9) |
267 (xfs_bmbt_rec_base_t)xfs_mask64lo(9); 267 (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
@@ -321,7 +321,7 @@ xfs_bmbt_disk_set_allf(
321 ((xfs_bmbt_rec_base_t)blockcount & 321 ((xfs_bmbt_rec_base_t)blockcount &
322 (xfs_bmbt_rec_base_t)xfs_mask64lo(21))); 322 (xfs_bmbt_rec_base_t)xfs_mask64lo(21)));
323#else /* !XFS_BIG_BLKNOS */ 323#else /* !XFS_BIG_BLKNOS */
324 if (ISNULLSTARTBLOCK(startblock)) { 324 if (isnullstartblock(startblock)) {
325 r->l0 = cpu_to_be64( 325 r->l0 = cpu_to_be64(
326 ((xfs_bmbt_rec_base_t)extent_flag << 63) | 326 ((xfs_bmbt_rec_base_t)extent_flag << 63) |
327 ((xfs_bmbt_rec_base_t)startoff << 9) | 327 ((xfs_bmbt_rec_base_t)startoff << 9) |
@@ -382,7 +382,7 @@ xfs_bmbt_set_startblock(
382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) | 382 r->l1 = (r->l1 & (xfs_bmbt_rec_base_t)xfs_mask64lo(21)) |
383 (xfs_bmbt_rec_base_t)(v << 21); 383 (xfs_bmbt_rec_base_t)(v << 21);
384#else /* !XFS_BIG_BLKNOS */ 384#else /* !XFS_BIG_BLKNOS */
385 if (ISNULLSTARTBLOCK(v)) { 385 if (isnullstartblock(v)) {
386 r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9); 386 r->l0 |= (xfs_bmbt_rec_base_t)xfs_mask64lo(9);
387 r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) | 387 r->l1 = (xfs_bmbt_rec_base_t)xfs_mask64hi(11) |
388 ((xfs_bmbt_rec_base_t)v << 21) | 388 ((xfs_bmbt_rec_base_t)v << 21) |
diff --git a/fs/xfs/xfs_bmap_btree.h b/fs/xfs/xfs_bmap_btree.h
index a4555abb6622..0e8df007615e 100644
--- a/fs/xfs/xfs_bmap_btree.h
+++ b/fs/xfs/xfs_bmap_btree.h
@@ -76,26 +76,22 @@ typedef struct xfs_bmbt_rec_host {
76#define DSTARTBLOCKMASK \ 76#define DSTARTBLOCKMASK \
77 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS) 77 (((((xfs_dfsbno_t)1) << DSTARTBLOCKMASKBITS) - 1) << STARTBLOCKVALBITS)
78 78
79#define ISNULLSTARTBLOCK(x) isnullstartblock(x)
80static inline int isnullstartblock(xfs_fsblock_t x) 79static inline int isnullstartblock(xfs_fsblock_t x)
81{ 80{
82 return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK; 81 return ((x) & STARTBLOCKMASK) == STARTBLOCKMASK;
83} 82}
84 83
85#define ISNULLDSTARTBLOCK(x) isnulldstartblock(x)
86static inline int isnulldstartblock(xfs_dfsbno_t x) 84static inline int isnulldstartblock(xfs_dfsbno_t x)
87{ 85{
88 return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK; 86 return ((x) & DSTARTBLOCKMASK) == DSTARTBLOCKMASK;
89} 87}
90 88
91#define NULLSTARTBLOCK(k) nullstartblock(k)
92static inline xfs_fsblock_t nullstartblock(int k) 89static inline xfs_fsblock_t nullstartblock(int k)
93{ 90{
94 ASSERT(k < (1 << STARTBLOCKVALBITS)); 91 ASSERT(k < (1 << STARTBLOCKVALBITS));
95 return STARTBLOCKMASK | (k); 92 return STARTBLOCKMASK | (k);
96} 93}
97 94
98#define STARTBLOCKVAL(x) startblockval(x)
99static inline xfs_filblks_t startblockval(xfs_fsblock_t x) 95static inline xfs_filblks_t startblockval(xfs_fsblock_t x)
100{ 96{
101 return (xfs_filblks_t)((x) & ~STARTBLOCKMASK); 97 return (xfs_filblks_t)((x) & ~STARTBLOCKMASK);
diff --git a/fs/xfs/xfs_btree.c b/fs/xfs/xfs_btree.c
index 2c3ef20f8842..e73c332eb23f 100644
--- a/fs/xfs/xfs_btree.c
+++ b/fs/xfs/xfs_btree.c
@@ -843,7 +843,7 @@ xfs_btree_ptr_is_null(
843 union xfs_btree_ptr *ptr) 843 union xfs_btree_ptr *ptr)
844{ 844{
845 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) 845 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
846 return be64_to_cpu(ptr->l) == NULLFSBLOCK; 846 return be64_to_cpu(ptr->l) == NULLDFSBNO;
847 else 847 else
848 return be32_to_cpu(ptr->s) == NULLAGBLOCK; 848 return be32_to_cpu(ptr->s) == NULLAGBLOCK;
849} 849}
@@ -854,7 +854,7 @@ xfs_btree_set_ptr_null(
854 union xfs_btree_ptr *ptr) 854 union xfs_btree_ptr *ptr)
855{ 855{
856 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) 856 if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
857 ptr->l = cpu_to_be64(NULLFSBLOCK); 857 ptr->l = cpu_to_be64(NULLDFSBNO);
858 else 858 else
859 ptr->s = cpu_to_be32(NULLAGBLOCK); 859 ptr->s = cpu_to_be32(NULLAGBLOCK);
860} 860}
@@ -918,8 +918,8 @@ xfs_btree_init_block(
918 new->bb_numrecs = cpu_to_be16(numrecs); 918 new->bb_numrecs = cpu_to_be16(numrecs);
919 919
920 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 920 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
921 new->bb_u.l.bb_leftsib = cpu_to_be64(NULLFSBLOCK); 921 new->bb_u.l.bb_leftsib = cpu_to_be64(NULLDFSBNO);
922 new->bb_u.l.bb_rightsib = cpu_to_be64(NULLFSBLOCK); 922 new->bb_u.l.bb_rightsib = cpu_to_be64(NULLDFSBNO);
923 } else { 923 } else {
924 new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK); 924 new->bb_u.s.bb_leftsib = cpu_to_be32(NULLAGBLOCK);
925 new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK); 925 new->bb_u.s.bb_rightsib = cpu_to_be32(NULLAGBLOCK);
@@ -960,7 +960,7 @@ xfs_btree_buf_to_ptr(
960 ptr->l = cpu_to_be64(XFS_DADDR_TO_FSB(cur->bc_mp, 960 ptr->l = cpu_to_be64(XFS_DADDR_TO_FSB(cur->bc_mp,
961 XFS_BUF_ADDR(bp))); 961 XFS_BUF_ADDR(bp)));
962 else { 962 else {
963 ptr->s = cpu_to_be32(XFS_DADDR_TO_AGBNO(cur->bc_mp, 963 ptr->s = cpu_to_be32(xfs_daddr_to_agbno(cur->bc_mp,
964 XFS_BUF_ADDR(bp))); 964 XFS_BUF_ADDR(bp)));
965 } 965 }
966} 966}
@@ -971,7 +971,7 @@ xfs_btree_ptr_to_daddr(
971 union xfs_btree_ptr *ptr) 971 union xfs_btree_ptr *ptr)
972{ 972{
973 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) { 973 if (cur->bc_flags & XFS_BTREE_LONG_PTRS) {
974 ASSERT(be64_to_cpu(ptr->l) != NULLFSBLOCK); 974 ASSERT(be64_to_cpu(ptr->l) != NULLDFSBNO);
975 975
976 return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l)); 976 return XFS_FSB_TO_DADDR(cur->bc_mp, be64_to_cpu(ptr->l));
977 } else { 977 } else {
@@ -2454,7 +2454,7 @@ xfs_btree_new_iroot(
2454 xfs_btree_log_ptrs(cur, cbp, 1, be16_to_cpu(cblock->bb_numrecs)); 2454 xfs_btree_log_ptrs(cur, cbp, 1, be16_to_cpu(cblock->bb_numrecs));
2455 2455
2456 *logflags |= 2456 *logflags |=
2457 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork); 2457 XFS_ILOG_CORE | xfs_ilog_fbroot(cur->bc_private.b.whichfork);
2458 *stat = 1; 2458 *stat = 1;
2459 XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT); 2459 XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
2460 return 0; 2460 return 0;
@@ -3048,7 +3048,7 @@ xfs_btree_kill_iroot(
3048 cur->bc_bufs[level - 1] = NULL; 3048 cur->bc_bufs[level - 1] = NULL;
3049 be16_add_cpu(&block->bb_level, -1); 3049 be16_add_cpu(&block->bb_level, -1);
3050 xfs_trans_log_inode(cur->bc_tp, ip, 3050 xfs_trans_log_inode(cur->bc_tp, ip,
3051 XFS_ILOG_CORE | XFS_ILOG_FBROOT(cur->bc_private.b.whichfork)); 3051 XFS_ILOG_CORE | xfs_ilog_fbroot(cur->bc_private.b.whichfork));
3052 cur->bc_nlevels--; 3052 cur->bc_nlevels--;
3053out0: 3053out0:
3054 XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT); 3054 XFS_BTREE_TRACE_CURSOR(cur, XBT_EXIT);
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index a11a8390bf6c..c45f74ff1a5b 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -1597,7 +1597,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
1597 nmap = 1; 1597 nmap = 1;
1598 ASSERT(args->firstblock != NULL); 1598 ASSERT(args->firstblock != NULL);
1599 if ((error = xfs_bmapi(tp, dp, bno, count, 1599 if ((error = xfs_bmapi(tp, dp, bno, count,
1600 XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA| 1600 xfs_bmapi_aflag(w)|XFS_BMAPI_WRITE|XFS_BMAPI_METADATA|
1601 XFS_BMAPI_CONTIG, 1601 XFS_BMAPI_CONTIG,
1602 args->firstblock, args->total, &map, &nmap, 1602 args->firstblock, args->total, &map, &nmap,
1603 args->flist, NULL))) { 1603 args->flist, NULL))) {
@@ -1618,7 +1618,7 @@ xfs_da_grow_inode(xfs_da_args_t *args, xfs_dablk_t *new_blkno)
1618 nmap = MIN(XFS_BMAP_MAX_NMAP, count); 1618 nmap = MIN(XFS_BMAP_MAX_NMAP, count);
1619 c = (int)(bno + count - b); 1619 c = (int)(bno + count - b);
1620 if ((error = xfs_bmapi(tp, dp, b, c, 1620 if ((error = xfs_bmapi(tp, dp, b, c,
1621 XFS_BMAPI_AFLAG(w)|XFS_BMAPI_WRITE| 1621 xfs_bmapi_aflag(w)|XFS_BMAPI_WRITE|
1622 XFS_BMAPI_METADATA, 1622 XFS_BMAPI_METADATA,
1623 args->firstblock, args->total, 1623 args->firstblock, args->total,
1624 &mapp[mapi], &nmap, args->flist, 1624 &mapp[mapi], &nmap, args->flist,
@@ -1882,7 +1882,7 @@ xfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
1882 * the last block to the place we want to kill. 1882 * the last block to the place we want to kill.
1883 */ 1883 */
1884 if ((error = xfs_bunmapi(tp, dp, dead_blkno, count, 1884 if ((error = xfs_bunmapi(tp, dp, dead_blkno, count,
1885 XFS_BMAPI_AFLAG(w)|XFS_BMAPI_METADATA, 1885 xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA,
1886 0, args->firstblock, args->flist, NULL, 1886 0, args->firstblock, args->flist, NULL,
1887 &done)) == ENOSPC) { 1887 &done)) == ENOSPC) {
1888 if (w != XFS_DATA_FORK) 1888 if (w != XFS_DATA_FORK)
@@ -1987,7 +1987,7 @@ xfs_da_do_buf(
1987 if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno, 1987 if ((error = xfs_bmapi(trans, dp, (xfs_fileoff_t)bno,
1988 nfsb, 1988 nfsb,
1989 XFS_BMAPI_METADATA | 1989 XFS_BMAPI_METADATA |
1990 XFS_BMAPI_AFLAG(whichfork), 1990 xfs_bmapi_aflag(whichfork),
1991 NULL, 0, mapp, &nmap, NULL, NULL))) 1991 NULL, 0, mapp, &nmap, NULL, NULL)))
1992 goto exit0; 1992 goto exit0;
1993 } 1993 }
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c
index e6ebbaeb4dc6..ab016e5ae7be 100644
--- a/fs/xfs/xfs_ialloc.c
+++ b/fs/xfs/xfs_ialloc.c
@@ -357,7 +357,7 @@ xfs_ialloc_ag_alloc(
357 int ioffset = i << args.mp->m_sb.sb_inodelog; 357 int ioffset = i << args.mp->m_sb.sb_inodelog;
358 uint isize = sizeof(struct xfs_dinode); 358 uint isize = sizeof(struct xfs_dinode);
359 359
360 free = XFS_MAKE_IPTR(args.mp, fbuf, i); 360 free = xfs_make_iptr(args.mp, fbuf, i);
361 free->di_magic = cpu_to_be16(XFS_DINODE_MAGIC); 361 free->di_magic = cpu_to_be16(XFS_DINODE_MAGIC);
362 free->di_version = version; 362 free->di_version = version;
363 free->di_gen = cpu_to_be32(gen); 363 free->di_gen = cpu_to_be32(gen);
@@ -937,7 +937,7 @@ nextag:
937 } 937 }
938 } 938 }
939 } 939 }
940 offset = XFS_IALLOC_FIND_FREE(&rec.ir_free); 940 offset = xfs_ialloc_find_free(&rec.ir_free);
941 ASSERT(offset >= 0); 941 ASSERT(offset >= 0);
942 ASSERT(offset < XFS_INODES_PER_CHUNK); 942 ASSERT(offset < XFS_INODES_PER_CHUNK);
943 ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) % 943 ASSERT((XFS_AGINO_TO_OFFSET(mp, rec.ir_startino) %
@@ -1279,7 +1279,7 @@ xfs_imap(
1279 offset = XFS_INO_TO_OFFSET(mp, ino); 1279 offset = XFS_INO_TO_OFFSET(mp, ino);
1280 ASSERT(offset < mp->m_sb.sb_inopblock); 1280 ASSERT(offset < mp->m_sb.sb_inopblock);
1281 1281
1282 cluster_agbno = XFS_DADDR_TO_AGBNO(mp, imap->im_blkno); 1282 cluster_agbno = xfs_daddr_to_agbno(mp, imap->im_blkno);
1283 offset += (agbno - cluster_agbno) * mp->m_sb.sb_inopblock; 1283 offset += (agbno - cluster_agbno) * mp->m_sb.sb_inopblock;
1284 1284
1285 imap->im_len = XFS_FSB_TO_BB(mp, blks_per_cluster); 1285 imap->im_len = XFS_FSB_TO_BB(mp, blks_per_cluster);
diff --git a/fs/xfs/xfs_ialloc.h b/fs/xfs/xfs_ialloc.h
index 50f558a4e0a8..aeee8278f92c 100644
--- a/fs/xfs/xfs_ialloc.h
+++ b/fs/xfs/xfs_ialloc.h
@@ -39,7 +39,6 @@ struct xfs_trans;
39/* 39/*
40 * Make an inode pointer out of the buffer/offset. 40 * Make an inode pointer out of the buffer/offset.
41 */ 41 */
42#define XFS_MAKE_IPTR(mp,b,o) xfs_make_iptr(mp,b,o)
43static inline struct xfs_dinode * 42static inline struct xfs_dinode *
44xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o) 43xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
45{ 44{
@@ -50,7 +49,6 @@ xfs_make_iptr(struct xfs_mount *mp, struct xfs_buf *b, int o)
50/* 49/*
51 * Find a free (set) bit in the inode bitmask. 50 * Find a free (set) bit in the inode bitmask.
52 */ 51 */
53#define XFS_IALLOC_FIND_FREE(fp) xfs_ialloc_find_free(fp)
54static inline int xfs_ialloc_find_free(xfs_inofree_t *fp) 52static inline int xfs_ialloc_find_free(xfs_inofree_t *fp)
55{ 53{
56 return xfs_lowbit64(*fp); 54 return xfs_lowbit64(*fp);
diff --git a/fs/xfs/xfs_ialloc_btree.h b/fs/xfs/xfs_ialloc_btree.h
index 37e5dd01a577..5580e255ff06 100644
--- a/fs/xfs/xfs_ialloc_btree.h
+++ b/fs/xfs/xfs_ialloc_btree.h
@@ -36,7 +36,6 @@ typedef __uint64_t xfs_inofree_t;
36#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3) 36#define XFS_INODES_PER_CHUNK_LOG (XFS_NBBYLOG + 3)
37#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1) 37#define XFS_INOBT_ALL_FREE ((xfs_inofree_t)-1)
38 38
39#define XFS_INOBT_MASKN(i,n) xfs_inobt_maskn(i,n)
40static inline xfs_inofree_t xfs_inobt_maskn(int i, int n) 39static inline xfs_inofree_t xfs_inobt_maskn(int i, int n)
41{ 40{
42 return (((n) >= XFS_INODES_PER_CHUNK ? \ 41 return (((n) >= XFS_INODES_PER_CHUNK ? \
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 5a5e035e5d38..e7ae08d1df48 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -424,6 +424,19 @@ xfs_iformat(
424 case XFS_DINODE_FMT_LOCAL: 424 case XFS_DINODE_FMT_LOCAL:
425 atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip); 425 atp = (xfs_attr_shortform_t *)XFS_DFORK_APTR(dip);
426 size = be16_to_cpu(atp->hdr.totsize); 426 size = be16_to_cpu(atp->hdr.totsize);
427
428 if (unlikely(size < sizeof(struct xfs_attr_sf_hdr))) {
429 xfs_fs_repair_cmn_err(CE_WARN, ip->i_mount,
430 "corrupt inode %Lu "
431 "(bad attr fork size %Ld).",
432 (unsigned long long) ip->i_ino,
433 (long long) size);
434 XFS_CORRUPTION_ERROR("xfs_iformat(8)",
435 XFS_ERRLEVEL_LOW,
436 ip->i_mount, dip);
437 return XFS_ERROR(EFSCORRUPTED);
438 }
439
427 error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size); 440 error = xfs_iformat_local(ip, dip, XFS_ATTR_FORK, size);
428 break; 441 break;
429 case XFS_DINODE_FMT_EXTENTS: 442 case XFS_DINODE_FMT_EXTENTS:
@@ -1601,10 +1614,10 @@ xfs_itruncate_finish(
1601 * in this file with garbage in them once recovery 1614 * in this file with garbage in them once recovery
1602 * runs. 1615 * runs.
1603 */ 1616 */
1604 XFS_BMAP_INIT(&free_list, &first_block); 1617 xfs_bmap_init(&free_list, &first_block);
1605 error = xfs_bunmapi(ntp, ip, 1618 error = xfs_bunmapi(ntp, ip,
1606 first_unmap_block, unmap_len, 1619 first_unmap_block, unmap_len,
1607 XFS_BMAPI_AFLAG(fork) | 1620 xfs_bmapi_aflag(fork) |
1608 (sync ? 0 : XFS_BMAPI_ASYNC), 1621 (sync ? 0 : XFS_BMAPI_ASYNC),
1609 XFS_ITRUNC_MAX_EXTENTS, 1622 XFS_ITRUNC_MAX_EXTENTS,
1610 &first_block, &free_list, 1623 &first_block, &free_list,
@@ -2557,7 +2570,7 @@ xfs_iextents_copy(
2557 for (i = 0; i < nrecs; i++) { 2570 for (i = 0; i < nrecs; i++) {
2558 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i); 2571 xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
2559 start_block = xfs_bmbt_get_startblock(ep); 2572 start_block = xfs_bmbt_get_startblock(ep);
2560 if (ISNULLSTARTBLOCK(start_block)) { 2573 if (isnullstartblock(start_block)) {
2561 /* 2574 /*
2562 * It's a delayed allocation extent, so skip it. 2575 * It's a delayed allocation extent, so skip it.
2563 */ 2576 */
diff --git a/fs/xfs/xfs_inode_item.h b/fs/xfs/xfs_inode_item.h
index 1ff04cc323ad..9957d0602d54 100644
--- a/fs/xfs/xfs_inode_item.h
+++ b/fs/xfs/xfs_inode_item.h
@@ -111,20 +111,16 @@ typedef struct xfs_inode_log_format_64 {
111 111
112#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED) 112#define XFS_ILI_IOLOCKED_ANY (XFS_ILI_IOLOCKED_EXCL | XFS_ILI_IOLOCKED_SHARED)
113 113
114
115#define XFS_ILOG_FBROOT(w) xfs_ilog_fbroot(w)
116static inline int xfs_ilog_fbroot(int w) 114static inline int xfs_ilog_fbroot(int w)
117{ 115{
118 return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT); 116 return (w == XFS_DATA_FORK ? XFS_ILOG_DBROOT : XFS_ILOG_ABROOT);
119} 117}
120 118
121#define XFS_ILOG_FEXT(w) xfs_ilog_fext(w)
122static inline int xfs_ilog_fext(int w) 119static inline int xfs_ilog_fext(int w)
123{ 120{
124 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT); 121 return (w == XFS_DATA_FORK ? XFS_ILOG_DEXT : XFS_ILOG_AEXT);
125} 122}
126 123
127#define XFS_ILOG_FDATA(w) xfs_ilog_fdata(w)
128static inline int xfs_ilog_fdata(int w) 124static inline int xfs_ilog_fdata(int w)
129{ 125{
130 return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA); 126 return (w == XFS_DATA_FORK ? XFS_ILOG_DDATA : XFS_ILOG_ADATA);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 911062cf73a6..08ce72316bfe 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -155,7 +155,7 @@ xfs_imap_to_bmap(
155 iomapp->iomap_bn = IOMAP_DADDR_NULL; 155 iomapp->iomap_bn = IOMAP_DADDR_NULL;
156 iomapp->iomap_flags |= IOMAP_DELAY; 156 iomapp->iomap_flags |= IOMAP_DELAY;
157 } else { 157 } else {
158 iomapp->iomap_bn = XFS_FSB_TO_DB(ip, start_block); 158 iomapp->iomap_bn = xfs_fsb_to_db(ip, start_block);
159 if (ISUNWRITTEN(imap)) 159 if (ISUNWRITTEN(imap))
160 iomapp->iomap_flags |= IOMAP_UNWRITTEN; 160 iomapp->iomap_flags |= IOMAP_UNWRITTEN;
161 } 161 }
@@ -261,7 +261,7 @@ xfs_iomap(
261 xfs_iunlock(ip, lockmode); 261 xfs_iunlock(ip, lockmode);
262 lockmode = 0; 262 lockmode = 0;
263 263
264 if (nimaps && !ISNULLSTARTBLOCK(imap.br_startblock)) { 264 if (nimaps && !isnullstartblock(imap.br_startblock)) {
265 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip, 265 xfs_iomap_map_trace(XFS_IOMAP_WRITE_MAP, ip,
266 offset, count, iomapp, &imap, flags); 266 offset, count, iomapp, &imap, flags);
267 break; 267 break;
@@ -491,7 +491,7 @@ xfs_iomap_write_direct(
491 /* 491 /*
492 * Issue the xfs_bmapi() call to allocate the blocks 492 * Issue the xfs_bmapi() call to allocate the blocks
493 */ 493 */
494 XFS_BMAP_INIT(&free_list, &firstfsb); 494 xfs_bmap_init(&free_list, &firstfsb);
495 nimaps = 1; 495 nimaps = 1;
496 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag, 496 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, bmapi_flag,
497 &firstfsb, 0, &imap, &nimaps, &free_list, NULL); 497 &firstfsb, 0, &imap, &nimaps, &free_list, NULL);
@@ -751,7 +751,7 @@ xfs_iomap_write_allocate(
751 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL); 751 xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
752 xfs_trans_ihold(tp, ip); 752 xfs_trans_ihold(tp, ip);
753 753
754 XFS_BMAP_INIT(&free_list, &first_block); 754 xfs_bmap_init(&free_list, &first_block);
755 755
756 /* 756 /*
757 * it is possible that the extents have changed since 757 * it is possible that the extents have changed since
@@ -911,7 +911,7 @@ xfs_iomap_write_unwritten(
911 /* 911 /*
912 * Modify the unwritten extent state of the buffer. 912 * Modify the unwritten extent state of the buffer.
913 */ 913 */
914 XFS_BMAP_INIT(&free_list, &firstfsb); 914 xfs_bmap_init(&free_list, &firstfsb);
915 nimaps = 1; 915 nimaps = 1;
916 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb, 916 error = xfs_bmapi(tp, ip, offset_fsb, count_fsb,
917 XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb, 917 XFS_BMAPI_WRITE|XFS_BMAPI_CONVERT, &firstfsb,
diff --git a/fs/xfs/xfs_itable.c b/fs/xfs/xfs_itable.c
index e19d0a8d5618..cf98a805ec90 100644
--- a/fs/xfs/xfs_itable.c
+++ b/fs/xfs/xfs_itable.c
@@ -453,7 +453,7 @@ xfs_bulkstat(
453 (chunkidx = agino - gino + 1) < 453 (chunkidx = agino - gino + 1) <
454 XFS_INODES_PER_CHUNK && 454 XFS_INODES_PER_CHUNK &&
455 /* there are some left allocated */ 455 /* there are some left allocated */
456 XFS_INOBT_MASKN(chunkidx, 456 xfs_inobt_maskn(chunkidx,
457 XFS_INODES_PER_CHUNK - chunkidx) & ~gfree) { 457 XFS_INODES_PER_CHUNK - chunkidx) & ~gfree) {
458 /* 458 /*
459 * Grab the chunk record. Mark all the 459 * Grab the chunk record. Mark all the
@@ -464,7 +464,7 @@ xfs_bulkstat(
464 if (XFS_INOBT_MASK(i) & ~gfree) 464 if (XFS_INOBT_MASK(i) & ~gfree)
465 gcnt++; 465 gcnt++;
466 } 466 }
467 gfree |= XFS_INOBT_MASKN(0, chunkidx); 467 gfree |= xfs_inobt_maskn(0, chunkidx);
468 irbp->ir_startino = gino; 468 irbp->ir_startino = gino;
469 irbp->ir_freecount = gcnt; 469 irbp->ir_freecount = gcnt;
470 irbp->ir_free = gfree; 470 irbp->ir_free = gfree;
@@ -535,7 +535,7 @@ xfs_bulkstat(
535 chunkidx < XFS_INODES_PER_CHUNK; 535 chunkidx < XFS_INODES_PER_CHUNK;
536 chunkidx += nicluster, 536 chunkidx += nicluster,
537 agbno += nbcluster) { 537 agbno += nbcluster) {
538 if (XFS_INOBT_MASKN(chunkidx, 538 if (xfs_inobt_maskn(chunkidx,
539 nicluster) & ~gfree) 539 nicluster) & ~gfree)
540 xfs_btree_reada_bufs(mp, agno, 540 xfs_btree_reada_bufs(mp, agno,
541 agbno, nbcluster); 541 agbno, nbcluster);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 3c97c6463a4e..35300250e86d 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -45,7 +45,6 @@
45#include "xfs_fsops.h" 45#include "xfs_fsops.h"
46#include "xfs_utils.h" 46#include "xfs_utils.h"
47 47
48STATIC int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
49STATIC int xfs_uuid_mount(xfs_mount_t *); 48STATIC int xfs_uuid_mount(xfs_mount_t *);
50STATIC void xfs_unmountfs_wait(xfs_mount_t *); 49STATIC void xfs_unmountfs_wait(xfs_mount_t *);
51 50
@@ -682,7 +681,7 @@ xfs_initialize_perag_data(xfs_mount_t *mp, xfs_agnumber_t agcount)
682 * Update alignment values based on mount options and sb values 681 * Update alignment values based on mount options and sb values
683 */ 682 */
684STATIC int 683STATIC int
685xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags) 684xfs_update_alignment(xfs_mount_t *mp)
686{ 685{
687 xfs_sb_t *sbp = &(mp->m_sb); 686 xfs_sb_t *sbp = &(mp->m_sb);
688 687
@@ -736,11 +735,11 @@ xfs_update_alignment(xfs_mount_t *mp, __uint64_t *update_flags)
736 if (xfs_sb_version_hasdalign(sbp)) { 735 if (xfs_sb_version_hasdalign(sbp)) {
737 if (sbp->sb_unit != mp->m_dalign) { 736 if (sbp->sb_unit != mp->m_dalign) {
738 sbp->sb_unit = mp->m_dalign; 737 sbp->sb_unit = mp->m_dalign;
739 *update_flags |= XFS_SB_UNIT; 738 mp->m_update_flags |= XFS_SB_UNIT;
740 } 739 }
741 if (sbp->sb_width != mp->m_swidth) { 740 if (sbp->sb_width != mp->m_swidth) {
742 sbp->sb_width = mp->m_swidth; 741 sbp->sb_width = mp->m_swidth;
743 *update_flags |= XFS_SB_WIDTH; 742 mp->m_update_flags |= XFS_SB_WIDTH;
744 } 743 }
745 } 744 }
746 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN && 745 } else if ((mp->m_flags & XFS_MOUNT_NOALIGN) != XFS_MOUNT_NOALIGN &&
@@ -905,7 +904,6 @@ xfs_mountfs(
905 xfs_sb_t *sbp = &(mp->m_sb); 904 xfs_sb_t *sbp = &(mp->m_sb);
906 xfs_inode_t *rip; 905 xfs_inode_t *rip;
907 __uint64_t resblks; 906 __uint64_t resblks;
908 __int64_t update_flags = 0LL;
909 uint quotamount, quotaflags; 907 uint quotamount, quotaflags;
910 int uuid_mounted = 0; 908 int uuid_mounted = 0;
911 int error = 0; 909 int error = 0;
@@ -933,7 +931,7 @@ xfs_mountfs(
933 "XFS: correcting sb_features alignment problem"); 931 "XFS: correcting sb_features alignment problem");
934 sbp->sb_features2 |= sbp->sb_bad_features2; 932 sbp->sb_features2 |= sbp->sb_bad_features2;
935 sbp->sb_bad_features2 = sbp->sb_features2; 933 sbp->sb_bad_features2 = sbp->sb_features2;
936 update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2; 934 mp->m_update_flags |= XFS_SB_FEATURES2 | XFS_SB_BAD_FEATURES2;
937 935
938 /* 936 /*
939 * Re-check for ATTR2 in case it was found in bad_features2 937 * Re-check for ATTR2 in case it was found in bad_features2
@@ -947,11 +945,11 @@ xfs_mountfs(
947 if (xfs_sb_version_hasattr2(&mp->m_sb) && 945 if (xfs_sb_version_hasattr2(&mp->m_sb) &&
948 (mp->m_flags & XFS_MOUNT_NOATTR2)) { 946 (mp->m_flags & XFS_MOUNT_NOATTR2)) {
949 xfs_sb_version_removeattr2(&mp->m_sb); 947 xfs_sb_version_removeattr2(&mp->m_sb);
950 update_flags |= XFS_SB_FEATURES2; 948 mp->m_update_flags |= XFS_SB_FEATURES2;
951 949
952 /* update sb_versionnum for the clearing of the morebits */ 950 /* update sb_versionnum for the clearing of the morebits */
953 if (!sbp->sb_features2) 951 if (!sbp->sb_features2)
954 update_flags |= XFS_SB_VERSIONNUM; 952 mp->m_update_flags |= XFS_SB_VERSIONNUM;
955 } 953 }
956 954
957 /* 955 /*
@@ -960,7 +958,7 @@ xfs_mountfs(
960 * allocator alignment is within an ag, therefore ag has 958 * allocator alignment is within an ag, therefore ag has
961 * to be aligned at stripe boundary. 959 * to be aligned at stripe boundary.
962 */ 960 */
963 error = xfs_update_alignment(mp, &update_flags); 961 error = xfs_update_alignment(mp);
964 if (error) 962 if (error)
965 goto error1; 963 goto error1;
966 964
@@ -1137,10 +1135,12 @@ xfs_mountfs(
1137 } 1135 }
1138 1136
1139 /* 1137 /*
1140 * If fs is not mounted readonly, then update the superblock changes. 1138 * If this is a read-only mount defer the superblock updates until
1139 * the next remount into writeable mode. Otherwise we would never
1140 * perform the update e.g. for the root filesystem.
1141 */ 1141 */
1142 if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) { 1142 if (mp->m_update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY)) {
1143 error = xfs_mount_log_sb(mp, update_flags); 1143 error = xfs_mount_log_sb(mp, mp->m_update_flags);
1144 if (error) { 1144 if (error) {
1145 cmn_err(CE_WARN, "XFS: failed to write sb changes"); 1145 cmn_err(CE_WARN, "XFS: failed to write sb changes");
1146 goto error4; 1146 goto error4;
@@ -1820,7 +1820,7 @@ xfs_uuid_mount(
1820 * be altered by the mount options, as well as any potential sb_features2 1820 * be altered by the mount options, as well as any potential sb_features2
1821 * fixup. Only the first superblock is updated. 1821 * fixup. Only the first superblock is updated.
1822 */ 1822 */
1823STATIC int 1823int
1824xfs_mount_log_sb( 1824xfs_mount_log_sb(
1825 xfs_mount_t *mp, 1825 xfs_mount_t *mp,
1826 __int64_t fields) 1826 __int64_t fields)
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index c1e028467327..f5e9937f9bdb 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -44,9 +44,9 @@ typedef struct xfs_trans_reservations {
44 44
45#ifndef __KERNEL__ 45#ifndef __KERNEL__
46 46
47#define XFS_DADDR_TO_AGNO(mp,d) \ 47#define xfs_daddr_to_agno(mp,d) \
48 ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks)) 48 ((xfs_agnumber_t)(XFS_BB_TO_FSBT(mp, d) / (mp)->m_sb.sb_agblocks))
49#define XFS_DADDR_TO_AGBNO(mp,d) \ 49#define xfs_daddr_to_agbno(mp,d) \
50 ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks)) 50 ((xfs_agblock_t)(XFS_BB_TO_FSBT(mp, d) % (mp)->m_sb.sb_agblocks))
51 51
52#else /* __KERNEL__ */ 52#else /* __KERNEL__ */
@@ -327,6 +327,8 @@ typedef struct xfs_mount {
327 spinlock_t m_sync_lock; /* work item list lock */ 327 spinlock_t m_sync_lock; /* work item list lock */
328 int m_sync_seq; /* sync thread generation no. */ 328 int m_sync_seq; /* sync thread generation no. */
329 wait_queue_head_t m_wait_single_sync_task; 329 wait_queue_head_t m_wait_single_sync_task;
330 __int64_t m_update_flags; /* sb flags we need to update
331 on the next remount,rw */
330} xfs_mount_t; 332} xfs_mount_t;
331 333
332/* 334/*
@@ -439,7 +441,6 @@ void xfs_do_force_shutdown(struct xfs_mount *mp, int flags, char *fname,
439 */ 441 */
440#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */ 442#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */
441 443
442#define XFS_DADDR_TO_AGNO(mp,d) xfs_daddr_to_agno(mp,d)
443static inline xfs_agnumber_t 444static inline xfs_agnumber_t
444xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d) 445xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
445{ 446{
@@ -448,7 +449,6 @@ xfs_daddr_to_agno(struct xfs_mount *mp, xfs_daddr_t d)
448 return (xfs_agnumber_t) ld; 449 return (xfs_agnumber_t) ld;
449} 450}
450 451
451#define XFS_DADDR_TO_AGBNO(mp,d) xfs_daddr_to_agbno(mp,d)
452static inline xfs_agblock_t 452static inline xfs_agblock_t
453xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d) 453xfs_daddr_to_agbno(struct xfs_mount *mp, xfs_daddr_t d)
454{ 454{
@@ -514,6 +514,7 @@ extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t,
514 int64_t, int); 514 int64_t, int);
515extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, 515extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *,
516 uint, int); 516 uint, int);
517extern int xfs_mount_log_sb(xfs_mount_t *, __int64_t);
517extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); 518extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
518extern int xfs_readsb(xfs_mount_t *, int); 519extern int xfs_readsb(xfs_mount_t *, int);
519extern void xfs_freesb(xfs_mount_t *); 520extern void xfs_freesb(xfs_mount_t *);
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 86471bb40fd4..58f85e9cd11d 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -147,7 +147,7 @@ xfs_rename(
147 xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip, 147 xfs_sort_for_rename(src_dp, target_dp, src_ip, target_ip,
148 inodes, &num_inodes); 148 inodes, &num_inodes);
149 149
150 XFS_BMAP_INIT(&free_list, &first_block); 150 xfs_bmap_init(&free_list, &first_block);
151 tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME); 151 tp = xfs_trans_alloc(mp, XFS_TRANS_RENAME);
152 cancel_flags = XFS_TRANS_RELEASE_LOG_RES; 152 cancel_flags = XFS_TRANS_RELEASE_LOG_RES;
153 spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len); 153 spaceres = XFS_RENAME_SPACE_RES(mp, target_name->len);
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index edf12c7b834c..c5bb86f3ec05 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -120,7 +120,7 @@ xfs_growfs_rt_alloc(
120 if ((error = xfs_trans_iget(mp, tp, ino, 0, 120 if ((error = xfs_trans_iget(mp, tp, ino, 0,
121 XFS_ILOCK_EXCL, &ip))) 121 XFS_ILOCK_EXCL, &ip)))
122 goto error_cancel; 122 goto error_cancel;
123 XFS_BMAP_INIT(&flist, &firstblock); 123 xfs_bmap_init(&flist, &firstblock);
124 /* 124 /*
125 * Allocate blocks to the bitmap file. 125 * Allocate blocks to the bitmap file.
126 */ 126 */
diff --git a/fs/xfs/xfs_rw.h b/fs/xfs/xfs_rw.h
index f87db5344ce6..f76c003ec55d 100644
--- a/fs/xfs/xfs_rw.h
+++ b/fs/xfs/xfs_rw.h
@@ -28,7 +28,6 @@ struct xfs_mount;
28 * file is a real time file or not, because the bmap code 28 * file is a real time file or not, because the bmap code
29 * does. 29 * does.
30 */ 30 */
31#define XFS_FSB_TO_DB(ip,fsb) xfs_fsb_to_db(ip,fsb)
32static inline xfs_daddr_t 31static inline xfs_daddr_t
33xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb) 32xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb)
34{ 33{
diff --git a/fs/xfs/xfs_sb.h b/fs/xfs/xfs_sb.h
index 1ed71916e4c9..1b017c657494 100644
--- a/fs/xfs/xfs_sb.h
+++ b/fs/xfs/xfs_sb.h
@@ -505,7 +505,7 @@ static inline void xfs_sb_version_removeattr2(xfs_sb_t *sbp)
505 505
506#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d)) 506#define XFS_HDR_BLOCK(mp,d) ((xfs_agblock_t)XFS_BB_TO_FSBT(mp,d))
507#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \ 507#define XFS_DADDR_TO_FSB(mp,d) XFS_AGB_TO_FSB(mp, \
508 XFS_DADDR_TO_AGNO(mp,d), XFS_DADDR_TO_AGBNO(mp,d)) 508 xfs_daddr_to_agno(mp,d), xfs_daddr_to_agbno(mp,d))
509#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \ 509#define XFS_FSB_TO_DADDR(mp,fsbno) XFS_AGB_TO_DADDR(mp, \
510 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno)) 510 XFS_FSB_TO_AGNO(mp,fsbno), XFS_FSB_TO_AGBNO(mp,fsbno))
511 511
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index f07bf8768c3a..0e55c5d7db5f 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -862,7 +862,7 @@ xfs_inactive_symlink_rmt(
862 * Find the block(s) so we can inval and unmap them. 862 * Find the block(s) so we can inval and unmap them.
863 */ 863 */
864 done = 0; 864 done = 0;
865 XFS_BMAP_INIT(&free_list, &first_block); 865 xfs_bmap_init(&free_list, &first_block);
866 nmaps = ARRAY_SIZE(mval); 866 nmaps = ARRAY_SIZE(mval);
867 if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size), 867 if ((error = xfs_bmapi(tp, ip, 0, XFS_B_TO_FSB(mp, size),
868 XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps, 868 XFS_BMAPI_METADATA, &first_block, 0, mval, &nmaps,
@@ -1288,7 +1288,7 @@ xfs_inactive(
1288 /* 1288 /*
1289 * Free the inode. 1289 * Free the inode.
1290 */ 1290 */
1291 XFS_BMAP_INIT(&free_list, &first_block); 1291 xfs_bmap_init(&free_list, &first_block);
1292 error = xfs_ifree(tp, ip, &free_list); 1292 error = xfs_ifree(tp, ip, &free_list);
1293 if (error) { 1293 if (error) {
1294 /* 1294 /*
@@ -1461,7 +1461,7 @@ xfs_create(
1461 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT); 1461 xfs_ilock(dp, XFS_ILOCK_EXCL | XFS_ILOCK_PARENT);
1462 unlock_dp_on_error = B_TRUE; 1462 unlock_dp_on_error = B_TRUE;
1463 1463
1464 XFS_BMAP_INIT(&free_list, &first_block); 1464 xfs_bmap_init(&free_list, &first_block);
1465 1465
1466 ASSERT(ip == NULL); 1466 ASSERT(ip == NULL);
1467 1467
@@ -1879,7 +1879,7 @@ xfs_remove(
1879 } 1879 }
1880 } 1880 }
1881 1881
1882 XFS_BMAP_INIT(&free_list, &first_block); 1882 xfs_bmap_init(&free_list, &first_block);
1883 error = xfs_dir_removename(tp, dp, name, ip->i_ino, 1883 error = xfs_dir_removename(tp, dp, name, ip->i_ino,
1884 &first_block, &free_list, resblks); 1884 &first_block, &free_list, resblks);
1885 if (error) { 1885 if (error) {
@@ -2059,7 +2059,7 @@ xfs_link(
2059 if (error) 2059 if (error)
2060 goto error_return; 2060 goto error_return;
2061 2061
2062 XFS_BMAP_INIT(&free_list, &first_block); 2062 xfs_bmap_init(&free_list, &first_block);
2063 2063
2064 error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino, 2064 error = xfs_dir_createname(tp, tdp, target_name, sip->i_ino,
2065 &first_block, &free_list, resblks); 2065 &first_block, &free_list, resblks);
@@ -2231,7 +2231,7 @@ xfs_mkdir(
2231 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); 2231 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2232 unlock_dp_on_error = B_FALSE; 2232 unlock_dp_on_error = B_FALSE;
2233 2233
2234 XFS_BMAP_INIT(&free_list, &first_block); 2234 xfs_bmap_init(&free_list, &first_block);
2235 2235
2236 error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino, 2236 error = xfs_dir_createname(tp, dp, dir_name, cdp->i_ino,
2237 &first_block, &free_list, resblks ? 2237 &first_block, &free_list, resblks ?
@@ -2438,7 +2438,7 @@ xfs_symlink(
2438 * Initialize the bmap freelist prior to calling either 2438 * Initialize the bmap freelist prior to calling either
2439 * bmapi or the directory create code. 2439 * bmapi or the directory create code.
2440 */ 2440 */
2441 XFS_BMAP_INIT(&free_list, &first_block); 2441 xfs_bmap_init(&free_list, &first_block);
2442 2442
2443 /* 2443 /*
2444 * Allocate an inode for the symlink. 2444 * Allocate an inode for the symlink.
@@ -2860,7 +2860,7 @@ retry:
2860 /* 2860 /*
2861 * Issue the xfs_bmapi() call to allocate the blocks 2861 * Issue the xfs_bmapi() call to allocate the blocks
2862 */ 2862 */
2863 XFS_BMAP_INIT(&free_list, &firstfsb); 2863 xfs_bmap_init(&free_list, &firstfsb);
2864 error = xfs_bmapi(tp, ip, startoffset_fsb, 2864 error = xfs_bmapi(tp, ip, startoffset_fsb,
2865 allocatesize_fsb, bmapi_flag, 2865 allocatesize_fsb, bmapi_flag,
2866 &firstfsb, 0, imapp, &nimaps, 2866 &firstfsb, 0, imapp, &nimaps,
@@ -2980,7 +2980,7 @@ xfs_zero_remaining_bytes(
2980 XFS_BUF_UNDONE(bp); 2980 XFS_BUF_UNDONE(bp);
2981 XFS_BUF_UNWRITE(bp); 2981 XFS_BUF_UNWRITE(bp);
2982 XFS_BUF_READ(bp); 2982 XFS_BUF_READ(bp);
2983 XFS_BUF_SET_ADDR(bp, XFS_FSB_TO_DB(ip, imap.br_startblock)); 2983 XFS_BUF_SET_ADDR(bp, xfs_fsb_to_db(ip, imap.br_startblock));
2984 xfsbdstrat(mp, bp); 2984 xfsbdstrat(mp, bp);
2985 error = xfs_iowait(bp); 2985 error = xfs_iowait(bp);
2986 if (error) { 2986 if (error) {
@@ -3186,7 +3186,7 @@ xfs_free_file_space(
3186 /* 3186 /*
3187 * issue the bunmapi() call to free the blocks 3187 * issue the bunmapi() call to free the blocks
3188 */ 3188 */
3189 XFS_BMAP_INIT(&free_list, &firstfsb); 3189 xfs_bmap_init(&free_list, &firstfsb);
3190 error = xfs_bunmapi(tp, ip, startoffset_fsb, 3190 error = xfs_bunmapi(tp, ip, startoffset_fsb,
3191 endoffset_fsb - startoffset_fsb, 3191 endoffset_fsb - startoffset_fsb,
3192 0, 2, &firstfsb, &free_list, NULL, &done); 3192 0, 2, &firstfsb, &free_list, NULL, &done);