aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/ocfs2.txt3
-rw-r--r--MAINTAINERS15
-rw-r--r--arch/arm/mach-omap2/clock24xx.h4
-rw-r--r--arch/parisc/include/asm/module.h6
-rw-r--r--arch/parisc/kernel/module.c216
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c1
-rw-r--r--arch/s390/hypfs/inode.c1
-rw-r--r--arch/sparc/Kconfig57
-rw-r--r--arch/sparc/configs/sparc64_defconfig105
-rw-r--r--arch/sparc/include/asm/Kbuild20
-rw-r--r--arch/sparc/include/asm/byteorder.h12
-rw-r--r--arch/sparc/include/asm/ipcbuf.h38
-rw-r--r--arch/sparc/include/asm/ipcbuf_32.h31
-rw-r--r--arch/sparc/include/asm/ipcbuf_64.h28
-rw-r--r--arch/sparc/include/asm/jsflash.h2
-rw-r--r--arch/sparc/include/asm/openprom.h277
-rw-r--r--arch/sparc/include/asm/openprom_32.h255
-rw-r--r--arch/sparc/include/asm/openprom_64.h280
-rw-r--r--arch/sparc/include/asm/posix_types.h157
-rw-r--r--arch/sparc/include/asm/posix_types_32.h118
-rw-r--r--arch/sparc/include/asm/posix_types_64.h122
-rw-r--r--arch/sparc/include/asm/processor_32.h2
-rw-r--r--arch/sparc/include/asm/ptrace.h448
-rw-r--r--arch/sparc/include/asm/ptrace_32.h186
-rw-r--r--arch/sparc/include/asm/ptrace_64.h356
-rw-r--r--arch/sparc/include/asm/reg.h8
-rw-r--r--arch/sparc/include/asm/reg_32.h79
-rw-r--r--arch/sparc/include/asm/reg_64.h56
-rw-r--r--arch/sparc/include/asm/sigcontext.h102
-rw-r--r--arch/sparc/include/asm/sigcontext_32.h62
-rw-r--r--arch/sparc/include/asm/sigcontext_64.h87
-rw-r--r--arch/sparc/include/asm/siginfo.h43
-rw-r--r--arch/sparc/include/asm/siginfo_32.h17
-rw-r--r--arch/sparc/include/asm/siginfo_64.h32
-rw-r--r--arch/sparc/include/asm/signal.h212
-rw-r--r--arch/sparc/include/asm/signal_32.h207
-rw-r--r--arch/sparc/include/asm/signal_64.h194
-rw-r--r--arch/sparc/include/asm/smp_32.h3
-rw-r--r--arch/sparc/include/asm/stat.h111
-rw-r--r--arch/sparc/include/asm/stat_32.h76
-rw-r--r--arch/sparc/include/asm/stat_64.h47
-rw-r--r--arch/sparc/include/asm/thread_info_32.h2
-rw-r--r--arch/sparc/include/asm/traps.h11
-rw-r--r--arch/sparc/kernel/irq_32.c2
-rw-r--r--arch/sparc/kernel/kgdb_32.c12
-rw-r--r--arch/sparc/kernel/muldiv.c8
-rw-r--r--arch/sparc/kernel/pci_psycho.c5
-rw-r--r--arch/sparc/kernel/process_32.c16
-rw-r--r--arch/sparc/kernel/prom_common.c14
-rw-r--r--arch/sparc/kernel/signal_32.c6
-rw-r--r--arch/sparc/kernel/traps_32.c4
-rw-r--r--arch/sparc/kernel/unaligned_32.c12
-rw-r--r--arch/sparc/kernel/windows.c6
-rw-r--r--arch/um/Makefile25
-rw-r--r--arch/um/include/asm/system.h14
-rw-r--r--arch/x86/Kconfig.cpu2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c51
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-lib.c9
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--drivers/cpufreq/cpufreq.c55
-rw-r--r--drivers/hid/Kconfig70
-rw-r--r--drivers/hid/Makefile5
-rw-r--r--drivers/hid/hid-bright.c71
-rw-r--r--drivers/hid/hid-core.c120
-rw-r--r--drivers/hid/hid-dell.c76
-rw-r--r--drivers/hid/hid-dummy.c6
-rw-r--r--drivers/hid/hid-gaff.c185
-rw-r--r--drivers/hid/hid-ids.h21
-rw-r--r--drivers/hid/hid-lg.c7
-rw-r--r--drivers/hid/hid-ntrig.c82
-rw-r--r--drivers/hid/hid-sony.c2
-rw-r--r--drivers/hid/hid-topseed.c77
-rw-r--r--drivers/hid/hidraw.c32
-rw-r--r--drivers/hid/usbhid/Kconfig2
-rw-r--r--drivers/hid/usbhid/hid-core.c34
-rw-r--r--drivers/hid/usbhid/hid-quirks.c1
-rw-r--r--drivers/hid/usbhid/hiddev.c135
-rw-r--r--drivers/hid/usbhid/usbhid.h10
-rw-r--r--drivers/i2c/busses/i2c-omap.c420
-rw-r--r--drivers/i2c/busses/i2c-s3c2410.c185
-rw-r--r--drivers/i2c/chips/Kconfig23
-rw-r--r--drivers/i2c/chips/Makefile2
-rw-r--r--drivers/infiniband/hw/ipath/ipath_fs.c3
-rw-r--r--drivers/isdn/capi/capidrv.c4
-rw-r--r--drivers/isdn/capi/capifs.c2
-rw-r--r--drivers/message/i2o/exec-osm.c2
-rw-r--r--drivers/message/i2o/i2o_config.c2
-rw-r--r--drivers/message/i2o/iop.c2
-rw-r--r--drivers/message/i2o/pci.c2
-rw-r--r--drivers/mfd/Kconfig66
-rw-r--r--drivers/mfd/Makefile7
-rw-r--r--drivers/mfd/da903x.c16
-rw-r--r--drivers/mfd/dm355evm_msp.c420
-rw-r--r--drivers/mfd/menelaus.c (renamed from drivers/i2c/chips/menelaus.c)0
-rw-r--r--drivers/mfd/mfd-core.c1
-rw-r--r--drivers/mfd/tps65010.c (renamed from drivers/i2c/chips/tps65010.c)0
-rw-r--r--drivers/mfd/twl4030-core.c472
-rw-r--r--drivers/mfd/twl4030-irq.c30
-rw-r--r--drivers/mfd/wm8350-core.c266
-rw-r--r--drivers/mfd/wm8350-i2c.c4
-rw-r--r--drivers/mfd/wm8350-regmap.c2100
-rw-r--r--drivers/mfd/wm8400-core.c31
-rw-r--r--drivers/misc/ibmasm/ibmasmfs.c2
-rw-r--r--drivers/net/acenic.c117
-rw-r--r--drivers/net/acenic.h4
-rw-r--r--drivers/net/e100.c268
-rw-r--r--drivers/net/ehea/ehea.h3
-rw-r--r--drivers/net/ehea/ehea_main.c2
-rw-r--r--drivers/net/enc28j60.c4
-rw-r--r--drivers/net/igb/igb_main.c4
-rw-r--r--drivers/net/myri10ge/myri10ge.c6
-rw-r--r--drivers/net/qlge/qlge.h57
-rw-r--r--drivers/net/qlge/qlge_dbg.c13
-rw-r--r--drivers/net/qlge/qlge_ethtool.c8
-rw-r--r--drivers/net/qlge/qlge_main.c116
-rw-r--r--drivers/net/starfire.c54
-rw-r--r--drivers/net/starfire_firmware.h346
-rw-r--r--drivers/net/starfire_firmware.pl31
-rw-r--r--drivers/net/tg3.c792
-rw-r--r--drivers/net/tg3.h4
-rw-r--r--drivers/net/tun.c2
-rw-r--r--drivers/oprofile/oprofilefs.c3
-rw-r--r--drivers/power/Kconfig14
-rw-r--r--drivers/power/Makefile2
-rw-r--r--drivers/power/da9030_battery.c600
-rw-r--r--drivers/power/power_supply_sysfs.c2
-rw-r--r--drivers/power/wm8350_power.c532
-rw-r--r--drivers/regulator/wm8350-regulator.c7
-rw-r--r--drivers/s390/net/qeth_core.h1
-rw-r--r--drivers/s390/net/qeth_core_main.c57
-rw-r--r--drivers/s390/net/qeth_l2_main.c8
-rw-r--r--drivers/s390/net/qeth_l3_main.c26
-rw-r--r--drivers/usb/core/inode.c1
-rw-r--r--drivers/usb/gadget/file_storage.c18
-rw-r--r--drivers/usb/gadget/inode.c1
-rw-r--r--firmware/Makefile11
-rw-r--r--firmware/WHENCE49
-rw-r--r--firmware/acenic/tg1.bin.ihex4573
-rw-r--r--firmware/acenic/tg2.bin.ihex4844
-rw-r--r--firmware/adaptec/starfire_rx.bin.ihex53
-rw-r--r--firmware/adaptec/starfire_tx.bin.ihex53
-rw-r--r--firmware/tigon/tg3.bin.ihex175
-rw-r--r--firmware/tigon/tg3_tso.bin.ihex446
-rw-r--r--firmware/tigon/tg3_tso5.bin.ihex252
-rw-r--r--fs/Kconfig18
-rw-r--r--fs/Makefile1
-rw-r--r--fs/affs/inode.c3
-rw-r--r--fs/autofs/inode.c2
-rw-r--r--fs/autofs4/inode.c4
-rw-r--r--fs/binfmt_misc.c3
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/coda/file.c12
-rw-r--r--fs/configfs/inode.c3
-rw-r--r--fs/cramfs/inode.c2
-rw-r--r--fs/debugfs/inode.c3
-rw-r--r--fs/devpts/inode.c4
-rw-r--r--fs/dlm/ast.c56
-rw-r--r--fs/dlm/ast.h4
-rw-r--r--fs/dlm/debug_fs.c310
-rw-r--r--fs/dlm/dir.c18
-rw-r--r--fs/dlm/dlm_internal.h4
-rw-r--r--fs/dlm/lock.c31
-rw-r--r--fs/dlm/lowcomms.c8
-rw-r--r--fs/dlm/memory.c6
-rw-r--r--fs/dlm/midcomms.c2
-rw-r--r--fs/dlm/netlink.c1
-rw-r--r--fs/dlm/user.c4
-rw-r--r--fs/dlm/user.h2
-rw-r--r--fs/dquot.c436
-rw-r--r--fs/ecryptfs/file.c15
-rw-r--r--fs/ecryptfs/inode.c3
-rw-r--r--fs/exec.c5
-rw-r--r--fs/ext3/super.c16
-rw-r--r--fs/ext4/super.c15
-rw-r--r--fs/filesystems.c23
-rw-r--r--fs/gfs2/Makefile2
-rw-r--r--fs/gfs2/acl.c2
-rw-r--r--fs/gfs2/bmap.c77
-rw-r--r--fs/gfs2/bmap.h34
-rw-r--r--fs/gfs2/daemon.c136
-rw-r--r--fs/gfs2/daemon.h17
-rw-r--r--fs/gfs2/dir.c62
-rw-r--r--fs/gfs2/dir.h1
-rw-r--r--fs/gfs2/eattr.c40
-rw-r--r--fs/gfs2/glock.c303
-rw-r--r--fs/gfs2/glock.h2
-rw-r--r--fs/gfs2/glops.c56
-rw-r--r--fs/gfs2/incore.h55
-rw-r--r--fs/gfs2/inode.c53
-rw-r--r--fs/gfs2/inode.h13
-rw-r--r--fs/gfs2/locking/dlm/mount.c12
-rw-r--r--fs/gfs2/locking/dlm/sysfs.c16
-rw-r--r--fs/gfs2/main.c15
-rw-r--r--fs/gfs2/mount.c29
-rw-r--r--fs/gfs2/ops_address.c32
-rw-r--r--fs/gfs2/ops_dentry.c2
-rw-r--r--fs/gfs2/ops_dentry.h17
-rw-r--r--fs/gfs2/ops_export.c5
-rw-r--r--fs/gfs2/ops_file.c22
-rw-r--r--fs/gfs2/ops_fstype.c125
-rw-r--r--fs/gfs2/ops_fstype.h19
-rw-r--r--fs/gfs2/ops_inode.c75
-rw-r--r--fs/gfs2/ops_inode.h25
-rw-r--r--fs/gfs2/ops_super.c149
-rw-r--r--fs/gfs2/ops_super.h17
-rw-r--r--fs/gfs2/quota.c113
-rw-r--r--fs/gfs2/quota.h24
-rw-r--r--fs/gfs2/recovery.c48
-rw-r--r--fs/gfs2/recovery.h14
-rw-r--r--fs/gfs2/rgrp.c58
-rw-r--r--fs/gfs2/super.c246
-rw-r--r--fs/gfs2/super.h13
-rw-r--r--fs/gfs2/sys.c66
-rw-r--r--fs/gfs2/sys.h4
-rw-r--r--fs/gfs2/util.c1
-rw-r--r--fs/gfs2/util.h1
-rw-r--r--fs/hugetlbfs/inode.c1
-rw-r--r--fs/inode.c2
-rw-r--r--fs/ioctl.c44
-rw-r--r--fs/isofs/inode.c6
-rw-r--r--fs/jbd2/commit.c9
-rw-r--r--fs/jbd2/journal.c19
-rw-r--r--fs/jbd2/transaction.c47
-rw-r--r--fs/jfs/jfs_imap.c10
-rw-r--r--fs/libfs.c5
-rw-r--r--fs/namei.c32
-rw-r--r--fs/nfsd/vfs.c43
-rw-r--r--fs/notify/inotify/inotify_user.c2
-rw-r--r--fs/ntfs/inode.c3
-rw-r--r--fs/ocfs2/Makefile7
-rw-r--r--fs/ocfs2/acl.c479
-rw-r--r--fs/ocfs2/acl.h58
-rw-r--r--fs/ocfs2/alloc.c710
-rw-r--r--fs/ocfs2/alloc.h30
-rw-r--r--fs/ocfs2/aops.c59
-rw-r--r--fs/ocfs2/blockcheck.c477
-rw-r--r--fs/ocfs2/blockcheck.h82
-rw-r--r--fs/ocfs2/buffer_head_io.c32
-rw-r--r--fs/ocfs2/buffer_head_io.h27
-rw-r--r--fs/ocfs2/cluster/masklog.c1
-rw-r--r--fs/ocfs2/cluster/masklog.h1
-rw-r--r--fs/ocfs2/dir.c399
-rw-r--r--fs/ocfs2/dir.h2
-rw-r--r--fs/ocfs2/dlm/dlmast.c52
-rw-r--r--fs/ocfs2/dlm/dlmcommon.h3
-rw-r--r--fs/ocfs2/dlm/dlmdebug.c53
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c1
-rw-r--r--fs/ocfs2/dlm/dlmfs.c2
-rw-r--r--fs/ocfs2/dlm/dlmmaster.c42
-rw-r--r--fs/ocfs2/dlm/dlmthread.c3
-rw-r--r--fs/ocfs2/dlmglue.c168
-rw-r--r--fs/ocfs2/dlmglue.h19
-rw-r--r--fs/ocfs2/extent_map.c96
-rw-r--r--fs/ocfs2/extent_map.h24
-rw-r--r--fs/ocfs2/file.c209
-rw-r--r--fs/ocfs2/file.h3
-rw-r--r--fs/ocfs2/inode.c175
-rw-r--r--fs/ocfs2/inode.h18
-rw-r--r--fs/ocfs2/journal.c364
-rw-r--r--fs/ocfs2/journal.h128
-rw-r--r--fs/ocfs2/localalloc.c26
-rw-r--r--fs/ocfs2/namei.c318
-rw-r--r--fs/ocfs2/ocfs2.h46
-rw-r--r--fs/ocfs2/ocfs2_fs.h213
-rw-r--r--fs/ocfs2/ocfs2_jbd_compat.h82
-rw-r--r--fs/ocfs2/ocfs2_lockid.h5
-rw-r--r--fs/ocfs2/quota.h119
-rw-r--r--fs/ocfs2/quota_global.c1025
-rw-r--r--fs/ocfs2/quota_local.c1253
-rw-r--r--fs/ocfs2/resize.c76
-rw-r--r--fs/ocfs2/slot_map.c4
-rw-r--r--fs/ocfs2/suballoc.c363
-rw-r--r--fs/ocfs2/suballoc.h18
-rw-r--r--fs/ocfs2/super.c328
-rw-r--r--fs/ocfs2/symlink.c2
-rw-r--r--fs/ocfs2/xattr.c2984
-rw-r--r--fs/ocfs2/xattr.h45
-rw-r--r--fs/omfs/inode.c1
-rw-r--r--fs/open.c2
-rw-r--r--fs/openpromfs/inode.c3
-rw-r--r--fs/proc/base.c4
-rw-r--r--fs/proc/proc_sysctl.c1
-rw-r--r--fs/quota.c11
-rw-r--r--fs/quota_tree.c645
-rw-r--r--fs/quota_tree.h25
-rw-r--r--fs/quota_v1.c28
-rw-r--r--fs/quota_v2.c631
-rw-r--r--fs/quotaio_v1.h (renamed from include/linux/quotaio_v1.h)0
-rw-r--r--fs/quotaio_v2.h (renamed from include/linux/quotaio_v2.h)33
-rw-r--r--fs/ramfs/inode.c1
-rw-r--r--fs/read_write.c13
-rw-r--r--fs/reiserfs/inode.c13
-rw-r--r--fs/reiserfs/super.c10
-rw-r--r--fs/romfs/inode.c1
-rw-r--r--fs/stat.c2
-rw-r--r--fs/sync.c48
-rw-r--r--fs/sysfs/inode.c3
-rw-r--r--fs/xattr.c2
-rw-r--r--include/linux/Kbuild4
-rw-r--r--include/linux/cpufreq.h1
-rw-r--r--include/linux/dma_remapping.h8
-rw-r--r--include/linux/dqblk_qtree.h56
-rw-r--r--include/linux/dqblk_v1.h7
-rw-r--r--include/linux/dqblk_v2.h22
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/linux/hid.h16
-rw-r--r--include/linux/hidraw.h2
-rw-r--r--include/linux/i2c/dm355evm_msp.h79
-rw-r--r--include/linux/i2c/twl4030.h81
-rw-r--r--include/linux/jbd2.h32
-rw-r--r--include/linux/journal-head.h8
-rw-r--r--include/linux/mfd/da903x.h44
-rw-r--r--include/linux/mfd/wm8350/comparator.h8
-rw-r--r--include/linux/mfd/wm8350/core.h52
-rw-r--r--include/linux/mfd/wm8350/pmic.h4
-rw-r--r--include/linux/mfd/wm8350/supply.h25
-rw-r--r--include/linux/moduleloader.h3
-rw-r--r--include/linux/netdevice.h16
-rw-r--r--include/linux/power_supply.h1
-rw-r--r--include/linux/quota.h108
-rw-r--r--include/linux/quotaops.h96
-rw-r--r--include/linux/radix-tree.h2
-rw-r--r--include/linux/stop_machine.h22
-rw-r--r--include/linux/syscalls.h2
-rw-r--r--include/net/ndisc.h4
-rw-r--r--init/Kconfig6
-rw-r--r--ipc/mqueue.c1
-rw-r--r--ipc/sem.c2
-rw-r--r--kernel/cgroup.c1
-rw-r--r--kernel/cpu.c6
-rw-r--r--kernel/module.c59
-rw-r--r--kernel/stop_machine.c55
-rw-r--r--lib/swiotlb.c3
-rw-r--r--mm/filemap.c2
-rw-r--r--mm/memory.c4
-rw-r--r--mm/mmap.c2
-rw-r--r--mm/mprotect.c2
-rw-r--r--mm/mremap.c2
-rw-r--r--mm/msync.c2
-rw-r--r--mm/nommu.c2
-rw-r--r--net/can/bcm.c208
-rw-r--r--net/core/dev.c93
-rw-r--r--net/core/skbuff.c15
-rw-r--r--net/dcb/dcbnl.c14
-rw-r--r--net/dccp/Kconfig4
-rw-r--r--net/dccp/Makefile15
-rw-r--r--net/dccp/ackvec.h49
-rw-r--r--net/dccp/ccid.c254
-rw-r--r--net/dccp/ccid.h14
-rw-r--r--net/dccp/ccids/Kconfig79
-rw-r--r--net/dccp/ccids/Makefile9
-rw-r--r--net/dccp/ccids/ccid2.c22
-rw-r--r--net/dccp/ccids/ccid3.c23
-rw-r--r--net/dccp/ccids/lib/Makefile3
-rw-r--r--net/dccp/ccids/lib/loss_interval.c3
-rw-r--r--net/dccp/ccids/lib/packet_history.c9
-rw-r--r--net/dccp/ccids/lib/tfrc.c19
-rw-r--r--net/dccp/ccids/lib/tfrc.h11
-rw-r--r--net/dccp/ccids/lib/tfrc_equation.c4
-rw-r--r--net/dccp/dccp.h2
-rw-r--r--net/dccp/feat.c6
-rw-r--r--net/dccp/input.c2
-rw-r--r--net/dccp/proto.c7
-rw-r--r--net/ipv4/tcp.c9
-rw-r--r--net/ipv6/ipv6_sockglue.c2
-rw-r--r--net/ipv6/route.c52
-rw-r--r--net/iucv/af_iucv.c28
-rw-r--r--net/iucv/iucv.c18
-rw-r--r--net/rfkill/rfkill.c4
-rw-r--r--net/sched/cls_u32.c3
-rw-r--r--net/sunrpc/rpc_pipe.c2
-rw-r--r--security/commoncap.c6
-rw-r--r--security/inode.c3
-rw-r--r--security/selinux/selinuxfs.c2
-rw-r--r--sound/pci/hda/patch_conexant.c114
-rw-r--r--sound/pci/hda/patch_realtek.c3
-rw-r--r--sound/pci/ice1712/ice1724.c2
-rw-r--r--sound/soc/codecs/twl4030.c377
-rw-r--r--sound/soc/codecs/twl4030.h7
-rw-r--r--sound/soc/davinci/davinci-sffsdr.c4
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c4
-rw-r--r--sound/soc/soc-core.c46
-rw-r--r--sound/soc/soc-dapm.c10
-rw-r--r--sound/usb/caiaq/caiaq-device.c4
-rw-r--r--sound/usb/usbaudio.c8
-rw-r--r--sound/usb/usbmidi.c39
-rw-r--r--sound/usb/usbmixer.c5
-rw-r--r--sound/usb/usx2y/us122l.c4
-rw-r--r--sound/usb/usx2y/usbusx2y.c4
390 files changed, 30499 insertions, 10226 deletions
diff --git a/Documentation/filesystems/ocfs2.txt b/Documentation/filesystems/ocfs2.txt
index 67310fbbb7df..c2a0871280a0 100644
--- a/Documentation/filesystems/ocfs2.txt
+++ b/Documentation/filesystems/ocfs2.txt
@@ -31,7 +31,6 @@ Features which OCFS2 does not support yet:
31 - quotas 31 - quotas
32 - Directory change notification (F_NOTIFY) 32 - Directory change notification (F_NOTIFY)
33 - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease) 33 - Distributed Caching (F_SETLEASE/F_GETLEASE/break_lease)
34 - POSIX ACLs
35 34
36Mount options 35Mount options
37============= 36=============
@@ -79,3 +78,5 @@ inode64 Indicates that Ocfs2 is allowed to create inodes at
79 bits of significance. 78 bits of significance.
80user_xattr (*) Enables Extended User Attributes. 79user_xattr (*) Enables Extended User Attributes.
81nouser_xattr Disables Extended User Attributes. 80nouser_xattr Disables Extended User Attributes.
81acl Enables POSIX Access Control Lists support.
82noacl (*) Disables POSIX Access Control Lists support.
diff --git a/MAINTAINERS b/MAINTAINERS
index befacf07729f..141aff67bd6d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4015,10 +4015,12 @@ L: alsa-devel@alsa-project.org (subscribers-only)
4015W: http://alsa-project.org/main/index.php/ASoC 4015W: http://alsa-project.org/main/index.php/ASoC
4016S: Supported 4016S: Supported
4017 4017
4018SPARC (sparc32) 4018SPARC + UltraSPARC (sparc/sparc64)
4019P: William L. Irwin 4019P: David S. Miller
4020M: wli@holomorphy.com 4020M: davem@davemloft.net
4021L: sparclinux@vger.kernel.org 4021L: sparclinux@vger.kernel.org
4022T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
4023T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-next-2.6.git
4022S: Maintained 4024S: Maintained
4023 4025
4024SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER 4026SPECIALIX IO8+ MULTIPORT SERIAL CARD DRIVER
@@ -4302,13 +4304,6 @@ M: dushistov@mail.ru
4302L: linux-kernel@vger.kernel.org 4304L: linux-kernel@vger.kernel.org
4303S: Maintained 4305S: Maintained
4304 4306
4305UltraSPARC (sparc64)
4306P: David S. Miller
4307M: davem@davemloft.net
4308L: sparclinux@vger.kernel.org
4309T: git kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6.git
4310S: Maintained
4311
4312ULTRA-WIDEBAND (UWB) SUBSYSTEM: 4307ULTRA-WIDEBAND (UWB) SUBSYSTEM:
4313P: David Vrabel 4308P: David Vrabel
4314M: david.vrabel@csr.com 4309M: david.vrabel@csr.com
diff --git a/arch/arm/mach-omap2/clock24xx.h b/arch/arm/mach-omap2/clock24xx.h
index ff6cd14d254d..ad6d98d177c5 100644
--- a/arch/arm/mach-omap2/clock24xx.h
+++ b/arch/arm/mach-omap2/clock24xx.h
@@ -2321,7 +2321,7 @@ static struct clk i2c2_fck = {
2321}; 2321};
2322 2322
2323static struct clk i2chs2_fck = { 2323static struct clk i2chs2_fck = {
2324 .name = "i2chs_fck", 2324 .name = "i2c_fck",
2325 .id = 2, 2325 .id = 2,
2326 .parent = &func_96m_ck, 2326 .parent = &func_96m_ck,
2327 .flags = CLOCK_IN_OMAP243X, 2327 .flags = CLOCK_IN_OMAP243X,
@@ -2354,7 +2354,7 @@ static struct clk i2c1_fck = {
2354}; 2354};
2355 2355
2356static struct clk i2chs1_fck = { 2356static struct clk i2chs1_fck = {
2357 .name = "i2chs_fck", 2357 .name = "i2c_fck",
2358 .id = 1, 2358 .id = 1,
2359 .parent = &func_96m_ck, 2359 .parent = &func_96m_ck,
2360 .flags = CLOCK_IN_OMAP243X, 2360 .flags = CLOCK_IN_OMAP243X,
diff --git a/arch/parisc/include/asm/module.h b/arch/parisc/include/asm/module.h
index c2cb49e934c1..1f4123427ea0 100644
--- a/arch/parisc/include/asm/module.h
+++ b/arch/parisc/include/asm/module.h
@@ -23,8 +23,10 @@ struct mod_arch_specific
23{ 23{
24 unsigned long got_offset, got_count, got_max; 24 unsigned long got_offset, got_count, got_max;
25 unsigned long fdesc_offset, fdesc_count, fdesc_max; 25 unsigned long fdesc_offset, fdesc_count, fdesc_max;
26 unsigned long stub_offset, stub_count, stub_max; 26 struct {
27 unsigned long init_stub_offset, init_stub_count, init_stub_max; 27 unsigned long stub_offset;
28 unsigned int stub_entries;
29 } *section;
28 int unwind_section; 30 int unwind_section;
29 struct unwind_table *unwind; 31 struct unwind_table *unwind;
30}; 32};
diff --git a/arch/parisc/kernel/module.c b/arch/parisc/kernel/module.c
index 44138c3e6ea7..9013243cecca 100644
--- a/arch/parisc/kernel/module.c
+++ b/arch/parisc/kernel/module.c
@@ -6,6 +6,7 @@
6 * 6 *
7 * Linux/PA-RISC Project (http://www.parisc-linux.org/) 7 * Linux/PA-RISC Project (http://www.parisc-linux.org/)
8 * Copyright (C) 2003 Randolph Chung <tausq at debian . org> 8 * Copyright (C) 2003 Randolph Chung <tausq at debian . org>
9 * Copyright (C) 2008 Helge Deller <deller@gmx.de>
9 * 10 *
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
@@ -24,6 +25,19 @@
24 * 25 *
25 * 26 *
26 * Notes: 27 * Notes:
28 * - PLT stub handling
29 * On 32bit (and sometimes 64bit) and with big kernel modules like xfs or
30 * ipv6 the relocation types R_PARISC_PCREL17F and R_PARISC_PCREL22F may
31 * fail to reach their PLT stub if we only create one big stub array for
32 * all sections at the beginning of the core or init section.
33 * Instead we now insert individual PLT stub entries directly in front of
34 * of the code sections where the stubs are actually called.
35 * This reduces the distance between the PCREL location and the stub entry
36 * so that the relocations can be fulfilled.
37 * While calculating the final layout of the kernel module in memory, the
38 * kernel module loader calls arch_mod_section_prepend() to request the
39 * to be reserved amount of memory in front of each individual section.
40 *
27 * - SEGREL32 handling 41 * - SEGREL32 handling
28 * We are not doing SEGREL32 handling correctly. According to the ABI, we 42 * We are not doing SEGREL32 handling correctly. According to the ABI, we
29 * should do a value offset, like this: 43 * should do a value offset, like this:
@@ -58,9 +72,13 @@
58#define DEBUGP(fmt...) 72#define DEBUGP(fmt...)
59#endif 73#endif
60 74
75#define RELOC_REACHABLE(val, bits) \
76 (( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \
77 ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) ? \
78 0 : 1)
79
61#define CHECK_RELOC(val, bits) \ 80#define CHECK_RELOC(val, bits) \
62 if ( ( !((val) & (1<<((bits)-1))) && ((val)>>(bits)) != 0 ) || \ 81 if (!RELOC_REACHABLE(val, bits)) { \
63 ( ((val) & (1<<((bits)-1))) && ((val)>>(bits)) != (((__typeof__(val))(~0))>>((bits)+2)))) { \
64 printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \ 82 printk(KERN_ERR "module %s relocation of symbol %s is out of range (0x%lx in %d bits)\n", \
65 me->name, strtab + sym->st_name, (unsigned long)val, bits); \ 83 me->name, strtab + sym->st_name, (unsigned long)val, bits); \
66 return -ENOEXEC; \ 84 return -ENOEXEC; \
@@ -92,13 +110,6 @@ static inline int in_local(struct module *me, void *loc)
92 return in_init(me, loc) || in_core(me, loc); 110 return in_init(me, loc) || in_core(me, loc);
93} 111}
94 112
95static inline int in_local_section(struct module *me, void *loc, void *dot)
96{
97 return (in_init(me, loc) && in_init(me, dot)) ||
98 (in_core(me, loc) && in_core(me, dot));
99}
100
101
102#ifndef CONFIG_64BIT 113#ifndef CONFIG_64BIT
103struct got_entry { 114struct got_entry {
104 Elf32_Addr addr; 115 Elf32_Addr addr;
@@ -258,23 +269,42 @@ static inline unsigned long count_stubs(const Elf_Rela *rela, unsigned long n)
258/* Free memory returned from module_alloc */ 269/* Free memory returned from module_alloc */
259void module_free(struct module *mod, void *module_region) 270void module_free(struct module *mod, void *module_region)
260{ 271{
272 kfree(mod->arch.section);
273 mod->arch.section = NULL;
274
261 vfree(module_region); 275 vfree(module_region);
262 /* FIXME: If module_region == mod->init_region, trim exception 276 /* FIXME: If module_region == mod->init_region, trim exception
263 table entries. */ 277 table entries. */
264} 278}
265 279
280/* Additional bytes needed in front of individual sections */
281unsigned int arch_mod_section_prepend(struct module *mod,
282 unsigned int section)
283{
284 /* size needed for all stubs of this section (including
285 * one additional for correct alignment of the stubs) */
286 return (mod->arch.section[section].stub_entries + 1)
287 * sizeof(struct stub_entry);
288}
289
266#define CONST 290#define CONST
267int module_frob_arch_sections(CONST Elf_Ehdr *hdr, 291int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
268 CONST Elf_Shdr *sechdrs, 292 CONST Elf_Shdr *sechdrs,
269 CONST char *secstrings, 293 CONST char *secstrings,
270 struct module *me) 294 struct module *me)
271{ 295{
272 unsigned long gots = 0, fdescs = 0, stubs = 0, init_stubs = 0; 296 unsigned long gots = 0, fdescs = 0, len;
273 unsigned int i; 297 unsigned int i;
274 298
299 len = hdr->e_shnum * sizeof(me->arch.section[0]);
300 me->arch.section = kzalloc(len, GFP_KERNEL);
301 if (!me->arch.section)
302 return -ENOMEM;
303
275 for (i = 1; i < hdr->e_shnum; i++) { 304 for (i = 1; i < hdr->e_shnum; i++) {
276 const Elf_Rela *rels = (void *)hdr + sechdrs[i].sh_offset; 305 const Elf_Rela *rels = (void *)sechdrs[i].sh_addr;
277 unsigned long nrels = sechdrs[i].sh_size / sizeof(*rels); 306 unsigned long nrels = sechdrs[i].sh_size / sizeof(*rels);
307 unsigned int count, s;
278 308
279 if (strncmp(secstrings + sechdrs[i].sh_name, 309 if (strncmp(secstrings + sechdrs[i].sh_name,
280 ".PARISC.unwind", 14) == 0) 310 ".PARISC.unwind", 14) == 0)
@@ -290,11 +320,23 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
290 */ 320 */
291 gots += count_gots(rels, nrels); 321 gots += count_gots(rels, nrels);
292 fdescs += count_fdescs(rels, nrels); 322 fdescs += count_fdescs(rels, nrels);
293 if(strncmp(secstrings + sechdrs[i].sh_name, 323
294 ".rela.init", 10) == 0) 324 /* XXX: By sorting the relocs and finding duplicate entries
295 init_stubs += count_stubs(rels, nrels); 325 * we could reduce the number of necessary stubs and save
296 else 326 * some memory. */
297 stubs += count_stubs(rels, nrels); 327 count = count_stubs(rels, nrels);
328 if (!count)
329 continue;
330
331 /* so we need relocation stubs. reserve necessary memory. */
332 /* sh_info gives the section for which we need to add stubs. */
333 s = sechdrs[i].sh_info;
334
335 /* each code section should only have one relocation section */
336 WARN_ON(me->arch.section[s].stub_entries);
337
338 /* store number of stubs we need for this section */
339 me->arch.section[s].stub_entries += count;
298 } 340 }
299 341
300 /* align things a bit */ 342 /* align things a bit */
@@ -306,18 +348,8 @@ int module_frob_arch_sections(CONST Elf_Ehdr *hdr,
306 me->arch.fdesc_offset = me->core_size; 348 me->arch.fdesc_offset = me->core_size;
307 me->core_size += fdescs * sizeof(Elf_Fdesc); 349 me->core_size += fdescs * sizeof(Elf_Fdesc);
308 350
309 me->core_size = ALIGN(me->core_size, 16);
310 me->arch.stub_offset = me->core_size;
311 me->core_size += stubs * sizeof(struct stub_entry);
312
313 me->init_size = ALIGN(me->init_size, 16);
314 me->arch.init_stub_offset = me->init_size;
315 me->init_size += init_stubs * sizeof(struct stub_entry);
316
317 me->arch.got_max = gots; 351 me->arch.got_max = gots;
318 me->arch.fdesc_max = fdescs; 352 me->arch.fdesc_max = fdescs;
319 me->arch.stub_max = stubs;
320 me->arch.init_stub_max = init_stubs;
321 353
322 return 0; 354 return 0;
323} 355}
@@ -380,23 +412,27 @@ enum elf_stub_type {
380}; 412};
381 413
382static Elf_Addr get_stub(struct module *me, unsigned long value, long addend, 414static Elf_Addr get_stub(struct module *me, unsigned long value, long addend,
383 enum elf_stub_type stub_type, int init_section) 415 enum elf_stub_type stub_type, Elf_Addr loc0, unsigned int targetsec)
384{ 416{
385 unsigned long i;
386 struct stub_entry *stub; 417 struct stub_entry *stub;
387 418
388 if(init_section) { 419 /* initialize stub_offset to point in front of the section */
389 i = me->arch.init_stub_count++; 420 if (!me->arch.section[targetsec].stub_offset) {
390 BUG_ON(me->arch.init_stub_count > me->arch.init_stub_max); 421 loc0 -= (me->arch.section[targetsec].stub_entries + 1) *
391 stub = me->module_init + me->arch.init_stub_offset + 422 sizeof(struct stub_entry);
392 i * sizeof(struct stub_entry); 423 /* get correct alignment for the stubs */
393 } else { 424 loc0 = ALIGN(loc0, sizeof(struct stub_entry));
394 i = me->arch.stub_count++; 425 me->arch.section[targetsec].stub_offset = loc0;
395 BUG_ON(me->arch.stub_count > me->arch.stub_max);
396 stub = me->module_core + me->arch.stub_offset +
397 i * sizeof(struct stub_entry);
398 } 426 }
399 427
428 /* get address of stub entry */
429 stub = (void *) me->arch.section[targetsec].stub_offset;
430 me->arch.section[targetsec].stub_offset += sizeof(struct stub_entry);
431
432 /* do not write outside available stub area */
433 BUG_ON(0 == me->arch.section[targetsec].stub_entries--);
434
435
400#ifndef CONFIG_64BIT 436#ifndef CONFIG_64BIT
401/* for 32-bit the stub looks like this: 437/* for 32-bit the stub looks like this:
402 * ldil L'XXX,%r1 438 * ldil L'XXX,%r1
@@ -489,15 +525,19 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
489 Elf32_Addr val; 525 Elf32_Addr val;
490 Elf32_Sword addend; 526 Elf32_Sword addend;
491 Elf32_Addr dot; 527 Elf32_Addr dot;
528 Elf_Addr loc0;
529 unsigned int targetsec = sechdrs[relsec].sh_info;
492 //unsigned long dp = (unsigned long)$global$; 530 //unsigned long dp = (unsigned long)$global$;
493 register unsigned long dp asm ("r27"); 531 register unsigned long dp asm ("r27");
494 532
495 DEBUGP("Applying relocate section %u to %u\n", relsec, 533 DEBUGP("Applying relocate section %u to %u\n", relsec,
496 sechdrs[relsec].sh_info); 534 targetsec);
497 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 535 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
498 /* This is where to make the change */ 536 /* This is where to make the change */
499 loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr 537 loc = (void *)sechdrs[targetsec].sh_addr
500 + rel[i].r_offset; 538 + rel[i].r_offset;
539 /* This is the start of the target section */
540 loc0 = sechdrs[targetsec].sh_addr;
501 /* This is the symbol it is referring to */ 541 /* This is the symbol it is referring to */
502 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr 542 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
503 + ELF32_R_SYM(rel[i].r_info); 543 + ELF32_R_SYM(rel[i].r_info);
@@ -569,19 +609,32 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
569 break; 609 break;
570 case R_PARISC_PCREL17F: 610 case R_PARISC_PCREL17F:
571 /* 17-bit PC relative address */ 611 /* 17-bit PC relative address */
572 val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc)); 612 /* calculate direct call offset */
613 val += addend;
573 val = (val - dot - 8)/4; 614 val = (val - dot - 8)/4;
574 CHECK_RELOC(val, 17) 615 if (!RELOC_REACHABLE(val, 17)) {
616 /* direct distance too far, create
617 * stub entry instead */
618 val = get_stub(me, sym->st_value, addend,
619 ELF_STUB_DIRECT, loc0, targetsec);
620 val = (val - dot - 8)/4;
621 CHECK_RELOC(val, 17);
622 }
575 *loc = (*loc & ~0x1f1ffd) | reassemble_17(val); 623 *loc = (*loc & ~0x1f1ffd) | reassemble_17(val);
576 break; 624 break;
577 case R_PARISC_PCREL22F: 625 case R_PARISC_PCREL22F:
578 /* 22-bit PC relative address; only defined for pa20 */ 626 /* 22-bit PC relative address; only defined for pa20 */
579 val = get_stub(me, val, addend, ELF_STUB_GOT, in_init(me, loc)); 627 /* calculate direct call offset */
580 DEBUGP("STUB FOR %s loc %lx+%lx at %lx\n", 628 val += addend;
581 strtab + sym->st_name, (unsigned long)loc, addend,
582 val)
583 val = (val - dot - 8)/4; 629 val = (val - dot - 8)/4;
584 CHECK_RELOC(val, 22); 630 if (!RELOC_REACHABLE(val, 22)) {
631 /* direct distance too far, create
632 * stub entry instead */
633 val = get_stub(me, sym->st_value, addend,
634 ELF_STUB_DIRECT, loc0, targetsec);
635 val = (val - dot - 8)/4;
636 CHECK_RELOC(val, 22);
637 }
585 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val); 638 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
586 break; 639 break;
587 640
@@ -610,13 +663,17 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
610 Elf64_Addr val; 663 Elf64_Addr val;
611 Elf64_Sxword addend; 664 Elf64_Sxword addend;
612 Elf64_Addr dot; 665 Elf64_Addr dot;
666 Elf_Addr loc0;
667 unsigned int targetsec = sechdrs[relsec].sh_info;
613 668
614 DEBUGP("Applying relocate section %u to %u\n", relsec, 669 DEBUGP("Applying relocate section %u to %u\n", relsec,
615 sechdrs[relsec].sh_info); 670 targetsec);
616 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { 671 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
617 /* This is where to make the change */ 672 /* This is where to make the change */
618 loc = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr 673 loc = (void *)sechdrs[targetsec].sh_addr
619 + rel[i].r_offset; 674 + rel[i].r_offset;
675 /* This is the start of the target section */
676 loc0 = sechdrs[targetsec].sh_addr;
620 /* This is the symbol it is referring to */ 677 /* This is the symbol it is referring to */
621 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr 678 sym = (Elf64_Sym *)sechdrs[symindex].sh_addr
622 + ELF64_R_SYM(rel[i].r_info); 679 + ELF64_R_SYM(rel[i].r_info);
@@ -672,42 +729,40 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
672 DEBUGP("PCREL22F Symbol %s loc %p val %lx\n", 729 DEBUGP("PCREL22F Symbol %s loc %p val %lx\n",
673 strtab + sym->st_name, 730 strtab + sym->st_name,
674 loc, val); 731 loc, val);
732 val += addend;
675 /* can we reach it locally? */ 733 /* can we reach it locally? */
676 if(!in_local_section(me, (void *)val, (void *)dot)) { 734 if (in_local(me, (void *)val)) {
677 735 /* this is the case where the symbol is local
678 if (in_local(me, (void *)val)) 736 * to the module, but in a different section,
679 /* this is the case where the 737 * so stub the jump in case it's more than 22
680 * symbol is local to the 738 * bits away */
681 * module, but in a different 739 val = (val - dot - 8)/4;
682 * section, so stub the jump 740 if (!RELOC_REACHABLE(val, 22)) {
683 * in case it's more than 22 741 /* direct distance too far, create
684 * bits away */ 742 * stub entry instead */
685 val = get_stub(me, val, addend, ELF_STUB_DIRECT, 743 val = get_stub(me, sym->st_value,
686 in_init(me, loc)); 744 addend, ELF_STUB_DIRECT,
687 else if (strncmp(strtab + sym->st_name, "$$", 2) 745 loc0, targetsec);
746 } else {
747 /* Ok, we can reach it directly. */
748 val = sym->st_value;
749 val += addend;
750 }
751 } else {
752 val = sym->st_value;
753 if (strncmp(strtab + sym->st_name, "$$", 2)
688 == 0) 754 == 0)
689 val = get_stub(me, val, addend, ELF_STUB_MILLI, 755 val = get_stub(me, val, addend, ELF_STUB_MILLI,
690 in_init(me, loc)); 756 loc0, targetsec);
691 else 757 else
692 val = get_stub(me, val, addend, ELF_STUB_GOT, 758 val = get_stub(me, val, addend, ELF_STUB_GOT,
693 in_init(me, loc)); 759 loc0, targetsec);
694 } 760 }
695 DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n", 761 DEBUGP("STUB FOR %s loc %lx, val %lx+%lx at %lx\n",
696 strtab + sym->st_name, loc, sym->st_value, 762 strtab + sym->st_name, loc, sym->st_value,
697 addend, val); 763 addend, val);
698 /* FIXME: local symbols work as long as the
699 * core and init pieces aren't separated too
700 * far. If this is ever broken, you will trip
701 * the check below. The way to fix it would
702 * be to generate local stubs to go between init
703 * and core */
704 if((Elf64_Sxword)(val - dot - 8) > 0x800000 -1 ||
705 (Elf64_Sxword)(val - dot - 8) < -0x800000) {
706 printk(KERN_ERR "Module %s, symbol %s is out of range for PCREL22F relocation\n",
707 me->name, strtab + sym->st_name);
708 return -ENOEXEC;
709 }
710 val = (val - dot - 8)/4; 764 val = (val - dot - 8)/4;
765 CHECK_RELOC(val, 22);
711 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val); 766 *loc = (*loc & ~0x3ff1ffd) | reassemble_22(val);
712 break; 767 break;
713 case R_PARISC_DIR64: 768 case R_PARISC_DIR64:
@@ -794,12 +849,8 @@ int module_finalize(const Elf_Ehdr *hdr,
794 addr = (u32 *)entry->addr; 849 addr = (u32 *)entry->addr;
795 printk("INSNS: %x %x %x %x\n", 850 printk("INSNS: %x %x %x %x\n",
796 addr[0], addr[1], addr[2], addr[3]); 851 addr[0], addr[1], addr[2], addr[3]);
797 printk("stubs used %ld, stubs max %ld\n" 852 printk("got entries used %ld, gots max %ld\n"
798 "init_stubs used %ld, init stubs max %ld\n"
799 "got entries used %ld, gots max %ld\n"
800 "fdescs used %ld, fdescs max %ld\n", 853 "fdescs used %ld, fdescs max %ld\n",
801 me->arch.stub_count, me->arch.stub_max,
802 me->arch.init_stub_count, me->arch.init_stub_max,
803 me->arch.got_count, me->arch.got_max, 854 me->arch.got_count, me->arch.got_max,
804 me->arch.fdesc_count, me->arch.fdesc_max); 855 me->arch.fdesc_count, me->arch.fdesc_max);
805#endif 856#endif
@@ -829,7 +880,10 @@ int module_finalize(const Elf_Ehdr *hdr,
829 me->name, me->arch.got_count, MAX_GOTS); 880 me->name, me->arch.got_count, MAX_GOTS);
830 return -EINVAL; 881 return -EINVAL;
831 } 882 }
832 883
884 kfree(me->arch.section);
885 me->arch.section = NULL;
886
833 /* no symbol table */ 887 /* no symbol table */
834 if(symhdr == NULL) 888 if(symhdr == NULL)
835 return 0; 889 return 0;
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index 6296bfd9cb0b..e309ef70a531 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -97,7 +97,6 @@ spufs_new_inode(struct super_block *sb, int mode)
97 inode->i_mode = mode; 97 inode->i_mode = mode;
98 inode->i_uid = current_fsuid(); 98 inode->i_uid = current_fsuid();
99 inode->i_gid = current_fsgid(); 99 inode->i_gid = current_fsgid();
100 inode->i_blocks = 0;
101 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 100 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
102out: 101out:
103 return inode; 102 return inode;
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 9d4f8e6c0800..5a805df216bb 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -106,7 +106,6 @@ static struct inode *hypfs_make_inode(struct super_block *sb, int mode)
106 ret->i_mode = mode; 106 ret->i_mode = mode;
107 ret->i_uid = hypfs_info->uid; 107 ret->i_uid = hypfs_info->uid;
108 ret->i_gid = hypfs_info->gid; 108 ret->i_gid = hypfs_info->gid;
109 ret->i_blocks = 0;
110 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 109 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
111 if (mode & S_IFDIR) 110 if (mode & S_IFDIR)
112 ret->i_nlink = 2; 111 ret->i_nlink = 2;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 0a94d9c9cde1..de58c02633b4 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -4,6 +4,17 @@
4 4
5mainmenu "Linux/SPARC Kernel Configuration" 5mainmenu "Linux/SPARC Kernel Configuration"
6 6
7config 64BIT
8 bool "64-bit kernel" if ARCH = "sparc"
9 default ARCH = "sparc64"
10 help
11 SPARC is a family of RISC microprocessors designed and marketed by
12 Sun Microsystems, incorporated. They are very widely found in Sun
13 workstations and clones.
14
15 Say yes to build a 64-bit kernel - formerly known as sparc64
16 Say no to build a 32-bit kernel - formerly known as sparc
17
7config SPARC 18config SPARC
8 bool 19 bool
9 default y 20 default y
@@ -15,22 +26,11 @@ config SPARC
15 select RTC_CLASS 26 select RTC_CLASS
16 select RTC_DRV_M48T59 27 select RTC_DRV_M48T59
17 28
18# Identify this as a Sparc32 build
19config SPARC32 29config SPARC32
20 bool 30 def_bool !64BIT
21 default y if ARCH = "sparc"
22 help
23 SPARC is a family of RISC microprocessors designed and marketed by
24 Sun Microsystems, incorporated. They are very widely found in Sun
25 workstations and clones. This port covers the original 32-bit SPARC;
26 it is old and stable and usually considered one of the "big three"
27 along with the Intel and Alpha ports. The UltraLinux project
28 maintains both the SPARC32 and SPARC64 ports; its web page is
29 available at <http://www.ultralinux.org/>.
30 31
31config SPARC64 32config SPARC64
32 bool 33 def_bool 64BIT
33 default y if ARCH = "sparc64"
34 select ARCH_SUPPORTS_MSI 34 select ARCH_SUPPORTS_MSI
35 select HAVE_FUNCTION_TRACER 35 select HAVE_FUNCTION_TRACER
36 select HAVE_KRETPROBES 36 select HAVE_KRETPROBES
@@ -53,9 +53,6 @@ config BITS
53 default 32 if SPARC32 53 default 32 if SPARC32
54 default 64 if SPARC64 54 default 64 if SPARC64
55 55
56config 64BIT
57 def_bool y if SPARC64
58
59config GENERIC_TIME 56config GENERIC_TIME
60 bool 57 bool
61 default y if SPARC64 58 default y if SPARC64
@@ -188,14 +185,6 @@ config ARCH_MAY_HAVE_PC_FDC
188 bool 185 bool
189 default y 186 default y
190 187
191config ARCH_HAS_ILOG2_U32
192 bool
193 default n
194
195config ARCH_HAS_ILOG2_U64
196 bool
197 default n
198
199config EMULATED_CMPXCHG 188config EMULATED_CMPXCHG
200 bool 189 bool
201 default y if SPARC32 190 default y if SPARC32
@@ -442,26 +431,6 @@ config SERIAL_CONSOLE
442endmenu 431endmenu
443 432
444menu "Bus options (PCI etc.)" 433menu "Bus options (PCI etc.)"
445config ISA
446 bool
447 help
448 ISA is found on Espresso only and is not supported currently.
449
450config ISAPNP
451 bool
452 help
453 ISAPNP is not supported
454
455config EISA
456 bool
457 help
458 EISA is not supported.
459
460config MCA
461 bool
462 help
463 MCA is not supported.
464
465config SBUS 434config SBUS
466 bool 435 bool
467 default y 436 default y
diff --git a/arch/sparc/configs/sparc64_defconfig b/arch/sparc/configs/sparc64_defconfig
index 05d19a3e590f..cde19ae78f5a 100644
--- a/arch/sparc/configs/sparc64_defconfig
+++ b/arch/sparc/configs/sparc64_defconfig
@@ -1,27 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc4 3# Linux kernel version: 2.6.28
4# Mon Nov 10 12:35:09 2008 4# Fri Jan 2 18:14:26 2009
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
8CONFIG_ARCH_DEFCONFIG="arch/sparc/configs/sparc64_defconfig"
9CONFIG_BITS=64
10CONFIG_64BIT=y
8CONFIG_GENERIC_TIME=y 11CONFIG_GENERIC_TIME=y
9CONFIG_GENERIC_CMOS_UPDATE=y 12CONFIG_GENERIC_CMOS_UPDATE=y
10CONFIG_GENERIC_CLOCKEVENTS=y 13CONFIG_GENERIC_CLOCKEVENTS=y
11CONFIG_64BIT=y
12CONFIG_MMU=y
13CONFIG_IOMMU_HELPER=y 14CONFIG_IOMMU_HELPER=y
14CONFIG_QUICKLIST=y 15CONFIG_QUICKLIST=y
15CONFIG_STACKTRACE_SUPPORT=y 16CONFIG_STACKTRACE_SUPPORT=y
16CONFIG_LOCKDEP_SUPPORT=y 17CONFIG_LOCKDEP_SUPPORT=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y 18CONFIG_HAVE_LATENCYTOP_SUPPORT=y
18# CONFIG_ARCH_HAS_ILOG2_U32 is not set
19# CONFIG_ARCH_HAS_ILOG2_U64 is not set
20CONFIG_AUDIT_ARCH=y 19CONFIG_AUDIT_ARCH=y
21CONFIG_HAVE_SETUP_PER_CPU_AREA=y 20CONFIG_HAVE_SETUP_PER_CPU_AREA=y
21CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
22CONFIG_MMU=y
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_OF=y 24CONFIG_OF=y
24CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26 26
27# 27#
@@ -86,6 +86,7 @@ CONFIG_SLUB_DEBUG=y
86CONFIG_SLUB=y 86CONFIG_SLUB=y
87# CONFIG_SLOB is not set 87# CONFIG_SLOB is not set
88CONFIG_PROFILING=y 88CONFIG_PROFILING=y
89CONFIG_TRACEPOINTS=y
89# CONFIG_MARKERS is not set 90# CONFIG_MARKERS is not set
90CONFIG_OPROFILE=m 91CONFIG_OPROFILE=m
91CONFIG_HAVE_OPROFILE=y 92CONFIG_HAVE_OPROFILE=y
@@ -127,34 +128,40 @@ CONFIG_DEFAULT_AS=y
127# CONFIG_DEFAULT_NOOP is not set 128# CONFIG_DEFAULT_NOOP is not set
128CONFIG_DEFAULT_IOSCHED="anticipatory" 129CONFIG_DEFAULT_IOSCHED="anticipatory"
129CONFIG_CLASSIC_RCU=y 130CONFIG_CLASSIC_RCU=y
131# CONFIG_TREE_RCU is not set
132# CONFIG_PREEMPT_RCU is not set
133# CONFIG_TREE_RCU_TRACE is not set
134# CONFIG_PREEMPT_RCU_TRACE is not set
130# CONFIG_FREEZER is not set 135# CONFIG_FREEZER is not set
131 136
132# 137#
133# Processor type and features 138# Processor type and features
134# 139#
135CONFIG_SPARC64_PAGE_SIZE_8KB=y 140CONFIG_SMP=y
136# CONFIG_SPARC64_PAGE_SIZE_64KB is not set 141CONFIG_NR_CPUS=64
137CONFIG_SECCOMP=y
138CONFIG_HZ_100=y 142CONFIG_HZ_100=y
139# CONFIG_HZ_250 is not set 143# CONFIG_HZ_250 is not set
140# CONFIG_HZ_300 is not set 144# CONFIG_HZ_300 is not set
141# CONFIG_HZ_1000 is not set 145# CONFIG_HZ_1000 is not set
142CONFIG_HZ=100 146CONFIG_HZ=100
143CONFIG_SCHED_HRTICK=y 147CONFIG_SCHED_HRTICK=y
148CONFIG_RWSEM_XCHGADD_ALGORITHM=y
149CONFIG_GENERIC_FIND_NEXT_BIT=y
150CONFIG_GENERIC_HWEIGHT=y
151CONFIG_GENERIC_CALIBRATE_DELAY=y
152CONFIG_ARCH_MAY_HAVE_PC_FDC=y
153CONFIG_SPARC64_SMP=y
154CONFIG_SPARC64_PAGE_SIZE_8KB=y
155# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
156CONFIG_SECCOMP=y
144CONFIG_HOTPLUG_CPU=y 157CONFIG_HOTPLUG_CPU=y
145CONFIG_GENERIC_HARDIRQS=y 158CONFIG_GENERIC_HARDIRQS=y
146CONFIG_TICK_ONESHOT=y 159CONFIG_TICK_ONESHOT=y
147CONFIG_NO_HZ=y 160CONFIG_NO_HZ=y
148CONFIG_HIGH_RES_TIMERS=y 161CONFIG_HIGH_RES_TIMERS=y
149CONFIG_GENERIC_CLOCKEVENTS_BUILD=y 162CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
150CONFIG_SMP=y
151CONFIG_NR_CPUS=64
152# CONFIG_CPU_FREQ is not set 163# CONFIG_CPU_FREQ is not set
153CONFIG_US3_MC=y 164CONFIG_US3_MC=y
154CONFIG_RWSEM_XCHGADD_ALGORITHM=y
155CONFIG_GENERIC_FIND_NEXT_BIT=y
156CONFIG_GENERIC_HWEIGHT=y
157CONFIG_GENERIC_CALIBRATE_DELAY=y
158CONFIG_HUGETLB_PAGE_SIZE_4MB=y 165CONFIG_HUGETLB_PAGE_SIZE_4MB=y
159# CONFIG_HUGETLB_PAGE_SIZE_512K is not set 166# CONFIG_HUGETLB_PAGE_SIZE_512K is not set
160# CONFIG_HUGETLB_PAGE_SIZE_64K is not set 167# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
@@ -183,10 +190,18 @@ CONFIG_PHYS_ADDR_T_64BIT=y
183CONFIG_ZONE_DMA_FLAG=0 190CONFIG_ZONE_DMA_FLAG=0
184CONFIG_NR_QUICK=1 191CONFIG_NR_QUICK=1
185CONFIG_UNEVICTABLE_LRU=y 192CONFIG_UNEVICTABLE_LRU=y
193CONFIG_SCHED_SMT=y
194CONFIG_SCHED_MC=y
195# CONFIG_PREEMPT_NONE is not set
196CONFIG_PREEMPT_VOLUNTARY=y
197# CONFIG_PREEMPT is not set
198# CONFIG_CMDLINE_BOOL is not set
199
200#
201# Bus options (PCI etc.)
202#
186CONFIG_SBUS=y 203CONFIG_SBUS=y
187CONFIG_SBUSCHAR=y 204CONFIG_SBUSCHAR=y
188CONFIG_SUN_AUXIO=y
189CONFIG_SUN_IO=y
190CONFIG_SUN_LDOMS=y 205CONFIG_SUN_LDOMS=y
191CONFIG_PCI=y 206CONFIG_PCI=y
192CONFIG_PCI_DOMAINS=y 207CONFIG_PCI_DOMAINS=y
@@ -195,7 +210,9 @@ CONFIG_ARCH_SUPPORTS_MSI=y
195CONFIG_PCI_MSI=y 210CONFIG_PCI_MSI=y
196# CONFIG_PCI_LEGACY is not set 211# CONFIG_PCI_LEGACY is not set
197# CONFIG_PCI_DEBUG is not set 212# CONFIG_PCI_DEBUG is not set
213# CONFIG_PCCARD is not set
198CONFIG_SUN_OPENPROMFS=m 214CONFIG_SUN_OPENPROMFS=m
215CONFIG_SPARC64_PCI=y
199 216
200# 217#
201# Executable file formats 218# Executable file formats
@@ -207,17 +224,13 @@ CONFIG_COMPAT_BINFMT_ELF=y
207CONFIG_BINFMT_MISC=m 224CONFIG_BINFMT_MISC=m
208CONFIG_COMPAT=y 225CONFIG_COMPAT=y
209CONFIG_SYSVIPC_COMPAT=y 226CONFIG_SYSVIPC_COMPAT=y
210CONFIG_SCHED_SMT=y
211CONFIG_SCHED_MC=y
212# CONFIG_PREEMPT_NONE is not set
213CONFIG_PREEMPT_VOLUNTARY=y
214# CONFIG_PREEMPT is not set
215# CONFIG_CMDLINE_BOOL is not set
216CONFIG_NET=y 227CONFIG_NET=y
217 228
218# 229#
219# Networking options 230# Networking options
220# 231#
232# CONFIG_NET_NS is not set
233CONFIG_COMPAT_NET_DEV_OPS=y
221CONFIG_PACKET=y 234CONFIG_PACKET=y
222CONFIG_PACKET_MMAP=y 235CONFIG_PACKET_MMAP=y
223CONFIG_UNIX=y 236CONFIG_UNIX=y
@@ -314,6 +327,7 @@ CONFIG_VLAN_8021Q=m
314# CONFIG_ECONET is not set 327# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set 328# CONFIG_WAN_ROUTER is not set
316# CONFIG_NET_SCHED is not set 329# CONFIG_NET_SCHED is not set
330# CONFIG_DCB is not set
317 331
318# 332#
319# Network testing 333# Network testing
@@ -330,8 +344,8 @@ CONFIG_WIRELESS=y
330# CONFIG_CFG80211 is not set 344# CONFIG_CFG80211 is not set
331CONFIG_WIRELESS_OLD_REGULATORY=y 345CONFIG_WIRELESS_OLD_REGULATORY=y
332# CONFIG_WIRELESS_EXT is not set 346# CONFIG_WIRELESS_EXT is not set
347# CONFIG_LIB80211 is not set
333# CONFIG_MAC80211 is not set 348# CONFIG_MAC80211 is not set
334# CONFIG_IEEE80211 is not set
335# CONFIG_RFKILL is not set 349# CONFIG_RFKILL is not set
336# CONFIG_NET_9P is not set 350# CONFIG_NET_9P is not set
337 351
@@ -378,8 +392,10 @@ CONFIG_MISC_DEVICES=y
378# CONFIG_EEPROM_93CX6 is not set 392# CONFIG_EEPROM_93CX6 is not set
379# CONFIG_SGI_IOC4 is not set 393# CONFIG_SGI_IOC4 is not set
380# CONFIG_TIFM_CORE is not set 394# CONFIG_TIFM_CORE is not set
395# CONFIG_ICS932S401 is not set
381# CONFIG_ENCLOSURE_SERVICES is not set 396# CONFIG_ENCLOSURE_SERVICES is not set
382# CONFIG_HP_ILO is not set 397# CONFIG_HP_ILO is not set
398# CONFIG_C2PORT is not set
383CONFIG_HAVE_IDE=y 399CONFIG_HAVE_IDE=y
384CONFIG_IDE=y 400CONFIG_IDE=y
385 401
@@ -387,6 +403,7 @@ CONFIG_IDE=y
387# Please see Documentation/ide/ide.txt for help/info on IDE drives 403# Please see Documentation/ide/ide.txt for help/info on IDE drives
388# 404#
389CONFIG_IDE_TIMINGS=y 405CONFIG_IDE_TIMINGS=y
406CONFIG_IDE_ATAPI=y
390# CONFIG_BLK_DEV_IDE_SATA is not set 407# CONFIG_BLK_DEV_IDE_SATA is not set
391CONFIG_IDE_GD=y 408CONFIG_IDE_GD=y
392CONFIG_IDE_GD_ATA=y 409CONFIG_IDE_GD_ATA=y
@@ -394,7 +411,6 @@ CONFIG_IDE_GD_ATA=y
394CONFIG_BLK_DEV_IDECD=y 411CONFIG_BLK_DEV_IDECD=y
395CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y 412CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
396# CONFIG_BLK_DEV_IDETAPE is not set 413# CONFIG_BLK_DEV_IDETAPE is not set
397# CONFIG_BLK_DEV_IDESCSI is not set
398# CONFIG_IDE_TASK_IOCTL is not set 414# CONFIG_IDE_TASK_IOCTL is not set
399CONFIG_IDE_PROC_FS=y 415CONFIG_IDE_PROC_FS=y
400 416
@@ -477,6 +493,7 @@ CONFIG_SCSI_FC_ATTRS=y
477# CONFIG_SCSI_SRP_ATTRS is not set 493# CONFIG_SCSI_SRP_ATTRS is not set
478CONFIG_SCSI_LOWLEVEL=y 494CONFIG_SCSI_LOWLEVEL=y
479# CONFIG_ISCSI_TCP is not set 495# CONFIG_ISCSI_TCP is not set
496# CONFIG_SCSI_CXGB3_ISCSI is not set
480# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 497# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
481# CONFIG_SCSI_3W_9XXX is not set 498# CONFIG_SCSI_3W_9XXX is not set
482# CONFIG_SCSI_ACARD is not set 499# CONFIG_SCSI_ACARD is not set
@@ -490,6 +507,8 @@ CONFIG_SCSI_LOWLEVEL=y
490# CONFIG_MEGARAID_LEGACY is not set 507# CONFIG_MEGARAID_LEGACY is not set
491# CONFIG_MEGARAID_SAS is not set 508# CONFIG_MEGARAID_SAS is not set
492# CONFIG_SCSI_HPTIOP is not set 509# CONFIG_SCSI_HPTIOP is not set
510# CONFIG_LIBFC is not set
511# CONFIG_FCOE is not set
493# CONFIG_SCSI_DMX3191D is not set 512# CONFIG_SCSI_DMX3191D is not set
494# CONFIG_SCSI_FUTURE_DOMAIN is not set 513# CONFIG_SCSI_FUTURE_DOMAIN is not set
495# CONFIG_SCSI_IPS is not set 514# CONFIG_SCSI_IPS is not set
@@ -564,6 +583,9 @@ CONFIG_PHYLIB=m
564# CONFIG_BROADCOM_PHY is not set 583# CONFIG_BROADCOM_PHY is not set
565# CONFIG_ICPLUS_PHY is not set 584# CONFIG_ICPLUS_PHY is not set
566# CONFIG_REALTEK_PHY is not set 585# CONFIG_REALTEK_PHY is not set
586# CONFIG_NATIONAL_PHY is not set
587# CONFIG_STE10XP is not set
588# CONFIG_LSI_ET1011C_PHY is not set
567# CONFIG_MDIO_BITBANG is not set 589# CONFIG_MDIO_BITBANG is not set
568CONFIG_NET_ETHERNET=y 590CONFIG_NET_ETHERNET=y
569CONFIG_MII=m 591CONFIG_MII=m
@@ -590,7 +612,6 @@ CONFIG_NET_PCI=y
590# CONFIG_ADAPTEC_STARFIRE is not set 612# CONFIG_ADAPTEC_STARFIRE is not set
591# CONFIG_B44 is not set 613# CONFIG_B44 is not set
592# CONFIG_FORCEDETH is not set 614# CONFIG_FORCEDETH is not set
593# CONFIG_EEPRO100 is not set
594# CONFIG_E100 is not set 615# CONFIG_E100 is not set
595# CONFIG_FEALNX is not set 616# CONFIG_FEALNX is not set
596# CONFIG_NATSEMI is not set 617# CONFIG_NATSEMI is not set
@@ -600,6 +621,7 @@ CONFIG_NET_PCI=y
600# CONFIG_R6040 is not set 621# CONFIG_R6040 is not set
601# CONFIG_SIS900 is not set 622# CONFIG_SIS900 is not set
602# CONFIG_EPIC100 is not set 623# CONFIG_EPIC100 is not set
624# CONFIG_SMSC9420 is not set
603# CONFIG_SUNDANCE is not set 625# CONFIG_SUNDANCE is not set
604# CONFIG_TLAN is not set 626# CONFIG_TLAN is not set
605# CONFIG_VIA_RHINE is not set 627# CONFIG_VIA_RHINE is not set
@@ -629,6 +651,7 @@ CONFIG_BNX2=m
629# CONFIG_JME is not set 651# CONFIG_JME is not set
630CONFIG_NETDEV_10000=y 652CONFIG_NETDEV_10000=y
631# CONFIG_CHELSIO_T1 is not set 653# CONFIG_CHELSIO_T1 is not set
654CONFIG_CHELSIO_T3_DEPENDS=y
632# CONFIG_CHELSIO_T3 is not set 655# CONFIG_CHELSIO_T3 is not set
633# CONFIG_ENIC is not set 656# CONFIG_ENIC is not set
634# CONFIG_IXGBE is not set 657# CONFIG_IXGBE is not set
@@ -778,6 +801,7 @@ CONFIG_SERIAL_CORE=y
778CONFIG_SERIAL_CORE_CONSOLE=y 801CONFIG_SERIAL_CORE_CONSOLE=y
779# CONFIG_SERIAL_JSM is not set 802# CONFIG_SERIAL_JSM is not set
780CONFIG_UNIX98_PTYS=y 803CONFIG_UNIX98_PTYS=y
804# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
781# CONFIG_LEGACY_PTYS is not set 805# CONFIG_LEGACY_PTYS is not set
782# CONFIG_IPMI_HANDLER is not set 806# CONFIG_IPMI_HANDLER is not set
783CONFIG_HW_RANDOM=m 807CONFIG_HW_RANDOM=m
@@ -870,6 +894,7 @@ CONFIG_HWMON=y
870# CONFIG_SENSORS_ADM1029 is not set 894# CONFIG_SENSORS_ADM1029 is not set
871# CONFIG_SENSORS_ADM1031 is not set 895# CONFIG_SENSORS_ADM1031 is not set
872# CONFIG_SENSORS_ADM9240 is not set 896# CONFIG_SENSORS_ADM9240 is not set
897# CONFIG_SENSORS_ADT7462 is not set
873# CONFIG_SENSORS_ADT7470 is not set 898# CONFIG_SENSORS_ADT7470 is not set
874# CONFIG_SENSORS_ADT7473 is not set 899# CONFIG_SENSORS_ADT7473 is not set
875# CONFIG_SENSORS_ATXP1 is not set 900# CONFIG_SENSORS_ATXP1 is not set
@@ -919,11 +944,11 @@ CONFIG_HWMON=y
919# CONFIG_THERMAL is not set 944# CONFIG_THERMAL is not set
920# CONFIG_THERMAL_HWMON is not set 945# CONFIG_THERMAL_HWMON is not set
921# CONFIG_WATCHDOG is not set 946# CONFIG_WATCHDOG is not set
947CONFIG_SSB_POSSIBLE=y
922 948
923# 949#
924# Sonics Silicon Backplane 950# Sonics Silicon Backplane
925# 951#
926CONFIG_SSB_POSSIBLE=y
927# CONFIG_SSB is not set 952# CONFIG_SSB is not set
928 953
929# 954#
@@ -1071,6 +1096,7 @@ CONFIG_SND_MIXER_OSS=m
1071CONFIG_SND_PCM_OSS=m 1096CONFIG_SND_PCM_OSS=m
1072CONFIG_SND_PCM_OSS_PLUGINS=y 1097CONFIG_SND_PCM_OSS_PLUGINS=y
1073CONFIG_SND_SEQUENCER_OSS=y 1098CONFIG_SND_SEQUENCER_OSS=y
1099# CONFIG_SND_HRTIMER is not set
1074# CONFIG_SND_DYNAMIC_MINORS is not set 1100# CONFIG_SND_DYNAMIC_MINORS is not set
1075CONFIG_SND_SUPPORT_OLD_API=y 1101CONFIG_SND_SUPPORT_OLD_API=y
1076CONFIG_SND_VERBOSE_PROCFS=y 1102CONFIG_SND_VERBOSE_PROCFS=y
@@ -1242,11 +1268,11 @@ CONFIG_USB_UHCI_HCD=m
1242# CONFIG_USB_TMC is not set 1268# CONFIG_USB_TMC is not set
1243 1269
1244# 1270#
1245# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 1271# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1246# 1272#
1247 1273
1248# 1274#
1249# may also be needed; see USB_STORAGE Help for more information 1275# see USB_STORAGE Help for more information
1250# 1276#
1251CONFIG_USB_STORAGE=m 1277CONFIG_USB_STORAGE=m
1252# CONFIG_USB_STORAGE_DEBUG is not set 1278# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1337,6 +1363,7 @@ CONFIG_RTC_INTF_DEV=y
1337# CONFIG_RTC_DRV_M41T80 is not set 1363# CONFIG_RTC_DRV_M41T80 is not set
1338# CONFIG_RTC_DRV_S35390A is not set 1364# CONFIG_RTC_DRV_S35390A is not set
1339# CONFIG_RTC_DRV_FM3130 is not set 1365# CONFIG_RTC_DRV_FM3130 is not set
1366# CONFIG_RTC_DRV_RX8581 is not set
1340 1367
1341# 1368#
1342# SPI RTC drivers 1369# SPI RTC drivers
@@ -1365,7 +1392,6 @@ CONFIG_RTC_DRV_STARFIRE=y
1365# CONFIG_DMADEVICES is not set 1392# CONFIG_DMADEVICES is not set
1366# CONFIG_UIO is not set 1393# CONFIG_UIO is not set
1367# CONFIG_STAGING is not set 1394# CONFIG_STAGING is not set
1368CONFIG_STAGING_EXCLUDE_BUILD=y
1369 1395
1370# 1396#
1371# Misc Linux/SPARC drivers 1397# Misc Linux/SPARC drivers
@@ -1544,6 +1570,7 @@ CONFIG_SCHEDSTATS=y
1544# CONFIG_LOCK_STAT is not set 1570# CONFIG_LOCK_STAT is not set
1545# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1571# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1546# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set 1572# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1573CONFIG_STACKTRACE=y
1547# CONFIG_DEBUG_KOBJECT is not set 1574# CONFIG_DEBUG_KOBJECT is not set
1548CONFIG_DEBUG_BUGVERBOSE=y 1575CONFIG_DEBUG_BUGVERBOSE=y
1549# CONFIG_DEBUG_INFO is not set 1576# CONFIG_DEBUG_INFO is not set
@@ -1552,6 +1579,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
1552CONFIG_DEBUG_MEMORY_INIT=y 1579CONFIG_DEBUG_MEMORY_INIT=y
1553# CONFIG_DEBUG_LIST is not set 1580# CONFIG_DEBUG_LIST is not set
1554# CONFIG_DEBUG_SG is not set 1581# CONFIG_DEBUG_SG is not set
1582# CONFIG_DEBUG_NOTIFIERS is not set
1555# CONFIG_BOOT_PRINTK_DELAY is not set 1583# CONFIG_BOOT_PRINTK_DELAY is not set
1556# CONFIG_RCU_TORTURE_TEST is not set 1584# CONFIG_RCU_TORTURE_TEST is not set
1557# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1585# CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -1560,8 +1588,12 @@ CONFIG_DEBUG_MEMORY_INIT=y
1560# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1588# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1561# CONFIG_LKDTM is not set 1589# CONFIG_LKDTM is not set
1562# CONFIG_FAULT_INJECTION is not set 1590# CONFIG_FAULT_INJECTION is not set
1591# CONFIG_LATENCYTOP is not set
1563CONFIG_SYSCTL_SYSCALL_CHECK=y 1592CONFIG_SYSCTL_SYSCALL_CHECK=y
1593CONFIG_NOP_TRACER=y
1564CONFIG_HAVE_FUNCTION_TRACER=y 1594CONFIG_HAVE_FUNCTION_TRACER=y
1595CONFIG_RING_BUFFER=y
1596CONFIG_TRACING=y
1565 1597
1566# 1598#
1567# Tracers 1599# Tracers
@@ -1571,7 +1603,9 @@ CONFIG_HAVE_FUNCTION_TRACER=y
1571# CONFIG_SCHED_TRACER is not set 1603# CONFIG_SCHED_TRACER is not set
1572# CONFIG_CONTEXT_SWITCH_TRACER is not set 1604# CONFIG_CONTEXT_SWITCH_TRACER is not set
1573# CONFIG_BOOT_TRACER is not set 1605# CONFIG_BOOT_TRACER is not set
1606# CONFIG_TRACE_BRANCH_PROFILING is not set
1574# CONFIG_STACK_TRACER is not set 1607# CONFIG_STACK_TRACER is not set
1608# CONFIG_FTRACE_STARTUP_TEST is not set
1575# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 1609# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
1576# CONFIG_SAMPLES is not set 1610# CONFIG_SAMPLES is not set
1577CONFIG_HAVE_ARCH_KGDB=y 1611CONFIG_HAVE_ARCH_KGDB=y
@@ -1600,11 +1634,16 @@ CONFIG_CRYPTO=y
1600# 1634#
1601# CONFIG_CRYPTO_FIPS is not set 1635# CONFIG_CRYPTO_FIPS is not set
1602CONFIG_CRYPTO_ALGAPI=y 1636CONFIG_CRYPTO_ALGAPI=y
1637CONFIG_CRYPTO_ALGAPI2=y
1603CONFIG_CRYPTO_AEAD=y 1638CONFIG_CRYPTO_AEAD=y
1639CONFIG_CRYPTO_AEAD2=y
1604CONFIG_CRYPTO_BLKCIPHER=y 1640CONFIG_CRYPTO_BLKCIPHER=y
1641CONFIG_CRYPTO_BLKCIPHER2=y
1605CONFIG_CRYPTO_HASH=y 1642CONFIG_CRYPTO_HASH=y
1606CONFIG_CRYPTO_RNG=y 1643CONFIG_CRYPTO_HASH2=y
1644CONFIG_CRYPTO_RNG2=y
1607CONFIG_CRYPTO_MANAGER=y 1645CONFIG_CRYPTO_MANAGER=y
1646CONFIG_CRYPTO_MANAGER2=y
1608CONFIG_CRYPTO_GF128MUL=m 1647CONFIG_CRYPTO_GF128MUL=m
1609CONFIG_CRYPTO_NULL=m 1648CONFIG_CRYPTO_NULL=m
1610# CONFIG_CRYPTO_CRYPTD is not set 1649# CONFIG_CRYPTO_CRYPTD is not set
diff --git a/arch/sparc/include/asm/Kbuild b/arch/sparc/include/asm/Kbuild
index 89c260aab45c..deeb0fba8029 100644
--- a/arch/sparc/include/asm/Kbuild
+++ b/arch/sparc/include/asm/Kbuild
@@ -1,21 +1,6 @@
1# User exported sparc header files 1# User exported sparc header files
2include include/asm-generic/Kbuild.asm 2include include/asm-generic/Kbuild.asm
3 3
4header-y += ipcbuf_32.h
5header-y += ipcbuf_64.h
6header-y += posix_types_32.h
7header-y += posix_types_64.h
8header-y += ptrace_32.h
9header-y += ptrace_64.h
10header-y += sigcontext_32.h
11header-y += sigcontext_64.h
12header-y += siginfo_32.h
13header-y += siginfo_64.h
14header-y += signal_32.h
15header-y += signal_64.h
16header-y += stat_32.h
17header-y += stat_64.h
18
19header-y += apc.h 4header-y += apc.h
20header-y += asi.h 5header-y += asi.h
21header-y += display7seg.h 6header-y += display7seg.h
@@ -23,16 +8,11 @@ header-y += envctrl.h
23header-y += fbio.h 8header-y += fbio.h
24header-y += jsflash.h 9header-y += jsflash.h
25header-y += openprom.h 10header-y += openprom.h
26header-y += openprom_32.h
27header-y += openprom_64.h
28header-y += openpromio.h 11header-y += openpromio.h
29header-y += perfctr.h 12header-y += perfctr.h
30header-y += psrcompat.h 13header-y += psrcompat.h
31header-y += psr.h 14header-y += psr.h
32header-y += pstate.h 15header-y += pstate.h
33header-y += reg.h
34header-y += reg_32.h
35header-y += reg_64.h
36header-y += traps.h 16header-y += traps.h
37header-y += uctx.h 17header-y += uctx.h
38header-y += utrap.h 18header-y += utrap.h
diff --git a/arch/sparc/include/asm/byteorder.h b/arch/sparc/include/asm/byteorder.h
index 5a70f137f1f7..738414b26558 100644
--- a/arch/sparc/include/asm/byteorder.h
+++ b/arch/sparc/include/asm/byteorder.h
@@ -1,16 +1,12 @@
1#ifndef _SPARC_BYTEORDER_H 1#ifndef _SPARC_BYTEORDER_H
2#define _SPARC_BYTEORDER_H 2#define _SPARC_BYTEORDER_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5#include <asm/asi.h> 5#include <asm/asi.h>
6 6
7#define __BIG_ENDIAN 7#define __BIG_ENDIAN
8 8
9#ifdef CONFIG_SPARC32 9#if defined(__sparc__) && defined(__arch64__)
10#define __SWAB_64_THRU_32__
11#endif
12
13#ifdef CONFIG_SPARC64
14static inline __u16 __arch_swab16p(const __u16 *addr) 10static inline __u16 __arch_swab16p(const __u16 *addr)
15{ 11{
16 __u16 ret; 12 __u16 ret;
@@ -44,7 +40,9 @@ static inline __u64 __arch_swab64p(const __u64 *addr)
44} 40}
45#define __arch_swab64p __arch_swab64p 41#define __arch_swab64p __arch_swab64p
46 42
47#endif /* CONFIG_SPARC64 */ 43#else
44#define __SWAB_64_THRU_32__
45#endif /* defined(__sparc__) && defined(__arch64__) */
48 46
49#include <linux/byteorder.h> 47#include <linux/byteorder.h>
50 48
diff --git a/arch/sparc/include/asm/ipcbuf.h b/arch/sparc/include/asm/ipcbuf.h
index 17d6ef7b23a4..66013b4fe10d 100644
--- a/arch/sparc/include/asm/ipcbuf.h
+++ b/arch/sparc/include/asm/ipcbuf.h
@@ -1,8 +1,32 @@
1#ifndef ___ASM_SPARC_IPCBUF_H 1#ifndef __SPARC_IPCBUF_H
2#define ___ASM_SPARC_IPCBUF_H 2#define __SPARC_IPCBUF_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/ipcbuf_64.h> 4/*
5#else 5 * The ipc64_perm structure for sparc/sparc64 architecture.
6#include <asm/ipcbuf_32.h> 6 * Note extra padding because this structure is passed back and forth
7#endif 7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - on sparc for 32 bit mode (it is 32 bit on sparc64)
12 * - 2 miscellaneous 64-bit values
13 */
14
15struct ipc64_perm
16{
17 __kernel_key_t key;
18 __kernel_uid_t uid;
19 __kernel_gid_t gid;
20 __kernel_uid_t cuid;
21 __kernel_gid_t cgid;
22#ifndef __arch64__
23 unsigned short __pad0;
8#endif 24#endif
25 __kernel_mode_t mode;
26 unsigned short __pad1;
27 unsigned short seq;
28 unsigned long long __unused1;
29 unsigned long long __unused2;
30};
31
32#endif /* __SPARC_IPCBUF_H */
diff --git a/arch/sparc/include/asm/ipcbuf_32.h b/arch/sparc/include/asm/ipcbuf_32.h
deleted file mode 100644
index 6387209518f2..000000000000
--- a/arch/sparc/include/asm/ipcbuf_32.h
+++ /dev/null
@@ -1,31 +0,0 @@
1#ifndef _SPARC_IPCBUF_H
2#define _SPARC_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for sparc architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit mode
11 * - 32-bit seq
12 * - 2 miscellaneous 64-bit values (so that this structure matches
13 * sparc64 ipc64_perm)
14 */
15
16struct ipc64_perm
17{
18 __kernel_key_t key;
19 __kernel_uid32_t uid;
20 __kernel_gid32_t gid;
21 __kernel_uid32_t cuid;
22 __kernel_gid32_t cgid;
23 unsigned short __pad1;
24 __kernel_mode_t mode;
25 unsigned short __pad2;
26 unsigned short seq;
27 unsigned long long __unused1;
28 unsigned long long __unused2;
29};
30
31#endif /* _SPARC_IPCBUF_H */
diff --git a/arch/sparc/include/asm/ipcbuf_64.h b/arch/sparc/include/asm/ipcbuf_64.h
deleted file mode 100644
index a44b855b98db..000000000000
--- a/arch/sparc/include/asm/ipcbuf_64.h
+++ /dev/null
@@ -1,28 +0,0 @@
1#ifndef _SPARC64_IPCBUF_H
2#define _SPARC64_IPCBUF_H
3
4/*
5 * The ipc64_perm structure for sparc64 architecture.
6 * Note extra padding because this structure is passed back and forth
7 * between kernel and user space.
8 *
9 * Pad space is left for:
10 * - 32-bit seq
11 * - 2 miscellaneous 64-bit values
12 */
13
14struct ipc64_perm
15{
16 __kernel_key_t key;
17 __kernel_uid_t uid;
18 __kernel_gid_t gid;
19 __kernel_uid_t cuid;
20 __kernel_gid_t cgid;
21 __kernel_mode_t mode;
22 unsigned short __pad1;
23 unsigned short seq;
24 unsigned long __unused1;
25 unsigned long __unused2;
26};
27
28#endif /* _SPARC64_IPCBUF_H */
diff --git a/arch/sparc/include/asm/jsflash.h b/arch/sparc/include/asm/jsflash.h
index 3457f29bd73b..0717d9e39d2d 100644
--- a/arch/sparc/include/asm/jsflash.h
+++ b/arch/sparc/include/asm/jsflash.h
@@ -8,7 +8,7 @@
8#define _SPARC_JSFLASH_H 8#define _SPARC_JSFLASH_H
9 9
10#ifndef _SPARC_TYPES_H 10#ifndef _SPARC_TYPES_H
11#include <asm/types.h> 11#include <linux/types.h>
12#endif 12#endif
13 13
14/* 14/*
diff --git a/arch/sparc/include/asm/openprom.h b/arch/sparc/include/asm/openprom.h
index aaeae905ed3f..963e1a45c35f 100644
--- a/arch/sparc/include/asm/openprom.h
+++ b/arch/sparc/include/asm/openprom.h
@@ -1,8 +1,277 @@
1#ifndef ___ASM_SPARC_OPENPROM_H 1#ifndef __SPARC_OPENPROM_H
2#define ___ASM_SPARC_OPENPROM_H 2#define __SPARC_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1995,1996 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10/* Empirical constants... */
11#define LINUX_OPPROM_MAGIC 0x10010407
12
13#ifndef __ASSEMBLY__
14/* V0 prom device operations. */
15struct linux_dev_v0_funcs {
16 int (*v0_devopen)(char *device_str);
17 int (*v0_devclose)(int dev_desc);
18 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
19 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
20 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
21 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
22 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
23 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
24 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
25};
26
27/* V2 and later prom device operations. */
28struct linux_dev_v2_funcs {
29 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
30 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
31 void (*v2_dumb_mem_free)(char *va, unsigned sz);
32
33 /* To map devices into virtual I/O space. */
34 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
35 void (*v2_dumb_munmap)(char *virta, unsigned size);
36
37 int (*v2_dev_open)(char *devpath);
38 void (*v2_dev_close)(int d);
39 int (*v2_dev_read)(int d, char *buf, int nbytes);
40 int (*v2_dev_write)(int d, char *buf, int nbytes);
41 int (*v2_dev_seek)(int d, int hi, int lo);
42
43 /* Never issued (multistage load support) */
44 void (*v2_wheee2)(void);
45 void (*v2_wheee3)(void);
46};
47
48struct linux_mlist_v0 {
49 struct linux_mlist_v0 *theres_more;
50 unsigned int start_adr;
51 unsigned num_bytes;
52};
53
54struct linux_mem_v0 {
55 struct linux_mlist_v0 **v0_totphys;
56 struct linux_mlist_v0 **v0_prommap;
57 struct linux_mlist_v0 **v0_available; /* What we can use */
58};
59
60/* Arguments sent to the kernel from the boot prompt. */
61struct linux_arguments_v0 {
62 char *argv[8];
63 char args[100];
64 char boot_dev[2];
65 int boot_dev_ctrl;
66 int boot_dev_unit;
67 int dev_partition;
68 char *kernel_file_name;
69 void *aieee1; /* XXX */
70};
71
72/* V2 and up boot things. */
73struct linux_bootargs_v2 {
74 char **bootpath;
75 char **bootargs;
76 int *fd_stdin;
77 int *fd_stdout;
78};
79
80/* The top level PROM vector. */
81struct linux_romvec {
82 /* Version numbers. */
83 unsigned int pv_magic_cookie;
84 unsigned int pv_romvers;
85 unsigned int pv_plugin_revision;
86 unsigned int pv_printrev;
87
88 /* Version 0 memory descriptors. */
89 struct linux_mem_v0 pv_v0mem;
90
91 /* Node operations. */
92 struct linux_nodeops *pv_nodeops;
93
94 char **pv_bootstr;
95 struct linux_dev_v0_funcs pv_v0devops;
96
97 char *pv_stdin;
98 char *pv_stdout;
99#define PROMDEV_KBD 0 /* input from keyboard */
100#define PROMDEV_SCREEN 0 /* output to screen */
101#define PROMDEV_TTYA 1 /* in/out to ttya */
102#define PROMDEV_TTYB 2 /* in/out to ttyb */
103
104 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
105 int (*pv_getchar)(void);
106 void (*pv_putchar)(int ch);
107
108 /* Non-blocking variants. */
109 int (*pv_nbgetchar)(void);
110 int (*pv_nbputchar)(int ch);
111
112 void (*pv_putstr)(char *str, int len);
113
114 /* Miscellany. */
115 void (*pv_reboot)(char *bootstr);
116 void (*pv_printf)(__const__ char *fmt, ...);
117 void (*pv_abort)(void);
118 __volatile__ int *pv_ticks;
119 void (*pv_halt)(void);
120 void (**pv_synchook)(void);
121
122 /* Evaluate a forth string, not different proto for V0 and V2->up. */
123 union {
124 void (*v0_eval)(int len, char *str);
125 void (*v2_eval)(char *str);
126 } pv_fortheval;
127
128 struct linux_arguments_v0 **pv_v0bootargs;
129
130 /* Get ether address. */
131 unsigned int (*pv_enaddr)(int d, char *enaddr);
132
133 struct linux_bootargs_v2 pv_v2bootargs;
134 struct linux_dev_v2_funcs pv_v2devops;
135
136 int filler[15];
137
138 /* This one is sun4c/sun4 only. */
139 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
140
141 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
142 * No joke. Calling these when there is only one cpu probably
143 * crashes the machine, have to test this. :-)
144 */
145
146 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
147 * 'thiscontext' executing at address 'prog_counter'
148 */
149 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
150 int thiscontext, char *prog_counter);
151
152 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
153 * until a resume cpu call is made.
154 */
155 int (*v3_cpustop)(unsigned int whichcpu);
156
157 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
158 * resume cpu call is made.
159 */
160 int (*v3_cpuidle)(unsigned int whichcpu);
161
162 /* v3_cpuresume() will resume processor 'whichcpu' executing
163 * starting with whatever 'pc' and 'npc' were left at the
164 * last 'idle' or 'stop' call.
165 */
166 int (*v3_cpuresume)(unsigned int whichcpu);
167};
168
169/* Routines for traversing the prom device tree. */
170struct linux_nodeops {
171 int (*no_nextnode)(int node);
172 int (*no_child)(int node);
173 int (*no_proplen)(int node, const char *name);
174 int (*no_getprop)(int node, const char *name, char *val);
175 int (*no_setprop)(int node, const char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name);
177};
178
179/* More fun PROM structures for device probing. */
3#if defined(__sparc__) && defined(__arch64__) 180#if defined(__sparc__) && defined(__arch64__)
4#include <asm/openprom_64.h> 181#define PROMREG_MAX 24
182#define PROMVADDR_MAX 16
183#define PROMINTR_MAX 32
5#else 184#else
6#include <asm/openprom_32.h> 185#define PROMREG_MAX 16
186#define PROMVADDR_MAX 16
187#define PROMINTR_MAX 15
7#endif 188#endif
189
190struct linux_prom_registers {
191 unsigned int which_io; /* hi part of physical address */
192 unsigned int phys_addr; /* The physical address of this register */
193 unsigned int reg_size; /* How many bytes does this register take up? */
194};
195
196struct linux_prom64_registers {
197 unsigned long phys_addr;
198 unsigned long reg_size;
199};
200
201struct linux_prom_irqs {
202 int pri; /* IRQ priority */
203 int vector; /* This is foobar, what does it do? */
204};
205
206/* Element of the "ranges" vector */
207struct linux_prom_ranges {
208 unsigned int ot_child_space;
209 unsigned int ot_child_base; /* Bus feels this */
210 unsigned int ot_parent_space;
211 unsigned int ot_parent_base; /* CPU looks from here */
212 unsigned int or_size;
213};
214
215/*
216 * Ranges and reg properties are a bit different for PCI.
217 */
218#if defined(__sparc__) && defined(__arch64__)
219struct linux_prom_pci_registers {
220 unsigned int phys_hi;
221 unsigned int phys_mid;
222 unsigned int phys_lo;
223
224 unsigned int size_hi;
225 unsigned int size_lo;
226};
227#else
228struct linux_prom_pci_registers {
229 /*
230 * We don't know what information this field contain.
231 * We guess, PCI device function is in bits 15:8
232 * So, ...
233 */
234 unsigned int which_io; /* Let it be which_io */
235
236 unsigned int phys_hi;
237 unsigned int phys_lo;
238
239 unsigned int size_hi;
240 unsigned int size_lo;
241};
242
8#endif 243#endif
244
245struct linux_prom_pci_ranges {
246 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
247 unsigned int child_phys_mid;
248 unsigned int child_phys_lo;
249
250 unsigned int parent_phys_hi;
251 unsigned int parent_phys_lo;
252
253 unsigned int size_hi;
254 unsigned int size_lo;
255};
256
257struct linux_prom_pci_intmap {
258 unsigned int phys_hi;
259 unsigned int phys_mid;
260 unsigned int phys_lo;
261
262 unsigned int interrupt;
263
264 int cnode;
265 unsigned int cinterrupt;
266};
267
268struct linux_prom_pci_intmask {
269 unsigned int phys_hi;
270 unsigned int phys_mid;
271 unsigned int phys_lo;
272 unsigned int interrupt;
273};
274
275#endif /* !(__ASSEMBLY__) */
276
277#endif /* !(__SPARC_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/openprom_32.h b/arch/sparc/include/asm/openprom_32.h
deleted file mode 100644
index 875da3552d80..000000000000
--- a/arch/sparc/include/asm/openprom_32.h
+++ /dev/null
@@ -1,255 +0,0 @@
1#ifndef __SPARC_OPENPROM_H
2#define __SPARC_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10/* Empirical constants... */
11#define LINUX_OPPROM_MAGIC 0x10010407
12
13#ifndef __ASSEMBLY__
14/* V0 prom device operations. */
15struct linux_dev_v0_funcs {
16 int (*v0_devopen)(char *device_str);
17 int (*v0_devclose)(int dev_desc);
18 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
19 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
20 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
21 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
22 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
23 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
24 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
25};
26
27/* V2 and later prom device operations. */
28struct linux_dev_v2_funcs {
29 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
30 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
31 void (*v2_dumb_mem_free)(char *va, unsigned sz);
32
33 /* To map devices into virtual I/O space. */
34 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
35 void (*v2_dumb_munmap)(char *virta, unsigned size);
36
37 int (*v2_dev_open)(char *devpath);
38 void (*v2_dev_close)(int d);
39 int (*v2_dev_read)(int d, char *buf, int nbytes);
40 int (*v2_dev_write)(int d, char *buf, int nbytes);
41 int (*v2_dev_seek)(int d, int hi, int lo);
42
43 /* Never issued (multistage load support) */
44 void (*v2_wheee2)(void);
45 void (*v2_wheee3)(void);
46};
47
48struct linux_mlist_v0 {
49 struct linux_mlist_v0 *theres_more;
50 char *start_adr;
51 unsigned num_bytes;
52};
53
54struct linux_mem_v0 {
55 struct linux_mlist_v0 **v0_totphys;
56 struct linux_mlist_v0 **v0_prommap;
57 struct linux_mlist_v0 **v0_available; /* What we can use */
58};
59
60/* Arguments sent to the kernel from the boot prompt. */
61struct linux_arguments_v0 {
62 char *argv[8];
63 char args[100];
64 char boot_dev[2];
65 int boot_dev_ctrl;
66 int boot_dev_unit;
67 int dev_partition;
68 char *kernel_file_name;
69 void *aieee1; /* XXX */
70};
71
72/* V2 and up boot things. */
73struct linux_bootargs_v2 {
74 char **bootpath;
75 char **bootargs;
76 int *fd_stdin;
77 int *fd_stdout;
78};
79
80/* The top level PROM vector. */
81struct linux_romvec {
82 /* Version numbers. */
83 unsigned int pv_magic_cookie;
84 unsigned int pv_romvers;
85 unsigned int pv_plugin_revision;
86 unsigned int pv_printrev;
87
88 /* Version 0 memory descriptors. */
89 struct linux_mem_v0 pv_v0mem;
90
91 /* Node operations. */
92 struct linux_nodeops *pv_nodeops;
93
94 char **pv_bootstr;
95 struct linux_dev_v0_funcs pv_v0devops;
96
97 char *pv_stdin;
98 char *pv_stdout;
99#define PROMDEV_KBD 0 /* input from keyboard */
100#define PROMDEV_SCREEN 0 /* output to screen */
101#define PROMDEV_TTYA 1 /* in/out to ttya */
102#define PROMDEV_TTYB 2 /* in/out to ttyb */
103
104 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
105 int (*pv_getchar)(void);
106 void (*pv_putchar)(int ch);
107
108 /* Non-blocking variants. */
109 int (*pv_nbgetchar)(void);
110 int (*pv_nbputchar)(int ch);
111
112 void (*pv_putstr)(char *str, int len);
113
114 /* Miscellany. */
115 void (*pv_reboot)(char *bootstr);
116 void (*pv_printf)(__const__ char *fmt, ...);
117 void (*pv_abort)(void);
118 __volatile__ int *pv_ticks;
119 void (*pv_halt)(void);
120 void (**pv_synchook)(void);
121
122 /* Evaluate a forth string, not different proto for V0 and V2->up. */
123 union {
124 void (*v0_eval)(int len, char *str);
125 void (*v2_eval)(char *str);
126 } pv_fortheval;
127
128 struct linux_arguments_v0 **pv_v0bootargs;
129
130 /* Get ether address. */
131 unsigned int (*pv_enaddr)(int d, char *enaddr);
132
133 struct linux_bootargs_v2 pv_v2bootargs;
134 struct linux_dev_v2_funcs pv_v2devops;
135
136 int filler[15];
137
138 /* This one is sun4c/sun4 only. */
139 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
140
141 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
142 * No joke. Calling these when there is only one cpu probably
143 * crashes the machine, have to test this. :-)
144 */
145
146 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
147 * 'thiscontext' executing at address 'prog_counter'
148 */
149 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
150 int thiscontext, char *prog_counter);
151
152 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
153 * until a resume cpu call is made.
154 */
155 int (*v3_cpustop)(unsigned int whichcpu);
156
157 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
158 * resume cpu call is made.
159 */
160 int (*v3_cpuidle)(unsigned int whichcpu);
161
162 /* v3_cpuresume() will resume processor 'whichcpu' executing
163 * starting with whatever 'pc' and 'npc' were left at the
164 * last 'idle' or 'stop' call.
165 */
166 int (*v3_cpuresume)(unsigned int whichcpu);
167};
168
169/* Routines for traversing the prom device tree. */
170struct linux_nodeops {
171 int (*no_nextnode)(int node);
172 int (*no_child)(int node);
173 int (*no_proplen)(int node, const char *name);
174 int (*no_getprop)(int node, const char *name, char *val);
175 int (*no_setprop)(int node, const char *name, char *val, int len);
176 char * (*no_nextprop)(int node, char *name);
177};
178
179/* More fun PROM structures for device probing. */
180#define PROMREG_MAX 16
181#define PROMVADDR_MAX 16
182#define PROMINTR_MAX 15
183
184struct linux_prom_registers {
185 unsigned int which_io; /* is this in OBIO space? */
186 unsigned int phys_addr; /* The physical address of this register */
187 unsigned int reg_size; /* How many bytes does this register take up? */
188};
189
190struct linux_prom_irqs {
191 int pri; /* IRQ priority */
192 int vector; /* This is foobar, what does it do? */
193};
194
195/* Element of the "ranges" vector */
196struct linux_prom_ranges {
197 unsigned int ot_child_space;
198 unsigned int ot_child_base; /* Bus feels this */
199 unsigned int ot_parent_space;
200 unsigned int ot_parent_base; /* CPU looks from here */
201 unsigned int or_size;
202};
203
204/* Ranges and reg properties are a bit different for PCI. */
205struct linux_prom_pci_registers {
206 /*
207 * We don't know what information this field contain.
208 * We guess, PCI device function is in bits 15:8
209 * So, ...
210 */
211 unsigned int which_io; /* Let it be which_io */
212
213 unsigned int phys_hi;
214 unsigned int phys_lo;
215
216 unsigned int size_hi;
217 unsigned int size_lo;
218};
219
220struct linux_prom_pci_ranges {
221 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
222 unsigned int child_phys_mid;
223 unsigned int child_phys_lo;
224
225 unsigned int parent_phys_hi;
226 unsigned int parent_phys_lo;
227
228 unsigned int size_hi;
229 unsigned int size_lo;
230};
231
232struct linux_prom_pci_assigned_addresses {
233 unsigned int which_io;
234
235 unsigned int phys_hi;
236 unsigned int phys_lo;
237
238 unsigned int size_hi;
239 unsigned int size_lo;
240};
241
242struct linux_prom_ebus_ranges {
243 unsigned int child_phys_hi;
244 unsigned int child_phys_lo;
245
246 unsigned int parent_phys_hi;
247 unsigned int parent_phys_mid;
248 unsigned int parent_phys_lo;
249
250 unsigned int size;
251};
252
253#endif /* !(__ASSEMBLY__) */
254
255#endif /* !(__SPARC_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/openprom_64.h b/arch/sparc/include/asm/openprom_64.h
deleted file mode 100644
index b69e4a8c9170..000000000000
--- a/arch/sparc/include/asm/openprom_64.h
+++ /dev/null
@@ -1,280 +0,0 @@
1#ifndef __SPARC64_OPENPROM_H
2#define __SPARC64_OPENPROM_H
3
4/* openprom.h: Prom structures and defines for access to the OPENBOOT
5 * prom routines and data areas.
6 *
7 * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
8 */
9
10#ifndef __ASSEMBLY__
11/* V0 prom device operations. */
12struct linux_dev_v0_funcs {
13 int (*v0_devopen)(char *device_str);
14 int (*v0_devclose)(int dev_desc);
15 int (*v0_rdblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
16 int (*v0_wrblkdev)(int dev_desc, int num_blks, int blk_st, char *buf);
17 int (*v0_wrnetdev)(int dev_desc, int num_bytes, char *buf);
18 int (*v0_rdnetdev)(int dev_desc, int num_bytes, char *buf);
19 int (*v0_rdchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
20 int (*v0_wrchardev)(int dev_desc, int num_bytes, int dummy, char *buf);
21 int (*v0_seekdev)(int dev_desc, long logical_offst, int from);
22};
23
24/* V2 and later prom device operations. */
25struct linux_dev_v2_funcs {
26 int (*v2_inst2pkg)(int d); /* Convert ihandle to phandle */
27 char * (*v2_dumb_mem_alloc)(char *va, unsigned sz);
28 void (*v2_dumb_mem_free)(char *va, unsigned sz);
29
30 /* To map devices into virtual I/O space. */
31 char * (*v2_dumb_mmap)(char *virta, int which_io, unsigned paddr, unsigned sz);
32 void (*v2_dumb_munmap)(char *virta, unsigned size);
33
34 int (*v2_dev_open)(char *devpath);
35 void (*v2_dev_close)(int d);
36 int (*v2_dev_read)(int d, char *buf, int nbytes);
37 int (*v2_dev_write)(int d, char *buf, int nbytes);
38 int (*v2_dev_seek)(int d, int hi, int lo);
39
40 /* Never issued (multistage load support) */
41 void (*v2_wheee2)(void);
42 void (*v2_wheee3)(void);
43};
44
45struct linux_mlist_v0 {
46 struct linux_mlist_v0 *theres_more;
47 unsigned start_adr;
48 unsigned num_bytes;
49};
50
51struct linux_mem_v0 {
52 struct linux_mlist_v0 **v0_totphys;
53 struct linux_mlist_v0 **v0_prommap;
54 struct linux_mlist_v0 **v0_available; /* What we can use */
55};
56
57/* Arguments sent to the kernel from the boot prompt. */
58struct linux_arguments_v0 {
59 char *argv[8];
60 char args[100];
61 char boot_dev[2];
62 int boot_dev_ctrl;
63 int boot_dev_unit;
64 int dev_partition;
65 char *kernel_file_name;
66 void *aieee1; /* XXX */
67};
68
69/* V2 and up boot things. */
70struct linux_bootargs_v2 {
71 char **bootpath;
72 char **bootargs;
73 int *fd_stdin;
74 int *fd_stdout;
75};
76
77/* The top level PROM vector. */
78struct linux_romvec {
79 /* Version numbers. */
80 unsigned int pv_magic_cookie;
81 unsigned int pv_romvers;
82 unsigned int pv_plugin_revision;
83 unsigned int pv_printrev;
84
85 /* Version 0 memory descriptors. */
86 struct linux_mem_v0 pv_v0mem;
87
88 /* Node operations. */
89 struct linux_nodeops *pv_nodeops;
90
91 char **pv_bootstr;
92 struct linux_dev_v0_funcs pv_v0devops;
93
94 char *pv_stdin;
95 char *pv_stdout;
96#define PROMDEV_KBD 0 /* input from keyboard */
97#define PROMDEV_SCREEN 0 /* output to screen */
98#define PROMDEV_TTYA 1 /* in/out to ttya */
99#define PROMDEV_TTYB 2 /* in/out to ttyb */
100
101 /* Blocking getchar/putchar. NOT REENTRANT! (grr) */
102 int (*pv_getchar)(void);
103 void (*pv_putchar)(int ch);
104
105 /* Non-blocking variants. */
106 int (*pv_nbgetchar)(void);
107 int (*pv_nbputchar)(int ch);
108
109 void (*pv_putstr)(char *str, int len);
110
111 /* Miscellany. */
112 void (*pv_reboot)(char *bootstr);
113 void (*pv_printf)(__const__ char *fmt, ...);
114 void (*pv_abort)(void);
115 __volatile__ int *pv_ticks;
116 void (*pv_halt)(void);
117 void (**pv_synchook)(void);
118
119 /* Evaluate a forth string, not different proto for V0 and V2->up. */
120 union {
121 void (*v0_eval)(int len, char *str);
122 void (*v2_eval)(char *str);
123 } pv_fortheval;
124
125 struct linux_arguments_v0 **pv_v0bootargs;
126
127 /* Get ether address. */
128 unsigned int (*pv_enaddr)(int d, char *enaddr);
129
130 struct linux_bootargs_v2 pv_v2bootargs;
131 struct linux_dev_v2_funcs pv_v2devops;
132
133 int filler[15];
134
135 /* This one is sun4c/sun4 only. */
136 void (*pv_setctxt)(int ctxt, char *va, int pmeg);
137
138 /* Prom version 3 Multiprocessor routines. This stuff is crazy.
139 * No joke. Calling these when there is only one cpu probably
140 * crashes the machine, have to test this. :-)
141 */
142
143 /* v3_cpustart() will start the cpu 'whichcpu' in mmu-context
144 * 'thiscontext' executing at address 'prog_counter'
145 */
146 int (*v3_cpustart)(unsigned int whichcpu, int ctxtbl_ptr,
147 int thiscontext, char *prog_counter);
148
149 /* v3_cpustop() will cause cpu 'whichcpu' to stop executing
150 * until a resume cpu call is made.
151 */
152 int (*v3_cpustop)(unsigned int whichcpu);
153
154 /* v3_cpuidle() will idle cpu 'whichcpu' until a stop or
155 * resume cpu call is made.
156 */
157 int (*v3_cpuidle)(unsigned int whichcpu);
158
159 /* v3_cpuresume() will resume processor 'whichcpu' executing
160 * starting with whatever 'pc' and 'npc' were left at the
161 * last 'idle' or 'stop' call.
162 */
163 int (*v3_cpuresume)(unsigned int whichcpu);
164};
165
166/* Routines for traversing the prom device tree. */
167struct linux_nodeops {
168 int (*no_nextnode)(int node);
169 int (*no_child)(int node);
170 int (*no_proplen)(int node, char *name);
171 int (*no_getprop)(int node, char *name, char *val);
172 int (*no_setprop)(int node, char *name, char *val, int len);
173 char * (*no_nextprop)(int node, char *name);
174};
175
176/* More fun PROM structures for device probing. */
177#define PROMREG_MAX 24
178#define PROMVADDR_MAX 16
179#define PROMINTR_MAX 32
180
181struct linux_prom_registers {
182 unsigned which_io; /* hi part of physical address */
183 unsigned phys_addr; /* The physical address of this register */
184 int reg_size; /* How many bytes does this register take up? */
185};
186
187struct linux_prom64_registers {
188 unsigned long phys_addr;
189 unsigned long reg_size;
190};
191
192struct linux_prom_irqs {
193 int pri; /* IRQ priority */
194 int vector; /* This is foobar, what does it do? */
195};
196
197/* Element of the "ranges" vector */
198struct linux_prom_ranges {
199 unsigned int ot_child_space;
200 unsigned int ot_child_base; /* Bus feels this */
201 unsigned int ot_parent_space;
202 unsigned int ot_parent_base; /* CPU looks from here */
203 unsigned int or_size;
204};
205
206struct linux_prom64_ranges {
207 unsigned long ot_child_base; /* Bus feels this */
208 unsigned long ot_parent_base; /* CPU looks from here */
209 unsigned long or_size;
210};
211
212/* Ranges and reg properties are a bit different for PCI. */
213struct linux_prom_pci_registers {
214 unsigned int phys_hi;
215 unsigned int phys_mid;
216 unsigned int phys_lo;
217
218 unsigned int size_hi;
219 unsigned int size_lo;
220};
221
222struct linux_prom_pci_ranges {
223 unsigned int child_phys_hi; /* Only certain bits are encoded here. */
224 unsigned int child_phys_mid;
225 unsigned int child_phys_lo;
226
227 unsigned int parent_phys_hi;
228 unsigned int parent_phys_lo;
229
230 unsigned int size_hi;
231 unsigned int size_lo;
232};
233
234struct linux_prom_pci_intmap {
235 unsigned int phys_hi;
236 unsigned int phys_mid;
237 unsigned int phys_lo;
238
239 unsigned int interrupt;
240
241 int cnode;
242 unsigned int cinterrupt;
243};
244
245struct linux_prom_pci_intmask {
246 unsigned int phys_hi;
247 unsigned int phys_mid;
248 unsigned int phys_lo;
249 unsigned int interrupt;
250};
251
252struct linux_prom_ebus_ranges {
253 unsigned int child_phys_hi;
254 unsigned int child_phys_lo;
255
256 unsigned int parent_phys_hi;
257 unsigned int parent_phys_mid;
258 unsigned int parent_phys_lo;
259
260 unsigned int size;
261};
262
263struct linux_prom_ebus_intmap {
264 unsigned int phys_hi;
265 unsigned int phys_lo;
266
267 unsigned int interrupt;
268
269 int cnode;
270 unsigned int cinterrupt;
271};
272
273struct linux_prom_ebus_intmask {
274 unsigned int phys_hi;
275 unsigned int phys_lo;
276 unsigned int interrupt;
277};
278#endif /* !(__ASSEMBLY__) */
279
280#endif /* !(__SPARC64_OPENPROM_H) */
diff --git a/arch/sparc/include/asm/posix_types.h b/arch/sparc/include/asm/posix_types.h
index 03a0e091a884..98d6ebb922fb 100644
--- a/arch/sparc/include/asm/posix_types.h
+++ b/arch/sparc/include/asm/posix_types.h
@@ -1,8 +1,155 @@
1#ifndef ___ASM_SPARC_POSIX_TYPES_H 1/*
2#define ___ASM_SPARC_POSIX_TYPES_H 2 * This file is generally used by user-level software, so you need to
3 * be a little careful about namespace pollution etc. Also, we cannot
4 * assume GCC is being used.
5 */
6
7#ifndef __SPARC_POSIX_TYPES_H
8#define __SPARC_POSIX_TYPES_H
9
3#if defined(__sparc__) && defined(__arch64__) 10#if defined(__sparc__) && defined(__arch64__)
4#include <asm/posix_types_64.h> 11/* sparc 64 bit */
12typedef unsigned long __kernel_size_t;
13typedef long __kernel_ssize_t;
14typedef long __kernel_ptrdiff_t;
15typedef long __kernel_time_t;
16typedef long __kernel_clock_t;
17typedef int __kernel_pid_t;
18typedef int __kernel_ipc_pid_t;
19typedef unsigned int __kernel_uid_t;
20typedef unsigned int __kernel_gid_t;
21typedef unsigned long __kernel_ino_t;
22typedef unsigned int __kernel_mode_t;
23typedef unsigned short __kernel_umode_t;
24typedef unsigned int __kernel_nlink_t;
25typedef int __kernel_daddr_t;
26typedef long __kernel_off_t;
27typedef char * __kernel_caddr_t;
28typedef unsigned short __kernel_uid16_t;
29typedef unsigned short __kernel_gid16_t;
30typedef int __kernel_clockid_t;
31typedef int __kernel_timer_t;
32
33typedef unsigned short __kernel_old_uid_t;
34typedef unsigned short __kernel_old_gid_t;
35typedef __kernel_uid_t __kernel_uid32_t;
36typedef __kernel_gid_t __kernel_gid32_t;
37
38typedef unsigned int __kernel_old_dev_t;
39
40/* Note this piece of asymmetry from the v9 ABI. */
41typedef int __kernel_suseconds_t;
42
5#else 43#else
6#include <asm/posix_types_32.h> 44/* sparc 32 bit */
7#endif 45
46typedef unsigned int __kernel_size_t;
47typedef int __kernel_ssize_t;
48typedef long int __kernel_ptrdiff_t;
49typedef long __kernel_time_t;
50typedef long __kernel_suseconds_t;
51typedef long __kernel_clock_t;
52typedef int __kernel_pid_t;
53typedef unsigned short __kernel_ipc_pid_t;
54typedef unsigned short __kernel_uid_t;
55typedef unsigned short __kernel_gid_t;
56typedef unsigned long __kernel_ino_t;
57typedef unsigned short __kernel_mode_t;
58typedef unsigned short __kernel_umode_t;
59typedef short __kernel_nlink_t;
60typedef long __kernel_daddr_t;
61typedef long __kernel_off_t;
62typedef char * __kernel_caddr_t;
63typedef unsigned short __kernel_uid16_t;
64typedef unsigned short __kernel_gid16_t;
65typedef unsigned int __kernel_uid32_t;
66typedef unsigned int __kernel_gid32_t;
67typedef unsigned short __kernel_old_uid_t;
68typedef unsigned short __kernel_old_gid_t;
69typedef unsigned short __kernel_old_dev_t;
70typedef int __kernel_clockid_t;
71typedef int __kernel_timer_t;
72
73#endif /* defined(__sparc__) && defined(__arch64__) */
74
75#ifdef __GNUC__
76typedef long long __kernel_loff_t;
8#endif 77#endif
78
79typedef struct {
80 int val[2];
81} __kernel_fsid_t;
82
83#ifdef __KERNEL__
84
85#undef __FD_SET
86static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
87{
88 unsigned long _tmp = fd / __NFDBITS;
89 unsigned long _rem = fd % __NFDBITS;
90 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
91}
92
93#undef __FD_CLR
94static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
95{
96 unsigned long _tmp = fd / __NFDBITS;
97 unsigned long _rem = fd % __NFDBITS;
98 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
99}
100
101#undef __FD_ISSET
102static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
103{
104 unsigned long _tmp = fd / __NFDBITS;
105 unsigned long _rem = fd % __NFDBITS;
106 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
107}
108
109/*
110 * This will unroll the loop for the normal constant cases (8 or 32 longs,
111 * for 256 and 1024-bit fd_sets respectively)
112 */
113#undef __FD_ZERO
114static inline void __FD_ZERO(__kernel_fd_set *p)
115{
116 unsigned long *tmp = p->fds_bits;
117 int i;
118
119 if (__builtin_constant_p(__FDSET_LONGS)) {
120 switch (__FDSET_LONGS) {
121 case 32:
122 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
123 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
124 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
125 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
126 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
127 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
128 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
129 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
130 return;
131 case 16:
132 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
133 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
134 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
135 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
136 return;
137 case 8:
138 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
139 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
140 return;
141 case 4:
142 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
143 return;
144 }
145 }
146 i = __FDSET_LONGS;
147 while (i) {
148 i--;
149 *tmp = 0;
150 tmp++;
151 }
152}
153
154#endif /* __KERNEL__ */
155#endif /* __SPARC_POSIX_TYPES_H */
diff --git a/arch/sparc/include/asm/posix_types_32.h b/arch/sparc/include/asm/posix_types_32.h
deleted file mode 100644
index 6bb6eb1ca0f2..000000000000
--- a/arch/sparc/include/asm/posix_types_32.h
+++ /dev/null
@@ -1,118 +0,0 @@
1#ifndef __ARCH_SPARC_POSIX_TYPES_H
2#define __ARCH_SPARC_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned int __kernel_size_t;
11typedef int __kernel_ssize_t;
12typedef long int __kernel_ptrdiff_t;
13typedef long __kernel_time_t;
14typedef long __kernel_suseconds_t;
15typedef long __kernel_clock_t;
16typedef int __kernel_pid_t;
17typedef unsigned short __kernel_ipc_pid_t;
18typedef unsigned short __kernel_uid_t;
19typedef unsigned short __kernel_gid_t;
20typedef unsigned long __kernel_ino_t;
21typedef unsigned short __kernel_mode_t;
22typedef unsigned short __kernel_umode_t;
23typedef short __kernel_nlink_t;
24typedef long __kernel_daddr_t;
25typedef long __kernel_off_t;
26typedef char * __kernel_caddr_t;
27typedef unsigned short __kernel_uid16_t;
28typedef unsigned short __kernel_gid16_t;
29typedef unsigned int __kernel_uid32_t;
30typedef unsigned int __kernel_gid32_t;
31typedef unsigned short __kernel_old_uid_t;
32typedef unsigned short __kernel_old_gid_t;
33typedef unsigned short __kernel_old_dev_t;
34typedef int __kernel_clockid_t;
35typedef int __kernel_timer_t;
36
37#ifdef __GNUC__
38typedef long long __kernel_loff_t;
39#endif
40
41typedef struct {
42 int val[2];
43} __kernel_fsid_t;
44
45#if defined(__KERNEL__)
46
47#undef __FD_SET
48static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
49{
50 unsigned long _tmp = fd / __NFDBITS;
51 unsigned long _rem = fd % __NFDBITS;
52 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
53}
54
55#undef __FD_CLR
56static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
57{
58 unsigned long _tmp = fd / __NFDBITS;
59 unsigned long _rem = fd % __NFDBITS;
60 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
61}
62
63#undef __FD_ISSET
64static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
65{
66 unsigned long _tmp = fd / __NFDBITS;
67 unsigned long _rem = fd % __NFDBITS;
68 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
69}
70
71/*
72 * This will unroll the loop for the normal constant cases (8 or 32 longs,
73 * for 256 and 1024-bit fd_sets respectively)
74 */
75#undef __FD_ZERO
76static inline void __FD_ZERO(__kernel_fd_set *p)
77{
78 unsigned long *tmp = p->fds_bits;
79 int i;
80
81 if (__builtin_constant_p(__FDSET_LONGS)) {
82 switch (__FDSET_LONGS) {
83 case 32:
84 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
85 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
86 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
87 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
88 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
89 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
90 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
91 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
92 return;
93 case 16:
94 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
95 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
96 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
97 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
98 return;
99 case 8:
100 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
101 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
102 return;
103 case 4:
104 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
105 return;
106 }
107 }
108 i = __FDSET_LONGS;
109 while (i) {
110 i--;
111 *tmp = 0;
112 tmp++;
113 }
114}
115
116#endif /* defined(__KERNEL__) */
117
118#endif /* !(__ARCH_SPARC_POSIX_TYPES_H) */
diff --git a/arch/sparc/include/asm/posix_types_64.h b/arch/sparc/include/asm/posix_types_64.h
deleted file mode 100644
index ba8f93295763..000000000000
--- a/arch/sparc/include/asm/posix_types_64.h
+++ /dev/null
@@ -1,122 +0,0 @@
1#ifndef __ARCH_SPARC64_POSIX_TYPES_H
2#define __ARCH_SPARC64_POSIX_TYPES_H
3
4/*
5 * This file is generally used by user-level software, so you need to
6 * be a little careful about namespace pollution etc. Also, we cannot
7 * assume GCC is being used.
8 */
9
10typedef unsigned long __kernel_size_t;
11typedef long __kernel_ssize_t;
12typedef long __kernel_ptrdiff_t;
13typedef long __kernel_time_t;
14typedef long __kernel_clock_t;
15typedef int __kernel_pid_t;
16typedef int __kernel_ipc_pid_t;
17typedef unsigned int __kernel_uid_t;
18typedef unsigned int __kernel_gid_t;
19typedef unsigned long __kernel_ino_t;
20typedef unsigned int __kernel_mode_t;
21typedef unsigned short __kernel_umode_t;
22typedef unsigned int __kernel_nlink_t;
23typedef int __kernel_daddr_t;
24typedef long __kernel_off_t;
25typedef char * __kernel_caddr_t;
26typedef unsigned short __kernel_uid16_t;
27typedef unsigned short __kernel_gid16_t;
28typedef int __kernel_clockid_t;
29typedef int __kernel_timer_t;
30
31typedef unsigned short __kernel_old_uid_t;
32typedef unsigned short __kernel_old_gid_t;
33typedef __kernel_uid_t __kernel_uid32_t;
34typedef __kernel_gid_t __kernel_gid32_t;
35
36typedef unsigned int __kernel_old_dev_t;
37
38/* Note this piece of asymmetry from the v9 ABI. */
39typedef int __kernel_suseconds_t;
40
41#ifdef __GNUC__
42typedef long long __kernel_loff_t;
43#endif
44
45typedef struct {
46 int val[2];
47} __kernel_fsid_t;
48
49#if defined(__KERNEL__)
50
51#undef __FD_SET
52static inline void __FD_SET(unsigned long fd, __kernel_fd_set *fdsetp)
53{
54 unsigned long _tmp = fd / __NFDBITS;
55 unsigned long _rem = fd % __NFDBITS;
56 fdsetp->fds_bits[_tmp] |= (1UL<<_rem);
57}
58
59#undef __FD_CLR
60static inline void __FD_CLR(unsigned long fd, __kernel_fd_set *fdsetp)
61{
62 unsigned long _tmp = fd / __NFDBITS;
63 unsigned long _rem = fd % __NFDBITS;
64 fdsetp->fds_bits[_tmp] &= ~(1UL<<_rem);
65}
66
67#undef __FD_ISSET
68static inline int __FD_ISSET(unsigned long fd, __const__ __kernel_fd_set *p)
69{
70 unsigned long _tmp = fd / __NFDBITS;
71 unsigned long _rem = fd % __NFDBITS;
72 return (p->fds_bits[_tmp] & (1UL<<_rem)) != 0;
73}
74
75/*
76 * This will unroll the loop for the normal constant cases (8 or 32 longs,
77 * for 256 and 1024-bit fd_sets respectively)
78 */
79#undef __FD_ZERO
80static inline void __FD_ZERO(__kernel_fd_set *p)
81{
82 unsigned long *tmp = p->fds_bits;
83 int i;
84
85 if (__builtin_constant_p(__FDSET_LONGS)) {
86 switch (__FDSET_LONGS) {
87 case 32:
88 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
89 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
90 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
91 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
92 tmp[16] = 0; tmp[17] = 0; tmp[18] = 0; tmp[19] = 0;
93 tmp[20] = 0; tmp[21] = 0; tmp[22] = 0; tmp[23] = 0;
94 tmp[24] = 0; tmp[25] = 0; tmp[26] = 0; tmp[27] = 0;
95 tmp[28] = 0; tmp[29] = 0; tmp[30] = 0; tmp[31] = 0;
96 return;
97 case 16:
98 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
99 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
100 tmp[ 8] = 0; tmp[ 9] = 0; tmp[10] = 0; tmp[11] = 0;
101 tmp[12] = 0; tmp[13] = 0; tmp[14] = 0; tmp[15] = 0;
102 return;
103 case 8:
104 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
105 tmp[ 4] = 0; tmp[ 5] = 0; tmp[ 6] = 0; tmp[ 7] = 0;
106 return;
107 case 4:
108 tmp[ 0] = 0; tmp[ 1] = 0; tmp[ 2] = 0; tmp[ 3] = 0;
109 return;
110 }
111 }
112 i = __FDSET_LONGS;
113 while (i) {
114 i--;
115 *tmp = 0;
116 tmp++;
117 }
118}
119
120#endif /* defined(__KERNEL__) */
121
122#endif /* !(__ARCH_SPARC64_POSIX_TYPES_H) */
diff --git a/arch/sparc/include/asm/processor_32.h b/arch/sparc/include/asm/processor_32.h
index 2ae67a2e7f3a..09521c6a5edb 100644
--- a/arch/sparc/include/asm/processor_32.h
+++ b/arch/sparc/include/asm/processor_32.h
@@ -99,7 +99,7 @@ static inline void start_thread(struct pt_regs * regs, unsigned long pc,
99 "st\t%%g0, [%0 + %3 + 0x3c]" 99 "st\t%%g0, [%0 + %3 + 0x3c]"
100 : /* no outputs */ 100 : /* no outputs */
101 : "r" (regs), 101 : "r" (regs),
102 "r" (sp - sizeof(struct reg_window)), 102 "r" (sp - sizeof(struct reg_window32)),
103 "r" (zero), 103 "r" (zero),
104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0])) 104 "i" ((const unsigned long)(&((struct pt_regs *)0)->u_regs[0]))
105 : "memory"); 105 : "memory");
diff --git a/arch/sparc/include/asm/ptrace.h b/arch/sparc/include/asm/ptrace.h
index 6dcbe2eed2e2..30b0b797dc0c 100644
--- a/arch/sparc/include/asm/ptrace.h
+++ b/arch/sparc/include/asm/ptrace.h
@@ -1,8 +1,448 @@
1#ifndef ___ASM_SPARC_PTRACE_H 1#ifndef __SPARC_PTRACE_H
2#define ___ASM_SPARC_PTRACE_H 2#define __SPARC_PTRACE_H
3
3#if defined(__sparc__) && defined(__arch64__) 4#if defined(__sparc__) && defined(__arch64__)
4#include <asm/ptrace_64.h> 5/* 64 bit sparc */
6#include <asm/pstate.h>
7
8/* This struct defines the way the registers are stored on the
9 * stack during a system call and basically all traps.
10 */
11
12/* This magic value must have the low 9 bits clear,
13 * as that is where we encode the %tt value, see below.
14 */
15#define PT_REGS_MAGIC 0x57ac6c00
16
17#ifndef __ASSEMBLY__
18
19#include <linux/types.h>
20
21struct pt_regs {
22 unsigned long u_regs[16]; /* globals and ins */
23 unsigned long tstate;
24 unsigned long tpc;
25 unsigned long tnpc;
26 unsigned int y;
27
28 /* We encode a magic number, PT_REGS_MAGIC, along
29 * with the %tt (trap type) register value at trap
30 * entry time. The magic number allows us to identify
31 * accurately a trap stack frame in the stack
32 * unwinder, and the %tt value allows us to test
33 * things like "in a system call" etc. for an arbitray
34 * process.
35 *
36 * The PT_REGS_MAGIC is choosen such that it can be
37 * loaded completely using just a sethi instruction.
38 */
39 unsigned int magic;
40};
41
42struct pt_regs32 {
43 unsigned int psr;
44 unsigned int pc;
45 unsigned int npc;
46 unsigned int y;
47 unsigned int u_regs[16]; /* globals and ins */
48};
49
50/* A V9 register window */
51struct reg_window {
52 unsigned long locals[8];
53 unsigned long ins[8];
54};
55
56/* A 32-bit register window. */
57struct reg_window32 {
58 unsigned int locals[8];
59 unsigned int ins[8];
60};
61
62/* A V9 Sparc stack frame */
63struct sparc_stackf {
64 unsigned long locals[8];
65 unsigned long ins[6];
66 struct sparc_stackf *fp;
67 unsigned long callers_pc;
68 char *structptr;
69 unsigned long xargs[6];
70 unsigned long xxargs[1];
71};
72
73/* A 32-bit Sparc stack frame */
74struct sparc_stackf32 {
75 unsigned int locals[8];
76 unsigned int ins[6];
77 unsigned int fp;
78 unsigned int callers_pc;
79 unsigned int structptr;
80 unsigned int xargs[6];
81 unsigned int xxargs[1];
82};
83
84struct sparc_trapf {
85 unsigned long locals[8];
86 unsigned long ins[8];
87 unsigned long _unused;
88 struct pt_regs *regs;
89};
90#endif /* (!__ASSEMBLY__) */
5#else 91#else
6#include <asm/ptrace_32.h> 92/* 32 bit sparc */
93
94#include <asm/psr.h>
95
96/* This struct defines the way the registers are stored on the
97 * stack during a system call and basically all traps.
98 */
99#ifndef __ASSEMBLY__
100
101struct pt_regs {
102 unsigned long psr;
103 unsigned long pc;
104 unsigned long npc;
105 unsigned long y;
106 unsigned long u_regs[16]; /* globals and ins */
107};
108
109/* A 32-bit register window. */
110struct reg_window32 {
111 unsigned long locals[8];
112 unsigned long ins[8];
113};
114
115/* A Sparc stack frame */
116struct sparc_stackf {
117 unsigned long locals[8];
118 unsigned long ins[6];
119 struct sparc_stackf *fp;
120 unsigned long callers_pc;
121 char *structptr;
122 unsigned long xargs[6];
123 unsigned long xxargs[1];
124};
125#endif /* (!__ASSEMBLY__) */
126
127#endif /* (defined(__sparc__) && defined(__arch64__))*/
128
129#ifndef __ASSEMBLY__
130
131#define TRACEREG_SZ sizeof(struct pt_regs)
132#define STACKFRAME_SZ sizeof(struct sparc_stackf)
133
134#define TRACEREG32_SZ sizeof(struct pt_regs32)
135#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
136
137#endif /* (!__ASSEMBLY__) */
138
139#define UREG_G0 0
140#define UREG_G1 1
141#define UREG_G2 2
142#define UREG_G3 3
143#define UREG_G4 4
144#define UREG_G5 5
145#define UREG_G6 6
146#define UREG_G7 7
147#define UREG_I0 8
148#define UREG_I1 9
149#define UREG_I2 10
150#define UREG_I3 11
151#define UREG_I4 12
152#define UREG_I5 13
153#define UREG_I6 14
154#define UREG_I7 15
155#define UREG_FP UREG_I6
156#define UREG_RETPC UREG_I7
157
158#if defined(__sparc__) && defined(__arch64__)
159/* 64 bit sparc */
160
161#ifndef __ASSEMBLY__
162
163#ifdef __KERNEL__
164
165#include <linux/threads.h>
166#include <asm/system.h>
167
168static inline int pt_regs_trap_type(struct pt_regs *regs)
169{
170 return regs->magic & 0x1ff;
171}
172
173static inline bool pt_regs_is_syscall(struct pt_regs *regs)
174{
175 return (regs->tstate & TSTATE_SYSCALL);
176}
177
178static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
179{
180 return (regs->tstate &= ~TSTATE_SYSCALL);
181}
182
183#define arch_ptrace_stop_needed(exit_code, info) \
184({ flush_user_windows(); \
185 get_thread_wsaved() != 0; \
186})
187
188#define arch_ptrace_stop(exit_code, info) \
189 synchronize_user_stack()
190
191struct global_reg_snapshot {
192 unsigned long tstate;
193 unsigned long tpc;
194 unsigned long tnpc;
195 unsigned long o7;
196 unsigned long i7;
197 unsigned long rpc;
198 struct thread_info *thread;
199 unsigned long pad1;
200};
201extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
202
203#define force_successful_syscall_return() \
204do { current_thread_info()->syscall_noerror = 1; \
205} while (0)
206#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
207#define instruction_pointer(regs) ((regs)->tpc)
208#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
209#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
210#ifdef CONFIG_SMP
211extern unsigned long profile_pc(struct pt_regs *);
212#else
213#define profile_pc(regs) instruction_pointer(regs)
7#endif 214#endif
215extern void show_regs(struct pt_regs *);
216#endif /* (__KERNEL__) */
217
218#else /* __ASSEMBLY__ */
219/* For assembly code. */
220#define TRACEREG_SZ 0xa0
221#define STACKFRAME_SZ 0xc0
222
223#define TRACEREG32_SZ 0x50
224#define STACKFRAME32_SZ 0x60
225#endif /* __ASSEMBLY__ */
226
227#else /* (defined(__sparc__) && defined(__arch64__)) */
228
229/* 32 bit sparc */
230
231#ifndef __ASSEMBLY__
232
233#ifdef __KERNEL__
234
235#include <asm/system.h>
236
237static inline bool pt_regs_is_syscall(struct pt_regs *regs)
238{
239 return (regs->psr & PSR_SYSCALL);
240}
241
242static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
243{
244 return (regs->psr &= ~PSR_SYSCALL);
245}
246
247#define arch_ptrace_stop_needed(exit_code, info) \
248({ flush_user_windows(); \
249 current_thread_info()->w_saved != 0; \
250})
251
252#define arch_ptrace_stop(exit_code, info) \
253 synchronize_user_stack()
254
255#define user_mode(regs) (!((regs)->psr & PSR_PS))
256#define instruction_pointer(regs) ((regs)->pc)
257#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
258unsigned long profile_pc(struct pt_regs *);
259extern void show_regs(struct pt_regs *);
260#endif /* (__KERNEL__) */
261
262#else /* (!__ASSEMBLY__) */
263/* For assembly code. */
264#define TRACEREG_SZ 0x50
265#define STACKFRAME_SZ 0x60
266#endif /* (!__ASSEMBLY__) */
267
268#endif /* (defined(__sparc__) && defined(__arch64__)) */
269
270#ifdef __KERNEL__
271#define STACK_BIAS 2047
8#endif 272#endif
273
274/* These are for pt_regs. */
275#define PT_V9_G0 0x00
276#define PT_V9_G1 0x08
277#define PT_V9_G2 0x10
278#define PT_V9_G3 0x18
279#define PT_V9_G4 0x20
280#define PT_V9_G5 0x28
281#define PT_V9_G6 0x30
282#define PT_V9_G7 0x38
283#define PT_V9_I0 0x40
284#define PT_V9_I1 0x48
285#define PT_V9_I2 0x50
286#define PT_V9_I3 0x58
287#define PT_V9_I4 0x60
288#define PT_V9_I5 0x68
289#define PT_V9_I6 0x70
290#define PT_V9_FP PT_V9_I6
291#define PT_V9_I7 0x78
292#define PT_V9_TSTATE 0x80
293#define PT_V9_TPC 0x88
294#define PT_V9_TNPC 0x90
295#define PT_V9_Y 0x98
296#define PT_V9_MAGIC 0x9c
297#define PT_TSTATE PT_V9_TSTATE
298#define PT_TPC PT_V9_TPC
299#define PT_TNPC PT_V9_TNPC
300
301/* These for pt_regs32. */
302#define PT_PSR 0x0
303#define PT_PC 0x4
304#define PT_NPC 0x8
305#define PT_Y 0xc
306#define PT_G0 0x10
307#define PT_WIM PT_G0
308#define PT_G1 0x14
309#define PT_G2 0x18
310#define PT_G3 0x1c
311#define PT_G4 0x20
312#define PT_G5 0x24
313#define PT_G6 0x28
314#define PT_G7 0x2c
315#define PT_I0 0x30
316#define PT_I1 0x34
317#define PT_I2 0x38
318#define PT_I3 0x3c
319#define PT_I4 0x40
320#define PT_I5 0x44
321#define PT_I6 0x48
322#define PT_FP PT_I6
323#define PT_I7 0x4c
324
325/* Reg_window offsets */
326#define RW_V9_L0 0x00
327#define RW_V9_L1 0x08
328#define RW_V9_L2 0x10
329#define RW_V9_L3 0x18
330#define RW_V9_L4 0x20
331#define RW_V9_L5 0x28
332#define RW_V9_L6 0x30
333#define RW_V9_L7 0x38
334#define RW_V9_I0 0x40
335#define RW_V9_I1 0x48
336#define RW_V9_I2 0x50
337#define RW_V9_I3 0x58
338#define RW_V9_I4 0x60
339#define RW_V9_I5 0x68
340#define RW_V9_I6 0x70
341#define RW_V9_I7 0x78
342
343#define RW_L0 0x00
344#define RW_L1 0x04
345#define RW_L2 0x08
346#define RW_L3 0x0c
347#define RW_L4 0x10
348#define RW_L5 0x14
349#define RW_L6 0x18
350#define RW_L7 0x1c
351#define RW_I0 0x20
352#define RW_I1 0x24
353#define RW_I2 0x28
354#define RW_I3 0x2c
355#define RW_I4 0x30
356#define RW_I5 0x34
357#define RW_I6 0x38
358#define RW_I7 0x3c
359
360/* Stack_frame offsets */
361#define SF_V9_L0 0x00
362#define SF_V9_L1 0x08
363#define SF_V9_L2 0x10
364#define SF_V9_L3 0x18
365#define SF_V9_L4 0x20
366#define SF_V9_L5 0x28
367#define SF_V9_L6 0x30
368#define SF_V9_L7 0x38
369#define SF_V9_I0 0x40
370#define SF_V9_I1 0x48
371#define SF_V9_I2 0x50
372#define SF_V9_I3 0x58
373#define SF_V9_I4 0x60
374#define SF_V9_I5 0x68
375#define SF_V9_FP 0x70
376#define SF_V9_PC 0x78
377#define SF_V9_RETP 0x80
378#define SF_V9_XARG0 0x88
379#define SF_V9_XARG1 0x90
380#define SF_V9_XARG2 0x98
381#define SF_V9_XARG3 0xa0
382#define SF_V9_XARG4 0xa8
383#define SF_V9_XARG5 0xb0
384#define SF_V9_XXARG 0xb8
385
386#define SF_L0 0x00
387#define SF_L1 0x04
388#define SF_L2 0x08
389#define SF_L3 0x0c
390#define SF_L4 0x10
391#define SF_L5 0x14
392#define SF_L6 0x18
393#define SF_L7 0x1c
394#define SF_I0 0x20
395#define SF_I1 0x24
396#define SF_I2 0x28
397#define SF_I3 0x2c
398#define SF_I4 0x30
399#define SF_I5 0x34
400#define SF_FP 0x38
401#define SF_PC 0x3c
402#define SF_RETP 0x40
403#define SF_XARG0 0x44
404#define SF_XARG1 0x48
405#define SF_XARG2 0x4c
406#define SF_XARG3 0x50
407#define SF_XARG4 0x54
408#define SF_XARG5 0x58
409#define SF_XXARG 0x5c
410
411#ifdef __KERNEL__
412
413/* global_reg_snapshot offsets */
414#define GR_SNAP_TSTATE 0x00
415#define GR_SNAP_TPC 0x08
416#define GR_SNAP_TNPC 0x10
417#define GR_SNAP_O7 0x18
418#define GR_SNAP_I7 0x20
419#define GR_SNAP_RPC 0x28
420#define GR_SNAP_THREAD 0x30
421#define GR_SNAP_PAD1 0x38
422
423#endif /* __KERNEL__ */
424
425/* Stuff for the ptrace system call */
426#define PTRACE_SPARC_DETACH 11
427#define PTRACE_GETREGS 12
428#define PTRACE_SETREGS 13
429#define PTRACE_GETFPREGS 14
430#define PTRACE_SETFPREGS 15
431#define PTRACE_READDATA 16
432#define PTRACE_WRITEDATA 17
433#define PTRACE_READTEXT 18
434#define PTRACE_WRITETEXT 19
435#define PTRACE_GETFPAREGS 20
436#define PTRACE_SETFPAREGS 21
437
438/* There are for debugging 64-bit processes, either from a 32 or 64 bit
439 * parent. Thus their complements are for debugging 32-bit processes only.
440 */
441
442#define PTRACE_GETREGS64 22
443#define PTRACE_SETREGS64 23
444/* PTRACE_SYSCALL is 24 */
445#define PTRACE_GETFPREGS64 25
446#define PTRACE_SETFPREGS64 26
447
448#endif /* !(__SPARC_PTRACE_H) */
diff --git a/arch/sparc/include/asm/ptrace_32.h b/arch/sparc/include/asm/ptrace_32.h
deleted file mode 100644
index 4cef450167dd..000000000000
--- a/arch/sparc/include/asm/ptrace_32.h
+++ /dev/null
@@ -1,186 +0,0 @@
1#ifndef _SPARC_PTRACE_H
2#define _SPARC_PTRACE_H
3
4#include <asm/psr.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10#ifndef __ASSEMBLY__
11
12#include <linux/types.h>
13
14struct pt_regs {
15 unsigned long psr;
16 unsigned long pc;
17 unsigned long npc;
18 unsigned long y;
19 unsigned long u_regs[16]; /* globals and ins */
20};
21
22#define UREG_G0 0
23#define UREG_G1 1
24#define UREG_G2 2
25#define UREG_G3 3
26#define UREG_G4 4
27#define UREG_G5 5
28#define UREG_G6 6
29#define UREG_G7 7
30#define UREG_I0 8
31#define UREG_I1 9
32#define UREG_I2 10
33#define UREG_I3 11
34#define UREG_I4 12
35#define UREG_I5 13
36#define UREG_I6 14
37#define UREG_I7 15
38#define UREG_WIM UREG_G0
39#define UREG_FADDR UREG_G0
40#define UREG_FP UREG_I6
41#define UREG_RETPC UREG_I7
42
43/* A register window */
44struct reg_window {
45 unsigned long locals[8];
46 unsigned long ins[8];
47};
48
49/* A Sparc stack frame */
50struct sparc_stackf {
51 unsigned long locals[8];
52 unsigned long ins[6];
53 struct sparc_stackf *fp;
54 unsigned long callers_pc;
55 char *structptr;
56 unsigned long xargs[6];
57 unsigned long xxargs[1];
58};
59
60#define TRACEREG_SZ sizeof(struct pt_regs)
61#define STACKFRAME_SZ sizeof(struct sparc_stackf)
62
63#ifdef __KERNEL__
64
65#include <asm/system.h>
66
67static inline bool pt_regs_is_syscall(struct pt_regs *regs)
68{
69 return (regs->psr & PSR_SYSCALL);
70}
71
72static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
73{
74 return (regs->psr &= ~PSR_SYSCALL);
75}
76
77#define arch_ptrace_stop_needed(exit_code, info) \
78({ flush_user_windows(); \
79 current_thread_info()->w_saved != 0; \
80})
81
82#define arch_ptrace_stop(exit_code, info) \
83 synchronize_user_stack()
84
85#define user_mode(regs) (!((regs)->psr & PSR_PS))
86#define instruction_pointer(regs) ((regs)->pc)
87#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
88unsigned long profile_pc(struct pt_regs *);
89extern void show_regs(struct pt_regs *);
90#endif
91
92#else /* __ASSEMBLY__ */
93/* For assembly code. */
94#define TRACEREG_SZ 0x50
95#define STACKFRAME_SZ 0x60
96#endif
97
98/*
99 * The asm-offsets.h is a generated file, so we cannot include it.
100 * It may be OK for glibc headers, but it's utterly pointless for C code.
101 * The assembly code using those offsets has to include it explicitly.
102 */
103/* #include <asm/asm-offsets.h> */
104
105/* These are for pt_regs. */
106#define PT_PSR 0x0
107#define PT_PC 0x4
108#define PT_NPC 0x8
109#define PT_Y 0xc
110#define PT_G0 0x10
111#define PT_WIM PT_G0
112#define PT_G1 0x14
113#define PT_G2 0x18
114#define PT_G3 0x1c
115#define PT_G4 0x20
116#define PT_G5 0x24
117#define PT_G6 0x28
118#define PT_G7 0x2c
119#define PT_I0 0x30
120#define PT_I1 0x34
121#define PT_I2 0x38
122#define PT_I3 0x3c
123#define PT_I4 0x40
124#define PT_I5 0x44
125#define PT_I6 0x48
126#define PT_FP PT_I6
127#define PT_I7 0x4c
128
129/* Reg_window offsets */
130#define RW_L0 0x00
131#define RW_L1 0x04
132#define RW_L2 0x08
133#define RW_L3 0x0c
134#define RW_L4 0x10
135#define RW_L5 0x14
136#define RW_L6 0x18
137#define RW_L7 0x1c
138#define RW_I0 0x20
139#define RW_I1 0x24
140#define RW_I2 0x28
141#define RW_I3 0x2c
142#define RW_I4 0x30
143#define RW_I5 0x34
144#define RW_I6 0x38
145#define RW_I7 0x3c
146
147/* Stack_frame offsets */
148#define SF_L0 0x00
149#define SF_L1 0x04
150#define SF_L2 0x08
151#define SF_L3 0x0c
152#define SF_L4 0x10
153#define SF_L5 0x14
154#define SF_L6 0x18
155#define SF_L7 0x1c
156#define SF_I0 0x20
157#define SF_I1 0x24
158#define SF_I2 0x28
159#define SF_I3 0x2c
160#define SF_I4 0x30
161#define SF_I5 0x34
162#define SF_FP 0x38
163#define SF_PC 0x3c
164#define SF_RETP 0x40
165#define SF_XARG0 0x44
166#define SF_XARG1 0x48
167#define SF_XARG2 0x4c
168#define SF_XARG3 0x50
169#define SF_XARG4 0x54
170#define SF_XARG5 0x58
171#define SF_XXARG 0x5c
172
173/* Stuff for the ptrace system call */
174#define PTRACE_SPARC_DETACH 11
175#define PTRACE_GETREGS 12
176#define PTRACE_SETREGS 13
177#define PTRACE_GETFPREGS 14
178#define PTRACE_SETFPREGS 15
179#define PTRACE_READDATA 16
180#define PTRACE_WRITEDATA 17
181#define PTRACE_READTEXT 18
182#define PTRACE_WRITETEXT 19
183#define PTRACE_GETFPAREGS 20
184#define PTRACE_SETFPAREGS 21
185
186#endif /* !(_SPARC_PTRACE_H) */
diff --git a/arch/sparc/include/asm/ptrace_64.h b/arch/sparc/include/asm/ptrace_64.h
deleted file mode 100644
index cd6fbfc20435..000000000000
--- a/arch/sparc/include/asm/ptrace_64.h
+++ /dev/null
@@ -1,356 +0,0 @@
1#ifndef _SPARC64_PTRACE_H
2#define _SPARC64_PTRACE_H
3
4#include <asm/pstate.h>
5
6/* This struct defines the way the registers are stored on the
7 * stack during a system call and basically all traps.
8 */
9
10/* This magic value must have the low 9 bits clear,
11 * as that is where we encode the %tt value, see below.
12 */
13#define PT_REGS_MAGIC 0x57ac6c00
14
15#ifndef __ASSEMBLY__
16
17#include <linux/types.h>
18
19struct pt_regs {
20 unsigned long u_regs[16]; /* globals and ins */
21 unsigned long tstate;
22 unsigned long tpc;
23 unsigned long tnpc;
24 unsigned int y;
25
26 /* We encode a magic number, PT_REGS_MAGIC, along
27 * with the %tt (trap type) register value at trap
28 * entry time. The magic number allows us to identify
29 * accurately a trap stack frame in the stack
30 * unwinder, and the %tt value allows us to test
31 * things like "in a system call" etc. for an arbitray
32 * process.
33 *
34 * The PT_REGS_MAGIC is choosen such that it can be
35 * loaded completely using just a sethi instruction.
36 */
37 unsigned int magic;
38};
39
40struct pt_regs32 {
41 unsigned int psr;
42 unsigned int pc;
43 unsigned int npc;
44 unsigned int y;
45 unsigned int u_regs[16]; /* globals and ins */
46};
47
48#define UREG_G0 0
49#define UREG_G1 1
50#define UREG_G2 2
51#define UREG_G3 3
52#define UREG_G4 4
53#define UREG_G5 5
54#define UREG_G6 6
55#define UREG_G7 7
56#define UREG_I0 8
57#define UREG_I1 9
58#define UREG_I2 10
59#define UREG_I3 11
60#define UREG_I4 12
61#define UREG_I5 13
62#define UREG_I6 14
63#define UREG_I7 15
64#define UREG_FP UREG_I6
65#define UREG_RETPC UREG_I7
66
67/* A V9 register window */
68struct reg_window {
69 unsigned long locals[8];
70 unsigned long ins[8];
71};
72
73/* A 32-bit register window. */
74struct reg_window32 {
75 unsigned int locals[8];
76 unsigned int ins[8];
77};
78
79/* A V9 Sparc stack frame */
80struct sparc_stackf {
81 unsigned long locals[8];
82 unsigned long ins[6];
83 struct sparc_stackf *fp;
84 unsigned long callers_pc;
85 char *structptr;
86 unsigned long xargs[6];
87 unsigned long xxargs[1];
88};
89
90/* A 32-bit Sparc stack frame */
91struct sparc_stackf32 {
92 unsigned int locals[8];
93 unsigned int ins[6];
94 unsigned int fp;
95 unsigned int callers_pc;
96 unsigned int structptr;
97 unsigned int xargs[6];
98 unsigned int xxargs[1];
99};
100
101struct sparc_trapf {
102 unsigned long locals[8];
103 unsigned long ins[8];
104 unsigned long _unused;
105 struct pt_regs *regs;
106};
107
108#define TRACEREG_SZ sizeof(struct pt_regs)
109#define STACKFRAME_SZ sizeof(struct sparc_stackf)
110
111#define TRACEREG32_SZ sizeof(struct pt_regs32)
112#define STACKFRAME32_SZ sizeof(struct sparc_stackf32)
113
114#ifdef __KERNEL__
115
116#include <linux/threads.h>
117#include <asm/system.h>
118
119static inline int pt_regs_trap_type(struct pt_regs *regs)
120{
121 return regs->magic & 0x1ff;
122}
123
124static inline bool pt_regs_is_syscall(struct pt_regs *regs)
125{
126 return (regs->tstate & TSTATE_SYSCALL);
127}
128
129static inline bool pt_regs_clear_syscall(struct pt_regs *regs)
130{
131 return (regs->tstate &= ~TSTATE_SYSCALL);
132}
133
134#define arch_ptrace_stop_needed(exit_code, info) \
135({ flush_user_windows(); \
136 get_thread_wsaved() != 0; \
137})
138
139#define arch_ptrace_stop(exit_code, info) \
140 synchronize_user_stack()
141
142struct global_reg_snapshot {
143 unsigned long tstate;
144 unsigned long tpc;
145 unsigned long tnpc;
146 unsigned long o7;
147 unsigned long i7;
148 unsigned long rpc;
149 struct thread_info *thread;
150 unsigned long pad1;
151};
152extern struct global_reg_snapshot global_reg_snapshot[NR_CPUS];
153
154#define force_successful_syscall_return() \
155do { current_thread_info()->syscall_noerror = 1; \
156} while (0)
157#define user_mode(regs) (!((regs)->tstate & TSTATE_PRIV))
158#define instruction_pointer(regs) ((regs)->tpc)
159#define user_stack_pointer(regs) ((regs)->u_regs[UREG_FP])
160#define regs_return_value(regs) ((regs)->u_regs[UREG_I0])
161#ifdef CONFIG_SMP
162extern unsigned long profile_pc(struct pt_regs *);
163#else
164#define profile_pc(regs) instruction_pointer(regs)
165#endif
166extern void show_regs(struct pt_regs *);
167#endif
168
169#else /* __ASSEMBLY__ */
170/* For assembly code. */
171#define TRACEREG_SZ 0xa0
172#define STACKFRAME_SZ 0xc0
173
174#define TRACEREG32_SZ 0x50
175#define STACKFRAME32_SZ 0x60
176#endif
177
178#ifdef __KERNEL__
179#define STACK_BIAS 2047
180#endif
181
182/* These are for pt_regs. */
183#define PT_V9_G0 0x00
184#define PT_V9_G1 0x08
185#define PT_V9_G2 0x10
186#define PT_V9_G3 0x18
187#define PT_V9_G4 0x20
188#define PT_V9_G5 0x28
189#define PT_V9_G6 0x30
190#define PT_V9_G7 0x38
191#define PT_V9_I0 0x40
192#define PT_V9_I1 0x48
193#define PT_V9_I2 0x50
194#define PT_V9_I3 0x58
195#define PT_V9_I4 0x60
196#define PT_V9_I5 0x68
197#define PT_V9_I6 0x70
198#define PT_V9_FP PT_V9_I6
199#define PT_V9_I7 0x78
200#define PT_V9_TSTATE 0x80
201#define PT_V9_TPC 0x88
202#define PT_V9_TNPC 0x90
203#define PT_V9_Y 0x98
204#define PT_V9_MAGIC 0x9c
205#define PT_TSTATE PT_V9_TSTATE
206#define PT_TPC PT_V9_TPC
207#define PT_TNPC PT_V9_TNPC
208
209/* These for pt_regs32. */
210#define PT_PSR 0x0
211#define PT_PC 0x4
212#define PT_NPC 0x8
213#define PT_Y 0xc
214#define PT_G0 0x10
215#define PT_WIM PT_G0
216#define PT_G1 0x14
217#define PT_G2 0x18
218#define PT_G3 0x1c
219#define PT_G4 0x20
220#define PT_G5 0x24
221#define PT_G6 0x28
222#define PT_G7 0x2c
223#define PT_I0 0x30
224#define PT_I1 0x34
225#define PT_I2 0x38
226#define PT_I3 0x3c
227#define PT_I4 0x40
228#define PT_I5 0x44
229#define PT_I6 0x48
230#define PT_FP PT_I6
231#define PT_I7 0x4c
232
233/* Reg_window offsets */
234#define RW_V9_L0 0x00
235#define RW_V9_L1 0x08
236#define RW_V9_L2 0x10
237#define RW_V9_L3 0x18
238#define RW_V9_L4 0x20
239#define RW_V9_L5 0x28
240#define RW_V9_L6 0x30
241#define RW_V9_L7 0x38
242#define RW_V9_I0 0x40
243#define RW_V9_I1 0x48
244#define RW_V9_I2 0x50
245#define RW_V9_I3 0x58
246#define RW_V9_I4 0x60
247#define RW_V9_I5 0x68
248#define RW_V9_I6 0x70
249#define RW_V9_I7 0x78
250
251#define RW_L0 0x00
252#define RW_L1 0x04
253#define RW_L2 0x08
254#define RW_L3 0x0c
255#define RW_L4 0x10
256#define RW_L5 0x14
257#define RW_L6 0x18
258#define RW_L7 0x1c
259#define RW_I0 0x20
260#define RW_I1 0x24
261#define RW_I2 0x28
262#define RW_I3 0x2c
263#define RW_I4 0x30
264#define RW_I5 0x34
265#define RW_I6 0x38
266#define RW_I7 0x3c
267
268/* Stack_frame offsets */
269#define SF_V9_L0 0x00
270#define SF_V9_L1 0x08
271#define SF_V9_L2 0x10
272#define SF_V9_L3 0x18
273#define SF_V9_L4 0x20
274#define SF_V9_L5 0x28
275#define SF_V9_L6 0x30
276#define SF_V9_L7 0x38
277#define SF_V9_I0 0x40
278#define SF_V9_I1 0x48
279#define SF_V9_I2 0x50
280#define SF_V9_I3 0x58
281#define SF_V9_I4 0x60
282#define SF_V9_I5 0x68
283#define SF_V9_FP 0x70
284#define SF_V9_PC 0x78
285#define SF_V9_RETP 0x80
286#define SF_V9_XARG0 0x88
287#define SF_V9_XARG1 0x90
288#define SF_V9_XARG2 0x98
289#define SF_V9_XARG3 0xa0
290#define SF_V9_XARG4 0xa8
291#define SF_V9_XARG5 0xb0
292#define SF_V9_XXARG 0xb8
293
294#define SF_L0 0x00
295#define SF_L1 0x04
296#define SF_L2 0x08
297#define SF_L3 0x0c
298#define SF_L4 0x10
299#define SF_L5 0x14
300#define SF_L6 0x18
301#define SF_L7 0x1c
302#define SF_I0 0x20
303#define SF_I1 0x24
304#define SF_I2 0x28
305#define SF_I3 0x2c
306#define SF_I4 0x30
307#define SF_I5 0x34
308#define SF_FP 0x38
309#define SF_PC 0x3c
310#define SF_RETP 0x40
311#define SF_XARG0 0x44
312#define SF_XARG1 0x48
313#define SF_XARG2 0x4c
314#define SF_XARG3 0x50
315#define SF_XARG4 0x54
316#define SF_XARG5 0x58
317#define SF_XXARG 0x5c
318
319#ifdef __KERNEL__
320
321/* global_reg_snapshot offsets */
322#define GR_SNAP_TSTATE 0x00
323#define GR_SNAP_TPC 0x08
324#define GR_SNAP_TNPC 0x10
325#define GR_SNAP_O7 0x18
326#define GR_SNAP_I7 0x20
327#define GR_SNAP_RPC 0x28
328#define GR_SNAP_THREAD 0x30
329#define GR_SNAP_PAD1 0x38
330
331#endif /* __KERNEL__ */
332
333/* Stuff for the ptrace system call */
334#define PTRACE_SPARC_DETACH 11
335#define PTRACE_GETREGS 12
336#define PTRACE_SETREGS 13
337#define PTRACE_GETFPREGS 14
338#define PTRACE_SETFPREGS 15
339#define PTRACE_READDATA 16
340#define PTRACE_WRITEDATA 17
341#define PTRACE_READTEXT 18
342#define PTRACE_WRITETEXT 19
343#define PTRACE_GETFPAREGS 20
344#define PTRACE_SETFPAREGS 21
345
346/* There are for debugging 64-bit processes, either from a 32 or 64 bit
347 * parent. Thus their complements are for debugging 32-bit processes only.
348 */
349
350#define PTRACE_GETREGS64 22
351#define PTRACE_SETREGS64 23
352/* PTRACE_SYSCALL is 24 */
353#define PTRACE_GETFPREGS64 25
354#define PTRACE_SETFPREGS64 26
355
356#endif /* !(_SPARC64_PTRACE_H) */
diff --git a/arch/sparc/include/asm/reg.h b/arch/sparc/include/asm/reg.h
deleted file mode 100644
index 0c16e19cae4d..000000000000
--- a/arch/sparc/include/asm/reg.h
+++ /dev/null
@@ -1,8 +0,0 @@
1#ifndef ___ASM_SPARC_REG_H
2#define ___ASM_SPARC_REG_H
3#if defined(__sparc__) && defined(__arch64__)
4#include <asm/reg_64.h>
5#else
6#include <asm/reg_32.h>
7#endif
8#endif
diff --git a/arch/sparc/include/asm/reg_32.h b/arch/sparc/include/asm/reg_32.h
deleted file mode 100644
index 1efb056fb3d1..000000000000
--- a/arch/sparc/include/asm/reg_32.h
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * linux/include/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC_REG_H
15#define __SPARC_REG_H
16
17struct regs {
18 int r_psr;
19#define r_ps r_psr
20 int r_pc;
21 int r_npc;
22 int r_y;
23 int r_g1;
24 int r_g2;
25 int r_g3;
26 int r_g4;
27 int r_g5;
28 int r_g6;
29 int r_g7;
30 int r_o0;
31 int r_o1;
32 int r_o2;
33 int r_o3;
34 int r_o4;
35 int r_o5;
36 int r_o6;
37 int r_o7;
38};
39
40struct fpq {
41 unsigned long *addr;
42 unsigned long instr;
43};
44
45struct fq {
46 union {
47 double whole;
48 struct fpq fpq;
49 } FQu;
50};
51
52#define FPU_REGS_TYPE unsigned int
53#define FPU_FSR_TYPE unsigned
54
55struct fp_status {
56 union {
57 FPU_REGS_TYPE Fpu_regs[32];
58 double Fpu_dregs[16];
59 } fpu_fr;
60 FPU_FSR_TYPE Fpu_fsr;
61 unsigned Fpu_flags;
62 unsigned Fpu_extra;
63 unsigned Fpu_qcnt;
64 struct fq Fpu_q[16];
65};
66
67#define fpu_regs f_fpstatus.fpu_fr.Fpu_regs
68#define fpu_dregs f_fpstatus.fpu_fr.Fpu_dregs
69#define fpu_fsr f_fpstatus.Fpu_fsr
70#define fpu_flags f_fpstatus.Fpu_flags
71#define fpu_extra f_fpstatus.Fpu_extra
72#define fpu_q f_fpstatus.Fpu_q
73#define fpu_qcnt f_fpstatus.Fpu_qcnt
74
75struct fpu {
76 struct fp_status f_fpstatus;
77};
78
79#endif /* __SPARC_REG_H */
diff --git a/arch/sparc/include/asm/reg_64.h b/arch/sparc/include/asm/reg_64.h
deleted file mode 100644
index 6f277d7c7d88..000000000000
--- a/arch/sparc/include/asm/reg_64.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * linux/asm/reg.h
3 * Layout of the registers as expected by gdb on the Sparc
4 * we should replace the user.h definitions with those in
5 * this file, we don't even use the other
6 * -miguel
7 *
8 * The names of the structures, constants and aliases in this file
9 * have the same names as the sunos ones, some programs rely on these
10 * names (gdb for example).
11 *
12 */
13
14#ifndef __SPARC64_REG_H
15#define __SPARC64_REG_H
16
17struct regs {
18 unsigned long r_g1;
19 unsigned long r_g2;
20 unsigned long r_g3;
21 unsigned long r_g4;
22 unsigned long r_g5;
23 unsigned long r_g6;
24 unsigned long r_g7;
25 unsigned long r_o0;
26 unsigned long r_o1;
27 unsigned long r_o2;
28 unsigned long r_o3;
29 unsigned long r_o4;
30 unsigned long r_o5;
31 unsigned long r_o6;
32 unsigned long r_o7;
33 unsigned long __pad;
34 unsigned long r_tstate;
35 unsigned long r_tpc;
36 unsigned long r_tnpc;
37 unsigned int r_y;
38 unsigned int r_fprs;
39};
40
41#define FPU_REGS_TYPE unsigned int
42#define FPU_FSR_TYPE unsigned long
43
44struct fp_status {
45 unsigned long fpu_fr[32];
46 unsigned long Fpu_fsr;
47};
48
49struct fpu {
50 struct fp_status f_fpstatus;
51};
52
53#define fpu_regs f_fpstatus.fpu_fr
54#define fpu_fsr f_fpstatus.Fpu_fsr
55
56#endif /* __SPARC64_REG_H */
diff --git a/arch/sparc/include/asm/sigcontext.h b/arch/sparc/include/asm/sigcontext.h
index e92de7e286b5..a1607d180354 100644
--- a/arch/sparc/include/asm/sigcontext.h
+++ b/arch/sparc/include/asm/sigcontext.h
@@ -1,8 +1,96 @@
1#ifndef ___ASM_SPARC_SIGCONTEXT_H 1#ifndef __SPARC_SIGCONTEXT_H
2#define ___ASM_SPARC_SIGCONTEXT_H 2#define __SPARC_SIGCONTEXT_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/sigcontext_64.h> 4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6
7#ifndef __ASSEMBLY__
8
9#define __SUNOS_MAXWIN 31
10
11/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
12struct sigcontext32 {
13 int sigc_onstack; /* state to restore */
14 int sigc_mask; /* sigmask to restore */
15 int sigc_sp; /* stack pointer */
16 int sigc_pc; /* program counter */
17 int sigc_npc; /* next program counter */
18 int sigc_psr; /* for condition codes etc */
19 int sigc_g1; /* User uses these two registers */
20 int sigc_o0; /* within the trampoline code. */
21
22 /* Now comes information regarding the users window set
23 * at the time of the signal.
24 */
25 int sigc_oswins; /* outstanding windows */
26
27 /* stack ptrs for each regwin buf */
28 unsigned sigc_spbuf[__SUNOS_MAXWIN];
29
30 /* Windows to restore after signal */
31 struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
32};
33
34
35/* This is what we use for 32bit new non-rt signals. */
36
37typedef struct {
38 struct {
39 unsigned int psr;
40 unsigned int pc;
41 unsigned int npc;
42 unsigned int y;
43 unsigned int u_regs[16]; /* globals and ins */
44 } si_regs;
45 int si_mask;
46} __siginfo32_t;
47
48#ifdef CONFIG_SPARC64
49typedef struct {
50 unsigned int si_float_regs [64];
51 unsigned long si_fsr;
52 unsigned long si_gsr;
53 unsigned long si_fprs;
54} __siginfo_fpu_t;
55
56/* This is what SunOS doesn't, so we have to write this alone
57 and do it properly. */
58struct sigcontext {
59 /* The size of this array has to match SI_MAX_SIZE from siginfo.h */
60 char sigc_info[128];
61 struct {
62 unsigned long u_regs[16]; /* globals and ins */
63 unsigned long tstate;
64 unsigned long tpc;
65 unsigned long tnpc;
66 unsigned int y;
67 unsigned int fprs;
68 } sigc_regs;
69 __siginfo_fpu_t * sigc_fpu_save;
70 struct {
71 void * ss_sp;
72 int ss_flags;
73 unsigned long ss_size;
74 } sigc_stack;
75 unsigned long sigc_mask;
76};
77
5#else 78#else
6#include <asm/sigcontext_32.h> 79
7#endif 80typedef struct {
8#endif 81 unsigned long si_float_regs [32];
82 unsigned long si_fsr;
83 unsigned long si_fpqdepth;
84 struct {
85 unsigned long *insn_addr;
86 unsigned long insn;
87 } si_fpqueue [16];
88} __siginfo_fpu_t;
89#endif /* (CONFIG_SPARC64) */
90
91
92#endif /* !(__ASSEMBLY__) */
93
94#endif /* (__KERNEL__) */
95
96#endif /* !(__SPARC_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/sigcontext_32.h b/arch/sparc/include/asm/sigcontext_32.h
deleted file mode 100644
index c5fb60dcbd75..000000000000
--- a/arch/sparc/include/asm/sigcontext_32.h
+++ /dev/null
@@ -1,62 +0,0 @@
1#ifndef __SPARC_SIGCONTEXT_H
2#define __SPARC_SIGCONTEXT_H
3
4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6
7#ifndef __ASSEMBLY__
8
9#define __SUNOS_MAXWIN 31
10
11/* This is what SunOS does, so shall I. */
12struct sigcontext {
13 int sigc_onstack; /* state to restore */
14 int sigc_mask; /* sigmask to restore */
15 int sigc_sp; /* stack pointer */
16 int sigc_pc; /* program counter */
17 int sigc_npc; /* next program counter */
18 int sigc_psr; /* for condition codes etc */
19 int sigc_g1; /* User uses these two registers */
20 int sigc_o0; /* within the trampoline code. */
21
22 /* Now comes information regarding the users window set
23 * at the time of the signal.
24 */
25 int sigc_oswins; /* outstanding windows */
26
27 /* stack ptrs for each regwin buf */
28 char *sigc_spbuf[__SUNOS_MAXWIN];
29
30 /* Windows to restore after signal */
31 struct {
32 unsigned long locals[8];
33 unsigned long ins[8];
34 } sigc_wbuf[__SUNOS_MAXWIN];
35};
36
37typedef struct {
38 struct {
39 unsigned long psr;
40 unsigned long pc;
41 unsigned long npc;
42 unsigned long y;
43 unsigned long u_regs[16]; /* globals and ins */
44 } si_regs;
45 int si_mask;
46} __siginfo_t;
47
48typedef struct {
49 unsigned long si_float_regs [32];
50 unsigned long si_fsr;
51 unsigned long si_fpqdepth;
52 struct {
53 unsigned long *insn_addr;
54 unsigned long insn;
55 } si_fpqueue [16];
56} __siginfo_fpu_t;
57
58#endif /* !(__ASSEMBLY__) */
59
60#endif /* (__KERNEL__) */
61
62#endif /* !(__SPARC_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/sigcontext_64.h b/arch/sparc/include/asm/sigcontext_64.h
deleted file mode 100644
index 1c868d680cfc..000000000000
--- a/arch/sparc/include/asm/sigcontext_64.h
+++ /dev/null
@@ -1,87 +0,0 @@
1#ifndef __SPARC64_SIGCONTEXT_H
2#define __SPARC64_SIGCONTEXT_H
3
4#ifdef __KERNEL__
5#include <asm/ptrace.h>
6#endif
7
8#ifndef __ASSEMBLY__
9
10#ifdef __KERNEL__
11
12#define __SUNOS_MAXWIN 31
13
14/* This is what SunOS does, so shall I unless we use new 32bit signals or rt signals. */
15struct sigcontext32 {
16 int sigc_onstack; /* state to restore */
17 int sigc_mask; /* sigmask to restore */
18 int sigc_sp; /* stack pointer */
19 int sigc_pc; /* program counter */
20 int sigc_npc; /* next program counter */
21 int sigc_psr; /* for condition codes etc */
22 int sigc_g1; /* User uses these two registers */
23 int sigc_o0; /* within the trampoline code. */
24
25 /* Now comes information regarding the users window set
26 * at the time of the signal.
27 */
28 int sigc_oswins; /* outstanding windows */
29
30 /* stack ptrs for each regwin buf */
31 unsigned sigc_spbuf[__SUNOS_MAXWIN];
32
33 /* Windows to restore after signal */
34 struct reg_window32 sigc_wbuf[__SUNOS_MAXWIN];
35};
36
37#endif
38
39#ifdef __KERNEL__
40
41/* This is what we use for 32bit new non-rt signals. */
42
43typedef struct {
44 struct {
45 unsigned int psr;
46 unsigned int pc;
47 unsigned int npc;
48 unsigned int y;
49 unsigned int u_regs[16]; /* globals and ins */
50 } si_regs;
51 int si_mask;
52} __siginfo32_t;
53
54#endif
55
56typedef struct {
57 unsigned int si_float_regs [64];
58 unsigned long si_fsr;
59 unsigned long si_gsr;
60 unsigned long si_fprs;
61} __siginfo_fpu_t;
62
63/* This is what SunOS doesn't, so we have to write this alone
64 and do it properly. */
65struct sigcontext {
66 /* The size of this array has to match SI_MAX_SIZE from siginfo.h */
67 char sigc_info[128];
68 struct {
69 unsigned long u_regs[16]; /* globals and ins */
70 unsigned long tstate;
71 unsigned long tpc;
72 unsigned long tnpc;
73 unsigned int y;
74 unsigned int fprs;
75 } sigc_regs;
76 __siginfo_fpu_t * sigc_fpu_save;
77 struct {
78 void * ss_sp;
79 int ss_flags;
80 unsigned long ss_size;
81 } sigc_stack;
82 unsigned long sigc_mask;
83};
84
85#endif /* !(__ASSEMBLY__) */
86
87#endif /* !(__SPARC64_SIGCONTEXT_H) */
diff --git a/arch/sparc/include/asm/siginfo.h b/arch/sparc/include/asm/siginfo.h
index bd81f8d7f5ce..988e5d8ed11a 100644
--- a/arch/sparc/include/asm/siginfo.h
+++ b/arch/sparc/include/asm/siginfo.h
@@ -1,8 +1,37 @@
1#ifndef ___ASM_SPARC_SIGINFO_H 1#ifndef __SPARC_SIGINFO_H
2#define ___ASM_SPARC_SIGINFO_H 2#define __SPARC_SIGINFO_H
3
3#if defined(__sparc__) && defined(__arch64__) 4#if defined(__sparc__) && defined(__arch64__)
4#include <asm/siginfo_64.h> 5
5#else 6#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
6#include <asm/siginfo_32.h> 7#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
7#endif 8#define __ARCH_SI_BAND_T int
8#endif 9
10#endif /* defined(__sparc__) && defined(__arch64__) */
11
12
13#define __ARCH_SI_TRAPNO
14
15#include <asm-generic/siginfo.h>
16
17#ifdef __KERNEL__
18
19#include <linux/compat.h>
20
21#ifdef CONFIG_COMPAT
22
23struct compat_siginfo;
24
25#endif /* CONFIG_COMPAT */
26
27#endif /* __KERNEL__ */
28
29#define SI_NOINFO 32767 /* no information in siginfo_t */
30
31/*
32 * SIGEMT si_codes
33 */
34#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
35#define NSIGEMT 1
36
37#endif /* !(__SPARC_SIGINFO_H) */
diff --git a/arch/sparc/include/asm/siginfo_32.h b/arch/sparc/include/asm/siginfo_32.h
deleted file mode 100644
index 3c71af135c52..000000000000
--- a/arch/sparc/include/asm/siginfo_32.h
+++ /dev/null
@@ -1,17 +0,0 @@
1#ifndef _SPARC_SIGINFO_H
2#define _SPARC_SIGINFO_H
3
4#define __ARCH_SI_UID_T unsigned int
5#define __ARCH_SI_TRAPNO
6
7#include <asm-generic/siginfo.h>
8
9#define SI_NOINFO 32767 /* no information in siginfo_t */
10
11/*
12 * SIGEMT si_codes
13 */
14#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
15#define NSIGEMT 1
16
17#endif /* !(_SPARC_SIGINFO_H) */
diff --git a/arch/sparc/include/asm/siginfo_64.h b/arch/sparc/include/asm/siginfo_64.h
deleted file mode 100644
index c96e6c30f8b0..000000000000
--- a/arch/sparc/include/asm/siginfo_64.h
+++ /dev/null
@@ -1,32 +0,0 @@
1#ifndef _SPARC64_SIGINFO_H
2#define _SPARC64_SIGINFO_H
3
4#define SI_PAD_SIZE32 ((SI_MAX_SIZE/sizeof(int)) - 3)
5
6#define __ARCH_SI_PREAMBLE_SIZE (4 * sizeof(int))
7#define __ARCH_SI_TRAPNO
8#define __ARCH_SI_BAND_T int
9
10#include <asm-generic/siginfo.h>
11
12#ifdef __KERNEL__
13
14#include <linux/compat.h>
15
16#ifdef CONFIG_COMPAT
17
18struct compat_siginfo;
19
20#endif /* CONFIG_COMPAT */
21
22#endif /* __KERNEL__ */
23
24#define SI_NOINFO 32767 /* no information in siginfo_t */
25
26/*
27 * SIGEMT si_codes
28 */
29#define EMT_TAGOVF (__SI_FAULT|1) /* tag overflow */
30#define NSIGEMT 1
31
32#endif
diff --git a/arch/sparc/include/asm/signal.h b/arch/sparc/include/asm/signal.h
index 27ab05dc203e..41535e77b255 100644
--- a/arch/sparc/include/asm/signal.h
+++ b/arch/sparc/include/asm/signal.h
@@ -1,8 +1,210 @@
1#ifndef ___ASM_SPARC_SIGNAL_H 1#ifndef __SPARC_SIGNAL_H
2#define ___ASM_SPARC_SIGNAL_H 2#define __SPARC_SIGNAL_H
3#if defined(__sparc__) && defined(__arch64__) 3
4#include <asm/signal_64.h> 4#include <asm/sigcontext.h>
5#include <linux/compiler.h>
6
7#ifdef __KERNEL__
8#ifndef __ASSEMBLY__
9#include <linux/personality.h>
10#include <linux/types.h>
11#endif
12#endif
13
14/* On the Sparc the signal handlers get passed a 'sub-signal' code
15 * for certain signal types, which we document here.
16 */
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SUBSIG_STACK 0
22#define SUBSIG_ILLINST 2
23#define SUBSIG_PRIVINST 3
24#define SUBSIG_BADTRAP(t) (0x80 + (t))
25
26#define SIGTRAP 5
27#define SIGABRT 6
28#define SIGIOT 6
29
30#define SIGEMT 7
31#define SUBSIG_TAG 10
32
33#define SIGFPE 8
34#define SUBSIG_FPDISABLED 0x400
35#define SUBSIG_FPERROR 0x404
36#define SUBSIG_FPINTOVFL 0x001
37#define SUBSIG_FPSTSIG 0x002
38#define SUBSIG_IDIVZERO 0x014
39#define SUBSIG_FPINEXACT 0x0c4
40#define SUBSIG_FPDIVZERO 0x0c8
41#define SUBSIG_FPUNFLOW 0x0cc
42#define SUBSIG_FPOPERROR 0x0d0
43#define SUBSIG_FPOVFLOW 0x0d4
44
45#define SIGKILL 9
46#define SIGBUS 10
47#define SUBSIG_BUSTIMEOUT 1
48#define SUBSIG_ALIGNMENT 2
49#define SUBSIG_MISCERROR 5
50
51#define SIGSEGV 11
52#define SUBSIG_NOMAPPING 3
53#define SUBSIG_PROTECTION 4
54#define SUBSIG_SEGERROR 5
55
56#define SIGSYS 12
57
58#define SIGPIPE 13
59#define SIGALRM 14
60#define SIGTERM 15
61#define SIGURG 16
62
63/* SunOS values which deviate from the Linux/i386 ones */
64#define SIGSTOP 17
65#define SIGTSTP 18
66#define SIGCONT 19
67#define SIGCHLD 20
68#define SIGTTIN 21
69#define SIGTTOU 22
70#define SIGIO 23
71#define SIGPOLL SIGIO /* SysV name for SIGIO */
72#define SIGXCPU 24
73#define SIGXFSZ 25
74#define SIGVTALRM 26
75#define SIGPROF 27
76#define SIGWINCH 28
77#define SIGLOST 29
78#define SIGPWR SIGLOST
79#define SIGUSR1 30
80#define SIGUSR2 31
81
82/* Most things should be clean enough to redefine this at will, if care
83 is taken to make libc match. */
84
85#define __OLD_NSIG 32
86#define __NEW_NSIG 64
87#define _NSIG_BPW 64
88#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
89
90#define SIGRTMIN 32
91#define SIGRTMAX __NEW_NSIG
92
93#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
94#define _NSIG __NEW_NSIG
95#define __new_sigset_t sigset_t
96#define __new_sigaction sigaction
97#define __new_sigaction32 sigaction32
98#define __old_sigset_t old_sigset_t
99#define __old_sigaction old_sigaction
100#define __old_sigaction32 old_sigaction32
5#else 101#else
6#include <asm/signal_32.h> 102#define _NSIG __OLD_NSIG
103#define NSIG _NSIG
104#define __old_sigset_t sigset_t
105#define __old_sigaction sigaction
106#define __old_sigaction32 sigaction32
7#endif 107#endif
108
109#ifndef __ASSEMBLY__
110
111typedef unsigned long __old_sigset_t; /* at least 32 bits */
112
113typedef struct {
114 unsigned long sig[_NSIG_WORDS];
115} __new_sigset_t;
116
117/* A SunOS sigstack */
118struct sigstack {
119 /* XXX 32-bit pointers pinhead XXX */
120 char *the_stack;
121 int cur_status;
122};
123
124/* Sigvec flags */
125#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
126#define _SV_INTR 2u /* Sig return should not restart system call */
127#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
128#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
129
130/*
131 * sa_flags values: SA_STACK is not currently supported, but will allow the
132 * usage of signal stacks by using the (now obsolete) sa_restorer field in
133 * the sigaction structure as a stack pointer. This is now possible due to
134 * the changes in signal handling. LBT 010493.
135 * SA_RESTART flag to get restarting signals (which were the default long ago)
136 */
137#define SA_NOCLDSTOP _SV_IGNCHILD
138#define SA_STACK _SV_SSTACK
139#define SA_ONSTACK _SV_SSTACK
140#define SA_RESTART _SV_INTR
141#define SA_ONESHOT _SV_RESET
142#define SA_NOMASK 0x20u
143#define SA_NOCLDWAIT 0x100u
144#define SA_SIGINFO 0x200u
145
146
147#define SIG_BLOCK 0x01 /* for blocking signals */
148#define SIG_UNBLOCK 0x02 /* for unblocking signals */
149#define SIG_SETMASK 0x04 /* for setting the signal mask */
150
151/*
152 * sigaltstack controls
153 */
154#define SS_ONSTACK 1
155#define SS_DISABLE 2
156
157#define MINSIGSTKSZ 4096
158#define SIGSTKSZ 16384
159
160#ifdef __KERNEL__
161/*
162 * DJHR
163 * SA_STATIC_ALLOC is used for the sparc32 system to indicate that this
164 * interrupt handler's irq structure should be statically allocated
165 * by the request_irq routine.
166 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
167 * of interrupt usage and that sucks. Also without a flag like this
168 * it may be possible for the free_irq routine to attempt to free
169 * statically allocated data.. which is NOT GOOD.
170 *
171 */
172#define SA_STATIC_ALLOC 0x8000
8#endif 173#endif
174
175#include <asm-generic/signal.h>
176
177struct __new_sigaction {
178 __sighandler_t sa_handler;
179 unsigned long sa_flags;
180 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
181 __new_sigset_t sa_mask;
182};
183
184struct __old_sigaction {
185 __sighandler_t sa_handler;
186 __old_sigset_t sa_mask;
187 unsigned long sa_flags;
188 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
189};
190
191typedef struct sigaltstack {
192 void __user *ss_sp;
193 int ss_flags;
194 size_t ss_size;
195} stack_t;
196
197#ifdef __KERNEL__
198
199struct k_sigaction {
200 struct __new_sigaction sa;
201 void __user *ka_restorer;
202};
203
204#define ptrace_signal_deliver(regs, cookie) do { } while (0)
205
206#endif /* !(__KERNEL__) */
207
208#endif /* !(__ASSEMBLY__) */
209
210#endif /* !(__SPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/signal_32.h b/arch/sparc/include/asm/signal_32.h
deleted file mode 100644
index 96a60ab03ca1..000000000000
--- a/arch/sparc/include/asm/signal_32.h
+++ /dev/null
@@ -1,207 +0,0 @@
1#ifndef _ASMSPARC_SIGNAL_H
2#define _ASMSPARC_SIGNAL_H
3
4#include <asm/sigcontext.h>
5#include <linux/compiler.h>
6
7#ifdef __KERNEL__
8#ifndef __ASSEMBLY__
9#include <linux/personality.h>
10#include <linux/types.h>
11#endif
12#endif
13
14/* On the Sparc the signal handlers get passed a 'sub-signal' code
15 * for certain signal types, which we document here.
16 */
17#define SIGHUP 1
18#define SIGINT 2
19#define SIGQUIT 3
20#define SIGILL 4
21#define SUBSIG_STACK 0
22#define SUBSIG_ILLINST 2
23#define SUBSIG_PRIVINST 3
24#define SUBSIG_BADTRAP(t) (0x80 + (t))
25
26#define SIGTRAP 5
27#define SIGABRT 6
28#define SIGIOT 6
29
30#define SIGEMT 7
31#define SUBSIG_TAG 10
32
33#define SIGFPE 8
34#define SUBSIG_FPDISABLED 0x400
35#define SUBSIG_FPERROR 0x404
36#define SUBSIG_FPINTOVFL 0x001
37#define SUBSIG_FPSTSIG 0x002
38#define SUBSIG_IDIVZERO 0x014
39#define SUBSIG_FPINEXACT 0x0c4
40#define SUBSIG_FPDIVZERO 0x0c8
41#define SUBSIG_FPUNFLOW 0x0cc
42#define SUBSIG_FPOPERROR 0x0d0
43#define SUBSIG_FPOVFLOW 0x0d4
44
45#define SIGKILL 9
46#define SIGBUS 10
47#define SUBSIG_BUSTIMEOUT 1
48#define SUBSIG_ALIGNMENT 2
49#define SUBSIG_MISCERROR 5
50
51#define SIGSEGV 11
52#define SUBSIG_NOMAPPING 3
53#define SUBSIG_PROTECTION 4
54#define SUBSIG_SEGERROR 5
55
56#define SIGSYS 12
57
58#define SIGPIPE 13
59#define SIGALRM 14
60#define SIGTERM 15
61#define SIGURG 16
62
63/* SunOS values which deviate from the Linux/i386 ones */
64#define SIGSTOP 17
65#define SIGTSTP 18
66#define SIGCONT 19
67#define SIGCHLD 20
68#define SIGTTIN 21
69#define SIGTTOU 22
70#define SIGIO 23
71#define SIGPOLL SIGIO /* SysV name for SIGIO */
72#define SIGXCPU 24
73#define SIGXFSZ 25
74#define SIGVTALRM 26
75#define SIGPROF 27
76#define SIGWINCH 28
77#define SIGLOST 29
78#define SIGPWR SIGLOST
79#define SIGUSR1 30
80#define SIGUSR2 31
81
82/* Most things should be clean enough to redefine this at will, if care
83 * is taken to make libc match.
84 */
85
86#define __OLD_NSIG 32
87#define __NEW_NSIG 64
88#define _NSIG_BPW 32
89#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
90
91#define SIGRTMIN 32
92#define SIGRTMAX __NEW_NSIG
93
94#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
95#define _NSIG __NEW_NSIG
96#define __new_sigset_t sigset_t
97#define __new_sigaction sigaction
98#define __old_sigset_t old_sigset_t
99#define __old_sigaction old_sigaction
100#else
101#define _NSIG __OLD_NSIG
102#define __old_sigset_t sigset_t
103#define __old_sigaction sigaction
104#endif
105
106#ifndef __ASSEMBLY__
107
108typedef unsigned long __old_sigset_t;
109
110typedef struct {
111 unsigned long sig[_NSIG_WORDS];
112} __new_sigset_t;
113
114
115#ifdef __KERNEL__
116/* A SunOS sigstack */
117struct sigstack {
118 char *the_stack;
119 int cur_status;
120};
121#endif
122
123/* Sigvec flags */
124#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
125#define _SV_INTR 2u /* Sig return should not restart system call */
126#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
127#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
128
129/*
130 * sa_flags values: SA_STACK is not currently supported, but will allow the
131 * usage of signal stacks by using the (now obsolete) sa_restorer field in
132 * the sigaction structure as a stack pointer. This is now possible due to
133 * the changes in signal handling. LBT 010493.
134 * SA_RESTART flag to get restarting signals (which were the default long ago)
135 */
136#define SA_NOCLDSTOP _SV_IGNCHILD
137#define SA_STACK _SV_SSTACK
138#define SA_ONSTACK _SV_SSTACK
139#define SA_RESTART _SV_INTR
140#define SA_ONESHOT _SV_RESET
141#define SA_NOMASK 0x20u
142#define SA_NOCLDWAIT 0x100u
143#define SA_SIGINFO 0x200u
144
145#define SIG_BLOCK 0x01 /* for blocking signals */
146#define SIG_UNBLOCK 0x02 /* for unblocking signals */
147#define SIG_SETMASK 0x04 /* for setting the signal mask */
148
149/*
150 * sigaltstack controls
151 */
152#define SS_ONSTACK 1
153#define SS_DISABLE 2
154
155#define MINSIGSTKSZ 4096
156#define SIGSTKSZ 16384
157
158#ifdef __KERNEL__
159/*
160 * DJHR
161 * SA_STATIC_ALLOC is used for the SPARC system to indicate that this
162 * interrupt handler's irq structure should be statically allocated
163 * by the request_irq routine.
164 * The alternative is that arch/sparc/kernel/irq.c has carnal knowledge
165 * of interrupt usage and that sucks. Also without a flag like this
166 * it may be possible for the free_irq routine to attempt to free
167 * statically allocated data.. which is NOT GOOD.
168 *
169 */
170#define SA_STATIC_ALLOC 0x8000
171#endif
172
173#include <asm-generic/signal.h>
174
175#ifdef __KERNEL__
176struct __new_sigaction {
177 __sighandler_t sa_handler;
178 unsigned long sa_flags;
179 void (*sa_restorer)(void); /* Not used by Linux/SPARC */
180 __new_sigset_t sa_mask;
181};
182
183struct k_sigaction {
184 struct __new_sigaction sa;
185 void __user *ka_restorer;
186};
187
188struct __old_sigaction {
189 __sighandler_t sa_handler;
190 __old_sigset_t sa_mask;
191 unsigned long sa_flags;
192 void (*sa_restorer) (void); /* not used by Linux/SPARC */
193};
194
195typedef struct sigaltstack {
196 void __user *ss_sp;
197 int ss_flags;
198 size_t ss_size;
199} stack_t;
200
201#define ptrace_signal_deliver(regs, cookie) do { } while (0)
202
203#endif /* !(__KERNEL__) */
204
205#endif /* !(__ASSEMBLY__) */
206
207#endif /* !(_ASMSPARC_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/signal_64.h b/arch/sparc/include/asm/signal_64.h
deleted file mode 100644
index ab1509a101c5..000000000000
--- a/arch/sparc/include/asm/signal_64.h
+++ /dev/null
@@ -1,194 +0,0 @@
1#ifndef _ASMSPARC64_SIGNAL_H
2#define _ASMSPARC64_SIGNAL_H
3
4#include <asm/sigcontext.h>
5
6#ifdef __KERNEL__
7#ifndef __ASSEMBLY__
8#include <linux/personality.h>
9#include <linux/types.h>
10#endif
11#endif
12
13/* On the Sparc the signal handlers get passed a 'sub-signal' code
14 * for certain signal types, which we document here.
15 */
16#define SIGHUP 1
17#define SIGINT 2
18#define SIGQUIT 3
19#define SIGILL 4
20#define SUBSIG_STACK 0
21#define SUBSIG_ILLINST 2
22#define SUBSIG_PRIVINST 3
23#define SUBSIG_BADTRAP(t) (0x80 + (t))
24
25#define SIGTRAP 5
26#define SIGABRT 6
27#define SIGIOT 6
28
29#define SIGEMT 7
30#define SUBSIG_TAG 10
31
32#define SIGFPE 8
33#define SUBSIG_FPDISABLED 0x400
34#define SUBSIG_FPERROR 0x404
35#define SUBSIG_FPINTOVFL 0x001
36#define SUBSIG_FPSTSIG 0x002
37#define SUBSIG_IDIVZERO 0x014
38#define SUBSIG_FPINEXACT 0x0c4
39#define SUBSIG_FPDIVZERO 0x0c8
40#define SUBSIG_FPUNFLOW 0x0cc
41#define SUBSIG_FPOPERROR 0x0d0
42#define SUBSIG_FPOVFLOW 0x0d4
43
44#define SIGKILL 9
45#define SIGBUS 10
46#define SUBSIG_BUSTIMEOUT 1
47#define SUBSIG_ALIGNMENT 2
48#define SUBSIG_MISCERROR 5
49
50#define SIGSEGV 11
51#define SUBSIG_NOMAPPING 3
52#define SUBSIG_PROTECTION 4
53#define SUBSIG_SEGERROR 5
54
55#define SIGSYS 12
56
57#define SIGPIPE 13
58#define SIGALRM 14
59#define SIGTERM 15
60#define SIGURG 16
61
62/* SunOS values which deviate from the Linux/i386 ones */
63#define SIGSTOP 17
64#define SIGTSTP 18
65#define SIGCONT 19
66#define SIGCHLD 20
67#define SIGTTIN 21
68#define SIGTTOU 22
69#define SIGIO 23
70#define SIGPOLL SIGIO /* SysV name for SIGIO */
71#define SIGXCPU 24
72#define SIGXFSZ 25
73#define SIGVTALRM 26
74#define SIGPROF 27
75#define SIGWINCH 28
76#define SIGLOST 29
77#define SIGPWR SIGLOST
78#define SIGUSR1 30
79#define SIGUSR2 31
80
81/* Most things should be clean enough to redefine this at will, if care
82 is taken to make libc match. */
83
84#define __OLD_NSIG 32
85#define __NEW_NSIG 64
86#define _NSIG_BPW 64
87#define _NSIG_WORDS (__NEW_NSIG / _NSIG_BPW)
88
89#define SIGRTMIN 32
90#define SIGRTMAX __NEW_NSIG
91
92#if defined(__KERNEL__) || defined(__WANT_POSIX1B_SIGNALS__)
93#define _NSIG __NEW_NSIG
94#define __new_sigset_t sigset_t
95#define __new_sigaction sigaction
96#define __new_sigaction32 sigaction32
97#define __old_sigset_t old_sigset_t
98#define __old_sigaction old_sigaction
99#define __old_sigaction32 old_sigaction32
100#else
101#define _NSIG __OLD_NSIG
102#define NSIG _NSIG
103#define __old_sigset_t sigset_t
104#define __old_sigaction sigaction
105#define __old_sigaction32 sigaction32
106#endif
107
108#ifndef __ASSEMBLY__
109
110typedef unsigned long __old_sigset_t; /* at least 32 bits */
111
112typedef struct {
113 unsigned long sig[_NSIG_WORDS];
114} __new_sigset_t;
115
116/* A SunOS sigstack */
117struct sigstack {
118 /* XXX 32-bit pointers pinhead XXX */
119 char *the_stack;
120 int cur_status;
121};
122
123/* Sigvec flags */
124#define _SV_SSTACK 1u /* This signal handler should use sig-stack */
125#define _SV_INTR 2u /* Sig return should not restart system call */
126#define _SV_RESET 4u /* Set handler to SIG_DFL upon taken signal */
127#define _SV_IGNCHILD 8u /* Do not send SIGCHLD */
128
129/*
130 * sa_flags values: SA_STACK is not currently supported, but will allow the
131 * usage of signal stacks by using the (now obsolete) sa_restorer field in
132 * the sigaction structure as a stack pointer. This is now possible due to
133 * the changes in signal handling. LBT 010493.
134 * SA_RESTART flag to get restarting signals (which were the default long ago)
135 */
136#define SA_NOCLDSTOP _SV_IGNCHILD
137#define SA_STACK _SV_SSTACK
138#define SA_ONSTACK _SV_SSTACK
139#define SA_RESTART _SV_INTR
140#define SA_ONESHOT _SV_RESET
141#define SA_NOMASK 0x20u
142#define SA_NOCLDWAIT 0x100u
143#define SA_SIGINFO 0x200u
144
145
146#define SIG_BLOCK 0x01 /* for blocking signals */
147#define SIG_UNBLOCK 0x02 /* for unblocking signals */
148#define SIG_SETMASK 0x04 /* for setting the signal mask */
149
150/*
151 * sigaltstack controls
152 */
153#define SS_ONSTACK 1
154#define SS_DISABLE 2
155
156#define MINSIGSTKSZ 4096
157#define SIGSTKSZ 16384
158
159#include <asm-generic/signal.h>
160
161struct __new_sigaction {
162 __sighandler_t sa_handler;
163 unsigned long sa_flags;
164 __sigrestore_t sa_restorer; /* not used by Linux/SPARC yet */
165 __new_sigset_t sa_mask;
166};
167
168struct __old_sigaction {
169 __sighandler_t sa_handler;
170 __old_sigset_t sa_mask;
171 unsigned long sa_flags;
172 void (*sa_restorer)(void); /* not used by Linux/SPARC yet */
173};
174
175typedef struct sigaltstack {
176 void __user *ss_sp;
177 int ss_flags;
178 size_t ss_size;
179} stack_t;
180
181#ifdef __KERNEL__
182
183struct k_sigaction {
184 struct __new_sigaction sa;
185 void __user *ka_restorer;
186};
187
188#define ptrace_signal_deliver(regs, cookie) do { } while (0)
189
190#endif /* !(__KERNEL__) */
191
192#endif /* !(__ASSEMBLY__) */
193
194#endif /* !(_ASMSPARC64_SIGNAL_H) */
diff --git a/arch/sparc/include/asm/smp_32.h b/arch/sparc/include/asm/smp_32.h
index 8408d9d2a662..58101dc70493 100644
--- a/arch/sparc/include/asm/smp_32.h
+++ b/arch/sparc/include/asm/smp_32.h
@@ -170,7 +170,4 @@ void smp_setup_cpu_possible_map(void);
170#define smp_setup_cpu_possible_map() do { } while (0) 170#define smp_setup_cpu_possible_map() do { } while (0)
171 171
172#endif /* !(SMP) */ 172#endif /* !(SMP) */
173
174#define NO_PROC_ID 0xFF
175
176#endif /* !(_SPARC_SMP_H) */ 173#endif /* !(_SPARC_SMP_H) */
diff --git a/arch/sparc/include/asm/stat.h b/arch/sparc/include/asm/stat.h
index d8153013df72..55db5eca08e2 100644
--- a/arch/sparc/include/asm/stat.h
+++ b/arch/sparc/include/asm/stat.h
@@ -1,8 +1,107 @@
1#ifndef ___ASM_SPARC_STAT_H 1#ifndef __SPARC_STAT_H
2#define ___ASM_SPARC_STAT_H 2#define __SPARC_STAT_H
3
4#include <linux/types.h>
5
3#if defined(__sparc__) && defined(__arch64__) 6#if defined(__sparc__) && defined(__arch64__)
4#include <asm/stat_64.h> 7/* 64 bit sparc */
8struct stat {
9 unsigned st_dev;
10 ino_t st_ino;
11 mode_t st_mode;
12 short st_nlink;
13 uid_t st_uid;
14 gid_t st_gid;
15 unsigned st_rdev;
16 off_t st_size;
17 time_t st_atime;
18 time_t st_mtime;
19 time_t st_ctime;
20 off_t st_blksize;
21 off_t st_blocks;
22 unsigned long __unused4[2];
23};
24
25struct stat64 {
26 unsigned long st_dev;
27 unsigned long st_ino;
28 unsigned long st_nlink;
29
30 unsigned int st_mode;
31 unsigned int st_uid;
32 unsigned int st_gid;
33 unsigned int __pad0;
34
35 unsigned long st_rdev;
36 long st_size;
37 long st_blksize;
38 long st_blocks;
39
40 unsigned long st_atime;
41 unsigned long st_atime_nsec;
42 unsigned long st_mtime;
43 unsigned long st_mtime_nsec;
44 unsigned long st_ctime;
45 unsigned long st_ctime_nsec;
46 long __unused[3];
47};
48
5#else 49#else
6#include <asm/stat_32.h> 50/* 32 bit sparc */
7#endif 51struct stat {
8#endif 52 unsigned short st_dev;
53 ino_t st_ino;
54 mode_t st_mode;
55 short st_nlink;
56 uid_t st_uid;
57 gid_t st_gid;
58 unsigned short st_rdev;
59 off_t st_size;
60 time_t st_atime;
61 unsigned long st_atime_nsec;
62 time_t st_mtime;
63 unsigned long st_mtime_nsec;
64 time_t st_ctime;
65 unsigned long st_ctime_nsec;
66 off_t st_blksize;
67 off_t st_blocks;
68 unsigned long __unused4[2];
69};
70
71#define STAT_HAVE_NSEC 1
72
73struct stat64 {
74 unsigned long long st_dev;
75
76 unsigned long long st_ino;
77
78 unsigned int st_mode;
79 unsigned int st_nlink;
80
81 unsigned int st_uid;
82 unsigned int st_gid;
83
84 unsigned long long st_rdev;
85
86 unsigned char __pad3[8];
87
88 long long st_size;
89 unsigned int st_blksize;
90
91 unsigned char __pad4[8];
92 unsigned int st_blocks;
93
94 unsigned int st_atime;
95 unsigned int st_atime_nsec;
96
97 unsigned int st_mtime;
98 unsigned int st_mtime_nsec;
99
100 unsigned int st_ctime;
101 unsigned int st_ctime_nsec;
102
103 unsigned int __unused4;
104 unsigned int __unused5;
105};
106#endif /* defined(__sparc__) && defined(__arch64__) */
107#endif /* __SPARC_STAT_H */
diff --git a/arch/sparc/include/asm/stat_32.h b/arch/sparc/include/asm/stat_32.h
deleted file mode 100644
index 2299e1d5d94c..000000000000
--- a/arch/sparc/include/asm/stat_32.h
+++ /dev/null
@@ -1,76 +0,0 @@
1#ifndef _SPARC_STAT_H
2#define _SPARC_STAT_H
3
4#include <linux/types.h>
5
6struct __old_kernel_stat {
7 unsigned short st_dev;
8 unsigned short st_ino;
9 unsigned short st_mode;
10 unsigned short st_nlink;
11 unsigned short st_uid;
12 unsigned short st_gid;
13 unsigned short st_rdev;
14 unsigned long st_size;
15 unsigned long st_atime;
16 unsigned long st_mtime;
17 unsigned long st_ctime;
18};
19
20struct stat {
21 unsigned short st_dev;
22 unsigned long st_ino;
23 unsigned short st_mode;
24 short st_nlink;
25 unsigned short st_uid;
26 unsigned short st_gid;
27 unsigned short st_rdev;
28 long st_size;
29 long st_atime;
30 unsigned long st_atime_nsec;
31 long st_mtime;
32 unsigned long st_mtime_nsec;
33 long st_ctime;
34 unsigned long st_ctime_nsec;
35 long st_blksize;
36 long st_blocks;
37 unsigned long __unused4[2];
38};
39
40#define STAT_HAVE_NSEC 1
41
42struct stat64 {
43 unsigned long long st_dev;
44
45 unsigned long long st_ino;
46
47 unsigned int st_mode;
48 unsigned int st_nlink;
49
50 unsigned int st_uid;
51 unsigned int st_gid;
52
53 unsigned long long st_rdev;
54
55 unsigned char __pad3[8];
56
57 long long st_size;
58 unsigned int st_blksize;
59
60 unsigned char __pad4[8];
61 unsigned int st_blocks;
62
63 unsigned int st_atime;
64 unsigned int st_atime_nsec;
65
66 unsigned int st_mtime;
67 unsigned int st_mtime_nsec;
68
69 unsigned int st_ctime;
70 unsigned int st_ctime_nsec;
71
72 unsigned int __unused4;
73 unsigned int __unused5;
74};
75
76#endif
diff --git a/arch/sparc/include/asm/stat_64.h b/arch/sparc/include/asm/stat_64.h
deleted file mode 100644
index 9650fdea847f..000000000000
--- a/arch/sparc/include/asm/stat_64.h
+++ /dev/null
@@ -1,47 +0,0 @@
1#ifndef _SPARC64_STAT_H
2#define _SPARC64_STAT_H
3
4#include <linux/types.h>
5
6struct stat {
7 unsigned st_dev;
8 ino_t st_ino;
9 mode_t st_mode;
10 short st_nlink;
11 uid_t st_uid;
12 gid_t st_gid;
13 unsigned st_rdev;
14 off_t st_size;
15 time_t st_atime;
16 time_t st_mtime;
17 time_t st_ctime;
18 off_t st_blksize;
19 off_t st_blocks;
20 unsigned long __unused4[2];
21};
22
23struct stat64 {
24 unsigned long st_dev;
25 unsigned long st_ino;
26 unsigned long st_nlink;
27
28 unsigned int st_mode;
29 unsigned int st_uid;
30 unsigned int st_gid;
31 unsigned int __pad0;
32
33 unsigned long st_rdev;
34 long st_size;
35 long st_blksize;
36 long st_blocks;
37
38 unsigned long st_atime;
39 unsigned long st_atime_nsec;
40 unsigned long st_mtime;
41 unsigned long st_mtime_nsec;
42 unsigned long st_ctime;
43 unsigned long st_ctime_nsec;
44 long __unused[3];
45};
46
47#endif
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 80fe547c3f45..0f7b0e5fb1c7 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -45,7 +45,7 @@ struct thread_info {
45 /* A place to store user windows and stack pointers 45 /* A place to store user windows and stack pointers
46 * when the stack needs inspection. 46 * when the stack needs inspection.
47 */ 47 */
48 struct reg_window reg_window[NSWINS]; /* align for ldd! */ 48 struct reg_window32 reg_window[NSWINS]; /* align for ldd! */
49 unsigned long rwbuf_stkptrs[NSWINS]; 49 unsigned long rwbuf_stkptrs[NSWINS];
50 unsigned long w_saved; 50 unsigned long w_saved;
51 51
diff --git a/arch/sparc/include/asm/traps.h b/arch/sparc/include/asm/traps.h
index bebdbf8f43a8..3aa62dde343f 100644
--- a/arch/sparc/include/asm/traps.h
+++ b/arch/sparc/include/asm/traps.h
@@ -10,7 +10,7 @@
10#define NUM_SPARC_TRAPS 255 10#define NUM_SPARC_TRAPS 255
11 11
12#ifndef __ASSEMBLY__ 12#ifndef __ASSEMBLY__
13 13#ifdef __KERNEL__
14/* This is for V8 compliant Sparc CPUS */ 14/* This is for V8 compliant Sparc CPUS */
15struct tt_entry { 15struct tt_entry {
16 unsigned long inst_one; 16 unsigned long inst_one;
@@ -22,14 +22,7 @@ struct tt_entry {
22/* We set this to _start in system setup. */ 22/* We set this to _start in system setup. */
23extern struct tt_entry *sparc_ttable; 23extern struct tt_entry *sparc_ttable;
24 24
25static inline unsigned long get_tbr(void) 25#endif /* (__KERNEL__) */
26{
27 unsigned long tbr;
28
29 __asm__ __volatile__("rd %%tbr, %0\n\t" : "=r" (tbr));
30 return tbr;
31}
32
33#endif /* !(__ASSEMBLY__) */ 26#endif /* !(__ASSEMBLY__) */
34 27
35/* For patching the trap table at boot time, we need to know how to 28/* For patching the trap table at boot time, we need to know how to
diff --git a/arch/sparc/kernel/irq_32.c b/arch/sparc/kernel/irq_32.c
index f3488c45d57a..1eff942fe22f 100644
--- a/arch/sparc/kernel/irq_32.c
+++ b/arch/sparc/kernel/irq_32.c
@@ -669,7 +669,9 @@ void __init init_IRQ(void)
669 btfixup(); 669 btfixup();
670} 670}
671 671
672#ifdef CONFIG_PROC_FS
672void init_irq_proc(void) 673void init_irq_proc(void)
673{ 674{
674 /* For now, nothing... */ 675 /* For now, nothing... */
675} 676}
677#endif /* CONFIG_PROC_FS */
diff --git a/arch/sparc/kernel/kgdb_32.c b/arch/sparc/kernel/kgdb_32.c
index 757805ce02ee..04df4edc0073 100644
--- a/arch/sparc/kernel/kgdb_32.c
+++ b/arch/sparc/kernel/kgdb_32.c
@@ -14,14 +14,14 @@ extern unsigned long trapbase;
14 14
15void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs) 15void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
16{ 16{
17 struct reg_window *win; 17 struct reg_window32 *win;
18 int i; 18 int i;
19 19
20 gdb_regs[GDB_G0] = 0; 20 gdb_regs[GDB_G0] = 0;
21 for (i = 0; i < 15; i++) 21 for (i = 0; i < 15; i++)
22 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i]; 22 gdb_regs[GDB_G1 + i] = regs->u_regs[UREG_G1 + i];
23 23
24 win = (struct reg_window *) regs->u_regs[UREG_FP]; 24 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
25 for (i = 0; i < 8; i++) 25 for (i = 0; i < 8; i++)
26 gdb_regs[GDB_L0 + i] = win->locals[i]; 26 gdb_regs[GDB_L0 + i] = win->locals[i];
27 for (i = 0; i < 8; i++) 27 for (i = 0; i < 8; i++)
@@ -43,7 +43,7 @@ void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
43void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 43void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
44{ 44{
45 struct thread_info *t = task_thread_info(p); 45 struct thread_info *t = task_thread_info(p);
46 struct reg_window *win; 46 struct reg_window32 *win;
47 int i; 47 int i;
48 48
49 for (i = GDB_G0; i < GDB_G6; i++) 49 for (i = GDB_G0; i < GDB_G6; i++)
@@ -55,7 +55,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
55 gdb_regs[GDB_SP] = t->ksp; 55 gdb_regs[GDB_SP] = t->ksp;
56 gdb_regs[GDB_O7] = 0; 56 gdb_regs[GDB_O7] = 0;
57 57
58 win = (struct reg_window *) t->ksp; 58 win = (struct reg_window32 *) t->ksp;
59 for (i = 0; i < 8; i++) 59 for (i = 0; i < 8; i++)
60 gdb_regs[GDB_L0 + i] = win->locals[i]; 60 gdb_regs[GDB_L0 + i] = win->locals[i];
61 for (i = 0; i < 8; i++) 61 for (i = 0; i < 8; i++)
@@ -77,7 +77,7 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
77 77
78void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs) 78void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
79{ 79{
80 struct reg_window *win; 80 struct reg_window32 *win;
81 int i; 81 int i;
82 82
83 for (i = 0; i < 15; i++) 83 for (i = 0; i < 15; i++)
@@ -96,7 +96,7 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
96 regs->npc = gdb_regs[GDB_NPC]; 96 regs->npc = gdb_regs[GDB_NPC];
97 regs->y = gdb_regs[GDB_Y]; 97 regs->y = gdb_regs[GDB_Y];
98 98
99 win = (struct reg_window *) regs->u_regs[UREG_FP]; 99 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
100 for (i = 0; i < 8; i++) 100 for (i = 0; i < 8; i++)
101 win->locals[i] = gdb_regs[GDB_L0 + i]; 101 win->locals[i] = gdb_regs[GDB_L0 + i];
102 for (i = 0; i < 8; i++) 102 for (i = 0; i < 8; i++)
diff --git a/arch/sparc/kernel/muldiv.c b/arch/sparc/kernel/muldiv.c
index ba960c02bb55..6ce1021d487c 100644
--- a/arch/sparc/kernel/muldiv.c
+++ b/arch/sparc/kernel/muldiv.c
@@ -60,7 +60,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
60} 60}
61 61
62#define fetch_reg(reg, regs) ({ \ 62#define fetch_reg(reg, regs) ({ \
63 struct reg_window __user *win; \ 63 struct reg_window32 __user *win; \
64 register unsigned long ret; \ 64 register unsigned long ret; \
65 \ 65 \
66 if (!(reg)) ret = 0; \ 66 if (!(reg)) ret = 0; \
@@ -68,7 +68,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
68 ret = regs->u_regs[(reg)]; \ 68 ret = regs->u_regs[(reg)]; \
69 } else { \ 69 } else { \
70 /* Ho hum, the slightly complicated case. */ \ 70 /* Ho hum, the slightly complicated case. */ \
71 win = (struct reg_window __user *)regs->u_regs[UREG_FP];\ 71 win = (struct reg_window32 __user *)regs->u_regs[UREG_FP];\
72 if (get_user (ret, &win->locals[(reg) - 16])) return -1;\ 72 if (get_user (ret, &win->locals[(reg) - 16])) return -1;\
73 } \ 73 } \
74 ret; \ 74 ret; \
@@ -77,7 +77,7 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2,
77static inline int 77static inline int
78store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs) 78store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
79{ 79{
80 struct reg_window __user *win; 80 struct reg_window32 __user *win;
81 81
82 if (!reg) 82 if (!reg)
83 return 0; 83 return 0;
@@ -86,7 +86,7 @@ store_reg(unsigned int result, unsigned int reg, struct pt_regs *regs)
86 return 0; 86 return 0;
87 } else { 87 } else {
88 /* need to use put_user() in this case: */ 88 /* need to use put_user() in this case: */
89 win = (struct reg_window __user *) regs->u_regs[UREG_FP]; 89 win = (struct reg_window32 __user *) regs->u_regs[UREG_FP];
90 return (put_user(result, &win->locals[reg - 16])); 90 return (put_user(result, &win->locals[reg - 16]));
91 } 91 }
92} 92}
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index dfb3ec892987..3b34344082ef 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -307,10 +307,7 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
307 307
308 /* We really mean to ignore the return result here. Two 308 /* We really mean to ignore the return result here. Two
309 * PCI controller share the same interrupt numbers and 309 * PCI controller share the same interrupt numbers and
310 * drive the same front-end hardware. Whichever of the 310 * drive the same front-end hardware.
311 * two get in here first will register the IRQ handler
312 * the second will just error out since we do not pass in
313 * IRQF_SHARED.
314 */ 311 */
315 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, 312 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED,
316 "PSYCHO_UE", pbm); 313 "PSYCHO_UE", pbm);
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index 69d9315f4a93..5a8d8ced33da 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -180,13 +180,13 @@ static DEFINE_SPINLOCK(sparc_backtrace_lock);
180 180
181void __show_backtrace(unsigned long fp) 181void __show_backtrace(unsigned long fp)
182{ 182{
183 struct reg_window *rw; 183 struct reg_window32 *rw;
184 unsigned long flags; 184 unsigned long flags;
185 int cpu = smp_processor_id(); 185 int cpu = smp_processor_id();
186 186
187 spin_lock_irqsave(&sparc_backtrace_lock, flags); 187 spin_lock_irqsave(&sparc_backtrace_lock, flags);
188 188
189 rw = (struct reg_window *)fp; 189 rw = (struct reg_window32 *)fp;
190 while(rw && (((unsigned long) rw) >= PAGE_OFFSET) && 190 while(rw && (((unsigned long) rw) >= PAGE_OFFSET) &&
191 !(((unsigned long) rw) & 0x7)) { 191 !(((unsigned long) rw) & 0x7)) {
192 printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] " 192 printk("CPU[%d]: ARGS[%08lx,%08lx,%08lx,%08lx,%08lx,%08lx] "
@@ -196,7 +196,7 @@ void __show_backtrace(unsigned long fp)
196 rw->ins[6], 196 rw->ins[6],
197 rw->ins[7]); 197 rw->ins[7]);
198 printk("%pS\n", (void *) rw->ins[7]); 198 printk("%pS\n", (void *) rw->ins[7]);
199 rw = (struct reg_window *) rw->ins[6]; 199 rw = (struct reg_window32 *) rw->ins[6];
200 } 200 }
201 spin_unlock_irqrestore(&sparc_backtrace_lock, flags); 201 spin_unlock_irqrestore(&sparc_backtrace_lock, flags);
202} 202}
@@ -258,7 +258,7 @@ void show_stackframe(struct sparc_stackf *sf)
258 258
259void show_regs(struct pt_regs *r) 259void show_regs(struct pt_regs *r)
260{ 260{
261 struct reg_window *rw = (struct reg_window *) r->u_regs[14]; 261 struct reg_window32 *rw = (struct reg_window32 *) r->u_regs[14];
262 262
263 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n", 263 printk("PSR: %08lx PC: %08lx NPC: %08lx Y: %08lx %s\n",
264 r->psr, r->pc, r->npc, r->y, print_tainted()); 264 r->psr, r->pc, r->npc, r->y, print_tainted());
@@ -287,7 +287,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
287{ 287{
288 unsigned long pc, fp; 288 unsigned long pc, fp;
289 unsigned long task_base; 289 unsigned long task_base;
290 struct reg_window *rw; 290 struct reg_window32 *rw;
291 int count = 0; 291 int count = 0;
292 292
293 if (tsk != NULL) 293 if (tsk != NULL)
@@ -301,7 +301,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
301 if (fp < (task_base + sizeof(struct thread_info)) || 301 if (fp < (task_base + sizeof(struct thread_info)) ||
302 fp >= (task_base + (PAGE_SIZE << 1))) 302 fp >= (task_base + (PAGE_SIZE << 1)))
303 break; 303 break;
304 rw = (struct reg_window *) fp; 304 rw = (struct reg_window32 *) fp;
305 pc = rw->ins[7]; 305 pc = rw->ins[7];
306 printk("[%08lx : ", pc); 306 printk("[%08lx : ", pc);
307 printk("%pS ] ", (void *) pc); 307 printk("%pS ] ", (void *) pc);
@@ -679,7 +679,7 @@ unsigned long get_wchan(struct task_struct *task)
679 unsigned long pc, fp, bias = 0; 679 unsigned long pc, fp, bias = 0;
680 unsigned long task_base = (unsigned long) task; 680 unsigned long task_base = (unsigned long) task;
681 unsigned long ret = 0; 681 unsigned long ret = 0;
682 struct reg_window *rw; 682 struct reg_window32 *rw;
683 int count = 0; 683 int count = 0;
684 684
685 if (!task || task == current || 685 if (!task || task == current ||
@@ -692,7 +692,7 @@ unsigned long get_wchan(struct task_struct *task)
692 if (fp < (task_base + sizeof(struct thread_info)) || 692 if (fp < (task_base + sizeof(struct thread_info)) ||
693 fp >= (task_base + (2 * PAGE_SIZE))) 693 fp >= (task_base + (2 * PAGE_SIZE)))
694 break; 694 break;
695 rw = (struct reg_window *) fp; 695 rw = (struct reg_window32 *) fp;
696 pc = rw->ins[7]; 696 pc = rw->ins[7];
697 if (!in_sched_functions(pc)) { 697 if (!in_sched_functions(pc)) {
698 ret = pc; 698 ret = pc;
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 4e9af593db49..ff7b591c8946 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -155,20 +155,12 @@ static struct property * __init build_one_prop(phandle node, char *prev,
155 p->value = prom_early_alloc(special_len); 155 p->value = prom_early_alloc(special_len);
156 memcpy(p->value, special_val, special_len); 156 memcpy(p->value, special_val, special_len);
157 } else { 157 } else {
158#ifdef CONFIG_SPARC32
159 if (prev == NULL) {
160 name = prom_firstprop(node, NULL);
161 } else {
162 name = prom_nextprop(node, prev, NULL);
163 }
164#else
165 if (prev == NULL) { 158 if (prev == NULL) {
166 prom_firstprop(node, p->name); 159 name = prom_firstprop(node, p->name);
167 } else { 160 } else {
168 prom_nextprop(node, prev, p->name); 161 name = prom_nextprop(node, prev, p->name);
169 } 162 }
170 name = p->name; 163
171#endif
172 if (strlen(name) == 0) { 164 if (strlen(name) == 0) {
173 tmp = p; 165 tmp = p;
174 return NULL; 166 return NULL;
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index c94f91c8b6e0..181d069a2d44 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -34,7 +34,7 @@ extern void fpload(unsigned long *fpregs, unsigned long *fsr);
34 34
35struct signal_frame { 35struct signal_frame {
36 struct sparc_stackf ss; 36 struct sparc_stackf ss;
37 __siginfo_t info; 37 __siginfo32_t info;
38 __siginfo_fpu_t __user *fpu_save; 38 __siginfo_fpu_t __user *fpu_save;
39 unsigned long insns[2] __attribute__ ((aligned (8))); 39 unsigned long insns[2] __attribute__ ((aligned (8)));
40 unsigned int extramask[_NSIG_WORDS - 1]; 40 unsigned int extramask[_NSIG_WORDS - 1];
@@ -351,7 +351,7 @@ static void setup_frame(struct k_sigaction *ka, struct pt_regs *regs,
351 err |= __copy_to_user(sf->extramask, &oldset->sig[1], 351 err |= __copy_to_user(sf->extramask, &oldset->sig[1],
352 (_NSIG_WORDS - 1) * sizeof(unsigned int)); 352 (_NSIG_WORDS - 1) * sizeof(unsigned int));
353 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 353 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
354 sizeof(struct reg_window)); 354 sizeof(struct reg_window32));
355 if (err) 355 if (err)
356 goto sigsegv; 356 goto sigsegv;
357 357
@@ -433,7 +433,7 @@ static void setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs,
433 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size); 433 err |= __put_user(current->sas_ss_size, &sf->stack.ss_size);
434 434
435 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP], 435 err |= __copy_to_user(sf, (char *) regs->u_regs[UREG_FP],
436 sizeof(struct reg_window)); 436 sizeof(struct reg_window32));
437 437
438 err |= copy_siginfo_to_user(&sf->info, info); 438 err |= copy_siginfo_to_user(&sf->info, info);
439 439
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c
index 716f3946c494..213645be6e92 100644
--- a/arch/sparc/kernel/traps_32.c
+++ b/arch/sparc/kernel/traps_32.c
@@ -67,7 +67,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
67 __RESTORE; __RESTORE; __RESTORE; __RESTORE; 67 __RESTORE; __RESTORE; __RESTORE; __RESTORE;
68 68
69 { 69 {
70 struct reg_window *rw = (struct reg_window *)regs->u_regs[UREG_FP]; 70 struct reg_window32 *rw = (struct reg_window32 *)regs->u_regs[UREG_FP];
71 71
72 /* Stop the back trace when we hit userland or we 72 /* Stop the back trace when we hit userland or we
73 * find some badly aligned kernel stack. Set an upper 73 * find some badly aligned kernel stack. Set an upper
@@ -79,7 +79,7 @@ void die_if_kernel(char *str, struct pt_regs *regs)
79 !(((unsigned long) rw) & 0x7)) { 79 !(((unsigned long) rw) & 0x7)) {
80 printk("Caller[%08lx]: %pS\n", rw->ins[7], 80 printk("Caller[%08lx]: %pS\n", rw->ins[7],
81 (void *) rw->ins[7]); 81 (void *) rw->ins[7]);
82 rw = (struct reg_window *)rw->ins[6]; 82 rw = (struct reg_window32 *)rw->ins[6];
83 } 83 }
84 } 84 }
85 printk("Instruction DUMP:"); 85 printk("Instruction DUMP:");
diff --git a/arch/sparc/kernel/unaligned_32.c b/arch/sparc/kernel/unaligned_32.c
index c2a28c5ad650..6b1e6cde6fff 100644
--- a/arch/sparc/kernel/unaligned_32.c
+++ b/arch/sparc/kernel/unaligned_32.c
@@ -97,26 +97,26 @@ static inline int sign_extend_imm13(int imm)
97 97
98static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) 98static inline unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
99{ 99{
100 struct reg_window *win; 100 struct reg_window32 *win;
101 101
102 if(reg < 16) 102 if(reg < 16)
103 return (!reg ? 0 : regs->u_regs[reg]); 103 return (!reg ? 0 : regs->u_regs[reg]);
104 104
105 /* Ho hum, the slightly complicated case. */ 105 /* Ho hum, the slightly complicated case. */
106 win = (struct reg_window *) regs->u_regs[UREG_FP]; 106 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
107 return win->locals[reg - 16]; /* yes, I know what this does... */ 107 return win->locals[reg - 16]; /* yes, I know what this does... */
108} 108}
109 109
110static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs) 110static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *regs)
111{ 111{
112 struct reg_window __user *win; 112 struct reg_window32 __user *win;
113 unsigned long ret; 113 unsigned long ret;
114 114
115 if (reg < 16) 115 if (reg < 16)
116 return (!reg ? 0 : regs->u_regs[reg]); 116 return (!reg ? 0 : regs->u_regs[reg]);
117 117
118 /* Ho hum, the slightly complicated case. */ 118 /* Ho hum, the slightly complicated case. */
119 win = (struct reg_window __user *) regs->u_regs[UREG_FP]; 119 win = (struct reg_window32 __user *) regs->u_regs[UREG_FP];
120 120
121 if ((unsigned long)win & 3) 121 if ((unsigned long)win & 3)
122 return -1; 122 return -1;
@@ -129,11 +129,11 @@ static inline unsigned long safe_fetch_reg(unsigned int reg, struct pt_regs *reg
129 129
130static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs) 130static inline unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
131{ 131{
132 struct reg_window *win; 132 struct reg_window32 *win;
133 133
134 if(reg < 16) 134 if(reg < 16)
135 return &regs->u_regs[reg]; 135 return &regs->u_regs[reg];
136 win = (struct reg_window *) regs->u_regs[UREG_FP]; 136 win = (struct reg_window32 *) regs->u_regs[UREG_FP];
137 return &win->locals[reg - 16]; 137 return &win->locals[reg - 16];
138} 138}
139 139
diff --git a/arch/sparc/kernel/windows.c b/arch/sparc/kernel/windows.c
index 9cc93eaa4abf..f24d298bda29 100644
--- a/arch/sparc/kernel/windows.c
+++ b/arch/sparc/kernel/windows.c
@@ -42,7 +42,7 @@ static inline void shift_window_buffer(int first_win, int last_win, struct threa
42 42
43 for(i = first_win; i < last_win; i++) { 43 for(i = first_win; i < last_win; i++) {
44 tp->rwbuf_stkptrs[i] = tp->rwbuf_stkptrs[i+1]; 44 tp->rwbuf_stkptrs[i] = tp->rwbuf_stkptrs[i+1];
45 memcpy(&tp->reg_window[i], &tp->reg_window[i+1], sizeof(struct reg_window)); 45 memcpy(&tp->reg_window[i], &tp->reg_window[i+1], sizeof(struct reg_window32));
46 } 46 }
47} 47}
48 48
@@ -70,7 +70,7 @@ void synchronize_user_stack(void)
70 70
71 /* Ok, let it rip. */ 71 /* Ok, let it rip. */
72 if (copy_to_user((char __user *) sp, &tp->reg_window[window], 72 if (copy_to_user((char __user *) sp, &tp->reg_window[window],
73 sizeof(struct reg_window))) 73 sizeof(struct reg_window32)))
74 continue; 74 continue;
75 75
76 shift_window_buffer(window, tp->w_saved - 1, tp); 76 shift_window_buffer(window, tp->w_saved - 1, tp);
@@ -119,7 +119,7 @@ void try_to_clear_window_buffer(struct pt_regs *regs, int who)
119 119
120 if ((sp & 7) || 120 if ((sp & 7) ||
121 copy_to_user((char __user *) sp, &tp->reg_window[window], 121 copy_to_user((char __user *) sp, &tp->reg_window[window],
122 sizeof(struct reg_window))) 122 sizeof(struct reg_window32)))
123 do_exit(SIGILL); 123 do_exit(SIGILL);
124 } 124 }
125 tp->w_saved = 0; 125 tp->w_saved = 0;
diff --git a/arch/um/Makefile b/arch/um/Makefile
index d944c343acdb..0728def32234 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -22,10 +22,11 @@ MODE_INCLUDE += -I$(srctree)/$(ARCH_DIR)/include/shared/skas
22 22
23include $(srctree)/$(ARCH_DIR)/Makefile-skas 23include $(srctree)/$(ARCH_DIR)/Makefile-skas
24 24
25ARCH_INCLUDE := -I$(srctree)/$(ARCH_DIR)/include/shared 25SHARED_HEADERS := $(ARCH_DIR)/include/shared
26ARCH_INCLUDE := -I$(srctree)/$(SHARED_HEADERS)
26ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared 27ARCH_INCLUDE += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)/shared
27ifneq ($(KBUILD_SRC),) 28ifneq ($(KBUILD_SRC),)
28ARCH_INCLUDE += -I$(ARCH_DIR)/include/shared # for two generated files 29ARCH_INCLUDE += -I$(SHARED_HEADERS)
29endif 30endif
30KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH) 31KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)
31 32
@@ -85,8 +86,8 @@ endef
85 86
86KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH) 87KBUILD_KCONFIG := arch/um/Kconfig.$(HEADER_ARCH)
87 88
88archprepare: $(ARCH_DIR)/include/shared/user_constants.h 89archprepare: $(SHARED_HEADERS)/user_constants.h
89prepare: $(ARCH_DIR)/include/shared/kern_constants.h 90archprepare: $(SHARED_HEADERS)/kern_constants.h
90 91
91LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static 92LINK-$(CONFIG_LD_SCRIPT_STATIC) += -static
92LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib 93LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib
@@ -119,17 +120,13 @@ endef
119# When cleaning we don't include .config, so we don't include 120# When cleaning we don't include .config, so we don't include
120# TT or skas makefiles and don't clean skas_ptregs.h. 121# TT or skas makefiles and don't clean skas_ptregs.h.
121CLEAN_FILES += linux x.i gmon.out \ 122CLEAN_FILES += linux x.i gmon.out \
122 $(ARCH_DIR)/include/shared/user_constants.h \ 123 $(SHARED_HEADERS)/user_constants.h \
123 $(ARCH_DIR)/include/shared/kern_constants.h 124 $(SHARED_HEADERS)/kern_constants.h
124 125
125archclean: 126archclean:
126 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \ 127 @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
127 -o -name '*.gcov' \) -type f -print | xargs rm -f 128 -o -name '*.gcov' \) -type f -print | xargs rm -f
128 129
129$(objtree)/$(ARCH_DIR)/include/shared:
130 @echo ' MKDIR $@'
131 $(Q)mkdir -p $@
132
133# Generated files 130# Generated files
134 131
135$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE 132$(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s: FORCE
@@ -148,11 +145,11 @@ define filechk_gen-asm-offsets
148 echo ""; ) 145 echo ""; )
149endef 146endef
150 147
151$(ARCH_DIR)/include/shared/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s 148$(SHARED_HEADERS)/user_constants.h: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.s
152 $(call filechk,gen-asm-offsets) 149 $(call filechk,gen-asm-offsets)
153 150
154$(ARCH_DIR)/include/shared/kern_constants.h: $(objtree)/$(ARCH_DIR)/include/shared 151$(SHARED_HEADERS)/kern_constants.h:
155 @echo ' SYMLINK $@' 152 $(Q)mkdir -p $(dir $@)
156 $(Q)ln -sf ../../../../include/asm/asm-offsets.h $@ 153 $(Q)echo '#include "../../../../include/asm/asm-offsets.h"' >$@
157 154
158export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH 155export SUBARCH USER_CFLAGS CFLAGS_NO_HARDENING OS HEADER_ARCH DEV_NULL_PATH
diff --git a/arch/um/include/asm/system.h b/arch/um/include/asm/system.h
index ae5f94d6317d..753346e2cdfd 100644
--- a/arch/um/include/asm/system.h
+++ b/arch/um/include/asm/system.h
@@ -11,21 +11,21 @@ extern int get_signals(void);
11extern void block_signals(void); 11extern void block_signals(void);
12extern void unblock_signals(void); 12extern void unblock_signals(void);
13 13
14#define raw_local_save_flags(flags) do { typecheck(unsigned long, flags); \ 14#define local_save_flags(flags) do { typecheck(unsigned long, flags); \
15 (flags) = get_signals(); } while(0) 15 (flags) = get_signals(); } while(0)
16#define raw_local_irq_restore(flags) do { typecheck(unsigned long, flags); \ 16#define local_irq_restore(flags) do { typecheck(unsigned long, flags); \
17 set_signals(flags); } while(0) 17 set_signals(flags); } while(0)
18 18
19#define raw_local_irq_save(flags) do { raw_local_save_flags(flags); \ 19#define local_irq_save(flags) do { local_save_flags(flags); \
20 raw_local_irq_disable(); } while(0) 20 local_irq_disable(); } while(0)
21 21
22#define raw_local_irq_enable() unblock_signals() 22#define local_irq_enable() unblock_signals()
23#define raw_local_irq_disable() block_signals() 23#define local_irq_disable() block_signals()
24 24
25#define irqs_disabled() \ 25#define irqs_disabled() \
26({ \ 26({ \
27 unsigned long flags; \ 27 unsigned long flags; \
28 raw_local_save_flags(flags); \ 28 local_save_flags(flags); \
29 (flags == 0); \ 29 (flags == 0); \
30}) 30})
31 31
diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
index 85a78575956c..8078955845ae 100644
--- a/arch/x86/Kconfig.cpu
+++ b/arch/x86/Kconfig.cpu
@@ -408,7 +408,7 @@ config X86_MINIMUM_CPU_FAMILY
408 408
409config X86_DEBUGCTLMSR 409config X86_DEBUGCTLMSR
410 def_bool y 410 def_bool y
411 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) 411 depends on !(MK6 || MWINCHIPC6 || MWINCHIP3D || MCYRIXIII || M586MMX || M586TSC || M586 || M486 || M386) && !UML
412 412
413menuconfig PROCESSOR_SELECT 413menuconfig PROCESSOR_SELECT
414 bool "Supported processor vendors" if EMBEDDED 414 bool "Supported processor vendors" if EMBEDDED
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index b8e05ee4f736..beea4466b063 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -160,6 +160,7 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
160 switch (c->x86_model) { 160 switch (c->x86_model) {
161 case 0x0E: /* Core */ 161 case 0x0E: /* Core */
162 case 0x0F: /* Core Duo */ 162 case 0x0F: /* Core Duo */
163 case 0x16: /* Celeron Core */
163 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS; 164 p4clockmod_driver.flags |= CPUFREQ_CONST_LOOPS;
164 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE); 165 return speedstep_get_processor_frequency(SPEEDSTEP_PROCESSOR_PCORE);
165 case 0x0D: /* Pentium M (Dothan) */ 166 case 0x0D: /* Pentium M (Dothan) */
@@ -171,7 +172,9 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
171 } 172 }
172 173
173 if (c->x86 != 0xF) { 174 if (c->x86 != 0xF) {
174 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. Please send an e-mail to <cpufreq@vger.kernel.org>\n"); 175 if (!cpu_has(c, X86_FEATURE_EST))
176 printk(KERN_WARNING PFX "Unknown p4-clockmod-capable CPU. "
177 "Please send an e-mail to <cpufreq@vger.kernel.org>\n");
175 return 0; 178 return 0;
176 } 179 }
177 180
@@ -274,6 +277,7 @@ static struct cpufreq_driver p4clockmod_driver = {
274 .name = "p4-clockmod", 277 .name = "p4-clockmod",
275 .owner = THIS_MODULE, 278 .owner = THIS_MODULE,
276 .attr = p4clockmod_attr, 279 .attr = p4clockmod_attr,
280 .hide_interface = 1,
277}; 281};
278 282
279 283
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index 3b5f06423e77..f0ea6fa2f53c 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -459,9 +459,7 @@ static int centrino_verify (struct cpufreq_policy *policy)
459 * Sets a new CPUFreq policy. 459 * Sets a new CPUFreq policy.
460 */ 460 */
461struct allmasks { 461struct allmasks {
462 cpumask_t online_policy_cpus;
463 cpumask_t saved_mask; 462 cpumask_t saved_mask;
464 cpumask_t set_mask;
465 cpumask_t covered_cpus; 463 cpumask_t covered_cpus;
466}; 464};
467 465
@@ -475,9 +473,7 @@ static int centrino_target (struct cpufreq_policy *policy,
475 int retval = 0; 473 int retval = 0;
476 unsigned int j, k, first_cpu, tmp; 474 unsigned int j, k, first_cpu, tmp;
477 CPUMASK_ALLOC(allmasks); 475 CPUMASK_ALLOC(allmasks);
478 CPUMASK_PTR(online_policy_cpus, allmasks);
479 CPUMASK_PTR(saved_mask, allmasks); 476 CPUMASK_PTR(saved_mask, allmasks);
480 CPUMASK_PTR(set_mask, allmasks);
481 CPUMASK_PTR(covered_cpus, allmasks); 477 CPUMASK_PTR(covered_cpus, allmasks);
482 478
483 if (unlikely(allmasks == NULL)) 479 if (unlikely(allmasks == NULL))
@@ -497,30 +493,28 @@ static int centrino_target (struct cpufreq_policy *policy,
497 goto out; 493 goto out;
498 } 494 }
499 495
500#ifdef CONFIG_HOTPLUG_CPU
501 /* cpufreq holds the hotplug lock, so we are safe from here on */
502 cpus_and(*online_policy_cpus, cpu_online_map, policy->cpus);
503#else
504 *online_policy_cpus = policy->cpus;
505#endif
506
507 *saved_mask = current->cpus_allowed; 496 *saved_mask = current->cpus_allowed;
508 first_cpu = 1; 497 first_cpu = 1;
509 cpus_clear(*covered_cpus); 498 cpus_clear(*covered_cpus);
510 for_each_cpu_mask_nr(j, *online_policy_cpus) { 499 for_each_cpu_mask_nr(j, policy->cpus) {
500 const cpumask_t *mask;
501
502 /* cpufreq holds the hotplug lock, so we are safe here */
503 if (!cpu_online(j))
504 continue;
505
511 /* 506 /*
512 * Support for SMP systems. 507 * Support for SMP systems.
513 * Make sure we are running on CPU that wants to change freq 508 * Make sure we are running on CPU that wants to change freq
514 */ 509 */
515 cpus_clear(*set_mask);
516 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 510 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
517 cpus_or(*set_mask, *set_mask, *online_policy_cpus); 511 mask = &policy->cpus;
518 else 512 else
519 cpu_set(j, *set_mask); 513 mask = &cpumask_of_cpu(j);
520 514
521 set_cpus_allowed_ptr(current, set_mask); 515 set_cpus_allowed_ptr(current, mask);
522 preempt_disable(); 516 preempt_disable();
523 if (unlikely(!cpu_isset(smp_processor_id(), *set_mask))) { 517 if (unlikely(!cpu_isset(smp_processor_id(), *mask))) {
524 dprintk("couldn't limit to CPUs in this domain\n"); 518 dprintk("couldn't limit to CPUs in this domain\n");
525 retval = -EAGAIN; 519 retval = -EAGAIN;
526 if (first_cpu) { 520 if (first_cpu) {
@@ -548,7 +542,9 @@ static int centrino_target (struct cpufreq_policy *policy,
548 dprintk("target=%dkHz old=%d new=%d msr=%04x\n", 542 dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
549 target_freq, freqs.old, freqs.new, msr); 543 target_freq, freqs.old, freqs.new, msr);
550 544
551 for_each_cpu_mask_nr(k, *online_policy_cpus) { 545 for_each_cpu_mask_nr(k, policy->cpus) {
546 if (!cpu_online(k))
547 continue;
552 freqs.cpu = k; 548 freqs.cpu = k;
553 cpufreq_notify_transition(&freqs, 549 cpufreq_notify_transition(&freqs,
554 CPUFREQ_PRECHANGE); 550 CPUFREQ_PRECHANGE);
@@ -571,7 +567,9 @@ static int centrino_target (struct cpufreq_policy *policy,
571 preempt_enable(); 567 preempt_enable();
572 } 568 }
573 569
574 for_each_cpu_mask_nr(k, *online_policy_cpus) { 570 for_each_cpu_mask_nr(k, policy->cpus) {
571 if (!cpu_online(k))
572 continue;
575 freqs.cpu = k; 573 freqs.cpu = k;
576 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 574 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
577 } 575 }
@@ -584,18 +582,17 @@ static int centrino_target (struct cpufreq_policy *policy,
584 * Best effort undo.. 582 * Best effort undo..
585 */ 583 */
586 584
587 if (!cpus_empty(*covered_cpus)) 585 for_each_cpu_mask_nr(j, *covered_cpus) {
588 for_each_cpu_mask_nr(j, *covered_cpus) { 586 set_cpus_allowed_ptr(current, &cpumask_of_cpu(j));
589 set_cpus_allowed_ptr(current, 587 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
590 &cpumask_of_cpu(j)); 588 }
591 wrmsr(MSR_IA32_PERF_CTL, oldmsr, h);
592 }
593 589
594 tmp = freqs.new; 590 tmp = freqs.new;
595 freqs.new = freqs.old; 591 freqs.new = freqs.old;
596 freqs.old = tmp; 592 freqs.old = tmp;
597 for_each_cpu_mask_nr(j, *online_policy_cpus) { 593 for_each_cpu_mask_nr(j, policy->cpus) {
598 freqs.cpu = j; 594 if (!cpu_online(j))
595 continue;
599 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 596 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
600 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 597 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
601 } 598 }
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
index 98d4fdb7dc04..cdac7d62369b 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-lib.c
@@ -139,6 +139,15 @@ static unsigned int pentium_core_get_frequency(void)
139 case 3: 139 case 3:
140 fsb = 166667; 140 fsb = 166667;
141 break; 141 break;
142 case 2:
143 fsb = 200000;
144 break;
145 case 0:
146 fsb = 266667;
147 break;
148 case 4:
149 fsb = 333333;
150 break;
142 default: 151 default:
143 printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value"); 152 printk(KERN_ERR "PCORE - MSR_FSB_FREQ undefined value");
144 } 153 }
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 242c3440687f..8cba3749a511 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -13,7 +13,7 @@
13 13
14int swiotlb __read_mostly; 14int swiotlb __read_mostly;
15 15
16void *swiotlb_alloc_boot(size_t size, unsigned long nslabs) 16void * __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
17{ 17{
18 return alloc_bootmem_low_pages(size); 18 return alloc_bootmem_low_pages(size);
19} 19}
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 31d6f535a79d..01dde80597f7 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -754,6 +754,11 @@ static struct kobj_type ktype_cpufreq = {
754 .release = cpufreq_sysfs_release, 754 .release = cpufreq_sysfs_release,
755}; 755};
756 756
757static struct kobj_type ktype_empty_cpufreq = {
758 .sysfs_ops = &sysfs_ops,
759 .release = cpufreq_sysfs_release,
760};
761
757 762
758/** 763/**
759 * cpufreq_add_dev - add a CPU device 764 * cpufreq_add_dev - add a CPU device
@@ -822,8 +827,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
822 dprintk("initialization failed\n"); 827 dprintk("initialization failed\n");
823 goto err_out; 828 goto err_out;
824 } 829 }
825 policy->user_policy.min = policy->cpuinfo.min_freq; 830 policy->user_policy.min = policy->min;
826 policy->user_policy.max = policy->cpuinfo.max_freq; 831 policy->user_policy.max = policy->max;
827 832
828 blocking_notifier_call_chain(&cpufreq_policy_notifier_list, 833 blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
829 CPUFREQ_START, policy); 834 CPUFREQ_START, policy);
@@ -876,26 +881,36 @@ static int cpufreq_add_dev(struct sys_device *sys_dev)
876 memcpy(&new_policy, policy, sizeof(struct cpufreq_policy)); 881 memcpy(&new_policy, policy, sizeof(struct cpufreq_policy));
877 882
878 /* prepare interface data */ 883 /* prepare interface data */
879 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, 884 if (!cpufreq_driver->hide_interface) {
880 "cpufreq"); 885 ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq,
881 if (ret) 886 &sys_dev->kobj, "cpufreq");
882 goto err_out_driver_exit;
883
884 /* set up files for this cpu device */
885 drv_attr = cpufreq_driver->attr;
886 while ((drv_attr) && (*drv_attr)) {
887 ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr));
888 if (ret) 887 if (ret)
889 goto err_out_driver_exit; 888 goto err_out_driver_exit;
890 drv_attr++; 889
891 } 890 /* set up files for this cpu device */
892 if (cpufreq_driver->get) { 891 drv_attr = cpufreq_driver->attr;
893 ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); 892 while ((drv_attr) && (*drv_attr)) {
894 if (ret) 893 ret = sysfs_create_file(&policy->kobj,
895 goto err_out_driver_exit; 894 &((*drv_attr)->attr));
896 } 895 if (ret)
897 if (cpufreq_driver->target) { 896 goto err_out_driver_exit;
898 ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); 897 drv_attr++;
898 }
899 if (cpufreq_driver->get) {
900 ret = sysfs_create_file(&policy->kobj,
901 &cpuinfo_cur_freq.attr);
902 if (ret)
903 goto err_out_driver_exit;
904 }
905 if (cpufreq_driver->target) {
906 ret = sysfs_create_file(&policy->kobj,
907 &scaling_cur_freq.attr);
908 if (ret)
909 goto err_out_driver_exit;
910 }
911 } else {
912 ret = kobject_init_and_add(&policy->kobj, &ktype_empty_cpufreq,
913 &sys_dev->kobj, "cpufreq");
899 if (ret) 914 if (ret)
900 goto err_out_driver_exit; 915 goto err_out_driver_exit;
901 } 916 }
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig
index b4fd8ca701a4..e85c8fe9ffcf 100644
--- a/drivers/hid/Kconfig
+++ b/drivers/hid/Kconfig
@@ -85,14 +85,14 @@ config HID_COMPAT
85config HID_A4TECH 85config HID_A4TECH
86 tristate "A4 tech" if EMBEDDED 86 tristate "A4 tech" if EMBEDDED
87 depends on USB_HID 87 depends on USB_HID
88 default y 88 default !EMBEDDED
89 ---help--- 89 ---help---
90 Support for A4 tech X5 and WOP-35 / Trust 450L mice. 90 Support for A4 tech X5 and WOP-35 / Trust 450L mice.
91 91
92config HID_APPLE 92config HID_APPLE
93 tristate "Apple" if EMBEDDED 93 tristate "Apple" if EMBEDDED
94 depends on (USB_HID || BT_HIDP) 94 depends on (USB_HID || BT_HIDP)
95 default y 95 default !EMBEDDED
96 ---help--- 96 ---help---
97 Support for some Apple devices which less or more break 97 Support for some Apple devices which less or more break
98 HID specification. 98 HID specification.
@@ -103,64 +103,49 @@ config HID_APPLE
103config HID_BELKIN 103config HID_BELKIN
104 tristate "Belkin" if EMBEDDED 104 tristate "Belkin" if EMBEDDED
105 depends on USB_HID 105 depends on USB_HID
106 default y 106 default !EMBEDDED
107 ---help--- 107 ---help---
108 Support for Belkin Flip KVM and Wireless keyboard. 108 Support for Belkin Flip KVM and Wireless keyboard.
109 109
110config HID_BRIGHT
111 tristate "Bright" if EMBEDDED
112 depends on USB_HID
113 default y
114 ---help---
115 Support for Bright ABNT-2 keyboard.
116
117config HID_CHERRY 110config HID_CHERRY
118 tristate "Cherry" if EMBEDDED 111 tristate "Cherry" if EMBEDDED
119 depends on USB_HID 112 depends on USB_HID
120 default y 113 default !EMBEDDED
121 ---help--- 114 ---help---
122 Support for Cherry Cymotion keyboard. 115 Support for Cherry Cymotion keyboard.
123 116
124config HID_CHICONY 117config HID_CHICONY
125 tristate "Chicony" if EMBEDDED 118 tristate "Chicony" if EMBEDDED
126 depends on USB_HID 119 depends on USB_HID
127 default y 120 default !EMBEDDED
128 ---help--- 121 ---help---
129 Support for Chicony Tactical pad. 122 Support for Chicony Tactical pad.
130 123
131config HID_CYPRESS 124config HID_CYPRESS
132 tristate "Cypress" if EMBEDDED 125 tristate "Cypress" if EMBEDDED
133 depends on USB_HID 126 depends on USB_HID
134 default y 127 default !EMBEDDED
135 ---help--- 128 ---help---
136 Support for cypress mouse and barcode readers. 129 Support for cypress mouse and barcode readers.
137 130
138config HID_DELL
139 tristate "Dell" if EMBEDDED
140 depends on USB_HID
141 default y
142 ---help---
143 Support for quirky Dell HID hardware that require
144 special LED handling (W7658 and SK8115 models)
145
146config HID_EZKEY 131config HID_EZKEY
147 tristate "Ezkey" if EMBEDDED 132 tristate "Ezkey" if EMBEDDED
148 depends on USB_HID 133 depends on USB_HID
149 default y 134 default !EMBEDDED
150 ---help--- 135 ---help---
151 Support for Ezkey BTC 8193 keyboard. 136 Support for Ezkey BTC 8193 keyboard.
152 137
153config HID_GYRATION 138config HID_GYRATION
154 tristate "Gyration" if EMBEDDED 139 tristate "Gyration" if EMBEDDED
155 depends on USB_HID 140 depends on USB_HID
156 default y 141 default !EMBEDDED
157 ---help--- 142 ---help---
158 Support for Gyration remote control. 143 Support for Gyration remote control.
159 144
160config HID_LOGITECH 145config HID_LOGITECH
161 tristate "Logitech" if EMBEDDED 146 tristate "Logitech" if EMBEDDED
162 depends on USB_HID 147 depends on USB_HID
163 default y 148 default !EMBEDDED
164 ---help--- 149 ---help---
165 Support for Logitech devices that are not fully compliant with HID standard. 150 Support for Logitech devices that are not fully compliant with HID standard.
166 151
@@ -191,21 +176,28 @@ config LOGIRUMBLEPAD2_FF
191config HID_MICROSOFT 176config HID_MICROSOFT
192 tristate "Microsoft" if EMBEDDED 177 tristate "Microsoft" if EMBEDDED
193 depends on USB_HID 178 depends on USB_HID
194 default y 179 default !EMBEDDED
195 ---help--- 180 ---help---
196 Support for Microsoft devices that are not fully compliant with HID standard. 181 Support for Microsoft devices that are not fully compliant with HID standard.
197 182
198config HID_MONTEREY 183config HID_MONTEREY
199 tristate "Monterey" if EMBEDDED 184 tristate "Monterey" if EMBEDDED
200 depends on USB_HID 185 depends on USB_HID
201 default y 186 default !EMBEDDED
202 ---help--- 187 ---help---
203 Support for Monterey Genius KB29E. 188 Support for Monterey Genius KB29E.
204 189
190config HID_NTRIG
191 tristate "NTrig" if EMBEDDED
192 depends on USB_HID
193 default !EMBEDDED
194 ---help---
195 Support for N-Trig touch screen.
196
205config HID_PANTHERLORD 197config HID_PANTHERLORD
206 tristate "Pantherlord devices support" if EMBEDDED 198 tristate "Pantherlord devices support" if EMBEDDED
207 depends on USB_HID 199 depends on USB_HID
208 default y 200 default !EMBEDDED
209 ---help--- 201 ---help---
210 Support for PantherLord/GreenAsia based device support. 202 Support for PantherLord/GreenAsia based device support.
211 203
@@ -220,31 +212,47 @@ config PANTHERLORD_FF
220config HID_PETALYNX 212config HID_PETALYNX
221 tristate "Petalynx" if EMBEDDED 213 tristate "Petalynx" if EMBEDDED
222 depends on USB_HID 214 depends on USB_HID
223 default y 215 default !EMBEDDED
224 ---help--- 216 ---help---
225 Support for Petalynx Maxter remote control. 217 Support for Petalynx Maxter remote control.
226 218
227config HID_SAMSUNG 219config HID_SAMSUNG
228 tristate "Samsung" if EMBEDDED 220 tristate "Samsung" if EMBEDDED
229 depends on USB_HID 221 depends on USB_HID
230 default y 222 default !EMBEDDED
231 ---help--- 223 ---help---
232 Support for Samsung InfraRed remote control. 224 Support for Samsung InfraRed remote control.
233 225
234config HID_SONY 226config HID_SONY
235 tristate "Sony" if EMBEDDED 227 tristate "Sony" if EMBEDDED
236 depends on USB_HID 228 depends on USB_HID
237 default y 229 default !EMBEDDED
238 ---help--- 230 ---help---
239 Support for Sony PS3 controller. 231 Support for Sony PS3 controller.
240 232
241config HID_SUNPLUS 233config HID_SUNPLUS
242 tristate "Sunplus" if EMBEDDED 234 tristate "Sunplus" if EMBEDDED
243 depends on USB_HID 235 depends on USB_HID
244 default y 236 default !EMBEDDED
245 ---help--- 237 ---help---
246 Support for Sunplus wireless desktop. 238 Support for Sunplus wireless desktop.
247 239
240config GREENASIA_FF
241 tristate "GreenAsia (Product ID 0x12) force feedback support"
242 depends on USB_HID
243 select INPUT_FF_MEMLESS
244 ---help---
245 Say Y here if you have a GreenAsia (Product ID 0x12) based game controller
246 (like MANTA Warior MM816 and SpeedLink Strike2 SL-6635) or adapter
247 and want to enable force feedback support for it.
248
249config HID_TOPSEED
250 tristate "TopSeed Cyberlink remote control support" if EMBEDDED
251 depends on USB_HID
252 default !EMBEDDED
253 ---help---
254 Say Y if you have a TopSeed Cyberlink remote control.
255
248config THRUSTMASTER_FF 256config THRUSTMASTER_FF
249 tristate "ThrustMaster devices support" 257 tristate "ThrustMaster devices support"
250 depends on USB_HID 258 depends on USB_HID
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile
index b09e43e7413e..fbd021f153f1 100644
--- a/drivers/hid/Makefile
+++ b/drivers/hid/Makefile
@@ -23,22 +23,23 @@ endif
23obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o 23obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
24obj-$(CONFIG_HID_APPLE) += hid-apple.o 24obj-$(CONFIG_HID_APPLE) += hid-apple.o
25obj-$(CONFIG_HID_BELKIN) += hid-belkin.o 25obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
26obj-$(CONFIG_HID_BRIGHT) += hid-bright.o
27obj-$(CONFIG_HID_CHERRY) += hid-cherry.o 26obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
28obj-$(CONFIG_HID_CHICONY) += hid-chicony.o 27obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
29obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o 28obj-$(CONFIG_HID_CYPRESS) += hid-cypress.o
30obj-$(CONFIG_HID_DELL) += hid-dell.o
31obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o 29obj-$(CONFIG_HID_EZKEY) += hid-ezkey.o
32obj-$(CONFIG_HID_GYRATION) += hid-gyration.o 30obj-$(CONFIG_HID_GYRATION) += hid-gyration.o
33obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o 31obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
34obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o 32obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
35obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o 33obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
34obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
36obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o 35obj-$(CONFIG_HID_PANTHERLORD) += hid-pl.o
37obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o 36obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
38obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o 37obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o
39obj-$(CONFIG_HID_SONY) += hid-sony.o 38obj-$(CONFIG_HID_SONY) += hid-sony.o
40obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o 39obj-$(CONFIG_HID_SUNPLUS) += hid-sunplus.o
40obj-$(CONFIG_GREENASIA_FF) += hid-gaff.o
41obj-$(CONFIG_THRUSTMASTER_FF) += hid-tmff.o 41obj-$(CONFIG_THRUSTMASTER_FF) += hid-tmff.o
42obj-$(CONFIG_HID_TOPSEED) += hid-topseed.o
42obj-$(CONFIG_ZEROPLUS_FF) += hid-zpff.o 43obj-$(CONFIG_ZEROPLUS_FF) += hid-zpff.o
43 44
44obj-$(CONFIG_USB_HID) += usbhid/ 45obj-$(CONFIG_USB_HID) += usbhid/
diff --git a/drivers/hid/hid-bright.c b/drivers/hid/hid-bright.c
deleted file mode 100644
index 38517a117dfd..000000000000
--- a/drivers/hid/hid-bright.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * HID driver for some bright "special" devices
3 *
4 * Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@redhat.com>
5 *
6 * Based on hid-dell driver
7 */
8
9/*
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 */
15
16#include <linux/device.h>
17#include <linux/hid.h>
18#include <linux/module.h>
19
20#include "hid-ids.h"
21
22static int bright_probe(struct hid_device *hdev, const struct hid_device_id *id)
23{
24 int ret;
25
26 ret = hid_parse(hdev);
27 if (ret) {
28 dev_err(&hdev->dev, "parse failed\n");
29 goto err_free;
30 }
31
32 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
33 if (ret) {
34 dev_err(&hdev->dev, "hw start failed\n");
35 goto err_free;
36 }
37
38 usbhid_set_leds(hdev);
39
40 return 0;
41err_free:
42 return ret;
43}
44
45static const struct hid_device_id bright_devices[] = {
46 { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
47 { }
48};
49MODULE_DEVICE_TABLE(hid, bright_devices);
50
51static struct hid_driver bright_driver = {
52 .name = "bright",
53 .id_table = bright_devices,
54 .probe = bright_probe,
55};
56
57static int bright_init(void)
58{
59 return hid_register_driver(&bright_driver);
60}
61
62static void bright_exit(void)
63{
64 hid_unregister_driver(&bright_driver);
65}
66
67module_init(bright_init);
68module_exit(bright_exit);
69MODULE_LICENSE("GPL");
70
71HID_COMPAT_LOAD_DRIVER(bright);
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 40df3e1b4bd1..5d7640e49dc5 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1256,19 +1256,16 @@ static const struct hid_device_id hid_blacklist[] = {
1256 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1256 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1257 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1257 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1258 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, 1258 { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
1259 { HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
1260 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, 1259 { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
1261 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) }, 1260 { HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) }, 1261 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) }, 1262 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
1264 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) }, 1263 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
1265 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
1266 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
1267 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) }, 1264 { HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
1269 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) }, 1265 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
1270 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) }, 1266 { HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
1271 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) }, 1267 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
1268 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012) },
1272 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) }, 1269 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE) },
1273 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) }, 1270 { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_2) },
1274 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, 1271 { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) },
@@ -1279,7 +1276,6 @@ static const struct hid_device_id hid_blacklist[] = {
1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, 1276 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, 1277 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, 1278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
1282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) },
1283 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) }, 1279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
1284 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) }, 1280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
1285 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) }, 1281 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },
@@ -1297,23 +1293,105 @@ static const struct hid_device_id hid_blacklist[] = {
1297 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, 1293 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) },
1298 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) }, 1294 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
1299 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, 1295 { HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
1296 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
1300 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, 1297 { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
1301 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, 1298 { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) }, 1299 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
1303 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) }, 1300 { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
1304 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) }, 1301 { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
1302 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
1305 1303
1306 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) }, 1304 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
1307 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) }, 1305 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
1308 { } 1306 { }
1309}; 1307};
1310 1308
1309struct hid_dynid {
1310 struct list_head list;
1311 struct hid_device_id id;
1312};
1313
1314/**
1315 * store_new_id - add a new HID device ID to this driver and re-probe devices
1316 * @driver: target device driver
1317 * @buf: buffer for scanning device ID data
1318 * @count: input size
1319 *
1320 * Adds a new dynamic hid device ID to this driver,
1321 * and causes the driver to probe for all devices again.
1322 */
1323static ssize_t store_new_id(struct device_driver *drv, const char *buf,
1324 size_t count)
1325{
1326 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
1327 struct hid_dynid *dynid;
1328 __u32 bus, vendor, product;
1329 unsigned long driver_data = 0;
1330 int ret;
1331
1332 ret = sscanf(buf, "%x %x %x %lx",
1333 &bus, &vendor, &product, &driver_data);
1334 if (ret < 3)
1335 return -EINVAL;
1336
1337 dynid = kzalloc(sizeof(*dynid), GFP_KERNEL);
1338 if (!dynid)
1339 return -ENOMEM;
1340
1341 dynid->id.bus = bus;
1342 dynid->id.vendor = vendor;
1343 dynid->id.product = product;
1344 dynid->id.driver_data = driver_data;
1345
1346 spin_lock(&hdrv->dyn_lock);
1347 list_add_tail(&dynid->list, &hdrv->dyn_list);
1348 spin_unlock(&hdrv->dyn_lock);
1349
1350 ret = 0;
1351 if (get_driver(&hdrv->driver)) {
1352 ret = driver_attach(&hdrv->driver);
1353 put_driver(&hdrv->driver);
1354 }
1355
1356 return ret ? : count;
1357}
1358static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);
1359
1360static void hid_free_dynids(struct hid_driver *hdrv)
1361{
1362 struct hid_dynid *dynid, *n;
1363
1364 spin_lock(&hdrv->dyn_lock);
1365 list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) {
1366 list_del(&dynid->list);
1367 kfree(dynid);
1368 }
1369 spin_unlock(&hdrv->dyn_lock);
1370}
1371
1372static const struct hid_device_id *hid_match_device(struct hid_device *hdev,
1373 struct hid_driver *hdrv)
1374{
1375 struct hid_dynid *dynid;
1376
1377 spin_lock(&hdrv->dyn_lock);
1378 list_for_each_entry(dynid, &hdrv->dyn_list, list) {
1379 if (hid_match_one_id(hdev, &dynid->id)) {
1380 spin_unlock(&hdrv->dyn_lock);
1381 return &dynid->id;
1382 }
1383 }
1384 spin_unlock(&hdrv->dyn_lock);
1385
1386 return hid_match_id(hdev, hdrv->id_table);
1387}
1388
1311static int hid_bus_match(struct device *dev, struct device_driver *drv) 1389static int hid_bus_match(struct device *dev, struct device_driver *drv)
1312{ 1390{
1313 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver); 1391 struct hid_driver *hdrv = container_of(drv, struct hid_driver, driver);
1314 struct hid_device *hdev = container_of(dev, struct hid_device, dev); 1392 struct hid_device *hdev = container_of(dev, struct hid_device, dev);
1315 1393
1316 if (!hid_match_id(hdev, hdrv->id_table)) 1394 if (!hid_match_device(hdev, hdrv))
1317 return 0; 1395 return 0;
1318 1396
1319 /* generic wants all non-blacklisted */ 1397 /* generic wants all non-blacklisted */
@@ -1332,7 +1410,7 @@ static int hid_device_probe(struct device *dev)
1332 int ret = 0; 1410 int ret = 0;
1333 1411
1334 if (!hdev->driver) { 1412 if (!hdev->driver) {
1335 id = hid_match_id(hdev, hdrv->id_table); 1413 id = hid_match_device(hdev, hdrv);
1336 if (id == NULL) 1414 if (id == NULL)
1337 return -ENODEV; 1415 return -ENODEV;
1338 1416
@@ -1420,6 +1498,7 @@ static const struct hid_device_id hid_ignore_list[] = {
1420 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) }, 1498 { HID_USB_DEVICE(USB_VENDOR_ID_CMEDIA, USB_DEVICE_ID_CM109) },
1421 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) }, 1499 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM) },
1422 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) }, 1500 { HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE) },
1501 { HID_USB_DEVICE(USB_VENDOR_ID_DEALEXTREAME, USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701) },
1423 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) }, 1502 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE) },
1424 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) }, 1503 { HID_USB_DEVICE(USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20) },
1425 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) }, 1504 { HID_USB_DEVICE(USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5) },
@@ -1577,6 +1656,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = {
1577 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) }, 1656 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ANSI) },
1578 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) }, 1657 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_ISO) },
1579 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) }, 1658 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING2_JIS) },
1659 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
1660 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
1661 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
1580 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, 1662 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
1581 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, 1663 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
1582 { } 1664 { }
@@ -1618,9 +1700,10 @@ int hid_add_device(struct hid_device *hdev)
1618 if (hid_ignore(hdev)) 1700 if (hid_ignore(hdev))
1619 return -ENODEV; 1701 return -ENODEV;
1620 1702
1621 /* XXX hack, any other cleaner solution < 20 bus_id bytes? */ 1703 /* XXX hack, any other cleaner solution after the driver core
1622 sprintf(hdev->dev.bus_id, "%04X:%04X:%04X.%04X", hdev->bus, 1704 * is converted to allow more than 20 bytes as the device name? */
1623 hdev->vendor, hdev->product, atomic_inc_return(&id)); 1705 dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
1706 hdev->vendor, hdev->product, atomic_inc_return(&id));
1624 1707
1625 ret = device_add(&hdev->dev); 1708 ret = device_add(&hdev->dev);
1626 if (!ret) 1709 if (!ret)
@@ -1695,18 +1778,33 @@ EXPORT_SYMBOL_GPL(hid_destroy_device);
1695int __hid_register_driver(struct hid_driver *hdrv, struct module *owner, 1778int __hid_register_driver(struct hid_driver *hdrv, struct module *owner,
1696 const char *mod_name) 1779 const char *mod_name)
1697{ 1780{
1781 int ret;
1782
1698 hdrv->driver.name = hdrv->name; 1783 hdrv->driver.name = hdrv->name;
1699 hdrv->driver.bus = &hid_bus_type; 1784 hdrv->driver.bus = &hid_bus_type;
1700 hdrv->driver.owner = owner; 1785 hdrv->driver.owner = owner;
1701 hdrv->driver.mod_name = mod_name; 1786 hdrv->driver.mod_name = mod_name;
1702 1787
1703 return driver_register(&hdrv->driver); 1788 INIT_LIST_HEAD(&hdrv->dyn_list);
1789 spin_lock_init(&hdrv->dyn_lock);
1790
1791 ret = driver_register(&hdrv->driver);
1792 if (ret)
1793 return ret;
1794
1795 ret = driver_create_file(&hdrv->driver, &driver_attr_new_id);
1796 if (ret)
1797 driver_unregister(&hdrv->driver);
1798
1799 return ret;
1704} 1800}
1705EXPORT_SYMBOL_GPL(__hid_register_driver); 1801EXPORT_SYMBOL_GPL(__hid_register_driver);
1706 1802
1707void hid_unregister_driver(struct hid_driver *hdrv) 1803void hid_unregister_driver(struct hid_driver *hdrv)
1708{ 1804{
1805 driver_remove_file(&hdrv->driver, &driver_attr_new_id);
1709 driver_unregister(&hdrv->driver); 1806 driver_unregister(&hdrv->driver);
1807 hid_free_dynids(hdrv);
1710} 1808}
1711EXPORT_SYMBOL_GPL(hid_unregister_driver); 1809EXPORT_SYMBOL_GPL(hid_unregister_driver);
1712 1810
diff --git a/drivers/hid/hid-dell.c b/drivers/hid/hid-dell.c
deleted file mode 100644
index f5474300b83a..000000000000
--- a/drivers/hid/hid-dell.c
+++ /dev/null
@@ -1,76 +0,0 @@
1/*
2 * HID driver for some dell "special" devices
3 *
4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2007 Paul Walmsley
9 * Copyright (c) 2008 Jiri Slaby
10 */
11
12/*
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the Free
15 * Software Foundation; either version 2 of the License, or (at your option)
16 * any later version.
17 */
18
19#include <linux/device.h>
20#include <linux/hid.h>
21#include <linux/module.h>
22
23#include "hid-ids.h"
24
25static int dell_probe(struct hid_device *hdev, const struct hid_device_id *id)
26{
27 int ret;
28
29 ret = hid_parse(hdev);
30 if (ret) {
31 dev_err(&hdev->dev, "parse failed\n");
32 goto err_free;
33 }
34
35 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
36 if (ret) {
37 dev_err(&hdev->dev, "hw start failed\n");
38 goto err_free;
39 }
40
41 usbhid_set_leds(hdev);
42
43 return 0;
44err_free:
45 return ret;
46}
47
48static const struct hid_device_id dell_devices[] = {
49 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
50 { HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
51 { HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
52 { }
53};
54MODULE_DEVICE_TABLE(hid, dell_devices);
55
56static struct hid_driver dell_driver = {
57 .name = "dell",
58 .id_table = dell_devices,
59 .probe = dell_probe,
60};
61
62static int dell_init(void)
63{
64 return hid_register_driver(&dell_driver);
65}
66
67static void dell_exit(void)
68{
69 hid_unregister_driver(&dell_driver);
70}
71
72module_init(dell_init);
73module_exit(dell_exit);
74MODULE_LICENSE("GPL");
75
76HID_COMPAT_LOAD_DRIVER(dell);
diff --git a/drivers/hid/hid-dummy.c b/drivers/hid/hid-dummy.c
index e148f86fb58e..b4cc0f743d63 100644
--- a/drivers/hid/hid-dummy.c
+++ b/drivers/hid/hid-dummy.c
@@ -43,6 +43,9 @@ static int __init hid_dummy_init(void)
43#ifdef CONFIG_HID_MONTEREY_MODULE 43#ifdef CONFIG_HID_MONTEREY_MODULE
44 HID_COMPAT_CALL_DRIVER(monterey); 44 HID_COMPAT_CALL_DRIVER(monterey);
45#endif 45#endif
46#ifdef CONFIG_HID_NTRIG_MODULE
47 HID_COMPAT_CALL_DRIVER(ntrig);
48#endif
46#ifdef CONFIG_HID_PANTHERLORD_MODULE 49#ifdef CONFIG_HID_PANTHERLORD_MODULE
47 HID_COMPAT_CALL_DRIVER(pantherlord); 50 HID_COMPAT_CALL_DRIVER(pantherlord);
48#endif 51#endif
@@ -58,6 +61,9 @@ static int __init hid_dummy_init(void)
58#ifdef CONFIG_HID_SUNPLUS_MODULE 61#ifdef CONFIG_HID_SUNPLUS_MODULE
59 HID_COMPAT_CALL_DRIVER(sunplus); 62 HID_COMPAT_CALL_DRIVER(sunplus);
60#endif 63#endif
64#ifdef CONFIG_GREENASIA_FF_MODULE
65 HID_COMPAT_CALL_DRIVER(greenasia);
66#endif
61#ifdef CONFIG_THRUSTMASTER_FF_MODULE 67#ifdef CONFIG_THRUSTMASTER_FF_MODULE
62 HID_COMPAT_CALL_DRIVER(thrustmaster); 68 HID_COMPAT_CALL_DRIVER(thrustmaster);
63#endif 69#endif
diff --git a/drivers/hid/hid-gaff.c b/drivers/hid/hid-gaff.c
new file mode 100644
index 000000000000..71211f6a4f02
--- /dev/null
+++ b/drivers/hid/hid-gaff.c
@@ -0,0 +1,185 @@
1/*
2 * Force feedback support for GreenAsia (Product ID 0x12) based devices
3 *
4 * The devices are distributed under various names and the same USB device ID
5 * can be used in many game controllers.
6 *
7 *
8 * 0e8f:0012 "GreenAsia Inc. USB Joystick "
9 * - tested with MANTA Warior MM816 and SpeedLink Strike2 SL-6635.
10 *
11 * Copyright (c) 2008 Lukasz Lubojanski <lukasz@lubojanski.info>
12 */
13
14/*
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 */
29
30#include <linux/input.h>
31#include <linux/usb.h>
32#include <linux/hid.h>
33#include "hid-ids.h"
34#include "usbhid/usbhid.h"
35
36struct gaff_device {
37 struct hid_report *report;
38};
39
40static int hid_gaff_play(struct input_dev *dev, void *data,
41 struct ff_effect *effect)
42{
43 struct hid_device *hid = input_get_drvdata(dev);
44 struct gaff_device *gaff = data;
45 int left, right;
46
47 left = effect->u.rumble.strong_magnitude;
48 right = effect->u.rumble.weak_magnitude;
49
50 dbg_hid("called with 0x%04x 0x%04x", left, right);
51
52 left = left * 0xfe / 0xffff;
53 right = right * 0xfe / 0xffff;
54
55 gaff->report->field[0]->value[0] = 0x51;
56 gaff->report->field[0]->value[1] = 0x0;
57 gaff->report->field[0]->value[2] = right;
58 gaff->report->field[0]->value[3] = 0;
59 gaff->report->field[0]->value[4] = left;
60 gaff->report->field[0]->value[5] = 0;
61 dbg_hid("running with 0x%02x 0x%02x", left, right);
62 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
63
64 gaff->report->field[0]->value[0] = 0xfa;
65 gaff->report->field[0]->value[1] = 0xfe;
66 gaff->report->field[0]->value[2] = 0x0;
67 gaff->report->field[0]->value[4] = 0x0;
68
69 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
70
71 return 0;
72}
73
74static int gaff_init(struct hid_device *hid)
75{
76 struct gaff_device *gaff;
77 struct hid_report *report;
78 struct hid_input *hidinput = list_entry(hid->inputs.next,
79 struct hid_input, list);
80 struct list_head *report_list =
81 &hid->report_enum[HID_OUTPUT_REPORT].report_list;
82 struct list_head *report_ptr = report_list;
83 struct input_dev *dev = hidinput->input;
84 int error;
85
86 if (list_empty(report_list)) {
87 dev_err(&hid->dev, "no output reports found\n");
88 return -ENODEV;
89 }
90
91 report_ptr = report_ptr->next;
92
93 report = list_entry(report_ptr, struct hid_report, list);
94 if (report->maxfield < 1) {
95 dev_err(&hid->dev, "no fields in the report\n");
96 return -ENODEV;
97 }
98
99 if (report->field[0]->report_count < 6) {
100 dev_err(&hid->dev, "not enough values in the field\n");
101 return -ENODEV;
102 }
103
104 gaff = kzalloc(sizeof(struct gaff_device), GFP_KERNEL);
105 if (!gaff)
106 return -ENOMEM;
107
108 set_bit(FF_RUMBLE, dev->ffbit);
109
110 error = input_ff_create_memless(dev, gaff, hid_gaff_play);
111 if (error) {
112 kfree(gaff);
113 return error;
114 }
115
116 gaff->report = report;
117 gaff->report->field[0]->value[0] = 0x51;
118 gaff->report->field[0]->value[1] = 0x00;
119 gaff->report->field[0]->value[2] = 0x00;
120 gaff->report->field[0]->value[3] = 0x00;
121 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
122
123 gaff->report->field[0]->value[0] = 0xfa;
124 gaff->report->field[0]->value[1] = 0xfe;
125
126 usbhid_submit_report(hid, gaff->report, USB_DIR_OUT);
127
128 dev_info(&hid->dev, "Force Feedback for GreenAsia 0x12"
129 " devices by Lukasz Lubojanski <lukasz@lubojanski.info>\n");
130
131 return 0;
132}
133
134static int ga_probe(struct hid_device *hdev, const struct hid_device_id *id)
135{
136 int ret;
137
138 dev_dbg(&hdev->dev, "Greenasia HID hardware probe...");
139
140 ret = hid_parse(hdev);
141 if (ret) {
142 dev_err(&hdev->dev, "parse failed\n");
143 goto err;
144 }
145
146 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
147 if (ret) {
148 dev_err(&hdev->dev, "hw start failed\n");
149 goto err;
150 }
151
152 gaff_init(hdev);
153
154 return 0;
155err:
156 return ret;
157}
158
159static const struct hid_device_id ga_devices[] = {
160 { HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0012), },
161 { }
162};
163MODULE_DEVICE_TABLE(hid, ga_devices);
164
165static struct hid_driver ga_driver = {
166 .name = "greenasia",
167 .id_table = ga_devices,
168 .probe = ga_probe,
169};
170
171static int __init ga_init(void)
172{
173 return hid_register_driver(&ga_driver);
174}
175
176static void __exit ga_exit(void)
177{
178 hid_unregister_driver(&ga_driver);
179}
180
181module_init(ga_init);
182module_exit(ga_exit);
183MODULE_LICENSE("GPL");
184
185HID_COMPAT_LOAD_DRIVER(greenasia);
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 39289699c32f..acc1abc834a4 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -107,9 +107,6 @@
107#define USB_VENDOR_ID_BELKIN 0x050d 107#define USB_VENDOR_ID_BELKIN 0x050d
108#define USB_DEVICE_ID_FLIP_KVM 0x3201 108#define USB_DEVICE_ID_FLIP_KVM 0x3201
109 109
110#define USB_VENDOR_ID_BRIGHT 0x1241
111#define USB_DEVICE_ID_BRIGHT_ABNT2 0x1503
112
113#define USB_VENDOR_ID_BERKSHIRE 0x0c98 110#define USB_VENDOR_ID_BERKSHIRE 0x0c98
114#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 111#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140
115 112
@@ -141,9 +138,8 @@
141#define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61 138#define USB_DEVICE_ID_CYPRESS_BARCODE_1 0xde61
142#define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64 139#define USB_DEVICE_ID_CYPRESS_BARCODE_2 0xde64
143 140
144#define USB_VENDOR_ID_DELL 0x413c 141#define USB_VENDOR_ID_DEALEXTREAME 0x10c5
145#define USB_DEVICE_ID_DELL_W7658 0x2005 142#define USB_DEVICE_ID_DEALEXTREAME_RADIO_SI4701 0x819a
146#define USB_DEVICE_ID_DELL_SK8115 0x2105
147 143
148#define USB_VENDOR_ID_DELORME 0x1163 144#define USB_VENDOR_ID_DELORME 0x1163
149#define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100 145#define USB_DEVICE_ID_DELORME_EARTHMATE 0x0100
@@ -167,9 +163,6 @@
167 163
168#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc 164#define USB_VENDOR_ID_GENERAL_TOUCH 0x0dfc
169 165
170#define USB_VENDOR_ID_GENERIC_13BA 0x13ba
171#define USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE 0x0017
172
173#define USB_VENDOR_ID_GLAB 0x06c2 166#define USB_VENDOR_ID_GLAB 0x06c2
174#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038 167#define USB_DEVICE_ID_4_PHIDGETSERVO_30 0x0038
175#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039 168#define USB_DEVICE_ID_1_PHIDGETSERVO_30 0x0039
@@ -292,7 +285,6 @@
292#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294 285#define USB_DEVICE_ID_LOGITECH_WHEEL 0xc294
293#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295 286#define USB_DEVICE_ID_LOGITECH_MOMO_WHEEL 0xc295
294#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a 287#define USB_DEVICE_ID_LOGITECH_ELITE_KBD 0xc30a
295#define USB_DEVICE_ID_LOGITECH_KBD 0xc311
296#define USB_DEVICE_ID_S510_RECEIVER 0xc50c 288#define USB_DEVICE_ID_S510_RECEIVER 0xc50c
297#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517 289#define USB_DEVICE_ID_S510_RECEIVER_2 0xc517
298#define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512 290#define USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500 0xc512
@@ -339,6 +331,9 @@
339#define USB_VENDOR_ID_NEC 0x073e 331#define USB_VENDOR_ID_NEC 0x073e
340#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301 332#define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301
341 333
334#define USB_VENDOR_ID_NTRIG 0x1b96
335#define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN 0x0001
336
342#define USB_VENDOR_ID_ONTRAK 0x0a07 337#define USB_VENDOR_ID_ONTRAK 0x0a07
343#define USB_DEVICE_ID_ONTRAK_ADU100 0x0064 338#define USB_DEVICE_ID_ONTRAK_ADU100 0x0064
344 339
@@ -383,9 +378,15 @@
383#define USB_VENDOR_ID_TOPMAX 0x0663 378#define USB_VENDOR_ID_TOPMAX 0x0663
384#define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103 379#define USB_DEVICE_ID_TOPMAX_COBRAPAD 0x0103
385 380
381#define USB_VENDOR_ID_TOPSEED 0x0766
382#define USB_DEVICE_ID_TOPSEED_CYBERLINK 0x0204
383
386#define USB_VENDOR_ID_TURBOX 0x062a 384#define USB_VENDOR_ID_TURBOX 0x062a
387#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201 385#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201
388 386
387#define USB_VENDOR_ID_UCLOGIC 0x5543
388#define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042
389
389#define USB_VENDOR_ID_VERNIER 0x08f7 390#define USB_VENDOR_ID_VERNIER 0x08f7
390#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 391#define USB_DEVICE_ID_VERNIER_LABPRO 0x0001
391#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002 392#define USB_DEVICE_ID_VERNIER_GOTEMP 0x0002
diff --git a/drivers/hid/hid-lg.c b/drivers/hid/hid-lg.c
index 2bae340eafe2..83e07c9f4144 100644
--- a/drivers/hid/hid-lg.c
+++ b/drivers/hid/hid-lg.c
@@ -26,7 +26,6 @@
26#define LG_RDESC 0x001 26#define LG_RDESC 0x001
27#define LG_BAD_RELATIVE_KEYS 0x002 27#define LG_BAD_RELATIVE_KEYS 0x002
28#define LG_DUPLICATE_USAGES 0x004 28#define LG_DUPLICATE_USAGES 0x004
29#define LG_RESET_LEDS 0x008
30#define LG_EXPANDED_KEYMAP 0x010 29#define LG_EXPANDED_KEYMAP 0x010
31#define LG_IGNORE_DOUBLED_WHEEL 0x020 30#define LG_IGNORE_DOUBLED_WHEEL 0x020
32#define LG_WIRELESS 0x040 31#define LG_WIRELESS 0x040
@@ -248,9 +247,6 @@ static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
248 goto err_free; 247 goto err_free;
249 } 248 }
250 249
251 if (quirks & LG_RESET_LEDS)
252 usbhid_set_leds(hdev);
253
254 if (quirks & LG_FF) 250 if (quirks & LG_FF)
255 lgff_init(hdev); 251 lgff_init(hdev);
256 if (quirks & LG_FF2) 252 if (quirks & LG_FF2)
@@ -279,9 +275,6 @@ static const struct hid_device_id lg_devices[] = {
279 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI), 275 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI),
280 .driver_data = LG_DUPLICATE_USAGES }, 276 .driver_data = LG_DUPLICATE_USAGES },
281 277
282 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD),
283 .driver_data = LG_RESET_LEDS },
284
285 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD), 278 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD),
286 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP }, 279 .driver_data = LG_IGNORE_DOUBLED_WHEEL | LG_EXPANDED_KEYMAP },
287 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500), 280 { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500),
diff --git a/drivers/hid/hid-ntrig.c b/drivers/hid/hid-ntrig.c
new file mode 100644
index 000000000000..db44fbd7bdf6
--- /dev/null
+++ b/drivers/hid/hid-ntrig.c
@@ -0,0 +1,82 @@
1/*
2 * HID driver for some ntrig "special" devices
3 *
4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina
8 * Copyright (c) 2007 Paul Walmsley
9 * Copyright (c) 2008 Jiri Slaby
10 * Copyright (c) 2008 Rafi Rubin
11 *
12 */
13
14/*
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the Free
17 * Software Foundation; either version 2 of the License, or (at your option)
18 * any later version.
19 */
20
21#include <linux/device.h>
22#include <linux/hid.h>
23#include <linux/module.h>
24
25#include "hid-ids.h"
26
27#define NTRIG_DUPLICATE_USAGES 0x001
28
29#define nt_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
30 EV_KEY, (c))
31
32static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
33 struct hid_field *field, struct hid_usage *usage,
34 unsigned long **bit, int *max)
35{
36 if ((usage->hid & HID_USAGE_PAGE) == HID_UP_DIGITIZER &&
37 (usage->hid & 0xff) == 0x47) {
38 nt_map_key_clear(BTN_TOOL_DOUBLETAP);
39 return 1;
40 }
41 return 0;
42}
43
44static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
45 struct hid_field *field, struct hid_usage *usage,
46 unsigned long **bit, int *max)
47{
48 if (usage->type == EV_KEY || usage->type == EV_REL
49 || usage->type == EV_ABS)
50 clear_bit(usage->code, *bit);
51
52 return 0;
53}
54static const struct hid_device_id ntrig_devices[] = {
55 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN),
56 .driver_data = NTRIG_DUPLICATE_USAGES },
57 { }
58};
59MODULE_DEVICE_TABLE(hid, ntrig_devices);
60
61static struct hid_driver ntrig_driver = {
62 .name = "ntrig",
63 .id_table = ntrig_devices,
64 .input_mapping = ntrig_input_mapping,
65 .input_mapped = ntrig_input_mapped,
66};
67
68static int ntrig_init(void)
69{
70 return hid_register_driver(&ntrig_driver);
71}
72
73static void ntrig_exit(void)
74{
75 hid_unregister_driver(&ntrig_driver);
76}
77
78module_init(ntrig_init);
79module_exit(ntrig_exit);
80MODULE_LICENSE("GPL");
81
82HID_COMPAT_LOAD_DRIVER(ntrig);
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 86e563b8d644..dd5a3979a4de 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -102,7 +102,7 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
102 } 102 }
103 103
104 ret = sony_set_operational(hdev); 104 ret = sony_set_operational(hdev);
105 if (ret) 105 if (ret < 0)
106 goto err_stop; 106 goto err_stop;
107 107
108 return 0; 108 return 0;
diff --git a/drivers/hid/hid-topseed.c b/drivers/hid/hid-topseed.c
new file mode 100644
index 000000000000..cca64a0564a9
--- /dev/null
+++ b/drivers/hid/hid-topseed.c
@@ -0,0 +1,77 @@
1/*
2 * HID driver for TopSeed Cyberlink remote
3 *
4 * Copyright (c) 2008 Lev Babiev
5 * based on hid-cherry driver
6 */
7
8/*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
13 */
14
15#include <linux/device.h>
16#include <linux/hid.h>
17#include <linux/module.h>
18
19#include "hid-ids.h"
20
21#define ts_map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, \
22 EV_KEY, (c))
23static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi,
24 struct hid_field *field, struct hid_usage *usage,
25 unsigned long **bit, int *max)
26{
27 if ((usage->hid & HID_USAGE_PAGE) != 0x0ffbc0000)
28 return 0;
29
30 switch (usage->hid & HID_USAGE) {
31 case 0x00d: ts_map_key_clear(KEY_HOME); break;
32 case 0x024: ts_map_key_clear(KEY_MENU); break;
33 case 0x025: ts_map_key_clear(KEY_TV); break;
34 case 0x048: ts_map_key_clear(KEY_RED); break;
35 case 0x047: ts_map_key_clear(KEY_GREEN); break;
36 case 0x049: ts_map_key_clear(KEY_YELLOW); break;
37 case 0x04a: ts_map_key_clear(KEY_BLUE); break;
38 case 0x04b: ts_map_key_clear(KEY_ANGLE); break;
39 case 0x04c: ts_map_key_clear(KEY_LANGUAGE); break;
40 case 0x04d: ts_map_key_clear(KEY_SUBTITLE); break;
41 case 0x031: ts_map_key_clear(KEY_AUDIO); break;
42 case 0x032: ts_map_key_clear(KEY_TEXT); break;
43 case 0x033: ts_map_key_clear(KEY_CHANNEL); break;
44 default:
45 return 0;
46 }
47
48 return 1;
49}
50
51static const struct hid_device_id ts_devices[] = {
52 { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
53 { }
54};
55MODULE_DEVICE_TABLE(hid, ts_devices);
56
57static struct hid_driver ts_driver = {
58 .name = "topseed",
59 .id_table = ts_devices,
60 .input_mapping = ts_input_mapping,
61};
62
63static int ts_init(void)
64{
65 return hid_register_driver(&ts_driver);
66}
67
68static void ts_exit(void)
69{
70 hid_unregister_driver(&ts_driver);
71}
72
73module_init(ts_init);
74module_exit(ts_exit);
75MODULE_LICENSE("GPL");
76
77HID_COMPAT_LOAD_DRIVER(topseed);
diff --git a/drivers/hid/hidraw.c b/drivers/hid/hidraw.c
index 7685ae6808c4..732449628971 100644
--- a/drivers/hid/hidraw.c
+++ b/drivers/hid/hidraw.c
@@ -208,7 +208,7 @@ static int hidraw_release(struct inode * inode, struct file * file)
208 208
209 list_del(&list->node); 209 list_del(&list->node);
210 dev = hidraw_table[minor]; 210 dev = hidraw_table[minor];
211 if (!dev->open--) { 211 if (!--dev->open) {
212 if (list->hidraw->exist) 212 if (list->hidraw->exist)
213 dev->hid->ll_driver->close(dev->hid); 213 dev->hid->ll_driver->close(dev->hid);
214 else 214 else
@@ -265,6 +265,34 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
265 break; 265 break;
266 } 266 }
267 default: 267 default:
268 {
269 struct hid_device *hid = dev->hid;
270 if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ)
271 return -EINVAL;
272
273 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
274 int len;
275 if (!hid->name)
276 return 0;
277 len = strlen(hid->name) + 1;
278 if (len > _IOC_SIZE(cmd))
279 len = _IOC_SIZE(cmd);
280 return copy_to_user(user_arg, hid->name, len) ?
281 -EFAULT : len;
282 }
283
284 if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
285 int len;
286 if (!hid->phys)
287 return 0;
288 len = strlen(hid->phys) + 1;
289 if (len > _IOC_SIZE(cmd))
290 len = _IOC_SIZE(cmd);
291 return copy_to_user(user_arg, hid->phys, len) ?
292 -EFAULT : len;
293 }
294 }
295
268 ret = -ENOTTY; 296 ret = -ENOTTY;
269 } 297 }
270 unlock_kernel(); 298 unlock_kernel();
@@ -329,7 +357,7 @@ int hidraw_connect(struct hid_device *hid)
329 goto out; 357 goto out;
330 } 358 }
331 359
332 dev->dev = device_create(hidraw_class, NULL, MKDEV(hidraw_major, minor), 360 dev->dev = device_create(hidraw_class, &hid->dev, MKDEV(hidraw_major, minor),
333 NULL, "%s%d", "hidraw", minor); 361 NULL, "%s%d", "hidraw", minor);
334 362
335 if (IS_ERR(dev->dev)) { 363 if (IS_ERR(dev->dev)) {
diff --git a/drivers/hid/usbhid/Kconfig b/drivers/hid/usbhid/Kconfig
index 5d9aa95fc3ef..4edb3bef94a6 100644
--- a/drivers/hid/usbhid/Kconfig
+++ b/drivers/hid/usbhid/Kconfig
@@ -45,7 +45,7 @@ config USB_HIDDEV
45 If unsure, say Y. 45 If unsure, say Y.
46 46
47menu "USB HID Boot Protocol drivers" 47menu "USB HID Boot Protocol drivers"
48 depends on USB!=n && USB_HID!=y 48 depends on USB!=n && USB_HID!=y && EMBEDDED
49 49
50config USB_KBD 50config USB_KBD
51 tristate "USB HIDBP Keyboard (simple Boot) support" 51 tristate "USB HIDBP Keyboard (simple Boot) support"
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 606369ea24ca..03cb494af1c5 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -4,7 +4,7 @@
4 * Copyright (c) 1999 Andreas Gal 4 * Copyright (c) 1999 Andreas Gal
5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz> 5 * Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc 6 * Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
7 * Copyright (c) 2006-2007 Jiri Kosina 7 * Copyright (c) 2006-2008 Jiri Kosina
8 */ 8 */
9 9
10/* 10/*
@@ -641,9 +641,7 @@ static void hid_find_max_report(struct hid_device *hid, unsigned int type,
641 unsigned int size; 641 unsigned int size;
642 642
643 list_for_each_entry(report, &hid->report_enum[type].report_list, list) { 643 list_for_each_entry(report, &hid->report_enum[type].report_list, list) {
644 size = ((report->size - 1) >> 3) + 1; 644 size = ((report->size - 1) >> 3) + 1 + hid->report_enum[type].numbered;
645 if (type == HID_INPUT_REPORT && hid->report_enum[type].numbered)
646 size++;
647 if (*max < size) 645 if (*max < size)
648 *max = size; 646 *max = size;
649 } 647 }
@@ -653,13 +651,16 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid)
653{ 651{
654 struct usbhid_device *usbhid = hid->driver_data; 652 struct usbhid_device *usbhid = hid->driver_data;
655 653
656 if (!(usbhid->inbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_ATOMIC, &usbhid->inbuf_dma))) 654 usbhid->inbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
657 return -1; 655 &usbhid->inbuf_dma);
658 if (!(usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_ATOMIC, &usbhid->outbuf_dma))) 656 usbhid->outbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
659 return -1; 657 &usbhid->outbuf_dma);
660 if (!(usbhid->cr = usb_buffer_alloc(dev, sizeof(*(usbhid->cr)), GFP_ATOMIC, &usbhid->cr_dma))) 658 usbhid->cr = usb_buffer_alloc(dev, sizeof(*usbhid->cr), GFP_KERNEL,
661 return -1; 659 &usbhid->cr_dma);
662 if (!(usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_ATOMIC, &usbhid->ctrlbuf_dma))) 660 usbhid->ctrlbuf = usb_buffer_alloc(dev, usbhid->bufsize, GFP_KERNEL,
661 &usbhid->ctrlbuf_dma);
662 if (!usbhid->inbuf || !usbhid->outbuf || !usbhid->cr ||
663 !usbhid->ctrlbuf)
663 return -1; 664 return -1;
664 665
665 return 0; 666 return 0;
@@ -807,7 +808,7 @@ static int usbhid_start(struct hid_device *hid)
807 int interval; 808 int interval;
808 809
809 endpoint = &interface->endpoint[n].desc; 810 endpoint = &interface->endpoint[n].desc;
810 if ((endpoint->bmAttributes & 3) != 3) /* Not an interrupt endpoint */ 811 if (!usb_endpoint_xfer_int(endpoint))
811 continue; 812 continue;
812 813
813 interval = endpoint->bInterval; 814 interval = endpoint->bInterval;
@@ -876,6 +877,15 @@ static int usbhid_start(struct hid_device *hid)
876 877
877 set_bit(HID_STARTED, &usbhid->iofl); 878 set_bit(HID_STARTED, &usbhid->iofl);
878 879
880 /* Some keyboards don't work until their LEDs have been set.
881 * Since BIOSes do set the LEDs, it must be safe for any device
882 * that supports the keyboard boot protocol.
883 */
884 if (interface->desc.bInterfaceSubClass == USB_INTERFACE_SUBCLASS_BOOT &&
885 interface->desc.bInterfaceProtocol ==
886 USB_INTERFACE_PROTOCOL_KEYBOARD)
887 usbhid_set_leds(hid);
888
879 return 0; 889 return 0;
880 890
881fail: 891fail:
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 47ebe045f9b5..4391717d2519 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
@@ -54,6 +54,7 @@ static const struct hid_blacklist {
54 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, 54 { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
55 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET }, 55 { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
56 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, 56 { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
57 { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
57 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, 58 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS },
58 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, 59 { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT },
59 60
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
index 83e851a5ed30..6a98f9f572b0 100644
--- a/drivers/hid/usbhid/hiddev.c
+++ b/drivers/hid/usbhid/hiddev.c
@@ -49,6 +49,7 @@
49struct hiddev { 49struct hiddev {
50 int exist; 50 int exist;
51 int open; 51 int open;
52 struct mutex existancelock;
52 wait_queue_head_t wait; 53 wait_queue_head_t wait;
53 struct hid_device *hid; 54 struct hid_device *hid;
54 struct list_head list; 55 struct list_head list;
@@ -63,6 +64,7 @@ struct hiddev_list {
63 struct fasync_struct *fasync; 64 struct fasync_struct *fasync;
64 struct hiddev *hiddev; 65 struct hiddev *hiddev;
65 struct list_head node; 66 struct list_head node;
67 struct mutex thread_lock;
66}; 68};
67 69
68static struct hiddev *hiddev_table[HIDDEV_MINORS]; 70static struct hiddev *hiddev_table[HIDDEV_MINORS];
@@ -264,29 +266,48 @@ static int hiddev_release(struct inode * inode, struct file * file)
264static int hiddev_open(struct inode *inode, struct file *file) 266static int hiddev_open(struct inode *inode, struct file *file)
265{ 267{
266 struct hiddev_list *list; 268 struct hiddev_list *list;
267 unsigned long flags; 269 int res;
268 270
269 int i = iminor(inode) - HIDDEV_MINOR_BASE; 271 int i = iminor(inode) - HIDDEV_MINOR_BASE;
270 272
271 if (i >= HIDDEV_MINORS || !hiddev_table[i]) 273 if (i >= HIDDEV_MINORS || i < 0 || !hiddev_table[i])
272 return -ENODEV; 274 return -ENODEV;
273 275
274 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL))) 276 if (!(list = kzalloc(sizeof(struct hiddev_list), GFP_KERNEL)))
275 return -ENOMEM; 277 return -ENOMEM;
278 mutex_init(&list->thread_lock);
276 279
277 list->hiddev = hiddev_table[i]; 280 list->hiddev = hiddev_table[i];
278 281
279 spin_lock_irqsave(&list->hiddev->list_lock, flags);
280 list_add_tail(&list->node, &hiddev_table[i]->list);
281 spin_unlock_irqrestore(&list->hiddev->list_lock, flags);
282 282
283 file->private_data = list; 283 file->private_data = list;
284 284
285 if (!list->hiddev->open++) 285 /*
286 if (list->hiddev->exist) 286 * no need for locking because the USB major number
287 usbhid_open(hiddev_table[i]->hid); 287 * is shared which usbcore guards against disconnect
288 */
289 if (list->hiddev->exist) {
290 if (!list->hiddev->open++) {
291 res = usbhid_open(hiddev_table[i]->hid);
292 if (res < 0) {
293 res = -EIO;
294 goto bail;
295 }
296 }
297 } else {
298 res = -ENODEV;
299 goto bail;
300 }
301
302 spin_lock_irq(&list->hiddev->list_lock);
303 list_add_tail(&list->node, &hiddev_table[i]->list);
304 spin_unlock_irq(&list->hiddev->list_lock);
288 305
289 return 0; 306 return 0;
307bail:
308 file->private_data = NULL;
309 kfree(list->hiddev);
310 return res;
290} 311}
291 312
292/* 313/*
@@ -305,7 +326,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
305 DECLARE_WAITQUEUE(wait, current); 326 DECLARE_WAITQUEUE(wait, current);
306 struct hiddev_list *list = file->private_data; 327 struct hiddev_list *list = file->private_data;
307 int event_size; 328 int event_size;
308 int retval = 0; 329 int retval;
309 330
310 event_size = ((list->flags & HIDDEV_FLAG_UREF) != 0) ? 331 event_size = ((list->flags & HIDDEV_FLAG_UREF) != 0) ?
311 sizeof(struct hiddev_usage_ref) : sizeof(struct hiddev_event); 332 sizeof(struct hiddev_usage_ref) : sizeof(struct hiddev_event);
@@ -313,10 +334,14 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
313 if (count < event_size) 334 if (count < event_size)
314 return 0; 335 return 0;
315 336
337 /* lock against other threads */
338 retval = mutex_lock_interruptible(&list->thread_lock);
339 if (retval)
340 return -ERESTARTSYS;
341
316 while (retval == 0) { 342 while (retval == 0) {
317 if (list->head == list->tail) { 343 if (list->head == list->tail) {
318 add_wait_queue(&list->hiddev->wait, &wait); 344 prepare_to_wait(&list->hiddev->wait, &wait, TASK_INTERRUPTIBLE);
319 set_current_state(TASK_INTERRUPTIBLE);
320 345
321 while (list->head == list->tail) { 346 while (list->head == list->tail) {
322 if (file->f_flags & O_NONBLOCK) { 347 if (file->f_flags & O_NONBLOCK) {
@@ -332,35 +357,45 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
332 break; 357 break;
333 } 358 }
334 359
360 /* let O_NONBLOCK tasks run */
361 mutex_unlock(&list->thread_lock);
335 schedule(); 362 schedule();
363 if (mutex_lock_interruptible(&list->thread_lock))
364 return -EINTR;
336 set_current_state(TASK_INTERRUPTIBLE); 365 set_current_state(TASK_INTERRUPTIBLE);
337 } 366 }
367 finish_wait(&list->hiddev->wait, &wait);
338 368
339 set_current_state(TASK_RUNNING);
340 remove_wait_queue(&list->hiddev->wait, &wait);
341 } 369 }
342 370
343 if (retval) 371 if (retval) {
372 mutex_unlock(&list->thread_lock);
344 return retval; 373 return retval;
374 }
345 375
346 376
347 while (list->head != list->tail && 377 while (list->head != list->tail &&
348 retval + event_size <= count) { 378 retval + event_size <= count) {
349 if ((list->flags & HIDDEV_FLAG_UREF) == 0) { 379 if ((list->flags & HIDDEV_FLAG_UREF) == 0) {
350 if (list->buffer[list->tail].field_index != 380 if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE) {
351 HID_FIELD_INDEX_NONE) {
352 struct hiddev_event event; 381 struct hiddev_event event;
382
353 event.hid = list->buffer[list->tail].usage_code; 383 event.hid = list->buffer[list->tail].usage_code;
354 event.value = list->buffer[list->tail].value; 384 event.value = list->buffer[list->tail].value;
355 if (copy_to_user(buffer + retval, &event, sizeof(struct hiddev_event))) 385 if (copy_to_user(buffer + retval, &event, sizeof(struct hiddev_event))) {
386 mutex_unlock(&list->thread_lock);
356 return -EFAULT; 387 return -EFAULT;
388 }
357 retval += sizeof(struct hiddev_event); 389 retval += sizeof(struct hiddev_event);
358 } 390 }
359 } else { 391 } else {
360 if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE || 392 if (list->buffer[list->tail].field_index != HID_FIELD_INDEX_NONE ||
361 (list->flags & HIDDEV_FLAG_REPORT) != 0) { 393 (list->flags & HIDDEV_FLAG_REPORT) != 0) {
362 if (copy_to_user(buffer + retval, list->buffer + list->tail, sizeof(struct hiddev_usage_ref))) 394
395 if (copy_to_user(buffer + retval, list->buffer + list->tail, sizeof(struct hiddev_usage_ref))) {
396 mutex_unlock(&list->thread_lock);
363 return -EFAULT; 397 return -EFAULT;
398 }
364 retval += sizeof(struct hiddev_usage_ref); 399 retval += sizeof(struct hiddev_usage_ref);
365 } 400 }
366 } 401 }
@@ -368,6 +403,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
368 } 403 }
369 404
370 } 405 }
406 mutex_unlock(&list->thread_lock);
371 407
372 return retval; 408 return retval;
373} 409}
@@ -555,7 +591,7 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
555 struct hid_field *field; 591 struct hid_field *field;
556 struct usbhid_device *usbhid = hid->driver_data; 592 struct usbhid_device *usbhid = hid->driver_data;
557 void __user *user_arg = (void __user *)arg; 593 void __user *user_arg = (void __user *)arg;
558 int i; 594 int i, r;
559 595
560 /* Called without BKL by compat methods so no BKL taken */ 596 /* Called without BKL by compat methods so no BKL taken */
561 597
@@ -619,10 +655,22 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
619 } 655 }
620 656
621 case HIDIOCGSTRING: 657 case HIDIOCGSTRING:
622 return hiddev_ioctl_string(hiddev, cmd, user_arg); 658 mutex_lock(&hiddev->existancelock);
659 if (!hiddev->exist)
660 r = hiddev_ioctl_string(hiddev, cmd, user_arg);
661 else
662 r = -ENODEV;
663 mutex_unlock(&hiddev->existancelock);
664 return r;
623 665
624 case HIDIOCINITREPORT: 666 case HIDIOCINITREPORT:
667 mutex_lock(&hiddev->existancelock);
668 if (!hiddev->exist) {
669 mutex_unlock(&hiddev->existancelock);
670 return -ENODEV;
671 }
625 usbhid_init_reports(hid); 672 usbhid_init_reports(hid);
673 mutex_unlock(&hiddev->existancelock);
626 674
627 return 0; 675 return 0;
628 676
@@ -636,8 +684,12 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
636 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 684 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)
637 return -EINVAL; 685 return -EINVAL;
638 686
639 usbhid_submit_report(hid, report, USB_DIR_IN); 687 mutex_lock(&hiddev->existancelock);
640 usbhid_wait_io(hid); 688 if (hiddev->exist) {
689 usbhid_submit_report(hid, report, USB_DIR_IN);
690 usbhid_wait_io(hid);
691 }
692 mutex_unlock(&hiddev->existancelock);
641 693
642 return 0; 694 return 0;
643 695
@@ -651,8 +703,12 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
651 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL) 703 if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)
652 return -EINVAL; 704 return -EINVAL;
653 705
654 usbhid_submit_report(hid, report, USB_DIR_OUT); 706 mutex_lock(&hiddev->existancelock);
655 usbhid_wait_io(hid); 707 if (hiddev->exist) {
708 usbhid_submit_report(hid, report, USB_DIR_OUT);
709 usbhid_wait_io(hid);
710 }
711 mutex_unlock(&hiddev->existancelock);
656 712
657 return 0; 713 return 0;
658 714
@@ -710,7 +766,13 @@ static long hiddev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
710 case HIDIOCGUSAGES: 766 case HIDIOCGUSAGES:
711 case HIDIOCSUSAGES: 767 case HIDIOCSUSAGES:
712 case HIDIOCGCOLLECTIONINDEX: 768 case HIDIOCGCOLLECTIONINDEX:
713 return hiddev_ioctl_usage(hiddev, cmd, user_arg); 769 mutex_lock(&hiddev->existancelock);
770 if (hiddev->exist)
771 r = hiddev_ioctl_usage(hiddev, cmd, user_arg);
772 else
773 r = -ENODEV;
774 mutex_unlock(&hiddev->existancelock);
775 return r;
714 776
715 case HIDIOCGCOLLECTIONINFO: 777 case HIDIOCGCOLLECTIONINFO:
716 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo))) 778 if (copy_from_user(&cinfo, user_arg, sizeof(cinfo)))
@@ -808,23 +870,22 @@ int hiddev_connect(struct hid_device *hid, unsigned int force)
808 if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL))) 870 if (!(hiddev = kzalloc(sizeof(struct hiddev), GFP_KERNEL)))
809 return -1; 871 return -1;
810 872
811 retval = usb_register_dev(usbhid->intf, &hiddev_class);
812 if (retval) {
813 err_hid("Not able to get a minor for this device.");
814 kfree(hiddev);
815 return -1;
816 }
817
818 init_waitqueue_head(&hiddev->wait); 873 init_waitqueue_head(&hiddev->wait);
819 INIT_LIST_HEAD(&hiddev->list); 874 INIT_LIST_HEAD(&hiddev->list);
820 spin_lock_init(&hiddev->list_lock); 875 spin_lock_init(&hiddev->list_lock);
876 mutex_init(&hiddev->existancelock);
821 hiddev->hid = hid; 877 hiddev->hid = hid;
822 hiddev->exist = 1; 878 hiddev->exist = 1;
823 879
824 hid->minor = usbhid->intf->minor; 880 retval = usb_register_dev(usbhid->intf, &hiddev_class);
825 hid->hiddev = hiddev; 881 if (retval) {
826 882 err_hid("Not able to get a minor for this device.");
827 hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; 883 kfree(hiddev);
884 return -1;
885 } else {
886 hid->minor = usbhid->intf->minor;
887 hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
888 }
828 889
829 return 0; 890 return 0;
830} 891}
@@ -839,7 +900,9 @@ void hiddev_disconnect(struct hid_device *hid)
839 struct hiddev *hiddev = hid->hiddev; 900 struct hiddev *hiddev = hid->hiddev;
840 struct usbhid_device *usbhid = hid->driver_data; 901 struct usbhid_device *usbhid = hid->driver_data;
841 902
903 mutex_lock(&hiddev->existancelock);
842 hiddev->exist = 0; 904 hiddev->exist = 0;
905 mutex_unlock(&hiddev->existancelock);
843 906
844 hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL; 907 hiddev_table[hiddev->hid->minor - HIDDEV_MINOR_BASE] = NULL;
845 usb_deregister_dev(usbhid->intf, &hiddev_class); 908 usb_deregister_dev(usbhid->intf, &hiddev_class);
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h
index 332abcdf9956..9eb30564be9c 100644
--- a/drivers/hid/usbhid/usbhid.h
+++ b/drivers/hid/usbhid/usbhid.h
@@ -40,6 +40,16 @@ int usbhid_open(struct hid_device *hid);
40void usbhid_init_reports(struct hid_device *hid); 40void usbhid_init_reports(struct hid_device *hid);
41void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir); 41void usbhid_submit_report(struct hid_device *hid, struct hid_report *report, unsigned char dir);
42 42
43/* iofl flags */
44#define HID_CTRL_RUNNING 1
45#define HID_OUT_RUNNING 2
46#define HID_IN_RUNNING 3
47#define HID_RESET_PENDING 4
48#define HID_SUSPENDED 5
49#define HID_CLEAR_HALT 6
50#define HID_DISCONNECTED 7
51#define HID_STARTED 8
52
43/* 53/*
44 * USB-specific HID struct, to be pointed to 54 * USB-specific HID struct, to be pointed to
45 * from struct hid_device->driver_data 55 * from struct hid_device->driver_data
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 608038d64f81..be8ee2cac8bb 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -2,13 +2,16 @@
2 * TI OMAP I2C master mode driver 2 * TI OMAP I2C master mode driver
3 * 3 *
4 * Copyright (C) 2003 MontaVista Software, Inc. 4 * Copyright (C) 2003 MontaVista Software, Inc.
5 * Copyright (C) 2004 Texas Instruments.
6 *
7 * Updated to work with multiple I2C interfaces on 24xx by
8 * Tony Lindgren <tony@atomide.com> and Imre Deak <imre.deak@nokia.com>
9 * Copyright (C) 2005 Nokia Corporation 5 * Copyright (C) 2005 Nokia Corporation
6 * Copyright (C) 2004 - 2007 Texas Instruments.
10 * 7 *
11 * Cleaned up by Juha Yrjölä <juha.yrjola@nokia.com> 8 * Originally written by MontaVista Software, Inc.
9 * Additional contributions by:
10 * Tony Lindgren <tony@atomide.com>
11 * Imre Deak <imre.deak@nokia.com>
12 * Juha Yrjölä <juha.yrjola@solidboot.com>
13 * Syed Khasim <x0khasim@ti.com>
14 * Nishant Menon <nm@ti.com>
12 * 15 *
13 * This program is free software; you can redistribute it and/or modify 16 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 17 * it under the terms of the GNU General Public License as published by
@@ -33,8 +36,14 @@
33#include <linux/completion.h> 36#include <linux/completion.h>
34#include <linux/platform_device.h> 37#include <linux/platform_device.h>
35#include <linux/clk.h> 38#include <linux/clk.h>
39#include <linux/io.h>
40
41/* I2C controller revisions */
42#define OMAP_I2C_REV_2 0x20
36 43
37#include <asm/io.h> 44/* I2C controller revisions present on specific hardware */
45#define OMAP_I2C_REV_ON_2430 0x36
46#define OMAP_I2C_REV_ON_3430 0x3C
38 47
39/* timeout waiting for the controller to respond */ 48/* timeout waiting for the controller to respond */
40#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000)) 49#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
@@ -43,6 +52,8 @@
43#define OMAP_I2C_IE_REG 0x04 52#define OMAP_I2C_IE_REG 0x04
44#define OMAP_I2C_STAT_REG 0x08 53#define OMAP_I2C_STAT_REG 0x08
45#define OMAP_I2C_IV_REG 0x0c 54#define OMAP_I2C_IV_REG 0x0c
55/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
56#define OMAP_I2C_WE_REG 0x0c
46#define OMAP_I2C_SYSS_REG 0x10 57#define OMAP_I2C_SYSS_REG 0x10
47#define OMAP_I2C_BUF_REG 0x14 58#define OMAP_I2C_BUF_REG 0x14
48#define OMAP_I2C_CNT_REG 0x18 59#define OMAP_I2C_CNT_REG 0x18
@@ -55,8 +66,11 @@
55#define OMAP_I2C_SCLL_REG 0x34 66#define OMAP_I2C_SCLL_REG 0x34
56#define OMAP_I2C_SCLH_REG 0x38 67#define OMAP_I2C_SCLH_REG 0x38
57#define OMAP_I2C_SYSTEST_REG 0x3c 68#define OMAP_I2C_SYSTEST_REG 0x3c
69#define OMAP_I2C_BUFSTAT_REG 0x40
58 70
59/* I2C Interrupt Enable Register (OMAP_I2C_IE): */ 71/* I2C Interrupt Enable Register (OMAP_I2C_IE): */
72#define OMAP_I2C_IE_XDR (1 << 14) /* TX Buffer drain int enable */
73#define OMAP_I2C_IE_RDR (1 << 13) /* RX Buffer drain int enable */
60#define OMAP_I2C_IE_XRDY (1 << 4) /* TX data ready int enable */ 74#define OMAP_I2C_IE_XRDY (1 << 4) /* TX data ready int enable */
61#define OMAP_I2C_IE_RRDY (1 << 3) /* RX data ready int enable */ 75#define OMAP_I2C_IE_RRDY (1 << 3) /* RX data ready int enable */
62#define OMAP_I2C_IE_ARDY (1 << 2) /* Access ready int enable */ 76#define OMAP_I2C_IE_ARDY (1 << 2) /* Access ready int enable */
@@ -64,7 +78,8 @@
64#define OMAP_I2C_IE_AL (1 << 0) /* Arbitration lost int ena */ 78#define OMAP_I2C_IE_AL (1 << 0) /* Arbitration lost int ena */
65 79
66/* I2C Status Register (OMAP_I2C_STAT): */ 80/* I2C Status Register (OMAP_I2C_STAT): */
67#define OMAP_I2C_STAT_SBD (1 << 15) /* Single byte data */ 81#define OMAP_I2C_STAT_XDR (1 << 14) /* TX Buffer draining */
82#define OMAP_I2C_STAT_RDR (1 << 13) /* RX Buffer draining */
68#define OMAP_I2C_STAT_BB (1 << 12) /* Bus busy */ 83#define OMAP_I2C_STAT_BB (1 << 12) /* Bus busy */
69#define OMAP_I2C_STAT_ROVR (1 << 11) /* Receive overrun */ 84#define OMAP_I2C_STAT_ROVR (1 << 11) /* Receive overrun */
70#define OMAP_I2C_STAT_XUDF (1 << 10) /* Transmit underflow */ 85#define OMAP_I2C_STAT_XUDF (1 << 10) /* Transmit underflow */
@@ -76,13 +91,34 @@
76#define OMAP_I2C_STAT_NACK (1 << 1) /* No ack interrupt enable */ 91#define OMAP_I2C_STAT_NACK (1 << 1) /* No ack interrupt enable */
77#define OMAP_I2C_STAT_AL (1 << 0) /* Arbitration lost int ena */ 92#define OMAP_I2C_STAT_AL (1 << 0) /* Arbitration lost int ena */
78 93
94/* I2C WE wakeup enable register */
95#define OMAP_I2C_WE_XDR_WE (1 << 14) /* TX drain wakup */
96#define OMAP_I2C_WE_RDR_WE (1 << 13) /* RX drain wakeup */
97#define OMAP_I2C_WE_AAS_WE (1 << 9) /* Address as slave wakeup*/
98#define OMAP_I2C_WE_BF_WE (1 << 8) /* Bus free wakeup */
99#define OMAP_I2C_WE_STC_WE (1 << 6) /* Start condition wakeup */
100#define OMAP_I2C_WE_GC_WE (1 << 5) /* General call wakeup */
101#define OMAP_I2C_WE_DRDY_WE (1 << 3) /* TX/RX data ready wakeup */
102#define OMAP_I2C_WE_ARDY_WE (1 << 2) /* Reg access ready wakeup */
103#define OMAP_I2C_WE_NACK_WE (1 << 1) /* No acknowledgment wakeup */
104#define OMAP_I2C_WE_AL_WE (1 << 0) /* Arbitration lost wakeup */
105
106#define OMAP_I2C_WE_ALL (OMAP_I2C_WE_XDR_WE | OMAP_I2C_WE_RDR_WE | \
107 OMAP_I2C_WE_AAS_WE | OMAP_I2C_WE_BF_WE | \
108 OMAP_I2C_WE_STC_WE | OMAP_I2C_WE_GC_WE | \
109 OMAP_I2C_WE_DRDY_WE | OMAP_I2C_WE_ARDY_WE | \
110 OMAP_I2C_WE_NACK_WE | OMAP_I2C_WE_AL_WE)
111
79/* I2C Buffer Configuration Register (OMAP_I2C_BUF): */ 112/* I2C Buffer Configuration Register (OMAP_I2C_BUF): */
80#define OMAP_I2C_BUF_RDMA_EN (1 << 15) /* RX DMA channel enable */ 113#define OMAP_I2C_BUF_RDMA_EN (1 << 15) /* RX DMA channel enable */
114#define OMAP_I2C_BUF_RXFIF_CLR (1 << 14) /* RX FIFO Clear */
81#define OMAP_I2C_BUF_XDMA_EN (1 << 7) /* TX DMA channel enable */ 115#define OMAP_I2C_BUF_XDMA_EN (1 << 7) /* TX DMA channel enable */
116#define OMAP_I2C_BUF_TXFIF_CLR (1 << 6) /* TX FIFO Clear */
82 117
83/* I2C Configuration Register (OMAP_I2C_CON): */ 118/* I2C Configuration Register (OMAP_I2C_CON): */
84#define OMAP_I2C_CON_EN (1 << 15) /* I2C module enable */ 119#define OMAP_I2C_CON_EN (1 << 15) /* I2C module enable */
85#define OMAP_I2C_CON_BE (1 << 14) /* Big endian mode */ 120#define OMAP_I2C_CON_BE (1 << 14) /* Big endian mode */
121#define OMAP_I2C_CON_OPMODE_HS (1 << 12) /* High Speed support */
86#define OMAP_I2C_CON_STB (1 << 11) /* Start byte mode (master) */ 122#define OMAP_I2C_CON_STB (1 << 11) /* Start byte mode (master) */
87#define OMAP_I2C_CON_MST (1 << 10) /* Master/slave mode */ 123#define OMAP_I2C_CON_MST (1 << 10) /* Master/slave mode */
88#define OMAP_I2C_CON_TRX (1 << 9) /* TX/RX mode (master only) */ 124#define OMAP_I2C_CON_TRX (1 << 9) /* TX/RX mode (master only) */
@@ -91,6 +127,10 @@
91#define OMAP_I2C_CON_STP (1 << 1) /* Stop cond (master only) */ 127#define OMAP_I2C_CON_STP (1 << 1) /* Stop cond (master only) */
92#define OMAP_I2C_CON_STT (1 << 0) /* Start condition (master) */ 128#define OMAP_I2C_CON_STT (1 << 0) /* Start condition (master) */
93 129
130/* I2C SCL time value when Master */
131#define OMAP_I2C_SCLL_HSSCLL 8
132#define OMAP_I2C_SCLH_HSSCLH 8
133
94/* I2C System Test Register (OMAP_I2C_SYSTEST): */ 134/* I2C System Test Register (OMAP_I2C_SYSTEST): */
95#ifdef DEBUG 135#ifdef DEBUG
96#define OMAP_I2C_SYSTEST_ST_EN (1 << 15) /* System test enable */ 136#define OMAP_I2C_SYSTEST_ST_EN (1 << 15) /* System test enable */
@@ -103,17 +143,19 @@
103#define OMAP_I2C_SYSTEST_SDA_O (1 << 0) /* SDA line drive out */ 143#define OMAP_I2C_SYSTEST_SDA_O (1 << 0) /* SDA line drive out */
104#endif 144#endif
105 145
106/* I2C System Status register (OMAP_I2C_SYSS): */ 146/* OCP_SYSSTATUS bit definitions */
107#define OMAP_I2C_SYSS_RDONE (1 << 0) /* Reset Done */ 147#define SYSS_RESETDONE_MASK (1 << 0)
148
149/* OCP_SYSCONFIG bit definitions */
150#define SYSC_CLOCKACTIVITY_MASK (0x3 << 8)
151#define SYSC_SIDLEMODE_MASK (0x3 << 3)
152#define SYSC_ENAWAKEUP_MASK (1 << 2)
153#define SYSC_SOFTRESET_MASK (1 << 1)
154#define SYSC_AUTOIDLE_MASK (1 << 0)
108 155
109/* I2C System Configuration Register (OMAP_I2C_SYSC): */ 156#define SYSC_IDLEMODE_SMART 0x2
110#define OMAP_I2C_SYSC_SRST (1 << 1) /* Soft Reset */ 157#define SYSC_CLOCKACTIVITY_FCLK 0x2
111 158
112/* REVISIT: Use platform_data instead of module parameters */
113/* Fast Mode = 400 kHz, Standard = 100 kHz */
114static int clock = 100; /* Default: 100 kHz */
115module_param(clock, int, 0);
116MODULE_PARM_DESC(clock, "Set I2C clock in kHz: 400=fast mode (default == 100)");
117 159
118struct omap_i2c_dev { 160struct omap_i2c_dev {
119 struct device *dev; 161 struct device *dev;
@@ -123,11 +165,17 @@ struct omap_i2c_dev {
123 struct clk *fclk; /* Functional clock */ 165 struct clk *fclk; /* Functional clock */
124 struct completion cmd_complete; 166 struct completion cmd_complete;
125 struct resource *ioarea; 167 struct resource *ioarea;
168 u32 speed; /* Speed of bus in Khz */
126 u16 cmd_err; 169 u16 cmd_err;
127 u8 *buf; 170 u8 *buf;
128 size_t buf_len; 171 size_t buf_len;
129 struct i2c_adapter adapter; 172 struct i2c_adapter adapter;
130 unsigned rev1:1; 173 u8 fifo_size; /* use as flag and value
174 * fifo_size==0 implies no fifo
175 * if set, should be trsh+1
176 */
177 u8 rev;
178 unsigned b_hw:1; /* bad h/w fixes */
131 unsigned idle:1; 179 unsigned idle:1;
132 u16 iestate; /* Saved interrupt register */ 180 u16 iestate; /* Saved interrupt register */
133}; 181};
@@ -143,9 +191,9 @@ static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
143 return __raw_readw(i2c_dev->base + reg); 191 return __raw_readw(i2c_dev->base + reg);
144} 192}
145 193
146static int omap_i2c_get_clocks(struct omap_i2c_dev *dev) 194static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
147{ 195{
148 if (cpu_is_omap16xx() || cpu_is_omap24xx()) { 196 if (cpu_is_omap16xx() || cpu_class_is_omap2()) {
149 dev->iclk = clk_get(dev->dev, "i2c_ick"); 197 dev->iclk = clk_get(dev->dev, "i2c_ick");
150 if (IS_ERR(dev->iclk)) { 198 if (IS_ERR(dev->iclk)) {
151 dev->iclk = NULL; 199 dev->iclk = NULL;
@@ -178,25 +226,33 @@ static void omap_i2c_put_clocks(struct omap_i2c_dev *dev)
178 226
179static void omap_i2c_unidle(struct omap_i2c_dev *dev) 227static void omap_i2c_unidle(struct omap_i2c_dev *dev)
180{ 228{
229 WARN_ON(!dev->idle);
230
181 if (dev->iclk != NULL) 231 if (dev->iclk != NULL)
182 clk_enable(dev->iclk); 232 clk_enable(dev->iclk);
183 clk_enable(dev->fclk); 233 clk_enable(dev->fclk);
234 dev->idle = 0;
184 if (dev->iestate) 235 if (dev->iestate)
185 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate); 236 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, dev->iestate);
186 dev->idle = 0;
187} 237}
188 238
189static void omap_i2c_idle(struct omap_i2c_dev *dev) 239static void omap_i2c_idle(struct omap_i2c_dev *dev)
190{ 240{
191 u16 iv; 241 u16 iv;
192 242
193 dev->idle = 1; 243 WARN_ON(dev->idle);
244
194 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG); 245 dev->iestate = omap_i2c_read_reg(dev, OMAP_I2C_IE_REG);
195 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0); 246 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 0);
196 if (dev->rev1) 247 if (dev->rev < OMAP_I2C_REV_2) {
197 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */ 248 iv = omap_i2c_read_reg(dev, OMAP_I2C_IV_REG); /* Read clears */
198 else 249 } else {
199 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate); 250 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, dev->iestate);
251
252 /* Flush posted write before the dev->idle store occurs */
253 omap_i2c_read_reg(dev, OMAP_I2C_STAT_REG);
254 }
255 dev->idle = 1;
200 clk_disable(dev->fclk); 256 clk_disable(dev->fclk);
201 if (dev->iclk != NULL) 257 if (dev->iclk != NULL)
202 clk_disable(dev->iclk); 258 clk_disable(dev->iclk);
@@ -204,18 +260,20 @@ static void omap_i2c_idle(struct omap_i2c_dev *dev)
204 260
205static int omap_i2c_init(struct omap_i2c_dev *dev) 261static int omap_i2c_init(struct omap_i2c_dev *dev)
206{ 262{
207 u16 psc = 0; 263 u16 psc = 0, scll = 0, sclh = 0;
264 u16 fsscll = 0, fssclh = 0, hsscll = 0, hssclh = 0;
208 unsigned long fclk_rate = 12000000; 265 unsigned long fclk_rate = 12000000;
209 unsigned long timeout; 266 unsigned long timeout;
267 unsigned long internal_clk = 0;
210 268
211 if (!dev->rev1) { 269 if (dev->rev >= OMAP_I2C_REV_2) {
212 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, OMAP_I2C_SYSC_SRST); 270 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, SYSC_SOFTRESET_MASK);
213 /* For some reason we need to set the EN bit before the 271 /* For some reason we need to set the EN bit before the
214 * reset done bit gets set. */ 272 * reset done bit gets set. */
215 timeout = jiffies + OMAP_I2C_TIMEOUT; 273 timeout = jiffies + OMAP_I2C_TIMEOUT;
216 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN); 274 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
217 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) & 275 while (!(omap_i2c_read_reg(dev, OMAP_I2C_SYSS_REG) &
218 OMAP_I2C_SYSS_RDONE)) { 276 SYSS_RESETDONE_MASK)) {
219 if (time_after(jiffies, timeout)) { 277 if (time_after(jiffies, timeout)) {
220 dev_warn(dev->dev, "timeout waiting " 278 dev_warn(dev->dev, "timeout waiting "
221 "for controller reset\n"); 279 "for controller reset\n");
@@ -223,6 +281,33 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
223 } 281 }
224 msleep(1); 282 msleep(1);
225 } 283 }
284
285 /* SYSC register is cleared by the reset; rewrite it */
286 if (dev->rev == OMAP_I2C_REV_ON_2430) {
287
288 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG,
289 SYSC_AUTOIDLE_MASK);
290
291 } else if (dev->rev >= OMAP_I2C_REV_ON_3430) {
292 u32 v;
293
294 v = SYSC_AUTOIDLE_MASK;
295 v |= SYSC_ENAWAKEUP_MASK;
296 v |= (SYSC_IDLEMODE_SMART <<
297 __ffs(SYSC_SIDLEMODE_MASK));
298 v |= (SYSC_CLOCKACTIVITY_FCLK <<
299 __ffs(SYSC_CLOCKACTIVITY_MASK));
300
301 omap_i2c_write_reg(dev, OMAP_I2C_SYSC_REG, v);
302 /*
303 * Enabling all wakup sources to stop I2C freezing on
304 * WFI instruction.
305 * REVISIT: Some wkup sources might not be needed.
306 */
307 omap_i2c_write_reg(dev, OMAP_I2C_WE_REG,
308 OMAP_I2C_WE_ALL);
309
310 }
226 } 311 }
227 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0); 312 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, 0);
228 313
@@ -249,27 +334,65 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
249 psc = fclk_rate / 12000000; 334 psc = fclk_rate / 12000000;
250 } 335 }
251 336
337 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
338
339 /* HSI2C controller internal clk rate should be 19.2 Mhz */
340 internal_clk = 19200;
341 fclk_rate = clk_get_rate(dev->fclk) / 1000;
342
343 /* Compute prescaler divisor */
344 psc = fclk_rate / internal_clk;
345 psc = psc - 1;
346
347 /* If configured for High Speed */
348 if (dev->speed > 400) {
349 /* For first phase of HS mode */
350 fsscll = internal_clk / (400 * 2) - 6;
351 fssclh = internal_clk / (400 * 2) - 6;
352
353 /* For second phase of HS mode */
354 hsscll = fclk_rate / (dev->speed * 2) - 6;
355 hssclh = fclk_rate / (dev->speed * 2) - 6;
356 } else {
357 /* To handle F/S modes */
358 fsscll = internal_clk / (dev->speed * 2) - 6;
359 fssclh = internal_clk / (dev->speed * 2) - 6;
360 }
361 scll = (hsscll << OMAP_I2C_SCLL_HSSCLL) | fsscll;
362 sclh = (hssclh << OMAP_I2C_SCLH_HSSCLH) | fssclh;
363 } else {
364 /* Program desired operating rate */
365 fclk_rate /= (psc + 1) * 1000;
366 if (psc > 2)
367 psc = 2;
368 scll = fclk_rate / (dev->speed * 2) - 7 + psc;
369 sclh = fclk_rate / (dev->speed * 2) - 7 + psc;
370 }
371
252 /* Setup clock prescaler to obtain approx 12MHz I2C module clock: */ 372 /* Setup clock prescaler to obtain approx 12MHz I2C module clock: */
253 omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, psc); 373 omap_i2c_write_reg(dev, OMAP_I2C_PSC_REG, psc);
254 374
255 /* Program desired operating rate */ 375 /* SCL low and high time values */
256 fclk_rate /= (psc + 1) * 1000; 376 omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, scll);
257 if (psc > 2) 377 omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, sclh);
258 psc = 2;
259 378
260 omap_i2c_write_reg(dev, OMAP_I2C_SCLL_REG, 379 if (dev->fifo_size)
261 fclk_rate / (clock * 2) - 7 + psc); 380 /* Note: setup required fifo size - 1 */
262 omap_i2c_write_reg(dev, OMAP_I2C_SCLH_REG, 381 omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG,
263 fclk_rate / (clock * 2) - 7 + psc); 382 (dev->fifo_size - 1) << 8 | /* RTRSH */
383 OMAP_I2C_BUF_RXFIF_CLR |
384 (dev->fifo_size - 1) | /* XTRSH */
385 OMAP_I2C_BUF_TXFIF_CLR);
264 386
265 /* Take the I2C module out of reset: */ 387 /* Take the I2C module out of reset: */
266 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN); 388 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, OMAP_I2C_CON_EN);
267 389
268 /* Enable interrupts */ 390 /* Enable interrupts */
269 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG, 391 omap_i2c_write_reg(dev, OMAP_I2C_IE_REG,
270 (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY | 392 (OMAP_I2C_IE_XRDY | OMAP_I2C_IE_RRDY |
271 OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK | 393 OMAP_I2C_IE_ARDY | OMAP_I2C_IE_NACK |
272 OMAP_I2C_IE_AL)); 394 OMAP_I2C_IE_AL) | ((dev->fifo_size) ?
395 (OMAP_I2C_IE_RDR | OMAP_I2C_IE_XDR) : 0));
273 return 0; 396 return 0;
274} 397}
275 398
@@ -316,20 +439,59 @@ static int omap_i2c_xfer_msg(struct i2c_adapter *adap,
316 439
317 omap_i2c_write_reg(dev, OMAP_I2C_CNT_REG, dev->buf_len); 440 omap_i2c_write_reg(dev, OMAP_I2C_CNT_REG, dev->buf_len);
318 441
442 /* Clear the FIFO Buffers */
443 w = omap_i2c_read_reg(dev, OMAP_I2C_BUF_REG);
444 w |= OMAP_I2C_BUF_RXFIF_CLR | OMAP_I2C_BUF_TXFIF_CLR;
445 omap_i2c_write_reg(dev, OMAP_I2C_BUF_REG, w);
446
319 init_completion(&dev->cmd_complete); 447 init_completion(&dev->cmd_complete);
320 dev->cmd_err = 0; 448 dev->cmd_err = 0;
321 449
322 w = OMAP_I2C_CON_EN | OMAP_I2C_CON_MST | OMAP_I2C_CON_STT; 450 w = OMAP_I2C_CON_EN | OMAP_I2C_CON_MST | OMAP_I2C_CON_STT;
451
452 /* High speed configuration */
453 if (dev->speed > 400)
454 w |= OMAP_I2C_CON_OPMODE_HS;
455
323 if (msg->flags & I2C_M_TEN) 456 if (msg->flags & I2C_M_TEN)
324 w |= OMAP_I2C_CON_XA; 457 w |= OMAP_I2C_CON_XA;
325 if (!(msg->flags & I2C_M_RD)) 458 if (!(msg->flags & I2C_M_RD))
326 w |= OMAP_I2C_CON_TRX; 459 w |= OMAP_I2C_CON_TRX;
327 if (stop) 460
461 if (!dev->b_hw && stop)
328 w |= OMAP_I2C_CON_STP; 462 w |= OMAP_I2C_CON_STP;
463
329 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w); 464 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
330 465
331 r = wait_for_completion_interruptible_timeout(&dev->cmd_complete, 466 /*
332 OMAP_I2C_TIMEOUT); 467 * Don't write stt and stp together on some hardware.
468 */
469 if (dev->b_hw && stop) {
470 unsigned long delay = jiffies + OMAP_I2C_TIMEOUT;
471 u16 con = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
472 while (con & OMAP_I2C_CON_STT) {
473 con = omap_i2c_read_reg(dev, OMAP_I2C_CON_REG);
474
475 /* Let the user know if i2c is in a bad state */
476 if (time_after(jiffies, delay)) {
477 dev_err(dev->dev, "controller timed out "
478 "waiting for start condition to finish\n");
479 return -ETIMEDOUT;
480 }
481 cpu_relax();
482 }
483
484 w |= OMAP_I2C_CON_STP;
485 w &= ~OMAP_I2C_CON_STT;
486 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG, w);
487 }
488
489 /*
490 * REVISIT: We should abort the transfer on signals, but the bus goes
491 * into arbitration and we're currently unable to recover from it.
492 */
493 r = wait_for_completion_timeout(&dev->cmd_complete,
494 OMAP_I2C_TIMEOUT);
333 dev->buf_len = 0; 495 dev->buf_len = 0;
334 if (r < 0) 496 if (r < 0)
335 return r; 497 return r;
@@ -376,7 +538,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
376 538
377 omap_i2c_unidle(dev); 539 omap_i2c_unidle(dev);
378 540
379 if ((r = omap_i2c_wait_for_bb(dev)) < 0) 541 r = omap_i2c_wait_for_bb(dev);
542 if (r < 0)
380 goto out; 543 goto out;
381 544
382 for (i = 0; i < num; i++) { 545 for (i = 0; i < num; i++) {
@@ -411,6 +574,9 @@ omap_i2c_ack_stat(struct omap_i2c_dev *dev, u16 stat)
411 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); 574 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
412} 575}
413 576
577/* rev1 devices are apparently only on some 15xx */
578#ifdef CONFIG_ARCH_OMAP15XX
579
414static irqreturn_t 580static irqreturn_t
415omap_i2c_rev1_isr(int this_irq, void *dev_id) 581omap_i2c_rev1_isr(int this_irq, void *dev_id)
416{ 582{
@@ -465,6 +631,9 @@ omap_i2c_rev1_isr(int this_irq, void *dev_id)
465 631
466 return IRQ_HANDLED; 632 return IRQ_HANDLED;
467} 633}
634#else
635#define omap_i2c_rev1_isr NULL
636#endif
468 637
469static irqreturn_t 638static irqreturn_t
470omap_i2c_isr(int this_irq, void *dev_id) 639omap_i2c_isr(int this_irq, void *dev_id)
@@ -472,7 +641,7 @@ omap_i2c_isr(int this_irq, void *dev_id)
472 struct omap_i2c_dev *dev = dev_id; 641 struct omap_i2c_dev *dev = dev_id;
473 u16 bits; 642 u16 bits;
474 u16 stat, w; 643 u16 stat, w;
475 int count = 0; 644 int err, count = 0;
476 645
477 if (dev->idle) 646 if (dev->idle)
478 return IRQ_NONE; 647 return IRQ_NONE;
@@ -487,39 +656,96 @@ omap_i2c_isr(int this_irq, void *dev_id)
487 656
488 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat); 657 omap_i2c_write_reg(dev, OMAP_I2C_STAT_REG, stat);
489 658
490 if (stat & OMAP_I2C_STAT_ARDY) { 659 err = 0;
491 omap_i2c_complete_cmd(dev, 0); 660 if (stat & OMAP_I2C_STAT_NACK) {
492 continue; 661 err |= OMAP_I2C_STAT_NACK;
662 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
663 OMAP_I2C_CON_STP);
493 } 664 }
494 if (stat & OMAP_I2C_STAT_RRDY) { 665 if (stat & OMAP_I2C_STAT_AL) {
495 w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG); 666 dev_err(dev->dev, "Arbitration lost\n");
496 if (dev->buf_len) { 667 err |= OMAP_I2C_STAT_AL;
497 *dev->buf++ = w; 668 }
498 dev->buf_len--; 669 if (stat & (OMAP_I2C_STAT_ARDY | OMAP_I2C_STAT_NACK |
670 OMAP_I2C_STAT_AL))
671 omap_i2c_complete_cmd(dev, err);
672 if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
673 u8 num_bytes = 1;
674 if (dev->fifo_size) {
675 if (stat & OMAP_I2C_STAT_RRDY)
676 num_bytes = dev->fifo_size;
677 else
678 num_bytes = omap_i2c_read_reg(dev,
679 OMAP_I2C_BUFSTAT_REG);
680 }
681 while (num_bytes) {
682 num_bytes--;
683 w = omap_i2c_read_reg(dev, OMAP_I2C_DATA_REG);
499 if (dev->buf_len) { 684 if (dev->buf_len) {
500 *dev->buf++ = w >> 8; 685 *dev->buf++ = w;
501 dev->buf_len--; 686 dev->buf_len--;
687 /* Data reg from 2430 is 8 bit wide */
688 if (!cpu_is_omap2430() &&
689 !cpu_is_omap34xx()) {
690 if (dev->buf_len) {
691 *dev->buf++ = w >> 8;
692 dev->buf_len--;
693 }
694 }
695 } else {
696 if (stat & OMAP_I2C_STAT_RRDY)
697 dev_err(dev->dev,
698 "RRDY IRQ while no data"
699 " requested\n");
700 if (stat & OMAP_I2C_STAT_RDR)
701 dev_err(dev->dev,
702 "RDR IRQ while no data"
703 " requested\n");
704 break;
502 } 705 }
503 } else 706 }
504 dev_err(dev->dev, "RRDY IRQ while no data " 707 omap_i2c_ack_stat(dev,
505 "requested\n"); 708 stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR));
506 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_RRDY);
507 continue; 709 continue;
508 } 710 }
509 if (stat & OMAP_I2C_STAT_XRDY) { 711 if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
510 w = 0; 712 u8 num_bytes = 1;
511 if (dev->buf_len) { 713 if (dev->fifo_size) {
512 w = *dev->buf++; 714 if (stat & OMAP_I2C_STAT_XRDY)
513 dev->buf_len--; 715 num_bytes = dev->fifo_size;
716 else
717 num_bytes = omap_i2c_read_reg(dev,
718 OMAP_I2C_BUFSTAT_REG);
719 }
720 while (num_bytes) {
721 num_bytes--;
722 w = 0;
514 if (dev->buf_len) { 723 if (dev->buf_len) {
515 w |= *dev->buf++ << 8; 724 w = *dev->buf++;
516 dev->buf_len--; 725 dev->buf_len--;
726 /* Data reg from 2430 is 8 bit wide */
727 if (!cpu_is_omap2430() &&
728 !cpu_is_omap34xx()) {
729 if (dev->buf_len) {
730 w |= *dev->buf++ << 8;
731 dev->buf_len--;
732 }
733 }
734 } else {
735 if (stat & OMAP_I2C_STAT_XRDY)
736 dev_err(dev->dev,
737 "XRDY IRQ while no "
738 "data to send\n");
739 if (stat & OMAP_I2C_STAT_XDR)
740 dev_err(dev->dev,
741 "XDR IRQ while no "
742 "data to send\n");
743 break;
517 } 744 }
518 } else 745 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w);
519 dev_err(dev->dev, "XRDY IRQ while no " 746 }
520 "data to send\n"); 747 omap_i2c_ack_stat(dev,
521 omap_i2c_write_reg(dev, OMAP_I2C_DATA_REG, w); 748 stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR));
522 omap_i2c_ack_stat(dev, OMAP_I2C_STAT_XRDY);
523 continue; 749 continue;
524 } 750 }
525 if (stat & OMAP_I2C_STAT_ROVR) { 751 if (stat & OMAP_I2C_STAT_ROVR) {
@@ -527,18 +753,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
527 dev->cmd_err |= OMAP_I2C_STAT_ROVR; 753 dev->cmd_err |= OMAP_I2C_STAT_ROVR;
528 } 754 }
529 if (stat & OMAP_I2C_STAT_XUDF) { 755 if (stat & OMAP_I2C_STAT_XUDF) {
530 dev_err(dev->dev, "Transmit overflow\n"); 756 dev_err(dev->dev, "Transmit underflow\n");
531 dev->cmd_err |= OMAP_I2C_STAT_XUDF; 757 dev->cmd_err |= OMAP_I2C_STAT_XUDF;
532 } 758 }
533 if (stat & OMAP_I2C_STAT_NACK) {
534 omap_i2c_complete_cmd(dev, OMAP_I2C_STAT_NACK);
535 omap_i2c_write_reg(dev, OMAP_I2C_CON_REG,
536 OMAP_I2C_CON_STP);
537 }
538 if (stat & OMAP_I2C_STAT_AL) {
539 dev_err(dev->dev, "Arbitration lost\n");
540 omap_i2c_complete_cmd(dev, OMAP_I2C_STAT_AL);
541 }
542 } 759 }
543 760
544 return count ? IRQ_HANDLED : IRQ_NONE; 761 return count ? IRQ_HANDLED : IRQ_NONE;
@@ -549,13 +766,15 @@ static const struct i2c_algorithm omap_i2c_algo = {
549 .functionality = omap_i2c_func, 766 .functionality = omap_i2c_func,
550}; 767};
551 768
552static int 769static int __init
553omap_i2c_probe(struct platform_device *pdev) 770omap_i2c_probe(struct platform_device *pdev)
554{ 771{
555 struct omap_i2c_dev *dev; 772 struct omap_i2c_dev *dev;
556 struct i2c_adapter *adap; 773 struct i2c_adapter *adap;
557 struct resource *mem, *irq, *ioarea; 774 struct resource *mem, *irq, *ioarea;
775 irq_handler_t isr;
558 int r; 776 int r;
777 u32 speed = 0;
559 778
560 /* NOTE: driver uses the static register mapping */ 779 /* NOTE: driver uses the static register mapping */
561 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 780 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -576,17 +795,19 @@ omap_i2c_probe(struct platform_device *pdev)
576 return -EBUSY; 795 return -EBUSY;
577 } 796 }
578 797
579 if (clock > 200)
580 clock = 400; /* Fast mode */
581 else
582 clock = 100; /* Standard mode */
583
584 dev = kzalloc(sizeof(struct omap_i2c_dev), GFP_KERNEL); 798 dev = kzalloc(sizeof(struct omap_i2c_dev), GFP_KERNEL);
585 if (!dev) { 799 if (!dev) {
586 r = -ENOMEM; 800 r = -ENOMEM;
587 goto err_release_region; 801 goto err_release_region;
588 } 802 }
589 803
804 if (pdev->dev.platform_data != NULL)
805 speed = *(u32 *)pdev->dev.platform_data;
806 else
807 speed = 100; /* Defualt speed */
808
809 dev->speed = speed;
810 dev->idle = 1;
590 dev->dev = &pdev->dev; 811 dev->dev = &pdev->dev;
591 dev->irq = irq->start; 812 dev->irq = irq->start;
592 dev->base = ioremap(mem->start, mem->end - mem->start + 1); 813 dev->base = ioremap(mem->start, mem->end - mem->start + 1);
@@ -602,22 +823,39 @@ omap_i2c_probe(struct platform_device *pdev)
602 823
603 omap_i2c_unidle(dev); 824 omap_i2c_unidle(dev);
604 825
605 if (cpu_is_omap15xx()) 826 dev->rev = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff;
606 dev->rev1 = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) < 0x20; 827
828 if (cpu_is_omap2430() || cpu_is_omap34xx()) {
829 u16 s;
830
831 /* Set up the fifo size - Get total size */
832 s = (omap_i2c_read_reg(dev, OMAP_I2C_BUFSTAT_REG) >> 14) & 0x3;
833 dev->fifo_size = 0x8 << s;
834
835 /*
836 * Set up notification threshold as half the total available
837 * size. This is to ensure that we can handle the status on int
838 * call back latencies.
839 */
840 dev->fifo_size = (dev->fifo_size / 2);
841 dev->b_hw = 1; /* Enable hardware fixes */
842 }
607 843
608 /* reset ASAP, clearing any IRQs */ 844 /* reset ASAP, clearing any IRQs */
609 omap_i2c_init(dev); 845 omap_i2c_init(dev);
610 846
611 r = request_irq(dev->irq, dev->rev1 ? omap_i2c_rev1_isr : omap_i2c_isr, 847 isr = (dev->rev < OMAP_I2C_REV_2) ? omap_i2c_rev1_isr : omap_i2c_isr;
612 0, pdev->name, dev); 848 r = request_irq(dev->irq, isr, 0, pdev->name, dev);
613 849
614 if (r) { 850 if (r) {
615 dev_err(dev->dev, "failure requesting irq %i\n", dev->irq); 851 dev_err(dev->dev, "failure requesting irq %i\n", dev->irq);
616 goto err_unuse_clocks; 852 goto err_unuse_clocks;
617 } 853 }
618 r = omap_i2c_read_reg(dev, OMAP_I2C_REV_REG) & 0xff; 854
619 dev_info(dev->dev, "bus %d rev%d.%d at %d kHz\n", 855 dev_info(dev->dev, "bus %d rev%d.%d at %d kHz\n",
620 pdev->id, r >> 4, r & 0xf, clock); 856 pdev->id, dev->rev >> 4, dev->rev & 0xf, dev->speed);
857
858 omap_i2c_idle(dev);
621 859
622 adap = &dev->adapter; 860 adap = &dev->adapter;
623 i2c_set_adapdata(adap, dev); 861 i2c_set_adapdata(adap, dev);
@@ -635,8 +873,6 @@ omap_i2c_probe(struct platform_device *pdev)
635 goto err_free_irq; 873 goto err_free_irq;
636 } 874 }
637 875
638 omap_i2c_idle(dev);
639
640 return 0; 876 return 0;
641 877
642err_free_irq: 878err_free_irq:
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index c39079f9c73f..f69f91ffb469 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -35,11 +35,9 @@
35#include <linux/clk.h> 35#include <linux/clk.h>
36#include <linux/cpufreq.h> 36#include <linux/cpufreq.h>
37 37
38#include <mach/hardware.h>
39#include <asm/irq.h> 38#include <asm/irq.h>
40#include <asm/io.h> 39#include <asm/io.h>
41 40
42#include <mach/regs-gpio.h>
43#include <plat/regs-iic.h> 41#include <plat/regs-iic.h>
44#include <plat/iic.h> 42#include <plat/iic.h>
45 43
@@ -64,6 +62,7 @@ struct s3c24xx_i2c {
64 unsigned int msg_ptr; 62 unsigned int msg_ptr;
65 63
66 unsigned int tx_setup; 64 unsigned int tx_setup;
65 unsigned int irq;
67 66
68 enum s3c24xx_i2c_state state; 67 enum s3c24xx_i2c_state state;
69 unsigned long clkrate; 68 unsigned long clkrate;
@@ -71,7 +70,6 @@ struct s3c24xx_i2c {
71 void __iomem *regs; 70 void __iomem *regs;
72 struct clk *clk; 71 struct clk *clk;
73 struct device *dev; 72 struct device *dev;
74 struct resource *irq;
75 struct resource *ioarea; 73 struct resource *ioarea;
76 struct i2c_adapter adap; 74 struct i2c_adapter adap;
77 75
@@ -80,16 +78,7 @@ struct s3c24xx_i2c {
80#endif 78#endif
81}; 79};
82 80
83/* default platform data to use if not supplied in the platform_device 81/* default platform data removed, dev should always carry data. */
84*/
85
86static struct s3c2410_platform_i2c s3c24xx_i2c_default_platform = {
87 .flags = 0,
88 .slave_addr = 0x10,
89 .bus_freq = 100*1000,
90 .max_freq = 400*1000,
91 .sda_delay = S3C2410_IICLC_SDA_DELAY5 | S3C2410_IICLC_FILTER_ON,
92};
93 82
94/* s3c24xx_i2c_is2440() 83/* s3c24xx_i2c_is2440()
95 * 84 *
@@ -103,21 +92,6 @@ static inline int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
103 return !strcmp(pdev->name, "s3c2440-i2c"); 92 return !strcmp(pdev->name, "s3c2440-i2c");
104} 93}
105 94
106
107/* s3c24xx_i2c_get_platformdata
108 *
109 * get the platform data associated with the given device, or return
110 * the default if there is none
111*/
112
113static inline struct s3c2410_platform_i2c *s3c24xx_i2c_get_platformdata(struct device *dev)
114{
115 if (dev->platform_data != NULL)
116 return (struct s3c2410_platform_i2c *)dev->platform_data;
117
118 return &s3c24xx_i2c_default_platform;
119}
120
121/* s3c24xx_i2c_master_complete 95/* s3c24xx_i2c_master_complete
122 * 96 *
123 * complete the message and wake up the caller, using the given return code, 97 * complete the message and wake up the caller, using the given return code,
@@ -130,7 +104,7 @@ static inline void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret)
130 104
131 i2c->msg_ptr = 0; 105 i2c->msg_ptr = 0;
132 i2c->msg = NULL; 106 i2c->msg = NULL;
133 i2c->msg_idx ++; 107 i2c->msg_idx++;
134 i2c->msg_num = 0; 108 i2c->msg_num = 0;
135 if (ret) 109 if (ret)
136 i2c->msg_idx = ret; 110 i2c->msg_idx = ret;
@@ -141,19 +115,17 @@ static inline void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret)
141static inline void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c) 115static inline void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c)
142{ 116{
143 unsigned long tmp; 117 unsigned long tmp;
144 118
145 tmp = readl(i2c->regs + S3C2410_IICCON); 119 tmp = readl(i2c->regs + S3C2410_IICCON);
146 writel(tmp & ~S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON); 120 writel(tmp & ~S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
147
148} 121}
149 122
150static inline void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c) 123static inline void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c)
151{ 124{
152 unsigned long tmp; 125 unsigned long tmp;
153 126
154 tmp = readl(i2c->regs + S3C2410_IICCON); 127 tmp = readl(i2c->regs + S3C2410_IICCON);
155 writel(tmp | S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON); 128 writel(tmp | S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
156
157} 129}
158 130
159/* irq enable/disable functions */ 131/* irq enable/disable functions */
@@ -161,7 +133,7 @@ static inline void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c)
161static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c) 133static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c)
162{ 134{
163 unsigned long tmp; 135 unsigned long tmp;
164 136
165 tmp = readl(i2c->regs + S3C2410_IICCON); 137 tmp = readl(i2c->regs + S3C2410_IICCON);
166 writel(tmp & ~S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON); 138 writel(tmp & ~S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
167} 139}
@@ -169,7 +141,7 @@ static inline void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c)
169static inline void s3c24xx_i2c_enable_irq(struct s3c24xx_i2c *i2c) 141static inline void s3c24xx_i2c_enable_irq(struct s3c24xx_i2c *i2c)
170{ 142{
171 unsigned long tmp; 143 unsigned long tmp;
172 144
173 tmp = readl(i2c->regs + S3C2410_IICCON); 145 tmp = readl(i2c->regs + S3C2410_IICCON);
174 writel(tmp | S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON); 146 writel(tmp | S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
175} 147}
@@ -177,10 +149,10 @@ static inline void s3c24xx_i2c_enable_irq(struct s3c24xx_i2c *i2c)
177 149
178/* s3c24xx_i2c_message_start 150/* s3c24xx_i2c_message_start
179 * 151 *
180 * put the start of a message onto the bus 152 * put the start of a message onto the bus
181*/ 153*/
182 154
183static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c, 155static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
184 struct i2c_msg *msg) 156 struct i2c_msg *msg)
185{ 157{
186 unsigned int addr = (msg->addr & 0x7f) << 1; 158 unsigned int addr = (msg->addr & 0x7f) << 1;
@@ -199,15 +171,15 @@ static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
199 if (msg->flags & I2C_M_REV_DIR_ADDR) 171 if (msg->flags & I2C_M_REV_DIR_ADDR)
200 addr ^= 1; 172 addr ^= 1;
201 173
202 // todo - check for wether ack wanted or not 174 /* todo - check for wether ack wanted or not */
203 s3c24xx_i2c_enable_ack(i2c); 175 s3c24xx_i2c_enable_ack(i2c);
204 176
205 iiccon = readl(i2c->regs + S3C2410_IICCON); 177 iiccon = readl(i2c->regs + S3C2410_IICCON);
206 writel(stat, i2c->regs + S3C2410_IICSTAT); 178 writel(stat, i2c->regs + S3C2410_IICSTAT);
207 179
208 dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr); 180 dev_dbg(i2c->dev, "START: %08lx to IICSTAT, %02x to DS\n", stat, addr);
209 writeb(addr, i2c->regs + S3C2410_IICDS); 181 writeb(addr, i2c->regs + S3C2410_IICDS);
210 182
211 /* delay here to ensure the data byte has gotten onto the bus 183 /* delay here to ensure the data byte has gotten onto the bus
212 * before the transaction is started */ 184 * before the transaction is started */
213 185
@@ -215,8 +187,8 @@ static void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
215 187
216 dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon); 188 dev_dbg(i2c->dev, "iiccon, %08lx\n", iiccon);
217 writel(iiccon, i2c->regs + S3C2410_IICCON); 189 writel(iiccon, i2c->regs + S3C2410_IICCON);
218 190
219 stat |= S3C2410_IICSTAT_START; 191 stat |= S3C2410_IICSTAT_START;
220 writel(stat, i2c->regs + S3C2410_IICSTAT); 192 writel(stat, i2c->regs + S3C2410_IICSTAT);
221} 193}
222 194
@@ -227,11 +199,11 @@ static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
227 dev_dbg(i2c->dev, "STOP\n"); 199 dev_dbg(i2c->dev, "STOP\n");
228 200
229 /* stop the transfer */ 201 /* stop the transfer */
230 iicstat &= ~ S3C2410_IICSTAT_START; 202 iicstat &= ~S3C2410_IICSTAT_START;
231 writel(iicstat, i2c->regs + S3C2410_IICSTAT); 203 writel(iicstat, i2c->regs + S3C2410_IICSTAT);
232 204
233 i2c->state = STATE_STOP; 205 i2c->state = STATE_STOP;
234 206
235 s3c24xx_i2c_master_complete(i2c, ret); 207 s3c24xx_i2c_master_complete(i2c, ret);
236 s3c24xx_i2c_disable_irq(i2c); 208 s3c24xx_i2c_disable_irq(i2c);
237} 209}
@@ -241,7 +213,7 @@ static inline void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
241 213
242/* is_lastmsg() 214/* is_lastmsg()
243 * 215 *
244 * returns TRUE if the current message is the last in the set 216 * returns TRUE if the current message is the last in the set
245*/ 217*/
246 218
247static inline int is_lastmsg(struct s3c24xx_i2c *i2c) 219static inline int is_lastmsg(struct s3c24xx_i2c *i2c)
@@ -289,14 +261,14 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
289 261
290 case STATE_STOP: 262 case STATE_STOP:
291 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__); 263 dev_err(i2c->dev, "%s: called in STATE_STOP\n", __func__);
292 s3c24xx_i2c_disable_irq(i2c); 264 s3c24xx_i2c_disable_irq(i2c);
293 goto out_ack; 265 goto out_ack;
294 266
295 case STATE_START: 267 case STATE_START:
296 /* last thing we did was send a start condition on the 268 /* last thing we did was send a start condition on the
297 * bus, or started a new i2c message 269 * bus, or started a new i2c message
298 */ 270 */
299 271
300 if (iicstat & S3C2410_IICSTAT_LASTBIT && 272 if (iicstat & S3C2410_IICSTAT_LASTBIT &&
301 !(i2c->msg->flags & I2C_M_IGNORE_NAK)) { 273 !(i2c->msg->flags & I2C_M_IGNORE_NAK)) {
302 /* ack was not received... */ 274 /* ack was not received... */
@@ -322,7 +294,7 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
322 if (i2c->state == STATE_READ) 294 if (i2c->state == STATE_READ)
323 goto prepare_read; 295 goto prepare_read;
324 296
325 /* fall through to the write state, as we will need to 297 /* fall through to the write state, as we will need to
326 * send a byte as well */ 298 * send a byte as well */
327 299
328 case STATE_WRITE: 300 case STATE_WRITE:
@@ -339,7 +311,7 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
339 } 311 }
340 } 312 }
341 313
342 retry_write: 314 retry_write:
343 315
344 if (!is_msgend(i2c)) { 316 if (!is_msgend(i2c)) {
345 byte = i2c->msg->buf[i2c->msg_ptr++]; 317 byte = i2c->msg->buf[i2c->msg_ptr++];
@@ -359,9 +331,9 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
359 dev_dbg(i2c->dev, "WRITE: Next Message\n"); 331 dev_dbg(i2c->dev, "WRITE: Next Message\n");
360 332
361 i2c->msg_ptr = 0; 333 i2c->msg_ptr = 0;
362 i2c->msg_idx ++; 334 i2c->msg_idx++;
363 i2c->msg++; 335 i2c->msg++;
364 336
365 /* check to see if we need to do another message */ 337 /* check to see if we need to do another message */
366 if (i2c->msg->flags & I2C_M_NOSTART) { 338 if (i2c->msg->flags & I2C_M_NOSTART) {
367 339
@@ -375,7 +347,6 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
375 347
376 goto retry_write; 348 goto retry_write;
377 } else { 349 } else {
378
379 /* send the new start */ 350 /* send the new start */
380 s3c24xx_i2c_message_start(i2c, i2c->msg); 351 s3c24xx_i2c_message_start(i2c, i2c->msg);
381 i2c->state = STATE_START; 352 i2c->state = STATE_START;
@@ -389,7 +360,7 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
389 break; 360 break;
390 361
391 case STATE_READ: 362 case STATE_READ:
392 /* we have a byte of data in the data register, do 363 /* we have a byte of data in the data register, do
393 * something with it, and then work out wether we are 364 * something with it, and then work out wether we are
394 * going to do any more read/write 365 * going to do any more read/write
395 */ 366 */
@@ -397,13 +368,13 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
397 byte = readb(i2c->regs + S3C2410_IICDS); 368 byte = readb(i2c->regs + S3C2410_IICDS);
398 i2c->msg->buf[i2c->msg_ptr++] = byte; 369 i2c->msg->buf[i2c->msg_ptr++] = byte;
399 370
400 prepare_read: 371 prepare_read:
401 if (is_msglast(i2c)) { 372 if (is_msglast(i2c)) {
402 /* last byte of buffer */ 373 /* last byte of buffer */
403 374
404 if (is_lastmsg(i2c)) 375 if (is_lastmsg(i2c))
405 s3c24xx_i2c_disable_ack(i2c); 376 s3c24xx_i2c_disable_ack(i2c);
406 377
407 } else if (is_msgend(i2c)) { 378 } else if (is_msgend(i2c)) {
408 /* ok, we've read the entire buffer, see if there 379 /* ok, we've read the entire buffer, see if there
409 * is anything else we need to do */ 380 * is anything else we need to do */
@@ -429,7 +400,7 @@ static int i2s_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
429 /* acknowlegde the IRQ and get back on with the work */ 400 /* acknowlegde the IRQ and get back on with the work */
430 401
431 out_ack: 402 out_ack:
432 tmp = readl(i2c->regs + S3C2410_IICCON); 403 tmp = readl(i2c->regs + S3C2410_IICCON);
433 tmp &= ~S3C2410_IICCON_IRQPEND; 404 tmp &= ~S3C2410_IICCON_IRQPEND;
434 writel(tmp, i2c->regs + S3C2410_IICCON); 405 writel(tmp, i2c->regs + S3C2410_IICCON);
435 out: 406 out:
@@ -450,19 +421,19 @@ static irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
450 status = readl(i2c->regs + S3C2410_IICSTAT); 421 status = readl(i2c->regs + S3C2410_IICSTAT);
451 422
452 if (status & S3C2410_IICSTAT_ARBITR) { 423 if (status & S3C2410_IICSTAT_ARBITR) {
453 // deal with arbitration loss 424 /* deal with arbitration loss */
454 dev_err(i2c->dev, "deal with arbitration loss\n"); 425 dev_err(i2c->dev, "deal with arbitration loss\n");
455 } 426 }
456 427
457 if (i2c->state == STATE_IDLE) { 428 if (i2c->state == STATE_IDLE) {
458 dev_dbg(i2c->dev, "IRQ: error i2c->state == IDLE\n"); 429 dev_dbg(i2c->dev, "IRQ: error i2c->state == IDLE\n");
459 430
460 tmp = readl(i2c->regs + S3C2410_IICCON); 431 tmp = readl(i2c->regs + S3C2410_IICCON);
461 tmp &= ~S3C2410_IICCON_IRQPEND; 432 tmp &= ~S3C2410_IICCON_IRQPEND;
462 writel(tmp, i2c->regs + S3C2410_IICCON); 433 writel(tmp, i2c->regs + S3C2410_IICCON);
463 goto out; 434 goto out;
464 } 435 }
465 436
466 /* pretty much this leaves us with the fact that we've 437 /* pretty much this leaves us with the fact that we've
467 * transmitted or received whatever byte we last sent */ 438 * transmitted or received whatever byte we last sent */
468 439
@@ -485,16 +456,13 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
485 456
486 while (timeout-- > 0) { 457 while (timeout-- > 0) {
487 iicstat = readl(i2c->regs + S3C2410_IICSTAT); 458 iicstat = readl(i2c->regs + S3C2410_IICSTAT);
488 459
489 if (!(iicstat & S3C2410_IICSTAT_BUSBUSY)) 460 if (!(iicstat & S3C2410_IICSTAT_BUSBUSY))
490 return 0; 461 return 0;
491 462
492 msleep(1); 463 msleep(1);
493 } 464 }
494 465
495 dev_dbg(i2c->dev, "timeout: GPEDAT is %08x\n",
496 __raw_readl(S3C2410_GPEDAT));
497
498 return -ETIMEDOUT; 466 return -ETIMEDOUT;
499} 467}
500 468
@@ -503,7 +471,8 @@ static int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
503 * this starts an i2c transfer 471 * this starts an i2c transfer
504*/ 472*/
505 473
506static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int num) 474static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
475 struct i2c_msg *msgs, int num)
507{ 476{
508 unsigned long timeout; 477 unsigned long timeout;
509 int ret; 478 int ret;
@@ -529,12 +498,12 @@ static int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c, struct i2c_msg *msgs, int
529 s3c24xx_i2c_enable_irq(i2c); 498 s3c24xx_i2c_enable_irq(i2c);
530 s3c24xx_i2c_message_start(i2c, msgs); 499 s3c24xx_i2c_message_start(i2c, msgs);
531 spin_unlock_irq(&i2c->lock); 500 spin_unlock_irq(&i2c->lock);
532 501
533 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5); 502 timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ * 5);
534 503
535 ret = i2c->msg_idx; 504 ret = i2c->msg_idx;
536 505
537 /* having these next two as dev_err() makes life very 506 /* having these next two as dev_err() makes life very
538 * noisy when doing an i2cdetect */ 507 * noisy when doing an i2cdetect */
539 508
540 if (timeout == 0) 509 if (timeout == 0)
@@ -591,19 +560,6 @@ static const struct i2c_algorithm s3c24xx_i2c_algorithm = {
591 .functionality = s3c24xx_i2c_func, 560 .functionality = s3c24xx_i2c_func,
592}; 561};
593 562
594static struct s3c24xx_i2c s3c24xx_i2c = {
595 .lock = __SPIN_LOCK_UNLOCKED(s3c24xx_i2c.lock),
596 .wait = __WAIT_QUEUE_HEAD_INITIALIZER(s3c24xx_i2c.wait),
597 .tx_setup = 50,
598 .adap = {
599 .name = "s3c2410-i2c",
600 .owner = THIS_MODULE,
601 .algo = &s3c24xx_i2c_algorithm,
602 .retries = 2,
603 .class = I2C_CLASS_HWMON | I2C_CLASS_SPD,
604 },
605};
606
607/* s3c24xx_i2c_calcdivisor 563/* s3c24xx_i2c_calcdivisor
608 * 564 *
609 * return the divisor settings for a given frequency 565 * return the divisor settings for a given frequency
@@ -643,7 +599,7 @@ static inline int freq_acceptable(unsigned int freq, unsigned int wanted)
643{ 599{
644 int diff = freq - wanted; 600 int diff = freq - wanted;
645 601
646 return (diff >= -2 && diff <= 2); 602 return diff >= -2 && diff <= 2;
647} 603}
648 604
649/* s3c24xx_i2c_clockrate 605/* s3c24xx_i2c_clockrate
@@ -655,7 +611,7 @@ static inline int freq_acceptable(unsigned int freq, unsigned int wanted)
655 611
656static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got) 612static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
657{ 613{
658 struct s3c2410_platform_i2c *pdata; 614 struct s3c2410_platform_i2c *pdata = i2c->dev->platform_data;
659 unsigned long clkin = clk_get_rate(i2c->clk); 615 unsigned long clkin = clk_get_rate(i2c->clk);
660 unsigned int divs, div1; 616 unsigned int divs, div1;
661 u32 iiccon; 617 u32 iiccon;
@@ -663,10 +619,8 @@ static int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
663 int start, end; 619 int start, end;
664 620
665 i2c->clkrate = clkin; 621 i2c->clkrate = clkin;
666
667 pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent);
668 clkin /= 1000; /* clkin now in KHz */ 622 clkin /= 1000; /* clkin now in KHz */
669 623
670 dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n", 624 dev_dbg(i2c->dev, "pdata %p, freq %lu %lu..%lu\n",
671 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq); 625 pdata, pdata->bus_freq, pdata->min_freq, pdata->max_freq);
672 626
@@ -774,7 +728,7 @@ static inline void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
774 728
775/* s3c24xx_i2c_init 729/* s3c24xx_i2c_init
776 * 730 *
777 * initialise the controller, set the IO lines and frequency 731 * initialise the controller, set the IO lines and frequency
778*/ 732*/
779 733
780static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c) 734static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
@@ -785,15 +739,15 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
785 739
786 /* get the plafrom data */ 740 /* get the plafrom data */
787 741
788 pdata = s3c24xx_i2c_get_platformdata(i2c->adap.dev.parent); 742 pdata = i2c->dev->platform_data;
789 743
790 /* inititalise the gpio */ 744 /* inititalise the gpio */
791 745
792 s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA); 746 if (pdata->cfg_gpio)
793 s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_IICSCL); 747 pdata->cfg_gpio(to_platform_device(i2c->dev));
794 748
795 /* write slave address */ 749 /* write slave address */
796 750
797 writeb(pdata->slave_addr, i2c->regs + S3C2410_IICADD); 751 writeb(pdata->slave_addr, i2c->regs + S3C2410_IICADD);
798 752
799 dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr); 753 dev_info(i2c->dev, "slave address 0x%02x\n", pdata->slave_addr);
@@ -831,12 +785,32 @@ static int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
831 785
832static int s3c24xx_i2c_probe(struct platform_device *pdev) 786static int s3c24xx_i2c_probe(struct platform_device *pdev)
833{ 787{
834 struct s3c24xx_i2c *i2c = &s3c24xx_i2c; 788 struct s3c24xx_i2c *i2c;
835 struct s3c2410_platform_i2c *pdata; 789 struct s3c2410_platform_i2c *pdata;
836 struct resource *res; 790 struct resource *res;
837 int ret; 791 int ret;
838 792
839 pdata = s3c24xx_i2c_get_platformdata(&pdev->dev); 793 pdata = pdev->dev.platform_data;
794 if (!pdata) {
795 dev_err(&pdev->dev, "no platform data\n");
796 return -EINVAL;
797 }
798
799 i2c = kzalloc(sizeof(struct s3c24xx_i2c), GFP_KERNEL);
800 if (!i2c) {
801 dev_err(&pdev->dev, "no memory for state\n");
802 return -ENOMEM;
803 }
804
805 strlcpy(i2c->adap.name, "s3c2410-i2c", sizeof(i2c->adap.name));
806 i2c->adap.owner = THIS_MODULE;
807 i2c->adap.algo = &s3c24xx_i2c_algorithm;
808 i2c->adap.retries = 2;
809 i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
810 i2c->tx_setup = 50;
811
812 spin_lock_init(&i2c->lock);
813 init_waitqueue_head(&i2c->wait);
840 814
841 /* find the clock and enable it */ 815 /* find the clock and enable it */
842 816
@@ -878,7 +852,8 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
878 goto err_ioarea; 852 goto err_ioarea;
879 } 853 }
880 854
881 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n", i2c->regs, i2c->ioarea, res); 855 dev_dbg(&pdev->dev, "registers %p (%p, %p)\n",
856 i2c->regs, i2c->ioarea, res);
882 857
883 /* setup info block for the i2c core */ 858 /* setup info block for the i2c core */
884 859
@@ -892,29 +867,23 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
892 goto err_iomap; 867 goto err_iomap;
893 868
894 /* find the IRQ for this unit (note, this relies on the init call to 869 /* find the IRQ for this unit (note, this relies on the init call to
895 * ensure no current IRQs pending 870 * ensure no current IRQs pending
896 */ 871 */
897 872
898 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 873 i2c->irq = ret = platform_get_irq(pdev, 0);
899 if (res == NULL) { 874 if (ret <= 0) {
900 dev_err(&pdev->dev, "cannot find IRQ\n"); 875 dev_err(&pdev->dev, "cannot find IRQ\n");
901 ret = -ENOENT;
902 goto err_iomap; 876 goto err_iomap;
903 } 877 }
904 878
905 ret = request_irq(res->start, s3c24xx_i2c_irq, IRQF_DISABLED, 879 ret = request_irq(i2c->irq, s3c24xx_i2c_irq, IRQF_DISABLED,
906 pdev->name, i2c); 880 dev_name(&pdev->dev), i2c);
907 881
908 if (ret != 0) { 882 if (ret != 0) {
909 dev_err(&pdev->dev, "cannot claim IRQ\n"); 883 dev_err(&pdev->dev, "cannot claim IRQ %d\n", i2c->irq);
910 goto err_iomap; 884 goto err_iomap;
911 } 885 }
912 886
913 i2c->irq = res;
914
915 dev_dbg(&pdev->dev, "irq resource %p (%lu)\n", res,
916 (unsigned long)res->start);
917
918 ret = s3c24xx_i2c_register_cpufreq(i2c); 887 ret = s3c24xx_i2c_register_cpufreq(i2c);
919 if (ret < 0) { 888 if (ret < 0) {
920 dev_err(&pdev->dev, "failed to register cpufreq notifier\n"); 889 dev_err(&pdev->dev, "failed to register cpufreq notifier\n");
@@ -944,7 +913,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
944 s3c24xx_i2c_deregister_cpufreq(i2c); 913 s3c24xx_i2c_deregister_cpufreq(i2c);
945 914
946 err_irq: 915 err_irq:
947 free_irq(i2c->irq->start, i2c); 916 free_irq(i2c->irq, i2c);
948 917
949 err_iomap: 918 err_iomap:
950 iounmap(i2c->regs); 919 iounmap(i2c->regs);
@@ -958,6 +927,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
958 clk_put(i2c->clk); 927 clk_put(i2c->clk);
959 928
960 err_noclk: 929 err_noclk:
930 kfree(i2c);
961 return ret; 931 return ret;
962} 932}
963 933
@@ -973,7 +943,7 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
973 s3c24xx_i2c_deregister_cpufreq(i2c); 943 s3c24xx_i2c_deregister_cpufreq(i2c);
974 944
975 i2c_del_adapter(&i2c->adap); 945 i2c_del_adapter(&i2c->adap);
976 free_irq(i2c->irq->start, i2c); 946 free_irq(i2c->irq, i2c);
977 947
978 clk_disable(i2c->clk); 948 clk_disable(i2c->clk);
979 clk_put(i2c->clk); 949 clk_put(i2c->clk);
@@ -982,6 +952,7 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev)
982 952
983 release_resource(i2c->ioarea); 953 release_resource(i2c->ioarea);
984 kfree(i2c->ioarea); 954 kfree(i2c->ioarea);
955 kfree(i2c);
985 956
986 return 0; 957 return 0;
987} 958}
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index 4c35702830ce..864ac561fdbb 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -126,19 +126,6 @@ config ISP1301_OMAP
126 This driver can also be built as a module. If so, the module 126 This driver can also be built as a module. If so, the module
127 will be called isp1301_omap. 127 will be called isp1301_omap.
128 128
129config TPS65010
130 tristate "TPS6501x Power Management chips"
131 depends on GPIOLIB
132 default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
133 help
134 If you say yes here you get support for the TPS6501x series of
135 Power Management chips. These include voltage regulators,
136 lithium ion/polymer battery charging, and other features that
137 are often used in portable devices like cell phones and cameras.
138
139 This driver can also be built as a module. If so, the module
140 will be called tps65010.
141
142config SENSORS_MAX6875 129config SENSORS_MAX6875
143 tristate "Maxim MAX6875 Power supply supervisor" 130 tristate "Maxim MAX6875 Power supply supervisor"
144 depends on EXPERIMENTAL 131 depends on EXPERIMENTAL
@@ -164,16 +151,6 @@ config SENSORS_TSL2550
164 This driver can also be built as a module. If so, the module 151 This driver can also be built as a module. If so, the module
165 will be called tsl2550. 152 will be called tsl2550.
166 153
167config MENELAUS
168 bool "TWL92330/Menelaus PM chip"
169 depends on I2C=y && ARCH_OMAP24XX
170 help
171 If you say yes here you get support for the Texas Instruments
172 TWL92330/Menelaus Power Management chip. This include voltage
173 regulators, Dual slot memory card tranceivers, real-time clock
174 and other features that are often used in portable devices like
175 cell phones and PDAs.
176
177config MCU_MPC8349EMITX 154config MCU_MPC8349EMITX
178 tristate "MPC8349E-mITX MCU driver" 155 tristate "MPC8349E-mITX MCU driver"
179 depends on I2C && PPC_83xx 156 depends on I2C && PPC_83xx
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index 23d2a31b0a64..8b95f41a5001 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -19,8 +19,6 @@ obj-$(CONFIG_SENSORS_PCF8574) += pcf8574.o
19obj-$(CONFIG_PCF8575) += pcf8575.o 19obj-$(CONFIG_PCF8575) += pcf8575.o
20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 20obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o
21obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o 21obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o
22obj-$(CONFIG_TPS65010) += tps65010.o
23obj-$(CONFIG_MENELAUS) += menelaus.o
24obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 22obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o
25obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o 23obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
26 24
diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
index 53912c327bfe..8dc2bb781605 100644
--- a/drivers/infiniband/hw/ipath/ipath_fs.c
+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
@@ -57,9 +57,6 @@ static int ipathfs_mknod(struct inode *dir, struct dentry *dentry,
57 } 57 }
58 58
59 inode->i_mode = mode; 59 inode->i_mode = mode;
60 inode->i_uid = 0;
61 inode->i_gid = 0;
62 inode->i_blocks = 0;
63 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 60 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
64 inode->i_private = data; 61 inode->i_private = data;
65 if ((mode & S_IFMT) == S_IFDIR) { 62 if ((mode & S_IFMT) == S_IFDIR) {
diff --git a/drivers/isdn/capi/capidrv.c b/drivers/isdn/capi/capidrv.c
index d5b4cc357a3c..650120261abf 100644
--- a/drivers/isdn/capi/capidrv.c
+++ b/drivers/isdn/capi/capidrv.c
@@ -1519,7 +1519,7 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1519 int digit2 = 0; 1519 int digit2 = 0;
1520 if (!isdigit(*s)) return -3; 1520 if (!isdigit(*s)) return -3;
1521 while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; } 1521 while (isdigit(*s)) { digit1 = digit1*10 + (*s - '0'); s++; }
1522 if (digit1 <= 0 && digit1 > 30) return -4; 1522 if (digit1 <= 0 || digit1 > 30) return -4;
1523 if (*s == 0 || *s == ',' || *s == ' ') { 1523 if (*s == 0 || *s == ',' || *s == ' ') {
1524 bmask |= (1 << digit1); 1524 bmask |= (1 << digit1);
1525 digit1 = 0; 1525 digit1 = 0;
@@ -1530,7 +1530,7 @@ static int decodeFVteln(char *teln, unsigned long *bmaskp, int *activep)
1530 s++; 1530 s++;
1531 if (!isdigit(*s)) return -3; 1531 if (!isdigit(*s)) return -3;
1532 while (isdigit(*s)) { digit2 = digit2*10 + (*s - '0'); s++; } 1532 while (isdigit(*s)) { digit2 = digit2*10 + (*s - '0'); s++; }
1533 if (digit2 <= 0 && digit2 > 30) return -4; 1533 if (digit2 <= 0 || digit2 > 30) return -4;
1534 if (*s == 0 || *s == ',' || *s == ' ') { 1534 if (*s == 0 || *s == ',' || *s == ' ') {
1535 if (digit1 > digit2) 1535 if (digit1 > digit2)
1536 for (i = digit2; i <= digit1 ; i++) 1536 for (i = digit2; i <= digit1 ; i++)
diff --git a/drivers/isdn/capi/capifs.c b/drivers/isdn/capi/capifs.c
index 0aa66ec4cbdd..b129409925af 100644
--- a/drivers/isdn/capi/capifs.c
+++ b/drivers/isdn/capi/capifs.c
@@ -111,8 +111,6 @@ capifs_fill_super(struct super_block *s, void *data, int silent)
111 goto fail; 111 goto fail;
112 inode->i_ino = 1; 112 inode->i_ino = 1;
113 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 113 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
114 inode->i_blocks = 0;
115 inode->i_uid = inode->i_gid = 0;
116 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 114 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
117 inode->i_op = &simple_dir_inode_operations; 115 inode->i_op = &simple_dir_inode_operations;
118 inode->i_fop = &simple_dir_operations; 116 inode->i_fop = &simple_dir_operations;
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c
index 56faef1a1d55..06c655c55587 100644
--- a/drivers/message/i2o/exec-osm.c
+++ b/drivers/message/i2o/exec-osm.c
@@ -19,7 +19,7 @@
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@lxorguk.ukuu.org.uk>:
23 * Ported to Linux 2.5. 23 * Ported to Linux 2.5.
24 * Markus Lidel <Markus.Lidel@shadowconnect.com>: 24 * Markus Lidel <Markus.Lidel@shadowconnect.com>:
25 * Minor fixes for 2.6. 25 * Minor fixes for 2.6.
diff --git a/drivers/message/i2o/i2o_config.c b/drivers/message/i2o/i2o_config.c
index f3384c32b9a1..efba7021948a 100644
--- a/drivers/message/i2o/i2o_config.c
+++ b/drivers/message/i2o/i2o_config.c
@@ -19,7 +19,7 @@
19 * Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel() 19 * Changed ioctl_swdl(), implemented ioctl_swul() and ioctl_swdel()
20 * Deepak Saxena (11/18/1999): 20 * Deepak Saxena (11/18/1999):
21 * Added event managmenet support 21 * Added event managmenet support
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@lxorguk.ukuu.org.uk>:
23 * 2.4 rewrite ported to 2.5 23 * 2.4 rewrite ported to 2.5
24 * Markus Lidel <Markus.Lidel@shadowconnect.com>: 24 * Markus Lidel <Markus.Lidel@shadowconnect.com>:
25 * Added pass-thru support for Adaptec's raidutils 25 * Added pass-thru support for Adaptec's raidutils
diff --git a/drivers/message/i2o/iop.c b/drivers/message/i2o/iop.c
index 6e53a30bfd38..35c67d1f255e 100644
--- a/drivers/message/i2o/iop.c
+++ b/drivers/message/i2o/iop.c
@@ -19,7 +19,7 @@
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@lxorguk.ukuu.org.uk>:
23 * Ported to Linux 2.5. 23 * Ported to Linux 2.5.
24 * Markus Lidel <Markus.Lidel@shadowconnect.com>: 24 * Markus Lidel <Markus.Lidel@shadowconnect.com>:
25 * Minor fixes for 2.6. 25 * Minor fixes for 2.6.
diff --git a/drivers/message/i2o/pci.c b/drivers/message/i2o/pci.c
index 610ef1204e68..25d6f2341983 100644
--- a/drivers/message/i2o/pci.c
+++ b/drivers/message/i2o/pci.c
@@ -19,7 +19,7 @@
19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI> 19 * Auvo Häkkinen <Auvo.Hakkinen@cs.Helsinki.FI>
20 * Deepak Saxena <deepak@plexity.net> 20 * Deepak Saxena <deepak@plexity.net>
21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com> 21 * Boji T Kannanthanam <boji.t.kannanthanam@intel.com>
22 * Alan Cox <alan@redhat.com>: 22 * Alan Cox <alan@lxorguk.ukuu.org.uk>:
23 * Ported to Linux 2.5. 23 * Ported to Linux 2.5.
24 * Markus Lidel <Markus.Lidel@shadowconnect.com>: 24 * Markus Lidel <Markus.Lidel@shadowconnect.com>:
25 * Minor fixes for 2.6. 25 * Minor fixes for 2.6.
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 257277394f8c..416f9e7286ba 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -34,6 +34,14 @@ config MFD_ASIC3
34 This driver supports the ASIC3 multifunction chip found on many 34 This driver supports the ASIC3 multifunction chip found on many
35 PDAs (mainly iPAQ and HTC based ones) 35 PDAs (mainly iPAQ and HTC based ones)
36 36
37config MFD_DM355EVM_MSP
38 bool "DaVinci DM355 EVM microcontroller"
39 depends on I2C && MACH_DAVINCI_DM355_EVM
40 help
41 This driver supports the MSP430 microcontroller used on these
42 boards. MSP430 firmware manages resets and power sequencing,
43 inputs from buttons and the IR remote, LEDs, an RTC, and more.
44
37config HTC_EGPIO 45config HTC_EGPIO
38 bool "HTC EGPIO support" 46 bool "HTC EGPIO support"
39 depends on GENERIC_HARDIRQS && GPIOLIB && ARM 47 depends on GENERIC_HARDIRQS && GPIOLIB && ARM
@@ -61,9 +69,32 @@ config UCB1400_CORE
61 To compile this driver as a module, choose M here: the 69 To compile this driver as a module, choose M here: the
62 module will be called ucb1400_core. 70 module will be called ucb1400_core.
63 71
72config TPS65010
73 tristate "TPS6501x Power Management chips"
74 depends on I2C && GPIOLIB
75 default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK
76 help
77 If you say yes here you get support for the TPS6501x series of
78 Power Management chips. These include voltage regulators,
79 lithium ion/polymer battery charging, and other features that
80 are often used in portable devices like cell phones and cameras.
81
82 This driver can also be built as a module. If so, the module
83 will be called tps65010.
84
85config MENELAUS
86 bool "Texas Instruments TWL92330/Menelaus PM chip"
87 depends on I2C=y && ARCH_OMAP24XX
88 help
89 If you say yes here you get support for the Texas Instruments
90 TWL92330/Menelaus Power Management chip. This include voltage
91 regulators, Dual slot memory card tranceivers, real-time clock
92 and other features that are often used in portable devices like
93 cell phones and PDAs.
94
64config TWL4030_CORE 95config TWL4030_CORE
65 bool "Texas Instruments TWL4030/TPS659x0 Support" 96 bool "Texas Instruments TWL4030/TPS659x0 Support"
66 depends on I2C=y && GENERIC_HARDIRQS && (ARCH_OMAP2 || ARCH_OMAP3) 97 depends on I2C=y && GENERIC_HARDIRQS
67 help 98 help
68 Say yes here if you have TWL4030 family chip on your board. 99 Say yes here if you have TWL4030 family chip on your board.
69 This core driver provides register access and IRQ handling 100 This core driver provides register access and IRQ handling
@@ -116,6 +147,7 @@ config PMIC_DA903X
116 147
117config MFD_WM8400 148config MFD_WM8400
118 tristate "Support Wolfson Microelectronics WM8400" 149 tristate "Support Wolfson Microelectronics WM8400"
150 select MFD_CORE
119 depends on I2C 151 depends on I2C
120 help 152 help
121 Support for the Wolfson Microelecronics WM8400 PMIC and audio 153 Support for the Wolfson Microelecronics WM8400 PMIC and audio
@@ -142,6 +174,38 @@ config MFD_WM8350_CONFIG_MODE_3
142 bool 174 bool
143 depends on MFD_WM8350 175 depends on MFD_WM8350
144 176
177config MFD_WM8351_CONFIG_MODE_0
178 bool
179 depends on MFD_WM8350
180
181config MFD_WM8351_CONFIG_MODE_1
182 bool
183 depends on MFD_WM8350
184
185config MFD_WM8351_CONFIG_MODE_2
186 bool
187 depends on MFD_WM8350
188
189config MFD_WM8351_CONFIG_MODE_3
190 bool
191 depends on MFD_WM8350
192
193config MFD_WM8352_CONFIG_MODE_0
194 bool
195 depends on MFD_WM8350
196
197config MFD_WM8352_CONFIG_MODE_1
198 bool
199 depends on MFD_WM8350
200
201config MFD_WM8352_CONFIG_MODE_2
202 bool
203 depends on MFD_WM8350
204
205config MFD_WM8352_CONFIG_MODE_3
206 bool
207 depends on MFD_WM8350
208
145config MFD_WM8350_I2C 209config MFD_WM8350_I2C
146 tristate "Support Wolfson Microelectronics WM8350 with I2C" 210 tristate "Support Wolfson Microelectronics WM8350 with I2C"
147 select MFD_WM8350 211 select MFD_WM8350
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 9a5ad8af9116..0c9418b36c26 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -8,6 +8,8 @@ obj-$(CONFIG_MFD_ASIC3) += asic3.o
8obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o 8obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o
9obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o 9obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o
10 10
11obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o
12
11obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o 13obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o
12obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o 14obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o
13obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o 15obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o
@@ -17,6 +19,9 @@ wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o
17obj-$(CONFIG_MFD_WM8350) += wm8350.o 19obj-$(CONFIG_MFD_WM8350) += wm8350.o
18obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o 20obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
19 21
22obj-$(CONFIG_TPS65010) += tps65010.o
23obj-$(CONFIG_MENELAUS) += menelaus.o
24
20obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o 25obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o
21 26
22obj-$(CONFIG_MFD_CORE) += mfd-core.o 27obj-$(CONFIG_MFD_CORE) += mfd-core.o
@@ -31,4 +36,4 @@ obj-$(CONFIG_MCP_UCB1200) += ucb1x00-assabet.o
31endif 36endif
32obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o 37obj-$(CONFIG_UCB1400_CORE) += ucb1400_core.o
33 38
34obj-$(CONFIG_PMIC_DA903X) += da903x.o \ No newline at end of file 39obj-$(CONFIG_PMIC_DA903X) += da903x.o
diff --git a/drivers/mfd/da903x.c b/drivers/mfd/da903x.c
index 0b5bd85dfcec..99f8dcfe3d98 100644
--- a/drivers/mfd/da903x.c
+++ b/drivers/mfd/da903x.c
@@ -151,12 +151,24 @@ int da903x_write(struct device *dev, int reg, uint8_t val)
151} 151}
152EXPORT_SYMBOL_GPL(da903x_write); 152EXPORT_SYMBOL_GPL(da903x_write);
153 153
154int da903x_writes(struct device *dev, int reg, int len, uint8_t *val)
155{
156 return __da903x_writes(to_i2c_client(dev), reg, len, val);
157}
158EXPORT_SYMBOL_GPL(da903x_writes);
159
154int da903x_read(struct device *dev, int reg, uint8_t *val) 160int da903x_read(struct device *dev, int reg, uint8_t *val)
155{ 161{
156 return __da903x_read(to_i2c_client(dev), reg, val); 162 return __da903x_read(to_i2c_client(dev), reg, val);
157} 163}
158EXPORT_SYMBOL_GPL(da903x_read); 164EXPORT_SYMBOL_GPL(da903x_read);
159 165
166int da903x_reads(struct device *dev, int reg, int len, uint8_t *val)
167{
168 return __da903x_reads(to_i2c_client(dev), reg, len, val);
169}
170EXPORT_SYMBOL_GPL(da903x_reads);
171
160int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask) 172int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask)
161{ 173{
162 struct da903x_chip *chip = dev_get_drvdata(dev); 174 struct da903x_chip *chip = dev_get_drvdata(dev);
@@ -435,13 +447,13 @@ static const struct i2c_device_id da903x_id_table[] = {
435}; 447};
436MODULE_DEVICE_TABLE(i2c, da903x_id_table); 448MODULE_DEVICE_TABLE(i2c, da903x_id_table);
437 449
438static int __devexit __remove_subdev(struct device *dev, void *unused) 450static int __remove_subdev(struct device *dev, void *unused)
439{ 451{
440 platform_device_unregister(to_platform_device(dev)); 452 platform_device_unregister(to_platform_device(dev));
441 return 0; 453 return 0;
442} 454}
443 455
444static int __devexit da903x_remove_subdevs(struct da903x_chip *chip) 456static int da903x_remove_subdevs(struct da903x_chip *chip)
445{ 457{
446 return device_for_each_child(chip->dev, NULL, __remove_subdev); 458 return device_for_each_child(chip->dev, NULL, __remove_subdev);
447} 459}
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c
new file mode 100644
index 000000000000..4214b3f72426
--- /dev/null
+++ b/drivers/mfd/dm355evm_msp.c
@@ -0,0 +1,420 @@
1/*
2 * dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board
3 *
4 * Copyright (C) 2008 David Brownell
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/init.h>
13#include <linux/mutex.h>
14#include <linux/platform_device.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/gpio.h>
18#include <linux/leds.h>
19#include <linux/i2c.h>
20#include <linux/i2c/dm355evm_msp.h>
21
22
23/*
24 * The DM355 is a DaVinci chip with video support but no C64+ DSP. Its
25 * EVM board has an MSP430 programmed with firmware for various board
26 * support functions. This driver exposes some of them directly, and
27 * supports other drivers (e.g. RTC, input) for more complex access.
28 *
29 * Because this firmware is entirely board-specific, this file embeds
30 * knowledge that would be passed as platform_data in a generic driver.
31 *
32 * This driver was tested with firmware revision A4.
33 */
34
35#if defined(CONFIG_KEYBOARD_DM355EVM) \
36 || defined(CONFIG_KEYBOARD_DM355EVM_MODULE)
37#define msp_has_keyboard() true
38#else
39#define msp_has_keyboard() false
40#endif
41
42#if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE)
43#define msp_has_leds() true
44#else
45#define msp_has_leds() false
46#endif
47
48#if defined(CONFIG_RTC_DRV_DM355EVM) || defined(CONFIG_RTC_DRV_DM355EVM_MODULE)
49#define msp_has_rtc() true
50#else
51#define msp_has_rtc() false
52#endif
53
54#if defined(CONFIG_VIDEO_TVP514X) || defined(CONFIG_VIDEO_TVP514X_MODULE)
55#define msp_has_tvp() true
56#else
57#define msp_has_tvp() false
58#endif
59
60
61/*----------------------------------------------------------------------*/
62
63/* REVISIT for paranoia's sake, retry reads/writes on error */
64
65static struct i2c_client *msp430;
66
67/**
68 * dm355evm_msp_write - Writes a register in dm355evm_msp
69 * @value: the value to be written
70 * @reg: register address
71 *
72 * Returns result of operation - 0 is success, else negative errno
73 */
74int dm355evm_msp_write(u8 value, u8 reg)
75{
76 return i2c_smbus_write_byte_data(msp430, reg, value);
77}
78EXPORT_SYMBOL(dm355evm_msp_write);
79
80/**
81 * dm355evm_msp_read - Reads a register from dm355evm_msp
82 * @reg: register address
83 *
84 * Returns result of operation - value, or negative errno
85 */
86int dm355evm_msp_read(u8 reg)
87{
88 return i2c_smbus_read_byte_data(msp430, reg);
89}
90EXPORT_SYMBOL(dm355evm_msp_read);
91
92/*----------------------------------------------------------------------*/
93
94/*
95 * Many of the msp430 pins are just used as fixed-direction GPIOs.
96 * We could export a few more of them this way, if we wanted.
97 */
98#define MSP_GPIO(bit,reg) ((DM355EVM_MSP_ ## reg) << 3 | (bit))
99
100static const u8 msp_gpios[] = {
101 /* eight leds */
102 MSP_GPIO(0, LED), MSP_GPIO(1, LED),
103 MSP_GPIO(2, LED), MSP_GPIO(3, LED),
104 MSP_GPIO(4, LED), MSP_GPIO(5, LED),
105 MSP_GPIO(6, LED), MSP_GPIO(7, LED),
106 /* SW6 and the NTSC/nPAL jumper */
107 MSP_GPIO(0, SWITCH1), MSP_GPIO(1, SWITCH1),
108 MSP_GPIO(2, SWITCH1), MSP_GPIO(3, SWITCH1),
109 MSP_GPIO(4, SWITCH1),
110};
111
112#define MSP_GPIO_REG(offset) (msp_gpios[(offset)] >> 3)
113#define MSP_GPIO_MASK(offset) BIT(msp_gpios[(offset)] & 0x07)
114
115static int msp_gpio_in(struct gpio_chip *chip, unsigned offset)
116{
117 switch (MSP_GPIO_REG(offset)) {
118 case DM355EVM_MSP_SWITCH1:
119 case DM355EVM_MSP_SWITCH2:
120 case DM355EVM_MSP_SDMMC:
121 return 0;
122 default:
123 return -EINVAL;
124 }
125}
126
127static u8 msp_led_cache;
128
129static int msp_gpio_get(struct gpio_chip *chip, unsigned offset)
130{
131 int reg, status;
132
133 reg = MSP_GPIO_REG(offset);
134 status = dm355evm_msp_read(reg);
135 if (status < 0)
136 return status;
137 if (reg == DM355EVM_MSP_LED)
138 msp_led_cache = status;
139 return status & MSP_GPIO_MASK(offset);
140}
141
142static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value)
143{
144 int mask, bits;
145
146 /* NOTE: there are some other signals that could be
147 * packaged as output GPIOs, but they aren't as useful
148 * as the LEDs ... so for now we don't.
149 */
150 if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED)
151 return -EINVAL;
152
153 mask = MSP_GPIO_MASK(offset);
154 bits = msp_led_cache;
155
156 bits &= ~mask;
157 if (value)
158 bits |= mask;
159 msp_led_cache = bits;
160
161 return dm355evm_msp_write(bits, DM355EVM_MSP_LED);
162}
163
164static void msp_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
165{
166 msp_gpio_out(chip, offset, value);
167}
168
169static struct gpio_chip dm355evm_msp_gpio = {
170 .label = "dm355evm_msp",
171 .owner = THIS_MODULE,
172 .direction_input = msp_gpio_in,
173 .get = msp_gpio_get,
174 .direction_output = msp_gpio_out,
175 .set = msp_gpio_set,
176 .base = -EINVAL, /* dynamic assignment */
177 .ngpio = ARRAY_SIZE(msp_gpios),
178 .can_sleep = true,
179};
180
181/*----------------------------------------------------------------------*/
182
183static struct device *add_child(struct i2c_client *client, const char *name,
184 void *pdata, unsigned pdata_len,
185 bool can_wakeup, int irq)
186{
187 struct platform_device *pdev;
188 int status;
189
190 pdev = platform_device_alloc(name, -1);
191 if (!pdev) {
192 dev_dbg(&client->dev, "can't alloc dev\n");
193 status = -ENOMEM;
194 goto err;
195 }
196
197 device_init_wakeup(&pdev->dev, can_wakeup);
198 pdev->dev.parent = &client->dev;
199
200 if (pdata) {
201 status = platform_device_add_data(pdev, pdata, pdata_len);
202 if (status < 0) {
203 dev_dbg(&pdev->dev, "can't add platform_data\n");
204 goto err;
205 }
206 }
207
208 if (irq) {
209 struct resource r = {
210 .start = irq,
211 .flags = IORESOURCE_IRQ,
212 };
213
214 status = platform_device_add_resources(pdev, &r, 1);
215 if (status < 0) {
216 dev_dbg(&pdev->dev, "can't add irq\n");
217 goto err;
218 }
219 }
220
221 status = platform_device_add(pdev);
222
223err:
224 if (status < 0) {
225 platform_device_put(pdev);
226 dev_err(&client->dev, "can't add %s dev\n", name);
227 return ERR_PTR(status);
228 }
229 return &pdev->dev;
230}
231
232static int add_children(struct i2c_client *client)
233{
234 static const struct {
235 int offset;
236 char *label;
237 } config_inputs[] = {
238 /* 8 == right after the LEDs */
239 { 8 + 0, "sw6_1", },
240 { 8 + 1, "sw6_2", },
241 { 8 + 2, "sw6_3", },
242 { 8 + 3, "sw6_4", },
243 { 8 + 4, "NTSC/nPAL", },
244 };
245
246 struct device *child;
247 int status;
248 int i;
249
250 /* GPIO-ish stuff */
251 dm355evm_msp_gpio.dev = &client->dev;
252 status = gpiochip_add(&dm355evm_msp_gpio);
253 if (status < 0)
254 return status;
255
256 /* LED output */
257 if (msp_has_leds()) {
258#define GPIO_LED(l) .name = l, .active_low = true
259 static struct gpio_led evm_leds[] = {
260 { GPIO_LED("dm355evm::ds14"),
261 .default_trigger = "heartbeat", },
262 { GPIO_LED("dm355evm::ds15"),
263 .default_trigger = "mmc0", },
264 { GPIO_LED("dm355evm::ds16"),
265 /* could also be a CE-ATA drive */
266 .default_trigger = "mmc1", },
267 { GPIO_LED("dm355evm::ds17"),
268 .default_trigger = "nand-disk", },
269 { GPIO_LED("dm355evm::ds18"), },
270 { GPIO_LED("dm355evm::ds19"), },
271 { GPIO_LED("dm355evm::ds20"), },
272 { GPIO_LED("dm355evm::ds21"), },
273 };
274#undef GPIO_LED
275
276 struct gpio_led_platform_data evm_led_data = {
277 .num_leds = ARRAY_SIZE(evm_leds),
278 .leds = evm_leds,
279 };
280
281 for (i = 0; i < ARRAY_SIZE(evm_leds); i++)
282 evm_leds[i].gpio = i + dm355evm_msp_gpio.base;
283
284 /* NOTE: these are the only fully programmable LEDs
285 * on the board, since GPIO-61/ds22 (and many signals
286 * going to DC7) must be used for AEMIF address lines
287 * unless the top 1 GB of NAND is unused...
288 */
289 child = add_child(client, "leds-gpio",
290 &evm_led_data, sizeof(evm_led_data),
291 false, 0);
292 if (IS_ERR(child))
293 return PTR_ERR(child);
294 }
295
296 /* configuration inputs */
297 for (i = 0; i < ARRAY_SIZE(config_inputs); i++) {
298 int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset;
299
300 gpio_request(gpio, config_inputs[i].label);
301 gpio_direction_input(gpio);
302
303 /* make it easy for userspace to see these */
304 gpio_export(gpio, false);
305 }
306
307 /* RTC is a 32 bit counter, no alarm */
308 if (msp_has_rtc()) {
309 child = add_child(client, "rtc-dm355evm",
310 NULL, 0, false, 0);
311 if (IS_ERR(child))
312 return PTR_ERR(child);
313 }
314
315 /* input from buttons and IR remote (uses the IRQ) */
316 if (msp_has_keyboard()) {
317 child = add_child(client, "dm355evm_keys",
318 NULL, 0, true, client->irq);
319 if (IS_ERR(child))
320 return PTR_ERR(child);
321 }
322
323 return 0;
324}
325
326/*----------------------------------------------------------------------*/
327
328static void dm355evm_command(unsigned command)
329{
330 int status;
331
332 status = dm355evm_msp_write(command, DM355EVM_MSP_COMMAND);
333 if (status < 0)
334 dev_err(&msp430->dev, "command %d failure %d\n",
335 command, status);
336}
337
338static void dm355evm_power_off(void)
339{
340 dm355evm_command(MSP_COMMAND_POWEROFF);
341}
342
343static int dm355evm_msp_remove(struct i2c_client *client)
344{
345 pm_power_off = NULL;
346 msp430 = NULL;
347 return 0;
348}
349
350static int
351dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
352{
353 int status;
354 const char *video = msp_has_tvp() ? "TVP5146" : "imager";
355
356 if (msp430)
357 return -EBUSY;
358 msp430 = client;
359
360 /* display revision status; doubles as sanity check */
361 status = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
362 if (status < 0)
363 goto fail;
364 dev_info(&client->dev, "firmware v.%02X, %s as video-in\n",
365 status, video);
366
367 /* mux video input: either tvp5146 or some external imager */
368 status = dm355evm_msp_write(msp_has_tvp() ? 0 : MSP_VIDEO_IMAGER,
369 DM355EVM_MSP_VIDEO_IN);
370 if (status < 0)
371 dev_warn(&client->dev, "error %d muxing %s as video-in\n",
372 status, video);
373
374 /* init LED cache, and turn off the LEDs */
375 msp_led_cache = 0xff;
376 dm355evm_msp_write(msp_led_cache, DM355EVM_MSP_LED);
377
378 /* export capabilities we support */
379 status = add_children(client);
380 if (status < 0)
381 goto fail;
382
383 /* PM hookup */
384 pm_power_off = dm355evm_power_off;
385
386 return 0;
387
388fail:
389 /* FIXME remove children ... */
390 dm355evm_msp_remove(client);
391 return status;
392}
393
394static const struct i2c_device_id dm355evm_msp_ids[] = {
395 { "dm355evm_msp", 0 },
396 { /* end of list */ },
397};
398MODULE_DEVICE_TABLE(i2c, dm355evm_msp_ids);
399
400static struct i2c_driver dm355evm_msp_driver = {
401 .driver.name = "dm355evm_msp",
402 .id_table = dm355evm_msp_ids,
403 .probe = dm355evm_msp_probe,
404 .remove = dm355evm_msp_remove,
405};
406
407static int __init dm355evm_msp_init(void)
408{
409 return i2c_add_driver(&dm355evm_msp_driver);
410}
411subsys_initcall(dm355evm_msp_init);
412
413static void __exit dm355evm_msp_exit(void)
414{
415 i2c_del_driver(&dm355evm_msp_driver);
416}
417module_exit(dm355evm_msp_exit);
418
419MODULE_DESCRIPTION("Interface to MSP430 firmware on DM355EVM");
420MODULE_LICENSE("GPL");
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/mfd/menelaus.c
index 4b364bae6b3e..4b364bae6b3e 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/mfd/menelaus.c
diff --git a/drivers/mfd/mfd-core.c b/drivers/mfd/mfd-core.c
index 6c0d1bec4b76..54ddf3772e0c 100644
--- a/drivers/mfd/mfd-core.c
+++ b/drivers/mfd/mfd-core.c
@@ -34,6 +34,7 @@ static int mfd_add_device(struct device *parent, int id,
34 goto fail_device; 34 goto fail_device;
35 35
36 pdev->dev.parent = parent; 36 pdev->dev.parent = parent;
37 platform_set_drvdata(pdev, cell->driver_data);
37 38
38 ret = platform_device_add_data(pdev, 39 ret = platform_device_add_data(pdev,
39 cell->platform_data, cell->data_size); 40 cell->platform_data, cell->data_size);
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/mfd/tps65010.c
index acf8b9d5f575..acf8b9d5f575 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/mfd/tps65010.c
diff --git a/drivers/mfd/twl4030-core.c b/drivers/mfd/twl4030-core.c
index dd843c4fbcc7..b59c385cbc12 100644
--- a/drivers/mfd/twl4030-core.c
+++ b/drivers/mfd/twl4030-core.c
@@ -33,6 +33,8 @@
33#include <linux/clk.h> 33#include <linux/clk.h>
34#include <linux/err.h> 34#include <linux/err.h>
35 35
36#include <linux/regulator/machine.h>
37
36#include <linux/i2c.h> 38#include <linux/i2c.h>
37#include <linux/i2c/twl4030.h> 39#include <linux/i2c/twl4030.h>
38 40
@@ -71,6 +73,13 @@
71#define twl_has_gpio() false 73#define twl_has_gpio() false
72#endif 74#endif
73 75
76#if defined(CONFIG_REGULATOR_TWL4030) \
77 || defined(CONFIG_REGULATOR_TWL4030_MODULE)
78#define twl_has_regulator() true
79#else
80#define twl_has_regulator() false
81#endif
82
74#if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE) 83#if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE)
75#define twl_has_madc() true 84#define twl_has_madc() true
76#else 85#else
@@ -149,6 +158,10 @@
149#define HIGH_PERF_SQ (1 << 3) 158#define HIGH_PERF_SQ (1 << 3)
150 159
151 160
161/* chip-specific feature flags, for i2c_device_id.driver_data */
162#define TWL4030_VAUX2 BIT(0) /* pre-5030 voltage ranges */
163#define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */
164
152/*----------------------------------------------------------------------*/ 165/*----------------------------------------------------------------------*/
153 166
154/* is driver active, bound to a chip? */ 167/* is driver active, bound to a chip? */
@@ -225,7 +238,7 @@ static struct twl4030mapping twl4030_map[TWL4030_MODULE_LAST + 1] = {
225 * 238 *
226 * Returns the result of operation - 0 is success 239 * Returns the result of operation - 0 is success
227 */ 240 */
228int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes) 241int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
229{ 242{
230 int ret; 243 int ret;
231 int sid; 244 int sid;
@@ -274,7 +287,7 @@ EXPORT_SYMBOL(twl4030_i2c_write);
274 * 287 *
275 * Returns result of operation - num_bytes is success else failure. 288 * Returns result of operation - num_bytes is success else failure.
276 */ 289 */
277int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes) 290int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
278{ 291{
279 int ret; 292 int ret;
280 u8 val; 293 u8 val;
@@ -352,258 +365,258 @@ EXPORT_SYMBOL(twl4030_i2c_read_u8);
352 365
353/*----------------------------------------------------------------------*/ 366/*----------------------------------------------------------------------*/
354 367
355/* 368static struct device *
356 * NOTE: We know the first 8 IRQs after pdata->base_irq are 369add_numbered_child(unsigned chip, const char *name, int num,
357 * for the PIH, and the next are for the PWR_INT SIH, since 370 void *pdata, unsigned pdata_len,
358 * that's how twl_init_irq() sets things up. 371 bool can_wakeup, int irq0, int irq1)
359 */
360
361static int add_children(struct twl4030_platform_data *pdata)
362{ 372{
363 struct platform_device *pdev = NULL; 373 struct platform_device *pdev;
364 struct twl4030_client *twl = NULL; 374 struct twl4030_client *twl = &twl4030_modules[chip];
365 int status = 0; 375 int status;
376
377 pdev = platform_device_alloc(name, num);
378 if (!pdev) {
379 dev_dbg(&twl->client->dev, "can't alloc dev\n");
380 status = -ENOMEM;
381 goto err;
382 }
366 383
367 if (twl_has_bci() && pdata->bci) { 384 device_init_wakeup(&pdev->dev, can_wakeup);
368 twl = &twl4030_modules[3]; 385 pdev->dev.parent = &twl->client->dev;
369 386
370 pdev = platform_device_alloc("twl4030_bci", -1); 387 if (pdata) {
371 if (!pdev) { 388 status = platform_device_add_data(pdev, pdata, pdata_len);
372 pr_debug("%s: can't alloc bci dev\n", DRIVER_NAME); 389 if (status < 0) {
373 status = -ENOMEM; 390 dev_dbg(&pdev->dev, "can't add platform_data\n");
374 goto err; 391 goto err;
375 } 392 }
393 }
376 394
377 if (status == 0) { 395 if (irq0) {
378 pdev->dev.parent = &twl->client->dev; 396 struct resource r[2] = {
379 status = platform_device_add_data(pdev, pdata->bci, 397 { .start = irq0, .flags = IORESOURCE_IRQ, },
380 sizeof(*pdata->bci)); 398 { .start = irq1, .flags = IORESOURCE_IRQ, },
381 if (status < 0) { 399 };
382 dev_dbg(&twl->client->dev,
383 "can't add bci data, %d\n",
384 status);
385 goto err;
386 }
387 }
388
389 if (status == 0) {
390 struct resource r = {
391 .start = pdata->irq_base + 8 + 1,
392 .flags = IORESOURCE_IRQ,
393 };
394
395 status = platform_device_add_resources(pdev, &r, 1);
396 }
397
398 if (status == 0)
399 status = platform_device_add(pdev);
400 400
401 status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1);
401 if (status < 0) { 402 if (status < 0) {
402 platform_device_put(pdev); 403 dev_dbg(&pdev->dev, "can't add irqs\n");
403 dev_dbg(&twl->client->dev,
404 "can't create bci dev, %d\n",
405 status);
406 goto err; 404 goto err;
407 } 405 }
408 } 406 }
409 407
410 if (twl_has_gpio() && pdata->gpio) { 408 status = platform_device_add(pdev);
411 twl = &twl4030_modules[1];
412 409
413 pdev = platform_device_alloc("twl4030_gpio", -1); 410err:
414 if (!pdev) { 411 if (status < 0) {
415 pr_debug("%s: can't alloc gpio dev\n", DRIVER_NAME); 412 platform_device_put(pdev);
416 status = -ENOMEM; 413 dev_err(&twl->client->dev, "can't add %s dev\n", name);
417 goto err; 414 return ERR_PTR(status);
418 } 415 }
416 return &pdev->dev;
417}
419 418
420 /* more driver model init */ 419static inline struct device *add_child(unsigned chip, const char *name,
421 if (status == 0) { 420 void *pdata, unsigned pdata_len,
422 pdev->dev.parent = &twl->client->dev; 421 bool can_wakeup, int irq0, int irq1)
423 /* device_init_wakeup(&pdev->dev, 1); */ 422{
424 423 return add_numbered_child(chip, name, -1, pdata, pdata_len,
425 status = platform_device_add_data(pdev, pdata->gpio, 424 can_wakeup, irq0, irq1);
426 sizeof(*pdata->gpio)); 425}
427 if (status < 0) {
428 dev_dbg(&twl->client->dev,
429 "can't add gpio data, %d\n",
430 status);
431 goto err;
432 }
433 }
434 426
435 /* GPIO module IRQ */ 427static struct device *
436 if (status == 0) { 428add_regulator_linked(int num, struct regulator_init_data *pdata,
437 struct resource r = { 429 struct regulator_consumer_supply *consumers,
438 .start = pdata->irq_base + 0, 430 unsigned num_consumers)
439 .flags = IORESOURCE_IRQ, 431{
440 }; 432 /* regulator framework demands init_data ... */
433 if (!pdata)
434 return NULL;
441 435
442 status = platform_device_add_resources(pdev, &r, 1); 436 if (consumers) {
443 } 437 pdata->consumer_supplies = consumers;
438 pdata->num_consumer_supplies = num_consumers;
439 }
444 440
445 if (status == 0) 441 /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */
446 status = platform_device_add(pdev); 442 return add_numbered_child(3, "twl4030_reg", num,
443 pdata, sizeof(*pdata), false, 0, 0);
444}
447 445
448 if (status < 0) { 446static struct device *
449 platform_device_put(pdev); 447add_regulator(int num, struct regulator_init_data *pdata)
450 dev_dbg(&twl->client->dev, 448{
451 "can't create gpio dev, %d\n", 449 return add_regulator_linked(num, pdata, NULL, 0);
452 status); 450}
453 goto err; 451
454 } 452/*
453 * NOTE: We know the first 8 IRQs after pdata->base_irq are
454 * for the PIH, and the next are for the PWR_INT SIH, since
455 * that's how twl_init_irq() sets things up.
456 */
457
458static int
459add_children(struct twl4030_platform_data *pdata, unsigned long features)
460{
461 struct device *child;
462 struct device *usb_transceiver = NULL;
463
464 if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) {
465 child = add_child(3, "twl4030_bci",
466 pdata->bci, sizeof(*pdata->bci),
467 false,
468 /* irq0 = CHG_PRES, irq1 = BCI */
469 pdata->irq_base + 8 + 1, pdata->irq_base + 2);
470 if (IS_ERR(child))
471 return PTR_ERR(child);
472 }
473
474 if (twl_has_gpio() && pdata->gpio) {
475 child = add_child(1, "twl4030_gpio",
476 pdata->gpio, sizeof(*pdata->gpio),
477 false, pdata->irq_base + 0, 0);
478 if (IS_ERR(child))
479 return PTR_ERR(child);
455 } 480 }
456 481
457 if (twl_has_keypad() && pdata->keypad) { 482 if (twl_has_keypad() && pdata->keypad) {
458 pdev = platform_device_alloc("twl4030_keypad", -1); 483 child = add_child(2, "twl4030_keypad",
459 if (pdev) { 484 pdata->keypad, sizeof(*pdata->keypad),
460 twl = &twl4030_modules[2]; 485 true, pdata->irq_base + 1, 0);
461 pdev->dev.parent = &twl->client->dev; 486 if (IS_ERR(child))
462 device_init_wakeup(&pdev->dev, 1); 487 return PTR_ERR(child);
463 status = platform_device_add_data(pdev, pdata->keypad,
464 sizeof(*pdata->keypad));
465 if (status < 0) {
466 dev_dbg(&twl->client->dev,
467 "can't add keypad data, %d\n",
468 status);
469 platform_device_put(pdev);
470 goto err;
471 }
472 status = platform_device_add(pdev);
473 if (status < 0) {
474 platform_device_put(pdev);
475 dev_dbg(&twl->client->dev,
476 "can't create keypad dev, %d\n",
477 status);
478 goto err;
479 }
480 } else {
481 pr_debug("%s: can't alloc keypad dev\n", DRIVER_NAME);
482 status = -ENOMEM;
483 goto err;
484 }
485 } 488 }
486 489
487 if (twl_has_madc() && pdata->madc) { 490 if (twl_has_madc() && pdata->madc) {
488 pdev = platform_device_alloc("twl4030_madc", -1); 491 child = add_child(2, "twl4030_madc",
489 if (pdev) { 492 pdata->madc, sizeof(*pdata->madc),
490 twl = &twl4030_modules[2]; 493 true, pdata->irq_base + 3, 0);
491 pdev->dev.parent = &twl->client->dev; 494 if (IS_ERR(child))
492 device_init_wakeup(&pdev->dev, 1); 495 return PTR_ERR(child);
493 status = platform_device_add_data(pdev, pdata->madc,
494 sizeof(*pdata->madc));
495 if (status < 0) {
496 platform_device_put(pdev);
497 dev_dbg(&twl->client->dev,
498 "can't add madc data, %d\n",
499 status);
500 goto err;
501 }
502 status = platform_device_add(pdev);
503 if (status < 0) {
504 platform_device_put(pdev);
505 dev_dbg(&twl->client->dev,
506 "can't create madc dev, %d\n",
507 status);
508 goto err;
509 }
510 } else {
511 pr_debug("%s: can't alloc madc dev\n", DRIVER_NAME);
512 status = -ENOMEM;
513 goto err;
514 }
515 } 496 }
516 497
517 if (twl_has_rtc()) { 498 if (twl_has_rtc()) {
518 twl = &twl4030_modules[3];
519
520 pdev = platform_device_alloc("twl4030_rtc", -1);
521 if (!pdev) {
522 pr_debug("%s: can't alloc rtc dev\n", DRIVER_NAME);
523 status = -ENOMEM;
524 } else {
525 pdev->dev.parent = &twl->client->dev;
526 device_init_wakeup(&pdev->dev, 1);
527 }
528
529 /* 499 /*
530 * REVISIT platform_data here currently might use of 500 * REVISIT platform_data here currently might expose the
531 * "msecure" line ... but for now we just expect board 501 * "msecure" line ... but for now we just expect board
532 * setup to tell the chip "we are secure" at all times. 502 * setup to tell the chip "it's always ok to SET_TIME".
533 * Eventually, Linux might become more aware of such 503 * Eventually, Linux might become more aware of such
534 * HW security concerns, and "least privilege". 504 * HW security concerns, and "least privilege".
535 */ 505 */
536 506 child = add_child(3, "twl4030_rtc",
537 /* RTC module IRQ */ 507 NULL, 0,
538 if (status == 0) { 508 true, pdata->irq_base + 8 + 3, 0);
539 struct resource r = { 509 if (IS_ERR(child))
540 .start = pdata->irq_base + 8 + 3, 510 return PTR_ERR(child);
541 .flags = IORESOURCE_IRQ,
542 };
543
544 status = platform_device_add_resources(pdev, &r, 1);
545 }
546
547 if (status == 0)
548 status = platform_device_add(pdev);
549
550 if (status < 0) {
551 platform_device_put(pdev);
552 dev_dbg(&twl->client->dev,
553 "can't create rtc dev, %d\n",
554 status);
555 goto err;
556 }
557 } 511 }
558 512
559 if (twl_has_usb() && pdata->usb) { 513 if (twl_has_usb() && pdata->usb) {
560 twl = &twl4030_modules[0]; 514 child = add_child(0, "twl4030_usb",
561 515 pdata->usb, sizeof(*pdata->usb),
562 pdev = platform_device_alloc("twl4030_usb", -1); 516 true,
563 if (!pdev) { 517 /* irq0 = USB_PRES, irq1 = USB */
564 pr_debug("%s: can't alloc usb dev\n", DRIVER_NAME); 518 pdata->irq_base + 8 + 2, pdata->irq_base + 4);
565 status = -ENOMEM; 519 if (IS_ERR(child))
566 goto err; 520 return PTR_ERR(child);
567 } 521
568 522 /* we need to connect regulators to this transceiver */
569 if (status == 0) { 523 usb_transceiver = child;
570 pdev->dev.parent = &twl->client->dev; 524 }
571 device_init_wakeup(&pdev->dev, 1);
572 status = platform_device_add_data(pdev, pdata->usb,
573 sizeof(*pdata->usb));
574 if (status < 0) {
575 platform_device_put(pdev);
576 dev_dbg(&twl->client->dev,
577 "can't add usb data, %d\n",
578 status);
579 goto err;
580 }
581 }
582
583 if (status == 0) {
584 struct resource r = {
585 .start = pdata->irq_base + 8 + 2,
586 .flags = IORESOURCE_IRQ,
587 };
588 525
589 status = platform_device_add_resources(pdev, &r, 1); 526 if (twl_has_regulator()) {
590 } 527 /*
528 child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1);
529 if (IS_ERR(child))
530 return PTR_ERR(child);
531 */
532
533 child = add_regulator(TWL4030_REG_VMMC1, pdata->vmmc1);
534 if (IS_ERR(child))
535 return PTR_ERR(child);
536
537 child = add_regulator(TWL4030_REG_VDAC, pdata->vdac);
538 if (IS_ERR(child))
539 return PTR_ERR(child);
540
541 child = add_regulator((features & TWL4030_VAUX2)
542 ? TWL4030_REG_VAUX2_4030
543 : TWL4030_REG_VAUX2,
544 pdata->vaux2);
545 if (IS_ERR(child))
546 return PTR_ERR(child);
547 }
591 548
592 if (status == 0) 549 if (twl_has_regulator() && usb_transceiver) {
593 status = platform_device_add(pdev); 550 static struct regulator_consumer_supply usb1v5 = {
551 .supply = "usb1v5",
552 };
553 static struct regulator_consumer_supply usb1v8 = {
554 .supply = "usb1v8",
555 };
556 static struct regulator_consumer_supply usb3v1 = {
557 .supply = "usb3v1",
558 };
559
560 /* this is a template that gets copied */
561 struct regulator_init_data usb_fixed = {
562 .constraints.valid_modes_mask =
563 REGULATOR_MODE_NORMAL
564 | REGULATOR_MODE_STANDBY,
565 .constraints.valid_ops_mask =
566 REGULATOR_CHANGE_MODE
567 | REGULATOR_CHANGE_STATUS,
568 };
569
570 usb1v5.dev = usb_transceiver;
571 usb1v8.dev = usb_transceiver;
572 usb3v1.dev = usb_transceiver;
573
574 child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed,
575 &usb1v5, 1);
576 if (IS_ERR(child))
577 return PTR_ERR(child);
578
579 child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed,
580 &usb1v8, 1);
581 if (IS_ERR(child))
582 return PTR_ERR(child);
583
584 child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed,
585 &usb3v1, 1);
586 if (IS_ERR(child))
587 return PTR_ERR(child);
588 }
594 589
595 if (status < 0) { 590 /* maybe add LDOs that are omitted on cost-reduced parts */
596 platform_device_put(pdev); 591 if (twl_has_regulator() && !(features & TPS_SUBSET)) {
597 dev_dbg(&twl->client->dev, 592 /*
598 "can't create usb dev, %d\n", 593 child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2);
599 status); 594 if (IS_ERR(child))
600 } 595 return PTR_ERR(child);
596 */
597
598 child = add_regulator(TWL4030_REG_VMMC2, pdata->vmmc2);
599 if (IS_ERR(child))
600 return PTR_ERR(child);
601
602 child = add_regulator(TWL4030_REG_VSIM, pdata->vsim);
603 if (IS_ERR(child))
604 return PTR_ERR(child);
605
606 child = add_regulator(TWL4030_REG_VAUX1, pdata->vaux1);
607 if (IS_ERR(child))
608 return PTR_ERR(child);
609
610 child = add_regulator(TWL4030_REG_VAUX3, pdata->vaux3);
611 if (IS_ERR(child))
612 return PTR_ERR(child);
613
614 child = add_regulator(TWL4030_REG_VAUX4, pdata->vaux4);
615 if (IS_ERR(child))
616 return PTR_ERR(child);
601 } 617 }
602 618
603err: 619 return 0;
604 if (status)
605 pr_err("failed to add twl4030's children (status %d)\n", status);
606 return status;
607} 620}
608 621
609/*----------------------------------------------------------------------*/ 622/*----------------------------------------------------------------------*/
@@ -645,12 +658,7 @@ static void __init clocks_init(void)
645 osc = clk_get(NULL, "osc_ck"); 658 osc = clk_get(NULL, "osc_ck");
646 else 659 else
647 osc = clk_get(NULL, "osc_sys_ck"); 660 osc = clk_get(NULL, "osc_sys_ck");
648#else 661
649 /* REVISIT for non-OMAP systems, pass the clock rate from
650 * board init code, using platform_data.
651 */
652 osc = ERR_PTR(-EIO);
653#endif
654 if (IS_ERR(osc)) { 662 if (IS_ERR(osc)) {
655 printk(KERN_WARNING "Skipping twl4030 internal clock init and " 663 printk(KERN_WARNING "Skipping twl4030 internal clock init and "
656 "using bootloader value (unknown osc rate)\n"); 664 "using bootloader value (unknown osc rate)\n");
@@ -660,6 +668,18 @@ static void __init clocks_init(void)
660 rate = clk_get_rate(osc); 668 rate = clk_get_rate(osc);
661 clk_put(osc); 669 clk_put(osc);
662 670
671#else
672 /* REVISIT for non-OMAP systems, pass the clock rate from
673 * board init code, using platform_data.
674 */
675 osc = ERR_PTR(-EIO);
676
677 printk(KERN_WARNING "Skipping twl4030 internal clock init and "
678 "using bootloader value (unknown osc rate)\n");
679
680 return;
681#endif
682
663 switch (rate) { 683 switch (rate) {
664 case 19200000: 684 case 19200000:
665 ctrl = HFCLK_FREQ_19p2_MHZ; 685 ctrl = HFCLK_FREQ_19p2_MHZ;
@@ -764,7 +784,7 @@ twl4030_probe(struct i2c_client *client, const struct i2c_device_id *id)
764 goto fail; 784 goto fail;
765 } 785 }
766 786
767 status = add_children(pdata); 787 status = add_children(pdata, id->driver_data);
768fail: 788fail:
769 if (status < 0) 789 if (status < 0)
770 twl4030_remove(client); 790 twl4030_remove(client);
@@ -772,11 +792,11 @@ fail:
772} 792}
773 793
774static const struct i2c_device_id twl4030_ids[] = { 794static const struct i2c_device_id twl4030_ids[] = {
775 { "twl4030", 0 }, /* "Triton 2" */ 795 { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */
776 { "tps65950", 0 }, /* catalog version of twl4030 */ 796 { "twl5030", 0 }, /* T2 updated */
777 { "tps65930", 0 }, /* fewer LDOs and DACs; no charger */ 797 { "tps65950", 0 }, /* catalog version of twl5030 */
778 { "tps65920", 0 }, /* fewer LDOs; no codec or charger */ 798 { "tps65930", TPS_SUBSET }, /* fewer LDOs and DACs; no charger */
779 { "twl5030", 0 }, /* T2 updated */ 799 { "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */
780 { /* end of list */ }, 800 { /* end of list */ },
781}; 801};
782MODULE_DEVICE_TABLE(i2c, twl4030_ids); 802MODULE_DEVICE_TABLE(i2c, twl4030_ids);
diff --git a/drivers/mfd/twl4030-irq.c b/drivers/mfd/twl4030-irq.c
index fae868a8d499..b10876036983 100644
--- a/drivers/mfd/twl4030-irq.c
+++ b/drivers/mfd/twl4030-irq.c
@@ -180,10 +180,15 @@ static struct completion irq_event;
180static int twl4030_irq_thread(void *data) 180static int twl4030_irq_thread(void *data)
181{ 181{
182 long irq = (long)data; 182 long irq = (long)data;
183 irq_desc_t *desc = irq_desc + irq; 183 struct irq_desc *desc = irq_to_desc(irq);
184 static unsigned i2c_errors; 184 static unsigned i2c_errors;
185 const static unsigned max_i2c_errors = 100; 185 const static unsigned max_i2c_errors = 100;
186 186
187 if (!desc) {
188 pr_err("twl4030: Invalid IRQ: %ld\n", irq);
189 return -EINVAL;
190 }
191
187 current->flags |= PF_NOFREEZE; 192 current->flags |= PF_NOFREEZE;
188 193
189 while (!kthread_should_stop()) { 194 while (!kthread_should_stop()) {
@@ -215,7 +220,13 @@ static int twl4030_irq_thread(void *data)
215 pih_isr; 220 pih_isr;
216 pih_isr >>= 1, module_irq++) { 221 pih_isr >>= 1, module_irq++) {
217 if (pih_isr & 0x1) { 222 if (pih_isr & 0x1) {
218 irq_desc_t *d = irq_desc + module_irq; 223 struct irq_desc *d = irq_to_desc(module_irq);
224
225 if (!d) {
226 pr_err("twl4030: Invalid SIH IRQ: %d\n",
227 module_irq);
228 return -EINVAL;
229 }
219 230
220 /* These can't be masked ... always warn 231 /* These can't be masked ... always warn
221 * if we get any surprises. 232 * if we get any surprises.
@@ -452,10 +463,16 @@ static void twl4030_sih_do_edge(struct work_struct *work)
452 /* Modify only the bits we know must change */ 463 /* Modify only the bits we know must change */
453 while (edge_change) { 464 while (edge_change) {
454 int i = fls(edge_change) - 1; 465 int i = fls(edge_change) - 1;
455 struct irq_desc *d = irq_desc + i + agent->irq_base; 466 struct irq_desc *d = irq_to_desc(i + agent->irq_base);
456 int byte = 1 + (i >> 2); 467 int byte = 1 + (i >> 2);
457 int off = (i & 0x3) * 2; 468 int off = (i & 0x3) * 2;
458 469
470 if (!d) {
471 pr_err("twl4030: Invalid IRQ: %d\n",
472 i + agent->irq_base);
473 return;
474 }
475
459 bytes[byte] &= ~(0x03 << off); 476 bytes[byte] &= ~(0x03 << off);
460 477
461 spin_lock_irq(&d->lock); 478 spin_lock_irq(&d->lock);
@@ -512,9 +529,14 @@ static void twl4030_sih_unmask(unsigned irq)
512static int twl4030_sih_set_type(unsigned irq, unsigned trigger) 529static int twl4030_sih_set_type(unsigned irq, unsigned trigger)
513{ 530{
514 struct sih_agent *sih = get_irq_chip_data(irq); 531 struct sih_agent *sih = get_irq_chip_data(irq);
515 struct irq_desc *desc = irq_desc + irq; 532 struct irq_desc *desc = irq_to_desc(irq);
516 unsigned long flags; 533 unsigned long flags;
517 534
535 if (!desc) {
536 pr_err("twl4030: Invalid IRQ: %d\n", irq);
537 return -EINVAL;
538 }
539
518 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 540 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
519 return -EINVAL; 541 return -EINVAL;
520 542
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index 0d47fb9e4b3b..3a273ccef3f2 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -63,7 +63,6 @@
63 */ 63 */
64static DEFINE_MUTEX(io_mutex); 64static DEFINE_MUTEX(io_mutex);
65static DEFINE_MUTEX(reg_lock_mutex); 65static DEFINE_MUTEX(reg_lock_mutex);
66static DEFINE_MUTEX(auxadc_mutex);
67 66
68/* Perform a physical read from the device. 67/* Perform a physical read from the device.
69 */ 68 */
@@ -299,6 +298,13 @@ int wm8350_block_write(struct wm8350 *wm8350, int start_reg, int regs,
299} 298}
300EXPORT_SYMBOL_GPL(wm8350_block_write); 299EXPORT_SYMBOL_GPL(wm8350_block_write);
301 300
301/**
302 * wm8350_reg_lock()
303 *
304 * The WM8350 has a hardware lock which can be used to prevent writes to
305 * some registers (generally those which can cause particularly serious
306 * problems if misused). This function enables that lock.
307 */
302int wm8350_reg_lock(struct wm8350 *wm8350) 308int wm8350_reg_lock(struct wm8350 *wm8350)
303{ 309{
304 u16 key = WM8350_LOCK_KEY; 310 u16 key = WM8350_LOCK_KEY;
@@ -314,6 +320,15 @@ int wm8350_reg_lock(struct wm8350 *wm8350)
314} 320}
315EXPORT_SYMBOL_GPL(wm8350_reg_lock); 321EXPORT_SYMBOL_GPL(wm8350_reg_lock);
316 322
323/**
324 * wm8350_reg_unlock()
325 *
326 * The WM8350 has a hardware lock which can be used to prevent writes to
327 * some registers (generally those which can cause particularly serious
328 * problems if misused). This function disables that lock so updates
329 * can be performed. For maximum safety this should be done only when
330 * required.
331 */
317int wm8350_reg_unlock(struct wm8350 *wm8350) 332int wm8350_reg_unlock(struct wm8350 *wm8350)
318{ 333{
319 u16 key = WM8350_UNLOCK_KEY; 334 u16 key = WM8350_UNLOCK_KEY;
@@ -1066,38 +1081,158 @@ int wm8350_unmask_irq(struct wm8350 *wm8350, int irq)
1066} 1081}
1067EXPORT_SYMBOL_GPL(wm8350_unmask_irq); 1082EXPORT_SYMBOL_GPL(wm8350_unmask_irq);
1068 1083
1084int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
1085{
1086 u16 reg, result = 0;
1087 int tries = 5;
1088
1089 if (channel < WM8350_AUXADC_AUX1 || channel > WM8350_AUXADC_TEMP)
1090 return -EINVAL;
1091 if (channel >= WM8350_AUXADC_USB && channel <= WM8350_AUXADC_TEMP
1092 && (scale != 0 || vref != 0))
1093 return -EINVAL;
1094
1095 mutex_lock(&wm8350->auxadc_mutex);
1096
1097 /* Turn on the ADC */
1098 reg = wm8350_reg_read(wm8350, WM8350_POWER_MGMT_5);
1099 wm8350_reg_write(wm8350, WM8350_POWER_MGMT_5, reg | WM8350_AUXADC_ENA);
1100
1101 if (scale || vref) {
1102 reg = scale << 13;
1103 reg |= vref << 12;
1104 wm8350_reg_write(wm8350, WM8350_AUX1_READBACK + channel, reg);
1105 }
1106
1107 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
1108 reg |= 1 << channel | WM8350_AUXADC_POLL;
1109 wm8350_reg_write(wm8350, WM8350_DIGITISER_CONTROL_1, reg);
1110
1111 do {
1112 schedule_timeout_interruptible(1);
1113 reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
1114 } while (tries-- && (reg & WM8350_AUXADC_POLL));
1115
1116 if (!tries)
1117 dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);
1118 else
1119 result = wm8350_reg_read(wm8350,
1120 WM8350_AUX1_READBACK + channel);
1121
1122 /* Turn off the ADC */
1123 reg = wm8350_reg_read(wm8350, WM8350_POWER_MGMT_5);
1124 wm8350_reg_write(wm8350, WM8350_POWER_MGMT_5,
1125 reg & ~WM8350_AUXADC_ENA);
1126
1127 mutex_unlock(&wm8350->auxadc_mutex);
1128
1129 return result & WM8350_AUXADC_DATA1_MASK;
1130}
1131EXPORT_SYMBOL_GPL(wm8350_read_auxadc);
1132
1069/* 1133/*
1070 * Cache is always host endian. 1134 * Cache is always host endian.
1071 */ 1135 */
1072static int wm8350_create_cache(struct wm8350 *wm8350, int mode) 1136static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode)
1073{ 1137{
1074 int i, ret = 0; 1138 int i, ret = 0;
1075 u16 value; 1139 u16 value;
1076 const u16 *reg_map; 1140 const u16 *reg_map;
1077 1141
1078 switch (mode) { 1142 switch (type) {
1079#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0
1080 case 0: 1143 case 0:
1081 reg_map = wm8350_mode0_defaults; 1144 switch (mode) {
1082 break; 1145#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0
1146 case 0:
1147 reg_map = wm8350_mode0_defaults;
1148 break;
1083#endif 1149#endif
1084#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1 1150#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1
1085 case 1: 1151 case 1:
1086 reg_map = wm8350_mode1_defaults; 1152 reg_map = wm8350_mode1_defaults;
1087 break; 1153 break;
1088#endif 1154#endif
1089#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2 1155#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2
1090 case 2: 1156 case 2:
1091 reg_map = wm8350_mode2_defaults; 1157 reg_map = wm8350_mode2_defaults;
1092 break; 1158 break;
1093#endif 1159#endif
1094#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3 1160#ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3
1095 case 3: 1161 case 3:
1096 reg_map = wm8350_mode3_defaults; 1162 reg_map = wm8350_mode3_defaults;
1163 break;
1164#endif
1165 default:
1166 dev_err(wm8350->dev,
1167 "WM8350 configuration mode %d not supported\n",
1168 mode);
1169 return -EINVAL;
1170 }
1171 break;
1172
1173 case 1:
1174 switch (mode) {
1175#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_0
1176 case 0:
1177 reg_map = wm8351_mode0_defaults;
1178 break;
1179#endif
1180#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_1
1181 case 1:
1182 reg_map = wm8351_mode1_defaults;
1183 break;
1184#endif
1185#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_2
1186 case 2:
1187 reg_map = wm8351_mode2_defaults;
1188 break;
1189#endif
1190#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_3
1191 case 3:
1192 reg_map = wm8351_mode3_defaults;
1193 break;
1194#endif
1195 default:
1196 dev_err(wm8350->dev,
1197 "WM8351 configuration mode %d not supported\n",
1198 mode);
1199 return -EINVAL;
1200 }
1097 break; 1201 break;
1202
1203 case 2:
1204 switch (mode) {
1205#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0
1206 case 0:
1207 reg_map = wm8352_mode0_defaults;
1208 break;
1209#endif
1210#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1
1211 case 1:
1212 reg_map = wm8352_mode1_defaults;
1213 break;
1098#endif 1214#endif
1215#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2
1216 case 2:
1217 reg_map = wm8352_mode2_defaults;
1218 break;
1219#endif
1220#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3
1221 case 3:
1222 reg_map = wm8352_mode3_defaults;
1223 break;
1224#endif
1225 default:
1226 dev_err(wm8350->dev,
1227 "WM8352 configuration mode %d not supported\n",
1228 mode);
1229 return -EINVAL;
1230 }
1231 break;
1232
1099 default: 1233 default:
1100 dev_err(wm8350->dev, "Configuration mode %d not supported\n", 1234 dev_err(wm8350->dev,
1235 "WM835x configuration mode %d not supported\n",
1101 mode); 1236 mode);
1102 return -EINVAL; 1237 return -EINVAL;
1103 } 1238 }
@@ -1163,53 +1298,113 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1163 struct wm8350_platform_data *pdata) 1298 struct wm8350_platform_data *pdata)
1164{ 1299{
1165 int ret = -EINVAL; 1300 int ret = -EINVAL;
1166 u16 id1, id2, mask, mode; 1301 u16 id1, id2, mask_rev;
1302 u16 cust_id, mode, chip_rev;
1167 1303
1168 /* get WM8350 revision and config mode */ 1304 /* get WM8350 revision and config mode */
1169 wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); 1305 wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
1170 wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); 1306 wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
1307 wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev);
1171 1308
1172 id1 = be16_to_cpu(id1); 1309 id1 = be16_to_cpu(id1);
1173 id2 = be16_to_cpu(id2); 1310 id2 = be16_to_cpu(id2);
1311 mask_rev = be16_to_cpu(mask_rev);
1174 1312
1175 if (id1 == 0x6143) { 1313 if (id1 != 0x6143) {
1176 switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) { 1314 dev_err(wm8350->dev,
1315 "Device with ID %x is not a WM8350\n", id1);
1316 ret = -ENODEV;
1317 goto err;
1318 }
1319
1320 mode = id2 & WM8350_CONF_STS_MASK >> 10;
1321 cust_id = id2 & WM8350_CUST_ID_MASK;
1322 chip_rev = (id2 & WM8350_CHIP_REV_MASK) >> 12;
1323 dev_info(wm8350->dev,
1324 "CONF_STS %d, CUST_ID %d, MASK_REV %d, CHIP_REV %d\n",
1325 mode, cust_id, mask_rev, chip_rev);
1326
1327 if (cust_id != 0) {
1328 dev_err(wm8350->dev, "Unsupported CUST_ID\n");
1329 ret = -ENODEV;
1330 goto err;
1331 }
1332
1333 switch (mask_rev) {
1334 case 0:
1335 wm8350->pmic.max_dcdc = WM8350_DCDC_6;
1336 wm8350->pmic.max_isink = WM8350_ISINK_B;
1337
1338 switch (chip_rev) {
1177 case WM8350_REV_E: 1339 case WM8350_REV_E:
1178 dev_info(wm8350->dev, "Found Rev E device\n"); 1340 dev_info(wm8350->dev, "WM8350 Rev E\n");
1179 wm8350->rev = WM8350_REV_E;
1180 break; 1341 break;
1181 case WM8350_REV_F: 1342 case WM8350_REV_F:
1182 dev_info(wm8350->dev, "Found Rev F device\n"); 1343 dev_info(wm8350->dev, "WM8350 Rev F\n");
1183 wm8350->rev = WM8350_REV_F;
1184 break; 1344 break;
1185 case WM8350_REV_G: 1345 case WM8350_REV_G:
1186 dev_info(wm8350->dev, "Found Rev G device\n"); 1346 dev_info(wm8350->dev, "WM8350 Rev G\n");
1187 wm8350->rev = WM8350_REV_G; 1347 wm8350->power.rev_g_coeff = 1;
1348 break;
1349 case WM8350_REV_H:
1350 dev_info(wm8350->dev, "WM8350 Rev H\n");
1351 wm8350->power.rev_g_coeff = 1;
1188 break; 1352 break;
1189 default: 1353 default:
1190 /* For safety we refuse to run on unknown hardware */ 1354 /* For safety we refuse to run on unknown hardware */
1191 dev_info(wm8350->dev, "Found unknown rev\n"); 1355 dev_err(wm8350->dev, "Unknown WM8350 CHIP_REV\n");
1192 ret = -ENODEV; 1356 ret = -ENODEV;
1193 goto err; 1357 goto err;
1194 } 1358 }
1195 } else { 1359 break;
1196 dev_info(wm8350->dev, "Device with ID %x is not a WM8350\n", 1360
1197 id1); 1361 case 1:
1362 wm8350->pmic.max_dcdc = WM8350_DCDC_4;
1363 wm8350->pmic.max_isink = WM8350_ISINK_A;
1364
1365 switch (chip_rev) {
1366 case 0:
1367 dev_info(wm8350->dev, "WM8351 Rev A\n");
1368 wm8350->power.rev_g_coeff = 1;
1369 break;
1370
1371 default:
1372 dev_err(wm8350->dev, "Unknown WM8351 CHIP_REV\n");
1373 ret = -ENODEV;
1374 goto err;
1375 }
1376 break;
1377
1378 case 2:
1379 wm8350->pmic.max_dcdc = WM8350_DCDC_6;
1380 wm8350->pmic.max_isink = WM8350_ISINK_B;
1381
1382 switch (chip_rev) {
1383 case 0:
1384 dev_info(wm8350->dev, "WM8352 Rev A\n");
1385 wm8350->power.rev_g_coeff = 1;
1386 break;
1387
1388 default:
1389 dev_err(wm8350->dev, "Unknown WM8352 CHIP_REV\n");
1390 ret = -ENODEV;
1391 goto err;
1392 }
1393 break;
1394
1395 default:
1396 dev_err(wm8350->dev, "Unknown MASK_REV\n");
1198 ret = -ENODEV; 1397 ret = -ENODEV;
1199 goto err; 1398 goto err;
1200 } 1399 }
1201 1400
1202 mode = id2 & WM8350_CONF_STS_MASK >> 10; 1401 ret = wm8350_create_cache(wm8350, mask_rev, mode);
1203 mask = id2 & WM8350_CUST_ID_MASK;
1204 dev_info(wm8350->dev, "Config mode %d, ROM mask %d\n", mode, mask);
1205
1206 ret = wm8350_create_cache(wm8350, mode);
1207 if (ret < 0) { 1402 if (ret < 0) {
1208 printk(KERN_ERR "wm8350: failed to create register cache\n"); 1403 dev_err(wm8350->dev, "Failed to create register cache\n");
1209 return ret; 1404 return ret;
1210 } 1405 }
1211 1406
1212 if (pdata->init) { 1407 if (pdata && pdata->init) {
1213 ret = pdata->init(wm8350); 1408 ret = pdata->init(wm8350);
1214 if (ret != 0) { 1409 if (ret != 0) {
1215 dev_err(wm8350->dev, "Platform init() failed: %d\n", 1410 dev_err(wm8350->dev, "Platform init() failed: %d\n",
@@ -1218,6 +1413,7 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
1218 } 1413 }
1219 } 1414 }
1220 1415
1416 mutex_init(&wm8350->auxadc_mutex);
1221 mutex_init(&wm8350->irq_mutex); 1417 mutex_init(&wm8350->irq_mutex);
1222 INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); 1418 INIT_WORK(&wm8350->irq_work, wm8350_irq_worker);
1223 if (irq) { 1419 if (irq) {
diff --git a/drivers/mfd/wm8350-i2c.c b/drivers/mfd/wm8350-i2c.c
index 3e0ce0e50ea2..8d8c93217572 100644
--- a/drivers/mfd/wm8350-i2c.c
+++ b/drivers/mfd/wm8350-i2c.c
@@ -1,8 +1,6 @@
1/* 1/*
2 * wm8350-i2c.c -- Generic I2C driver for Wolfson WM8350 PMIC 2 * wm8350-i2c.c -- Generic I2C driver for Wolfson WM8350 PMIC
3 * 3 *
4 * This driver defines and configures the WM8350 for the Freescale i.MX32ADS.
5 *
6 * Copyright 2007, 2008 Wolfson Microelectronics PLC. 4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
7 * 5 *
8 * Author: Liam Girdwood 6 * Author: Liam Girdwood
@@ -99,6 +97,8 @@ static int wm8350_i2c_remove(struct i2c_client *i2c)
99 97
100static const struct i2c_device_id wm8350_i2c_id[] = { 98static const struct i2c_device_id wm8350_i2c_id[] = {
101 { "wm8350", 0 }, 99 { "wm8350", 0 },
100 { "wm8351", 0 },
101 { "wm8352", 0 },
102 { } 102 { }
103}; 103};
104MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id); 104MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id);
diff --git a/drivers/mfd/wm8350-regmap.c b/drivers/mfd/wm8350-regmap.c
index 974678db22cd..68887b817d17 100644
--- a/drivers/mfd/wm8350-regmap.c
+++ b/drivers/mfd/wm8350-regmap.c
@@ -1074,6 +1074,2102 @@ const u16 wm8350_mode3_defaults[] = {
1074}; 1074};
1075#endif 1075#endif
1076 1076
1077#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_0
1078
1079#undef WM8350_HAVE_CONFIG_MODE
1080#define WM8350_HAVE_CONFIG_MODE
1081
1082const u16 wm8351_mode0_defaults[] = {
1083 0x6143, /* R0 - Reset/ID */
1084 0x0000, /* R1 - ID */
1085 0x0001, /* R2 - Revision */
1086 0x1C02, /* R3 - System Control 1 */
1087 0x0004, /* R4 - System Control 2 */
1088 0x0000, /* R5 - System Hibernate */
1089 0x8A00, /* R6 - Interface Control */
1090 0x0000, /* R7 */
1091 0x8000, /* R8 - Power mgmt (1) */
1092 0x0000, /* R9 - Power mgmt (2) */
1093 0x0000, /* R10 - Power mgmt (3) */
1094 0x2000, /* R11 - Power mgmt (4) */
1095 0x0E00, /* R12 - Power mgmt (5) */
1096 0x0000, /* R13 - Power mgmt (6) */
1097 0x0000, /* R14 - Power mgmt (7) */
1098 0x0000, /* R15 */
1099 0x0000, /* R16 - RTC Seconds/Minutes */
1100 0x0100, /* R17 - RTC Hours/Day */
1101 0x0101, /* R18 - RTC Date/Month */
1102 0x1400, /* R19 - RTC Year */
1103 0x0000, /* R20 - Alarm Seconds/Minutes */
1104 0x0000, /* R21 - Alarm Hours/Day */
1105 0x0000, /* R22 - Alarm Date/Month */
1106 0x0320, /* R23 - RTC Time Control */
1107 0x0000, /* R24 - System Interrupts */
1108 0x0000, /* R25 - Interrupt Status 1 */
1109 0x0000, /* R26 - Interrupt Status 2 */
1110 0x0000, /* R27 */
1111 0x0000, /* R28 - Under Voltage Interrupt status */
1112 0x0000, /* R29 - Over Current Interrupt status */
1113 0x0000, /* R30 - GPIO Interrupt Status */
1114 0x0000, /* R31 - Comparator Interrupt Status */
1115 0x3FFF, /* R32 - System Interrupts Mask */
1116 0x0000, /* R33 - Interrupt Status 1 Mask */
1117 0x0000, /* R34 - Interrupt Status 2 Mask */
1118 0x0000, /* R35 */
1119 0x0000, /* R36 - Under Voltage Interrupt status Mask */
1120 0x0000, /* R37 - Over Current Interrupt status Mask */
1121 0x0000, /* R38 - GPIO Interrupt Status Mask */
1122 0x0000, /* R39 - Comparator Interrupt Status Mask */
1123 0x0040, /* R40 - Clock Control 1 */
1124 0x0000, /* R41 - Clock Control 2 */
1125 0x3A00, /* R42 - FLL Control 1 */
1126 0x7086, /* R43 - FLL Control 2 */
1127 0xC226, /* R44 - FLL Control 3 */
1128 0x0000, /* R45 - FLL Control 4 */
1129 0x0000, /* R46 */
1130 0x0000, /* R47 */
1131 0x0000, /* R48 - DAC Control */
1132 0x0000, /* R49 */
1133 0x00C0, /* R50 - DAC Digital Volume L */
1134 0x00C0, /* R51 - DAC Digital Volume R */
1135 0x0000, /* R52 */
1136 0x0040, /* R53 - DAC LR Rate */
1137 0x0000, /* R54 - DAC Clock Control */
1138 0x0000, /* R55 */
1139 0x0000, /* R56 */
1140 0x0000, /* R57 */
1141 0x4000, /* R58 - DAC Mute */
1142 0x0000, /* R59 - DAC Mute Volume */
1143 0x0000, /* R60 - DAC Side */
1144 0x0000, /* R61 */
1145 0x0000, /* R62 */
1146 0x0000, /* R63 */
1147 0x8000, /* R64 - ADC Control */
1148 0x0000, /* R65 */
1149 0x00C0, /* R66 - ADC Digital Volume L */
1150 0x00C0, /* R67 - ADC Digital Volume R */
1151 0x0000, /* R68 - ADC Divider */
1152 0x0000, /* R69 */
1153 0x0040, /* R70 - ADC LR Rate */
1154 0x0000, /* R71 */
1155 0x0303, /* R72 - Input Control */
1156 0x0000, /* R73 - IN3 Input Control */
1157 0x0000, /* R74 - Mic Bias Control */
1158 0x0000, /* R75 */
1159 0x0000, /* R76 - Output Control */
1160 0x0000, /* R77 - Jack Detect */
1161 0x0000, /* R78 - Anti Pop Control */
1162 0x0000, /* R79 */
1163 0x0040, /* R80 - Left Input Volume */
1164 0x0040, /* R81 - Right Input Volume */
1165 0x0000, /* R82 */
1166 0x0000, /* R83 */
1167 0x0000, /* R84 */
1168 0x0000, /* R85 */
1169 0x0000, /* R86 */
1170 0x0000, /* R87 */
1171 0x0800, /* R88 - Left Mixer Control */
1172 0x1000, /* R89 - Right Mixer Control */
1173 0x0000, /* R90 */
1174 0x0000, /* R91 */
1175 0x0000, /* R92 - OUT3 Mixer Control */
1176 0x0000, /* R93 - OUT4 Mixer Control */
1177 0x0000, /* R94 */
1178 0x0000, /* R95 */
1179 0x0000, /* R96 - Output Left Mixer Volume */
1180 0x0000, /* R97 - Output Right Mixer Volume */
1181 0x0000, /* R98 - Input Mixer Volume L */
1182 0x0000, /* R99 - Input Mixer Volume R */
1183 0x0000, /* R100 - Input Mixer Volume */
1184 0x0000, /* R101 */
1185 0x0000, /* R102 */
1186 0x0000, /* R103 */
1187 0x00E4, /* R104 - OUT1L Volume */
1188 0x00E4, /* R105 - OUT1R Volume */
1189 0x00E4, /* R106 - OUT2L Volume */
1190 0x02E4, /* R107 - OUT2R Volume */
1191 0x0000, /* R108 */
1192 0x0000, /* R109 */
1193 0x0000, /* R110 */
1194 0x0000, /* R111 - BEEP Volume */
1195 0x0A00, /* R112 - AI Formating */
1196 0x0000, /* R113 - ADC DAC COMP */
1197 0x0020, /* R114 - AI ADC Control */
1198 0x0020, /* R115 - AI DAC Control */
1199 0x0000, /* R116 */
1200 0x0000, /* R117 */
1201 0x0000, /* R118 */
1202 0x0000, /* R119 */
1203 0x0000, /* R120 */
1204 0x0000, /* R121 */
1205 0x0000, /* R122 */
1206 0x0000, /* R123 */
1207 0x0000, /* R124 */
1208 0x0000, /* R125 */
1209 0x0000, /* R126 */
1210 0x0000, /* R127 */
1211 0x1FFF, /* R128 - GPIO Debounce */
1212 0x0000, /* R129 - GPIO Pin pull up Control */
1213 0x0000, /* R130 - GPIO Pull down Control */
1214 0x0000, /* R131 - GPIO Interrupt Mode */
1215 0x0000, /* R132 */
1216 0x0000, /* R133 - GPIO Control */
1217 0x0FFC, /* R134 - GPIO Configuration (i/o) */
1218 0x0FFC, /* R135 - GPIO Pin Polarity / Type */
1219 0x0000, /* R136 */
1220 0x0000, /* R137 */
1221 0x0000, /* R138 */
1222 0x0000, /* R139 */
1223 0x0013, /* R140 - GPIO Function Select 1 */
1224 0x0000, /* R141 - GPIO Function Select 2 */
1225 0x0000, /* R142 - GPIO Function Select 3 */
1226 0x0003, /* R143 - GPIO Function Select 4 */
1227 0x0000, /* R144 - Digitiser Control (1) */
1228 0x0002, /* R145 - Digitiser Control (2) */
1229 0x0000, /* R146 */
1230 0x0000, /* R147 */
1231 0x0000, /* R148 */
1232 0x0000, /* R149 */
1233 0x0000, /* R150 */
1234 0x0000, /* R151 */
1235 0x7000, /* R152 - AUX1 Readback */
1236 0x7000, /* R153 - AUX2 Readback */
1237 0x7000, /* R154 - AUX3 Readback */
1238 0x7000, /* R155 - AUX4 Readback */
1239 0x0000, /* R156 - USB Voltage Readback */
1240 0x0000, /* R157 - LINE Voltage Readback */
1241 0x0000, /* R158 - BATT Voltage Readback */
1242 0x0000, /* R159 - Chip Temp Readback */
1243 0x0000, /* R160 */
1244 0x0000, /* R161 */
1245 0x0000, /* R162 */
1246 0x0000, /* R163 - Generic Comparator Control */
1247 0x0000, /* R164 - Generic comparator 1 */
1248 0x0000, /* R165 - Generic comparator 2 */
1249 0x0000, /* R166 - Generic comparator 3 */
1250 0x0000, /* R167 - Generic comparator 4 */
1251 0xA00F, /* R168 - Battery Charger Control 1 */
1252 0x0B06, /* R169 - Battery Charger Control 2 */
1253 0x0000, /* R170 - Battery Charger Control 3 */
1254 0x0000, /* R171 */
1255 0x0000, /* R172 - Current Sink Driver A */
1256 0x0000, /* R173 - CSA Flash control */
1257 0x0000, /* R174 */
1258 0x0000, /* R175 */
1259 0x0000, /* R176 - DCDC/LDO requested */
1260 0x032D, /* R177 - DCDC Active options */
1261 0x0000, /* R178 - DCDC Sleep options */
1262 0x0025, /* R179 - Power-check comparator */
1263 0x000E, /* R180 - DCDC1 Control */
1264 0x0000, /* R181 - DCDC1 Timeouts */
1265 0x1006, /* R182 - DCDC1 Low Power */
1266 0x0018, /* R183 - DCDC2 Control */
1267 0x0000, /* R184 - DCDC2 Timeouts */
1268 0x0000, /* R185 */
1269 0x0000, /* R186 - DCDC3 Control */
1270 0x0000, /* R187 - DCDC3 Timeouts */
1271 0x0006, /* R188 - DCDC3 Low Power */
1272 0x0000, /* R189 - DCDC4 Control */
1273 0x0000, /* R190 - DCDC4 Timeouts */
1274 0x0006, /* R191 - DCDC4 Low Power */
1275 0x0008, /* R192 */
1276 0x0000, /* R193 */
1277 0x0000, /* R194 */
1278 0x0000, /* R195 */
1279 0x0000, /* R196 */
1280 0x0006, /* R197 */
1281 0x0000, /* R198 */
1282 0x0003, /* R199 - Limit Switch Control */
1283 0x001C, /* R200 - LDO1 Control */
1284 0x0000, /* R201 - LDO1 Timeouts */
1285 0x001C, /* R202 - LDO1 Low Power */
1286 0x001B, /* R203 - LDO2 Control */
1287 0x0000, /* R204 - LDO2 Timeouts */
1288 0x001C, /* R205 - LDO2 Low Power */
1289 0x001B, /* R206 - LDO3 Control */
1290 0x0000, /* R207 - LDO3 Timeouts */
1291 0x001C, /* R208 - LDO3 Low Power */
1292 0x001B, /* R209 - LDO4 Control */
1293 0x0000, /* R210 - LDO4 Timeouts */
1294 0x001C, /* R211 - LDO4 Low Power */
1295 0x0000, /* R212 */
1296 0x0000, /* R213 */
1297 0x0000, /* R214 */
1298 0x0000, /* R215 - VCC_FAULT Masks */
1299 0x001F, /* R216 - Main Bandgap Control */
1300 0x0000, /* R217 - OSC Control */
1301 0x9000, /* R218 - RTC Tick Control */
1302 0x0000, /* R219 - Security1 */
1303 0x4000, /* R220 */
1304 0x0000, /* R221 */
1305 0x0000, /* R222 */
1306 0x0000, /* R223 */
1307 0x0000, /* R224 - Signal overrides */
1308 0x0000, /* R225 - DCDC/LDO status */
1309 0x0000, /* R226 - Charger Overides/status */
1310 0x0000, /* R227 - misc overrides */
1311 0x0000, /* R228 - Supply overrides/status 1 */
1312 0x0000, /* R229 - Supply overrides/status 2 */
1313 0xE000, /* R230 - GPIO Pin Status */
1314 0x0000, /* R231 - comparotor overrides */
1315 0x0000, /* R232 */
1316 0x0000, /* R233 - State Machine status */
1317 0x1200, /* R234 - FLL Test 1 */
1318 0x0000, /* R235 */
1319 0x8000, /* R236 */
1320 0x0000, /* R237 */
1321 0x0000, /* R238 */
1322 0x0000, /* R239 */
1323 0x0003, /* R240 */
1324 0x0000, /* R241 */
1325 0x0000, /* R242 */
1326 0x0004, /* R243 */
1327 0x0300, /* R244 */
1328 0x0000, /* R245 */
1329 0x0200, /* R246 */
1330 0x0000, /* R247 */
1331 0x1000, /* R248 - DCDC1 Test Controls */
1332 0x1000, /* R249 */
1333 0x1000, /* R250 - DCDC3 Test Controls */
1334 0x1000, /* R251 - DCDC4 Test Controls */
1335};
1336#endif
1337
1338#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_1
1339
1340#undef WM8350_HAVE_CONFIG_MODE
1341#define WM8350_HAVE_CONFIG_MODE
1342
1343const u16 wm8351_mode1_defaults[] = {
1344 0x6143, /* R0 - Reset/ID */
1345 0x0000, /* R1 - ID */
1346 0x0001, /* R2 - Revision */
1347 0x1C02, /* R3 - System Control 1 */
1348 0x0204, /* R4 - System Control 2 */
1349 0x0000, /* R5 - System Hibernate */
1350 0x8A00, /* R6 - Interface Control */
1351 0x0000, /* R7 */
1352 0x8000, /* R8 - Power mgmt (1) */
1353 0x0000, /* R9 - Power mgmt (2) */
1354 0x0000, /* R10 - Power mgmt (3) */
1355 0x2000, /* R11 - Power mgmt (4) */
1356 0x0E00, /* R12 - Power mgmt (5) */
1357 0x0000, /* R13 - Power mgmt (6) */
1358 0x0000, /* R14 - Power mgmt (7) */
1359 0x0000, /* R15 */
1360 0x0000, /* R16 - RTC Seconds/Minutes */
1361 0x0100, /* R17 - RTC Hours/Day */
1362 0x0101, /* R18 - RTC Date/Month */
1363 0x1400, /* R19 - RTC Year */
1364 0x0000, /* R20 - Alarm Seconds/Minutes */
1365 0x0000, /* R21 - Alarm Hours/Day */
1366 0x0000, /* R22 - Alarm Date/Month */
1367 0x0320, /* R23 - RTC Time Control */
1368 0x0000, /* R24 - System Interrupts */
1369 0x0000, /* R25 - Interrupt Status 1 */
1370 0x0000, /* R26 - Interrupt Status 2 */
1371 0x0000, /* R27 */
1372 0x0000, /* R28 - Under Voltage Interrupt status */
1373 0x0000, /* R29 - Over Current Interrupt status */
1374 0x0000, /* R30 - GPIO Interrupt Status */
1375 0x0000, /* R31 - Comparator Interrupt Status */
1376 0x3FFF, /* R32 - System Interrupts Mask */
1377 0x0000, /* R33 - Interrupt Status 1 Mask */
1378 0x0000, /* R34 - Interrupt Status 2 Mask */
1379 0x0000, /* R35 */
1380 0x0000, /* R36 - Under Voltage Interrupt status Mask */
1381 0x0000, /* R37 - Over Current Interrupt status Mask */
1382 0x0000, /* R38 - GPIO Interrupt Status Mask */
1383 0x0000, /* R39 - Comparator Interrupt Status Mask */
1384 0x0040, /* R40 - Clock Control 1 */
1385 0x0000, /* R41 - Clock Control 2 */
1386 0x3A00, /* R42 - FLL Control 1 */
1387 0x7086, /* R43 - FLL Control 2 */
1388 0xC226, /* R44 - FLL Control 3 */
1389 0x0000, /* R45 - FLL Control 4 */
1390 0x0000, /* R46 */
1391 0x0000, /* R47 */
1392 0x0000, /* R48 - DAC Control */
1393 0x0000, /* R49 */
1394 0x00C0, /* R50 - DAC Digital Volume L */
1395 0x00C0, /* R51 - DAC Digital Volume R */
1396 0x0000, /* R52 */
1397 0x0040, /* R53 - DAC LR Rate */
1398 0x0000, /* R54 - DAC Clock Control */
1399 0x0000, /* R55 */
1400 0x0000, /* R56 */
1401 0x0000, /* R57 */
1402 0x4000, /* R58 - DAC Mute */
1403 0x0000, /* R59 - DAC Mute Volume */
1404 0x0000, /* R60 - DAC Side */
1405 0x0000, /* R61 */
1406 0x0000, /* R62 */
1407 0x0000, /* R63 */
1408 0x8000, /* R64 - ADC Control */
1409 0x0000, /* R65 */
1410 0x00C0, /* R66 - ADC Digital Volume L */
1411 0x00C0, /* R67 - ADC Digital Volume R */
1412 0x0000, /* R68 - ADC Divider */
1413 0x0000, /* R69 */
1414 0x0040, /* R70 - ADC LR Rate */
1415 0x0000, /* R71 */
1416 0x0303, /* R72 - Input Control */
1417 0x0000, /* R73 - IN3 Input Control */
1418 0x0000, /* R74 - Mic Bias Control */
1419 0x0000, /* R75 */
1420 0x0000, /* R76 - Output Control */
1421 0x0000, /* R77 - Jack Detect */
1422 0x0000, /* R78 - Anti Pop Control */
1423 0x0000, /* R79 */
1424 0x0040, /* R80 - Left Input Volume */
1425 0x0040, /* R81 - Right Input Volume */
1426 0x0000, /* R82 */
1427 0x0000, /* R83 */
1428 0x0000, /* R84 */
1429 0x0000, /* R85 */
1430 0x0000, /* R86 */
1431 0x0000, /* R87 */
1432 0x0800, /* R88 - Left Mixer Control */
1433 0x1000, /* R89 - Right Mixer Control */
1434 0x0000, /* R90 */
1435 0x0000, /* R91 */
1436 0x0000, /* R92 - OUT3 Mixer Control */
1437 0x0000, /* R93 - OUT4 Mixer Control */
1438 0x0000, /* R94 */
1439 0x0000, /* R95 */
1440 0x0000, /* R96 - Output Left Mixer Volume */
1441 0x0000, /* R97 - Output Right Mixer Volume */
1442 0x0000, /* R98 - Input Mixer Volume L */
1443 0x0000, /* R99 - Input Mixer Volume R */
1444 0x0000, /* R100 - Input Mixer Volume */
1445 0x0000, /* R101 */
1446 0x0000, /* R102 */
1447 0x0000, /* R103 */
1448 0x00E4, /* R104 - OUT1L Volume */
1449 0x00E4, /* R105 - OUT1R Volume */
1450 0x00E4, /* R106 - OUT2L Volume */
1451 0x02E4, /* R107 - OUT2R Volume */
1452 0x0000, /* R108 */
1453 0x0000, /* R109 */
1454 0x0000, /* R110 */
1455 0x0000, /* R111 - BEEP Volume */
1456 0x0A00, /* R112 - AI Formating */
1457 0x0000, /* R113 - ADC DAC COMP */
1458 0x0020, /* R114 - AI ADC Control */
1459 0x0020, /* R115 - AI DAC Control */
1460 0x0000, /* R116 */
1461 0x0000, /* R117 */
1462 0x0000, /* R118 */
1463 0x0000, /* R119 */
1464 0x0000, /* R120 */
1465 0x0000, /* R121 */
1466 0x0000, /* R122 */
1467 0x0000, /* R123 */
1468 0x0000, /* R124 */
1469 0x0000, /* R125 */
1470 0x0000, /* R126 */
1471 0x0000, /* R127 */
1472 0x1FFF, /* R128 - GPIO Debounce */
1473 0x0000, /* R129 - GPIO Pin pull up Control */
1474 0x0000, /* R130 - GPIO Pull down Control */
1475 0x0000, /* R131 - GPIO Interrupt Mode */
1476 0x0000, /* R132 */
1477 0x0000, /* R133 - GPIO Control */
1478 0x0CFB, /* R134 - GPIO Configuration (i/o) */
1479 0x0C1F, /* R135 - GPIO Pin Polarity / Type */
1480 0x0000, /* R136 */
1481 0x0000, /* R137 */
1482 0x0000, /* R138 */
1483 0x0000, /* R139 */
1484 0x0300, /* R140 - GPIO Function Select 1 */
1485 0x1110, /* R141 - GPIO Function Select 2 */
1486 0x0013, /* R142 - GPIO Function Select 3 */
1487 0x0003, /* R143 - GPIO Function Select 4 */
1488 0x0000, /* R144 - Digitiser Control (1) */
1489 0x0002, /* R145 - Digitiser Control (2) */
1490 0x0000, /* R146 */
1491 0x0000, /* R147 */
1492 0x0000, /* R148 */
1493 0x0000, /* R149 */
1494 0x0000, /* R150 */
1495 0x0000, /* R151 */
1496 0x7000, /* R152 - AUX1 Readback */
1497 0x7000, /* R153 - AUX2 Readback */
1498 0x7000, /* R154 - AUX3 Readback */
1499 0x7000, /* R155 - AUX4 Readback */
1500 0x0000, /* R156 - USB Voltage Readback */
1501 0x0000, /* R157 - LINE Voltage Readback */
1502 0x0000, /* R158 - BATT Voltage Readback */
1503 0x0000, /* R159 - Chip Temp Readback */
1504 0x0000, /* R160 */
1505 0x0000, /* R161 */
1506 0x0000, /* R162 */
1507 0x0000, /* R163 - Generic Comparator Control */
1508 0x0000, /* R164 - Generic comparator 1 */
1509 0x0000, /* R165 - Generic comparator 2 */
1510 0x0000, /* R166 - Generic comparator 3 */
1511 0x0000, /* R167 - Generic comparator 4 */
1512 0xA00F, /* R168 - Battery Charger Control 1 */
1513 0x0B06, /* R169 - Battery Charger Control 2 */
1514 0x0000, /* R170 - Battery Charger Control 3 */
1515 0x0000, /* R171 */
1516 0x0000, /* R172 - Current Sink Driver A */
1517 0x0000, /* R173 - CSA Flash control */
1518 0x0000, /* R174 */
1519 0x0000, /* R175 */
1520 0x0000, /* R176 - DCDC/LDO requested */
1521 0x032D, /* R177 - DCDC Active options */
1522 0x0000, /* R178 - DCDC Sleep options */
1523 0x0025, /* R179 - Power-check comparator */
1524 0x000E, /* R180 - DCDC1 Control */
1525 0x0C00, /* R181 - DCDC1 Timeouts */
1526 0x1006, /* R182 - DCDC1 Low Power */
1527 0x0018, /* R183 - DCDC2 Control */
1528 0x0000, /* R184 - DCDC2 Timeouts */
1529 0x0000, /* R185 */
1530 0x0026, /* R186 - DCDC3 Control */
1531 0x0400, /* R187 - DCDC3 Timeouts */
1532 0x0006, /* R188 - DCDC3 Low Power */
1533 0x0062, /* R189 - DCDC4 Control */
1534 0x0800, /* R190 - DCDC4 Timeouts */
1535 0x0006, /* R191 - DCDC4 Low Power */
1536 0x0008, /* R192 */
1537 0x0000, /* R193 */
1538 0x0000, /* R194 */
1539 0x000A, /* R195 */
1540 0x1000, /* R196 */
1541 0x0006, /* R197 */
1542 0x0000, /* R198 */
1543 0x0003, /* R199 - Limit Switch Control */
1544 0x0006, /* R200 - LDO1 Control */
1545 0x0000, /* R201 - LDO1 Timeouts */
1546 0x001C, /* R202 - LDO1 Low Power */
1547 0x0010, /* R203 - LDO2 Control */
1548 0x0C00, /* R204 - LDO2 Timeouts */
1549 0x001C, /* R205 - LDO2 Low Power */
1550 0x001F, /* R206 - LDO3 Control */
1551 0x0800, /* R207 - LDO3 Timeouts */
1552 0x001C, /* R208 - LDO3 Low Power */
1553 0x000A, /* R209 - LDO4 Control */
1554 0x0800, /* R210 - LDO4 Timeouts */
1555 0x001C, /* R211 - LDO4 Low Power */
1556 0x0000, /* R212 */
1557 0x0000, /* R213 */
1558 0x0000, /* R214 */
1559 0x0000, /* R215 - VCC_FAULT Masks */
1560 0x001F, /* R216 - Main Bandgap Control */
1561 0x0000, /* R217 - OSC Control */
1562 0x9000, /* R218 - RTC Tick Control */
1563 0x0000, /* R219 - Security1 */
1564 0x4000, /* R220 */
1565 0x0000, /* R221 */
1566 0x0000, /* R222 */
1567 0x0000, /* R223 */
1568 0x0000, /* R224 - Signal overrides */
1569 0x0000, /* R225 - DCDC/LDO status */
1570 0x0000, /* R226 - Charger Overides/status */
1571 0x0000, /* R227 - misc overrides */
1572 0x0000, /* R228 - Supply overrides/status 1 */
1573 0x0000, /* R229 - Supply overrides/status 2 */
1574 0xE000, /* R230 - GPIO Pin Status */
1575 0x0000, /* R231 - comparotor overrides */
1576 0x0000, /* R232 */
1577 0x0000, /* R233 - State Machine status */
1578 0x1200, /* R234 - FLL Test 1 */
1579 0x0000, /* R235 */
1580 0x8000, /* R236 */
1581 0x0000, /* R237 */
1582 0x0000, /* R238 */
1583 0x0000, /* R239 */
1584 0x0003, /* R240 */
1585 0x0000, /* R241 */
1586 0x0000, /* R242 */
1587 0x0004, /* R243 */
1588 0x0300, /* R244 */
1589 0x0000, /* R245 */
1590 0x0200, /* R246 */
1591 0x1000, /* R247 */
1592 0x1000, /* R248 - DCDC1 Test Controls */
1593 0x1000, /* R249 */
1594 0x1000, /* R250 - DCDC3 Test Controls */
1595 0x1000, /* R251 - DCDC4 Test Controls */
1596};
1597#endif
1598
1599#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_2
1600
1601#undef WM8350_HAVE_CONFIG_MODE
1602#define WM8350_HAVE_CONFIG_MODE
1603
1604const u16 wm8351_mode2_defaults[] = {
1605 0x6143, /* R0 - Reset/ID */
1606 0x0000, /* R1 - ID */
1607 0x0001, /* R2 - Revision */
1608 0x1C02, /* R3 - System Control 1 */
1609 0x0214, /* R4 - System Control 2 */
1610 0x0000, /* R5 - System Hibernate */
1611 0x8A00, /* R6 - Interface Control */
1612 0x0000, /* R7 */
1613 0x8000, /* R8 - Power mgmt (1) */
1614 0x0000, /* R9 - Power mgmt (2) */
1615 0x0000, /* R10 - Power mgmt (3) */
1616 0x2000, /* R11 - Power mgmt (4) */
1617 0x0E00, /* R12 - Power mgmt (5) */
1618 0x0000, /* R13 - Power mgmt (6) */
1619 0x0000, /* R14 - Power mgmt (7) */
1620 0x0000, /* R15 */
1621 0x0000, /* R16 - RTC Seconds/Minutes */
1622 0x0100, /* R17 - RTC Hours/Day */
1623 0x0101, /* R18 - RTC Date/Month */
1624 0x1400, /* R19 - RTC Year */
1625 0x0000, /* R20 - Alarm Seconds/Minutes */
1626 0x0000, /* R21 - Alarm Hours/Day */
1627 0x0000, /* R22 - Alarm Date/Month */
1628 0x0320, /* R23 - RTC Time Control */
1629 0x0000, /* R24 - System Interrupts */
1630 0x0000, /* R25 - Interrupt Status 1 */
1631 0x0000, /* R26 - Interrupt Status 2 */
1632 0x0000, /* R27 */
1633 0x0000, /* R28 - Under Voltage Interrupt status */
1634 0x0000, /* R29 - Over Current Interrupt status */
1635 0x0000, /* R30 - GPIO Interrupt Status */
1636 0x0000, /* R31 - Comparator Interrupt Status */
1637 0x3FFF, /* R32 - System Interrupts Mask */
1638 0x0000, /* R33 - Interrupt Status 1 Mask */
1639 0x0000, /* R34 - Interrupt Status 2 Mask */
1640 0x0000, /* R35 */
1641 0x0000, /* R36 - Under Voltage Interrupt status Mask */
1642 0x0000, /* R37 - Over Current Interrupt status Mask */
1643 0x0000, /* R38 - GPIO Interrupt Status Mask */
1644 0x0000, /* R39 - Comparator Interrupt Status Mask */
1645 0x0040, /* R40 - Clock Control 1 */
1646 0x0000, /* R41 - Clock Control 2 */
1647 0x3A00, /* R42 - FLL Control 1 */
1648 0x7086, /* R43 - FLL Control 2 */
1649 0xC226, /* R44 - FLL Control 3 */
1650 0x0000, /* R45 - FLL Control 4 */
1651 0x0000, /* R46 */
1652 0x0000, /* R47 */
1653 0x0000, /* R48 - DAC Control */
1654 0x0000, /* R49 */
1655 0x00C0, /* R50 - DAC Digital Volume L */
1656 0x00C0, /* R51 - DAC Digital Volume R */
1657 0x0000, /* R52 */
1658 0x0040, /* R53 - DAC LR Rate */
1659 0x0000, /* R54 - DAC Clock Control */
1660 0x0000, /* R55 */
1661 0x0000, /* R56 */
1662 0x0000, /* R57 */
1663 0x4000, /* R58 - DAC Mute */
1664 0x0000, /* R59 - DAC Mute Volume */
1665 0x0000, /* R60 - DAC Side */
1666 0x0000, /* R61 */
1667 0x0000, /* R62 */
1668 0x0000, /* R63 */
1669 0x8000, /* R64 - ADC Control */
1670 0x0000, /* R65 */
1671 0x00C0, /* R66 - ADC Digital Volume L */
1672 0x00C0, /* R67 - ADC Digital Volume R */
1673 0x0000, /* R68 - ADC Divider */
1674 0x0000, /* R69 */
1675 0x0040, /* R70 - ADC LR Rate */
1676 0x0000, /* R71 */
1677 0x0303, /* R72 - Input Control */
1678 0x0000, /* R73 - IN3 Input Control */
1679 0x0000, /* R74 - Mic Bias Control */
1680 0x0000, /* R75 */
1681 0x0000, /* R76 - Output Control */
1682 0x0000, /* R77 - Jack Detect */
1683 0x0000, /* R78 - Anti Pop Control */
1684 0x0000, /* R79 */
1685 0x0040, /* R80 - Left Input Volume */
1686 0x0040, /* R81 - Right Input Volume */
1687 0x0000, /* R82 */
1688 0x0000, /* R83 */
1689 0x0000, /* R84 */
1690 0x0000, /* R85 */
1691 0x0000, /* R86 */
1692 0x0000, /* R87 */
1693 0x0800, /* R88 - Left Mixer Control */
1694 0x1000, /* R89 - Right Mixer Control */
1695 0x0000, /* R90 */
1696 0x0000, /* R91 */
1697 0x0000, /* R92 - OUT3 Mixer Control */
1698 0x0000, /* R93 - OUT4 Mixer Control */
1699 0x0000, /* R94 */
1700 0x0000, /* R95 */
1701 0x0000, /* R96 - Output Left Mixer Volume */
1702 0x0000, /* R97 - Output Right Mixer Volume */
1703 0x0000, /* R98 - Input Mixer Volume L */
1704 0x0000, /* R99 - Input Mixer Volume R */
1705 0x0000, /* R100 - Input Mixer Volume */
1706 0x0000, /* R101 */
1707 0x0000, /* R102 */
1708 0x0000, /* R103 */
1709 0x00E4, /* R104 - OUT1L Volume */
1710 0x00E4, /* R105 - OUT1R Volume */
1711 0x00E4, /* R106 - OUT2L Volume */
1712 0x02E4, /* R107 - OUT2R Volume */
1713 0x0000, /* R108 */
1714 0x0000, /* R109 */
1715 0x0000, /* R110 */
1716 0x0000, /* R111 - BEEP Volume */
1717 0x0A00, /* R112 - AI Formating */
1718 0x0000, /* R113 - ADC DAC COMP */
1719 0x0020, /* R114 - AI ADC Control */
1720 0x0020, /* R115 - AI DAC Control */
1721 0x0000, /* R116 */
1722 0x0000, /* R117 */
1723 0x0000, /* R118 */
1724 0x0000, /* R119 */
1725 0x0000, /* R120 */
1726 0x0000, /* R121 */
1727 0x0000, /* R122 */
1728 0x0000, /* R123 */
1729 0x0000, /* R124 */
1730 0x0000, /* R125 */
1731 0x0000, /* R126 */
1732 0x0000, /* R127 */
1733 0x1FFF, /* R128 - GPIO Debounce */
1734 0x0000, /* R129 - GPIO Pin pull up Control */
1735 0x0110, /* R130 - GPIO Pull down Control */
1736 0x0000, /* R131 - GPIO Interrupt Mode */
1737 0x0000, /* R132 */
1738 0x0000, /* R133 - GPIO Control */
1739 0x09FA, /* R134 - GPIO Configuration (i/o) */
1740 0x0DF6, /* R135 - GPIO Pin Polarity / Type */
1741 0x0000, /* R136 */
1742 0x0000, /* R137 */
1743 0x0000, /* R138 */
1744 0x0000, /* R139 */
1745 0x1310, /* R140 - GPIO Function Select 1 */
1746 0x0003, /* R141 - GPIO Function Select 2 */
1747 0x2000, /* R142 - GPIO Function Select 3 */
1748 0x0000, /* R143 - GPIO Function Select 4 */
1749 0x0000, /* R144 - Digitiser Control (1) */
1750 0x0002, /* R145 - Digitiser Control (2) */
1751 0x0000, /* R146 */
1752 0x0000, /* R147 */
1753 0x0000, /* R148 */
1754 0x0000, /* R149 */
1755 0x0000, /* R150 */
1756 0x0000, /* R151 */
1757 0x7000, /* R152 - AUX1 Readback */
1758 0x7000, /* R153 - AUX2 Readback */
1759 0x7000, /* R154 - AUX3 Readback */
1760 0x7000, /* R155 - AUX4 Readback */
1761 0x0000, /* R156 - USB Voltage Readback */
1762 0x0000, /* R157 - LINE Voltage Readback */
1763 0x0000, /* R158 - BATT Voltage Readback */
1764 0x0000, /* R159 - Chip Temp Readback */
1765 0x0000, /* R160 */
1766 0x0000, /* R161 */
1767 0x0000, /* R162 */
1768 0x0000, /* R163 - Generic Comparator Control */
1769 0x0000, /* R164 - Generic comparator 1 */
1770 0x0000, /* R165 - Generic comparator 2 */
1771 0x0000, /* R166 - Generic comparator 3 */
1772 0x0000, /* R167 - Generic comparator 4 */
1773 0xA00F, /* R168 - Battery Charger Control 1 */
1774 0x0B06, /* R169 - Battery Charger Control 2 */
1775 0x0000, /* R170 - Battery Charger Control 3 */
1776 0x0000, /* R171 */
1777 0x0000, /* R172 - Current Sink Driver A */
1778 0x0000, /* R173 - CSA Flash control */
1779 0x0000, /* R174 */
1780 0x0000, /* R175 */
1781 0x0000, /* R176 - DCDC/LDO requested */
1782 0x032D, /* R177 - DCDC Active options */
1783 0x0000, /* R178 - DCDC Sleep options */
1784 0x0025, /* R179 - Power-check comparator */
1785 0x001A, /* R180 - DCDC1 Control */
1786 0x0800, /* R181 - DCDC1 Timeouts */
1787 0x1006, /* R182 - DCDC1 Low Power */
1788 0x0018, /* R183 - DCDC2 Control */
1789 0x0000, /* R184 - DCDC2 Timeouts */
1790 0x0000, /* R185 */
1791 0x0056, /* R186 - DCDC3 Control */
1792 0x0400, /* R187 - DCDC3 Timeouts */
1793 0x0006, /* R188 - DCDC3 Low Power */
1794 0x0026, /* R189 - DCDC4 Control */
1795 0x0C00, /* R190 - DCDC4 Timeouts */
1796 0x0006, /* R191 - DCDC4 Low Power */
1797 0x0008, /* R192 */
1798 0x0000, /* R193 */
1799 0x0000, /* R194 */
1800 0x0026, /* R195 */
1801 0x0C00, /* R196 */
1802 0x0006, /* R197 */
1803 0x0000, /* R198 */
1804 0x0003, /* R199 - Limit Switch Control */
1805 0x001C, /* R200 - LDO1 Control */
1806 0x0400, /* R201 - LDO1 Timeouts */
1807 0x001C, /* R202 - LDO1 Low Power */
1808 0x0010, /* R203 - LDO2 Control */
1809 0x0C00, /* R204 - LDO2 Timeouts */
1810 0x001C, /* R205 - LDO2 Low Power */
1811 0x0015, /* R206 - LDO3 Control */
1812 0x0000, /* R207 - LDO3 Timeouts */
1813 0x001C, /* R208 - LDO3 Low Power */
1814 0x001A, /* R209 - LDO4 Control */
1815 0x0000, /* R210 - LDO4 Timeouts */
1816 0x001C, /* R211 - LDO4 Low Power */
1817 0x0000, /* R212 */
1818 0x0000, /* R213 */
1819 0x0000, /* R214 */
1820 0x0000, /* R215 - VCC_FAULT Masks */
1821 0x001F, /* R216 - Main Bandgap Control */
1822 0x0000, /* R217 - OSC Control */
1823 0x9000, /* R218 - RTC Tick Control */
1824 0x0000, /* R219 - Security1 */
1825 0x4000, /* R220 */
1826 0x0000, /* R221 */
1827 0x0000, /* R222 */
1828 0x0000, /* R223 */
1829 0x0000, /* R224 - Signal overrides */
1830 0x0000, /* R225 - DCDC/LDO status */
1831 0x0000, /* R226 - Charger Overides/status */
1832 0x0000, /* R227 - misc overrides */
1833 0x0000, /* R228 - Supply overrides/status 1 */
1834 0x0000, /* R229 - Supply overrides/status 2 */
1835 0xE000, /* R230 - GPIO Pin Status */
1836 0x0000, /* R231 - comparotor overrides */
1837 0x0000, /* R232 */
1838 0x0000, /* R233 - State Machine status */
1839 0x1200, /* R234 - FLL Test 1 */
1840 0x0000, /* R235 */
1841 0x8000, /* R236 */
1842 0x0000, /* R237 */
1843 0x0000, /* R238 */
1844 0x0000, /* R239 */
1845 0x0003, /* R240 */
1846 0x0000, /* R241 */
1847 0x0000, /* R242 */
1848 0x0004, /* R243 */
1849 0x0300, /* R244 */
1850 0x0000, /* R245 */
1851 0x0200, /* R246 */
1852 0x0000, /* R247 */
1853 0x1000, /* R248 - DCDC1 Test Controls */
1854 0x1000, /* R249 */
1855 0x1000, /* R250 - DCDC3 Test Controls */
1856 0x1000, /* R251 - DCDC4 Test Controls */
1857};
1858#endif
1859
1860#ifdef CONFIG_MFD_WM8351_CONFIG_MODE_3
1861
1862#undef WM8350_HAVE_CONFIG_MODE
1863#define WM8350_HAVE_CONFIG_MODE
1864
1865const u16 wm8351_mode3_defaults[] = {
1866 0x6143, /* R0 - Reset/ID */
1867 0x0000, /* R1 - ID */
1868 0x0001, /* R2 - Revision */
1869 0x1C02, /* R3 - System Control 1 */
1870 0x0204, /* R4 - System Control 2 */
1871 0x0000, /* R5 - System Hibernate */
1872 0x8A00, /* R6 - Interface Control */
1873 0x0000, /* R7 */
1874 0x8000, /* R8 - Power mgmt (1) */
1875 0x0000, /* R9 - Power mgmt (2) */
1876 0x0000, /* R10 - Power mgmt (3) */
1877 0x2000, /* R11 - Power mgmt (4) */
1878 0x0E00, /* R12 - Power mgmt (5) */
1879 0x0000, /* R13 - Power mgmt (6) */
1880 0x0000, /* R14 - Power mgmt (7) */
1881 0x0000, /* R15 */
1882 0x0000, /* R16 - RTC Seconds/Minutes */
1883 0x0100, /* R17 - RTC Hours/Day */
1884 0x0101, /* R18 - RTC Date/Month */
1885 0x1400, /* R19 - RTC Year */
1886 0x0000, /* R20 - Alarm Seconds/Minutes */
1887 0x0000, /* R21 - Alarm Hours/Day */
1888 0x0000, /* R22 - Alarm Date/Month */
1889 0x0320, /* R23 - RTC Time Control */
1890 0x0000, /* R24 - System Interrupts */
1891 0x0000, /* R25 - Interrupt Status 1 */
1892 0x0000, /* R26 - Interrupt Status 2 */
1893 0x0000, /* R27 */
1894 0x0000, /* R28 - Under Voltage Interrupt status */
1895 0x0000, /* R29 - Over Current Interrupt status */
1896 0x0000, /* R30 - GPIO Interrupt Status */
1897 0x0000, /* R31 - Comparator Interrupt Status */
1898 0x3FFF, /* R32 - System Interrupts Mask */
1899 0x0000, /* R33 - Interrupt Status 1 Mask */
1900 0x0000, /* R34 - Interrupt Status 2 Mask */
1901 0x0000, /* R35 */
1902 0x0000, /* R36 - Under Voltage Interrupt status Mask */
1903 0x0000, /* R37 - Over Current Interrupt status Mask */
1904 0x0000, /* R38 - GPIO Interrupt Status Mask */
1905 0x0000, /* R39 - Comparator Interrupt Status Mask */
1906 0x0040, /* R40 - Clock Control 1 */
1907 0x0000, /* R41 - Clock Control 2 */
1908 0x3A00, /* R42 - FLL Control 1 */
1909 0x7086, /* R43 - FLL Control 2 */
1910 0xC226, /* R44 - FLL Control 3 */
1911 0x0000, /* R45 - FLL Control 4 */
1912 0x0000, /* R46 */
1913 0x0000, /* R47 */
1914 0x0000, /* R48 - DAC Control */
1915 0x0000, /* R49 */
1916 0x00C0, /* R50 - DAC Digital Volume L */
1917 0x00C0, /* R51 - DAC Digital Volume R */
1918 0x0000, /* R52 */
1919 0x0040, /* R53 - DAC LR Rate */
1920 0x0000, /* R54 - DAC Clock Control */
1921 0x0000, /* R55 */
1922 0x0000, /* R56 */
1923 0x0000, /* R57 */
1924 0x4000, /* R58 - DAC Mute */
1925 0x0000, /* R59 - DAC Mute Volume */
1926 0x0000, /* R60 - DAC Side */
1927 0x0000, /* R61 */
1928 0x0000, /* R62 */
1929 0x0000, /* R63 */
1930 0x8000, /* R64 - ADC Control */
1931 0x0000, /* R65 */
1932 0x00C0, /* R66 - ADC Digital Volume L */
1933 0x00C0, /* R67 - ADC Digital Volume R */
1934 0x0000, /* R68 - ADC Divider */
1935 0x0000, /* R69 */
1936 0x0040, /* R70 - ADC LR Rate */
1937 0x0000, /* R71 */
1938 0x0303, /* R72 - Input Control */
1939 0x0000, /* R73 - IN3 Input Control */
1940 0x0000, /* R74 - Mic Bias Control */
1941 0x0000, /* R75 */
1942 0x0000, /* R76 - Output Control */
1943 0x0000, /* R77 - Jack Detect */
1944 0x0000, /* R78 - Anti Pop Control */
1945 0x0000, /* R79 */
1946 0x0040, /* R80 - Left Input Volume */
1947 0x0040, /* R81 - Right Input Volume */
1948 0x0000, /* R82 */
1949 0x0000, /* R83 */
1950 0x0000, /* R84 */
1951 0x0000, /* R85 */
1952 0x0000, /* R86 */
1953 0x0000, /* R87 */
1954 0x0800, /* R88 - Left Mixer Control */
1955 0x1000, /* R89 - Right Mixer Control */
1956 0x0000, /* R90 */
1957 0x0000, /* R91 */
1958 0x0000, /* R92 - OUT3 Mixer Control */
1959 0x0000, /* R93 - OUT4 Mixer Control */
1960 0x0000, /* R94 */
1961 0x0000, /* R95 */
1962 0x0000, /* R96 - Output Left Mixer Volume */
1963 0x0000, /* R97 - Output Right Mixer Volume */
1964 0x0000, /* R98 - Input Mixer Volume L */
1965 0x0000, /* R99 - Input Mixer Volume R */
1966 0x0000, /* R100 - Input Mixer Volume */
1967 0x0000, /* R101 */
1968 0x0000, /* R102 */
1969 0x0000, /* R103 */
1970 0x00E4, /* R104 - OUT1L Volume */
1971 0x00E4, /* R105 - OUT1R Volume */
1972 0x00E4, /* R106 - OUT2L Volume */
1973 0x02E4, /* R107 - OUT2R Volume */
1974 0x0000, /* R108 */
1975 0x0000, /* R109 */
1976 0x0000, /* R110 */
1977 0x0000, /* R111 - BEEP Volume */
1978 0x0A00, /* R112 - AI Formating */
1979 0x0000, /* R113 - ADC DAC COMP */
1980 0x0020, /* R114 - AI ADC Control */
1981 0x0020, /* R115 - AI DAC Control */
1982 0x0000, /* R116 */
1983 0x0000, /* R117 */
1984 0x0000, /* R118 */
1985 0x0000, /* R119 */
1986 0x0000, /* R120 */
1987 0x0000, /* R121 */
1988 0x0000, /* R122 */
1989 0x0000, /* R123 */
1990 0x0000, /* R124 */
1991 0x0000, /* R125 */
1992 0x0000, /* R126 */
1993 0x0000, /* R127 */
1994 0x1FFF, /* R128 - GPIO Debounce */
1995 0x0010, /* R129 - GPIO Pin pull up Control */
1996 0x0000, /* R130 - GPIO Pull down Control */
1997 0x0000, /* R131 - GPIO Interrupt Mode */
1998 0x0000, /* R132 */
1999 0x0000, /* R133 - GPIO Control */
2000 0x0BFB, /* R134 - GPIO Configuration (i/o) */
2001 0x0FFD, /* R135 - GPIO Pin Polarity / Type */
2002 0x0000, /* R136 */
2003 0x0000, /* R137 */
2004 0x0000, /* R138 */
2005 0x0000, /* R139 */
2006 0x0310, /* R140 - GPIO Function Select 1 */
2007 0x0001, /* R141 - GPIO Function Select 2 */
2008 0x2300, /* R142 - GPIO Function Select 3 */
2009 0x0003, /* R143 - GPIO Function Select 4 */
2010 0x0000, /* R144 - Digitiser Control (1) */
2011 0x0002, /* R145 - Digitiser Control (2) */
2012 0x0000, /* R146 */
2013 0x0000, /* R147 */
2014 0x0000, /* R148 */
2015 0x0000, /* R149 */
2016 0x0000, /* R150 */
2017 0x0000, /* R151 */
2018 0x7000, /* R152 - AUX1 Readback */
2019 0x7000, /* R153 - AUX2 Readback */
2020 0x7000, /* R154 - AUX3 Readback */
2021 0x7000, /* R155 - AUX4 Readback */
2022 0x0000, /* R156 - USB Voltage Readback */
2023 0x0000, /* R157 - LINE Voltage Readback */
2024 0x0000, /* R158 - BATT Voltage Readback */
2025 0x0000, /* R159 - Chip Temp Readback */
2026 0x0000, /* R160 */
2027 0x0000, /* R161 */
2028 0x0000, /* R162 */
2029 0x0000, /* R163 - Generic Comparator Control */
2030 0x0000, /* R164 - Generic comparator 1 */
2031 0x0000, /* R165 - Generic comparator 2 */
2032 0x0000, /* R166 - Generic comparator 3 */
2033 0x0000, /* R167 - Generic comparator 4 */
2034 0xA00F, /* R168 - Battery Charger Control 1 */
2035 0x0B06, /* R169 - Battery Charger Control 2 */
2036 0x0000, /* R170 - Battery Charger Control 3 */
2037 0x0000, /* R171 */
2038 0x0000, /* R172 - Current Sink Driver A */
2039 0x0000, /* R173 - CSA Flash control */
2040 0x0000, /* R174 */
2041 0x0000, /* R175 */
2042 0x0000, /* R176 - DCDC/LDO requested */
2043 0x032D, /* R177 - DCDC Active options */
2044 0x0000, /* R178 - DCDC Sleep options */
2045 0x0025, /* R179 - Power-check comparator */
2046 0x000E, /* R180 - DCDC1 Control */
2047 0x0400, /* R181 - DCDC1 Timeouts */
2048 0x1006, /* R182 - DCDC1 Low Power */
2049 0x0018, /* R183 - DCDC2 Control */
2050 0x0000, /* R184 - DCDC2 Timeouts */
2051 0x0000, /* R185 */
2052 0x0026, /* R186 - DCDC3 Control */
2053 0x0800, /* R187 - DCDC3 Timeouts */
2054 0x0006, /* R188 - DCDC3 Low Power */
2055 0x0062, /* R189 - DCDC4 Control */
2056 0x1400, /* R190 - DCDC4 Timeouts */
2057 0x0006, /* R191 - DCDC4 Low Power */
2058 0x0008, /* R192 */
2059 0x0000, /* R193 */
2060 0x0000, /* R194 */
2061 0x0026, /* R195 */
2062 0x0400, /* R196 */
2063 0x0006, /* R197 */
2064 0x0000, /* R198 */
2065 0x0003, /* R199 - Limit Switch Control */
2066 0x0006, /* R200 - LDO1 Control */
2067 0x0C00, /* R201 - LDO1 Timeouts */
2068 0x001C, /* R202 - LDO1 Low Power */
2069 0x0016, /* R203 - LDO2 Control */
2070 0x0000, /* R204 - LDO2 Timeouts */
2071 0x001C, /* R205 - LDO2 Low Power */
2072 0x0019, /* R206 - LDO3 Control */
2073 0x0000, /* R207 - LDO3 Timeouts */
2074 0x001C, /* R208 - LDO3 Low Power */
2075 0x001A, /* R209 - LDO4 Control */
2076 0x1000, /* R210 - LDO4 Timeouts */
2077 0x001C, /* R211 - LDO4 Low Power */
2078 0x0000, /* R212 */
2079 0x0000, /* R213 */
2080 0x0000, /* R214 */
2081 0x0000, /* R215 - VCC_FAULT Masks */
2082 0x001F, /* R216 - Main Bandgap Control */
2083 0x0000, /* R217 - OSC Control */
2084 0x9000, /* R218 - RTC Tick Control */
2085 0x0000, /* R219 - Security1 */
2086 0x4000, /* R220 */
2087 0x0000, /* R221 */
2088 0x0000, /* R222 */
2089 0x0000, /* R223 */
2090 0x0000, /* R224 - Signal overrides */
2091 0x0000, /* R225 - DCDC/LDO status */
2092 0x0000, /* R226 - Charger Overides/status */
2093 0x0000, /* R227 - misc overrides */
2094 0x0000, /* R228 - Supply overrides/status 1 */
2095 0x0000, /* R229 - Supply overrides/status 2 */
2096 0xE000, /* R230 - GPIO Pin Status */
2097 0x0000, /* R231 - comparotor overrides */
2098 0x0000, /* R232 */
2099 0x0000, /* R233 - State Machine status */
2100 0x1200, /* R234 - FLL Test 1 */
2101 0x0000, /* R235 */
2102 0x8000, /* R236 */
2103 0x0000, /* R237 */
2104 0x0000, /* R238 */
2105 0x0000, /* R239 */
2106 0x0003, /* R240 */
2107 0x0000, /* R241 */
2108 0x0000, /* R242 */
2109 0x0004, /* R243 */
2110 0x0300, /* R244 */
2111 0x0000, /* R245 */
2112 0x0200, /* R246 */
2113 0x0000, /* R247 */
2114 0x1000, /* R248 - DCDC1 Test Controls */
2115 0x1000, /* R249 */
2116 0x1000, /* R250 - DCDC3 Test Controls */
2117 0x1000, /* R251 - DCDC4 Test Controls */
2118};
2119#endif
2120
2121#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0
2122
2123#undef WM8350_HAVE_CONFIG_MODE
2124#define WM8350_HAVE_CONFIG_MODE
2125
2126const u16 wm8352_mode0_defaults[] = {
2127 0x6143, /* R0 - Reset/ID */
2128 0x0000, /* R1 - ID */
2129 0x0002, /* R2 - Revision */
2130 0x1C02, /* R3 - System Control 1 */
2131 0x0004, /* R4 - System Control 2 */
2132 0x0000, /* R5 - System Hibernate */
2133 0x8A00, /* R6 - Interface Control */
2134 0x0000, /* R7 */
2135 0x8000, /* R8 - Power mgmt (1) */
2136 0x0000, /* R9 - Power mgmt (2) */
2137 0x0000, /* R10 - Power mgmt (3) */
2138 0x2000, /* R11 - Power mgmt (4) */
2139 0x0E00, /* R12 - Power mgmt (5) */
2140 0x0000, /* R13 - Power mgmt (6) */
2141 0x0000, /* R14 - Power mgmt (7) */
2142 0x0000, /* R15 */
2143 0x0000, /* R16 - RTC Seconds/Minutes */
2144 0x0100, /* R17 - RTC Hours/Day */
2145 0x0101, /* R18 - RTC Date/Month */
2146 0x1400, /* R19 - RTC Year */
2147 0x0000, /* R20 - Alarm Seconds/Minutes */
2148 0x0000, /* R21 - Alarm Hours/Day */
2149 0x0000, /* R22 - Alarm Date/Month */
2150 0x0320, /* R23 - RTC Time Control */
2151 0x0000, /* R24 - System Interrupts */
2152 0x0000, /* R25 - Interrupt Status 1 */
2153 0x0000, /* R26 - Interrupt Status 2 */
2154 0x0000, /* R27 */
2155 0x0000, /* R28 - Under Voltage Interrupt status */
2156 0x0000, /* R29 - Over Current Interrupt status */
2157 0x0000, /* R30 - GPIO Interrupt Status */
2158 0x0000, /* R31 - Comparator Interrupt Status */
2159 0x3FFF, /* R32 - System Interrupts Mask */
2160 0x0000, /* R33 - Interrupt Status 1 Mask */
2161 0x0000, /* R34 - Interrupt Status 2 Mask */
2162 0x0000, /* R35 */
2163 0x0000, /* R36 - Under Voltage Interrupt status Mask */
2164 0x0000, /* R37 - Over Current Interrupt status Mask */
2165 0x0000, /* R38 - GPIO Interrupt Status Mask */
2166 0x0000, /* R39 - Comparator Interrupt Status Mask */
2167 0x0040, /* R40 - Clock Control 1 */
2168 0x0000, /* R41 - Clock Control 2 */
2169 0x3A00, /* R42 - FLL Control 1 */
2170 0x7086, /* R43 - FLL Control 2 */
2171 0xC226, /* R44 - FLL Control 3 */
2172 0x0000, /* R45 - FLL Control 4 */
2173 0x0000, /* R46 */
2174 0x0000, /* R47 */
2175 0x0000, /* R48 - DAC Control */
2176 0x0000, /* R49 */
2177 0x00C0, /* R50 - DAC Digital Volume L */
2178 0x00C0, /* R51 - DAC Digital Volume R */
2179 0x0000, /* R52 */
2180 0x0040, /* R53 - DAC LR Rate */
2181 0x0000, /* R54 - DAC Clock Control */
2182 0x0000, /* R55 */
2183 0x0000, /* R56 */
2184 0x0000, /* R57 */
2185 0x4000, /* R58 - DAC Mute */
2186 0x0000, /* R59 - DAC Mute Volume */
2187 0x0000, /* R60 - DAC Side */
2188 0x0000, /* R61 */
2189 0x0000, /* R62 */
2190 0x0000, /* R63 */
2191 0x8000, /* R64 - ADC Control */
2192 0x0000, /* R65 */
2193 0x00C0, /* R66 - ADC Digital Volume L */
2194 0x00C0, /* R67 - ADC Digital Volume R */
2195 0x0000, /* R68 - ADC Divider */
2196 0x0000, /* R69 */
2197 0x0040, /* R70 - ADC LR Rate */
2198 0x0000, /* R71 */
2199 0x0303, /* R72 - Input Control */
2200 0x0000, /* R73 - IN3 Input Control */
2201 0x0000, /* R74 - Mic Bias Control */
2202 0x0000, /* R75 */
2203 0x0000, /* R76 - Output Control */
2204 0x0000, /* R77 - Jack Detect */
2205 0x0000, /* R78 - Anti Pop Control */
2206 0x0000, /* R79 */
2207 0x0040, /* R80 - Left Input Volume */
2208 0x0040, /* R81 - Right Input Volume */
2209 0x0000, /* R82 */
2210 0x0000, /* R83 */
2211 0x0000, /* R84 */
2212 0x0000, /* R85 */
2213 0x0000, /* R86 */
2214 0x0000, /* R87 */
2215 0x0800, /* R88 - Left Mixer Control */
2216 0x1000, /* R89 - Right Mixer Control */
2217 0x0000, /* R90 */
2218 0x0000, /* R91 */
2219 0x0000, /* R92 - OUT3 Mixer Control */
2220 0x0000, /* R93 - OUT4 Mixer Control */
2221 0x0000, /* R94 */
2222 0x0000, /* R95 */
2223 0x0000, /* R96 - Output Left Mixer Volume */
2224 0x0000, /* R97 - Output Right Mixer Volume */
2225 0x0000, /* R98 - Input Mixer Volume L */
2226 0x0000, /* R99 - Input Mixer Volume R */
2227 0x0000, /* R100 - Input Mixer Volume */
2228 0x0000, /* R101 */
2229 0x0000, /* R102 */
2230 0x0000, /* R103 */
2231 0x00E4, /* R104 - OUT1L Volume */
2232 0x00E4, /* R105 - OUT1R Volume */
2233 0x00E4, /* R106 - OUT2L Volume */
2234 0x02E4, /* R107 - OUT2R Volume */
2235 0x0000, /* R108 */
2236 0x0000, /* R109 */
2237 0x0000, /* R110 */
2238 0x0000, /* R111 - BEEP Volume */
2239 0x0A00, /* R112 - AI Formating */
2240 0x0000, /* R113 - ADC DAC COMP */
2241 0x0020, /* R114 - AI ADC Control */
2242 0x0020, /* R115 - AI DAC Control */
2243 0x0000, /* R116 */
2244 0x0000, /* R117 */
2245 0x0000, /* R118 */
2246 0x0000, /* R119 */
2247 0x0000, /* R120 */
2248 0x0000, /* R121 */
2249 0x0000, /* R122 */
2250 0x0000, /* R123 */
2251 0x0000, /* R124 */
2252 0x0000, /* R125 */
2253 0x0000, /* R126 */
2254 0x0000, /* R127 */
2255 0x1FFF, /* R128 - GPIO Debounce */
2256 0x0000, /* R129 - GPIO Pin pull up Control */
2257 0x0000, /* R130 - GPIO Pull down Control */
2258 0x0000, /* R131 - GPIO Interrupt Mode */
2259 0x0000, /* R132 */
2260 0x0000, /* R133 - GPIO Control */
2261 0x0FFC, /* R134 - GPIO Configuration (i/o) */
2262 0x0FFC, /* R135 - GPIO Pin Polarity / Type */
2263 0x0000, /* R136 */
2264 0x0000, /* R137 */
2265 0x0000, /* R138 */
2266 0x0000, /* R139 */
2267 0x0013, /* R140 - GPIO Function Select 1 */
2268 0x0000, /* R141 - GPIO Function Select 2 */
2269 0x0000, /* R142 - GPIO Function Select 3 */
2270 0x0003, /* R143 - GPIO Function Select 4 */
2271 0x0000, /* R144 - Digitiser Control (1) */
2272 0x0002, /* R145 - Digitiser Control (2) */
2273 0x0000, /* R146 */
2274 0x0000, /* R147 */
2275 0x0000, /* R148 */
2276 0x0000, /* R149 */
2277 0x0000, /* R150 */
2278 0x0000, /* R151 */
2279 0x7000, /* R152 - AUX1 Readback */
2280 0x7000, /* R153 - AUX2 Readback */
2281 0x7000, /* R154 - AUX3 Readback */
2282 0x7000, /* R155 - AUX4 Readback */
2283 0x0000, /* R156 - USB Voltage Readback */
2284 0x0000, /* R157 - LINE Voltage Readback */
2285 0x0000, /* R158 - BATT Voltage Readback */
2286 0x0000, /* R159 - Chip Temp Readback */
2287 0x0000, /* R160 */
2288 0x0000, /* R161 */
2289 0x0000, /* R162 */
2290 0x0000, /* R163 - Generic Comparator Control */
2291 0x0000, /* R164 - Generic comparator 1 */
2292 0x0000, /* R165 - Generic comparator 2 */
2293 0x0000, /* R166 - Generic comparator 3 */
2294 0x0000, /* R167 - Generic comparator 4 */
2295 0xA00F, /* R168 - Battery Charger Control 1 */
2296 0x0B06, /* R169 - Battery Charger Control 2 */
2297 0x0000, /* R170 - Battery Charger Control 3 */
2298 0x0000, /* R171 */
2299 0x0000, /* R172 - Current Sink Driver A */
2300 0x0000, /* R173 - CSA Flash control */
2301 0x0000, /* R174 - Current Sink Driver B */
2302 0x0000, /* R175 - CSB Flash control */
2303 0x0000, /* R176 - DCDC/LDO requested */
2304 0x032D, /* R177 - DCDC Active options */
2305 0x0000, /* R178 - DCDC Sleep options */
2306 0x0025, /* R179 - Power-check comparator */
2307 0x000E, /* R180 - DCDC1 Control */
2308 0x0000, /* R181 - DCDC1 Timeouts */
2309 0x1006, /* R182 - DCDC1 Low Power */
2310 0x0018, /* R183 - DCDC2 Control */
2311 0x0000, /* R184 - DCDC2 Timeouts */
2312 0x0000, /* R185 */
2313 0x0000, /* R186 - DCDC3 Control */
2314 0x0000, /* R187 - DCDC3 Timeouts */
2315 0x0006, /* R188 - DCDC3 Low Power */
2316 0x0000, /* R189 - DCDC4 Control */
2317 0x0000, /* R190 - DCDC4 Timeouts */
2318 0x0006, /* R191 - DCDC4 Low Power */
2319 0x0008, /* R192 - DCDC5 Control */
2320 0x0000, /* R193 - DCDC5 Timeouts */
2321 0x0000, /* R194 */
2322 0x0000, /* R195 - DCDC6 Control */
2323 0x0000, /* R196 - DCDC6 Timeouts */
2324 0x0006, /* R197 - DCDC6 Low Power */
2325 0x0000, /* R198 */
2326 0x0003, /* R199 - Limit Switch Control */
2327 0x001C, /* R200 - LDO1 Control */
2328 0x0000, /* R201 - LDO1 Timeouts */
2329 0x001C, /* R202 - LDO1 Low Power */
2330 0x001B, /* R203 - LDO2 Control */
2331 0x0000, /* R204 - LDO2 Timeouts */
2332 0x001C, /* R205 - LDO2 Low Power */
2333 0x001B, /* R206 - LDO3 Control */
2334 0x0000, /* R207 - LDO3 Timeouts */
2335 0x001C, /* R208 - LDO3 Low Power */
2336 0x001B, /* R209 - LDO4 Control */
2337 0x0000, /* R210 - LDO4 Timeouts */
2338 0x001C, /* R211 - LDO4 Low Power */
2339 0x0000, /* R212 */
2340 0x0000, /* R213 */
2341 0x0000, /* R214 */
2342 0x0000, /* R215 - VCC_FAULT Masks */
2343 0x001F, /* R216 - Main Bandgap Control */
2344 0x0000, /* R217 - OSC Control */
2345 0x9000, /* R218 - RTC Tick Control */
2346 0x0000, /* R219 - Security1 */
2347 0x4000, /* R220 */
2348 0x0000, /* R221 */
2349 0x0000, /* R222 */
2350 0x0000, /* R223 */
2351 0x0000, /* R224 - Signal overrides */
2352 0x0000, /* R225 - DCDC/LDO status */
2353 0x0000, /* R226 - Charger Overides/status */
2354 0x0000, /* R227 - misc overrides */
2355 0x0000, /* R228 - Supply overrides/status 1 */
2356 0x0000, /* R229 - Supply overrides/status 2 */
2357 0xE000, /* R230 - GPIO Pin Status */
2358 0x0000, /* R231 - comparotor overrides */
2359 0x0000, /* R232 */
2360 0x0000, /* R233 - State Machine status */
2361 0x1200, /* R234 */
2362 0x0000, /* R235 */
2363 0x8000, /* R236 */
2364 0x0000, /* R237 */
2365 0x0000, /* R238 */
2366 0x0000, /* R239 */
2367 0x0003, /* R240 */
2368 0x0000, /* R241 */
2369 0x0000, /* R242 */
2370 0x0004, /* R243 */
2371 0x0300, /* R244 */
2372 0x0000, /* R245 */
2373 0x0200, /* R246 */
2374 0x0000, /* R247 */
2375 0x1000, /* R248 - DCDC1 Test Controls */
2376 0x5000, /* R249 */
2377 0x1000, /* R250 - DCDC3 Test Controls */
2378 0x1000, /* R251 - DCDC4 Test Controls */
2379 0x5100, /* R252 */
2380 0x1000, /* R253 - DCDC6 Test Controls */
2381};
2382#endif
2383
2384#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1
2385
2386#undef WM8350_HAVE_CONFIG_MODE
2387#define WM8350_HAVE_CONFIG_MODE
2388
2389const u16 wm8352_mode1_defaults[] = {
2390 0x6143, /* R0 - Reset/ID */
2391 0x0000, /* R1 - ID */
2392 0x0002, /* R2 - Revision */
2393 0x1C02, /* R3 - System Control 1 */
2394 0x0204, /* R4 - System Control 2 */
2395 0x0000, /* R5 - System Hibernate */
2396 0x8A00, /* R6 - Interface Control */
2397 0x0000, /* R7 */
2398 0x8000, /* R8 - Power mgmt (1) */
2399 0x0000, /* R9 - Power mgmt (2) */
2400 0x0000, /* R10 - Power mgmt (3) */
2401 0x2000, /* R11 - Power mgmt (4) */
2402 0x0E00, /* R12 - Power mgmt (5) */
2403 0x0000, /* R13 - Power mgmt (6) */
2404 0x0000, /* R14 - Power mgmt (7) */
2405 0x0000, /* R15 */
2406 0x0000, /* R16 - RTC Seconds/Minutes */
2407 0x0100, /* R17 - RTC Hours/Day */
2408 0x0101, /* R18 - RTC Date/Month */
2409 0x1400, /* R19 - RTC Year */
2410 0x0000, /* R20 - Alarm Seconds/Minutes */
2411 0x0000, /* R21 - Alarm Hours/Day */
2412 0x0000, /* R22 - Alarm Date/Month */
2413 0x0320, /* R23 - RTC Time Control */
2414 0x0000, /* R24 - System Interrupts */
2415 0x0000, /* R25 - Interrupt Status 1 */
2416 0x0000, /* R26 - Interrupt Status 2 */
2417 0x0000, /* R27 */
2418 0x0000, /* R28 - Under Voltage Interrupt status */
2419 0x0000, /* R29 - Over Current Interrupt status */
2420 0x0000, /* R30 - GPIO Interrupt Status */
2421 0x0000, /* R31 - Comparator Interrupt Status */
2422 0x3FFF, /* R32 - System Interrupts Mask */
2423 0x0000, /* R33 - Interrupt Status 1 Mask */
2424 0x0000, /* R34 - Interrupt Status 2 Mask */
2425 0x0000, /* R35 */
2426 0x0000, /* R36 - Under Voltage Interrupt status Mask */
2427 0x0000, /* R37 - Over Current Interrupt status Mask */
2428 0x0000, /* R38 - GPIO Interrupt Status Mask */
2429 0x0000, /* R39 - Comparator Interrupt Status Mask */
2430 0x0040, /* R40 - Clock Control 1 */
2431 0x0000, /* R41 - Clock Control 2 */
2432 0x3A00, /* R42 - FLL Control 1 */
2433 0x7086, /* R43 - FLL Control 2 */
2434 0xC226, /* R44 - FLL Control 3 */
2435 0x0000, /* R45 - FLL Control 4 */
2436 0x0000, /* R46 */
2437 0x0000, /* R47 */
2438 0x0000, /* R48 - DAC Control */
2439 0x0000, /* R49 */
2440 0x00C0, /* R50 - DAC Digital Volume L */
2441 0x00C0, /* R51 - DAC Digital Volume R */
2442 0x0000, /* R52 */
2443 0x0040, /* R53 - DAC LR Rate */
2444 0x0000, /* R54 - DAC Clock Control */
2445 0x0000, /* R55 */
2446 0x0000, /* R56 */
2447 0x0000, /* R57 */
2448 0x4000, /* R58 - DAC Mute */
2449 0x0000, /* R59 - DAC Mute Volume */
2450 0x0000, /* R60 - DAC Side */
2451 0x0000, /* R61 */
2452 0x0000, /* R62 */
2453 0x0000, /* R63 */
2454 0x8000, /* R64 - ADC Control */
2455 0x0000, /* R65 */
2456 0x00C0, /* R66 - ADC Digital Volume L */
2457 0x00C0, /* R67 - ADC Digital Volume R */
2458 0x0000, /* R68 - ADC Divider */
2459 0x0000, /* R69 */
2460 0x0040, /* R70 - ADC LR Rate */
2461 0x0000, /* R71 */
2462 0x0303, /* R72 - Input Control */
2463 0x0000, /* R73 - IN3 Input Control */
2464 0x0000, /* R74 - Mic Bias Control */
2465 0x0000, /* R75 */
2466 0x0000, /* R76 - Output Control */
2467 0x0000, /* R77 - Jack Detect */
2468 0x0000, /* R78 - Anti Pop Control */
2469 0x0000, /* R79 */
2470 0x0040, /* R80 - Left Input Volume */
2471 0x0040, /* R81 - Right Input Volume */
2472 0x0000, /* R82 */
2473 0x0000, /* R83 */
2474 0x0000, /* R84 */
2475 0x0000, /* R85 */
2476 0x0000, /* R86 */
2477 0x0000, /* R87 */
2478 0x0800, /* R88 - Left Mixer Control */
2479 0x1000, /* R89 - Right Mixer Control */
2480 0x0000, /* R90 */
2481 0x0000, /* R91 */
2482 0x0000, /* R92 - OUT3 Mixer Control */
2483 0x0000, /* R93 - OUT4 Mixer Control */
2484 0x0000, /* R94 */
2485 0x0000, /* R95 */
2486 0x0000, /* R96 - Output Left Mixer Volume */
2487 0x0000, /* R97 - Output Right Mixer Volume */
2488 0x0000, /* R98 - Input Mixer Volume L */
2489 0x0000, /* R99 - Input Mixer Volume R */
2490 0x0000, /* R100 - Input Mixer Volume */
2491 0x0000, /* R101 */
2492 0x0000, /* R102 */
2493 0x0000, /* R103 */
2494 0x00E4, /* R104 - OUT1L Volume */
2495 0x00E4, /* R105 - OUT1R Volume */
2496 0x00E4, /* R106 - OUT2L Volume */
2497 0x02E4, /* R107 - OUT2R Volume */
2498 0x0000, /* R108 */
2499 0x0000, /* R109 */
2500 0x0000, /* R110 */
2501 0x0000, /* R111 - BEEP Volume */
2502 0x0A00, /* R112 - AI Formating */
2503 0x0000, /* R113 - ADC DAC COMP */
2504 0x0020, /* R114 - AI ADC Control */
2505 0x0020, /* R115 - AI DAC Control */
2506 0x0000, /* R116 */
2507 0x0000, /* R117 */
2508 0x0000, /* R118 */
2509 0x0000, /* R119 */
2510 0x0000, /* R120 */
2511 0x0000, /* R121 */
2512 0x0000, /* R122 */
2513 0x0000, /* R123 */
2514 0x0000, /* R124 */
2515 0x0000, /* R125 */
2516 0x0000, /* R126 */
2517 0x0000, /* R127 */
2518 0x1FFF, /* R128 - GPIO Debounce */
2519 0x0000, /* R129 - GPIO Pin pull up Control */
2520 0x0000, /* R130 - GPIO Pull down Control */
2521 0x0000, /* R131 - GPIO Interrupt Mode */
2522 0x0000, /* R132 */
2523 0x0000, /* R133 - GPIO Control */
2524 0x0BFB, /* R134 - GPIO Configuration (i/o) */
2525 0x0FFF, /* R135 - GPIO Pin Polarity / Type */
2526 0x0000, /* R136 */
2527 0x0000, /* R137 */
2528 0x0000, /* R138 */
2529 0x0000, /* R139 */
2530 0x0300, /* R140 - GPIO Function Select 1 */
2531 0x0000, /* R141 - GPIO Function Select 2 */
2532 0x2300, /* R142 - GPIO Function Select 3 */
2533 0x0003, /* R143 - GPIO Function Select 4 */
2534 0x0000, /* R144 - Digitiser Control (1) */
2535 0x0002, /* R145 - Digitiser Control (2) */
2536 0x0000, /* R146 */
2537 0x0000, /* R147 */
2538 0x0000, /* R148 */
2539 0x0000, /* R149 */
2540 0x0000, /* R150 */
2541 0x0000, /* R151 */
2542 0x7000, /* R152 - AUX1 Readback */
2543 0x7000, /* R153 - AUX2 Readback */
2544 0x7000, /* R154 - AUX3 Readback */
2545 0x7000, /* R155 - AUX4 Readback */
2546 0x0000, /* R156 - USB Voltage Readback */
2547 0x0000, /* R157 - LINE Voltage Readback */
2548 0x0000, /* R158 - BATT Voltage Readback */
2549 0x0000, /* R159 - Chip Temp Readback */
2550 0x0000, /* R160 */
2551 0x0000, /* R161 */
2552 0x0000, /* R162 */
2553 0x0000, /* R163 - Generic Comparator Control */
2554 0x0000, /* R164 - Generic comparator 1 */
2555 0x0000, /* R165 - Generic comparator 2 */
2556 0x0000, /* R166 - Generic comparator 3 */
2557 0x0000, /* R167 - Generic comparator 4 */
2558 0xA00F, /* R168 - Battery Charger Control 1 */
2559 0x0B06, /* R169 - Battery Charger Control 2 */
2560 0x0000, /* R170 - Battery Charger Control 3 */
2561 0x0000, /* R171 */
2562 0x0000, /* R172 - Current Sink Driver A */
2563 0x0000, /* R173 - CSA Flash control */
2564 0x0000, /* R174 - Current Sink Driver B */
2565 0x0000, /* R175 - CSB Flash control */
2566 0x0000, /* R176 - DCDC/LDO requested */
2567 0x032D, /* R177 - DCDC Active options */
2568 0x0000, /* R178 - DCDC Sleep options */
2569 0x0025, /* R179 - Power-check comparator */
2570 0x0062, /* R180 - DCDC1 Control */
2571 0x0400, /* R181 - DCDC1 Timeouts */
2572 0x1006, /* R182 - DCDC1 Low Power */
2573 0x0018, /* R183 - DCDC2 Control */
2574 0x0000, /* R184 - DCDC2 Timeouts */
2575 0x0000, /* R185 */
2576 0x0006, /* R186 - DCDC3 Control */
2577 0x0800, /* R187 - DCDC3 Timeouts */
2578 0x0006, /* R188 - DCDC3 Low Power */
2579 0x0006, /* R189 - DCDC4 Control */
2580 0x0C00, /* R190 - DCDC4 Timeouts */
2581 0x0006, /* R191 - DCDC4 Low Power */
2582 0x0008, /* R192 - DCDC5 Control */
2583 0x0000, /* R193 - DCDC5 Timeouts */
2584 0x0000, /* R194 */
2585 0x0026, /* R195 - DCDC6 Control */
2586 0x1000, /* R196 - DCDC6 Timeouts */
2587 0x0006, /* R197 - DCDC6 Low Power */
2588 0x0000, /* R198 */
2589 0x0003, /* R199 - Limit Switch Control */
2590 0x0002, /* R200 - LDO1 Control */
2591 0x0000, /* R201 - LDO1 Timeouts */
2592 0x001C, /* R202 - LDO1 Low Power */
2593 0x001A, /* R203 - LDO2 Control */
2594 0x0000, /* R204 - LDO2 Timeouts */
2595 0x001C, /* R205 - LDO2 Low Power */
2596 0x001F, /* R206 - LDO3 Control */
2597 0x0000, /* R207 - LDO3 Timeouts */
2598 0x001C, /* R208 - LDO3 Low Power */
2599 0x001F, /* R209 - LDO4 Control */
2600 0x0000, /* R210 - LDO4 Timeouts */
2601 0x001C, /* R211 - LDO4 Low Power */
2602 0x0000, /* R212 */
2603 0x0000, /* R213 */
2604 0x0000, /* R214 */
2605 0x0000, /* R215 - VCC_FAULT Masks */
2606 0x001F, /* R216 - Main Bandgap Control */
2607 0x0000, /* R217 - OSC Control */
2608 0x9000, /* R218 - RTC Tick Control */
2609 0x0000, /* R219 - Security1 */
2610 0x4000, /* R220 */
2611 0x0000, /* R221 */
2612 0x0000, /* R222 */
2613 0x0000, /* R223 */
2614 0x0000, /* R224 - Signal overrides */
2615 0x0000, /* R225 - DCDC/LDO status */
2616 0x0000, /* R226 - Charger Overides/status */
2617 0x0000, /* R227 - misc overrides */
2618 0x0000, /* R228 - Supply overrides/status 1 */
2619 0x0000, /* R229 - Supply overrides/status 2 */
2620 0xE000, /* R230 - GPIO Pin Status */
2621 0x0000, /* R231 - comparotor overrides */
2622 0x0000, /* R232 */
2623 0x0000, /* R233 - State Machine status */
2624 0x1200, /* R234 */
2625 0x0000, /* R235 */
2626 0x8000, /* R236 */
2627 0x0000, /* R237 */
2628 0x0000, /* R238 */
2629 0x0000, /* R239 */
2630 0x0003, /* R240 */
2631 0x0000, /* R241 */
2632 0x0000, /* R242 */
2633 0x0004, /* R243 */
2634 0x0300, /* R244 */
2635 0x0000, /* R245 */
2636 0x0200, /* R246 */
2637 0x0000, /* R247 */
2638 0x1000, /* R248 - DCDC1 Test Controls */
2639 0x5000, /* R249 */
2640 0x1000, /* R250 - DCDC3 Test Controls */
2641 0x1000, /* R251 - DCDC4 Test Controls */
2642 0x5100, /* R252 */
2643 0x1000, /* R253 - DCDC6 Test Controls */
2644};
2645#endif
2646
2647#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2
2648
2649#undef WM8350_HAVE_CONFIG_MODE
2650#define WM8350_HAVE_CONFIG_MODE
2651
2652const u16 wm8352_mode2_defaults[] = {
2653 0x6143, /* R0 - Reset/ID */
2654 0x0000, /* R1 - ID */
2655 0x0002, /* R2 - Revision */
2656 0x1C02, /* R3 - System Control 1 */
2657 0x0204, /* R4 - System Control 2 */
2658 0x0000, /* R5 - System Hibernate */
2659 0x8A00, /* R6 - Interface Control */
2660 0x0000, /* R7 */
2661 0x8000, /* R8 - Power mgmt (1) */
2662 0x0000, /* R9 - Power mgmt (2) */
2663 0x0000, /* R10 - Power mgmt (3) */
2664 0x2000, /* R11 - Power mgmt (4) */
2665 0x0E00, /* R12 - Power mgmt (5) */
2666 0x0000, /* R13 - Power mgmt (6) */
2667 0x0000, /* R14 - Power mgmt (7) */
2668 0x0000, /* R15 */
2669 0x0000, /* R16 - RTC Seconds/Minutes */
2670 0x0100, /* R17 - RTC Hours/Day */
2671 0x0101, /* R18 - RTC Date/Month */
2672 0x1400, /* R19 - RTC Year */
2673 0x0000, /* R20 - Alarm Seconds/Minutes */
2674 0x0000, /* R21 - Alarm Hours/Day */
2675 0x0000, /* R22 - Alarm Date/Month */
2676 0x0320, /* R23 - RTC Time Control */
2677 0x0000, /* R24 - System Interrupts */
2678 0x0000, /* R25 - Interrupt Status 1 */
2679 0x0000, /* R26 - Interrupt Status 2 */
2680 0x0000, /* R27 */
2681 0x0000, /* R28 - Under Voltage Interrupt status */
2682 0x0000, /* R29 - Over Current Interrupt status */
2683 0x0000, /* R30 - GPIO Interrupt Status */
2684 0x0000, /* R31 - Comparator Interrupt Status */
2685 0x3FFF, /* R32 - System Interrupts Mask */
2686 0x0000, /* R33 - Interrupt Status 1 Mask */
2687 0x0000, /* R34 - Interrupt Status 2 Mask */
2688 0x0000, /* R35 */
2689 0x0000, /* R36 - Under Voltage Interrupt status Mask */
2690 0x0000, /* R37 - Over Current Interrupt status Mask */
2691 0x0000, /* R38 - GPIO Interrupt Status Mask */
2692 0x0000, /* R39 - Comparator Interrupt Status Mask */
2693 0x0040, /* R40 - Clock Control 1 */
2694 0x0000, /* R41 - Clock Control 2 */
2695 0x3A00, /* R42 - FLL Control 1 */
2696 0x7086, /* R43 - FLL Control 2 */
2697 0xC226, /* R44 - FLL Control 3 */
2698 0x0000, /* R45 - FLL Control 4 */
2699 0x0000, /* R46 */
2700 0x0000, /* R47 */
2701 0x0000, /* R48 - DAC Control */
2702 0x0000, /* R49 */
2703 0x00C0, /* R50 - DAC Digital Volume L */
2704 0x00C0, /* R51 - DAC Digital Volume R */
2705 0x0000, /* R52 */
2706 0x0040, /* R53 - DAC LR Rate */
2707 0x0000, /* R54 - DAC Clock Control */
2708 0x0000, /* R55 */
2709 0x0000, /* R56 */
2710 0x0000, /* R57 */
2711 0x4000, /* R58 - DAC Mute */
2712 0x0000, /* R59 - DAC Mute Volume */
2713 0x0000, /* R60 - DAC Side */
2714 0x0000, /* R61 */
2715 0x0000, /* R62 */
2716 0x0000, /* R63 */
2717 0x8000, /* R64 - ADC Control */
2718 0x0000, /* R65 */
2719 0x00C0, /* R66 - ADC Digital Volume L */
2720 0x00C0, /* R67 - ADC Digital Volume R */
2721 0x0000, /* R68 - ADC Divider */
2722 0x0000, /* R69 */
2723 0x0040, /* R70 - ADC LR Rate */
2724 0x0000, /* R71 */
2725 0x0303, /* R72 - Input Control */
2726 0x0000, /* R73 - IN3 Input Control */
2727 0x0000, /* R74 - Mic Bias Control */
2728 0x0000, /* R75 */
2729 0x0000, /* R76 - Output Control */
2730 0x0000, /* R77 - Jack Detect */
2731 0x0000, /* R78 - Anti Pop Control */
2732 0x0000, /* R79 */
2733 0x0040, /* R80 - Left Input Volume */
2734 0x0040, /* R81 - Right Input Volume */
2735 0x0000, /* R82 */
2736 0x0000, /* R83 */
2737 0x0000, /* R84 */
2738 0x0000, /* R85 */
2739 0x0000, /* R86 */
2740 0x0000, /* R87 */
2741 0x0800, /* R88 - Left Mixer Control */
2742 0x1000, /* R89 - Right Mixer Control */
2743 0x0000, /* R90 */
2744 0x0000, /* R91 */
2745 0x0000, /* R92 - OUT3 Mixer Control */
2746 0x0000, /* R93 - OUT4 Mixer Control */
2747 0x0000, /* R94 */
2748 0x0000, /* R95 */
2749 0x0000, /* R96 - Output Left Mixer Volume */
2750 0x0000, /* R97 - Output Right Mixer Volume */
2751 0x0000, /* R98 - Input Mixer Volume L */
2752 0x0000, /* R99 - Input Mixer Volume R */
2753 0x0000, /* R100 - Input Mixer Volume */
2754 0x0000, /* R101 */
2755 0x0000, /* R102 */
2756 0x0000, /* R103 */
2757 0x00E4, /* R104 - OUT1L Volume */
2758 0x00E4, /* R105 - OUT1R Volume */
2759 0x00E4, /* R106 - OUT2L Volume */
2760 0x02E4, /* R107 - OUT2R Volume */
2761 0x0000, /* R108 */
2762 0x0000, /* R109 */
2763 0x0000, /* R110 */
2764 0x0000, /* R111 - BEEP Volume */
2765 0x0A00, /* R112 - AI Formating */
2766 0x0000, /* R113 - ADC DAC COMP */
2767 0x0020, /* R114 - AI ADC Control */
2768 0x0020, /* R115 - AI DAC Control */
2769 0x0000, /* R116 */
2770 0x0000, /* R117 */
2771 0x0000, /* R118 */
2772 0x0000, /* R119 */
2773 0x0000, /* R120 */
2774 0x0000, /* R121 */
2775 0x0000, /* R122 */
2776 0x0000, /* R123 */
2777 0x0000, /* R124 */
2778 0x0000, /* R125 */
2779 0x0000, /* R126 */
2780 0x0000, /* R127 */
2781 0x1FFF, /* R128 - GPIO Debounce */
2782 0x0000, /* R129 - GPIO Pin pull up Control */
2783 0x0110, /* R130 - GPIO Pull down Control */
2784 0x0000, /* R131 - GPIO Interrupt Mode */
2785 0x0000, /* R132 */
2786 0x0000, /* R133 - GPIO Control */
2787 0x09DA, /* R134 - GPIO Configuration (i/o) */
2788 0x0DD6, /* R135 - GPIO Pin Polarity / Type */
2789 0x0000, /* R136 */
2790 0x0000, /* R137 */
2791 0x0000, /* R138 */
2792 0x0000, /* R139 */
2793 0x1310, /* R140 - GPIO Function Select 1 */
2794 0x0033, /* R141 - GPIO Function Select 2 */
2795 0x2000, /* R142 - GPIO Function Select 3 */
2796 0x0000, /* R143 - GPIO Function Select 4 */
2797 0x0000, /* R144 - Digitiser Control (1) */
2798 0x0002, /* R145 - Digitiser Control (2) */
2799 0x0000, /* R146 */
2800 0x0000, /* R147 */
2801 0x0000, /* R148 */
2802 0x0000, /* R149 */
2803 0x0000, /* R150 */
2804 0x0000, /* R151 */
2805 0x7000, /* R152 - AUX1 Readback */
2806 0x7000, /* R153 - AUX2 Readback */
2807 0x7000, /* R154 - AUX3 Readback */
2808 0x7000, /* R155 - AUX4 Readback */
2809 0x0000, /* R156 - USB Voltage Readback */
2810 0x0000, /* R157 - LINE Voltage Readback */
2811 0x0000, /* R158 - BATT Voltage Readback */
2812 0x0000, /* R159 - Chip Temp Readback */
2813 0x0000, /* R160 */
2814 0x0000, /* R161 */
2815 0x0000, /* R162 */
2816 0x0000, /* R163 - Generic Comparator Control */
2817 0x0000, /* R164 - Generic comparator 1 */
2818 0x0000, /* R165 - Generic comparator 2 */
2819 0x0000, /* R166 - Generic comparator 3 */
2820 0x0000, /* R167 - Generic comparator 4 */
2821 0xA00F, /* R168 - Battery Charger Control 1 */
2822 0x0B06, /* R169 - Battery Charger Control 2 */
2823 0x0000, /* R170 - Battery Charger Control 3 */
2824 0x0000, /* R171 */
2825 0x0000, /* R172 - Current Sink Driver A */
2826 0x0000, /* R173 - CSA Flash control */
2827 0x0000, /* R174 - Current Sink Driver B */
2828 0x0000, /* R175 - CSB Flash control */
2829 0x0000, /* R176 - DCDC/LDO requested */
2830 0x032D, /* R177 - DCDC Active options */
2831 0x0000, /* R178 - DCDC Sleep options */
2832 0x0025, /* R179 - Power-check comparator */
2833 0x000E, /* R180 - DCDC1 Control */
2834 0x0800, /* R181 - DCDC1 Timeouts */
2835 0x1006, /* R182 - DCDC1 Low Power */
2836 0x0018, /* R183 - DCDC2 Control */
2837 0x0000, /* R184 - DCDC2 Timeouts */
2838 0x0000, /* R185 */
2839 0x0056, /* R186 - DCDC3 Control */
2840 0x1800, /* R187 - DCDC3 Timeouts */
2841 0x0006, /* R188 - DCDC3 Low Power */
2842 0x000E, /* R189 - DCDC4 Control */
2843 0x1000, /* R190 - DCDC4 Timeouts */
2844 0x0006, /* R191 - DCDC4 Low Power */
2845 0x0008, /* R192 - DCDC5 Control */
2846 0x0000, /* R193 - DCDC5 Timeouts */
2847 0x0000, /* R194 */
2848 0x0026, /* R195 - DCDC6 Control */
2849 0x0C00, /* R196 - DCDC6 Timeouts */
2850 0x0006, /* R197 - DCDC6 Low Power */
2851 0x0000, /* R198 */
2852 0x0003, /* R199 - Limit Switch Control */
2853 0x001C, /* R200 - LDO1 Control */
2854 0x0000, /* R201 - LDO1 Timeouts */
2855 0x001C, /* R202 - LDO1 Low Power */
2856 0x0006, /* R203 - LDO2 Control */
2857 0x0400, /* R204 - LDO2 Timeouts */
2858 0x001C, /* R205 - LDO2 Low Power */
2859 0x001C, /* R206 - LDO3 Control */
2860 0x1400, /* R207 - LDO3 Timeouts */
2861 0x001C, /* R208 - LDO3 Low Power */
2862 0x001A, /* R209 - LDO4 Control */
2863 0x0000, /* R210 - LDO4 Timeouts */
2864 0x001C, /* R211 - LDO4 Low Power */
2865 0x0000, /* R212 */
2866 0x0000, /* R213 */
2867 0x0000, /* R214 */
2868 0x0000, /* R215 - VCC_FAULT Masks */
2869 0x001F, /* R216 - Main Bandgap Control */
2870 0x0000, /* R217 - OSC Control */
2871 0x9000, /* R218 - RTC Tick Control */
2872 0x0000, /* R219 - Security1 */
2873 0x4000, /* R220 */
2874 0x0000, /* R221 */
2875 0x0000, /* R222 */
2876 0x0000, /* R223 */
2877 0x0000, /* R224 - Signal overrides */
2878 0x0000, /* R225 - DCDC/LDO status */
2879 0x0000, /* R226 - Charger Overides/status */
2880 0x0000, /* R227 - misc overrides */
2881 0x0000, /* R228 - Supply overrides/status 1 */
2882 0x0000, /* R229 - Supply overrides/status 2 */
2883 0xE000, /* R230 - GPIO Pin Status */
2884 0x0000, /* R231 - comparotor overrides */
2885 0x0000, /* R232 */
2886 0x0000, /* R233 - State Machine status */
2887 0x1200, /* R234 */
2888 0x0000, /* R235 */
2889 0x8000, /* R236 */
2890 0x0000, /* R237 */
2891 0x0000, /* R238 */
2892 0x0000, /* R239 */
2893 0x0003, /* R240 */
2894 0x0000, /* R241 */
2895 0x0000, /* R242 */
2896 0x0004, /* R243 */
2897 0x0300, /* R244 */
2898 0x0000, /* R245 */
2899 0x0200, /* R246 */
2900 0x0000, /* R247 */
2901 0x1000, /* R248 - DCDC1 Test Controls */
2902 0x5000, /* R249 */
2903 0x1000, /* R250 - DCDC3 Test Controls */
2904 0x1000, /* R251 - DCDC4 Test Controls */
2905 0x5100, /* R252 */
2906 0x1000, /* R253 - DCDC6 Test Controls */
2907};
2908#endif
2909
2910#ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3
2911
2912#undef WM8350_HAVE_CONFIG_MODE
2913#define WM8350_HAVE_CONFIG_MODE
2914
2915const u16 wm8352_mode3_defaults[] = {
2916 0x6143, /* R0 - Reset/ID */
2917 0x0000, /* R1 - ID */
2918 0x0002, /* R2 - Revision */
2919 0x1C02, /* R3 - System Control 1 */
2920 0x0204, /* R4 - System Control 2 */
2921 0x0000, /* R5 - System Hibernate */
2922 0x8A00, /* R6 - Interface Control */
2923 0x0000, /* R7 */
2924 0x8000, /* R8 - Power mgmt (1) */
2925 0x0000, /* R9 - Power mgmt (2) */
2926 0x0000, /* R10 - Power mgmt (3) */
2927 0x2000, /* R11 - Power mgmt (4) */
2928 0x0E00, /* R12 - Power mgmt (5) */
2929 0x0000, /* R13 - Power mgmt (6) */
2930 0x0000, /* R14 - Power mgmt (7) */
2931 0x0000, /* R15 */
2932 0x0000, /* R16 - RTC Seconds/Minutes */
2933 0x0100, /* R17 - RTC Hours/Day */
2934 0x0101, /* R18 - RTC Date/Month */
2935 0x1400, /* R19 - RTC Year */
2936 0x0000, /* R20 - Alarm Seconds/Minutes */
2937 0x0000, /* R21 - Alarm Hours/Day */
2938 0x0000, /* R22 - Alarm Date/Month */
2939 0x0320, /* R23 - RTC Time Control */
2940 0x0000, /* R24 - System Interrupts */
2941 0x0000, /* R25 - Interrupt Status 1 */
2942 0x0000, /* R26 - Interrupt Status 2 */
2943 0x0000, /* R27 */
2944 0x0000, /* R28 - Under Voltage Interrupt status */
2945 0x0000, /* R29 - Over Current Interrupt status */
2946 0x0000, /* R30 - GPIO Interrupt Status */
2947 0x0000, /* R31 - Comparator Interrupt Status */
2948 0x3FFF, /* R32 - System Interrupts Mask */
2949 0x0000, /* R33 - Interrupt Status 1 Mask */
2950 0x0000, /* R34 - Interrupt Status 2 Mask */
2951 0x0000, /* R35 */
2952 0x0000, /* R36 - Under Voltage Interrupt status Mask */
2953 0x0000, /* R37 - Over Current Interrupt status Mask */
2954 0x0000, /* R38 - GPIO Interrupt Status Mask */
2955 0x0000, /* R39 - Comparator Interrupt Status Mask */
2956 0x0040, /* R40 - Clock Control 1 */
2957 0x0000, /* R41 - Clock Control 2 */
2958 0x3A00, /* R42 - FLL Control 1 */
2959 0x7086, /* R43 - FLL Control 2 */
2960 0xC226, /* R44 - FLL Control 3 */
2961 0x0000, /* R45 - FLL Control 4 */
2962 0x0000, /* R46 */
2963 0x0000, /* R47 */
2964 0x0000, /* R48 - DAC Control */
2965 0x0000, /* R49 */
2966 0x00C0, /* R50 - DAC Digital Volume L */
2967 0x00C0, /* R51 - DAC Digital Volume R */
2968 0x0000, /* R52 */
2969 0x0040, /* R53 - DAC LR Rate */
2970 0x0000, /* R54 - DAC Clock Control */
2971 0x0000, /* R55 */
2972 0x0000, /* R56 */
2973 0x0000, /* R57 */
2974 0x4000, /* R58 - DAC Mute */
2975 0x0000, /* R59 - DAC Mute Volume */
2976 0x0000, /* R60 - DAC Side */
2977 0x0000, /* R61 */
2978 0x0000, /* R62 */
2979 0x0000, /* R63 */
2980 0x8000, /* R64 - ADC Control */
2981 0x0000, /* R65 */
2982 0x00C0, /* R66 - ADC Digital Volume L */
2983 0x00C0, /* R67 - ADC Digital Volume R */
2984 0x0000, /* R68 - ADC Divider */
2985 0x0000, /* R69 */
2986 0x0040, /* R70 - ADC LR Rate */
2987 0x0000, /* R71 */
2988 0x0303, /* R72 - Input Control */
2989 0x0000, /* R73 - IN3 Input Control */
2990 0x0000, /* R74 - Mic Bias Control */
2991 0x0000, /* R75 */
2992 0x0000, /* R76 - Output Control */
2993 0x0000, /* R77 - Jack Detect */
2994 0x0000, /* R78 - Anti Pop Control */
2995 0x0000, /* R79 */
2996 0x0040, /* R80 - Left Input Volume */
2997 0x0040, /* R81 - Right Input Volume */
2998 0x0000, /* R82 */
2999 0x0000, /* R83 */
3000 0x0000, /* R84 */
3001 0x0000, /* R85 */
3002 0x0000, /* R86 */
3003 0x0000, /* R87 */
3004 0x0800, /* R88 - Left Mixer Control */
3005 0x1000, /* R89 - Right Mixer Control */
3006 0x0000, /* R90 */
3007 0x0000, /* R91 */
3008 0x0000, /* R92 - OUT3 Mixer Control */
3009 0x0000, /* R93 - OUT4 Mixer Control */
3010 0x0000, /* R94 */
3011 0x0000, /* R95 */
3012 0x0000, /* R96 - Output Left Mixer Volume */
3013 0x0000, /* R97 - Output Right Mixer Volume */
3014 0x0000, /* R98 - Input Mixer Volume L */
3015 0x0000, /* R99 - Input Mixer Volume R */
3016 0x0000, /* R100 - Input Mixer Volume */
3017 0x0000, /* R101 */
3018 0x0000, /* R102 */
3019 0x0000, /* R103 */
3020 0x00E4, /* R104 - OUT1L Volume */
3021 0x00E4, /* R105 - OUT1R Volume */
3022 0x00E4, /* R106 - OUT2L Volume */
3023 0x02E4, /* R107 - OUT2R Volume */
3024 0x0000, /* R108 */
3025 0x0000, /* R109 */
3026 0x0000, /* R110 */
3027 0x0000, /* R111 - BEEP Volume */
3028 0x0A00, /* R112 - AI Formating */
3029 0x0000, /* R113 - ADC DAC COMP */
3030 0x0020, /* R114 - AI ADC Control */
3031 0x0020, /* R115 - AI DAC Control */
3032 0x0000, /* R116 */
3033 0x0000, /* R117 */
3034 0x0000, /* R118 */
3035 0x0000, /* R119 */
3036 0x0000, /* R120 */
3037 0x0000, /* R121 */
3038 0x0000, /* R122 */
3039 0x0000, /* R123 */
3040 0x0000, /* R124 */
3041 0x0000, /* R125 */
3042 0x0000, /* R126 */
3043 0x0000, /* R127 */
3044 0x1FFF, /* R128 - GPIO Debounce */
3045 0x0010, /* R129 - GPIO Pin pull up Control */
3046 0x0000, /* R130 - GPIO Pull down Control */
3047 0x0000, /* R131 - GPIO Interrupt Mode */
3048 0x0000, /* R132 */
3049 0x0000, /* R133 - GPIO Control */
3050 0x0BFB, /* R134 - GPIO Configuration (i/o) */
3051 0x0FFD, /* R135 - GPIO Pin Polarity / Type */
3052 0x0000, /* R136 */
3053 0x0000, /* R137 */
3054 0x0000, /* R138 */
3055 0x0000, /* R139 */
3056 0x0310, /* R140 - GPIO Function Select 1 */
3057 0x0001, /* R141 - GPIO Function Select 2 */
3058 0x2300, /* R142 - GPIO Function Select 3 */
3059 0x0003, /* R143 - GPIO Function Select 4 */
3060 0x0000, /* R144 - Digitiser Control (1) */
3061 0x0002, /* R145 - Digitiser Control (2) */
3062 0x0000, /* R146 */
3063 0x0000, /* R147 */
3064 0x0000, /* R148 */
3065 0x0000, /* R149 */
3066 0x0000, /* R150 */
3067 0x0000, /* R151 */
3068 0x7000, /* R152 - AUX1 Readback */
3069 0x7000, /* R153 - AUX2 Readback */
3070 0x7000, /* R154 - AUX3 Readback */
3071 0x7000, /* R155 - AUX4 Readback */
3072 0x0000, /* R156 - USB Voltage Readback */
3073 0x0000, /* R157 - LINE Voltage Readback */
3074 0x0000, /* R158 - BATT Voltage Readback */
3075 0x0000, /* R159 - Chip Temp Readback */
3076 0x0000, /* R160 */
3077 0x0000, /* R161 */
3078 0x0000, /* R162 */
3079 0x0000, /* R163 - Generic Comparator Control */
3080 0x0000, /* R164 - Generic comparator 1 */
3081 0x0000, /* R165 - Generic comparator 2 */
3082 0x0000, /* R166 - Generic comparator 3 */
3083 0x0000, /* R167 - Generic comparator 4 */
3084 0xA00F, /* R168 - Battery Charger Control 1 */
3085 0x0B06, /* R169 - Battery Charger Control 2 */
3086 0x0000, /* R170 - Battery Charger Control 3 */
3087 0x0000, /* R171 */
3088 0x0000, /* R172 - Current Sink Driver A */
3089 0x0000, /* R173 - CSA Flash control */
3090 0x0000, /* R174 - Current Sink Driver B */
3091 0x0000, /* R175 - CSB Flash control */
3092 0x0000, /* R176 - DCDC/LDO requested */
3093 0x032D, /* R177 - DCDC Active options */
3094 0x0000, /* R178 - DCDC Sleep options */
3095 0x0025, /* R179 - Power-check comparator */
3096 0x0006, /* R180 - DCDC1 Control */
3097 0x0400, /* R181 - DCDC1 Timeouts */
3098 0x1006, /* R182 - DCDC1 Low Power */
3099 0x0018, /* R183 - DCDC2 Control */
3100 0x0000, /* R184 - DCDC2 Timeouts */
3101 0x0000, /* R185 */
3102 0x0050, /* R186 - DCDC3 Control */
3103 0x0C00, /* R187 - DCDC3 Timeouts */
3104 0x0006, /* R188 - DCDC3 Low Power */
3105 0x000E, /* R189 - DCDC4 Control */
3106 0x0400, /* R190 - DCDC4 Timeouts */
3107 0x0006, /* R191 - DCDC4 Low Power */
3108 0x0008, /* R192 - DCDC5 Control */
3109 0x0000, /* R193 - DCDC5 Timeouts */
3110 0x0000, /* R194 */
3111 0x0029, /* R195 - DCDC6 Control */
3112 0x0800, /* R196 - DCDC6 Timeouts */
3113 0x0006, /* R197 - DCDC6 Low Power */
3114 0x0000, /* R198 */
3115 0x0003, /* R199 - Limit Switch Control */
3116 0x001D, /* R200 - LDO1 Control */
3117 0x1000, /* R201 - LDO1 Timeouts */
3118 0x001C, /* R202 - LDO1 Low Power */
3119 0x0017, /* R203 - LDO2 Control */
3120 0x1000, /* R204 - LDO2 Timeouts */
3121 0x001C, /* R205 - LDO2 Low Power */
3122 0x0006, /* R206 - LDO3 Control */
3123 0x1000, /* R207 - LDO3 Timeouts */
3124 0x001C, /* R208 - LDO3 Low Power */
3125 0x0010, /* R209 - LDO4 Control */
3126 0x1000, /* R210 - LDO4 Timeouts */
3127 0x001C, /* R211 - LDO4 Low Power */
3128 0x0000, /* R212 */
3129 0x0000, /* R213 */
3130 0x0000, /* R214 */
3131 0x0000, /* R215 - VCC_FAULT Masks */
3132 0x001F, /* R216 - Main Bandgap Control */
3133 0x0000, /* R217 - OSC Control */
3134 0x9000, /* R218 - RTC Tick Control */
3135 0x0000, /* R219 - Security1 */
3136 0x4000, /* R220 */
3137 0x0000, /* R221 */
3138 0x0000, /* R222 */
3139 0x0000, /* R223 */
3140 0x0000, /* R224 - Signal overrides */
3141 0x0000, /* R225 - DCDC/LDO status */
3142 0x0000, /* R226 - Charger Overides/status */
3143 0x0000, /* R227 - misc overrides */
3144 0x0000, /* R228 - Supply overrides/status 1 */
3145 0x0000, /* R229 - Supply overrides/status 2 */
3146 0xE000, /* R230 - GPIO Pin Status */
3147 0x0000, /* R231 - comparotor overrides */
3148 0x0000, /* R232 */
3149 0x0000, /* R233 - State Machine status */
3150 0x1200, /* R234 */
3151 0x0000, /* R235 */
3152 0x8000, /* R236 */
3153 0x0000, /* R237 */
3154 0x0000, /* R238 */
3155 0x0000, /* R239 */
3156 0x0003, /* R240 */
3157 0x0000, /* R241 */
3158 0x0000, /* R242 */
3159 0x0004, /* R243 */
3160 0x0300, /* R244 */
3161 0x0000, /* R245 */
3162 0x0200, /* R246 */
3163 0x0000, /* R247 */
3164 0x1000, /* R248 - DCDC1 Test Controls */
3165 0x5000, /* R249 */
3166 0x1000, /* R250 - DCDC3 Test Controls */
3167 0x1000, /* R251 - DCDC4 Test Controls */
3168 0x5100, /* R252 */
3169 0x1000, /* R253 - DCDC6 Test Controls */
3170};
3171#endif
3172
1077/* The register defaults for the config mode used must be compiled in but 3173/* The register defaults for the config mode used must be compiled in but
1078 * due to the impact on kernel size it is possible to disable 3174 * due to the impact on kernel size it is possible to disable
1079 */ 3175 */
@@ -1307,14 +3403,14 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
1307 { 0xFF3F, 0xE03F, 0x0000 }, /* R216 - Main Bandgap Control */ 3403 { 0xFF3F, 0xE03F, 0x0000 }, /* R216 - Main Bandgap Control */
1308 { 0xEF2F, 0xE02F, 0x0000 }, /* R217 - OSC Control */ 3404 { 0xEF2F, 0xE02F, 0x0000 }, /* R217 - OSC Control */
1309 { 0xF3FF, 0xB3FF, 0xc000 }, /* R218 - RTC Tick Control */ 3405 { 0xF3FF, 0xB3FF, 0xc000 }, /* R218 - RTC Tick Control */
1310 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R219 */ 3406 { 0xFFFF, 0xFFFF, 0x0000 }, /* R219 - Security */
1311 { 0x09FF, 0x01FF, 0x0000 }, /* R220 - RAM BIST 1 */ 3407 { 0x09FF, 0x01FF, 0x0000 }, /* R220 - RAM BIST 1 */
1312 { 0x0000, 0x0000, 0x0000 }, /* R221 */ 3408 { 0x0000, 0x0000, 0x0000 }, /* R221 */
1313 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R222 */ 3409 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R222 */
1314 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R223 */ 3410 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R223 */
1315 { 0x0000, 0x0000, 0x0000 }, /* R224 */ 3411 { 0x0000, 0x0000, 0x0000 }, /* R224 */
1316 { 0x8F3F, 0x0000, 0xFFFF }, /* R225 - DCDC/LDO status */ 3412 { 0x8F3F, 0x0000, 0xFFFF }, /* R225 - DCDC/LDO status */
1317 { 0x0000, 0x0000, 0x0000 }, /* R226 */ 3413 { 0x0000, 0x0000, 0xFFFF }, /* R226 - Charger status */
1318 { 0x0000, 0x0000, 0xFFFF }, /* R227 */ 3414 { 0x0000, 0x0000, 0xFFFF }, /* R227 */
1319 { 0x0000, 0x0000, 0x0000 }, /* R228 */ 3415 { 0x0000, 0x0000, 0x0000 }, /* R228 */
1320 { 0x0000, 0x0000, 0x0000 }, /* R229 */ 3416 { 0x0000, 0x0000, 0x0000 }, /* R229 */
diff --git a/drivers/mfd/wm8400-core.c b/drivers/mfd/wm8400-core.c
index 6a0cedb5bb8a..cf30d06a0104 100644
--- a/drivers/mfd/wm8400-core.c
+++ b/drivers/mfd/wm8400-core.c
@@ -15,6 +15,7 @@
15#include <linux/bug.h> 15#include <linux/bug.h>
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/mfd/core.h>
18#include <linux/mfd/wm8400-private.h> 19#include <linux/mfd/wm8400-private.h>
19#include <linux/mfd/wm8400-audio.h> 20#include <linux/mfd/wm8400-audio.h>
20 21
@@ -239,6 +240,16 @@ void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400)
239} 240}
240EXPORT_SYMBOL_GPL(wm8400_reset_codec_reg_cache); 241EXPORT_SYMBOL_GPL(wm8400_reset_codec_reg_cache);
241 242
243static int wm8400_register_codec(struct wm8400 *wm8400)
244{
245 struct mfd_cell cell = {
246 .name = "wm8400-codec",
247 .driver_data = wm8400,
248 };
249
250 return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0);
251}
252
242/* 253/*
243 * wm8400_init - Generic initialisation 254 * wm8400_init - Generic initialisation
244 * 255 *
@@ -296,24 +307,32 @@ static int wm8400_init(struct wm8400 *wm8400,
296 reg = (reg & WM8400_CHIP_REV_MASK) >> WM8400_CHIP_REV_SHIFT; 307 reg = (reg & WM8400_CHIP_REV_MASK) >> WM8400_CHIP_REV_SHIFT;
297 dev_info(wm8400->dev, "WM8400 revision %x\n", reg); 308 dev_info(wm8400->dev, "WM8400 revision %x\n", reg);
298 309
310 ret = wm8400_register_codec(wm8400);
311 if (ret != 0) {
312 dev_err(wm8400->dev, "Failed to register codec\n");
313 goto err_children;
314 }
315
299 if (pdata && pdata->platform_init) { 316 if (pdata && pdata->platform_init) {
300 ret = pdata->platform_init(wm8400->dev); 317 ret = pdata->platform_init(wm8400->dev);
301 if (ret != 0) 318 if (ret != 0) {
302 dev_err(wm8400->dev, "Platform init failed: %d\n", 319 dev_err(wm8400->dev, "Platform init failed: %d\n",
303 ret); 320 ret);
321 goto err_children;
322 }
304 } else 323 } else
305 dev_warn(wm8400->dev, "No platform initialisation supplied\n"); 324 dev_warn(wm8400->dev, "No platform initialisation supplied\n");
306 325
326 return 0;
327
328err_children:
329 mfd_remove_devices(wm8400->dev);
307 return ret; 330 return ret;
308} 331}
309 332
310static void wm8400_release(struct wm8400 *wm8400) 333static void wm8400_release(struct wm8400 *wm8400)
311{ 334{
312 int i; 335 mfd_remove_devices(wm8400->dev);
313
314 for (i = 0; i < ARRAY_SIZE(wm8400->regulators); i++)
315 if (wm8400->regulators[i].name)
316 platform_device_unregister(&wm8400->regulators[i]);
317} 336}
318 337
319#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 338#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
diff --git a/drivers/misc/ibmasm/ibmasmfs.c b/drivers/misc/ibmasm/ibmasmfs.c
index 22a7e8ba211d..de966a6fb7e6 100644
--- a/drivers/misc/ibmasm/ibmasmfs.c
+++ b/drivers/misc/ibmasm/ibmasmfs.c
@@ -146,8 +146,6 @@ static struct inode *ibmasmfs_make_inode(struct super_block *sb, int mode)
146 146
147 if (ret) { 147 if (ret) {
148 ret->i_mode = mode; 148 ret->i_mode = mode;
149 ret->i_uid = ret->i_gid = 0;
150 ret->i_blocks = 0;
151 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 149 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
152 } 150 }
153 return ret; 151 return ret;
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c
index 517fce48d94a..5b396ff6c83f 100644
--- a/drivers/net/acenic.c
+++ b/drivers/net/acenic.c
@@ -66,6 +66,7 @@
66#include <linux/mm.h> 66#include <linux/mm.h>
67#include <linux/highmem.h> 67#include <linux/highmem.h>
68#include <linux/sockios.h> 68#include <linux/sockios.h>
69#include <linux/firmware.h>
69 70
70#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) 71#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
71#include <linux/if_vlan.h> 72#include <linux/if_vlan.h>
@@ -186,8 +187,6 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl);
186#define MAX_RODATA_LEN 8*1024 187#define MAX_RODATA_LEN 8*1024
187#define MAX_DATA_LEN 2*1024 188#define MAX_DATA_LEN 2*1024
188 189
189#include "acenic_firmware.h"
190
191#ifndef tigon2FwReleaseLocal 190#ifndef tigon2FwReleaseLocal
192#define tigon2FwReleaseLocal 0 191#define tigon2FwReleaseLocal 0
193#endif 192#endif
@@ -417,6 +416,10 @@ static int dis_pci_mem_inval[ACE_MAX_MOD_PARMS] = {1, 1, 1, 1, 1, 1, 1, 1};
417MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>"); 416MODULE_AUTHOR("Jes Sorensen <jes@trained-monkey.org>");
418MODULE_LICENSE("GPL"); 417MODULE_LICENSE("GPL");
419MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver"); 418MODULE_DESCRIPTION("AceNIC/3C985/GA620 Gigabit Ethernet driver");
419#ifndef CONFIG_ACENIC_OMIT_TIGON_I
420MODULE_FIRMWARE("acenic/tg1.bin");
421#endif
422MODULE_FIRMWARE("acenic/tg2.bin");
420 423
421module_param_array_named(link, link_state, int, NULL, 0); 424module_param_array_named(link, link_state, int, NULL, 0);
422module_param_array(trace, int, NULL, 0); 425module_param_array(trace, int, NULL, 0);
@@ -943,8 +946,8 @@ static int __devinit ace_init(struct net_device *dev)
943 case 4: 946 case 4:
944 case 5: 947 case 5:
945 printk(KERN_INFO " Tigon I (Rev. %i), Firmware: %i.%i.%i, ", 948 printk(KERN_INFO " Tigon I (Rev. %i), Firmware: %i.%i.%i, ",
946 tig_ver, tigonFwReleaseMajor, tigonFwReleaseMinor, 949 tig_ver, ap->firmware_major, ap->firmware_minor,
947 tigonFwReleaseFix); 950 ap->firmware_fix);
948 writel(0, &regs->LocalCtrl); 951 writel(0, &regs->LocalCtrl);
949 ap->version = 1; 952 ap->version = 1;
950 ap->tx_ring_entries = TIGON_I_TX_RING_ENTRIES; 953 ap->tx_ring_entries = TIGON_I_TX_RING_ENTRIES;
@@ -952,8 +955,8 @@ static int __devinit ace_init(struct net_device *dev)
952#endif 955#endif
953 case 6: 956 case 6:
954 printk(KERN_INFO " Tigon II (Rev. %i), Firmware: %i.%i.%i, ", 957 printk(KERN_INFO " Tigon II (Rev. %i), Firmware: %i.%i.%i, ",
955 tig_ver, tigon2FwReleaseMajor, tigon2FwReleaseMinor, 958 tig_ver, ap->firmware_major, ap->firmware_minor,
956 tigon2FwReleaseFix); 959 ap->firmware_fix);
957 writel(readl(&regs->CpuBCtrl) | CPU_HALT, &regs->CpuBCtrl); 960 writel(readl(&regs->CpuBCtrl) | CPU_HALT, &regs->CpuBCtrl);
958 readl(&regs->CpuBCtrl); /* PCI write posting */ 961 readl(&regs->CpuBCtrl); /* PCI write posting */
959 /* 962 /*
@@ -1205,7 +1208,9 @@ static int __devinit ace_init(struct net_device *dev)
1205 memset(ap->info, 0, sizeof(struct ace_info)); 1208 memset(ap->info, 0, sizeof(struct ace_info));
1206 memset(ap->skb, 0, sizeof(struct ace_skb)); 1209 memset(ap->skb, 0, sizeof(struct ace_skb));
1207 1210
1208 ace_load_firmware(dev); 1211 if (ace_load_firmware(dev))
1212 goto init_error;
1213
1209 ap->fw_running = 0; 1214 ap->fw_running = 0;
1210 1215
1211 tmp_ptr = ap->info_dma; 1216 tmp_ptr = ap->info_dma;
@@ -1441,10 +1446,7 @@ static int __devinit ace_init(struct net_device *dev)
1441 if (ap->version >= 2) 1446 if (ap->version >= 2)
1442 writel(tmp, &regs->TuneFastLink); 1447 writel(tmp, &regs->TuneFastLink);
1443 1448
1444 if (ACE_IS_TIGON_I(ap)) 1449 writel(ap->firmware_start, &regs->Pc);
1445 writel(tigonFwStartAddr, &regs->Pc);
1446 if (ap->version == 2)
1447 writel(tigon2FwStartAddr, &regs->Pc);
1448 1450
1449 writel(0, &regs->Mb0Lo); 1451 writel(0, &regs->Mb0Lo);
1450 1452
@@ -2761,8 +2763,8 @@ static void ace_get_drvinfo(struct net_device *dev,
2761 2763
2762 strlcpy(info->driver, "acenic", sizeof(info->driver)); 2764 strlcpy(info->driver, "acenic", sizeof(info->driver));
2763 snprintf(info->version, sizeof(info->version), "%i.%i.%i", 2765 snprintf(info->version, sizeof(info->version), "%i.%i.%i",
2764 tigonFwReleaseMajor, tigonFwReleaseMinor, 2766 ap->firmware_major, ap->firmware_minor,
2765 tigonFwReleaseFix); 2767 ap->firmware_fix);
2766 2768
2767 if (ap->pdev) 2769 if (ap->pdev)
2768 strlcpy(info->bus_info, pci_name(ap->pdev), 2770 strlcpy(info->bus_info, pci_name(ap->pdev),
@@ -2869,11 +2871,10 @@ static struct net_device_stats *ace_get_stats(struct net_device *dev)
2869} 2871}
2870 2872
2871 2873
2872static void __devinit ace_copy(struct ace_regs __iomem *regs, void *src, 2874static void __devinit ace_copy(struct ace_regs __iomem *regs, const __be32 *src,
2873 u32 dest, int size) 2875 u32 dest, int size)
2874{ 2876{
2875 void __iomem *tdest; 2877 void __iomem *tdest;
2876 u32 *wsrc;
2877 short tsize, i; 2878 short tsize, i;
2878 2879
2879 if (size <= 0) 2880 if (size <= 0)
@@ -2885,20 +2886,15 @@ static void __devinit ace_copy(struct ace_regs __iomem *regs, void *src,
2885 tdest = (void __iomem *) &regs->Window + 2886 tdest = (void __iomem *) &regs->Window +
2886 (dest & (ACE_WINDOW_SIZE - 1)); 2887 (dest & (ACE_WINDOW_SIZE - 1));
2887 writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase); 2888 writel(dest & ~(ACE_WINDOW_SIZE - 1), &regs->WinBase);
2888 /*
2889 * This requires byte swapping on big endian, however
2890 * writel does that for us
2891 */
2892 wsrc = src;
2893 for (i = 0; i < (tsize / 4); i++) { 2889 for (i = 0; i < (tsize / 4); i++) {
2894 writel(wsrc[i], tdest + i*4); 2890 /* Firmware is big-endian */
2891 writel(be32_to_cpup(src), tdest);
2892 src++;
2893 tdest += 4;
2894 dest += 4;
2895 size -= 4;
2895 } 2896 }
2896 dest += tsize;
2897 src += tsize;
2898 size -= tsize;
2899 } 2897 }
2900
2901 return;
2902} 2898}
2903 2899
2904 2900
@@ -2937,8 +2933,13 @@ static void __devinit ace_clear(struct ace_regs __iomem *regs, u32 dest, int siz
2937 */ 2933 */
2938static int __devinit ace_load_firmware(struct net_device *dev) 2934static int __devinit ace_load_firmware(struct net_device *dev)
2939{ 2935{
2936 const struct firmware *fw;
2937 const char *fw_name = "acenic/tg2.bin";
2940 struct ace_private *ap = netdev_priv(dev); 2938 struct ace_private *ap = netdev_priv(dev);
2941 struct ace_regs __iomem *regs = ap->regs; 2939 struct ace_regs __iomem *regs = ap->regs;
2940 const __be32 *fw_data;
2941 u32 load_addr;
2942 int ret;
2942 2943
2943 if (!(readl(&regs->CpuCtrl) & CPU_HALTED)) { 2944 if (!(readl(&regs->CpuCtrl) & CPU_HALTED)) {
2944 printk(KERN_ERR "%s: trying to download firmware while the " 2945 printk(KERN_ERR "%s: trying to download firmware while the "
@@ -2946,28 +2947,52 @@ static int __devinit ace_load_firmware(struct net_device *dev)
2946 return -EFAULT; 2947 return -EFAULT;
2947 } 2948 }
2948 2949
2950 if (ACE_IS_TIGON_I(ap))
2951 fw_name = "acenic/tg1.bin";
2952
2953 ret = request_firmware(&fw, fw_name, &ap->pdev->dev);
2954 if (ret) {
2955 printk(KERN_ERR "%s: Failed to load firmware \"%s\"\n",
2956 ap->name, fw_name);
2957 return ret;
2958 }
2959
2960 fw_data = (void *)fw->data;
2961
2962 /* Firmware blob starts with version numbers, followed by
2963 load and start address. Remainder is the blob to be loaded
2964 contiguously from load address. We don't bother to represent
2965 the BSS/SBSS sections any more, since we were clearing the
2966 whole thing anyway. */
2967 ap->firmware_major = fw->data[0];
2968 ap->firmware_minor = fw->data[1];
2969 ap->firmware_fix = fw->data[2];
2970
2971 ap->firmware_start = be32_to_cpu(fw_data[1]);
2972 if (ap->firmware_start < 0x4000 || ap->firmware_start >= 0x80000) {
2973 printk(KERN_ERR "%s: bogus load address %08x in \"%s\"\n",
2974 ap->name, ap->firmware_start, fw_name);
2975 ret = -EINVAL;
2976 goto out;
2977 }
2978
2979 load_addr = be32_to_cpu(fw_data[2]);
2980 if (load_addr < 0x4000 || load_addr >= 0x80000) {
2981 printk(KERN_ERR "%s: bogus load address %08x in \"%s\"\n",
2982 ap->name, load_addr, fw_name);
2983 ret = -EINVAL;
2984 goto out;
2985 }
2986
2949 /* 2987 /*
2950 * Do not try to clear more than 512KB or we end up seeing 2988 * Do not try to clear more than 512KiB or we end up seeing
2951 * funny things on NICs with only 512KB SRAM 2989 * funny things on NICs with only 512KiB SRAM
2952 */ 2990 */
2953 ace_clear(regs, 0x2000, 0x80000-0x2000); 2991 ace_clear(regs, 0x2000, 0x80000-0x2000);
2954 if (ACE_IS_TIGON_I(ap)) { 2992 ace_copy(regs, &fw_data[3], load_addr, fw->size-12);
2955 ace_copy(regs, tigonFwText, tigonFwTextAddr, tigonFwTextLen); 2993 out:
2956 ace_copy(regs, tigonFwData, tigonFwDataAddr, tigonFwDataLen); 2994 release_firmware(fw);
2957 ace_copy(regs, tigonFwRodata, tigonFwRodataAddr, 2995 return ret;
2958 tigonFwRodataLen);
2959 ace_clear(regs, tigonFwBssAddr, tigonFwBssLen);
2960 ace_clear(regs, tigonFwSbssAddr, tigonFwSbssLen);
2961 }else if (ap->version == 2) {
2962 ace_clear(regs, tigon2FwBssAddr, tigon2FwBssLen);
2963 ace_clear(regs, tigon2FwSbssAddr, tigon2FwSbssLen);
2964 ace_copy(regs, tigon2FwText, tigon2FwTextAddr,tigon2FwTextLen);
2965 ace_copy(regs, tigon2FwRodata, tigon2FwRodataAddr,
2966 tigon2FwRodataLen);
2967 ace_copy(regs, tigon2FwData, tigon2FwDataAddr,tigon2FwDataLen);
2968 }
2969
2970 return 0;
2971} 2996}
2972 2997
2973 2998
diff --git a/drivers/net/acenic.h b/drivers/net/acenic.h
index 4487f32759a4..c987c9b5a137 100644
--- a/drivers/net/acenic.h
+++ b/drivers/net/acenic.h
@@ -694,6 +694,10 @@ struct ace_private
694 u32 last_tx, last_std_rx, last_mini_rx; 694 u32 last_tx, last_std_rx, last_mini_rx;
695#endif 695#endif
696 int pci_using_dac; 696 int pci_using_dac;
697 u8 firmware_major;
698 u8 firmware_minor;
699 u8 firmware_fix;
700 u32 firmware_start;
697}; 701};
698 702
699 703
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 9f38b16ccbbd..134b2d60b479 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -658,12 +658,12 @@ static int e100_self_test(struct nic *nic)
658 e100_disable_irq(nic); 658 e100_disable_irq(nic);
659 659
660 /* Check results of self-test */ 660 /* Check results of self-test */
661 if(nic->mem->selftest.result != 0) { 661 if (nic->mem->selftest.result != 0) {
662 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n", 662 DPRINTK(HW, ERR, "Self-test failed: result=0x%08X\n",
663 nic->mem->selftest.result); 663 nic->mem->selftest.result);
664 return -ETIMEDOUT; 664 return -ETIMEDOUT;
665 } 665 }
666 if(nic->mem->selftest.signature == 0) { 666 if (nic->mem->selftest.signature == 0) {
667 DPRINTK(HW, ERR, "Self-test failed: timed out\n"); 667 DPRINTK(HW, ERR, "Self-test failed: timed out\n");
668 return -ETIMEDOUT; 668 return -ETIMEDOUT;
669 } 669 }
@@ -684,13 +684,13 @@ static void e100_eeprom_write(struct nic *nic, u16 addr_len, u16 addr, __le16 da
684 cmd_addr_data[2] = op_ewds << (addr_len - 2); 684 cmd_addr_data[2] = op_ewds << (addr_len - 2);
685 685
686 /* Bit-bang cmds to write word to eeprom */ 686 /* Bit-bang cmds to write word to eeprom */
687 for(j = 0; j < 3; j++) { 687 for (j = 0; j < 3; j++) {
688 688
689 /* Chip select */ 689 /* Chip select */
690 iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo); 690 iowrite8(eecs | eesk, &nic->csr->eeprom_ctrl_lo);
691 e100_write_flush(nic); udelay(4); 691 e100_write_flush(nic); udelay(4);
692 692
693 for(i = 31; i >= 0; i--) { 693 for (i = 31; i >= 0; i--) {
694 ctrl = (cmd_addr_data[j] & (1 << i)) ? 694 ctrl = (cmd_addr_data[j] & (1 << i)) ?
695 eecs | eedi : eecs; 695 eecs | eedi : eecs;
696 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo); 696 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
@@ -723,7 +723,7 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
723 e100_write_flush(nic); udelay(4); 723 e100_write_flush(nic); udelay(4);
724 724
725 /* Bit-bang to read word from eeprom */ 725 /* Bit-bang to read word from eeprom */
726 for(i = 31; i >= 0; i--) { 726 for (i = 31; i >= 0; i--) {
727 ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs; 727 ctrl = (cmd_addr_data & (1 << i)) ? eecs | eedi : eecs;
728 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo); 728 iowrite8(ctrl, &nic->csr->eeprom_ctrl_lo);
729 e100_write_flush(nic); udelay(4); 729 e100_write_flush(nic); udelay(4);
@@ -734,7 +734,7 @@ static __le16 e100_eeprom_read(struct nic *nic, u16 *addr_len, u16 addr)
734 /* Eeprom drives a dummy zero to EEDO after receiving 734 /* Eeprom drives a dummy zero to EEDO after receiving
735 * complete address. Use this to adjust addr_len. */ 735 * complete address. Use this to adjust addr_len. */
736 ctrl = ioread8(&nic->csr->eeprom_ctrl_lo); 736 ctrl = ioread8(&nic->csr->eeprom_ctrl_lo);
737 if(!(ctrl & eedo) && i > 16) { 737 if (!(ctrl & eedo) && i > 16) {
738 *addr_len -= (i - 16); 738 *addr_len -= (i - 16);
739 i = 17; 739 i = 17;
740 } 740 }
@@ -758,9 +758,9 @@ static int e100_eeprom_load(struct nic *nic)
758 e100_eeprom_read(nic, &addr_len, 0); 758 e100_eeprom_read(nic, &addr_len, 0);
759 nic->eeprom_wc = 1 << addr_len; 759 nic->eeprom_wc = 1 << addr_len;
760 760
761 for(addr = 0; addr < nic->eeprom_wc; addr++) { 761 for (addr = 0; addr < nic->eeprom_wc; addr++) {
762 nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr); 762 nic->eeprom[addr] = e100_eeprom_read(nic, &addr_len, addr);
763 if(addr < nic->eeprom_wc - 1) 763 if (addr < nic->eeprom_wc - 1)
764 checksum += le16_to_cpu(nic->eeprom[addr]); 764 checksum += le16_to_cpu(nic->eeprom[addr]);
765 } 765 }
766 766
@@ -784,15 +784,15 @@ static int e100_eeprom_save(struct nic *nic, u16 start, u16 count)
784 e100_eeprom_read(nic, &addr_len, 0); 784 e100_eeprom_read(nic, &addr_len, 0);
785 nic->eeprom_wc = 1 << addr_len; 785 nic->eeprom_wc = 1 << addr_len;
786 786
787 if(start + count >= nic->eeprom_wc) 787 if (start + count >= nic->eeprom_wc)
788 return -EINVAL; 788 return -EINVAL;
789 789
790 for(addr = start; addr < start + count; addr++) 790 for (addr = start; addr < start + count; addr++)
791 e100_eeprom_write(nic, addr_len, addr, nic->eeprom[addr]); 791 e100_eeprom_write(nic, addr_len, addr, nic->eeprom[addr]);
792 792
793 /* The checksum, stored in the last word, is calculated such that 793 /* The checksum, stored in the last word, is calculated such that
794 * the sum of words should be 0xBABA */ 794 * the sum of words should be 0xBABA */
795 for(addr = 0; addr < nic->eeprom_wc - 1; addr++) 795 for (addr = 0; addr < nic->eeprom_wc - 1; addr++)
796 checksum += le16_to_cpu(nic->eeprom[addr]); 796 checksum += le16_to_cpu(nic->eeprom[addr]);
797 nic->eeprom[nic->eeprom_wc - 1] = cpu_to_le16(0xBABA - checksum); 797 nic->eeprom[nic->eeprom_wc - 1] = cpu_to_le16(0xBABA - checksum);
798 e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1, 798 e100_eeprom_write(nic, addr_len, nic->eeprom_wc - 1,
@@ -812,19 +812,19 @@ static int e100_exec_cmd(struct nic *nic, u8 cmd, dma_addr_t dma_addr)
812 spin_lock_irqsave(&nic->cmd_lock, flags); 812 spin_lock_irqsave(&nic->cmd_lock, flags);
813 813
814 /* Previous command is accepted when SCB clears */ 814 /* Previous command is accepted when SCB clears */
815 for(i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) { 815 for (i = 0; i < E100_WAIT_SCB_TIMEOUT; i++) {
816 if(likely(!ioread8(&nic->csr->scb.cmd_lo))) 816 if (likely(!ioread8(&nic->csr->scb.cmd_lo)))
817 break; 817 break;
818 cpu_relax(); 818 cpu_relax();
819 if(unlikely(i > E100_WAIT_SCB_FAST)) 819 if (unlikely(i > E100_WAIT_SCB_FAST))
820 udelay(5); 820 udelay(5);
821 } 821 }
822 if(unlikely(i == E100_WAIT_SCB_TIMEOUT)) { 822 if (unlikely(i == E100_WAIT_SCB_TIMEOUT)) {
823 err = -EAGAIN; 823 err = -EAGAIN;
824 goto err_unlock; 824 goto err_unlock;
825 } 825 }
826 826
827 if(unlikely(cmd != cuc_resume)) 827 if (unlikely(cmd != cuc_resume))
828 iowrite32(dma_addr, &nic->csr->scb.gen_ptr); 828 iowrite32(dma_addr, &nic->csr->scb.gen_ptr);
829 iowrite8(cmd, &nic->csr->scb.cmd_lo); 829 iowrite8(cmd, &nic->csr->scb.cmd_lo);
830 830
@@ -843,7 +843,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
843 843
844 spin_lock_irqsave(&nic->cb_lock, flags); 844 spin_lock_irqsave(&nic->cb_lock, flags);
845 845
846 if(unlikely(!nic->cbs_avail)) { 846 if (unlikely(!nic->cbs_avail)) {
847 err = -ENOMEM; 847 err = -ENOMEM;
848 goto err_unlock; 848 goto err_unlock;
849 } 849 }
@@ -853,7 +853,7 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
853 nic->cbs_avail--; 853 nic->cbs_avail--;
854 cb->skb = skb; 854 cb->skb = skb;
855 855
856 if(unlikely(!nic->cbs_avail)) 856 if (unlikely(!nic->cbs_avail))
857 err = -ENOSPC; 857 err = -ENOSPC;
858 858
859 cb_prepare(nic, cb, skb); 859 cb_prepare(nic, cb, skb);
@@ -864,15 +864,15 @@ static int e100_exec_cb(struct nic *nic, struct sk_buff *skb,
864 wmb(); 864 wmb();
865 cb->prev->command &= cpu_to_le16(~cb_s); 865 cb->prev->command &= cpu_to_le16(~cb_s);
866 866
867 while(nic->cb_to_send != nic->cb_to_use) { 867 while (nic->cb_to_send != nic->cb_to_use) {
868 if(unlikely(e100_exec_cmd(nic, nic->cuc_cmd, 868 if (unlikely(e100_exec_cmd(nic, nic->cuc_cmd,
869 nic->cb_to_send->dma_addr))) { 869 nic->cb_to_send->dma_addr))) {
870 /* Ok, here's where things get sticky. It's 870 /* Ok, here's where things get sticky. It's
871 * possible that we can't schedule the command 871 * possible that we can't schedule the command
872 * because the controller is too busy, so 872 * because the controller is too busy, so
873 * let's just queue the command and try again 873 * let's just queue the command and try again
874 * when another command is scheduled. */ 874 * when another command is scheduled. */
875 if(err == -ENOSPC) { 875 if (err == -ENOSPC) {
876 //request a reset 876 //request a reset
877 schedule_work(&nic->tx_timeout_task); 877 schedule_work(&nic->tx_timeout_task);
878 } 878 }
@@ -945,7 +945,7 @@ static void e100_get_defaults(struct nic *nic)
945 945
946 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */ 946 /* MAC type is encoded as rev ID; exception: ICH is treated as 82559 */
947 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision; 947 nic->mac = (nic->flags & ich) ? mac_82559_D101M : nic->pdev->revision;
948 if(nic->mac == mac_unknown) 948 if (nic->mac == mac_unknown)
949 nic->mac = mac_82557_D100_A; 949 nic->mac = mac_82557_D100_A;
950 950
951 nic->params.rfds = rfds; 951 nic->params.rfds = rfds;
@@ -1008,23 +1008,23 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1008 config->adaptive_ifs = nic->adaptive_ifs; 1008 config->adaptive_ifs = nic->adaptive_ifs;
1009 config->loopback = nic->loopback; 1009 config->loopback = nic->loopback;
1010 1010
1011 if(nic->mii.force_media && nic->mii.full_duplex) 1011 if (nic->mii.force_media && nic->mii.full_duplex)
1012 config->full_duplex_force = 0x1; /* 1=force, 0=auto */ 1012 config->full_duplex_force = 0x1; /* 1=force, 0=auto */
1013 1013
1014 if(nic->flags & promiscuous || nic->loopback) { 1014 if (nic->flags & promiscuous || nic->loopback) {
1015 config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */ 1015 config->rx_save_bad_frames = 0x1; /* 1=save, 0=discard */
1016 config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */ 1016 config->rx_discard_short_frames = 0x0; /* 1=discard, 0=save */
1017 config->promiscuous_mode = 0x1; /* 1=on, 0=off */ 1017 config->promiscuous_mode = 0x1; /* 1=on, 0=off */
1018 } 1018 }
1019 1019
1020 if(nic->flags & multicast_all) 1020 if (nic->flags & multicast_all)
1021 config->multicast_all = 0x1; /* 1=accept, 0=no */ 1021 config->multicast_all = 0x1; /* 1=accept, 0=no */
1022 1022
1023 /* disable WoL when up */ 1023 /* disable WoL when up */
1024 if(netif_running(nic->netdev) || !(nic->flags & wol_magic)) 1024 if (netif_running(nic->netdev) || !(nic->flags & wol_magic))
1025 config->magic_packet_disable = 0x1; /* 1=off, 0=on */ 1025 config->magic_packet_disable = 0x1; /* 1=off, 0=on */
1026 1026
1027 if(nic->mac >= mac_82558_D101_A4) { 1027 if (nic->mac >= mac_82558_D101_A4) {
1028 config->fc_disable = 0x1; /* 1=Tx fc off, 0=Tx fc on */ 1028 config->fc_disable = 0x1; /* 1=Tx fc off, 0=Tx fc on */
1029 config->mwi_enable = 0x1; /* 1=enable, 0=disable */ 1029 config->mwi_enable = 0x1; /* 1=enable, 0=disable */
1030 config->standard_tcb = 0x0; /* 1=standard, 0=extended */ 1030 config->standard_tcb = 0x0; /* 1=standard, 0=extended */
@@ -1369,21 +1369,21 @@ static int e100_phy_init(struct nic *nic)
1369 u16 bmcr, stat, id_lo, id_hi, cong; 1369 u16 bmcr, stat, id_lo, id_hi, cong;
1370 1370
1371 /* Discover phy addr by searching addrs in order {1,0,2,..., 31} */ 1371 /* Discover phy addr by searching addrs in order {1,0,2,..., 31} */
1372 for(addr = 0; addr < 32; addr++) { 1372 for (addr = 0; addr < 32; addr++) {
1373 nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr; 1373 nic->mii.phy_id = (addr == 0) ? 1 : (addr == 1) ? 0 : addr;
1374 bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR); 1374 bmcr = mdio_read(netdev, nic->mii.phy_id, MII_BMCR);
1375 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); 1375 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);
1376 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR); 1376 stat = mdio_read(netdev, nic->mii.phy_id, MII_BMSR);
1377 if(!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0)))) 1377 if (!((bmcr == 0xFFFF) || ((stat == 0) && (bmcr == 0))))
1378 break; 1378 break;
1379 } 1379 }
1380 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id); 1380 DPRINTK(HW, DEBUG, "phy_addr = %d\n", nic->mii.phy_id);
1381 if(addr == 32) 1381 if (addr == 32)
1382 return -EAGAIN; 1382 return -EAGAIN;
1383 1383
1384 /* Selected the phy and isolate the rest */ 1384 /* Selected the phy and isolate the rest */
1385 for(addr = 0; addr < 32; addr++) { 1385 for (addr = 0; addr < 32; addr++) {
1386 if(addr != nic->mii.phy_id) { 1386 if (addr != nic->mii.phy_id) {
1387 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE); 1387 mdio_write(netdev, addr, MII_BMCR, BMCR_ISOLATE);
1388 } else { 1388 } else {
1389 bmcr = mdio_read(netdev, addr, MII_BMCR); 1389 bmcr = mdio_read(netdev, addr, MII_BMCR);
@@ -1400,7 +1400,7 @@ static int e100_phy_init(struct nic *nic)
1400 1400
1401 /* Handle National tx phys */ 1401 /* Handle National tx phys */
1402#define NCS_PHY_MODEL_MASK 0xFFF0FFFF 1402#define NCS_PHY_MODEL_MASK 0xFFF0FFFF
1403 if((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) { 1403 if ((nic->phy & NCS_PHY_MODEL_MASK) == phy_nsc_tx) {
1404 /* Disable congestion control */ 1404 /* Disable congestion control */
1405 cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG); 1405 cong = mdio_read(netdev, nic->mii.phy_id, MII_NSC_CONG);
1406 cong |= NSC_CONG_TXREADY; 1406 cong |= NSC_CONG_TXREADY;
@@ -1408,7 +1408,7 @@ static int e100_phy_init(struct nic *nic)
1408 mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong); 1408 mdio_write(netdev, nic->mii.phy_id, MII_NSC_CONG, cong);
1409 } 1409 }
1410 1410
1411 if((nic->mac >= mac_82550_D102) || ((nic->flags & ich) && 1411 if ((nic->mac >= mac_82550_D102) || ((nic->flags & ich) &&
1412 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) && 1412 (mdio_read(netdev, nic->mii.phy_id, MII_TPISTATUS) & 0x8000) &&
1413 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) { 1413 !(nic->eeprom[eeprom_cnfg_mdix] & eeprom_mdix_enabled))) {
1414 /* enable/disable MDI/MDI-X auto-switching. */ 1414 /* enable/disable MDI/MDI-X auto-switching. */
@@ -1426,25 +1426,25 @@ static int e100_hw_init(struct nic *nic)
1426 e100_hw_reset(nic); 1426 e100_hw_reset(nic);
1427 1427
1428 DPRINTK(HW, ERR, "e100_hw_init\n"); 1428 DPRINTK(HW, ERR, "e100_hw_init\n");
1429 if(!in_interrupt() && (err = e100_self_test(nic))) 1429 if (!in_interrupt() && (err = e100_self_test(nic)))
1430 return err; 1430 return err;
1431 1431
1432 if((err = e100_phy_init(nic))) 1432 if ((err = e100_phy_init(nic)))
1433 return err; 1433 return err;
1434 if((err = e100_exec_cmd(nic, cuc_load_base, 0))) 1434 if ((err = e100_exec_cmd(nic, cuc_load_base, 0)))
1435 return err; 1435 return err;
1436 if((err = e100_exec_cmd(nic, ruc_load_base, 0))) 1436 if ((err = e100_exec_cmd(nic, ruc_load_base, 0)))
1437 return err; 1437 return err;
1438 if ((err = e100_exec_cb_wait(nic, NULL, e100_setup_ucode))) 1438 if ((err = e100_exec_cb_wait(nic, NULL, e100_setup_ucode)))
1439 return err; 1439 return err;
1440 if((err = e100_exec_cb(nic, NULL, e100_configure))) 1440 if ((err = e100_exec_cb(nic, NULL, e100_configure)))
1441 return err; 1441 return err;
1442 if((err = e100_exec_cb(nic, NULL, e100_setup_iaaddr))) 1442 if ((err = e100_exec_cb(nic, NULL, e100_setup_iaaddr)))
1443 return err; 1443 return err;
1444 if((err = e100_exec_cmd(nic, cuc_dump_addr, 1444 if ((err = e100_exec_cmd(nic, cuc_dump_addr,
1445 nic->dma_addr + offsetof(struct mem, stats)))) 1445 nic->dma_addr + offsetof(struct mem, stats))))
1446 return err; 1446 return err;
1447 if((err = e100_exec_cmd(nic, cuc_dump_reset, 0))) 1447 if ((err = e100_exec_cmd(nic, cuc_dump_reset, 0)))
1448 return err; 1448 return err;
1449 1449
1450 e100_disable_irq(nic); 1450 e100_disable_irq(nic);
@@ -1460,7 +1460,7 @@ static void e100_multi(struct nic *nic, struct cb *cb, struct sk_buff *skb)
1460 1460
1461 cb->command = cpu_to_le16(cb_multi); 1461 cb->command = cpu_to_le16(cb_multi);
1462 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN); 1462 cb->u.multi.count = cpu_to_le16(count * ETH_ALEN);
1463 for(i = 0; list && i < count; i++, list = list->next) 1463 for (i = 0; list && i < count; i++, list = list->next)
1464 memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr, 1464 memcpy(&cb->u.multi.addr[i*ETH_ALEN], &list->dmi_addr,
1465 ETH_ALEN); 1465 ETH_ALEN);
1466} 1466}
@@ -1472,12 +1472,12 @@ static void e100_set_multicast_list(struct net_device *netdev)
1472 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n", 1472 DPRINTK(HW, DEBUG, "mc_count=%d, flags=0x%04X\n",
1473 netdev->mc_count, netdev->flags); 1473 netdev->mc_count, netdev->flags);
1474 1474
1475 if(netdev->flags & IFF_PROMISC) 1475 if (netdev->flags & IFF_PROMISC)
1476 nic->flags |= promiscuous; 1476 nic->flags |= promiscuous;
1477 else 1477 else
1478 nic->flags &= ~promiscuous; 1478 nic->flags &= ~promiscuous;
1479 1479
1480 if(netdev->flags & IFF_ALLMULTI || 1480 if (netdev->flags & IFF_ALLMULTI ||
1481 netdev->mc_count > E100_MAX_MULTICAST_ADDRS) 1481 netdev->mc_count > E100_MAX_MULTICAST_ADDRS)
1482 nic->flags |= multicast_all; 1482 nic->flags |= multicast_all;
1483 else 1483 else
@@ -1500,7 +1500,7 @@ static void e100_update_stats(struct nic *nic)
1500 * complete, so we're always waiting for results of the 1500 * complete, so we're always waiting for results of the
1501 * previous command. */ 1501 * previous command. */
1502 1502
1503 if(*complete == cpu_to_le32(cuc_dump_reset_complete)) { 1503 if (*complete == cpu_to_le32(cuc_dump_reset_complete)) {
1504 *complete = 0; 1504 *complete = 0;
1505 nic->tx_frames = le32_to_cpu(s->tx_good_frames); 1505 nic->tx_frames = le32_to_cpu(s->tx_good_frames);
1506 nic->tx_collisions = le32_to_cpu(s->tx_total_collisions); 1506 nic->tx_collisions = le32_to_cpu(s->tx_total_collisions);
@@ -1527,12 +1527,12 @@ static void e100_update_stats(struct nic *nic)
1527 le32_to_cpu(s->tx_single_collisions); 1527 le32_to_cpu(s->tx_single_collisions);
1528 nic->tx_multiple_collisions += 1528 nic->tx_multiple_collisions +=
1529 le32_to_cpu(s->tx_multiple_collisions); 1529 le32_to_cpu(s->tx_multiple_collisions);
1530 if(nic->mac >= mac_82558_D101_A4) { 1530 if (nic->mac >= mac_82558_D101_A4) {
1531 nic->tx_fc_pause += le32_to_cpu(s->fc_xmt_pause); 1531 nic->tx_fc_pause += le32_to_cpu(s->fc_xmt_pause);
1532 nic->rx_fc_pause += le32_to_cpu(s->fc_rcv_pause); 1532 nic->rx_fc_pause += le32_to_cpu(s->fc_rcv_pause);
1533 nic->rx_fc_unsupported += 1533 nic->rx_fc_unsupported +=
1534 le32_to_cpu(s->fc_rcv_unsupported); 1534 le32_to_cpu(s->fc_rcv_unsupported);
1535 if(nic->mac >= mac_82559_D101M) { 1535 if (nic->mac >= mac_82559_D101M) {
1536 nic->tx_tco_frames += 1536 nic->tx_tco_frames +=
1537 le16_to_cpu(s->xmt_tco_frames); 1537 le16_to_cpu(s->xmt_tco_frames);
1538 nic->rx_tco_frames += 1538 nic->rx_tco_frames +=
@@ -1542,7 +1542,7 @@ static void e100_update_stats(struct nic *nic)
1542 } 1542 }
1543 1543
1544 1544
1545 if(e100_exec_cmd(nic, cuc_dump_reset, 0)) 1545 if (e100_exec_cmd(nic, cuc_dump_reset, 0))
1546 DPRINTK(TX_ERR, DEBUG, "exec cuc_dump_reset failed\n"); 1546 DPRINTK(TX_ERR, DEBUG, "exec cuc_dump_reset failed\n");
1547} 1547}
1548 1548
@@ -1551,19 +1551,19 @@ static void e100_adjust_adaptive_ifs(struct nic *nic, int speed, int duplex)
1551 /* Adjust inter-frame-spacing (IFS) between two transmits if 1551 /* Adjust inter-frame-spacing (IFS) between two transmits if
1552 * we're getting collisions on a half-duplex connection. */ 1552 * we're getting collisions on a half-duplex connection. */
1553 1553
1554 if(duplex == DUPLEX_HALF) { 1554 if (duplex == DUPLEX_HALF) {
1555 u32 prev = nic->adaptive_ifs; 1555 u32 prev = nic->adaptive_ifs;
1556 u32 min_frames = (speed == SPEED_100) ? 1000 : 100; 1556 u32 min_frames = (speed == SPEED_100) ? 1000 : 100;
1557 1557
1558 if((nic->tx_frames / 32 < nic->tx_collisions) && 1558 if ((nic->tx_frames / 32 < nic->tx_collisions) &&
1559 (nic->tx_frames > min_frames)) { 1559 (nic->tx_frames > min_frames)) {
1560 if(nic->adaptive_ifs < 60) 1560 if (nic->adaptive_ifs < 60)
1561 nic->adaptive_ifs += 5; 1561 nic->adaptive_ifs += 5;
1562 } else if (nic->tx_frames < min_frames) { 1562 } else if (nic->tx_frames < min_frames) {
1563 if(nic->adaptive_ifs >= 5) 1563 if (nic->adaptive_ifs >= 5)
1564 nic->adaptive_ifs -= 5; 1564 nic->adaptive_ifs -= 5;
1565 } 1565 }
1566 if(nic->adaptive_ifs != prev) 1566 if (nic->adaptive_ifs != prev)
1567 e100_exec_cb(nic, NULL, e100_configure); 1567 e100_exec_cb(nic, NULL, e100_configure);
1568 } 1568 }
1569} 1569}
@@ -1579,12 +1579,12 @@ static void e100_watchdog(unsigned long data)
1579 1579
1580 mii_ethtool_gset(&nic->mii, &cmd); 1580 mii_ethtool_gset(&nic->mii, &cmd);
1581 1581
1582 if(mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) { 1582 if (mii_link_ok(&nic->mii) && !netif_carrier_ok(nic->netdev)) {
1583 printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n", 1583 printk(KERN_INFO "e100: %s NIC Link is Up %s Mbps %s Duplex\n",
1584 nic->netdev->name, 1584 nic->netdev->name,
1585 cmd.speed == SPEED_100 ? "100" : "10", 1585 cmd.speed == SPEED_100 ? "100" : "10",
1586 cmd.duplex == DUPLEX_FULL ? "Full" : "Half"); 1586 cmd.duplex == DUPLEX_FULL ? "Full" : "Half");
1587 } else if(!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) { 1587 } else if (!mii_link_ok(&nic->mii) && netif_carrier_ok(nic->netdev)) {
1588 printk(KERN_INFO "e100: %s NIC Link is Down\n", 1588 printk(KERN_INFO "e100: %s NIC Link is Down\n",
1589 nic->netdev->name); 1589 nic->netdev->name);
1590 } 1590 }
@@ -1604,11 +1604,11 @@ static void e100_watchdog(unsigned long data)
1604 e100_update_stats(nic); 1604 e100_update_stats(nic);
1605 e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex); 1605 e100_adjust_adaptive_ifs(nic, cmd.speed, cmd.duplex);
1606 1606
1607 if(nic->mac <= mac_82557_D100_C) 1607 if (nic->mac <= mac_82557_D100_C)
1608 /* Issue a multicast command to workaround a 557 lock up */ 1608 /* Issue a multicast command to workaround a 557 lock up */
1609 e100_set_multicast_list(nic->netdev); 1609 e100_set_multicast_list(nic->netdev);
1610 1610
1611 if(nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF) 1611 if (nic->flags & ich && cmd.speed==SPEED_10 && cmd.duplex==DUPLEX_HALF)
1612 /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */ 1612 /* Need SW workaround for ICH[x] 10Mbps/half duplex Tx hang. */
1613 nic->flags |= ich_10h_workaround; 1613 nic->flags |= ich_10h_workaround;
1614 else 1614 else
@@ -1623,7 +1623,7 @@ static void e100_xmit_prepare(struct nic *nic, struct cb *cb,
1623{ 1623{
1624 cb->command = nic->tx_command; 1624 cb->command = nic->tx_command;
1625 /* interrupt every 16 packets regardless of delay */ 1625 /* interrupt every 16 packets regardless of delay */
1626 if((nic->cbs_avail & ~15) == nic->cbs_avail) 1626 if ((nic->cbs_avail & ~15) == nic->cbs_avail)
1627 cb->command |= cpu_to_le16(cb_i); 1627 cb->command |= cpu_to_le16(cb_i);
1628 cb->u.tcb.tbd_array = cb->dma_addr + offsetof(struct cb, u.tcb.tbd); 1628 cb->u.tcb.tbd_array = cb->dma_addr + offsetof(struct cb, u.tcb.tbd);
1629 cb->u.tcb.tcb_byte_count = 0; 1629 cb->u.tcb.tcb_byte_count = 0;
@@ -1640,18 +1640,18 @@ static int e100_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
1640 struct nic *nic = netdev_priv(netdev); 1640 struct nic *nic = netdev_priv(netdev);
1641 int err; 1641 int err;
1642 1642
1643 if(nic->flags & ich_10h_workaround) { 1643 if (nic->flags & ich_10h_workaround) {
1644 /* SW workaround for ICH[x] 10Mbps/half duplex Tx hang. 1644 /* SW workaround for ICH[x] 10Mbps/half duplex Tx hang.
1645 Issue a NOP command followed by a 1us delay before 1645 Issue a NOP command followed by a 1us delay before
1646 issuing the Tx command. */ 1646 issuing the Tx command. */
1647 if(e100_exec_cmd(nic, cuc_nop, 0)) 1647 if (e100_exec_cmd(nic, cuc_nop, 0))
1648 DPRINTK(TX_ERR, DEBUG, "exec cuc_nop failed\n"); 1648 DPRINTK(TX_ERR, DEBUG, "exec cuc_nop failed\n");
1649 udelay(1); 1649 udelay(1);
1650 } 1650 }
1651 1651
1652 err = e100_exec_cb(nic, skb, e100_xmit_prepare); 1652 err = e100_exec_cb(nic, skb, e100_xmit_prepare);
1653 1653
1654 switch(err) { 1654 switch (err) {
1655 case -ENOSPC: 1655 case -ENOSPC:
1656 /* We queued the skb, but now we're out of space. */ 1656 /* We queued the skb, but now we're out of space. */
1657 DPRINTK(TX_ERR, DEBUG, "No space for CB\n"); 1657 DPRINTK(TX_ERR, DEBUG, "No space for CB\n");
@@ -1677,14 +1677,14 @@ static int e100_tx_clean(struct nic *nic)
1677 spin_lock(&nic->cb_lock); 1677 spin_lock(&nic->cb_lock);
1678 1678
1679 /* Clean CBs marked complete */ 1679 /* Clean CBs marked complete */
1680 for(cb = nic->cb_to_clean; 1680 for (cb = nic->cb_to_clean;
1681 cb->status & cpu_to_le16(cb_complete); 1681 cb->status & cpu_to_le16(cb_complete);
1682 cb = nic->cb_to_clean = cb->next) { 1682 cb = nic->cb_to_clean = cb->next) {
1683 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n", 1683 DPRINTK(TX_DONE, DEBUG, "cb[%d]->status = 0x%04X\n",
1684 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)), 1684 (int)(((void*)cb - (void*)nic->cbs)/sizeof(struct cb)),
1685 cb->status); 1685 cb->status);
1686 1686
1687 if(likely(cb->skb != NULL)) { 1687 if (likely(cb->skb != NULL)) {
1688 dev->stats.tx_packets++; 1688 dev->stats.tx_packets++;
1689 dev->stats.tx_bytes += cb->skb->len; 1689 dev->stats.tx_bytes += cb->skb->len;
1690 1690
@@ -1703,7 +1703,7 @@ static int e100_tx_clean(struct nic *nic)
1703 spin_unlock(&nic->cb_lock); 1703 spin_unlock(&nic->cb_lock);
1704 1704
1705 /* Recover from running out of Tx resources in xmit_frame */ 1705 /* Recover from running out of Tx resources in xmit_frame */
1706 if(unlikely(tx_cleaned && netif_queue_stopped(nic->netdev))) 1706 if (unlikely(tx_cleaned && netif_queue_stopped(nic->netdev)))
1707 netif_wake_queue(nic->netdev); 1707 netif_wake_queue(nic->netdev);
1708 1708
1709 return tx_cleaned; 1709 return tx_cleaned;
@@ -1711,10 +1711,10 @@ static int e100_tx_clean(struct nic *nic)
1711 1711
1712static void e100_clean_cbs(struct nic *nic) 1712static void e100_clean_cbs(struct nic *nic)
1713{ 1713{
1714 if(nic->cbs) { 1714 if (nic->cbs) {
1715 while(nic->cbs_avail != nic->params.cbs.count) { 1715 while (nic->cbs_avail != nic->params.cbs.count) {
1716 struct cb *cb = nic->cb_to_clean; 1716 struct cb *cb = nic->cb_to_clean;
1717 if(cb->skb) { 1717 if (cb->skb) {
1718 pci_unmap_single(nic->pdev, 1718 pci_unmap_single(nic->pdev,
1719 le32_to_cpu(cb->u.tcb.tbd.buf_addr), 1719 le32_to_cpu(cb->u.tcb.tbd.buf_addr),
1720 le16_to_cpu(cb->u.tcb.tbd.size), 1720 le16_to_cpu(cb->u.tcb.tbd.size),
@@ -1746,10 +1746,10 @@ static int e100_alloc_cbs(struct nic *nic)
1746 1746
1747 nic->cbs = pci_alloc_consistent(nic->pdev, 1747 nic->cbs = pci_alloc_consistent(nic->pdev,
1748 sizeof(struct cb) * count, &nic->cbs_dma_addr); 1748 sizeof(struct cb) * count, &nic->cbs_dma_addr);
1749 if(!nic->cbs) 1749 if (!nic->cbs)
1750 return -ENOMEM; 1750 return -ENOMEM;
1751 1751
1752 for(cb = nic->cbs, i = 0; i < count; cb++, i++) { 1752 for (cb = nic->cbs, i = 0; i < count; cb++, i++) {
1753 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs; 1753 cb->next = (i + 1 < count) ? cb + 1 : nic->cbs;
1754 cb->prev = (i == 0) ? nic->cbs + count - 1 : cb - 1; 1754 cb->prev = (i == 0) ? nic->cbs + count - 1 : cb - 1;
1755 1755
@@ -1767,14 +1767,14 @@ static int e100_alloc_cbs(struct nic *nic)
1767 1767
1768static inline void e100_start_receiver(struct nic *nic, struct rx *rx) 1768static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
1769{ 1769{
1770 if(!nic->rxs) return; 1770 if (!nic->rxs) return;
1771 if(RU_SUSPENDED != nic->ru_running) return; 1771 if (RU_SUSPENDED != nic->ru_running) return;
1772 1772
1773 /* handle init time starts */ 1773 /* handle init time starts */
1774 if(!rx) rx = nic->rxs; 1774 if (!rx) rx = nic->rxs;
1775 1775
1776 /* (Re)start RU if suspended or idle and RFA is non-NULL */ 1776 /* (Re)start RU if suspended or idle and RFA is non-NULL */
1777 if(rx->skb) { 1777 if (rx->skb) {
1778 e100_exec_cmd(nic, ruc_start, rx->dma_addr); 1778 e100_exec_cmd(nic, ruc_start, rx->dma_addr);
1779 nic->ru_running = RU_RUNNING; 1779 nic->ru_running = RU_RUNNING;
1780 } 1780 }
@@ -1783,7 +1783,7 @@ static inline void e100_start_receiver(struct nic *nic, struct rx *rx)
1783#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN) 1783#define RFD_BUF_LEN (sizeof(struct rfd) + VLAN_ETH_FRAME_LEN)
1784static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx) 1784static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
1785{ 1785{
1786 if(!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN))) 1786 if (!(rx->skb = netdev_alloc_skb(nic->netdev, RFD_BUF_LEN + NET_IP_ALIGN)))
1787 return -ENOMEM; 1787 return -ENOMEM;
1788 1788
1789 /* Align, init, and map the RFD. */ 1789 /* Align, init, and map the RFD. */
@@ -1820,7 +1820,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1820 struct rfd *rfd = (struct rfd *)skb->data; 1820 struct rfd *rfd = (struct rfd *)skb->data;
1821 u16 rfd_status, actual_size; 1821 u16 rfd_status, actual_size;
1822 1822
1823 if(unlikely(work_done && *work_done >= work_to_do)) 1823 if (unlikely(work_done && *work_done >= work_to_do))
1824 return -EAGAIN; 1824 return -EAGAIN;
1825 1825
1826 /* Need to sync before taking a peek at cb_complete bit */ 1826 /* Need to sync before taking a peek at cb_complete bit */
@@ -1847,7 +1847,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1847 1847
1848 /* Get actual data size */ 1848 /* Get actual data size */
1849 actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF; 1849 actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF;
1850 if(unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd))) 1850 if (unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd)))
1851 actual_size = RFD_BUF_LEN - sizeof(struct rfd); 1851 actual_size = RFD_BUF_LEN - sizeof(struct rfd);
1852 1852
1853 /* Get data */ 1853 /* Get data */
@@ -1872,10 +1872,10 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1872 skb_put(skb, actual_size); 1872 skb_put(skb, actual_size);
1873 skb->protocol = eth_type_trans(skb, nic->netdev); 1873 skb->protocol = eth_type_trans(skb, nic->netdev);
1874 1874
1875 if(unlikely(!(rfd_status & cb_ok))) { 1875 if (unlikely(!(rfd_status & cb_ok))) {
1876 /* Don't indicate if hardware indicates errors */ 1876 /* Don't indicate if hardware indicates errors */
1877 dev_kfree_skb_any(skb); 1877 dev_kfree_skb_any(skb);
1878 } else if(actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) { 1878 } else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) {
1879 /* Don't indicate oversized frames */ 1879 /* Don't indicate oversized frames */
1880 nic->rx_over_length_errors++; 1880 nic->rx_over_length_errors++;
1881 dev_kfree_skb_any(skb); 1881 dev_kfree_skb_any(skb);
@@ -1883,7 +1883,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
1883 dev->stats.rx_packets++; 1883 dev->stats.rx_packets++;
1884 dev->stats.rx_bytes += actual_size; 1884 dev->stats.rx_bytes += actual_size;
1885 netif_receive_skb(skb); 1885 netif_receive_skb(skb);
1886 if(work_done) 1886 if (work_done)
1887 (*work_done)++; 1887 (*work_done)++;
1888 } 1888 }
1889 1889
@@ -1901,7 +1901,7 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1901 struct rfd *old_before_last_rfd, *new_before_last_rfd; 1901 struct rfd *old_before_last_rfd, *new_before_last_rfd;
1902 1902
1903 /* Indicate newly arrived packets */ 1903 /* Indicate newly arrived packets */
1904 for(rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) { 1904 for (rx = nic->rx_to_clean; rx->skb; rx = nic->rx_to_clean = rx->next) {
1905 err = e100_rx_indicate(nic, rx, work_done, work_to_do); 1905 err = e100_rx_indicate(nic, rx, work_done, work_to_do);
1906 /* Hit quota or no more to clean */ 1906 /* Hit quota or no more to clean */
1907 if (-EAGAIN == err || -ENODATA == err) 1907 if (-EAGAIN == err || -ENODATA == err)
@@ -1922,8 +1922,8 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1922 old_before_last_rfd = (struct rfd *)old_before_last_rx->skb->data; 1922 old_before_last_rfd = (struct rfd *)old_before_last_rx->skb->data;
1923 1923
1924 /* Alloc new skbs to refill list */ 1924 /* Alloc new skbs to refill list */
1925 for(rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) { 1925 for (rx = nic->rx_to_use; !rx->skb; rx = nic->rx_to_use = rx->next) {
1926 if(unlikely(e100_rx_alloc_skb(nic, rx))) 1926 if (unlikely(e100_rx_alloc_skb(nic, rx)))
1927 break; /* Better luck next time (see watchdog) */ 1927 break; /* Better luck next time (see watchdog) */
1928 } 1928 }
1929 1929
@@ -1959,11 +1959,11 @@ static void e100_rx_clean(struct nic *nic, unsigned int *work_done,
1959 PCI_DMA_BIDIRECTIONAL); 1959 PCI_DMA_BIDIRECTIONAL);
1960 } 1960 }
1961 1961
1962 if(restart_required) { 1962 if (restart_required) {
1963 // ack the rnr? 1963 // ack the rnr?
1964 iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack); 1964 iowrite8(stat_ack_rnr, &nic->csr->scb.stat_ack);
1965 e100_start_receiver(nic, nic->rx_to_clean); 1965 e100_start_receiver(nic, nic->rx_to_clean);
1966 if(work_done) 1966 if (work_done)
1967 (*work_done)++; 1967 (*work_done)++;
1968 } 1968 }
1969} 1969}
@@ -1975,9 +1975,9 @@ static void e100_rx_clean_list(struct nic *nic)
1975 1975
1976 nic->ru_running = RU_UNINITIALIZED; 1976 nic->ru_running = RU_UNINITIALIZED;
1977 1977
1978 if(nic->rxs) { 1978 if (nic->rxs) {
1979 for(rx = nic->rxs, i = 0; i < count; rx++, i++) { 1979 for (rx = nic->rxs, i = 0; i < count; rx++, i++) {
1980 if(rx->skb) { 1980 if (rx->skb) {
1981 pci_unmap_single(nic->pdev, rx->dma_addr, 1981 pci_unmap_single(nic->pdev, rx->dma_addr,
1982 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); 1982 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
1983 dev_kfree_skb(rx->skb); 1983 dev_kfree_skb(rx->skb);
@@ -1999,13 +1999,13 @@ static int e100_rx_alloc_list(struct nic *nic)
1999 nic->rx_to_use = nic->rx_to_clean = NULL; 1999 nic->rx_to_use = nic->rx_to_clean = NULL;
2000 nic->ru_running = RU_UNINITIALIZED; 2000 nic->ru_running = RU_UNINITIALIZED;
2001 2001
2002 if(!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC))) 2002 if (!(nic->rxs = kcalloc(count, sizeof(struct rx), GFP_ATOMIC)))
2003 return -ENOMEM; 2003 return -ENOMEM;
2004 2004
2005 for(rx = nic->rxs, i = 0; i < count; rx++, i++) { 2005 for (rx = nic->rxs, i = 0; i < count; rx++, i++) {
2006 rx->next = (i + 1 < count) ? rx + 1 : nic->rxs; 2006 rx->next = (i + 1 < count) ? rx + 1 : nic->rxs;
2007 rx->prev = (i == 0) ? nic->rxs + count - 1 : rx - 1; 2007 rx->prev = (i == 0) ? nic->rxs + count - 1 : rx - 1;
2008 if(e100_rx_alloc_skb(nic, rx)) { 2008 if (e100_rx_alloc_skb(nic, rx)) {
2009 e100_rx_clean_list(nic); 2009 e100_rx_clean_list(nic);
2010 return -ENOMEM; 2010 return -ENOMEM;
2011 } 2011 }
@@ -2038,7 +2038,7 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2038 2038
2039 DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack); 2039 DPRINTK(INTR, DEBUG, "stat_ack = 0x%02X\n", stat_ack);
2040 2040
2041 if(stat_ack == stat_ack_not_ours || /* Not our interrupt */ 2041 if (stat_ack == stat_ack_not_ours || /* Not our interrupt */
2042 stat_ack == stat_ack_not_present) /* Hardware is ejected */ 2042 stat_ack == stat_ack_not_present) /* Hardware is ejected */
2043 return IRQ_NONE; 2043 return IRQ_NONE;
2044 2044
@@ -2046,10 +2046,10 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
2046 iowrite8(stat_ack, &nic->csr->scb.stat_ack); 2046 iowrite8(stat_ack, &nic->csr->scb.stat_ack);
2047 2047
2048 /* We hit Receive No Resource (RNR); restart RU after cleaning */ 2048 /* We hit Receive No Resource (RNR); restart RU after cleaning */
2049 if(stat_ack & stat_ack_rnr) 2049 if (stat_ack & stat_ack_rnr)
2050 nic->ru_running = RU_SUSPENDED; 2050 nic->ru_running = RU_SUSPENDED;
2051 2051
2052 if(likely(netif_rx_schedule_prep(&nic->napi))) { 2052 if (likely(netif_rx_schedule_prep(&nic->napi))) {
2053 e100_disable_irq(nic); 2053 e100_disable_irq(nic);
2054 __netif_rx_schedule(&nic->napi); 2054 __netif_rx_schedule(&nic->napi);
2055 } 2055 }
@@ -2102,7 +2102,7 @@ static int e100_set_mac_address(struct net_device *netdev, void *p)
2102 2102
2103static int e100_change_mtu(struct net_device *netdev, int new_mtu) 2103static int e100_change_mtu(struct net_device *netdev, int new_mtu)
2104{ 2104{
2105 if(new_mtu < ETH_ZLEN || new_mtu > ETH_DATA_LEN) 2105 if (new_mtu < ETH_ZLEN || new_mtu > ETH_DATA_LEN)
2106 return -EINVAL; 2106 return -EINVAL;
2107 netdev->mtu = new_mtu; 2107 netdev->mtu = new_mtu;
2108 return 0; 2108 return 0;
@@ -2121,16 +2121,16 @@ static int e100_up(struct nic *nic)
2121{ 2121{
2122 int err; 2122 int err;
2123 2123
2124 if((err = e100_rx_alloc_list(nic))) 2124 if ((err = e100_rx_alloc_list(nic)))
2125 return err; 2125 return err;
2126 if((err = e100_alloc_cbs(nic))) 2126 if ((err = e100_alloc_cbs(nic)))
2127 goto err_rx_clean_list; 2127 goto err_rx_clean_list;
2128 if((err = e100_hw_init(nic))) 2128 if ((err = e100_hw_init(nic)))
2129 goto err_clean_cbs; 2129 goto err_clean_cbs;
2130 e100_set_multicast_list(nic->netdev); 2130 e100_set_multicast_list(nic->netdev);
2131 e100_start_receiver(nic, NULL); 2131 e100_start_receiver(nic, NULL);
2132 mod_timer(&nic->watchdog, jiffies); 2132 mod_timer(&nic->watchdog, jiffies);
2133 if((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED, 2133 if ((err = request_irq(nic->pdev->irq, e100_intr, IRQF_SHARED,
2134 nic->netdev->name, nic->netdev))) 2134 nic->netdev->name, nic->netdev)))
2135 goto err_no_irq; 2135 goto err_no_irq;
2136 netif_wake_queue(nic->netdev); 2136 netif_wake_queue(nic->netdev);
@@ -2192,26 +2192,26 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
2192 * in loopback mode, and the test passes if the received 2192 * in loopback mode, and the test passes if the received
2193 * packet compares byte-for-byte to the transmitted packet. */ 2193 * packet compares byte-for-byte to the transmitted packet. */
2194 2194
2195 if((err = e100_rx_alloc_list(nic))) 2195 if ((err = e100_rx_alloc_list(nic)))
2196 return err; 2196 return err;
2197 if((err = e100_alloc_cbs(nic))) 2197 if ((err = e100_alloc_cbs(nic)))
2198 goto err_clean_rx; 2198 goto err_clean_rx;
2199 2199
2200 /* ICH PHY loopback is broken so do MAC loopback instead */ 2200 /* ICH PHY loopback is broken so do MAC loopback instead */
2201 if(nic->flags & ich && loopback_mode == lb_phy) 2201 if (nic->flags & ich && loopback_mode == lb_phy)
2202 loopback_mode = lb_mac; 2202 loopback_mode = lb_mac;
2203 2203
2204 nic->loopback = loopback_mode; 2204 nic->loopback = loopback_mode;
2205 if((err = e100_hw_init(nic))) 2205 if ((err = e100_hw_init(nic)))
2206 goto err_loopback_none; 2206 goto err_loopback_none;
2207 2207
2208 if(loopback_mode == lb_phy) 2208 if (loopback_mode == lb_phy)
2209 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR, 2209 mdio_write(nic->netdev, nic->mii.phy_id, MII_BMCR,
2210 BMCR_LOOPBACK); 2210 BMCR_LOOPBACK);
2211 2211
2212 e100_start_receiver(nic, NULL); 2212 e100_start_receiver(nic, NULL);
2213 2213
2214 if(!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) { 2214 if (!(skb = netdev_alloc_skb(nic->netdev, ETH_DATA_LEN))) {
2215 err = -ENOMEM; 2215 err = -ENOMEM;
2216 goto err_loopback_none; 2216 goto err_loopback_none;
2217 } 2217 }
@@ -2224,7 +2224,7 @@ static int e100_loopback_test(struct nic *nic, enum loopback loopback_mode)
2224 pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr, 2224 pci_dma_sync_single_for_cpu(nic->pdev, nic->rx_to_clean->dma_addr,
2225 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL); 2225 RFD_BUF_LEN, PCI_DMA_BIDIRECTIONAL);
2226 2226
2227 if(memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd), 2227 if (memcmp(nic->rx_to_clean->skb->data + sizeof(struct rfd),
2228 skb->data, ETH_DATA_LEN)) 2228 skb->data, ETH_DATA_LEN))
2229 err = -EAGAIN; 2229 err = -EAGAIN;
2230 2230
@@ -2301,7 +2301,7 @@ static void e100_get_regs(struct net_device *netdev,
2301 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 | 2301 buff[0] = ioread8(&nic->csr->scb.cmd_hi) << 24 |
2302 ioread8(&nic->csr->scb.cmd_lo) << 16 | 2302 ioread8(&nic->csr->scb.cmd_lo) << 16 |
2303 ioread16(&nic->csr->scb.status); 2303 ioread16(&nic->csr->scb.status);
2304 for(i = E100_PHY_REGS; i >= 0; i--) 2304 for (i = E100_PHY_REGS; i >= 0; i--)
2305 buff[1 + E100_PHY_REGS - i] = 2305 buff[1 + E100_PHY_REGS - i] =
2306 mdio_read(netdev, nic->mii.phy_id, i); 2306 mdio_read(netdev, nic->mii.phy_id, i);
2307 memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf)); 2307 memset(nic->mem->dump_buf, 0, sizeof(nic->mem->dump_buf));
@@ -2326,7 +2326,7 @@ static int e100_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
2326 !device_can_wakeup(&nic->pdev->dev)) 2326 !device_can_wakeup(&nic->pdev->dev))
2327 return -EOPNOTSUPP; 2327 return -EOPNOTSUPP;
2328 2328
2329 if(wol->wolopts) 2329 if (wol->wolopts)
2330 nic->flags |= wol_magic; 2330 nic->flags |= wol_magic;
2331 else 2331 else
2332 nic->flags &= ~wol_magic; 2332 nic->flags &= ~wol_magic;
@@ -2385,7 +2385,7 @@ static int e100_set_eeprom(struct net_device *netdev,
2385{ 2385{
2386 struct nic *nic = netdev_priv(netdev); 2386 struct nic *nic = netdev_priv(netdev);
2387 2387
2388 if(eeprom->magic != E100_EEPROM_MAGIC) 2388 if (eeprom->magic != E100_EEPROM_MAGIC)
2389 return -EINVAL; 2389 return -EINVAL;
2390 2390
2391 memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len); 2391 memcpy(&((u8 *)nic->eeprom)[eeprom->offset], bytes, eeprom->len);
@@ -2421,7 +2421,7 @@ static int e100_set_ringparam(struct net_device *netdev,
2421 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending)) 2421 if ((ring->rx_mini_pending) || (ring->rx_jumbo_pending))
2422 return -EINVAL; 2422 return -EINVAL;
2423 2423
2424 if(netif_running(netdev)) 2424 if (netif_running(netdev))
2425 e100_down(nic); 2425 e100_down(nic);
2426 rfds->count = max(ring->rx_pending, rfds->min); 2426 rfds->count = max(ring->rx_pending, rfds->min);
2427 rfds->count = min(rfds->count, rfds->max); 2427 rfds->count = min(rfds->count, rfds->max);
@@ -2429,7 +2429,7 @@ static int e100_set_ringparam(struct net_device *netdev,
2429 cbs->count = min(cbs->count, cbs->max); 2429 cbs->count = min(cbs->count, cbs->max);
2430 DPRINTK(DRV, INFO, "Ring Param settings: rx: %d, tx %d\n", 2430 DPRINTK(DRV, INFO, "Ring Param settings: rx: %d, tx %d\n",
2431 rfds->count, cbs->count); 2431 rfds->count, cbs->count);
2432 if(netif_running(netdev)) 2432 if (netif_running(netdev))
2433 e100_up(nic); 2433 e100_up(nic);
2434 2434
2435 return 0; 2435 return 0;
@@ -2454,12 +2454,12 @@ static void e100_diag_test(struct net_device *netdev,
2454 memset(data, 0, E100_TEST_LEN * sizeof(u64)); 2454 memset(data, 0, E100_TEST_LEN * sizeof(u64));
2455 data[0] = !mii_link_ok(&nic->mii); 2455 data[0] = !mii_link_ok(&nic->mii);
2456 data[1] = e100_eeprom_load(nic); 2456 data[1] = e100_eeprom_load(nic);
2457 if(test->flags & ETH_TEST_FL_OFFLINE) { 2457 if (test->flags & ETH_TEST_FL_OFFLINE) {
2458 2458
2459 /* save speed, duplex & autoneg settings */ 2459 /* save speed, duplex & autoneg settings */
2460 err = mii_ethtool_gset(&nic->mii, &cmd); 2460 err = mii_ethtool_gset(&nic->mii, &cmd);
2461 2461
2462 if(netif_running(netdev)) 2462 if (netif_running(netdev))
2463 e100_down(nic); 2463 e100_down(nic);
2464 data[2] = e100_self_test(nic); 2464 data[2] = e100_self_test(nic);
2465 data[3] = e100_loopback_test(nic, lb_mac); 2465 data[3] = e100_loopback_test(nic, lb_mac);
@@ -2468,10 +2468,10 @@ static void e100_diag_test(struct net_device *netdev,
2468 /* restore speed, duplex & autoneg settings */ 2468 /* restore speed, duplex & autoneg settings */
2469 err = mii_ethtool_sset(&nic->mii, &cmd); 2469 err = mii_ethtool_sset(&nic->mii, &cmd);
2470 2470
2471 if(netif_running(netdev)) 2471 if (netif_running(netdev))
2472 e100_up(nic); 2472 e100_up(nic);
2473 } 2473 }
2474 for(i = 0; i < E100_TEST_LEN; i++) 2474 for (i = 0; i < E100_TEST_LEN; i++)
2475 test->flags |= data[i] ? ETH_TEST_FL_FAILED : 0; 2475 test->flags |= data[i] ? ETH_TEST_FL_FAILED : 0;
2476 2476
2477 msleep_interruptible(4 * 1000); 2477 msleep_interruptible(4 * 1000);
@@ -2481,7 +2481,7 @@ static int e100_phys_id(struct net_device *netdev, u32 data)
2481{ 2481{
2482 struct nic *nic = netdev_priv(netdev); 2482 struct nic *nic = netdev_priv(netdev);
2483 2483
2484 if(!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) 2484 if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ))
2485 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); 2485 data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ);
2486 mod_timer(&nic->blink_timer, jiffies); 2486 mod_timer(&nic->blink_timer, jiffies);
2487 msleep_interruptible(data * 1000); 2487 msleep_interruptible(data * 1000);
@@ -2524,7 +2524,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
2524 struct nic *nic = netdev_priv(netdev); 2524 struct nic *nic = netdev_priv(netdev);
2525 int i; 2525 int i;
2526 2526
2527 for(i = 0; i < E100_NET_STATS_LEN; i++) 2527 for (i = 0; i < E100_NET_STATS_LEN; i++)
2528 data[i] = ((unsigned long *)&netdev->stats)[i]; 2528 data[i] = ((unsigned long *)&netdev->stats)[i];
2529 2529
2530 data[i++] = nic->tx_deferred; 2530 data[i++] = nic->tx_deferred;
@@ -2539,7 +2539,7 @@ static void e100_get_ethtool_stats(struct net_device *netdev,
2539 2539
2540static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data) 2540static void e100_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
2541{ 2541{
2542 switch(stringset) { 2542 switch (stringset) {
2543 case ETH_SS_TEST: 2543 case ETH_SS_TEST:
2544 memcpy(data, *e100_gstrings_test, sizeof(e100_gstrings_test)); 2544 memcpy(data, *e100_gstrings_test, sizeof(e100_gstrings_test));
2545 break; 2545 break;
@@ -2589,7 +2589,7 @@ static int e100_alloc(struct nic *nic)
2589 2589
2590static void e100_free(struct nic *nic) 2590static void e100_free(struct nic *nic)
2591{ 2591{
2592 if(nic->mem) { 2592 if (nic->mem) {
2593 pci_free_consistent(nic->pdev, sizeof(struct mem), 2593 pci_free_consistent(nic->pdev, sizeof(struct mem),
2594 nic->mem, nic->dma_addr); 2594 nic->mem, nic->dma_addr);
2595 nic->mem = NULL; 2595 nic->mem = NULL;
@@ -2602,7 +2602,7 @@ static int e100_open(struct net_device *netdev)
2602 int err = 0; 2602 int err = 0;
2603 2603
2604 netif_carrier_off(netdev); 2604 netif_carrier_off(netdev);
2605 if((err = e100_up(nic))) 2605 if ((err = e100_up(nic)))
2606 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n"); 2606 DPRINTK(IFUP, ERR, "Cannot open interface, aborting.\n");
2607 return err; 2607 return err;
2608} 2608}
@@ -2635,8 +2635,8 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2635 struct nic *nic; 2635 struct nic *nic;
2636 int err; 2636 int err;
2637 2637
2638 if(!(netdev = alloc_etherdev(sizeof(struct nic)))) { 2638 if (!(netdev = alloc_etherdev(sizeof(struct nic)))) {
2639 if(((1 << debug) - 1) & NETIF_MSG_PROBE) 2639 if (((1 << debug) - 1) & NETIF_MSG_PROBE)
2640 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n"); 2640 printk(KERN_ERR PFX "Etherdev alloc failed, abort.\n");
2641 return -ENOMEM; 2641 return -ENOMEM;
2642 } 2642 }
@@ -2653,24 +2653,24 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2653 nic->msg_enable = (1 << debug) - 1; 2653 nic->msg_enable = (1 << debug) - 1;
2654 pci_set_drvdata(pdev, netdev); 2654 pci_set_drvdata(pdev, netdev);
2655 2655
2656 if((err = pci_enable_device(pdev))) { 2656 if ((err = pci_enable_device(pdev))) {
2657 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n"); 2657 DPRINTK(PROBE, ERR, "Cannot enable PCI device, aborting.\n");
2658 goto err_out_free_dev; 2658 goto err_out_free_dev;
2659 } 2659 }
2660 2660
2661 if(!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) { 2661 if (!(pci_resource_flags(pdev, 0) & IORESOURCE_MEM)) {
2662 DPRINTK(PROBE, ERR, "Cannot find proper PCI device " 2662 DPRINTK(PROBE, ERR, "Cannot find proper PCI device "
2663 "base address, aborting.\n"); 2663 "base address, aborting.\n");
2664 err = -ENODEV; 2664 err = -ENODEV;
2665 goto err_out_disable_pdev; 2665 goto err_out_disable_pdev;
2666 } 2666 }
2667 2667
2668 if((err = pci_request_regions(pdev, DRV_NAME))) { 2668 if ((err = pci_request_regions(pdev, DRV_NAME))) {
2669 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n"); 2669 DPRINTK(PROBE, ERR, "Cannot obtain PCI resources, aborting.\n");
2670 goto err_out_disable_pdev; 2670 goto err_out_disable_pdev;
2671 } 2671 }
2672 2672
2673 if((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) { 2673 if ((err = pci_set_dma_mask(pdev, DMA_32BIT_MASK))) {
2674 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n"); 2674 DPRINTK(PROBE, ERR, "No usable DMA configuration, aborting.\n");
2675 goto err_out_free_res; 2675 goto err_out_free_res;
2676 } 2676 }
@@ -2681,13 +2681,13 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2681 DPRINTK(PROBE, INFO, "using i/o access mode\n"); 2681 DPRINTK(PROBE, INFO, "using i/o access mode\n");
2682 2682
2683 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr)); 2683 nic->csr = pci_iomap(pdev, (use_io ? 1 : 0), sizeof(struct csr));
2684 if(!nic->csr) { 2684 if (!nic->csr) {
2685 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n"); 2685 DPRINTK(PROBE, ERR, "Cannot map device registers, aborting.\n");
2686 err = -ENOMEM; 2686 err = -ENOMEM;
2687 goto err_out_free_res; 2687 goto err_out_free_res;
2688 } 2688 }
2689 2689
2690 if(ent->driver_data) 2690 if (ent->driver_data)
2691 nic->flags |= ich; 2691 nic->flags |= ich;
2692 else 2692 else
2693 nic->flags &= ~ich; 2693 nic->flags &= ~ich;
@@ -2715,12 +2715,12 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2715 2715
2716 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task); 2716 INIT_WORK(&nic->tx_timeout_task, e100_tx_timeout_task);
2717 2717
2718 if((err = e100_alloc(nic))) { 2718 if ((err = e100_alloc(nic))) {
2719 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n"); 2719 DPRINTK(PROBE, ERR, "Cannot alloc driver memory, aborting.\n");
2720 goto err_out_iounmap; 2720 goto err_out_iounmap;
2721 } 2721 }
2722 2722
2723 if((err = e100_eeprom_load(nic))) 2723 if ((err = e100_eeprom_load(nic)))
2724 goto err_out_free; 2724 goto err_out_free;
2725 2725
2726 e100_phy_init(nic); 2726 e100_phy_init(nic);
@@ -2740,7 +2740,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2740 } 2740 }
2741 2741
2742 /* Wol magic packet can be enabled from eeprom */ 2742 /* Wol magic packet can be enabled from eeprom */
2743 if((nic->mac >= mac_82558_D101_A4) && 2743 if ((nic->mac >= mac_82558_D101_A4) &&
2744 (nic->eeprom[eeprom_id] & eeprom_id_wol)) { 2744 (nic->eeprom[eeprom_id] & eeprom_id_wol)) {
2745 nic->flags |= wol_magic; 2745 nic->flags |= wol_magic;
2746 device_set_wakeup_enable(&pdev->dev, true); 2746 device_set_wakeup_enable(&pdev->dev, true);
@@ -2750,7 +2750,7 @@ static int __devinit e100_probe(struct pci_dev *pdev,
2750 pci_pme_active(pdev, false); 2750 pci_pme_active(pdev, false);
2751 2751
2752 strcpy(netdev->name, "eth%d"); 2752 strcpy(netdev->name, "eth%d");
2753 if((err = register_netdev(netdev))) { 2753 if ((err = register_netdev(netdev))) {
2754 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n"); 2754 DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
2755 goto err_out_free; 2755 goto err_out_free;
2756 } 2756 }
@@ -2779,7 +2779,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
2779{ 2779{
2780 struct net_device *netdev = pci_get_drvdata(pdev); 2780 struct net_device *netdev = pci_get_drvdata(pdev);
2781 2781
2782 if(netdev) { 2782 if (netdev) {
2783 struct nic *nic = netdev_priv(netdev); 2783 struct nic *nic = netdev_priv(netdev);
2784 unregister_netdev(netdev); 2784 unregister_netdev(netdev);
2785 e100_free(nic); 2785 e100_free(nic);
@@ -2932,7 +2932,7 @@ static struct pci_driver e100_driver = {
2932 2932
2933static int __init e100_init_module(void) 2933static int __init e100_init_module(void)
2934{ 2934{
2935 if(((1 << debug) - 1) & NETIF_MSG_DRV) { 2935 if (((1 << debug) - 1) & NETIF_MSG_DRV) {
2936 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION); 2936 printk(KERN_INFO PFX "%s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
2937 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT); 2937 printk(KERN_INFO PFX "%s\n", DRV_COPYRIGHT);
2938 } 2938 }
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index 9930d5f8b9e1..6271b9411ccf 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -478,7 +478,7 @@ struct ehea_port {
478 int num_add_tx_qps; 478 int num_add_tx_qps;
479 int num_mcs; 479 int num_mcs;
480 int resets; 480 int resets;
481 u64 flags; 481 unsigned long flags;
482 u64 mac_addr; 482 u64 mac_addr;
483 u32 logical_port_id; 483 u32 logical_port_id;
484 u32 port_speed; 484 u32 port_speed;
@@ -510,7 +510,6 @@ void ehea_set_ethtool_ops(struct net_device *netdev);
510int ehea_sense_port_attr(struct ehea_port *port); 510int ehea_sense_port_attr(struct ehea_port *port);
511int ehea_set_portspeed(struct ehea_port *port, u32 port_speed); 511int ehea_set_portspeed(struct ehea_port *port, u32 port_speed);
512 512
513extern u64 ehea_driver_flags;
514extern struct work_struct ehea_rereg_mr_task; 513extern struct work_struct ehea_rereg_mr_task;
515 514
516#endif /* __EHEA_H__ */ 515#endif /* __EHEA_H__ */
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index a2f1905a23df..e3131ea629cd 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -99,7 +99,7 @@ MODULE_PARM_DESC(use_lro, " Large Receive Offload, 1: enable, 0: disable, "
99 99
100static int port_name_cnt; 100static int port_name_cnt;
101static LIST_HEAD(adapter_list); 101static LIST_HEAD(adapter_list);
102u64 ehea_driver_flags; 102static unsigned long ehea_driver_flags;
103struct work_struct ehea_rereg_mr_task; 103struct work_struct ehea_rereg_mr_task;
104static DEFINE_MUTEX(dlpar_mem_lock); 104static DEFINE_MUTEX(dlpar_mem_lock);
105struct ehea_fw_handle_array ehea_fw_handles; 105struct ehea_fw_handle_array ehea_fw_handles;
diff --git a/drivers/net/enc28j60.c b/drivers/net/enc28j60.c
index b0ef46c51a9d..cefe1d98f93e 100644
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -944,7 +944,7 @@ static void enc28j60_hw_rx(struct net_device *ndev)
944 if (netif_msg_rx_status(priv)) 944 if (netif_msg_rx_status(priv))
945 enc28j60_dump_rsv(priv, __func__, next_packet, len, rxstat); 945 enc28j60_dump_rsv(priv, __func__, next_packet, len, rxstat);
946 946
947 if (!RSV_GETBIT(rxstat, RSV_RXOK)) { 947 if (!RSV_GETBIT(rxstat, RSV_RXOK) || len > MAX_FRAMELEN) {
948 if (netif_msg_rx_err(priv)) 948 if (netif_msg_rx_err(priv))
949 dev_err(&ndev->dev, "Rx Error (%04x)\n", rxstat); 949 dev_err(&ndev->dev, "Rx Error (%04x)\n", rxstat);
950 ndev->stats.rx_errors++; 950 ndev->stats.rx_errors++;
@@ -952,6 +952,8 @@ static void enc28j60_hw_rx(struct net_device *ndev)
952 ndev->stats.rx_crc_errors++; 952 ndev->stats.rx_crc_errors++;
953 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR)) 953 if (RSV_GETBIT(rxstat, RSV_LENCHECKERR))
954 ndev->stats.rx_frame_errors++; 954 ndev->stats.rx_frame_errors++;
955 if (len > MAX_FRAMELEN)
956 ndev->stats.rx_over_errors++;
955 } else { 957 } else {
956 skb = dev_alloc_skb(len + NET_IP_ALIGN); 958 skb = dev_alloc_skb(len + NET_IP_ALIGN);
957 if (!skb) { 959 if (!skb) {
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index 022794e579c7..b82b0fb2056c 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -1457,8 +1457,8 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
1457 1457
1458 /* Number of supported queues. */ 1458 /* Number of supported queues. */
1459 /* Having more queues than CPUs doesn't make sense. */ 1459 /* Having more queues than CPUs doesn't make sense. */
1460 adapter->num_rx_queues = min((u32)IGB_MAX_RX_QUEUES, (u32)num_online_cpus()); 1460 adapter->num_rx_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
1461 adapter->num_tx_queues = min(IGB_MAX_TX_QUEUES, num_online_cpus()); 1461 adapter->num_tx_queues = min_t(u32, IGB_MAX_TX_QUEUES, num_online_cpus());
1462 1462
1463 /* This call may decrease the number of queues depending on 1463 /* This call may decrease the number of queues depending on
1464 * interrupt mode. */ 1464 * interrupt mode. */
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 5e70180bf569..6bb71b687f7b 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -75,7 +75,7 @@
75#include "myri10ge_mcp.h" 75#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 76#include "myri10ge_mcp_gen_header.h"
77 77
78#define MYRI10GE_VERSION_STR "1.4.4-1.395" 78#define MYRI10GE_VERSION_STR "1.4.4-1.398"
79 79
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 81MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -3929,6 +3929,10 @@ abort_with_firmware:
3929 myri10ge_dummy_rdma(mgp, 0); 3929 myri10ge_dummy_rdma(mgp, 0);
3930 3930
3931abort_with_ioremap: 3931abort_with_ioremap:
3932 if (mgp->mac_addr_string != NULL)
3933 dev_err(&pdev->dev,
3934 "myri10ge_probe() failed: MAC=%s, SN=%ld\n",
3935 mgp->mac_addr_string, mgp->serial_number);
3932 iounmap(mgp->sram); 3936 iounmap(mgp->sram);
3933 3937
3934abort_with_mtrr: 3938abort_with_mtrr:
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h
index ba2e1c5b6bcf..459663a4023d 100644
--- a/drivers/net/qlge/qlge.h
+++ b/drivers/net/qlge/qlge.h
@@ -818,15 +818,6 @@ struct tx_doorbell_context {
818}; 818};
819 819
820/* DATA STRUCTURES SHARED WITH HARDWARE. */ 820/* DATA STRUCTURES SHARED WITH HARDWARE. */
821
822struct bq_element {
823 u32 addr_lo;
824#define BQ_END 0x00000001
825#define BQ_CONT 0x00000002
826#define BQ_MASK 0x00000003
827 u32 addr_hi;
828} __attribute((packed));
829
830struct tx_buf_desc { 821struct tx_buf_desc {
831 __le64 addr; 822 __le64 addr;
832 __le32 len; 823 __le32 len;
@@ -860,8 +851,8 @@ struct ob_mac_iocb_req {
860 __le16 frame_len; 851 __le16 frame_len;
861#define OB_MAC_IOCB_LEN_MASK 0x3ffff 852#define OB_MAC_IOCB_LEN_MASK 0x3ffff
862 __le16 reserved2; 853 __le16 reserved2;
863 __le32 tid; 854 u32 tid;
864 __le32 txq_idx; 855 u32 txq_idx;
865 __le32 reserved3; 856 __le32 reserved3;
866 __le16 vlan_tci; 857 __le16 vlan_tci;
867 __le16 reserved4; 858 __le16 reserved4;
@@ -880,8 +871,8 @@ struct ob_mac_iocb_rsp {
880 u8 flags2; /* */ 871 u8 flags2; /* */
881 u8 flags3; /* */ 872 u8 flags3; /* */
882#define OB_MAC_IOCB_RSP_B 0x80 /* */ 873#define OB_MAC_IOCB_RSP_B 0x80 /* */
883 __le32 tid; 874 u32 tid;
884 __le32 txq_idx; 875 u32 txq_idx;
885 __le32 reserved[13]; 876 __le32 reserved[13];
886} __attribute((packed)); 877} __attribute((packed));
887 878
@@ -903,8 +894,8 @@ struct ob_mac_tso_iocb_req {
903#define OB_MAC_TSO_IOCB_V 0x04 894#define OB_MAC_TSO_IOCB_V 0x04
904 __le32 reserved1[2]; 895 __le32 reserved1[2];
905 __le32 frame_len; 896 __le32 frame_len;
906 __le32 tid; 897 u32 tid;
907 __le32 txq_idx; 898 u32 txq_idx;
908 __le16 total_hdrs_len; 899 __le16 total_hdrs_len;
909 __le16 net_trans_offset; 900 __le16 net_trans_offset;
910#define OB_MAC_TRANSPORT_HDR_SHIFT 6 901#define OB_MAC_TRANSPORT_HDR_SHIFT 6
@@ -925,8 +916,8 @@ struct ob_mac_tso_iocb_rsp {
925 u8 flags2; /* */ 916 u8 flags2; /* */
926 u8 flags3; /* */ 917 u8 flags3; /* */
927#define OB_MAC_TSO_IOCB_RSP_B 0x8000 918#define OB_MAC_TSO_IOCB_RSP_B 0x8000
928 __le32 tid; 919 u32 tid;
929 __le32 txq_idx; 920 u32 txq_idx;
930 __le32 reserved2[13]; 921 __le32 reserved2[13];
931} __attribute((packed)); 922} __attribute((packed));
932 923
@@ -979,10 +970,11 @@ struct ib_mac_iocb_rsp {
979 970
980 __le16 reserved1; 971 __le16 reserved1;
981 __le32 reserved2[6]; 972 __le32 reserved2[6];
982 __le32 flags4; 973 u8 reserved3[3];
983#define IB_MAC_IOCB_RSP_HV 0x20000000 /* */ 974 u8 flags4;
984#define IB_MAC_IOCB_RSP_HS 0x40000000 /* */ 975#define IB_MAC_IOCB_RSP_HV 0x20
985#define IB_MAC_IOCB_RSP_HL 0x80000000 /* */ 976#define IB_MAC_IOCB_RSP_HS 0x40
977#define IB_MAC_IOCB_RSP_HL 0x80
986 __le32 hdr_len; /* */ 978 __le32 hdr_len; /* */
987 __le32 hdr_addr_lo; /* */ 979 __le32 hdr_addr_lo; /* */
988 __le32 hdr_addr_hi; /* */ 980 __le32 hdr_addr_hi; /* */
@@ -1126,7 +1118,7 @@ struct map_list {
1126struct tx_ring_desc { 1118struct tx_ring_desc {
1127 struct sk_buff *skb; 1119 struct sk_buff *skb;
1128 struct ob_mac_iocb_req *queue_entry; 1120 struct ob_mac_iocb_req *queue_entry;
1129 int index; 1121 u32 index;
1130 struct oal oal; 1122 struct oal oal;
1131 struct map_list map[MAX_SKB_FRAGS + 1]; 1123 struct map_list map[MAX_SKB_FRAGS + 1];
1132 int map_cnt; 1124 int map_cnt;
@@ -1138,8 +1130,8 @@ struct bq_desc {
1138 struct page *lbq_page; 1130 struct page *lbq_page;
1139 struct sk_buff *skb; 1131 struct sk_buff *skb;
1140 } p; 1132 } p;
1141 struct bq_element *bq; 1133 __le64 *addr;
1142 int index; 1134 u32 index;
1143 DECLARE_PCI_UNMAP_ADDR(mapaddr); 1135 DECLARE_PCI_UNMAP_ADDR(mapaddr);
1144 DECLARE_PCI_UNMAP_LEN(maplen); 1136 DECLARE_PCI_UNMAP_LEN(maplen);
1145}; 1137};
@@ -1189,7 +1181,7 @@ struct rx_ring {
1189 u32 cq_size; 1181 u32 cq_size;
1190 u32 cq_len; 1182 u32 cq_len;
1191 u16 cq_id; 1183 u16 cq_id;
1192 u32 *prod_idx_sh_reg; /* Shadowed producer register. */ 1184 volatile __le32 *prod_idx_sh_reg; /* Shadowed producer register. */
1193 dma_addr_t prod_idx_sh_reg_dma; 1185 dma_addr_t prod_idx_sh_reg_dma;
1194 void __iomem *cnsmr_idx_db_reg; /* PCI doorbell mem area + 0 */ 1186 void __iomem *cnsmr_idx_db_reg; /* PCI doorbell mem area + 0 */
1195 u32 cnsmr_idx; /* current sw idx */ 1187 u32 cnsmr_idx; /* current sw idx */
@@ -1467,21 +1459,6 @@ static inline void ql_write_db_reg(u32 val, void __iomem *addr)
1467 mmiowb(); 1459 mmiowb();
1468} 1460}
1469 1461
1470/*
1471 * Shadow Registers:
1472 * Outbound queues have a consumer index that is maintained by the chip.
1473 * Inbound queues have a producer index that is maintained by the chip.
1474 * For lower overhead, these registers are "shadowed" to host memory
1475 * which allows the device driver to track the queue progress without
1476 * PCI reads. When an entry is placed on an inbound queue, the chip will
1477 * update the relevant index register and then copy the value to the
1478 * shadow register in host memory.
1479 */
1480static inline unsigned int ql_read_sh_reg(const volatile void *addr)
1481{
1482 return *(volatile unsigned int __force *)addr;
1483}
1484
1485extern char qlge_driver_name[]; 1462extern char qlge_driver_name[];
1486extern const char qlge_driver_version[]; 1463extern const char qlge_driver_version[];
1487extern const struct ethtool_ops qlge_ethtool_ops; 1464extern const struct ethtool_ops qlge_ethtool_ops;
diff --git a/drivers/net/qlge/qlge_dbg.c b/drivers/net/qlge/qlge_dbg.c
index 47df304a02c8..3f5e02d2e4a9 100644
--- a/drivers/net/qlge/qlge_dbg.c
+++ b/drivers/net/qlge/qlge_dbg.c
@@ -821,14 +821,11 @@ void ql_dump_ib_mac_rsp(struct ib_mac_iocb_rsp *ib_mac_rsp)
821 le16_to_cpu(ib_mac_rsp->vlan_id)); 821 le16_to_cpu(ib_mac_rsp->vlan_id));
822 822
823 printk(KERN_ERR PFX "flags4 = %s%s%s.\n", 823 printk(KERN_ERR PFX "flags4 = %s%s%s.\n",
824 le32_to_cpu(ib_mac_rsp-> 824 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV ? "HV " : "",
825 flags4) & IB_MAC_IOCB_RSP_HV ? "HV " : "", 825 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HS ? "HS " : "",
826 le32_to_cpu(ib_mac_rsp-> 826 ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HL ? "HL " : "");
827 flags4) & IB_MAC_IOCB_RSP_HS ? "HS " : "", 827
828 le32_to_cpu(ib_mac_rsp-> 828 if (ib_mac_rsp->flags4 & IB_MAC_IOCB_RSP_HV) {
829 flags4) & IB_MAC_IOCB_RSP_HL ? "HL " : "");
830
831 if (le32_to_cpu(ib_mac_rsp->flags4) & IB_MAC_IOCB_RSP_HV) {
832 printk(KERN_ERR PFX "hdr length = %d.\n", 829 printk(KERN_ERR PFX "hdr length = %d.\n",
833 le32_to_cpu(ib_mac_rsp->hdr_len)); 830 le32_to_cpu(ib_mac_rsp->hdr_len));
834 printk(KERN_ERR PFX "hdr addr_hi = 0x%x.\n", 831 printk(KERN_ERR PFX "hdr addr_hi = 0x%x.\n",
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c
index eefb81b13758..9d922e2ff226 100644
--- a/drivers/net/qlge/qlge_ethtool.c
+++ b/drivers/net/qlge/qlge_ethtool.c
@@ -56,9 +56,9 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev)
56 for (i = 1; i < qdev->rss_ring_first_cq_id; i++, rx_ring++) { 56 for (i = 1; i < qdev->rss_ring_first_cq_id; i++, rx_ring++) {
57 rx_ring = &qdev->rx_ring[i]; 57 rx_ring = &qdev->rx_ring[i];
58 cqicb = (struct cqicb *)rx_ring; 58 cqicb = (struct cqicb *)rx_ring;
59 cqicb->irq_delay = le16_to_cpu(qdev->tx_coalesce_usecs); 59 cqicb->irq_delay = cpu_to_le16(qdev->tx_coalesce_usecs);
60 cqicb->pkt_delay = 60 cqicb->pkt_delay =
61 le16_to_cpu(qdev->tx_max_coalesced_frames); 61 cpu_to_le16(qdev->tx_max_coalesced_frames);
62 cqicb->flags = FLAGS_LI; 62 cqicb->flags = FLAGS_LI;
63 status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), 63 status = ql_write_cfg(qdev, cqicb, sizeof(cqicb),
64 CFG_LCQ, rx_ring->cq_id); 64 CFG_LCQ, rx_ring->cq_id);
@@ -79,9 +79,9 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev)
79 i++) { 79 i++) {
80 rx_ring = &qdev->rx_ring[i]; 80 rx_ring = &qdev->rx_ring[i];
81 cqicb = (struct cqicb *)rx_ring; 81 cqicb = (struct cqicb *)rx_ring;
82 cqicb->irq_delay = le16_to_cpu(qdev->rx_coalesce_usecs); 82 cqicb->irq_delay = cpu_to_le16(qdev->rx_coalesce_usecs);
83 cqicb->pkt_delay = 83 cqicb->pkt_delay =
84 le16_to_cpu(qdev->rx_max_coalesced_frames); 84 cpu_to_le16(qdev->rx_max_coalesced_frames);
85 cqicb->flags = FLAGS_LI; 85 cqicb->flags = FLAGS_LI;
86 status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), 86 status = ql_write_cfg(qdev, cqicb, sizeof(cqicb),
87 CFG_LCQ, rx_ring->cq_id); 87 CFG_LCQ, rx_ring->cq_id);
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
index 718a7bd0cd1a..f4c016012f18 100644
--- a/drivers/net/qlge/qlge_main.c
+++ b/drivers/net/qlge/qlge_main.c
@@ -257,7 +257,7 @@ int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index,
257 { 257 {
258 status = 258 status =
259 ql_wait_reg_rdy(qdev, 259 ql_wait_reg_rdy(qdev,
260 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 260 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
261 if (status) 261 if (status)
262 goto exit; 262 goto exit;
263 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */ 263 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */
@@ -265,13 +265,13 @@ int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index,
265 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */ 265 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */
266 status = 266 status =
267 ql_wait_reg_rdy(qdev, 267 ql_wait_reg_rdy(qdev,
268 MAC_ADDR_IDX, MAC_ADDR_MR, MAC_ADDR_E); 268 MAC_ADDR_IDX, MAC_ADDR_MR, 0);
269 if (status) 269 if (status)
270 goto exit; 270 goto exit;
271 *value++ = ql_read32(qdev, MAC_ADDR_DATA); 271 *value++ = ql_read32(qdev, MAC_ADDR_DATA);
272 status = 272 status =
273 ql_wait_reg_rdy(qdev, 273 ql_wait_reg_rdy(qdev,
274 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 274 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
275 if (status) 275 if (status)
276 goto exit; 276 goto exit;
277 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */ 277 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */
@@ -279,14 +279,14 @@ int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index,
279 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */ 279 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */
280 status = 280 status =
281 ql_wait_reg_rdy(qdev, 281 ql_wait_reg_rdy(qdev,
282 MAC_ADDR_IDX, MAC_ADDR_MR, MAC_ADDR_E); 282 MAC_ADDR_IDX, MAC_ADDR_MR, 0);
283 if (status) 283 if (status)
284 goto exit; 284 goto exit;
285 *value++ = ql_read32(qdev, MAC_ADDR_DATA); 285 *value++ = ql_read32(qdev, MAC_ADDR_DATA);
286 if (type == MAC_ADDR_TYPE_CAM_MAC) { 286 if (type == MAC_ADDR_TYPE_CAM_MAC) {
287 status = 287 status =
288 ql_wait_reg_rdy(qdev, 288 ql_wait_reg_rdy(qdev,
289 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 289 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
290 if (status) 290 if (status)
291 goto exit; 291 goto exit;
292 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */ 292 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */
@@ -294,7 +294,7 @@ int ql_get_mac_addr_reg(struct ql_adapter *qdev, u32 type, u16 index,
294 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */ 294 MAC_ADDR_ADR | MAC_ADDR_RS | type); /* type */
295 status = 295 status =
296 ql_wait_reg_rdy(qdev, MAC_ADDR_IDX, 296 ql_wait_reg_rdy(qdev, MAC_ADDR_IDX,
297 MAC_ADDR_MR, MAC_ADDR_E); 297 MAC_ADDR_MR, 0);
298 if (status) 298 if (status)
299 goto exit; 299 goto exit;
300 *value++ = ql_read32(qdev, MAC_ADDR_DATA); 300 *value++ = ql_read32(qdev, MAC_ADDR_DATA);
@@ -344,7 +344,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
344 344
345 status = 345 status =
346 ql_wait_reg_rdy(qdev, 346 ql_wait_reg_rdy(qdev,
347 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 347 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
348 if (status) 348 if (status)
349 goto exit; 349 goto exit;
350 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */ 350 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */
@@ -353,7 +353,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
353 ql_write32(qdev, MAC_ADDR_DATA, lower); 353 ql_write32(qdev, MAC_ADDR_DATA, lower);
354 status = 354 status =
355 ql_wait_reg_rdy(qdev, 355 ql_wait_reg_rdy(qdev,
356 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 356 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
357 if (status) 357 if (status)
358 goto exit; 358 goto exit;
359 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */ 359 ql_write32(qdev, MAC_ADDR_IDX, (offset++) | /* offset */
@@ -362,7 +362,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
362 ql_write32(qdev, MAC_ADDR_DATA, upper); 362 ql_write32(qdev, MAC_ADDR_DATA, upper);
363 status = 363 status =
364 ql_wait_reg_rdy(qdev, 364 ql_wait_reg_rdy(qdev,
365 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 365 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
366 if (status) 366 if (status)
367 goto exit; 367 goto exit;
368 ql_write32(qdev, MAC_ADDR_IDX, (offset) | /* offset */ 368 ql_write32(qdev, MAC_ADDR_IDX, (offset) | /* offset */
@@ -400,7 +400,7 @@ static int ql_set_mac_addr_reg(struct ql_adapter *qdev, u8 *addr, u32 type,
400 400
401 status = 401 status =
402 ql_wait_reg_rdy(qdev, 402 ql_wait_reg_rdy(qdev,
403 MAC_ADDR_IDX, MAC_ADDR_MW, MAC_ADDR_E); 403 MAC_ADDR_IDX, MAC_ADDR_MW, 0);
404 if (status) 404 if (status)
405 goto exit; 405 goto exit;
406 ql_write32(qdev, MAC_ADDR_IDX, offset | /* offset */ 406 ql_write32(qdev, MAC_ADDR_IDX, offset | /* offset */
@@ -431,13 +431,13 @@ int ql_get_routing_reg(struct ql_adapter *qdev, u32 index, u32 *value)
431 if (status) 431 if (status)
432 goto exit; 432 goto exit;
433 433
434 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, RT_IDX_E); 434 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MW, 0);
435 if (status) 435 if (status)
436 goto exit; 436 goto exit;
437 437
438 ql_write32(qdev, RT_IDX, 438 ql_write32(qdev, RT_IDX,
439 RT_IDX_TYPE_NICQ | RT_IDX_RS | (index << RT_IDX_IDX_SHIFT)); 439 RT_IDX_TYPE_NICQ | RT_IDX_RS | (index << RT_IDX_IDX_SHIFT));
440 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MR, RT_IDX_E); 440 status = ql_wait_reg_rdy(qdev, RT_IDX, RT_IDX_MR, 0);
441 if (status) 441 if (status)
442 goto exit; 442 goto exit;
443 *value = ql_read32(qdev, RT_DATA); 443 *value = ql_read32(qdev, RT_DATA);
@@ -874,7 +874,6 @@ static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
874{ 874{
875 int clean_idx = rx_ring->lbq_clean_idx; 875 int clean_idx = rx_ring->lbq_clean_idx;
876 struct bq_desc *lbq_desc; 876 struct bq_desc *lbq_desc;
877 struct bq_element *bq;
878 u64 map; 877 u64 map;
879 int i; 878 int i;
880 879
@@ -884,7 +883,6 @@ static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
884 "lbq: try cleaning clean_idx = %d.\n", 883 "lbq: try cleaning clean_idx = %d.\n",
885 clean_idx); 884 clean_idx);
886 lbq_desc = &rx_ring->lbq[clean_idx]; 885 lbq_desc = &rx_ring->lbq[clean_idx];
887 bq = lbq_desc->bq;
888 if (lbq_desc->p.lbq_page == NULL) { 886 if (lbq_desc->p.lbq_page == NULL) {
889 QPRINTK(qdev, RX_STATUS, DEBUG, 887 QPRINTK(qdev, RX_STATUS, DEBUG,
890 "lbq: getting new page for index %d.\n", 888 "lbq: getting new page for index %d.\n",
@@ -906,10 +904,7 @@ static void ql_update_lbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
906 } 904 }
907 pci_unmap_addr_set(lbq_desc, mapaddr, map); 905 pci_unmap_addr_set(lbq_desc, mapaddr, map);
908 pci_unmap_len_set(lbq_desc, maplen, PAGE_SIZE); 906 pci_unmap_len_set(lbq_desc, maplen, PAGE_SIZE);
909 bq->addr_lo = /*lbq_desc->addr_lo = */ 907 *lbq_desc->addr = cpu_to_le64(map);
910 cpu_to_le32(map);
911 bq->addr_hi = /*lbq_desc->addr_hi = */
912 cpu_to_le32(map >> 32);
913 } 908 }
914 clean_idx++; 909 clean_idx++;
915 if (clean_idx == rx_ring->lbq_len) 910 if (clean_idx == rx_ring->lbq_len)
@@ -934,7 +929,6 @@ static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
934{ 929{
935 int clean_idx = rx_ring->sbq_clean_idx; 930 int clean_idx = rx_ring->sbq_clean_idx;
936 struct bq_desc *sbq_desc; 931 struct bq_desc *sbq_desc;
937 struct bq_element *bq;
938 u64 map; 932 u64 map;
939 int i; 933 int i;
940 934
@@ -944,7 +938,6 @@ static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
944 QPRINTK(qdev, RX_STATUS, DEBUG, 938 QPRINTK(qdev, RX_STATUS, DEBUG,
945 "sbq: try cleaning clean_idx = %d.\n", 939 "sbq: try cleaning clean_idx = %d.\n",
946 clean_idx); 940 clean_idx);
947 bq = sbq_desc->bq;
948 if (sbq_desc->p.skb == NULL) { 941 if (sbq_desc->p.skb == NULL) {
949 QPRINTK(qdev, RX_STATUS, DEBUG, 942 QPRINTK(qdev, RX_STATUS, DEBUG,
950 "sbq: getting new skb for index %d.\n", 943 "sbq: getting new skb for index %d.\n",
@@ -963,11 +956,15 @@ static void ql_update_sbq(struct ql_adapter *qdev, struct rx_ring *rx_ring)
963 sbq_desc->p.skb->data, 956 sbq_desc->p.skb->data,
964 rx_ring->sbq_buf_size / 957 rx_ring->sbq_buf_size /
965 2, PCI_DMA_FROMDEVICE); 958 2, PCI_DMA_FROMDEVICE);
959 if (pci_dma_mapping_error(qdev->pdev, map)) {
960 QPRINTK(qdev, IFUP, ERR, "PCI mapping failed.\n");
961 rx_ring->sbq_clean_idx = clean_idx;
962 return;
963 }
966 pci_unmap_addr_set(sbq_desc, mapaddr, map); 964 pci_unmap_addr_set(sbq_desc, mapaddr, map);
967 pci_unmap_len_set(sbq_desc, maplen, 965 pci_unmap_len_set(sbq_desc, maplen,
968 rx_ring->sbq_buf_size / 2); 966 rx_ring->sbq_buf_size / 2);
969 bq->addr_lo = cpu_to_le32(map); 967 *sbq_desc->addr = cpu_to_le64(map);
970 bq->addr_hi = cpu_to_le32(map >> 32);
971 } 968 }
972 969
973 clean_idx++; 970 clean_idx++;
@@ -1303,6 +1300,11 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
1303 "No skb available, drop the packet.\n"); 1300 "No skb available, drop the packet.\n");
1304 return NULL; 1301 return NULL;
1305 } 1302 }
1303 pci_unmap_page(qdev->pdev,
1304 pci_unmap_addr(lbq_desc,
1305 mapaddr),
1306 pci_unmap_len(lbq_desc, maplen),
1307 PCI_DMA_FROMDEVICE);
1306 skb_reserve(skb, NET_IP_ALIGN); 1308 skb_reserve(skb, NET_IP_ALIGN);
1307 QPRINTK(qdev, RX_STATUS, DEBUG, 1309 QPRINTK(qdev, RX_STATUS, DEBUG,
1308 "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n", length); 1310 "%d bytes of headers and data in large. Chain page to new skb and pull tail.\n", length);
@@ -1330,7 +1332,7 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
1330 * eventually be in trouble. 1332 * eventually be in trouble.
1331 */ 1333 */
1332 int size, offset, i = 0; 1334 int size, offset, i = 0;
1333 struct bq_element *bq, bq_array[8]; 1335 __le64 *bq, bq_array[8];
1334 sbq_desc = ql_get_curr_sbuf(rx_ring); 1336 sbq_desc = ql_get_curr_sbuf(rx_ring);
1335 pci_unmap_single(qdev->pdev, 1337 pci_unmap_single(qdev->pdev,
1336 pci_unmap_addr(sbq_desc, mapaddr), 1338 pci_unmap_addr(sbq_desc, mapaddr),
@@ -1356,16 +1358,10 @@ static struct sk_buff *ql_build_rx_skb(struct ql_adapter *qdev,
1356 } else { 1358 } else {
1357 QPRINTK(qdev, RX_STATUS, DEBUG, 1359 QPRINTK(qdev, RX_STATUS, DEBUG,
1358 "Headers in small, %d bytes of data in chain of large.\n", length); 1360 "Headers in small, %d bytes of data in chain of large.\n", length);
1359 bq = (struct bq_element *)sbq_desc->p.skb->data; 1361 bq = (__le64 *)sbq_desc->p.skb->data;
1360 } 1362 }
1361 while (length > 0) { 1363 while (length > 0) {
1362 lbq_desc = ql_get_curr_lbuf(rx_ring); 1364 lbq_desc = ql_get_curr_lbuf(rx_ring);
1363 if ((bq->addr_lo & ~BQ_MASK) != lbq_desc->bq->addr_lo) {
1364 QPRINTK(qdev, RX_STATUS, ERR,
1365 "Panic!!! bad large buffer address, expected 0x%.08x, got 0x%.08x.\n",
1366 lbq_desc->bq->addr_lo, bq->addr_lo);
1367 return NULL;
1368 }
1369 pci_unmap_page(qdev->pdev, 1365 pci_unmap_page(qdev->pdev,
1370 pci_unmap_addr(lbq_desc, 1366 pci_unmap_addr(lbq_desc,
1371 mapaddr), 1367 mapaddr),
@@ -1549,7 +1545,7 @@ static void ql_process_chip_ae_intr(struct ql_adapter *qdev,
1549static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring) 1545static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1550{ 1546{
1551 struct ql_adapter *qdev = rx_ring->qdev; 1547 struct ql_adapter *qdev = rx_ring->qdev;
1552 u32 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); 1548 u32 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg);
1553 struct ob_mac_iocb_rsp *net_rsp = NULL; 1549 struct ob_mac_iocb_rsp *net_rsp = NULL;
1554 int count = 0; 1550 int count = 0;
1555 1551
@@ -1575,7 +1571,7 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1575 } 1571 }
1576 count++; 1572 count++;
1577 ql_update_cq(rx_ring); 1573 ql_update_cq(rx_ring);
1578 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); 1574 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg);
1579 } 1575 }
1580 ql_write_cq_idx(rx_ring); 1576 ql_write_cq_idx(rx_ring);
1581 if (netif_queue_stopped(qdev->ndev) && net_rsp != NULL) { 1577 if (netif_queue_stopped(qdev->ndev) && net_rsp != NULL) {
@@ -1595,7 +1591,7 @@ static int ql_clean_outbound_rx_ring(struct rx_ring *rx_ring)
1595static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget) 1591static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget)
1596{ 1592{
1597 struct ql_adapter *qdev = rx_ring->qdev; 1593 struct ql_adapter *qdev = rx_ring->qdev;
1598 u32 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); 1594 u32 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg);
1599 struct ql_net_rsp_iocb *net_rsp; 1595 struct ql_net_rsp_iocb *net_rsp;
1600 int count = 0; 1596 int count = 0;
1601 1597
@@ -1628,7 +1624,7 @@ static int ql_clean_inbound_rx_ring(struct rx_ring *rx_ring, int budget)
1628 } 1624 }
1629 count++; 1625 count++;
1630 ql_update_cq(rx_ring); 1626 ql_update_cq(rx_ring);
1631 prod = ql_read_sh_reg(rx_ring->prod_idx_sh_reg); 1627 prod = le32_to_cpu(*rx_ring->prod_idx_sh_reg);
1632 if (count == budget) 1628 if (count == budget)
1633 break; 1629 break;
1634 } 1630 }
@@ -1791,7 +1787,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
1791 * Check the default queue and wake handler if active. 1787 * Check the default queue and wake handler if active.
1792 */ 1788 */
1793 rx_ring = &qdev->rx_ring[0]; 1789 rx_ring = &qdev->rx_ring[0];
1794 if (ql_read_sh_reg(rx_ring->prod_idx_sh_reg) != rx_ring->cnsmr_idx) { 1790 if (le32_to_cpu(*rx_ring->prod_idx_sh_reg) != rx_ring->cnsmr_idx) {
1795 QPRINTK(qdev, INTR, INFO, "Waking handler for rx_ring[0].\n"); 1791 QPRINTK(qdev, INTR, INFO, "Waking handler for rx_ring[0].\n");
1796 ql_disable_completion_interrupt(qdev, intr_context->intr); 1792 ql_disable_completion_interrupt(qdev, intr_context->intr);
1797 queue_delayed_work_on(smp_processor_id(), qdev->q_workqueue, 1793 queue_delayed_work_on(smp_processor_id(), qdev->q_workqueue,
@@ -1805,7 +1801,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
1805 */ 1801 */
1806 for (i = 1; i < qdev->rx_ring_count; i++) { 1802 for (i = 1; i < qdev->rx_ring_count; i++) {
1807 rx_ring = &qdev->rx_ring[i]; 1803 rx_ring = &qdev->rx_ring[i];
1808 if (ql_read_sh_reg(rx_ring->prod_idx_sh_reg) != 1804 if (le32_to_cpu(*rx_ring->prod_idx_sh_reg) !=
1809 rx_ring->cnsmr_idx) { 1805 rx_ring->cnsmr_idx) {
1810 QPRINTK(qdev, INTR, INFO, 1806 QPRINTK(qdev, INTR, INFO,
1811 "Waking handler for rx_ring[%d].\n", i); 1807 "Waking handler for rx_ring[%d].\n", i);
@@ -1874,7 +1870,7 @@ static void ql_hw_csum_setup(struct sk_buff *skb,
1874{ 1870{
1875 int len; 1871 int len;
1876 struct iphdr *iph = ip_hdr(skb); 1872 struct iphdr *iph = ip_hdr(skb);
1877 u16 *check; 1873 __sum16 *check;
1878 mac_iocb_ptr->opcode = OPCODE_OB_MAC_TSO_IOCB; 1874 mac_iocb_ptr->opcode = OPCODE_OB_MAC_TSO_IOCB;
1879 mac_iocb_ptr->frame_len = cpu_to_le32((u32) skb->len); 1875 mac_iocb_ptr->frame_len = cpu_to_le32((u32) skb->len);
1880 mac_iocb_ptr->net_trans_offset = 1876 mac_iocb_ptr->net_trans_offset =
@@ -2083,8 +2079,6 @@ static void ql_free_lbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring
2083 put_page(lbq_desc->p.lbq_page); 2079 put_page(lbq_desc->p.lbq_page);
2084 lbq_desc->p.lbq_page = NULL; 2080 lbq_desc->p.lbq_page = NULL;
2085 } 2081 }
2086 lbq_desc->bq->addr_lo = 0;
2087 lbq_desc->bq->addr_hi = 0;
2088 } 2082 }
2089} 2083}
2090 2084
@@ -2097,12 +2091,12 @@ static int ql_alloc_lbq_buffers(struct ql_adapter *qdev,
2097 int i; 2091 int i;
2098 struct bq_desc *lbq_desc; 2092 struct bq_desc *lbq_desc;
2099 u64 map; 2093 u64 map;
2100 struct bq_element *bq = rx_ring->lbq_base; 2094 __le64 *bq = rx_ring->lbq_base;
2101 2095
2102 for (i = 0; i < rx_ring->lbq_len; i++) { 2096 for (i = 0; i < rx_ring->lbq_len; i++) {
2103 lbq_desc = &rx_ring->lbq[i]; 2097 lbq_desc = &rx_ring->lbq[i];
2104 memset(lbq_desc, 0, sizeof(lbq_desc)); 2098 memset(lbq_desc, 0, sizeof(lbq_desc));
2105 lbq_desc->bq = bq; 2099 lbq_desc->addr = bq;
2106 lbq_desc->index = i; 2100 lbq_desc->index = i;
2107 lbq_desc->p.lbq_page = alloc_page(GFP_ATOMIC); 2101 lbq_desc->p.lbq_page = alloc_page(GFP_ATOMIC);
2108 if (unlikely(!lbq_desc->p.lbq_page)) { 2102 if (unlikely(!lbq_desc->p.lbq_page)) {
@@ -2119,8 +2113,7 @@ static int ql_alloc_lbq_buffers(struct ql_adapter *qdev,
2119 } 2113 }
2120 pci_unmap_addr_set(lbq_desc, mapaddr, map); 2114 pci_unmap_addr_set(lbq_desc, mapaddr, map);
2121 pci_unmap_len_set(lbq_desc, maplen, PAGE_SIZE); 2115 pci_unmap_len_set(lbq_desc, maplen, PAGE_SIZE);
2122 bq->addr_lo = cpu_to_le32(map); 2116 *lbq_desc->addr = cpu_to_le64(map);
2123 bq->addr_hi = cpu_to_le32(map >> 32);
2124 } 2117 }
2125 bq++; 2118 bq++;
2126 } 2119 }
@@ -2149,13 +2142,6 @@ static void ql_free_sbq_buffers(struct ql_adapter *qdev, struct rx_ring *rx_ring
2149 dev_kfree_skb(sbq_desc->p.skb); 2142 dev_kfree_skb(sbq_desc->p.skb);
2150 sbq_desc->p.skb = NULL; 2143 sbq_desc->p.skb = NULL;
2151 } 2144 }
2152 if (sbq_desc->bq == NULL) {
2153 QPRINTK(qdev, IFUP, ERR, "sbq_desc->bq %d is NULL.\n",
2154 i);
2155 return;
2156 }
2157 sbq_desc->bq->addr_lo = 0;
2158 sbq_desc->bq->addr_hi = 0;
2159 } 2145 }
2160} 2146}
2161 2147
@@ -2167,13 +2153,13 @@ static int ql_alloc_sbq_buffers(struct ql_adapter *qdev,
2167 struct bq_desc *sbq_desc; 2153 struct bq_desc *sbq_desc;
2168 struct sk_buff *skb; 2154 struct sk_buff *skb;
2169 u64 map; 2155 u64 map;
2170 struct bq_element *bq = rx_ring->sbq_base; 2156 __le64 *bq = rx_ring->sbq_base;
2171 2157
2172 for (i = 0; i < rx_ring->sbq_len; i++) { 2158 for (i = 0; i < rx_ring->sbq_len; i++) {
2173 sbq_desc = &rx_ring->sbq[i]; 2159 sbq_desc = &rx_ring->sbq[i];
2174 memset(sbq_desc, 0, sizeof(sbq_desc)); 2160 memset(sbq_desc, 0, sizeof(sbq_desc));
2175 sbq_desc->index = i; 2161 sbq_desc->index = i;
2176 sbq_desc->bq = bq; 2162 sbq_desc->addr = bq;
2177 skb = netdev_alloc_skb(qdev->ndev, rx_ring->sbq_buf_size); 2163 skb = netdev_alloc_skb(qdev->ndev, rx_ring->sbq_buf_size);
2178 if (unlikely(!skb)) { 2164 if (unlikely(!skb)) {
2179 /* Better luck next round */ 2165 /* Better luck next round */
@@ -2199,10 +2185,7 @@ static int ql_alloc_sbq_buffers(struct ql_adapter *qdev,
2199 } 2185 }
2200 pci_unmap_addr_set(sbq_desc, mapaddr, map); 2186 pci_unmap_addr_set(sbq_desc, mapaddr, map);
2201 pci_unmap_len_set(sbq_desc, maplen, rx_ring->sbq_buf_size / 2); 2187 pci_unmap_len_set(sbq_desc, maplen, rx_ring->sbq_buf_size / 2);
2202 bq->addr_lo = /*sbq_desc->addr_lo = */ 2188 *sbq_desc->addr = cpu_to_le64(map);
2203 cpu_to_le32(map);
2204 bq->addr_hi = /*sbq_desc->addr_hi = */
2205 cpu_to_le32(map >> 32);
2206 bq++; 2189 bq++;
2207 } 2190 }
2208 return 0; 2191 return 0;
@@ -2481,7 +2464,8 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2481 memset((void *)cqicb, 0, sizeof(struct cqicb)); 2464 memset((void *)cqicb, 0, sizeof(struct cqicb));
2482 cqicb->msix_vect = rx_ring->irq; 2465 cqicb->msix_vect = rx_ring->irq;
2483 2466
2484 cqicb->len = cpu_to_le16(rx_ring->cq_len | LEN_V | LEN_CPP_CONT); 2467 bq_len = (rx_ring->cq_len == 65536) ? 0 : (u16) rx_ring->cq_len;
2468 cqicb->len = cpu_to_le16(bq_len | LEN_V | LEN_CPP_CONT);
2485 2469
2486 cqicb->addr_lo = cpu_to_le32(rx_ring->cq_base_dma); 2470 cqicb->addr_lo = cpu_to_le32(rx_ring->cq_base_dma);
2487 cqicb->addr_hi = cpu_to_le32((u64) rx_ring->cq_base_dma >> 32); 2471 cqicb->addr_hi = cpu_to_le32((u64) rx_ring->cq_base_dma >> 32);
@@ -2503,8 +2487,11 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2503 cpu_to_le32(rx_ring->lbq_base_indirect_dma); 2487 cpu_to_le32(rx_ring->lbq_base_indirect_dma);
2504 cqicb->lbq_addr_hi = 2488 cqicb->lbq_addr_hi =
2505 cpu_to_le32((u64) rx_ring->lbq_base_indirect_dma >> 32); 2489 cpu_to_le32((u64) rx_ring->lbq_base_indirect_dma >> 32);
2506 cqicb->lbq_buf_size = cpu_to_le32(rx_ring->lbq_buf_size); 2490 bq_len = (rx_ring->lbq_buf_size == 65536) ? 0 :
2507 bq_len = (u16) rx_ring->lbq_len; 2491 (u16) rx_ring->lbq_buf_size;
2492 cqicb->lbq_buf_size = cpu_to_le16(bq_len);
2493 bq_len = (rx_ring->lbq_len == 65536) ? 0 :
2494 (u16) rx_ring->lbq_len;
2508 cqicb->lbq_len = cpu_to_le16(bq_len); 2495 cqicb->lbq_len = cpu_to_le16(bq_len);
2509 rx_ring->lbq_prod_idx = rx_ring->lbq_len - 16; 2496 rx_ring->lbq_prod_idx = rx_ring->lbq_len - 16;
2510 rx_ring->lbq_curr_idx = 0; 2497 rx_ring->lbq_curr_idx = 0;
@@ -2520,7 +2507,8 @@ static int ql_start_rx_ring(struct ql_adapter *qdev, struct rx_ring *rx_ring)
2520 cpu_to_le32((u64) rx_ring->sbq_base_indirect_dma >> 32); 2507 cpu_to_le32((u64) rx_ring->sbq_base_indirect_dma >> 32);
2521 cqicb->sbq_buf_size = 2508 cqicb->sbq_buf_size =
2522 cpu_to_le16(((rx_ring->sbq_buf_size / 2) + 8) & 0xfffffff8); 2509 cpu_to_le16(((rx_ring->sbq_buf_size / 2) + 8) & 0xfffffff8);
2523 bq_len = (u16) rx_ring->sbq_len; 2510 bq_len = (rx_ring->sbq_len == 65536) ? 0 :
2511 (u16) rx_ring->sbq_len;
2524 cqicb->sbq_len = cpu_to_le16(bq_len); 2512 cqicb->sbq_len = cpu_to_le16(bq_len);
2525 rx_ring->sbq_prod_idx = rx_ring->sbq_len - 16; 2513 rx_ring->sbq_prod_idx = rx_ring->sbq_len - 16;
2526 rx_ring->sbq_curr_idx = 0; 2514 rx_ring->sbq_curr_idx = 0;
@@ -3341,11 +3329,11 @@ static int ql_configure_rings(struct ql_adapter *qdev)
3341 rx_ring->cq_len * sizeof(struct ql_net_rsp_iocb); 3329 rx_ring->cq_len * sizeof(struct ql_net_rsp_iocb);
3342 rx_ring->lbq_len = NUM_LARGE_BUFFERS; 3330 rx_ring->lbq_len = NUM_LARGE_BUFFERS;
3343 rx_ring->lbq_size = 3331 rx_ring->lbq_size =
3344 rx_ring->lbq_len * sizeof(struct bq_element); 3332 rx_ring->lbq_len * sizeof(__le64);
3345 rx_ring->lbq_buf_size = LARGE_BUFFER_SIZE; 3333 rx_ring->lbq_buf_size = LARGE_BUFFER_SIZE;
3346 rx_ring->sbq_len = NUM_SMALL_BUFFERS; 3334 rx_ring->sbq_len = NUM_SMALL_BUFFERS;
3347 rx_ring->sbq_size = 3335 rx_ring->sbq_size =
3348 rx_ring->sbq_len * sizeof(struct bq_element); 3336 rx_ring->sbq_len * sizeof(__le64);
3349 rx_ring->sbq_buf_size = SMALL_BUFFER_SIZE * 2; 3337 rx_ring->sbq_buf_size = SMALL_BUFFER_SIZE * 2;
3350 rx_ring->type = DEFAULT_Q; 3338 rx_ring->type = DEFAULT_Q;
3351 } else if (i < qdev->rss_ring_first_cq_id) { 3339 } else if (i < qdev->rss_ring_first_cq_id) {
@@ -3372,11 +3360,11 @@ static int ql_configure_rings(struct ql_adapter *qdev)
3372 rx_ring->cq_len * sizeof(struct ql_net_rsp_iocb); 3360 rx_ring->cq_len * sizeof(struct ql_net_rsp_iocb);
3373 rx_ring->lbq_len = NUM_LARGE_BUFFERS; 3361 rx_ring->lbq_len = NUM_LARGE_BUFFERS;
3374 rx_ring->lbq_size = 3362 rx_ring->lbq_size =
3375 rx_ring->lbq_len * sizeof(struct bq_element); 3363 rx_ring->lbq_len * sizeof(__le64);
3376 rx_ring->lbq_buf_size = LARGE_BUFFER_SIZE; 3364 rx_ring->lbq_buf_size = LARGE_BUFFER_SIZE;
3377 rx_ring->sbq_len = NUM_SMALL_BUFFERS; 3365 rx_ring->sbq_len = NUM_SMALL_BUFFERS;
3378 rx_ring->sbq_size = 3366 rx_ring->sbq_size =
3379 rx_ring->sbq_len * sizeof(struct bq_element); 3367 rx_ring->sbq_len * sizeof(__le64);
3380 rx_ring->sbq_buf_size = SMALL_BUFFER_SIZE * 2; 3368 rx_ring->sbq_buf_size = SMALL_BUFFER_SIZE * 2;
3381 rx_ring->type = RX_Q; 3369 rx_ring->type = RX_Q;
3382 } 3370 }
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index f54ac2389da2..57fb1f71c47b 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -42,11 +42,11 @@
42#include <linux/mii.h> 42#include <linux/mii.h>
43#include <linux/if_vlan.h> 43#include <linux/if_vlan.h>
44#include <linux/mm.h> 44#include <linux/mm.h>
45#include <linux/firmware.h>
45#include <asm/processor.h> /* Processor type for cache alignment. */ 46#include <asm/processor.h> /* Processor type for cache alignment. */
46#include <asm/uaccess.h> 47#include <asm/uaccess.h>
47#include <asm/io.h> 48#include <asm/io.h>
48 49
49#include "starfire_firmware.h"
50/* 50/*
51 * The current frame processor firmware fails to checksum a fragment 51 * The current frame processor firmware fails to checksum a fragment
52 * of length 1. If and when this is fixed, the #define below can be removed. 52 * of length 1. If and when this is fixed, the #define below can be removed.
@@ -173,6 +173,10 @@ static int full_duplex[MAX_UNITS] = {0, };
173#define skb_first_frag_len(skb) skb_headlen(skb) 173#define skb_first_frag_len(skb) skb_headlen(skb)
174#define skb_num_frags(skb) (skb_shinfo(skb)->nr_frags + 1) 174#define skb_num_frags(skb) (skb_shinfo(skb)->nr_frags + 1)
175 175
176/* Firmware names */
177#define FIRMWARE_RX "adaptec/starfire_rx.bin"
178#define FIRMWARE_TX "adaptec/starfire_tx.bin"
179
176/* These identify the driver base version and may not be removed. */ 180/* These identify the driver base version and may not be removed. */
177static char version[] = 181static char version[] =
178KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" 182KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n"
@@ -182,6 +186,8 @@ MODULE_AUTHOR("Donald Becker <becker@scyld.com>");
182MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); 186MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver");
183MODULE_LICENSE("GPL"); 187MODULE_LICENSE("GPL");
184MODULE_VERSION(DRV_VERSION); 188MODULE_VERSION(DRV_VERSION);
189MODULE_FIRMWARE(FIRMWARE_RX);
190MODULE_FIRMWARE(FIRMWARE_TX);
185 191
186module_param(max_interrupt_work, int, 0); 192module_param(max_interrupt_work, int, 0);
187module_param(mtu, int, 0); 193module_param(mtu, int, 0);
@@ -902,9 +908,12 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
902 908
903static int netdev_open(struct net_device *dev) 909static int netdev_open(struct net_device *dev)
904{ 910{
911 const struct firmware *fw_rx, *fw_tx;
912 const __be32 *fw_rx_data, *fw_tx_data;
905 struct netdev_private *np = netdev_priv(dev); 913 struct netdev_private *np = netdev_priv(dev);
906 void __iomem *ioaddr = np->base; 914 void __iomem *ioaddr = np->base;
907 int i, retval; 915 int i, retval;
916 size_t tx_size, rx_size;
908 size_t tx_done_q_size, rx_done_q_size, tx_ring_size, rx_ring_size; 917 size_t tx_done_q_size, rx_done_q_size, tx_ring_size, rx_ring_size;
909 918
910 /* Do we ever need to reset the chip??? */ 919 /* Do we ever need to reset the chip??? */
@@ -1040,11 +1049,40 @@ static int netdev_open(struct net_device *dev)
1040 writel(ETH_P_8021Q, ioaddr + VlanType); 1049 writel(ETH_P_8021Q, ioaddr + VlanType);
1041#endif /* VLAN_SUPPORT */ 1050#endif /* VLAN_SUPPORT */
1042 1051
1052 retval = request_firmware(&fw_rx, FIRMWARE_RX, &np->pci_dev->dev);
1053 if (retval) {
1054 printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
1055 FIRMWARE_RX);
1056 return retval;
1057 }
1058 if (fw_rx->size % 4) {
1059 printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
1060 fw_rx->size, FIRMWARE_RX);
1061 retval = -EINVAL;
1062 goto out_rx;
1063 }
1064 retval = request_firmware(&fw_tx, FIRMWARE_TX, &np->pci_dev->dev);
1065 if (retval) {
1066 printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
1067 FIRMWARE_TX);
1068 goto out_rx;
1069 }
1070 if (fw_tx->size % 4) {
1071 printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
1072 fw_tx->size, FIRMWARE_TX);
1073 retval = -EINVAL;
1074 goto out_tx;
1075 }
1076 fw_rx_data = (const __be32 *)&fw_rx->data[0];
1077 fw_tx_data = (const __be32 *)&fw_tx->data[0];
1078 rx_size = fw_rx->size / 4;
1079 tx_size = fw_tx->size / 4;
1080
1043 /* Load Rx/Tx firmware into the frame processors */ 1081 /* Load Rx/Tx firmware into the frame processors */
1044 for (i = 0; i < FIRMWARE_RX_SIZE * 2; i++) 1082 for (i = 0; i < rx_size; i++)
1045 writel(firmware_rx[i], ioaddr + RxGfpMem + i * 4); 1083 writel(be32_to_cpup(&fw_rx_data[i]), ioaddr + RxGfpMem + i * 4);
1046 for (i = 0; i < FIRMWARE_TX_SIZE * 2; i++) 1084 for (i = 0; i < tx_size; i++)
1047 writel(firmware_tx[i], ioaddr + TxGfpMem + i * 4); 1085 writel(be32_to_cpup(&fw_tx_data[i]), ioaddr + TxGfpMem + i * 4);
1048 if (enable_hw_cksum) 1086 if (enable_hw_cksum)
1049 /* Enable the Rx and Tx units, and the Rx/Tx frame processors. */ 1087 /* Enable the Rx and Tx units, and the Rx/Tx frame processors. */
1050 writel(TxEnable|TxGFPEnable|RxEnable|RxGFPEnable, ioaddr + GenCtrl); 1088 writel(TxEnable|TxGFPEnable|RxEnable|RxGFPEnable, ioaddr + GenCtrl);
@@ -1056,7 +1094,11 @@ static int netdev_open(struct net_device *dev)
1056 printk(KERN_DEBUG "%s: Done netdev_open().\n", 1094 printk(KERN_DEBUG "%s: Done netdev_open().\n",
1057 dev->name); 1095 dev->name);
1058 1096
1059 return 0; 1097out_tx:
1098 release_firmware(fw_tx);
1099out_rx:
1100 release_firmware(fw_rx);
1101 return retval;
1060} 1102}
1061 1103
1062 1104
diff --git a/drivers/net/starfire_firmware.h b/drivers/net/starfire_firmware.h
deleted file mode 100644
index 0a668528955d..000000000000
--- a/drivers/net/starfire_firmware.h
+++ /dev/null
@@ -1,346 +0,0 @@
1/*
2 * Copyright 2003 Adaptec, Inc.
3 *
4 * Please read the following license before using the Adaptec Software
5 * ("Program"). If you do not agree to the license terms, do not use the
6 * Program:
7 *
8 * You agree to be bound by version 2 of the General Public License ("GPL")
9 * dated June 1991, which can be found at http://www.fsf.org/licenses/gpl.html.
10 * If the link is broken, write to Free Software Foundation, 59 Temple Place,
11 * Boston, Massachusetts 02111-1307.
12 *
13 * BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE IT IS LICENSED "AS IS" AND
14 * THERE IS NO WARRANTY FOR THE PROGRAM, INCLUDING BUT NOT LIMITED TO THE
15 * IMPLIED WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR A PARTICULAR PURPOSE
16 * (TO THE EXTENT PERMITTED BY APPLICABLE LAW). USE OF THE PROGRAM IS AT YOUR
17 * OWN RISK. IN NO EVENT WILL ADAPTEC OR ITS LICENSORS BE LIABLE TO YOU FOR
18 * DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
19 * ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.
20 *
21 */
22
23static const u32 firmware_rx[] = {
24 0x010003dc, 0x00000000,
25 0x04000421, 0x00000086,
26 0x80000015, 0x0000180e,
27 0x81000015, 0x00006664,
28 0x1a0040ab, 0x00000b06,
29 0x14200011, 0x00000000,
30 0x14204022, 0x0000aaaa,
31 0x14204022, 0x00000300,
32 0x14204022, 0x00000000,
33 0x1a0040ab, 0x00000b14,
34 0x14200011, 0x00000000,
35 0x83000015, 0x00000002,
36 0x04000021, 0x00000000,
37 0x00000010, 0x00000000,
38 0x04000421, 0x00000087,
39 0x00000010, 0x00000000,
40 0x00000010, 0x00000000,
41 0x00008015, 0x00000000,
42 0x0000003e, 0x00000000,
43 0x00000010, 0x00000000,
44 0x82000015, 0x00004000,
45 0x009e8050, 0x00000000,
46 0x03008015, 0x00000000,
47 0x86008015, 0x00000000,
48 0x82000015, 0x00008000,
49 0x0100001c, 0x00000000,
50 0x000050a0, 0x0000010c,
51 0x4e20d011, 0x00006008,
52 0x1420d012, 0x00004008,
53 0x0000f090, 0x00007000,
54 0x0000c8b0, 0x00003000,
55 0x00004040, 0x00000000,
56 0x00108015, 0x00000000,
57 0x00a2c150, 0x00004000,
58 0x00a400b0, 0x00000014,
59 0x00000020, 0x00000000,
60 0x2500400d, 0x00002525,
61 0x00047220, 0x00003100,
62 0x00934070, 0x00000000,
63 0x00000020, 0x00000000,
64 0x00924460, 0x00000184,
65 0x2b20c011, 0x00000000,
66 0x0000c420, 0x00000540,
67 0x36014018, 0x0000422d,
68 0x14200011, 0x00000000,
69 0x00924460, 0x00000183,
70 0x3200001f, 0x00000034,
71 0x02ac0015, 0x00000002,
72 0x00a60110, 0x00000008,
73 0x42200011, 0x00000000,
74 0x00924060, 0x00000103,
75 0x0000001e, 0x00000000,
76 0x00000020, 0x00000100,
77 0x0000001e, 0x00000000,
78 0x00924460, 0x00000086,
79 0x00004080, 0x00000000,
80 0x0092c070, 0x00000000,
81 0x00924060, 0x00000100,
82 0x0000c890, 0x00005000,
83 0x00a6c110, 0x00000000,
84 0x00b0c090, 0x00000012,
85 0x021c0015, 0x00000000,
86 0x3200001f, 0x00000034,
87 0x00924460, 0x00000510,
88 0x44210011, 0x00000000,
89 0x42000011, 0x00000000,
90 0x83000015, 0x00000040,
91 0x00924460, 0x00000508,
92 0x45014018, 0x00004545,
93 0x00808050, 0x00000000,
94 0x62208012, 0x00000000,
95 0x82000015, 0x00000800,
96 0x15200011, 0x00000000,
97 0x00000010, 0x00000000,
98 0x00000010, 0x00000000,
99 0x00000010, 0x00000000,
100 0x00000010, 0x00000000,
101 0x00000010, 0x00000000,
102 0x80000015, 0x0000eea4,
103 0x81000015, 0x0000005f,
104 0x00000060, 0x00000000,
105 0x00004120, 0x00000000,
106 0x00004a00, 0x00004000,
107 0x00924460, 0x00000190,
108 0x5601401a, 0x00005956,
109 0x14000011, 0x00000000,
110 0x00934050, 0x00000018,
111 0x00930050, 0x00000018,
112 0x3601403a, 0x0000002d,
113 0x000643a9, 0x00000000,
114 0x0000c420, 0x00000140,
115 0x5601401a, 0x00005956,
116 0x14000011, 0x00000000,
117 0x00000010, 0x00000000,
118 0x00000010, 0x00000000,
119 0x000642a9, 0x00000000,
120 0x00024420, 0x00000183,
121 0x5601401a, 0x00005956,
122 0x82000015, 0x00002000,
123 0x15200011, 0x00000000,
124 0x82000015, 0x00000010,
125 0x15200011, 0x00000000,
126 0x82000015, 0x00000010,
127 0x15200011, 0x00000000,
128}; /* 104 Rx instructions */
129#define FIRMWARE_RX_SIZE 104
130
131static const u32 firmware_tx[] = {
132 0x010003dc, 0x00000000,
133 0x04000421, 0x00000086,
134 0x80000015, 0x0000180e,
135 0x81000015, 0x00006664,
136 0x1a0040ab, 0x00000b06,
137 0x14200011, 0x00000000,
138 0x14204022, 0x0000aaaa,
139 0x14204022, 0x00000300,
140 0x14204022, 0x00000000,
141 0x1a0040ab, 0x00000b14,
142 0x14200011, 0x00000000,
143 0x83000015, 0x00000002,
144 0x04000021, 0x00000000,
145 0x00000010, 0x00000000,
146 0x04000421, 0x00000087,
147 0x00000010, 0x00000000,
148 0x00000010, 0x00000000,
149 0x00008015, 0x00000000,
150 0x0000003e, 0x00000000,
151 0x00000010, 0x00000000,
152 0x82000015, 0x00004000,
153 0x009e8050, 0x00000000,
154 0x03008015, 0x00000000,
155 0x86008015, 0x00000000,
156 0x82000015, 0x00008000,
157 0x0100001c, 0x00000000,
158 0x000050a0, 0x0000010c,
159 0x4e20d011, 0x00006008,
160 0x1420d012, 0x00004008,
161 0x0000f090, 0x00007000,
162 0x0000c8b0, 0x00003000,
163 0x00004040, 0x00000000,
164 0x00108015, 0x00000000,
165 0x00a2c150, 0x00004000,
166 0x00a400b0, 0x00000014,
167 0x00000020, 0x00000000,
168 0x2500400d, 0x00002525,
169 0x00047220, 0x00003100,
170 0x00934070, 0x00000000,
171 0x00000020, 0x00000000,
172 0x00924460, 0x00000184,
173 0x2b20c011, 0x00000000,
174 0x0000c420, 0x00000540,
175 0x36014018, 0x0000422d,
176 0x14200011, 0x00000000,
177 0x00924460, 0x00000183,
178 0x3200001f, 0x00000034,
179 0x02ac0015, 0x00000002,
180 0x00a60110, 0x00000008,
181 0x42200011, 0x00000000,
182 0x00924060, 0x00000103,
183 0x0000001e, 0x00000000,
184 0x00000020, 0x00000100,
185 0x0000001e, 0x00000000,
186 0x00924460, 0x00000086,
187 0x00004080, 0x00000000,
188 0x0092c070, 0x00000000,
189 0x00924060, 0x00000100,
190 0x0000c890, 0x00005000,
191 0x00a6c110, 0x00000000,
192 0x00b0c090, 0x00000012,
193 0x021c0015, 0x00000000,
194 0x3200001f, 0x00000034,
195 0x00924460, 0x00000510,
196 0x44210011, 0x00000000,
197 0x42000011, 0x00000000,
198 0x83000015, 0x00000040,
199 0x00924460, 0x00000508,
200 0x45014018, 0x00004545,
201 0x00808050, 0x00000000,
202 0x62208012, 0x00000000,
203 0x82000015, 0x00000800,
204 0x15200011, 0x00000000,
205 0x00000010, 0x00000000,
206 0x00000010, 0x00000000,
207 0x00000010, 0x00000000,
208 0x00000010, 0x00000000,
209 0x00000010, 0x00000000,
210 0x80000015, 0x0000eea4,
211 0x81000015, 0x0000005f,
212 0x00000060, 0x00000000,
213 0x00004120, 0x00000000,
214 0x00004a00, 0x00004000,
215 0x00924460, 0x00000190,
216 0x5601401a, 0x00005956,
217 0x14000011, 0x00000000,
218 0x00934050, 0x00000018,
219 0x00930050, 0x00000018,
220 0x3601403a, 0x0000002d,
221 0x000643a9, 0x00000000,
222 0x0000c420, 0x00000140,
223 0x5601401a, 0x00005956,
224 0x14000011, 0x00000000,
225 0x00000010, 0x00000000,
226 0x00000010, 0x00000000,
227 0x000642a9, 0x00000000,
228 0x00024420, 0x00000183,
229 0x5601401a, 0x00005956,
230 0x82000015, 0x00002000,
231 0x15200011, 0x00000000,
232 0x82000015, 0x00000010,
233 0x15200011, 0x00000000,
234 0x82000015, 0x00000010,
235 0x15200011, 0x00000000,
236}; /* 104 Tx instructions */
237#define FIRMWARE_TX_SIZE 104
238#if 0
239static const u32 firmware_wol[] = {
240 0x010003dc, 0x00000000,
241 0x19000421, 0x00000087,
242 0x80000015, 0x00001a1a,
243 0x81000015, 0x00001a1a,
244 0x1a0040ab, 0x00000b06,
245 0x15200011, 0x00000000,
246 0x15204022, 0x0000aaaa,
247 0x15204022, 0x00000300,
248 0x15204022, 0x00000000,
249 0x1a0040ab, 0x00000b15,
250 0x15200011, 0x00000000,
251 0x83000015, 0x00000002,
252 0x04000021, 0x00000000,
253 0x00000010, 0x00000000,
254 0x04000421, 0x00000087,
255 0x00000010, 0x00000000,
256 0x00000010, 0x00000000,
257 0x00008015, 0x00000000,
258 0x0000003e, 0x00000000,
259 0x00000010, 0x00000000,
260 0x00000010, 0x00000000,
261 0x82000015, 0x00004000,
262 0x82000015, 0x00008000,
263 0x0000000c, 0x00000000,
264 0x00000010, 0x00000000,
265 0x00004080, 0x00000100,
266 0x1f20c011, 0x00001122,
267 0x2720f011, 0x00003011,
268 0x19200071, 0x00000000,
269 0x1a200051, 0x00000000,
270 0x00000010, 0x00000000,
271 0x00000010, 0x00000000,
272 0x1d2040a4, 0x00003344,
273 0x1d2040a2, 0x00005566,
274 0x000040a0, 0x00000100,
275 0x00108050, 0x00000001,
276 0x1a208012, 0x00000006,
277 0x82000015, 0x00008080,
278 0x010003dc, 0x00000000,
279 0x1d2040a4, 0x00002233,
280 0x1d2040a4, 0x00004455,
281 0x2d208011, 0x00000005,
282 0x1d2040a4, 0x00006611,
283 0x00108050, 0x00000001,
284 0x27200011, 0x00000000,
285 0x1d2050a4, 0x00006600,
286 0x82000015, 0x00008080,
287 0x010003dc, 0x00000000,
288 0x00000050, 0x00000000,
289 0x1b200031, 0x00000000,
290 0x0000001e, 0x00000000,
291 0x0000001e, 0x00000000,
292 0x0000001e, 0x00000000,
293 0x0000001e, 0x00000000,
294 0x00924460, 0x00000086,
295 0x00004080, 0x00000000,
296 0x0092c070, 0x00000000,
297 0x00924060, 0x00000100,
298 0x0000c890, 0x00005000,
299 0x00a6c110, 0x00000000,
300 0x00b0c090, 0x00000012,
301 0x021c0015, 0x00000000,
302 0x3200001f, 0x00000034,
303 0x00924460, 0x00000510,
304 0x44210011, 0x00000000,
305 0x42000011, 0x00000000,
306 0x83000015, 0x00000040,
307 0x00924460, 0x00000508,
308 0x476a0012, 0x00000100,
309 0x83000015, 0x00000008,
310 0x16200011, 0x00000000,
311 0x001e8050, 0x00000000,
312 0x001e8050, 0x00000000,
313 0x00808050, 0x00000000,
314 0x03008015, 0x00000000,
315 0x62208012, 0x00000000,
316 0x82000015, 0x00000800,
317 0x16200011, 0x00000000,
318 0x80000015, 0x0000eea4,
319 0x81000015, 0x0000005f,
320 0x00000020, 0x00000000,
321 0x00004120, 0x00000000,
322 0x00004a00, 0x00004000,
323 0x00924460, 0x00000190,
324 0x5c01401a, 0x0000595c,
325 0x15000011, 0x00000000,
326 0x00934050, 0x00000018,
327 0x00930050, 0x00000018,
328 0x3601403a, 0x0000002d,
329 0x00064029, 0x00000000,
330 0x0000c420, 0x00000140,
331 0x5c01401a, 0x0000595c,
332 0x15000011, 0x00000000,
333 0x00000010, 0x00000000,
334 0x00000010, 0x00000000,
335 0x00064029, 0x00000000,
336 0x00024420, 0x00000183,
337 0x5c01401a, 0x0000595c,
338 0x82000015, 0x00002000,
339 0x16200011, 0x00000000,
340 0x82000015, 0x00000010,
341 0x16200011, 0x00000000,
342 0x82000015, 0x00000010,
343 0x16200011, 0x00000000,
344}; /* 104 WoL instructions */
345#define FIRMWARE_WOL_SIZE 104
346#endif
diff --git a/drivers/net/starfire_firmware.pl b/drivers/net/starfire_firmware.pl
deleted file mode 100644
index 0c82b80e1074..000000000000
--- a/drivers/net/starfire_firmware.pl
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/usr/bin/perl
2
3# This script can be used to generate a new starfire_firmware.h
4# from GFP_RX.DAT and GFP_TX.DAT, files included with the DDK
5# and also with the Novell drivers.
6
7open FW, "GFP_RX.DAT" || die;
8open FWH, ">starfire_firmware.h" || die;
9
10printf(FWH "static u32 firmware_rx[] = {\n");
11$counter = 0;
12while ($foo = <FW>) {
13 chomp;
14 printf(FWH " 0x%s, 0x0000%s,\n", substr($foo, 4, 8), substr($foo, 0, 4));
15 $counter++;
16}
17
18close FW;
19open FW, "GFP_TX.DAT" || die;
20
21printf(FWH "};\t/* %d Rx instructions */\n#define FIRMWARE_RX_SIZE %d\n\nstatic u32 firmware_tx[] = {\n", $counter, $counter);
22$counter = 0;
23while ($foo = <FW>) {
24 chomp;
25 printf(FWH " 0x%s, 0x0000%s,\n", substr($foo, 4, 8), substr($foo, 0, 4));
26 $counter++;
27}
28
29close FW;
30printf(FWH "};\t/* %d Tx instructions */\n#define FIRMWARE_TX_SIZE %d\n", $counter, $counter);
31close(FWH);
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 04ae1e86aeaa..5e2dbaee125b 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -40,6 +40,7 @@
40#include <linux/workqueue.h> 40#include <linux/workqueue.h>
41#include <linux/prefetch.h> 41#include <linux/prefetch.h>
42#include <linux/dma-mapping.h> 42#include <linux/dma-mapping.h>
43#include <linux/firmware.h>
43 44
44#include <net/checksum.h> 45#include <net/checksum.h>
45#include <net/ip.h> 46#include <net/ip.h>
@@ -137,6 +138,10 @@
137 138
138#define TG3_NUM_TEST 6 139#define TG3_NUM_TEST 6
139 140
141#define FIRMWARE_TG3 "tigon/tg3.bin"
142#define FIRMWARE_TG3TSO "tigon/tg3_tso.bin"
143#define FIRMWARE_TG3TSO5 "tigon/tg3_tso5.bin"
144
140static char version[] __devinitdata = 145static char version[] __devinitdata =
141 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; 146 DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
142 147
@@ -144,6 +149,10 @@ MODULE_AUTHOR("David S. Miller (davem@redhat.com) and Jeff Garzik (jgarzik@pobox
144MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver"); 149MODULE_DESCRIPTION("Broadcom Tigon3 ethernet driver");
145MODULE_LICENSE("GPL"); 150MODULE_LICENSE("GPL");
146MODULE_VERSION(DRV_MODULE_VERSION); 151MODULE_VERSION(DRV_MODULE_VERSION);
152MODULE_FIRMWARE(FIRMWARE_TG3);
153MODULE_FIRMWARE(FIRMWARE_TG3TSO);
154MODULE_FIRMWARE(FIRMWARE_TG3TSO5);
155
147 156
148static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */ 157static int tg3_debug = -1; /* -1 == use TG3_DEF_MSG_ENABLE as value */
149module_param(tg3_debug, int, 0); 158module_param(tg3_debug, int, 0);
@@ -6205,130 +6214,6 @@ static int tg3_halt(struct tg3 *tp, int kind, int silent)
6205 return 0; 6214 return 0;
6206} 6215}
6207 6216
6208#define TG3_FW_RELEASE_MAJOR 0x0
6209#define TG3_FW_RELASE_MINOR 0x0
6210#define TG3_FW_RELEASE_FIX 0x0
6211#define TG3_FW_START_ADDR 0x08000000
6212#define TG3_FW_TEXT_ADDR 0x08000000
6213#define TG3_FW_TEXT_LEN 0x9c0
6214#define TG3_FW_RODATA_ADDR 0x080009c0
6215#define TG3_FW_RODATA_LEN 0x60
6216#define TG3_FW_DATA_ADDR 0x08000a40
6217#define TG3_FW_DATA_LEN 0x20
6218#define TG3_FW_SBSS_ADDR 0x08000a60
6219#define TG3_FW_SBSS_LEN 0xc
6220#define TG3_FW_BSS_ADDR 0x08000a70
6221#define TG3_FW_BSS_LEN 0x10
6222
6223static const u32 tg3FwText[(TG3_FW_TEXT_LEN / sizeof(u32)) + 1] = {
6224 0x00000000, 0x10000003, 0x00000000, 0x0000000d, 0x0000000d, 0x3c1d0800,
6225 0x37bd3ffc, 0x03a0f021, 0x3c100800, 0x26100000, 0x0e000018, 0x00000000,
6226 0x0000000d, 0x3c1d0800, 0x37bd3ffc, 0x03a0f021, 0x3c100800, 0x26100034,
6227 0x0e00021c, 0x00000000, 0x0000000d, 0x00000000, 0x00000000, 0x00000000,
6228 0x27bdffe0, 0x3c1cc000, 0xafbf0018, 0xaf80680c, 0x0e00004c, 0x241b2105,
6229 0x97850000, 0x97870002, 0x9782002c, 0x9783002e, 0x3c040800, 0x248409c0,
6230 0xafa00014, 0x00021400, 0x00621825, 0x00052c00, 0xafa30010, 0x8f860010,
6231 0x00e52825, 0x0e000060, 0x24070102, 0x3c02ac00, 0x34420100, 0x3c03ac01,
6232 0x34630100, 0xaf820490, 0x3c02ffff, 0xaf820494, 0xaf830498, 0xaf82049c,
6233 0x24020001, 0xaf825ce0, 0x0e00003f, 0xaf825d00, 0x0e000140, 0x00000000,
6234 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x2402ffff, 0xaf825404, 0x8f835400,
6235 0x34630400, 0xaf835400, 0xaf825404, 0x3c020800, 0x24420034, 0xaf82541c,
6236 0x03e00008, 0xaf805400, 0x00000000, 0x00000000, 0x3c020800, 0x34423000,
6237 0x3c030800, 0x34633000, 0x3c040800, 0x348437ff, 0x3c010800, 0xac220a64,
6238 0x24020040, 0x3c010800, 0xac220a68, 0x3c010800, 0xac200a60, 0xac600000,
6239 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
6240 0x00804821, 0x8faa0010, 0x3c020800, 0x8c420a60, 0x3c040800, 0x8c840a68,
6241 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010800, 0xac230a60, 0x14400003,
6242 0x00004021, 0x3c010800, 0xac200a60, 0x3c020800, 0x8c420a60, 0x3c030800,
6243 0x8c630a64, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
6244 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020800, 0x8c420a60,
6245 0x3c030800, 0x8c630a64, 0x8f84680c, 0x00021140, 0x00431021, 0xac440008,
6246 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
6247 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6248 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6249 0, 0, 0, 0, 0, 0,
6250 0x02000008, 0x00000000, 0x0a0001e3, 0x3c0a0001, 0x0a0001e3, 0x3c0a0002,
6251 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000,
6252 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000,
6253 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000,
6254 0x0a0001e3, 0x3c0a0007, 0x0a0001e3, 0x3c0a0008, 0x0a0001e3, 0x3c0a0009,
6255 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x3c0a000b,
6256 0x0a0001e3, 0x3c0a000c, 0x0a0001e3, 0x3c0a000d, 0x0a0001e3, 0x00000000,
6257 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x3c0a000e, 0x0a0001e3, 0x00000000,
6258 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000,
6259 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x00000000,
6260 0x0a0001e3, 0x00000000, 0x0a0001e3, 0x3c0a0013, 0x0a0001e3, 0x3c0a0014,
6261 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6262 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6263 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
6264 0x27bdffe0, 0x00001821, 0x00001021, 0xafbf0018, 0xafb10014, 0xafb00010,
6265 0x3c010800, 0x00220821, 0xac200a70, 0x3c010800, 0x00220821, 0xac200a74,
6266 0x3c010800, 0x00220821, 0xac200a78, 0x24630001, 0x1860fff5, 0x2442000c,
6267 0x24110001, 0x8f906810, 0x32020004, 0x14400005, 0x24040001, 0x3c020800,
6268 0x8c420a78, 0x18400003, 0x00002021, 0x0e000182, 0x00000000, 0x32020001,
6269 0x10400003, 0x00000000, 0x0e000169, 0x00000000, 0x0a000153, 0xaf915028,
6270 0x8fbf0018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020, 0x3c050800,
6271 0x8ca50a70, 0x3c060800, 0x8cc60a80, 0x3c070800, 0x8ce70a78, 0x27bdffe0,
6272 0x3c040800, 0x248409d0, 0xafbf0018, 0xafa00010, 0x0e000060, 0xafa00014,
6273 0x0e00017b, 0x00002021, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x24020001,
6274 0x8f836810, 0x00821004, 0x00021027, 0x00621824, 0x03e00008, 0xaf836810,
6275 0x27bdffd8, 0xafbf0024, 0x1080002e, 0xafb00020, 0x8f825cec, 0xafa20018,
6276 0x8f825cec, 0x3c100800, 0x26100a78, 0xafa2001c, 0x34028000, 0xaf825cec,
6277 0x8e020000, 0x18400016, 0x00000000, 0x3c020800, 0x94420a74, 0x8fa3001c,
6278 0x000221c0, 0xac830004, 0x8fa2001c, 0x3c010800, 0x0e000201, 0xac220a74,
6279 0x10400005, 0x00000000, 0x8e020000, 0x24420001, 0x0a0001df, 0xae020000,
6280 0x3c020800, 0x8c420a70, 0x00021c02, 0x000321c0, 0x0a0001c5, 0xafa2001c,
6281 0x0e000201, 0x00000000, 0x1040001f, 0x00000000, 0x8e020000, 0x8fa3001c,
6282 0x24420001, 0x3c010800, 0xac230a70, 0x3c010800, 0xac230a74, 0x0a0001df,
6283 0xae020000, 0x3c100800, 0x26100a78, 0x8e020000, 0x18400028, 0x00000000,
6284 0x0e000201, 0x00000000, 0x14400024, 0x00000000, 0x8e020000, 0x3c030800,
6285 0x8c630a70, 0x2442ffff, 0xafa3001c, 0x18400006, 0xae020000, 0x00031402,
6286 0x000221c0, 0x8c820004, 0x3c010800, 0xac220a70, 0x97a2001e, 0x2442ff00,
6287 0x2c420300, 0x1440000b, 0x24024000, 0x3c040800, 0x248409dc, 0xafa00010,
6288 0xafa00014, 0x8fa6001c, 0x24050008, 0x0e000060, 0x00003821, 0x0a0001df,
6289 0x00000000, 0xaf825cf8, 0x3c020800, 0x8c420a40, 0x8fa3001c, 0x24420001,
6290 0xaf835cf8, 0x3c010800, 0xac220a40, 0x8fbf0024, 0x8fb00020, 0x03e00008,
6291 0x27bd0028, 0x27bdffe0, 0x3c040800, 0x248409e8, 0x00002821, 0x00003021,
6292 0x00003821, 0xafbf0018, 0xafa00010, 0x0e000060, 0xafa00014, 0x8fbf0018,
6293 0x03e00008, 0x27bd0020, 0x8f82680c, 0x8f85680c, 0x00021827, 0x0003182b,
6294 0x00031823, 0x00431024, 0x00441021, 0x00a2282b, 0x10a00006, 0x00000000,
6295 0x00401821, 0x8f82680c, 0x0043102b, 0x1440fffd, 0x00000000, 0x03e00008,
6296 0x00000000, 0x3c040800, 0x8c840000, 0x3c030800, 0x8c630a40, 0x0064102b,
6297 0x54400002, 0x00831023, 0x00641023, 0x2c420008, 0x03e00008, 0x38420001,
6298 0x27bdffe0, 0x00802821, 0x3c040800, 0x24840a00, 0x00003021, 0x00003821,
6299 0xafbf0018, 0xafa00010, 0x0e000060, 0xafa00014, 0x0a000216, 0x00000000,
6300 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x00000000, 0x27bdffe0, 0x3c1cc000,
6301 0xafbf0018, 0x0e00004c, 0xaf80680c, 0x3c040800, 0x24840a10, 0x03802821,
6302 0x00003021, 0x00003821, 0xafa00010, 0x0e000060, 0xafa00014, 0x2402ffff,
6303 0xaf825404, 0x3c0200aa, 0x0e000234, 0xaf825434, 0x8fbf0018, 0x03e00008,
6304 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe8, 0xafb00010,
6305 0x24100001, 0xafbf0014, 0x3c01c003, 0xac200000, 0x8f826810, 0x30422000,
6306 0x10400003, 0x00000000, 0x0e000246, 0x00000000, 0x0a00023a, 0xaf905428,
6307 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x27bdfff8, 0x8f845d0c,
6308 0x3c0200ff, 0x3c030800, 0x8c630a50, 0x3442fff8, 0x00821024, 0x1043001e,
6309 0x3c0500ff, 0x34a5fff8, 0x3c06c003, 0x3c074000, 0x00851824, 0x8c620010,
6310 0x3c010800, 0xac230a50, 0x30420008, 0x10400005, 0x00871025, 0x8cc20000,
6311 0x24420001, 0xacc20000, 0x00871025, 0xaf825d0c, 0x8fa20000, 0x24420001,
6312 0xafa20000, 0x8fa20000, 0x8fa20000, 0x24420001, 0xafa20000, 0x8fa20000,
6313 0x8f845d0c, 0x3c030800, 0x8c630a50, 0x00851024, 0x1443ffe8, 0x00851824,
6314 0x27bd0008, 0x03e00008, 0x00000000, 0x00000000, 0x00000000
6315};
6316
6317static const u32 tg3FwRodata[(TG3_FW_RODATA_LEN / sizeof(u32)) + 1] = {
6318 0x35373031, 0x726c7341, 0x00000000, 0x00000000, 0x53774576, 0x656e7430,
6319 0x00000000, 0x726c7045, 0x76656e74, 0x31000000, 0x556e6b6e, 0x45766e74,
6320 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x66617461, 0x6c457272,
6321 0x00000000, 0x00000000, 0x4d61696e, 0x43707542, 0x00000000, 0x00000000,
6322 0x00000000
6323};
6324
6325#if 0 /* All zeros, don't eat up space with it. */
6326u32 tg3FwData[(TG3_FW_DATA_LEN / sizeof(u32)) + 1] = {
6327 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6328 0x00000000, 0x00000000, 0x00000000, 0x00000000
6329};
6330#endif
6331
6332#define RX_CPU_SCRATCH_BASE 0x30000 6217#define RX_CPU_SCRATCH_BASE 0x30000
6333#define RX_CPU_SCRATCH_SIZE 0x04000 6218#define RX_CPU_SCRATCH_SIZE 0x04000
6334#define TX_CPU_SCRATCH_BASE 0x34000 6219#define TX_CPU_SCRATCH_BASE 0x34000
@@ -6383,15 +6268,9 @@ static int tg3_halt_cpu(struct tg3 *tp, u32 offset)
6383} 6268}
6384 6269
6385struct fw_info { 6270struct fw_info {
6386 unsigned int text_base; 6271 unsigned int fw_base;
6387 unsigned int text_len; 6272 unsigned int fw_len;
6388 const u32 *text_data; 6273 const __be32 *fw_data;
6389 unsigned int rodata_base;
6390 unsigned int rodata_len;
6391 const u32 *rodata_data;
6392 unsigned int data_base;
6393 unsigned int data_len;
6394 const u32 *data_data;
6395}; 6274};
6396 6275
6397/* tp->lock is held. */ 6276/* tp->lock is held. */
@@ -6428,24 +6307,11 @@ static int tg3_load_firmware_cpu(struct tg3 *tp, u32 cpu_base, u32 cpu_scratch_b
6428 write_op(tp, cpu_scratch_base + i, 0); 6307 write_op(tp, cpu_scratch_base + i, 0);
6429 tw32(cpu_base + CPU_STATE, 0xffffffff); 6308 tw32(cpu_base + CPU_STATE, 0xffffffff);
6430 tw32(cpu_base + CPU_MODE, tr32(cpu_base+CPU_MODE)|CPU_MODE_HALT); 6309 tw32(cpu_base + CPU_MODE, tr32(cpu_base+CPU_MODE)|CPU_MODE_HALT);
6431 for (i = 0; i < (info->text_len / sizeof(u32)); i++) 6310 for (i = 0; i < (info->fw_len / sizeof(u32)); i++)
6432 write_op(tp, (cpu_scratch_base +
6433 (info->text_base & 0xffff) +
6434 (i * sizeof(u32))),
6435 (info->text_data ?
6436 info->text_data[i] : 0));
6437 for (i = 0; i < (info->rodata_len / sizeof(u32)); i++)
6438 write_op(tp, (cpu_scratch_base +
6439 (info->rodata_base & 0xffff) +
6440 (i * sizeof(u32))),
6441 (info->rodata_data ?
6442 info->rodata_data[i] : 0));
6443 for (i = 0; i < (info->data_len / sizeof(u32)); i++)
6444 write_op(tp, (cpu_scratch_base + 6311 write_op(tp, (cpu_scratch_base +
6445 (info->data_base & 0xffff) + 6312 (info->fw_base & 0xffff) +
6446 (i * sizeof(u32))), 6313 (i * sizeof(u32))),
6447 (info->data_data ? 6314 be32_to_cpu(info->fw_data[i]));
6448 info->data_data[i] : 0));
6449 6315
6450 err = 0; 6316 err = 0;
6451 6317
@@ -6457,17 +6323,20 @@ out:
6457static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp) 6323static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
6458{ 6324{
6459 struct fw_info info; 6325 struct fw_info info;
6326 const __be32 *fw_data;
6460 int err, i; 6327 int err, i;
6461 6328
6462 info.text_base = TG3_FW_TEXT_ADDR; 6329 fw_data = (void *)tp->fw->data;
6463 info.text_len = TG3_FW_TEXT_LEN; 6330
6464 info.text_data = &tg3FwText[0]; 6331 /* Firmware blob starts with version numbers, followed by
6465 info.rodata_base = TG3_FW_RODATA_ADDR; 6332 start address and length. We are setting complete length.
6466 info.rodata_len = TG3_FW_RODATA_LEN; 6333 length = end_address_of_bss - start_address_of_text.
6467 info.rodata_data = &tg3FwRodata[0]; 6334 Remainder is the blob to be loaded contiguously
6468 info.data_base = TG3_FW_DATA_ADDR; 6335 from start address. */
6469 info.data_len = TG3_FW_DATA_LEN; 6336
6470 info.data_data = NULL; 6337 info.fw_base = be32_to_cpu(fw_data[1]);
6338 info.fw_len = tp->fw->size - 12;
6339 info.fw_data = &fw_data[3];
6471 6340
6472 err = tg3_load_firmware_cpu(tp, RX_CPU_BASE, 6341 err = tg3_load_firmware_cpu(tp, RX_CPU_BASE,
6473 RX_CPU_SCRATCH_BASE, RX_CPU_SCRATCH_SIZE, 6342 RX_CPU_SCRATCH_BASE, RX_CPU_SCRATCH_SIZE,
@@ -6483,21 +6352,21 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
6483 6352
6484 /* Now startup only the RX cpu. */ 6353 /* Now startup only the RX cpu. */
6485 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff); 6354 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff);
6486 tw32_f(RX_CPU_BASE + CPU_PC, TG3_FW_TEXT_ADDR); 6355 tw32_f(RX_CPU_BASE + CPU_PC, info.fw_base);
6487 6356
6488 for (i = 0; i < 5; i++) { 6357 for (i = 0; i < 5; i++) {
6489 if (tr32(RX_CPU_BASE + CPU_PC) == TG3_FW_TEXT_ADDR) 6358 if (tr32(RX_CPU_BASE + CPU_PC) == info.fw_base)
6490 break; 6359 break;
6491 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff); 6360 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff);
6492 tw32(RX_CPU_BASE + CPU_MODE, CPU_MODE_HALT); 6361 tw32(RX_CPU_BASE + CPU_MODE, CPU_MODE_HALT);
6493 tw32_f(RX_CPU_BASE + CPU_PC, TG3_FW_TEXT_ADDR); 6362 tw32_f(RX_CPU_BASE + CPU_PC, info.fw_base);
6494 udelay(1000); 6363 udelay(1000);
6495 } 6364 }
6496 if (i >= 5) { 6365 if (i >= 5) {
6497 printk(KERN_ERR PFX "tg3_load_firmware fails for %s " 6366 printk(KERN_ERR PFX "tg3_load_firmware fails for %s "
6498 "to set RX CPU PC, is %08x should be %08x\n", 6367 "to set RX CPU PC, is %08x should be %08x\n",
6499 tp->dev->name, tr32(RX_CPU_BASE + CPU_PC), 6368 tp->dev->name, tr32(RX_CPU_BASE + CPU_PC),
6500 TG3_FW_TEXT_ADDR); 6369 info.fw_base);
6501 return -ENODEV; 6370 return -ENODEV;
6502 } 6371 }
6503 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff); 6372 tw32(RX_CPU_BASE + CPU_STATE, 0xffffffff);
@@ -6506,547 +6375,36 @@ static int tg3_load_5701_a0_firmware_fix(struct tg3 *tp)
6506 return 0; 6375 return 0;
6507} 6376}
6508 6377
6509
6510#define TG3_TSO_FW_RELEASE_MAJOR 0x1
6511#define TG3_TSO_FW_RELASE_MINOR 0x6
6512#define TG3_TSO_FW_RELEASE_FIX 0x0
6513#define TG3_TSO_FW_START_ADDR 0x08000000
6514#define TG3_TSO_FW_TEXT_ADDR 0x08000000
6515#define TG3_TSO_FW_TEXT_LEN 0x1aa0
6516#define TG3_TSO_FW_RODATA_ADDR 0x08001aa0
6517#define TG3_TSO_FW_RODATA_LEN 0x60
6518#define TG3_TSO_FW_DATA_ADDR 0x08001b20
6519#define TG3_TSO_FW_DATA_LEN 0x30
6520#define TG3_TSO_FW_SBSS_ADDR 0x08001b50
6521#define TG3_TSO_FW_SBSS_LEN 0x2c
6522#define TG3_TSO_FW_BSS_ADDR 0x08001b80
6523#define TG3_TSO_FW_BSS_LEN 0x894
6524
6525static const u32 tg3TsoFwText[(TG3_TSO_FW_TEXT_LEN / 4) + 1] = {
6526 0x0e000003, 0x00000000, 0x08001b24, 0x00000000, 0x10000003, 0x00000000,
6527 0x0000000d, 0x0000000d, 0x3c1d0800, 0x37bd4000, 0x03a0f021, 0x3c100800,
6528 0x26100000, 0x0e000010, 0x00000000, 0x0000000d, 0x27bdffe0, 0x3c04fefe,
6529 0xafbf0018, 0x0e0005d8, 0x34840002, 0x0e000668, 0x00000000, 0x3c030800,
6530 0x90631b68, 0x24020002, 0x3c040800, 0x24841aac, 0x14620003, 0x24050001,
6531 0x3c040800, 0x24841aa0, 0x24060006, 0x00003821, 0xafa00010, 0x0e00067c,
6532 0xafa00014, 0x8f625c50, 0x34420001, 0xaf625c50, 0x8f625c90, 0x34420001,
6533 0xaf625c90, 0x2402ffff, 0x0e000034, 0xaf625404, 0x8fbf0018, 0x03e00008,
6534 0x27bd0020, 0x00000000, 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c,
6535 0xafb20018, 0xafb10014, 0x0e00005b, 0xafb00010, 0x24120002, 0x24110001,
6536 0x8f706820, 0x32020100, 0x10400003, 0x00000000, 0x0e0000bb, 0x00000000,
6537 0x8f706820, 0x32022000, 0x10400004, 0x32020001, 0x0e0001f0, 0x24040001,
6538 0x32020001, 0x10400003, 0x00000000, 0x0e0000a3, 0x00000000, 0x3c020800,
6539 0x90421b98, 0x14520003, 0x00000000, 0x0e0004c0, 0x00000000, 0x0a00003c,
6540 0xaf715028, 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008,
6541 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ac0, 0x00002821, 0x00003021,
6542 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014, 0x3c040800,
6543 0x248423d8, 0xa4800000, 0x3c010800, 0xa0201b98, 0x3c010800, 0xac201b9c,
6544 0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4, 0x3c010800, 0xac201bac,
6545 0x3c010800, 0xac201bb8, 0x3c010800, 0xac201bbc, 0x8f624434, 0x3c010800,
6546 0xac221b88, 0x8f624438, 0x3c010800, 0xac221b8c, 0x8f624410, 0xac80f7a8,
6547 0x3c010800, 0xac201b84, 0x3c010800, 0xac2023e0, 0x3c010800, 0xac2023c8,
6548 0x3c010800, 0xac2023cc, 0x3c010800, 0xac202400, 0x3c010800, 0xac221b90,
6549 0x8f620068, 0x24030007, 0x00021702, 0x10430005, 0x00000000, 0x8f620068,
6550 0x00021702, 0x14400004, 0x24020001, 0x3c010800, 0x0a000097, 0xac20240c,
6551 0xac820034, 0x3c040800, 0x24841acc, 0x3c050800, 0x8ca5240c, 0x00003021,
6552 0x00003821, 0xafa00010, 0x0e00067c, 0xafa00014, 0x8fbf0018, 0x03e00008,
6553 0x27bd0020, 0x27bdffe0, 0x3c040800, 0x24841ad8, 0x00002821, 0x00003021,
6554 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014, 0x0e00005b,
6555 0x00000000, 0x0e0000b4, 0x00002021, 0x8fbf0018, 0x03e00008, 0x27bd0020,
6556 0x24020001, 0x8f636820, 0x00821004, 0x00021027, 0x00621824, 0x03e00008,
6557 0xaf636820, 0x27bdffd0, 0xafbf002c, 0xafb60028, 0xafb50024, 0xafb40020,
6558 0xafb3001c, 0xafb20018, 0xafb10014, 0xafb00010, 0x8f675c5c, 0x3c030800,
6559 0x24631bbc, 0x8c620000, 0x14470005, 0x3c0200ff, 0x3c020800, 0x90421b98,
6560 0x14400119, 0x3c0200ff, 0x3442fff8, 0x00e28824, 0xac670000, 0x00111902,
6561 0x306300ff, 0x30e20003, 0x000211c0, 0x00622825, 0x00a04021, 0x00071602,
6562 0x3c030800, 0x90631b98, 0x3044000f, 0x14600036, 0x00804821, 0x24020001,
6563 0x3c010800, 0xa0221b98, 0x00051100, 0x00821025, 0x3c010800, 0xac201b9c,
6564 0x3c010800, 0xac201ba0, 0x3c010800, 0xac201ba4, 0x3c010800, 0xac201bac,
6565 0x3c010800, 0xac201bb8, 0x3c010800, 0xac201bb0, 0x3c010800, 0xac201bb4,
6566 0x3c010800, 0xa42223d8, 0x9622000c, 0x30437fff, 0x3c010800, 0xa4222410,
6567 0x30428000, 0x3c010800, 0xa4231bc6, 0x10400005, 0x24020001, 0x3c010800,
6568 0xac2223f4, 0x0a000102, 0x2406003e, 0x24060036, 0x3c010800, 0xac2023f4,
6569 0x9622000a, 0x3c030800, 0x94631bc6, 0x3c010800, 0xac2023f0, 0x3c010800,
6570 0xac2023f8, 0x00021302, 0x00021080, 0x00c21021, 0x00621821, 0x3c010800,
6571 0xa42223d0, 0x3c010800, 0x0a000115, 0xa4231b96, 0x9622000c, 0x3c010800,
6572 0xa42223ec, 0x3c040800, 0x24841b9c, 0x8c820000, 0x00021100, 0x3c010800,
6573 0x00220821, 0xac311bc8, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
6574 0xac271bcc, 0x8c820000, 0x25030001, 0x306601ff, 0x00021100, 0x3c010800,
6575 0x00220821, 0xac261bd0, 0x8c820000, 0x00021100, 0x3c010800, 0x00220821,
6576 0xac291bd4, 0x96230008, 0x3c020800, 0x8c421bac, 0x00432821, 0x3c010800,
6577 0xac251bac, 0x9622000a, 0x30420004, 0x14400018, 0x00061100, 0x8f630c14,
6578 0x3063000f, 0x2c620002, 0x1440000b, 0x3c02c000, 0x8f630c14, 0x3c020800,
6579 0x8c421b40, 0x3063000f, 0x24420001, 0x3c010800, 0xac221b40, 0x2c620002,
6580 0x1040fff7, 0x3c02c000, 0x00e21825, 0xaf635c5c, 0x8f625c50, 0x30420002,
6581 0x10400014, 0x00000000, 0x0a000147, 0x00000000, 0x3c030800, 0x8c631b80,
6582 0x3c040800, 0x94841b94, 0x01221025, 0x3c010800, 0xa42223da, 0x24020001,
6583 0x3c010800, 0xac221bb8, 0x24630001, 0x0085202a, 0x3c010800, 0x10800003,
6584 0xac231b80, 0x3c010800, 0xa4251b94, 0x3c060800, 0x24c61b9c, 0x8cc20000,
6585 0x24420001, 0xacc20000, 0x28420080, 0x14400005, 0x00000000, 0x0e000656,
6586 0x24040002, 0x0a0001e6, 0x00000000, 0x3c020800, 0x8c421bb8, 0x10400078,
6587 0x24020001, 0x3c050800, 0x90a51b98, 0x14a20072, 0x00000000, 0x3c150800,
6588 0x96b51b96, 0x3c040800, 0x8c841bac, 0x32a3ffff, 0x0083102a, 0x1440006c,
6589 0x00000000, 0x14830003, 0x00000000, 0x3c010800, 0xac2523f0, 0x1060005c,
6590 0x00009021, 0x24d60004, 0x0060a021, 0x24d30014, 0x8ec20000, 0x00028100,
6591 0x3c110800, 0x02308821, 0x0e000625, 0x8e311bc8, 0x00402821, 0x10a00054,
6592 0x00000000, 0x9628000a, 0x31020040, 0x10400005, 0x2407180c, 0x8e22000c,
6593 0x2407188c, 0x00021400, 0xaca20018, 0x3c030800, 0x00701821, 0x8c631bd0,
6594 0x3c020800, 0x00501021, 0x8c421bd4, 0x00031d00, 0x00021400, 0x00621825,
6595 0xaca30014, 0x8ec30004, 0x96220008, 0x00432023, 0x3242ffff, 0x3083ffff,
6596 0x00431021, 0x0282102a, 0x14400002, 0x02b23023, 0x00803021, 0x8e620000,
6597 0x30c4ffff, 0x00441021, 0xae620000, 0x8e220000, 0xaca20000, 0x8e220004,
6598 0x8e63fff4, 0x00431021, 0xaca20004, 0xa4a6000e, 0x8e62fff4, 0x00441021,
6599 0xae62fff4, 0x96230008, 0x0043102a, 0x14400005, 0x02469021, 0x8e62fff0,
6600 0xae60fff4, 0x24420001, 0xae62fff0, 0xaca00008, 0x3242ffff, 0x14540008,
6601 0x24020305, 0x31020080, 0x54400001, 0x34e70010, 0x24020905, 0xa4a2000c,
6602 0x0a0001cb, 0x34e70020, 0xa4a2000c, 0x3c020800, 0x8c4223f0, 0x10400003,
6603 0x3c024b65, 0x0a0001d3, 0x34427654, 0x3c02b49a, 0x344289ab, 0xaca2001c,
6604 0x30e2ffff, 0xaca20010, 0x0e0005a2, 0x00a02021, 0x3242ffff, 0x0054102b,
6605 0x1440ffa9, 0x00000000, 0x24020002, 0x3c010800, 0x0a0001e6, 0xa0221b98,
6606 0x8ec2083c, 0x24420001, 0x0a0001e6, 0xaec2083c, 0x0e0004c0, 0x00000000,
6607 0x8fbf002c, 0x8fb60028, 0x8fb50024, 0x8fb40020, 0x8fb3001c, 0x8fb20018,
6608 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0030, 0x27bdffd0, 0xafbf0028,
6609 0xafb30024, 0xafb20020, 0xafb1001c, 0xafb00018, 0x8f725c9c, 0x3c0200ff,
6610 0x3442fff8, 0x3c070800, 0x24e71bb4, 0x02428824, 0x9623000e, 0x8ce20000,
6611 0x00431021, 0xace20000, 0x8e220010, 0x30420020, 0x14400011, 0x00809821,
6612 0x0e00063b, 0x02202021, 0x3c02c000, 0x02421825, 0xaf635c9c, 0x8f625c90,
6613 0x30420002, 0x1040011e, 0x00000000, 0xaf635c9c, 0x8f625c90, 0x30420002,
6614 0x10400119, 0x00000000, 0x0a00020d, 0x00000000, 0x8e240008, 0x8e230014,
6615 0x00041402, 0x000231c0, 0x00031502, 0x304201ff, 0x2442ffff, 0x3042007f,
6616 0x00031942, 0x30637800, 0x00021100, 0x24424000, 0x00624821, 0x9522000a,
6617 0x3084ffff, 0x30420008, 0x104000b0, 0x000429c0, 0x3c020800, 0x8c422400,
6618 0x14400024, 0x24c50008, 0x94c20014, 0x3c010800, 0xa42223d0, 0x8cc40010,
6619 0x00041402, 0x3c010800, 0xa42223d2, 0x3c010800, 0xa42423d4, 0x94c2000e,
6620 0x3083ffff, 0x00431023, 0x3c010800, 0xac222408, 0x94c2001a, 0x3c010800,
6621 0xac262400, 0x3c010800, 0xac322404, 0x3c010800, 0xac2223fc, 0x3c02c000,
6622 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000e5, 0x00000000,
6623 0xaf635c9c, 0x8f625c90, 0x30420002, 0x104000e0, 0x00000000, 0x0a000246,
6624 0x00000000, 0x94c2000e, 0x3c030800, 0x946323d4, 0x00434023, 0x3103ffff,
6625 0x2c620008, 0x1040001c, 0x00000000, 0x94c20014, 0x24420028, 0x00a22821,
6626 0x00031042, 0x1840000b, 0x00002021, 0x24e60848, 0x00403821, 0x94a30000,
6627 0x8cc20000, 0x24840001, 0x00431021, 0xacc20000, 0x0087102a, 0x1440fff9,
6628 0x24a50002, 0x31020001, 0x1040001f, 0x3c024000, 0x3c040800, 0x248423fc,
6629 0xa0a00001, 0x94a30000, 0x8c820000, 0x00431021, 0x0a000285, 0xac820000,
6630 0x8f626800, 0x3c030010, 0x00431024, 0x10400009, 0x00000000, 0x94c2001a,
6631 0x3c030800, 0x8c6323fc, 0x00431021, 0x3c010800, 0xac2223fc, 0x0a000286,
6632 0x3c024000, 0x94c2001a, 0x94c4001c, 0x3c030800, 0x8c6323fc, 0x00441023,
6633 0x00621821, 0x3c010800, 0xac2323fc, 0x3c024000, 0x02421825, 0xaf635c9c,
6634 0x8f625c90, 0x30420002, 0x1440fffc, 0x00000000, 0x9522000a, 0x30420010,
6635 0x1040009b, 0x00000000, 0x3c030800, 0x946323d4, 0x3c070800, 0x24e72400,
6636 0x8ce40000, 0x8f626800, 0x24630030, 0x00832821, 0x3c030010, 0x00431024,
6637 0x1440000a, 0x00000000, 0x94a20004, 0x3c040800, 0x8c842408, 0x3c030800,
6638 0x8c6323fc, 0x00441023, 0x00621821, 0x3c010800, 0xac2323fc, 0x3c040800,
6639 0x8c8423fc, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402, 0x00822021,
6640 0x00041027, 0xa4a20006, 0x3c030800, 0x8c632404, 0x3c0200ff, 0x3442fff8,
6641 0x00628824, 0x96220008, 0x24050001, 0x24034000, 0x000231c0, 0x00801021,
6642 0xa4c2001a, 0xa4c0001c, 0xace00000, 0x3c010800, 0xac251b60, 0xaf635cb8,
6643 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000, 0x3c010800, 0xac201b60,
6644 0x8e220008, 0xaf625cb8, 0x8f625cb0, 0x30420002, 0x10400003, 0x00000000,
6645 0x3c010800, 0xac201b60, 0x3c020800, 0x8c421b60, 0x1040ffec, 0x00000000,
6646 0x3c040800, 0x0e00063b, 0x8c842404, 0x0a00032a, 0x00000000, 0x3c030800,
6647 0x90631b98, 0x24020002, 0x14620003, 0x3c034b65, 0x0a0002e1, 0x00008021,
6648 0x8e22001c, 0x34637654, 0x10430002, 0x24100002, 0x24100001, 0x00c02021,
6649 0x0e000350, 0x02003021, 0x24020003, 0x3c010800, 0xa0221b98, 0x24020002,
6650 0x1202000a, 0x24020001, 0x3c030800, 0x8c6323f0, 0x10620006, 0x00000000,
6651 0x3c020800, 0x944223d8, 0x00021400, 0x0a00031f, 0xae220014, 0x3c040800,
6652 0x248423da, 0x94820000, 0x00021400, 0xae220014, 0x3c020800, 0x8c421bbc,
6653 0x3c03c000, 0x3c010800, 0xa0201b98, 0x00431025, 0xaf625c5c, 0x8f625c50,
6654 0x30420002, 0x10400009, 0x00000000, 0x2484f7e2, 0x8c820000, 0x00431025,
6655 0xaf625c5c, 0x8f625c50, 0x30420002, 0x1440fffa, 0x00000000, 0x3c020800,
6656 0x24421b84, 0x8c430000, 0x24630001, 0xac430000, 0x8f630c14, 0x3063000f,
6657 0x2c620002, 0x1440000c, 0x3c024000, 0x8f630c14, 0x3c020800, 0x8c421b40,
6658 0x3063000f, 0x24420001, 0x3c010800, 0xac221b40, 0x2c620002, 0x1040fff7,
6659 0x00000000, 0x3c024000, 0x02421825, 0xaf635c9c, 0x8f625c90, 0x30420002,
6660 0x1440fffc, 0x00000000, 0x12600003, 0x00000000, 0x0e0004c0, 0x00000000,
6661 0x8fbf0028, 0x8fb30024, 0x8fb20020, 0x8fb1001c, 0x8fb00018, 0x03e00008,
6662 0x27bd0030, 0x8f634450, 0x3c040800, 0x24841b88, 0x8c820000, 0x00031c02,
6663 0x0043102b, 0x14400007, 0x3c038000, 0x8c840004, 0x8f624450, 0x00021c02,
6664 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024,
6665 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3c024000,
6666 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00000000,
6667 0x03e00008, 0x00000000, 0x27bdffe0, 0x00805821, 0x14c00011, 0x256e0008,
6668 0x3c020800, 0x8c4223f4, 0x10400007, 0x24020016, 0x3c010800, 0xa42223d2,
6669 0x2402002a, 0x3c010800, 0x0a000364, 0xa42223d4, 0x8d670010, 0x00071402,
6670 0x3c010800, 0xa42223d2, 0x3c010800, 0xa42723d4, 0x3c040800, 0x948423d4,
6671 0x3c030800, 0x946323d2, 0x95cf0006, 0x3c020800, 0x944223d0, 0x00832023,
6672 0x01e2c023, 0x3065ffff, 0x24a20028, 0x01c24821, 0x3082ffff, 0x14c0001a,
6673 0x01226021, 0x9582000c, 0x3042003f, 0x3c010800, 0xa42223d6, 0x95820004,
6674 0x95830006, 0x3c010800, 0xac2023e4, 0x3c010800, 0xac2023e8, 0x00021400,
6675 0x00431025, 0x3c010800, 0xac221bc0, 0x95220004, 0x3c010800, 0xa4221bc4,
6676 0x95230002, 0x01e51023, 0x0043102a, 0x10400010, 0x24020001, 0x3c010800,
6677 0x0a000398, 0xac2223f8, 0x3c030800, 0x8c6323e8, 0x3c020800, 0x94421bc4,
6678 0x00431021, 0xa5220004, 0x3c020800, 0x94421bc0, 0xa5820004, 0x3c020800,
6679 0x8c421bc0, 0xa5820006, 0x3c020800, 0x8c4223f0, 0x3c0d0800, 0x8dad23e4,
6680 0x3c0a0800, 0x144000e5, 0x8d4a23e8, 0x3c020800, 0x94421bc4, 0x004a1821,
6681 0x3063ffff, 0x0062182b, 0x24020002, 0x10c2000d, 0x01435023, 0x3c020800,
6682 0x944223d6, 0x30420009, 0x10400008, 0x00000000, 0x9582000c, 0x3042fff6,
6683 0xa582000c, 0x3c020800, 0x944223d6, 0x30420009, 0x01a26823, 0x3c020800,
6684 0x8c4223f8, 0x1040004a, 0x01203821, 0x3c020800, 0x944223d2, 0x00004021,
6685 0xa520000a, 0x01e21023, 0xa5220002, 0x3082ffff, 0x00021042, 0x18400008,
6686 0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021, 0x0103102a,
6687 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061402,
6688 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, 0x00003021, 0x2527000c,
6689 0x00004021, 0x94e20000, 0x25080001, 0x00c23021, 0x2d020004, 0x1440fffb,
6690 0x24e70002, 0x95220002, 0x00004021, 0x91230009, 0x00442023, 0x01803821,
6691 0x3082ffff, 0xa4e00010, 0x00621821, 0x00021042, 0x18400010, 0x00c33021,
6692 0x00404821, 0x94e20000, 0x24e70002, 0x00c23021, 0x30e2007f, 0x14400006,
6693 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80, 0x00625824, 0x25670008,
6694 0x0109102a, 0x1440fff3, 0x00000000, 0x30820001, 0x10400005, 0x00061c02,
6695 0xa0e00001, 0x94e20000, 0x00c23021, 0x00061c02, 0x30c2ffff, 0x00623021,
6696 0x00061402, 0x00c23021, 0x0a00047d, 0x30c6ffff, 0x24020002, 0x14c20081,
6697 0x00000000, 0x3c020800, 0x8c42240c, 0x14400007, 0x00000000, 0x3c020800,
6698 0x944223d2, 0x95230002, 0x01e21023, 0x10620077, 0x00000000, 0x3c020800,
6699 0x944223d2, 0x01e21023, 0xa5220002, 0x3c020800, 0x8c42240c, 0x1040001a,
6700 0x31e3ffff, 0x8dc70010, 0x3c020800, 0x94421b96, 0x00e04021, 0x00072c02,
6701 0x00aa2021, 0x00431023, 0x00823823, 0x00072402, 0x30e2ffff, 0x00823821,
6702 0x00071027, 0xa522000a, 0x3102ffff, 0x3c040800, 0x948423d4, 0x00453023,
6703 0x00e02821, 0x00641823, 0x006d1821, 0x00c33021, 0x00061c02, 0x30c2ffff,
6704 0x0a00047d, 0x00623021, 0x01203821, 0x00004021, 0x3082ffff, 0x00021042,
6705 0x18400008, 0x00003021, 0x00401821, 0x94e20000, 0x25080001, 0x00c23021,
6706 0x0103102a, 0x1440fffb, 0x24e70002, 0x00061c02, 0x30c2ffff, 0x00623021,
6707 0x00061402, 0x00c23021, 0x00c02821, 0x00061027, 0xa522000a, 0x00003021,
6708 0x2527000c, 0x00004021, 0x94e20000, 0x25080001, 0x00c23021, 0x2d020004,
6709 0x1440fffb, 0x24e70002, 0x95220002, 0x00004021, 0x91230009, 0x00442023,
6710 0x01803821, 0x3082ffff, 0xa4e00010, 0x3c040800, 0x948423d4, 0x00621821,
6711 0x00c33021, 0x00061c02, 0x30c2ffff, 0x00623021, 0x00061c02, 0x3c020800,
6712 0x944223d0, 0x00c34821, 0x00441023, 0x00021fc2, 0x00431021, 0x00021043,
6713 0x18400010, 0x00003021, 0x00402021, 0x94e20000, 0x24e70002, 0x00c23021,
6714 0x30e2007f, 0x14400006, 0x25080001, 0x8d630000, 0x3c02007f, 0x3442ff80,
6715 0x00625824, 0x25670008, 0x0104102a, 0x1440fff3, 0x00000000, 0x3c020800,
6716 0x944223ec, 0x00c23021, 0x3122ffff, 0x00c23021, 0x00061c02, 0x30c2ffff,
6717 0x00623021, 0x00061402, 0x00c23021, 0x00c04021, 0x00061027, 0xa5820010,
6718 0xadc00014, 0x0a00049d, 0xadc00000, 0x8dc70010, 0x00e04021, 0x11400007,
6719 0x00072c02, 0x00aa3021, 0x00061402, 0x30c3ffff, 0x00433021, 0x00061402,
6720 0x00c22821, 0x00051027, 0xa522000a, 0x3c030800, 0x946323d4, 0x3102ffff,
6721 0x01e21021, 0x00433023, 0x00cd3021, 0x00061c02, 0x30c2ffff, 0x00623021,
6722 0x00061402, 0x00c23021, 0x00c04021, 0x00061027, 0xa5820010, 0x3102ffff,
6723 0x00051c00, 0x00431025, 0xadc20010, 0x3c020800, 0x8c4223f4, 0x10400005,
6724 0x2de205eb, 0x14400002, 0x25e2fff2, 0x34028870, 0xa5c20034, 0x3c030800,
6725 0x246323e8, 0x8c620000, 0x24420001, 0xac620000, 0x3c040800, 0x8c8423e4,
6726 0x3c020800, 0x8c421bc0, 0x3303ffff, 0x00832021, 0x00431821, 0x0062102b,
6727 0x3c010800, 0xac2423e4, 0x10400003, 0x2482ffff, 0x3c010800, 0xac2223e4,
6728 0x3c010800, 0xac231bc0, 0x03e00008, 0x27bd0020, 0x27bdffb8, 0x3c050800,
6729 0x24a51b96, 0xafbf0044, 0xafbe0040, 0xafb7003c, 0xafb60038, 0xafb50034,
6730 0xafb40030, 0xafb3002c, 0xafb20028, 0xafb10024, 0xafb00020, 0x94a90000,
6731 0x3c020800, 0x944223d0, 0x3c030800, 0x8c631bb0, 0x3c040800, 0x8c841bac,
6732 0x01221023, 0x0064182a, 0xa7a9001e, 0x106000be, 0xa7a20016, 0x24be0022,
6733 0x97b6001e, 0x24b3001a, 0x24b70016, 0x8fc20000, 0x14400008, 0x00000000,
6734 0x8fc2fff8, 0x97a30016, 0x8fc4fff4, 0x00431021, 0x0082202a, 0x148000b0,
6735 0x00000000, 0x97d50818, 0x32a2ffff, 0x104000a3, 0x00009021, 0x0040a021,
6736 0x00008821, 0x0e000625, 0x00000000, 0x00403021, 0x14c00007, 0x00000000,
6737 0x3c020800, 0x8c4223dc, 0x24420001, 0x3c010800, 0x0a000596, 0xac2223dc,
6738 0x3c100800, 0x02118021, 0x8e101bc8, 0x9608000a, 0x31020040, 0x10400005,
6739 0x2407180c, 0x8e02000c, 0x2407188c, 0x00021400, 0xacc20018, 0x31020080,
6740 0x54400001, 0x34e70010, 0x3c020800, 0x00511021, 0x8c421bd0, 0x3c030800,
6741 0x00711821, 0x8c631bd4, 0x00021500, 0x00031c00, 0x00431025, 0xacc20014,
6742 0x96040008, 0x3242ffff, 0x00821021, 0x0282102a, 0x14400002, 0x02b22823,
6743 0x00802821, 0x8e020000, 0x02459021, 0xacc20000, 0x8e020004, 0x00c02021,
6744 0x26310010, 0xac820004, 0x30e2ffff, 0xac800008, 0xa485000e, 0xac820010,
6745 0x24020305, 0x0e0005a2, 0xa482000c, 0x3242ffff, 0x0054102b, 0x1440ffc5,
6746 0x3242ffff, 0x0a00058e, 0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a,
6747 0x10400067, 0x00000000, 0x8e62fff0, 0x00028900, 0x3c100800, 0x02118021,
6748 0x0e000625, 0x8e101bc8, 0x00403021, 0x14c00005, 0x00000000, 0x8e62082c,
6749 0x24420001, 0x0a000596, 0xae62082c, 0x9608000a, 0x31020040, 0x10400005,
6750 0x2407180c, 0x8e02000c, 0x2407188c, 0x00021400, 0xacc20018, 0x3c020800,
6751 0x00511021, 0x8c421bd0, 0x3c030800, 0x00711821, 0x8c631bd4, 0x00021500,
6752 0x00031c00, 0x00431025, 0xacc20014, 0x8e63fff4, 0x96020008, 0x00432023,
6753 0x3242ffff, 0x3083ffff, 0x00431021, 0x02c2102a, 0x10400003, 0x00802821,
6754 0x97a9001e, 0x01322823, 0x8e620000, 0x30a4ffff, 0x00441021, 0xae620000,
6755 0xa4c5000e, 0x8e020000, 0xacc20000, 0x8e020004, 0x8e63fff4, 0x00431021,
6756 0xacc20004, 0x8e63fff4, 0x96020008, 0x00641821, 0x0062102a, 0x14400006,
6757 0x02459021, 0x8e62fff0, 0xae60fff4, 0x24420001, 0x0a000571, 0xae62fff0,
6758 0xae63fff4, 0xacc00008, 0x3242ffff, 0x10560003, 0x31020004, 0x10400006,
6759 0x24020305, 0x31020080, 0x54400001, 0x34e70010, 0x34e70020, 0x24020905,
6760 0xa4c2000c, 0x8ee30000, 0x8ee20004, 0x14620007, 0x3c02b49a, 0x8ee20860,
6761 0x54400001, 0x34e70400, 0x3c024b65, 0x0a000588, 0x34427654, 0x344289ab,
6762 0xacc2001c, 0x30e2ffff, 0xacc20010, 0x0e0005a2, 0x00c02021, 0x3242ffff,
6763 0x0056102b, 0x1440ff9b, 0x00000000, 0x8e620000, 0x8e63fffc, 0x0043102a,
6764 0x1440ff48, 0x00000000, 0x8fbf0044, 0x8fbe0040, 0x8fb7003c, 0x8fb60038,
6765 0x8fb50034, 0x8fb40030, 0x8fb3002c, 0x8fb20028, 0x8fb10024, 0x8fb00020,
6766 0x03e00008, 0x27bd0048, 0x27bdffe8, 0xafbf0014, 0xafb00010, 0x8f624450,
6767 0x8f634410, 0x0a0005b1, 0x00808021, 0x8f626820, 0x30422000, 0x10400003,
6768 0x00000000, 0x0e0001f0, 0x00002021, 0x8f624450, 0x8f634410, 0x3042ffff,
6769 0x0043102b, 0x1440fff5, 0x00000000, 0x8f630c14, 0x3063000f, 0x2c620002,
6770 0x1440000b, 0x00000000, 0x8f630c14, 0x3c020800, 0x8c421b40, 0x3063000f,
6771 0x24420001, 0x3c010800, 0xac221b40, 0x2c620002, 0x1040fff7, 0x00000000,
6772 0xaf705c18, 0x8f625c10, 0x30420002, 0x10400009, 0x00000000, 0x8f626820,
6773 0x30422000, 0x1040fff8, 0x00000000, 0x0e0001f0, 0x00002021, 0x0a0005c4,
6774 0x00000000, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x00000000,
6775 0x00000000, 0x00000000, 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010,
6776 0xaf60680c, 0x8f626804, 0x34420082, 0xaf626804, 0x8f634000, 0x24020b50,
6777 0x3c010800, 0xac221b54, 0x24020b78, 0x3c010800, 0xac221b64, 0x34630002,
6778 0xaf634000, 0x0e000605, 0x00808021, 0x3c010800, 0xa0221b68, 0x304200ff,
6779 0x24030002, 0x14430005, 0x00000000, 0x3c020800, 0x8c421b54, 0x0a0005f8,
6780 0xac5000c0, 0x3c020800, 0x8c421b54, 0xac5000bc, 0x8f624434, 0x8f634438,
6781 0x8f644410, 0x3c010800, 0xac221b5c, 0x3c010800, 0xac231b6c, 0x3c010800,
6782 0xac241b58, 0x8fbf0014, 0x8fb00010, 0x03e00008, 0x27bd0018, 0x3c040800,
6783 0x8c870000, 0x3c03aa55, 0x3463aa55, 0x3c06c003, 0xac830000, 0x8cc20000,
6784 0x14430007, 0x24050002, 0x3c0355aa, 0x346355aa, 0xac830000, 0x8cc20000,
6785 0x50430001, 0x24050001, 0x3c020800, 0xac470000, 0x03e00008, 0x00a01021,
6786 0x27bdfff8, 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c, 0x1043fffe,
6787 0x00000000, 0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000, 0x03e00008,
6788 0x27bd0008, 0x8f634450, 0x3c020800, 0x8c421b5c, 0x00031c02, 0x0043102b,
6789 0x14400008, 0x3c038000, 0x3c040800, 0x8c841b6c, 0x8f624450, 0x00021c02,
6790 0x0083102b, 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024,
6791 0x1440fffd, 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3082ffff,
6792 0x2442e000, 0x2c422001, 0x14400003, 0x3c024000, 0x0a000648, 0x2402ffff,
6793 0x00822025, 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00001021,
6794 0x03e00008, 0x00000000, 0x8f624450, 0x3c030800, 0x8c631b58, 0x0a000651,
6795 0x3042ffff, 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc, 0x00000000,
6796 0x03e00008, 0x00000000, 0x27bdffe0, 0x00802821, 0x3c040800, 0x24841af0,
6797 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010, 0x0e00067c, 0xafa00014,
6798 0x0a000660, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x00000000,
6799 0x00000000, 0x00000000, 0x3c020800, 0x34423000, 0x3c030800, 0x34633000,
6800 0x3c040800, 0x348437ff, 0x3c010800, 0xac221b74, 0x24020040, 0x3c010800,
6801 0xac221b78, 0x3c010800, 0xac201b70, 0xac600000, 0x24630004, 0x0083102b,
6802 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000, 0x00804821, 0x8faa0010,
6803 0x3c020800, 0x8c421b70, 0x3c040800, 0x8c841b78, 0x8fab0014, 0x24430001,
6804 0x0044102b, 0x3c010800, 0xac231b70, 0x14400003, 0x00004021, 0x3c010800,
6805 0xac201b70, 0x3c020800, 0x8c421b70, 0x3c030800, 0x8c631b74, 0x91240000,
6806 0x00021140, 0x00431021, 0x00481021, 0x25080001, 0xa0440000, 0x29020008,
6807 0x1440fff4, 0x25290001, 0x3c020800, 0x8c421b70, 0x3c030800, 0x8c631b74,
6808 0x8f64680c, 0x00021140, 0x00431021, 0xac440008, 0xac45000c, 0xac460010,
6809 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c, 0x00000000, 0x00000000,
6810};
6811
6812static const u32 tg3TsoFwRodata[] = {
6813 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, 0x00000000,
6814 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x496e0000, 0x73746b6f,
6815 0x66662a2a, 0x00000000, 0x53774576, 0x656e7430, 0x00000000, 0x00000000,
6816 0x00000000, 0x00000000, 0x66617461, 0x6c457272, 0x00000000, 0x00000000,
6817 0x00000000,
6818};
6819
6820static const u32 tg3TsoFwData[] = {
6821 0x00000000, 0x73746b6f, 0x66666c64, 0x5f76312e, 0x362e3000, 0x00000000,
6822 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
6823 0x00000000,
6824};
6825
6826/* 5705 needs a special version of the TSO firmware. */ 6378/* 5705 needs a special version of the TSO firmware. */
6827#define TG3_TSO5_FW_RELEASE_MAJOR 0x1
6828#define TG3_TSO5_FW_RELASE_MINOR 0x2
6829#define TG3_TSO5_FW_RELEASE_FIX 0x0
6830#define TG3_TSO5_FW_START_ADDR 0x00010000
6831#define TG3_TSO5_FW_TEXT_ADDR 0x00010000
6832#define TG3_TSO5_FW_TEXT_LEN 0xe90
6833#define TG3_TSO5_FW_RODATA_ADDR 0x00010e90
6834#define TG3_TSO5_FW_RODATA_LEN 0x50
6835#define TG3_TSO5_FW_DATA_ADDR 0x00010f00
6836#define TG3_TSO5_FW_DATA_LEN 0x20
6837#define TG3_TSO5_FW_SBSS_ADDR 0x00010f20
6838#define TG3_TSO5_FW_SBSS_LEN 0x28
6839#define TG3_TSO5_FW_BSS_ADDR 0x00010f50
6840#define TG3_TSO5_FW_BSS_LEN 0x88
6841
6842static const u32 tg3Tso5FwText[(TG3_TSO5_FW_TEXT_LEN / 4) + 1] = {
6843 0x0c004003, 0x00000000, 0x00010f04, 0x00000000, 0x10000003, 0x00000000,
6844 0x0000000d, 0x0000000d, 0x3c1d0001, 0x37bde000, 0x03a0f021, 0x3c100001,
6845 0x26100000, 0x0c004010, 0x00000000, 0x0000000d, 0x27bdffe0, 0x3c04fefe,
6846 0xafbf0018, 0x0c0042e8, 0x34840002, 0x0c004364, 0x00000000, 0x3c030001,
6847 0x90630f34, 0x24020002, 0x3c040001, 0x24840e9c, 0x14620003, 0x24050001,
6848 0x3c040001, 0x24840e90, 0x24060002, 0x00003821, 0xafa00010, 0x0c004378,
6849 0xafa00014, 0x0c00402c, 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020,
6850 0x00000000, 0x00000000, 0x27bdffe0, 0xafbf001c, 0xafb20018, 0xafb10014,
6851 0x0c0042d4, 0xafb00010, 0x3c128000, 0x24110001, 0x8f706810, 0x32020400,
6852 0x10400007, 0x00000000, 0x8f641008, 0x00921024, 0x14400003, 0x00000000,
6853 0x0c004064, 0x00000000, 0x3c020001, 0x90420f56, 0x10510003, 0x32020200,
6854 0x1040fff1, 0x00000000, 0x0c0041b4, 0x00000000, 0x08004034, 0x00000000,
6855 0x8fbf001c, 0x8fb20018, 0x8fb10014, 0x8fb00010, 0x03e00008, 0x27bd0020,
6856 0x27bdffe0, 0x3c040001, 0x24840eb0, 0x00002821, 0x00003021, 0x00003821,
6857 0xafbf0018, 0xafa00010, 0x0c004378, 0xafa00014, 0x0000d021, 0x24020130,
6858 0xaf625000, 0x3c010001, 0xa4200f50, 0x3c010001, 0xa0200f57, 0x8fbf0018,
6859 0x03e00008, 0x27bd0020, 0x00000000, 0x00000000, 0x3c030001, 0x24630f60,
6860 0x90620000, 0x27bdfff0, 0x14400003, 0x0080c021, 0x08004073, 0x00004821,
6861 0x3c022000, 0x03021024, 0x10400003, 0x24090002, 0x08004073, 0xa0600000,
6862 0x24090001, 0x00181040, 0x30431f80, 0x346f8008, 0x1520004b, 0x25eb0028,
6863 0x3c040001, 0x00832021, 0x8c848010, 0x3c050001, 0x24a50f7a, 0x00041402,
6864 0xa0a20000, 0x3c010001, 0xa0240f7b, 0x3c020001, 0x00431021, 0x94428014,
6865 0x3c010001, 0xa0220f7c, 0x3c0c0001, 0x01836021, 0x8d8c8018, 0x304200ff,
6866 0x24420008, 0x000220c3, 0x24020001, 0x3c010001, 0xa0220f60, 0x0124102b,
6867 0x1040000c, 0x00003821, 0x24a6000e, 0x01602821, 0x8ca20000, 0x8ca30004,
6868 0x24a50008, 0x24e70001, 0xacc20000, 0xacc30004, 0x00e4102b, 0x1440fff8,
6869 0x24c60008, 0x00003821, 0x3c080001, 0x25080f7b, 0x91060000, 0x3c020001,
6870 0x90420f7c, 0x2503000d, 0x00c32821, 0x00461023, 0x00021fc2, 0x00431021,
6871 0x00021043, 0x1840000c, 0x00002021, 0x91020001, 0x00461023, 0x00021fc2,
6872 0x00431021, 0x00021843, 0x94a20000, 0x24e70001, 0x00822021, 0x00e3102a,
6873 0x1440fffb, 0x24a50002, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
6874 0x00822021, 0x3c02ffff, 0x01821024, 0x3083ffff, 0x00431025, 0x3c010001,
6875 0x080040fa, 0xac220f80, 0x3c050001, 0x24a50f7c, 0x90a20000, 0x3c0c0001,
6876 0x01836021, 0x8d8c8018, 0x000220c2, 0x1080000e, 0x00003821, 0x01603021,
6877 0x24a5000c, 0x8ca20000, 0x8ca30004, 0x24a50008, 0x24e70001, 0xacc20000,
6878 0xacc30004, 0x00e4102b, 0x1440fff8, 0x24c60008, 0x3c050001, 0x24a50f7c,
6879 0x90a20000, 0x30430007, 0x24020004, 0x10620011, 0x28620005, 0x10400005,
6880 0x24020002, 0x10620008, 0x000710c0, 0x080040fa, 0x00000000, 0x24020006,
6881 0x1062000e, 0x000710c0, 0x080040fa, 0x00000000, 0x00a21821, 0x9463000c,
6882 0x004b1021, 0x080040fa, 0xa4430000, 0x000710c0, 0x00a21821, 0x8c63000c,
6883 0x004b1021, 0x080040fa, 0xac430000, 0x00a21821, 0x8c63000c, 0x004b2021,
6884 0x00a21021, 0xac830000, 0x94420010, 0xa4820004, 0x95e70006, 0x3c020001,
6885 0x90420f7c, 0x3c030001, 0x90630f7a, 0x00e2c823, 0x3c020001, 0x90420f7b,
6886 0x24630028, 0x01e34021, 0x24420028, 0x15200012, 0x01e23021, 0x94c2000c,
6887 0x3c010001, 0xa4220f78, 0x94c20004, 0x94c30006, 0x3c010001, 0xa4200f76,
6888 0x3c010001, 0xa4200f72, 0x00021400, 0x00431025, 0x3c010001, 0xac220f6c,
6889 0x95020004, 0x3c010001, 0x08004124, 0xa4220f70, 0x3c020001, 0x94420f70,
6890 0x3c030001, 0x94630f72, 0x00431021, 0xa5020004, 0x3c020001, 0x94420f6c,
6891 0xa4c20004, 0x3c020001, 0x8c420f6c, 0xa4c20006, 0x3c040001, 0x94840f72,
6892 0x3c020001, 0x94420f70, 0x3c0a0001, 0x954a0f76, 0x00441821, 0x3063ffff,
6893 0x0062182a, 0x24020002, 0x1122000b, 0x00832023, 0x3c030001, 0x94630f78,
6894 0x30620009, 0x10400006, 0x3062fff6, 0xa4c2000c, 0x3c020001, 0x94420f78,
6895 0x30420009, 0x01425023, 0x24020001, 0x1122001b, 0x29220002, 0x50400005,
6896 0x24020002, 0x11200007, 0x31a2ffff, 0x08004197, 0x00000000, 0x1122001d,
6897 0x24020016, 0x08004197, 0x31a2ffff, 0x3c0e0001, 0x95ce0f80, 0x10800005,
6898 0x01806821, 0x01c42021, 0x00041c02, 0x3082ffff, 0x00627021, 0x000e1027,
6899 0xa502000a, 0x3c030001, 0x90630f7b, 0x31a2ffff, 0x00e21021, 0x0800418d,
6900 0x00432023, 0x3c020001, 0x94420f80, 0x00442021, 0x00041c02, 0x3082ffff,
6901 0x00622021, 0x00807021, 0x00041027, 0x08004185, 0xa502000a, 0x3c050001,
6902 0x24a50f7a, 0x90a30000, 0x14620002, 0x24e2fff2, 0xa5e20034, 0x90a20000,
6903 0x00e21023, 0xa5020002, 0x3c030001, 0x94630f80, 0x3c020001, 0x94420f5a,
6904 0x30e5ffff, 0x00641821, 0x00451023, 0x00622023, 0x00041c02, 0x3082ffff,
6905 0x00622021, 0x00041027, 0xa502000a, 0x3c030001, 0x90630f7c, 0x24620001,
6906 0x14a20005, 0x00807021, 0x01631021, 0x90420000, 0x08004185, 0x00026200,
6907 0x24620002, 0x14a20003, 0x306200fe, 0x004b1021, 0x944c0000, 0x3c020001,
6908 0x94420f82, 0x3183ffff, 0x3c040001, 0x90840f7b, 0x00431021, 0x00e21021,
6909 0x00442023, 0x008a2021, 0x00041c02, 0x3082ffff, 0x00622021, 0x00041402,
6910 0x00822021, 0x00806821, 0x00041027, 0xa4c20010, 0x31a2ffff, 0x000e1c00,
6911 0x00431025, 0x3c040001, 0x24840f72, 0xade20010, 0x94820000, 0x3c050001,
6912 0x94a50f76, 0x3c030001, 0x8c630f6c, 0x24420001, 0x00b92821, 0xa4820000,
6913 0x3322ffff, 0x00622021, 0x0083182b, 0x3c010001, 0xa4250f76, 0x10600003,
6914 0x24a2ffff, 0x3c010001, 0xa4220f76, 0x3c024000, 0x03021025, 0x3c010001,
6915 0xac240f6c, 0xaf621008, 0x03e00008, 0x27bd0010, 0x3c030001, 0x90630f56,
6916 0x27bdffe8, 0x24020001, 0xafbf0014, 0x10620026, 0xafb00010, 0x8f620cf4,
6917 0x2442ffff, 0x3042007f, 0x00021100, 0x8c434000, 0x3c010001, 0xac230f64,
6918 0x8c434008, 0x24444000, 0x8c5c4004, 0x30620040, 0x14400002, 0x24020088,
6919 0x24020008, 0x3c010001, 0xa4220f68, 0x30620004, 0x10400005, 0x24020001,
6920 0x3c010001, 0xa0220f57, 0x080041d5, 0x00031402, 0x3c010001, 0xa0200f57,
6921 0x00031402, 0x3c010001, 0xa4220f54, 0x9483000c, 0x24020001, 0x3c010001,
6922 0xa4200f50, 0x3c010001, 0xa0220f56, 0x3c010001, 0xa4230f62, 0x24020001,
6923 0x1342001e, 0x00000000, 0x13400005, 0x24020003, 0x13420067, 0x00000000,
6924 0x080042cf, 0x00000000, 0x3c020001, 0x94420f62, 0x241a0001, 0x3c010001,
6925 0xa4200f5e, 0x3c010001, 0xa4200f52, 0x304407ff, 0x00021bc2, 0x00031823,
6926 0x3063003e, 0x34630036, 0x00021242, 0x3042003c, 0x00621821, 0x3c010001,
6927 0xa4240f58, 0x00832021, 0x24630030, 0x3c010001, 0xa4240f5a, 0x3c010001,
6928 0xa4230f5c, 0x3c060001, 0x24c60f52, 0x94c50000, 0x94c30002, 0x3c040001,
6929 0x94840f5a, 0x00651021, 0x0044102a, 0x10400013, 0x3c108000, 0x00a31021,
6930 0xa4c20000, 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f56, 0x8f641008,
6931 0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4,
6932 0x00501024, 0x104000b7, 0x00000000, 0x0800420f, 0x00000000, 0x3c030001,
6933 0x94630f50, 0x00851023, 0xa4c40000, 0x00621821, 0x3042ffff, 0x3c010001,
6934 0xa4230f50, 0xaf620ce8, 0x3c020001, 0x94420f68, 0x34420024, 0xaf620cec,
6935 0x94c30002, 0x3c020001, 0x94420f50, 0x14620012, 0x3c028000, 0x3c108000,
6936 0x3c02a000, 0xaf620cf4, 0x3c010001, 0xa0200f56, 0x8f641008, 0x00901024,
6937 0x14400003, 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024,
6938 0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003, 0xaf620cf4, 0x3c108000,
6939 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064, 0x00000000,
6940 0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x080042cf, 0x241a0003,
6941 0x3c070001, 0x24e70f50, 0x94e20000, 0x03821021, 0xaf620ce0, 0x3c020001,
6942 0x8c420f64, 0xaf620ce4, 0x3c050001, 0x94a50f54, 0x94e30000, 0x3c040001,
6943 0x94840f58, 0x3c020001, 0x94420f5e, 0x00a32823, 0x00822023, 0x30a6ffff,
6944 0x3083ffff, 0x00c3102b, 0x14400043, 0x00000000, 0x3c020001, 0x94420f5c,
6945 0x00021400, 0x00621025, 0xaf620ce8, 0x94e20000, 0x3c030001, 0x94630f54,
6946 0x00441021, 0xa4e20000, 0x3042ffff, 0x14430021, 0x3c020008, 0x3c020001,
6947 0x90420f57, 0x10400006, 0x3c03000c, 0x3c020001, 0x94420f68, 0x34630624,
6948 0x0800427c, 0x0000d021, 0x3c020001, 0x94420f68, 0x3c030008, 0x34630624,
6949 0x00431025, 0xaf620cec, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
6950 0xa0200f56, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
6951 0x00000000, 0x8f620cf4, 0x00501024, 0x10400015, 0x00000000, 0x08004283,
6952 0x00000000, 0x3c030001, 0x94630f68, 0x34420624, 0x3c108000, 0x00621825,
6953 0x3c028000, 0xaf630cec, 0xaf620cf4, 0x8f641008, 0x00901024, 0x14400003,
6954 0x00000000, 0x0c004064, 0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7,
6955 0x00000000, 0x3c010001, 0x080042cf, 0xa4200f5e, 0x3c020001, 0x94420f5c,
6956 0x00021400, 0x00c21025, 0xaf620ce8, 0x3c020001, 0x90420f57, 0x10400009,
6957 0x3c03000c, 0x3c020001, 0x94420f68, 0x34630624, 0x0000d021, 0x00431025,
6958 0xaf620cec, 0x080042c1, 0x3c108000, 0x3c020001, 0x94420f68, 0x3c030008,
6959 0x34630604, 0x00431025, 0xaf620cec, 0x3c020001, 0x94420f5e, 0x00451021,
6960 0x3c010001, 0xa4220f5e, 0x3c108000, 0x3c02a000, 0xaf620cf4, 0x3c010001,
6961 0xa0200f56, 0x8f641008, 0x00901024, 0x14400003, 0x00000000, 0x0c004064,
6962 0x00000000, 0x8f620cf4, 0x00501024, 0x1440fff7, 0x00000000, 0x8fbf0014,
6963 0x8fb00010, 0x03e00008, 0x27bd0018, 0x00000000, 0x27bdffe0, 0x3c040001,
6964 0x24840ec0, 0x00002821, 0x00003021, 0x00003821, 0xafbf0018, 0xafa00010,
6965 0x0c004378, 0xafa00014, 0x0000d021, 0x24020130, 0xaf625000, 0x3c010001,
6966 0xa4200f50, 0x3c010001, 0xa0200f57, 0x8fbf0018, 0x03e00008, 0x27bd0020,
6967 0x27bdffe8, 0x3c1bc000, 0xafbf0014, 0xafb00010, 0xaf60680c, 0x8f626804,
6968 0x34420082, 0xaf626804, 0x8f634000, 0x24020b50, 0x3c010001, 0xac220f20,
6969 0x24020b78, 0x3c010001, 0xac220f30, 0x34630002, 0xaf634000, 0x0c004315,
6970 0x00808021, 0x3c010001, 0xa0220f34, 0x304200ff, 0x24030002, 0x14430005,
6971 0x00000000, 0x3c020001, 0x8c420f20, 0x08004308, 0xac5000c0, 0x3c020001,
6972 0x8c420f20, 0xac5000bc, 0x8f624434, 0x8f634438, 0x8f644410, 0x3c010001,
6973 0xac220f28, 0x3c010001, 0xac230f38, 0x3c010001, 0xac240f24, 0x8fbf0014,
6974 0x8fb00010, 0x03e00008, 0x27bd0018, 0x03e00008, 0x24020001, 0x27bdfff8,
6975 0x18800009, 0x00002821, 0x8f63680c, 0x8f62680c, 0x1043fffe, 0x00000000,
6976 0x24a50001, 0x00a4102a, 0x1440fff9, 0x00000000, 0x03e00008, 0x27bd0008,
6977 0x8f634450, 0x3c020001, 0x8c420f28, 0x00031c02, 0x0043102b, 0x14400008,
6978 0x3c038000, 0x3c040001, 0x8c840f38, 0x8f624450, 0x00021c02, 0x0083102b,
6979 0x1040fffc, 0x3c038000, 0xaf634444, 0x8f624444, 0x00431024, 0x1440fffd,
6980 0x00000000, 0x8f624448, 0x03e00008, 0x3042ffff, 0x3082ffff, 0x2442e000,
6981 0x2c422001, 0x14400003, 0x3c024000, 0x08004347, 0x2402ffff, 0x00822025,
6982 0xaf645c38, 0x8f625c30, 0x30420002, 0x1440fffc, 0x00001021, 0x03e00008,
6983 0x00000000, 0x8f624450, 0x3c030001, 0x8c630f24, 0x08004350, 0x3042ffff,
6984 0x8f624450, 0x3042ffff, 0x0043102b, 0x1440fffc, 0x00000000, 0x03e00008,
6985 0x00000000, 0x27bdffe0, 0x00802821, 0x3c040001, 0x24840ed0, 0x00003021,
6986 0x00003821, 0xafbf0018, 0xafa00010, 0x0c004378, 0xafa00014, 0x0800435f,
6987 0x00000000, 0x8fbf0018, 0x03e00008, 0x27bd0020, 0x3c020001, 0x3442d600,
6988 0x3c030001, 0x3463d600, 0x3c040001, 0x3484ddff, 0x3c010001, 0xac220f40,
6989 0x24020040, 0x3c010001, 0xac220f44, 0x3c010001, 0xac200f3c, 0xac600000,
6990 0x24630004, 0x0083102b, 0x5040fffd, 0xac600000, 0x03e00008, 0x00000000,
6991 0x00804821, 0x8faa0010, 0x3c020001, 0x8c420f3c, 0x3c040001, 0x8c840f44,
6992 0x8fab0014, 0x24430001, 0x0044102b, 0x3c010001, 0xac230f3c, 0x14400003,
6993 0x00004021, 0x3c010001, 0xac200f3c, 0x3c020001, 0x8c420f3c, 0x3c030001,
6994 0x8c630f40, 0x91240000, 0x00021140, 0x00431021, 0x00481021, 0x25080001,
6995 0xa0440000, 0x29020008, 0x1440fff4, 0x25290001, 0x3c020001, 0x8c420f3c,
6996 0x3c030001, 0x8c630f40, 0x8f64680c, 0x00021140, 0x00431021, 0xac440008,
6997 0xac45000c, 0xac460010, 0xac470014, 0xac4a0018, 0x03e00008, 0xac4b001c,
6998 0x00000000, 0x00000000, 0x00000000,
6999};
7000
7001static const u32 tg3Tso5FwRodata[(TG3_TSO5_FW_RODATA_LEN / 4) + 1] = {
7002 0x4d61696e, 0x43707542, 0x00000000, 0x4d61696e, 0x43707541, 0x00000000,
7003 0x00000000, 0x00000000, 0x73746b6f, 0x66666c64, 0x00000000, 0x00000000,
7004 0x73746b6f, 0x66666c64, 0x00000000, 0x00000000, 0x66617461, 0x6c457272,
7005 0x00000000, 0x00000000, 0x00000000,
7006};
7007
7008static const u32 tg3Tso5FwData[(TG3_TSO5_FW_DATA_LEN / 4) + 1] = {
7009 0x00000000, 0x73746b6f, 0x66666c64, 0x5f76312e, 0x322e3000, 0x00000000,
7010 0x00000000, 0x00000000, 0x00000000,
7011};
7012 6379
7013/* tp->lock is held. */ 6380/* tp->lock is held. */
7014static int tg3_load_tso_firmware(struct tg3 *tp) 6381static int tg3_load_tso_firmware(struct tg3 *tp)
7015{ 6382{
7016 struct fw_info info; 6383 struct fw_info info;
6384 const __be32 *fw_data;
7017 unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size; 6385 unsigned long cpu_base, cpu_scratch_base, cpu_scratch_size;
7018 int err, i; 6386 int err, i;
7019 6387
7020 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) 6388 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO)
7021 return 0; 6389 return 0;
7022 6390
6391 fw_data = (void *)tp->fw->data;
6392
6393 /* Firmware blob starts with version numbers, followed by
6394 start address and length. We are setting complete length.
6395 length = end_address_of_bss - start_address_of_text.
6396 Remainder is the blob to be loaded contiguously
6397 from start address. */
6398
6399 info.fw_base = be32_to_cpu(fw_data[1]);
6400 cpu_scratch_size = tp->fw_len;
6401 info.fw_len = tp->fw->size - 12;
6402 info.fw_data = &fw_data[3];
6403
7023 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) { 6404 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
7024 info.text_base = TG3_TSO5_FW_TEXT_ADDR;
7025 info.text_len = TG3_TSO5_FW_TEXT_LEN;
7026 info.text_data = &tg3Tso5FwText[0];
7027 info.rodata_base = TG3_TSO5_FW_RODATA_ADDR;
7028 info.rodata_len = TG3_TSO5_FW_RODATA_LEN;
7029 info.rodata_data = &tg3Tso5FwRodata[0];
7030 info.data_base = TG3_TSO5_FW_DATA_ADDR;
7031 info.data_len = TG3_TSO5_FW_DATA_LEN;
7032 info.data_data = &tg3Tso5FwData[0];
7033 cpu_base = RX_CPU_BASE; 6405 cpu_base = RX_CPU_BASE;
7034 cpu_scratch_base = NIC_SRAM_MBUF_POOL_BASE5705; 6406 cpu_scratch_base = NIC_SRAM_MBUF_POOL_BASE5705;
7035 cpu_scratch_size = (info.text_len +
7036 info.rodata_len +
7037 info.data_len +
7038 TG3_TSO5_FW_SBSS_LEN +
7039 TG3_TSO5_FW_BSS_LEN);
7040 } else { 6407 } else {
7041 info.text_base = TG3_TSO_FW_TEXT_ADDR;
7042 info.text_len = TG3_TSO_FW_TEXT_LEN;
7043 info.text_data = &tg3TsoFwText[0];
7044 info.rodata_base = TG3_TSO_FW_RODATA_ADDR;
7045 info.rodata_len = TG3_TSO_FW_RODATA_LEN;
7046 info.rodata_data = &tg3TsoFwRodata[0];
7047 info.data_base = TG3_TSO_FW_DATA_ADDR;
7048 info.data_len = TG3_TSO_FW_DATA_LEN;
7049 info.data_data = &tg3TsoFwData[0];
7050 cpu_base = TX_CPU_BASE; 6408 cpu_base = TX_CPU_BASE;
7051 cpu_scratch_base = TX_CPU_SCRATCH_BASE; 6409 cpu_scratch_base = TX_CPU_SCRATCH_BASE;
7052 cpu_scratch_size = TX_CPU_SCRATCH_SIZE; 6410 cpu_scratch_size = TX_CPU_SCRATCH_SIZE;
@@ -7060,21 +6418,21 @@ static int tg3_load_tso_firmware(struct tg3 *tp)
7060 6418
7061 /* Now startup the cpu. */ 6419 /* Now startup the cpu. */
7062 tw32(cpu_base + CPU_STATE, 0xffffffff); 6420 tw32(cpu_base + CPU_STATE, 0xffffffff);
7063 tw32_f(cpu_base + CPU_PC, info.text_base); 6421 tw32_f(cpu_base + CPU_PC, info.fw_base);
7064 6422
7065 for (i = 0; i < 5; i++) { 6423 for (i = 0; i < 5; i++) {
7066 if (tr32(cpu_base + CPU_PC) == info.text_base) 6424 if (tr32(cpu_base + CPU_PC) == info.fw_base)
7067 break; 6425 break;
7068 tw32(cpu_base + CPU_STATE, 0xffffffff); 6426 tw32(cpu_base + CPU_STATE, 0xffffffff);
7069 tw32(cpu_base + CPU_MODE, CPU_MODE_HALT); 6427 tw32(cpu_base + CPU_MODE, CPU_MODE_HALT);
7070 tw32_f(cpu_base + CPU_PC, info.text_base); 6428 tw32_f(cpu_base + CPU_PC, info.fw_base);
7071 udelay(1000); 6429 udelay(1000);
7072 } 6430 }
7073 if (i >= 5) { 6431 if (i >= 5) {
7074 printk(KERN_ERR PFX "tg3_load_tso_firmware fails for %s " 6432 printk(KERN_ERR PFX "tg3_load_tso_firmware fails for %s "
7075 "to set CPU PC, is %08x should be %08x\n", 6433 "to set CPU PC, is %08x should be %08x\n",
7076 tp->dev->name, tr32(cpu_base + CPU_PC), 6434 tp->dev->name, tr32(cpu_base + CPU_PC),
7077 info.text_base); 6435 info.fw_base);
7078 return -ENODEV; 6436 return -ENODEV;
7079 } 6437 }
7080 tw32(cpu_base + CPU_STATE, 0xffffffff); 6438 tw32(cpu_base + CPU_STATE, 0xffffffff);
@@ -7299,11 +6657,7 @@ static int tg3_reset_hw(struct tg3 *tp, int reset_phy)
7299 else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) { 6657 else if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
7300 int fw_len; 6658 int fw_len;
7301 6659
7302 fw_len = (TG3_TSO5_FW_TEXT_LEN + 6660 fw_len = tp->fw_len;
7303 TG3_TSO5_FW_RODATA_LEN +
7304 TG3_TSO5_FW_DATA_LEN +
7305 TG3_TSO5_FW_SBSS_LEN +
7306 TG3_TSO5_FW_BSS_LEN);
7307 fw_len = (fw_len + (0x80 - 1)) & ~(0x80 - 1); 6661 fw_len = (fw_len + (0x80 - 1)) & ~(0x80 - 1);
7308 tw32(BUFMGR_MB_POOL_ADDR, 6662 tw32(BUFMGR_MB_POOL_ADDR,
7309 NIC_SRAM_MBUF_POOL_BASE5705 + fw_len); 6663 NIC_SRAM_MBUF_POOL_BASE5705 + fw_len);
@@ -13580,6 +12934,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13580 struct net_device *dev; 12934 struct net_device *dev;
13581 struct tg3 *tp; 12935 struct tg3 *tp;
13582 int err, pm_cap; 12936 int err, pm_cap;
12937 const char *fw_name = NULL;
13583 char str[40]; 12938 char str[40];
13584 u64 dma_mask, persist_dma_mask; 12939 u64 dma_mask, persist_dma_mask;
13585 12940
@@ -13735,6 +13090,9 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13735 13090
13736 tg3_init_bufmgr_config(tp); 13091 tg3_init_bufmgr_config(tp);
13737 13092
13093 if (tp->pci_chip_rev_id == CHIPREV_ID_5701_A0)
13094 fw_name = FIRMWARE_TG3;
13095
13738 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) { 13096 if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
13739 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE; 13097 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE;
13740 } 13098 }
@@ -13747,6 +13105,37 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13747 } else { 13105 } else {
13748 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG; 13106 tp->tg3_flags2 |= TG3_FLG2_TSO_CAPABLE | TG3_FLG2_TSO_BUG;
13749 } 13107 }
13108 if (tp->tg3_flags2 & TG3_FLG2_TSO_CAPABLE) {
13109 if (GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705)
13110 fw_name = FIRMWARE_TG3TSO5;
13111 else
13112 fw_name = FIRMWARE_TG3TSO;
13113 }
13114
13115 if (fw_name) {
13116 const __be32 *fw_data;
13117
13118 err = request_firmware(&tp->fw, fw_name, &tp->pdev->dev);
13119 if (err) {
13120 printk(KERN_ERR "tg3: Failed to load firmware \"%s\"\n",
13121 fw_name);
13122 goto err_out_iounmap;
13123 }
13124
13125 fw_data = (void *)tp->fw->data;
13126
13127 /* Firmware blob starts with version numbers, followed by
13128 start address and _full_ length including BSS sections
13129 (which must be longer than the actual data, of course */
13130
13131 tp->fw_len = be32_to_cpu(fw_data[2]); /* includes bss */
13132 if (tp->fw_len < (tp->fw->size - 12)) {
13133 printk(KERN_ERR "tg3: bogus length %d in \"%s\"\n",
13134 tp->fw_len, fw_name);
13135 err = -EINVAL;
13136 goto err_out_fw;
13137 }
13138 }
13750 13139
13751 /* TSO is on by default on chips that support hardware TSO. 13140 /* TSO is on by default on chips that support hardware TSO.
13752 * Firmware TSO on older chips gives lower performance, so it 13141 * Firmware TSO on older chips gives lower performance, so it
@@ -13778,7 +13167,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13778 if (err) { 13167 if (err) {
13779 printk(KERN_ERR PFX "Could not obtain valid ethernet address, " 13168 printk(KERN_ERR PFX "Could not obtain valid ethernet address, "
13780 "aborting.\n"); 13169 "aborting.\n");
13781 goto err_out_iounmap; 13170 goto err_out_fw;
13782 } 13171 }
13783 13172
13784 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) { 13173 if (tp->tg3_flags3 & TG3_FLG3_ENABLE_APE) {
@@ -13787,7 +13176,7 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
13787 printk(KERN_ERR PFX "Cannot map APE registers, " 13176 printk(KERN_ERR PFX "Cannot map APE registers, "
13788 "aborting.\n"); 13177 "aborting.\n");
13789 err = -ENOMEM; 13178 err = -ENOMEM;
13790 goto err_out_iounmap; 13179 goto err_out_fw;
13791 } 13180 }
13792 13181
13793 tg3_ape_lock_init(tp); 13182 tg3_ape_lock_init(tp);
@@ -13867,6 +13256,10 @@ err_out_apeunmap:
13867 tp->aperegs = NULL; 13256 tp->aperegs = NULL;
13868 } 13257 }
13869 13258
13259err_out_fw:
13260 if (tp->fw)
13261 release_firmware(tp->fw);
13262
13870err_out_iounmap: 13263err_out_iounmap:
13871 if (tp->regs) { 13264 if (tp->regs) {
13872 iounmap(tp->regs); 13265 iounmap(tp->regs);
@@ -13892,6 +13285,9 @@ static void __devexit tg3_remove_one(struct pci_dev *pdev)
13892 if (dev) { 13285 if (dev) {
13893 struct tg3 *tp = netdev_priv(dev); 13286 struct tg3 *tp = netdev_priv(dev);
13894 13287
13288 if (tp->fw)
13289 release_firmware(tp->fw);
13290
13895 flush_scheduled_work(); 13291 flush_scheduled_work();
13896 13292
13897 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) { 13293 if (tp->tg3_flags3 & TG3_FLG3_USE_PHYLIB) {
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h
index 8936edfb0438..ae5da603c6af 100644
--- a/drivers/net/tg3.h
+++ b/drivers/net/tg3.h
@@ -2762,6 +2762,10 @@ struct tg3 {
2762#define SST_25VF0X0_PAGE_SIZE 4098 2762#define SST_25VF0X0_PAGE_SIZE 4098
2763 2763
2764 struct ethtool_coalesce coal; 2764 struct ethtool_coalesce coal;
2765
2766 /* firmware info */
2767 const struct firmware *fw;
2768 u32 fw_len; /* includes BSS */
2765}; 2769};
2766 2770
2767#endif /* !(_T3_H) */ 2771#endif /* !(_T3_H) */
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 69f9a0ec764d..d7b81e4fdd56 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -213,7 +213,7 @@ static int check_filter(struct tap_filter *filter, const struct sk_buff *skb)
213 213
214/* Network device part of the driver */ 214/* Network device part of the driver */
215 215
216static unsigned int tun_net_id; 216static int tun_net_id;
217struct tun_net { 217struct tun_net {
218 struct list_head dev_list; 218 struct list_head dev_list;
219}; 219};
diff --git a/drivers/oprofile/oprofilefs.c b/drivers/oprofile/oprofilefs.c
index ddc4c59f02dc..b7e4cee24269 100644
--- a/drivers/oprofile/oprofilefs.c
+++ b/drivers/oprofile/oprofilefs.c
@@ -29,9 +29,6 @@ static struct inode *oprofilefs_get_inode(struct super_block *sb, int mode)
29 29
30 if (inode) { 30 if (inode) {
31 inode->i_mode = mode; 31 inode->i_mode = mode;
32 inode->i_uid = 0;
33 inode->i_gid = 0;
34 inode->i_blocks = 0;
35 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 32 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
36 } 33 }
37 return inode; 34 return inode;
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig
index 8e0c2b47803c..668472405a57 100644
--- a/drivers/power/Kconfig
+++ b/drivers/power/Kconfig
@@ -29,6 +29,13 @@ config APM_POWER
29 Say Y here to enable support APM status emulation using 29 Say Y here to enable support APM status emulation using
30 battery class devices. 30 battery class devices.
31 31
32config WM8350_POWER
33 tristate "WM8350 PMU support"
34 depends on MFD_WM8350
35 help
36 Say Y here to enable support for the power management unit
37 provided by the Wolfson Microelectronics WM8350 PMIC.
38
32config BATTERY_DS2760 39config BATTERY_DS2760
33 tristate "DS2760 battery driver (HP iPAQ & others)" 40 tristate "DS2760 battery driver (HP iPAQ & others)"
34 select W1 41 select W1
@@ -68,4 +75,11 @@ config BATTERY_BQ27x00
68 help 75 help
69 Say Y here to enable support for batteries with BQ27200(I2C) chip. 76 Say Y here to enable support for batteries with BQ27200(I2C) chip.
70 77
78config BATTERY_DA9030
79 tristate "DA9030 battery driver"
80 depends on PMIC_DA903X
81 help
82 Say Y here to enable support for batteries charger integrated into
83 DA9030 PMIC.
84
71endif # POWER_SUPPLY 85endif # POWER_SUPPLY
diff --git a/drivers/power/Makefile b/drivers/power/Makefile
index e8f1ecec5d8f..eebb15505a40 100644
--- a/drivers/power/Makefile
+++ b/drivers/power/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_POWER_SUPPLY) += power_supply.o
16 16
17obj-$(CONFIG_PDA_POWER) += pda_power.o 17obj-$(CONFIG_PDA_POWER) += pda_power.o
18obj-$(CONFIG_APM_POWER) += apm_power.o 18obj-$(CONFIG_APM_POWER) += apm_power.o
19obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
19 20
20obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o 21obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
21obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o 22obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
@@ -23,3 +24,4 @@ obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
23obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o 24obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
24obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o 25obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o
25obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o 26obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o
27obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
diff --git a/drivers/power/da9030_battery.c b/drivers/power/da9030_battery.c
new file mode 100644
index 000000000000..1662bb0f23a5
--- /dev/null
+++ b/drivers/power/da9030_battery.c
@@ -0,0 +1,600 @@
1/*
2 * Battery charger driver for Dialog Semiconductor DA9030
3 *
4 * Copyright (C) 2008 Compulab, Ltd.
5 * Mike Rapoport <mike@compulab.co.il>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/types.h>
15#include <linux/device.h>
16#include <linux/workqueue.h>
17#include <linux/module.h>
18#include <linux/platform_device.h>
19#include <linux/power_supply.h>
20#include <linux/mfd/da903x.h>
21
22#include <linux/debugfs.h>
23#include <linux/seq_file.h>
24
25#define DA9030_STATUS_CHDET (1 << 3)
26
27#define DA9030_FAULT_LOG 0x0a
28#define DA9030_FAULT_LOG_OVER_TEMP (1 << 7)
29#define DA9030_FAULT_LOG_VBAT_OVER (1 << 4)
30
31#define DA9030_CHARGE_CONTROL 0x28
32#define DA9030_CHRG_CHARGER_ENABLE (1 << 7)
33
34#define DA9030_ADC_MAN_CONTROL 0x30
35#define DA9030_ADC_TBATREF_ENABLE (1 << 5)
36#define DA9030_ADC_LDO_INT_ENABLE (1 << 4)
37
38#define DA9030_ADC_AUTO_CONTROL 0x31
39#define DA9030_ADC_TBAT_ENABLE (1 << 5)
40#define DA9030_ADC_VBAT_IN_TXON (1 << 4)
41#define DA9030_ADC_VCH_ENABLE (1 << 3)
42#define DA9030_ADC_ICH_ENABLE (1 << 2)
43#define DA9030_ADC_VBAT_ENABLE (1 << 1)
44#define DA9030_ADC_AUTO_SLEEP_ENABLE (1 << 0)
45
46#define DA9030_VBATMON 0x32
47#define DA9030_VBATMONTXON 0x33
48#define DA9030_TBATHIGHP 0x34
49#define DA9030_TBATHIGHN 0x35
50#define DA9030_TBATLOW 0x36
51
52#define DA9030_VBAT_RES 0x41
53#define DA9030_VBATMIN_RES 0x42
54#define DA9030_VBATMINTXON_RES 0x43
55#define DA9030_ICHMAX_RES 0x44
56#define DA9030_ICHMIN_RES 0x45
57#define DA9030_ICHAVERAGE_RES 0x46
58#define DA9030_VCHMAX_RES 0x47
59#define DA9030_VCHMIN_RES 0x48
60#define DA9030_TBAT_RES 0x49
61
62struct da9030_adc_res {
63 uint8_t vbat_res;
64 uint8_t vbatmin_res;
65 uint8_t vbatmintxon;
66 uint8_t ichmax_res;
67 uint8_t ichmin_res;
68 uint8_t ichaverage_res;
69 uint8_t vchmax_res;
70 uint8_t vchmin_res;
71 uint8_t tbat_res;
72 uint8_t adc_in4_res;
73 uint8_t adc_in5_res;
74};
75
76struct da9030_battery_thresholds {
77 int tbat_low;
78 int tbat_high;
79 int tbat_restart;
80
81 int vbat_low;
82 int vbat_crit;
83 int vbat_charge_start;
84 int vbat_charge_stop;
85 int vbat_charge_restart;
86
87 int vcharge_min;
88 int vcharge_max;
89};
90
91struct da9030_charger {
92 struct power_supply psy;
93
94 struct device *master;
95
96 struct da9030_adc_res adc;
97 struct delayed_work work;
98 unsigned int interval;
99
100 struct power_supply_info *battery_info;
101
102 struct da9030_battery_thresholds thresholds;
103
104 unsigned int charge_milliamp;
105 unsigned int charge_millivolt;
106
107 /* charger status */
108 bool chdet;
109 uint8_t fault;
110 int mA;
111 int mV;
112 bool is_on;
113
114 struct notifier_block nb;
115
116 /* platform callbacks for battery low and critical events */
117 void (*battery_low)(void);
118 void (*battery_critical)(void);
119
120 struct dentry *debug_file;
121};
122
123static inline int da9030_reg_to_mV(int reg)
124{
125 return ((reg * 2650) >> 8) + 2650;
126}
127
128static inline int da9030_millivolt_to_reg(int mV)
129{
130 return ((mV - 2650) << 8) / 2650;
131}
132
133static inline int da9030_reg_to_mA(int reg)
134{
135 return ((reg * 24000) >> 8) / 15;
136}
137
138#ifdef CONFIG_DEBUG_FS
139static int bat_debug_show(struct seq_file *s, void *data)
140{
141 struct da9030_charger *charger = s->private;
142
143 seq_printf(s, "charger is %s\n", charger->is_on ? "on" : "off");
144 if (charger->chdet) {
145 seq_printf(s, "iset = %dmA, vset = %dmV\n",
146 charger->mA, charger->mV);
147 }
148
149 seq_printf(s, "vbat_res = %d (%dmV)\n",
150 charger->adc.vbat_res,
151 da9030_reg_to_mV(charger->adc.vbat_res));
152 seq_printf(s, "vbatmin_res = %d (%dmV)\n",
153 charger->adc.vbatmin_res,
154 da9030_reg_to_mV(charger->adc.vbatmin_res));
155 seq_printf(s, "vbatmintxon = %d (%dmV)\n",
156 charger->adc.vbatmintxon,
157 da9030_reg_to_mV(charger->adc.vbatmintxon));
158 seq_printf(s, "ichmax_res = %d (%dmA)\n",
159 charger->adc.ichmax_res,
160 da9030_reg_to_mV(charger->adc.ichmax_res));
161 seq_printf(s, "ichmin_res = %d (%dmA)\n",
162 charger->adc.ichmin_res,
163 da9030_reg_to_mA(charger->adc.ichmin_res));
164 seq_printf(s, "ichaverage_res = %d (%dmA)\n",
165 charger->adc.ichaverage_res,
166 da9030_reg_to_mA(charger->adc.ichaverage_res));
167 seq_printf(s, "vchmax_res = %d (%dmV)\n",
168 charger->adc.vchmax_res,
169 da9030_reg_to_mA(charger->adc.vchmax_res));
170 seq_printf(s, "vchmin_res = %d (%dmV)\n",
171 charger->adc.vchmin_res,
172 da9030_reg_to_mV(charger->adc.vchmin_res));
173
174 return 0;
175}
176
177static int debug_open(struct inode *inode, struct file *file)
178{
179 return single_open(file, bat_debug_show, inode->i_private);
180}
181
182static const struct file_operations bat_debug_fops = {
183 .open = debug_open,
184 .read = seq_read,
185 .llseek = seq_lseek,
186 .release = single_release,
187};
188
189static struct dentry *da9030_bat_create_debugfs(struct da9030_charger *charger)
190{
191 charger->debug_file = debugfs_create_file("charger", 0666, 0, charger,
192 &bat_debug_fops);
193 return charger->debug_file;
194}
195
196static void da9030_bat_remove_debugfs(struct da9030_charger *charger)
197{
198 debugfs_remove(charger->debug_file);
199}
200#else
201static inline struct dentry *da9030_bat_create_debugfs(struct da9030_charger *charger)
202{
203 return NULL;
204}
205static inline void da9030_bat_remove_debugfs(struct da9030_charger *charger)
206{
207}
208#endif
209
210static inline void da9030_read_adc(struct da9030_charger *charger,
211 struct da9030_adc_res *adc)
212{
213 da903x_reads(charger->master, DA9030_VBAT_RES,
214 sizeof(*adc), (uint8_t *)adc);
215}
216
217static void da9030_charger_update_state(struct da9030_charger *charger)
218{
219 uint8_t val;
220
221 da903x_read(charger->master, DA9030_CHARGE_CONTROL, &val);
222 charger->is_on = (val & DA9030_CHRG_CHARGER_ENABLE) ? 1 : 0;
223 charger->mA = ((val >> 3) & 0xf) * 100;
224 charger->mV = (val & 0x7) * 50 + 4000;
225
226 da9030_read_adc(charger, &charger->adc);
227 da903x_read(charger->master, DA9030_FAULT_LOG, &charger->fault);
228 charger->chdet = da903x_query_status(charger->master,
229 DA9030_STATUS_CHDET);
230}
231
232static void da9030_set_charge(struct da9030_charger *charger, int on)
233{
234 uint8_t val;
235
236 if (on) {
237 val = DA9030_CHRG_CHARGER_ENABLE;
238 val |= (charger->charge_milliamp / 100) << 3;
239 val |= (charger->charge_millivolt - 4000) / 50;
240 charger->is_on = 1;
241 } else {
242 val = 0;
243 charger->is_on = 0;
244 }
245
246 da903x_write(charger->master, DA9030_CHARGE_CONTROL, val);
247}
248
249static void da9030_charger_check_state(struct da9030_charger *charger)
250{
251 da9030_charger_update_state(charger);
252
253 /* we wake or boot with external power on */
254 if (!charger->is_on) {
255 if ((charger->chdet) &&
256 (charger->adc.vbat_res <
257 charger->thresholds.vbat_charge_start)) {
258 da9030_set_charge(charger, 1);
259 }
260 } else {
261 if (charger->adc.vbat_res >=
262 charger->thresholds.vbat_charge_stop) {
263 da9030_set_charge(charger, 0);
264 da903x_write(charger->master, DA9030_VBATMON,
265 charger->thresholds.vbat_charge_restart);
266 } else if (charger->adc.vbat_res >
267 charger->thresholds.vbat_low) {
268 /* we are charging and passed LOW_THRESH,
269 so upate DA9030 VBAT threshold
270 */
271 da903x_write(charger->master, DA9030_VBATMON,
272 charger->thresholds.vbat_low);
273 }
274 if (charger->adc.vchmax_res > charger->thresholds.vcharge_max ||
275 charger->adc.vchmin_res < charger->thresholds.vcharge_min ||
276 /* Tempreture readings are negative */
277 charger->adc.tbat_res < charger->thresholds.tbat_high ||
278 charger->adc.tbat_res > charger->thresholds.tbat_low) {
279 /* disable charger */
280 da9030_set_charge(charger, 0);
281 }
282 }
283}
284
285static void da9030_charging_monitor(struct work_struct *work)
286{
287 struct da9030_charger *charger;
288
289 charger = container_of(work, struct da9030_charger, work.work);
290
291 da9030_charger_check_state(charger);
292
293 /* reschedule for the next time */
294 schedule_delayed_work(&charger->work, charger->interval);
295}
296
297static enum power_supply_property da9030_battery_props[] = {
298 POWER_SUPPLY_PROP_MODEL_NAME,
299 POWER_SUPPLY_PROP_STATUS,
300 POWER_SUPPLY_PROP_HEALTH,
301 POWER_SUPPLY_PROP_TECHNOLOGY,
302 POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN,
303 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
304 POWER_SUPPLY_PROP_VOLTAGE_NOW,
305 POWER_SUPPLY_PROP_CURRENT_AVG,
306};
307
308static void da9030_battery_check_status(struct da9030_charger *charger,
309 union power_supply_propval *val)
310{
311 if (charger->chdet) {
312 if (charger->is_on)
313 val->intval = POWER_SUPPLY_STATUS_CHARGING;
314 else
315 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
316 } else {
317 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
318 }
319}
320
321static void da9030_battery_check_health(struct da9030_charger *charger,
322 union power_supply_propval *val)
323{
324 if (charger->fault & DA9030_FAULT_LOG_OVER_TEMP)
325 val->intval = POWER_SUPPLY_HEALTH_OVERHEAT;
326 else if (charger->fault & DA9030_FAULT_LOG_VBAT_OVER)
327 val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
328 else
329 val->intval = POWER_SUPPLY_HEALTH_GOOD;
330}
331
332static int da9030_battery_get_property(struct power_supply *psy,
333 enum power_supply_property psp,
334 union power_supply_propval *val)
335{
336 struct da9030_charger *charger;
337 charger = container_of(psy, struct da9030_charger, psy);
338
339 switch (psp) {
340 case POWER_SUPPLY_PROP_STATUS:
341 da9030_battery_check_status(charger, val);
342 break;
343 case POWER_SUPPLY_PROP_HEALTH:
344 da9030_battery_check_health(charger, val);
345 break;
346 case POWER_SUPPLY_PROP_TECHNOLOGY:
347 val->intval = charger->battery_info->technology;
348 break;
349 case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN:
350 val->intval = charger->battery_info->voltage_max_design;
351 break;
352 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN:
353 val->intval = charger->battery_info->voltage_min_design;
354 break;
355 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
356 val->intval = da9030_reg_to_mV(charger->adc.vbat_res) * 1000;
357 break;
358 case POWER_SUPPLY_PROP_CURRENT_AVG:
359 val->intval =
360 da9030_reg_to_mA(charger->adc.ichaverage_res) * 1000;
361 break;
362 case POWER_SUPPLY_PROP_MODEL_NAME:
363 val->strval = charger->battery_info->name;
364 break;
365 default:
366 break;
367 }
368
369 return 0;
370}
371
372static void da9030_battery_vbat_event(struct da9030_charger *charger)
373{
374 da9030_read_adc(charger, &charger->adc);
375
376 if (charger->is_on)
377 return;
378
379 if (charger->adc.vbat_res < charger->thresholds.vbat_low) {
380 /* set VBAT threshold for critical */
381 da903x_write(charger->master, DA9030_VBATMON,
382 charger->thresholds.vbat_crit);
383 if (charger->battery_low)
384 charger->battery_low();
385 } else if (charger->adc.vbat_res <
386 charger->thresholds.vbat_crit) {
387 /* notify the system of battery critical */
388 if (charger->battery_critical)
389 charger->battery_critical();
390 }
391}
392
393static int da9030_battery_event(struct notifier_block *nb, unsigned long event,
394 void *data)
395{
396 struct da9030_charger *charger =
397 container_of(nb, struct da9030_charger, nb);
398 int status;
399
400 switch (event) {
401 case DA9030_EVENT_CHDET:
402 status = da903x_query_status(charger->master,
403 DA9030_STATUS_CHDET);
404 da9030_set_charge(charger, status);
405 break;
406 case DA9030_EVENT_VBATMON:
407 da9030_battery_vbat_event(charger);
408 break;
409 case DA9030_EVENT_CHIOVER:
410 case DA9030_EVENT_TBAT:
411 da9030_set_charge(charger, 0);
412 break;
413 }
414
415 return 0;
416}
417
418static void da9030_battery_convert_thresholds(struct da9030_charger *charger,
419 struct da9030_battery_info *pdata)
420{
421 charger->thresholds.tbat_low = pdata->tbat_low;
422 charger->thresholds.tbat_high = pdata->tbat_high;
423 charger->thresholds.tbat_restart = pdata->tbat_restart;
424
425 charger->thresholds.vbat_low =
426 da9030_millivolt_to_reg(pdata->vbat_low);
427 charger->thresholds.vbat_crit =
428 da9030_millivolt_to_reg(pdata->vbat_crit);
429 charger->thresholds.vbat_charge_start =
430 da9030_millivolt_to_reg(pdata->vbat_charge_start);
431 charger->thresholds.vbat_charge_stop =
432 da9030_millivolt_to_reg(pdata->vbat_charge_stop);
433 charger->thresholds.vbat_charge_restart =
434 da9030_millivolt_to_reg(pdata->vbat_charge_restart);
435
436 charger->thresholds.vcharge_min =
437 da9030_millivolt_to_reg(pdata->vcharge_min);
438 charger->thresholds.vcharge_max =
439 da9030_millivolt_to_reg(pdata->vcharge_max);
440}
441
442static void da9030_battery_setup_psy(struct da9030_charger *charger)
443{
444 struct power_supply *psy = &charger->psy;
445 struct power_supply_info *info = charger->battery_info;
446
447 psy->name = info->name;
448 psy->use_for_apm = info->use_for_apm;
449 psy->type = POWER_SUPPLY_TYPE_BATTERY;
450 psy->get_property = da9030_battery_get_property;
451
452 psy->properties = da9030_battery_props;
453 psy->num_properties = ARRAY_SIZE(da9030_battery_props);
454};
455
456static int da9030_battery_charger_init(struct da9030_charger *charger)
457{
458 char v[5];
459 int ret;
460
461 v[0] = v[1] = charger->thresholds.vbat_low;
462 v[2] = charger->thresholds.tbat_high;
463 v[3] = charger->thresholds.tbat_restart;
464 v[4] = charger->thresholds.tbat_low;
465
466 ret = da903x_writes(charger->master, DA9030_VBATMON, 5, v);
467 if (ret)
468 return ret;
469
470 /*
471 * Enable reference voltage supply for ADC from the LDO_INTERNAL
472 * regulator. Must be set before ADC measurements can be made.
473 */
474 ret = da903x_write(charger->master, DA9030_ADC_MAN_CONTROL,
475 DA9030_ADC_LDO_INT_ENABLE |
476 DA9030_ADC_TBATREF_ENABLE);
477 if (ret)
478 return ret;
479
480 /* enable auto ADC measuremnts */
481 return da903x_write(charger->master, DA9030_ADC_AUTO_CONTROL,
482 DA9030_ADC_TBAT_ENABLE | DA9030_ADC_VBAT_IN_TXON |
483 DA9030_ADC_VCH_ENABLE | DA9030_ADC_ICH_ENABLE |
484 DA9030_ADC_VBAT_ENABLE |
485 DA9030_ADC_AUTO_SLEEP_ENABLE);
486}
487
488static int da9030_battery_probe(struct platform_device *pdev)
489{
490 struct da9030_charger *charger;
491 struct da9030_battery_info *pdata = pdev->dev.platform_data;
492 int ret;
493
494 if (pdata == NULL)
495 return -EINVAL;
496
497 if (pdata->charge_milliamp >= 1500 ||
498 pdata->charge_millivolt < 4000 ||
499 pdata->charge_millivolt > 4350)
500 return -EINVAL;
501
502 charger = kzalloc(sizeof(*charger), GFP_KERNEL);
503 if (charger == NULL)
504 return -ENOMEM;
505
506 charger->master = pdev->dev.parent;
507
508 /* 10 seconds between monotor runs unless platfrom defines other
509 interval */
510 charger->interval = msecs_to_jiffies(
511 (pdata->batmon_interval ? : 10) * 1000);
512
513 charger->charge_milliamp = pdata->charge_milliamp;
514 charger->charge_millivolt = pdata->charge_millivolt;
515 charger->battery_info = pdata->battery_info;
516 charger->battery_low = pdata->battery_low;
517 charger->battery_critical = pdata->battery_critical;
518
519 da9030_battery_convert_thresholds(charger, pdata);
520
521 ret = da9030_battery_charger_init(charger);
522 if (ret)
523 goto err_charger_init;
524
525 INIT_DELAYED_WORK(&charger->work, da9030_charging_monitor);
526 schedule_delayed_work(&charger->work, charger->interval);
527
528 charger->nb.notifier_call = da9030_battery_event;
529 ret = da903x_register_notifier(charger->master, &charger->nb,
530 DA9030_EVENT_CHDET |
531 DA9030_EVENT_VBATMON |
532 DA9030_EVENT_CHIOVER |
533 DA9030_EVENT_TBAT);
534 if (ret)
535 goto err_notifier;
536
537 da9030_battery_setup_psy(charger);
538 ret = power_supply_register(&pdev->dev, &charger->psy);
539 if (ret)
540 goto err_ps_register;
541
542 charger->debug_file = da9030_bat_create_debugfs(charger);
543 platform_set_drvdata(pdev, charger);
544 return 0;
545
546err_ps_register:
547 da903x_unregister_notifier(charger->master, &charger->nb,
548 DA9030_EVENT_CHDET | DA9030_EVENT_VBATMON |
549 DA9030_EVENT_CHIOVER | DA9030_EVENT_TBAT);
550err_notifier:
551 cancel_delayed_work(&charger->work);
552
553err_charger_init:
554 kfree(charger);
555
556 return ret;
557}
558
559static int da9030_battery_remove(struct platform_device *dev)
560{
561 struct da9030_charger *charger = platform_get_drvdata(dev);
562
563 da9030_bat_remove_debugfs(charger);
564
565 da903x_unregister_notifier(charger->master, &charger->nb,
566 DA9030_EVENT_CHDET | DA9030_EVENT_VBATMON |
567 DA9030_EVENT_CHIOVER | DA9030_EVENT_TBAT);
568 cancel_delayed_work(&charger->work);
569 power_supply_unregister(&charger->psy);
570
571 kfree(charger);
572
573 return 0;
574}
575
576static struct platform_driver da903x_battery_driver = {
577 .driver = {
578 .name = "da903x-battery",
579 .owner = THIS_MODULE,
580 },
581 .probe = da9030_battery_probe,
582 .remove = da9030_battery_remove,
583};
584
585static int da903x_battery_init(void)
586{
587 return platform_driver_register(&da903x_battery_driver);
588}
589
590static void da903x_battery_exit(void)
591{
592 platform_driver_unregister(&da903x_battery_driver);
593}
594
595module_init(da903x_battery_init);
596module_exit(da903x_battery_exit);
597
598MODULE_DESCRIPTION("DA9030 battery charger driver");
599MODULE_AUTHOR("Mike Rapoport, CompuLab");
600MODULE_LICENSE("GPL");
diff --git a/drivers/power/power_supply_sysfs.c b/drivers/power/power_supply_sysfs.c
index 23ae8460f5c1..ac01e06817fb 100644
--- a/drivers/power/power_supply_sysfs.c
+++ b/drivers/power/power_supply_sysfs.c
@@ -45,7 +45,7 @@ static ssize_t power_supply_show_property(struct device *dev,
45 }; 45 };
46 static char *health_text[] = { 46 static char *health_text[] = {
47 "Unknown", "Good", "Overheat", "Dead", "Over voltage", 47 "Unknown", "Good", "Overheat", "Dead", "Over voltage",
48 "Unspecified failure" 48 "Unspecified failure", "Cold",
49 }; 49 };
50 static char *technology_text[] = { 50 static char *technology_text[] = {
51 "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd", 51 "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
diff --git a/drivers/power/wm8350_power.c b/drivers/power/wm8350_power.c
new file mode 100644
index 000000000000..1b16bf343f2f
--- /dev/null
+++ b/drivers/power/wm8350_power.c
@@ -0,0 +1,532 @@
1/*
2 * Battery driver for wm8350 PMIC
3 *
4 * Copyright 2007, 2008 Wolfson Microelectronics PLC.
5 *
6 * Based on OLPC Battery Driver
7 *
8 * Copyright 2006 David Woodhouse <dwmw2@infradead.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/module.h>
16#include <linux/err.h>
17#include <linux/platform_device.h>
18#include <linux/power_supply.h>
19#include <linux/mfd/wm8350/supply.h>
20#include <linux/mfd/wm8350/core.h>
21#include <linux/mfd/wm8350/comparator.h>
22
23static int wm8350_read_battery_uvolts(struct wm8350 *wm8350)
24{
25 return wm8350_read_auxadc(wm8350, WM8350_AUXADC_BATT, 0, 0)
26 * WM8350_AUX_COEFF;
27}
28
29static int wm8350_read_line_uvolts(struct wm8350 *wm8350)
30{
31 return wm8350_read_auxadc(wm8350, WM8350_AUXADC_LINE, 0, 0)
32 * WM8350_AUX_COEFF;
33}
34
35static int wm8350_read_usb_uvolts(struct wm8350 *wm8350)
36{
37 return wm8350_read_auxadc(wm8350, WM8350_AUXADC_USB, 0, 0)
38 * WM8350_AUX_COEFF;
39}
40
41#define WM8350_BATT_SUPPLY 1
42#define WM8350_USB_SUPPLY 2
43#define WM8350_LINE_SUPPLY 4
44
45static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min)
46{
47 if (!wm8350->power.rev_g_coeff)
48 return (((min - 30) / 15) & 0xf) << 8;
49 else
50 return (((min - 30) / 30) & 0xf) << 8;
51}
52
53static int wm8350_get_supplies(struct wm8350 *wm8350)
54{
55 u16 sm, ov, co, chrg;
56 int supplies = 0;
57
58 sm = wm8350_reg_read(wm8350, WM8350_STATE_MACHINE_STATUS);
59 ov = wm8350_reg_read(wm8350, WM8350_MISC_OVERRIDES);
60 co = wm8350_reg_read(wm8350, WM8350_COMPARATOR_OVERRIDES);
61 chrg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2);
62
63 /* USB_SM */
64 sm = (sm & WM8350_USB_SM_MASK) >> WM8350_USB_SM_SHIFT;
65
66 /* CHG_ISEL */
67 chrg &= WM8350_CHG_ISEL_MASK;
68
69 /* If the USB state machine is active then we're using that with or
70 * without battery, otherwise check for wall supply */
71 if (((sm == WM8350_USB_SM_100_SLV) ||
72 (sm == WM8350_USB_SM_500_SLV) ||
73 (sm == WM8350_USB_SM_STDBY_SLV))
74 && !(ov & WM8350_USB_LIMIT_OVRDE))
75 supplies = WM8350_USB_SUPPLY;
76 else if (((sm == WM8350_USB_SM_100_SLV) ||
77 (sm == WM8350_USB_SM_500_SLV) ||
78 (sm == WM8350_USB_SM_STDBY_SLV))
79 && (ov & WM8350_USB_LIMIT_OVRDE) && (chrg == 0))
80 supplies = WM8350_USB_SUPPLY | WM8350_BATT_SUPPLY;
81 else if (co & WM8350_WALL_FB_OVRDE)
82 supplies = WM8350_LINE_SUPPLY;
83 else
84 supplies = WM8350_BATT_SUPPLY;
85
86 return supplies;
87}
88
89static int wm8350_charger_config(struct wm8350 *wm8350,
90 struct wm8350_charger_policy *policy)
91{
92 u16 reg, eoc_mA, fast_limit_mA;
93
94 if (!policy) {
95 dev_warn(wm8350->dev,
96 "No charger policy, charger not configured.\n");
97 return -EINVAL;
98 }
99
100 /* make sure USB fast charge current is not > 500mA */
101 if (policy->fast_limit_USB_mA > 500) {
102 dev_err(wm8350->dev, "USB fast charge > 500mA\n");
103 return -EINVAL;
104 }
105
106 eoc_mA = WM8350_CHG_EOC_mA(policy->eoc_mA);
107
108 wm8350_reg_unlock(wm8350);
109
110 reg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1)
111 & WM8350_CHG_ENA_R168;
112 wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1,
113 reg | eoc_mA | policy->trickle_start_mV |
114 WM8350_CHG_TRICKLE_TEMP_CHOKE |
115 WM8350_CHG_TRICKLE_USB_CHOKE |
116 WM8350_CHG_FAST_USB_THROTTLE);
117
118 if (wm8350_get_supplies(wm8350) & WM8350_USB_SUPPLY) {
119 fast_limit_mA =
120 WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_USB_mA);
121 wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2,
122 policy->charge_mV | policy->trickle_charge_USB_mA |
123 fast_limit_mA | wm8350_charge_time_min(wm8350,
124 policy->charge_timeout));
125
126 } else {
127 fast_limit_mA =
128 WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_mA);
129 wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2,
130 policy->charge_mV | policy->trickle_charge_mA |
131 fast_limit_mA | wm8350_charge_time_min(wm8350,
132 policy->charge_timeout));
133 }
134
135 wm8350_reg_lock(wm8350);
136 return 0;
137}
138
139static int wm8350_batt_status(struct wm8350 *wm8350)
140{
141 u16 state;
142
143 state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2);
144 state &= WM8350_CHG_STS_MASK;
145
146 switch (state) {
147 case WM8350_CHG_STS_OFF:
148 return POWER_SUPPLY_STATUS_DISCHARGING;
149
150 case WM8350_CHG_STS_TRICKLE:
151 case WM8350_CHG_STS_FAST:
152 return POWER_SUPPLY_STATUS_CHARGING;
153
154 default:
155 return POWER_SUPPLY_STATUS_UNKNOWN;
156 }
157}
158
159static ssize_t charger_state_show(struct device *dev,
160 struct device_attribute *attr, char *buf)
161{
162 struct wm8350 *wm8350 = dev_get_drvdata(dev);
163 char *charge;
164 int state;
165
166 state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2) &
167 WM8350_CHG_STS_MASK;
168 switch (state) {
169 case WM8350_CHG_STS_OFF:
170 charge = "Charger Off";
171 break;
172 case WM8350_CHG_STS_TRICKLE:
173 charge = "Trickle Charging";
174 break;
175 case WM8350_CHG_STS_FAST:
176 charge = "Fast Charging";
177 break;
178 default:
179 return 0;
180 }
181
182 return sprintf(buf, "%s\n", charge);
183}
184
185static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL);
186
187static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data)
188{
189 struct wm8350_power *power = &wm8350->power;
190 struct wm8350_charger_policy *policy = power->policy;
191
192 switch (irq) {
193 case WM8350_IRQ_CHG_BAT_FAIL:
194 dev_err(wm8350->dev, "battery failed\n");
195 break;
196 case WM8350_IRQ_CHG_TO:
197 dev_err(wm8350->dev, "charger timeout\n");
198 power_supply_changed(&power->battery);
199 break;
200
201 case WM8350_IRQ_CHG_BAT_HOT:
202 case WM8350_IRQ_CHG_BAT_COLD:
203 case WM8350_IRQ_CHG_START:
204 case WM8350_IRQ_CHG_END:
205 power_supply_changed(&power->battery);
206 break;
207
208 case WM8350_IRQ_CHG_FAST_RDY:
209 dev_dbg(wm8350->dev, "fast charger ready\n");
210 wm8350_charger_config(wm8350, policy);
211 wm8350_reg_unlock(wm8350);
212 wm8350_set_bits(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1,
213 WM8350_CHG_FAST);
214 wm8350_reg_lock(wm8350);
215 break;
216
217 case WM8350_IRQ_CHG_VBATT_LT_3P9:
218 dev_warn(wm8350->dev, "battery < 3.9V\n");
219 break;
220 case WM8350_IRQ_CHG_VBATT_LT_3P1:
221 dev_warn(wm8350->dev, "battery < 3.1V\n");
222 break;
223 case WM8350_IRQ_CHG_VBATT_LT_2P85:
224 dev_warn(wm8350->dev, "battery < 2.85V\n");
225 break;
226
227 /* Supply change. We will overnotify but it should do
228 * no harm. */
229 case WM8350_IRQ_EXT_USB_FB:
230 case WM8350_IRQ_EXT_WALL_FB:
231 wm8350_charger_config(wm8350, policy);
232 case WM8350_IRQ_EXT_BAT_FB: /* Fall through */
233 power_supply_changed(&power->battery);
234 power_supply_changed(&power->usb);
235 power_supply_changed(&power->ac);
236 break;
237
238 default:
239 dev_err(wm8350->dev, "Unknown interrupt %d\n", irq);
240 }
241}
242
243/*********************************************************************
244 * AC Power
245 *********************************************************************/
246static int wm8350_ac_get_prop(struct power_supply *psy,
247 enum power_supply_property psp,
248 union power_supply_propval *val)
249{
250 struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent);
251 int ret = 0;
252
253 switch (psp) {
254 case POWER_SUPPLY_PROP_ONLINE:
255 val->intval = !!(wm8350_get_supplies(wm8350) &
256 WM8350_LINE_SUPPLY);
257 break;
258 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
259 val->intval = wm8350_read_line_uvolts(wm8350);
260 break;
261 default:
262 ret = -EINVAL;
263 break;
264 }
265 return ret;
266}
267
268static enum power_supply_property wm8350_ac_props[] = {
269 POWER_SUPPLY_PROP_ONLINE,
270 POWER_SUPPLY_PROP_VOLTAGE_NOW,
271};
272
273/*********************************************************************
274 * USB Power
275 *********************************************************************/
276static int wm8350_usb_get_prop(struct power_supply *psy,
277 enum power_supply_property psp,
278 union power_supply_propval *val)
279{
280 struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent);
281 int ret = 0;
282
283 switch (psp) {
284 case POWER_SUPPLY_PROP_ONLINE:
285 val->intval = !!(wm8350_get_supplies(wm8350) &
286 WM8350_USB_SUPPLY);
287 break;
288 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
289 val->intval = wm8350_read_usb_uvolts(wm8350);
290 break;
291 default:
292 ret = -EINVAL;
293 break;
294 }
295 return ret;
296}
297
298static enum power_supply_property wm8350_usb_props[] = {
299 POWER_SUPPLY_PROP_ONLINE,
300 POWER_SUPPLY_PROP_VOLTAGE_NOW,
301};
302
303/*********************************************************************
304 * Battery properties
305 *********************************************************************/
306
307static int wm8350_bat_check_health(struct wm8350 *wm8350)
308{
309 u16 reg;
310
311 if (wm8350_read_battery_uvolts(wm8350) < 2850000)
312 return POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
313
314 reg = wm8350_reg_read(wm8350, WM8350_CHARGER_OVERRIDES);
315 if (reg & WM8350_CHG_BATT_HOT_OVRDE)
316 return POWER_SUPPLY_HEALTH_OVERHEAT;
317
318 if (reg & WM8350_CHG_BATT_COLD_OVRDE)
319 return POWER_SUPPLY_HEALTH_COLD;
320
321 return POWER_SUPPLY_HEALTH_GOOD;
322}
323
324static int wm8350_bat_get_property(struct power_supply *psy,
325 enum power_supply_property psp,
326 union power_supply_propval *val)
327{
328 struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent);
329 int ret = 0;
330
331 switch (psp) {
332 case POWER_SUPPLY_PROP_STATUS:
333 val->intval = wm8350_batt_status(wm8350);
334 break;
335 case POWER_SUPPLY_PROP_ONLINE:
336 val->intval = !!(wm8350_get_supplies(wm8350) &
337 WM8350_BATT_SUPPLY);
338 break;
339 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
340 val->intval = wm8350_read_battery_uvolts(wm8350);
341 break;
342 case POWER_SUPPLY_PROP_HEALTH:
343 val->intval = wm8350_bat_check_health(wm8350);
344 break;
345 default:
346 ret = -EINVAL;
347 break;
348 }
349
350 return ret;
351}
352
353static enum power_supply_property wm8350_bat_props[] = {
354 POWER_SUPPLY_PROP_STATUS,
355 POWER_SUPPLY_PROP_ONLINE,
356 POWER_SUPPLY_PROP_VOLTAGE_NOW,
357 POWER_SUPPLY_PROP_HEALTH,
358};
359
360/*********************************************************************
361 * Initialisation
362 *********************************************************************/
363
364static void wm8350_init_charger(struct wm8350 *wm8350)
365{
366 /* register our interest in charger events */
367 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT,
368 wm8350_charger_handler, NULL);
369 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
370 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD,
371 wm8350_charger_handler, NULL);
372 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
373 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL,
374 wm8350_charger_handler, NULL);
375 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
376 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO,
377 wm8350_charger_handler, NULL);
378 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO);
379 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END,
380 wm8350_charger_handler, NULL);
381 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END);
382 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START,
383 wm8350_charger_handler, NULL);
384 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START);
385 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY,
386 wm8350_charger_handler, NULL);
387 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY);
388 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9,
389 wm8350_charger_handler, NULL);
390 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
391 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1,
392 wm8350_charger_handler, NULL);
393 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
394 wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85,
395 wm8350_charger_handler, NULL);
396 wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
397
398 /* and supply change events */
399 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB,
400 wm8350_charger_handler, NULL);
401 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
402 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB,
403 wm8350_charger_handler, NULL);
404 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
405 wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB,
406 wm8350_charger_handler, NULL);
407 wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
408}
409
410static void free_charger_irq(struct wm8350 *wm8350)
411{
412 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
413 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT);
414 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
415 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD);
416 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
417 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL);
418 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_TO);
419 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO);
420 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_END);
421 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END);
422 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_START);
423 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START);
424 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
425 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9);
426 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
427 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1);
428 wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
429 wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85);
430 wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
431 wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB);
432 wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
433 wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB);
434 wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
435 wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB);
436}
437
438static __devinit int wm8350_power_probe(struct platform_device *pdev)
439{
440 struct wm8350 *wm8350 = platform_get_drvdata(pdev);
441 struct wm8350_power *power = &wm8350->power;
442 struct wm8350_charger_policy *policy = power->policy;
443 struct power_supply *usb = &power->usb;
444 struct power_supply *battery = &power->battery;
445 struct power_supply *ac = &power->ac;
446 int ret;
447
448 ac->name = "wm8350-ac";
449 ac->type = POWER_SUPPLY_TYPE_MAINS;
450 ac->properties = wm8350_ac_props;
451 ac->num_properties = ARRAY_SIZE(wm8350_ac_props);
452 ac->get_property = wm8350_ac_get_prop;
453 ret = power_supply_register(&pdev->dev, ac);
454 if (ret)
455 return ret;
456
457 battery->name = "wm8350-battery";
458 battery->properties = wm8350_bat_props;
459 battery->num_properties = ARRAY_SIZE(wm8350_bat_props);
460 battery->get_property = wm8350_bat_get_property;
461 battery->use_for_apm = 1;
462 ret = power_supply_register(&pdev->dev, battery);
463 if (ret)
464 goto battery_failed;
465
466 usb->name = "wm8350-usb",
467 usb->type = POWER_SUPPLY_TYPE_USB;
468 usb->properties = wm8350_usb_props;
469 usb->num_properties = ARRAY_SIZE(wm8350_usb_props);
470 usb->get_property = wm8350_usb_get_prop;
471 ret = power_supply_register(&pdev->dev, usb);
472 if (ret)
473 goto usb_failed;
474
475 ret = device_create_file(&pdev->dev, &dev_attr_charger_state);
476 if (ret < 0)
477 dev_warn(wm8350->dev, "failed to add charge sysfs: %d\n", ret);
478 ret = 0;
479
480 wm8350_init_charger(wm8350);
481 if (wm8350_charger_config(wm8350, policy) == 0) {
482 wm8350_reg_unlock(wm8350);
483 wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CHG_ENA);
484 wm8350_reg_lock(wm8350);
485 }
486
487 return ret;
488
489usb_failed:
490 power_supply_unregister(battery);
491battery_failed:
492 power_supply_unregister(ac);
493
494 return ret;
495}
496
497static __devexit int wm8350_power_remove(struct platform_device *pdev)
498{
499 struct wm8350 *wm8350 = platform_get_drvdata(pdev);
500 struct wm8350_power *power = &wm8350->power;
501
502 free_charger_irq(wm8350);
503 device_remove_file(&pdev->dev, &dev_attr_charger_state);
504 power_supply_unregister(&power->battery);
505 power_supply_unregister(&power->ac);
506 power_supply_unregister(&power->usb);
507 return 0;
508}
509
510static struct platform_driver wm8350_power_driver = {
511 .probe = wm8350_power_probe,
512 .remove = __devexit_p(wm8350_power_remove),
513 .driver = {
514 .name = "wm8350-power",
515 },
516};
517
518static int __init wm8350_power_init(void)
519{
520 return platform_driver_register(&wm8350_power_driver);
521}
522module_init(wm8350_power_init);
523
524static void __exit wm8350_power_exit(void)
525{
526 platform_driver_unregister(&wm8350_power_driver);
527}
528module_exit(wm8350_power_exit);
529
530MODULE_LICENSE("GPL");
531MODULE_DESCRIPTION("Power supply driver for WM8350");
532MODULE_ALIAS("platform:wm8350-power");
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index 1f44b17e23b1..c68c496b2c49 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -1380,6 +1380,13 @@ int wm8350_register_regulator(struct wm8350 *wm8350, int reg,
1380 if (wm8350->pmic.pdev[reg]) 1380 if (wm8350->pmic.pdev[reg])
1381 return -EBUSY; 1381 return -EBUSY;
1382 1382
1383 if (reg >= WM8350_DCDC_1 && reg <= WM8350_DCDC_6 &&
1384 reg > wm8350->pmic.max_dcdc)
1385 return -ENODEV;
1386 if (reg >= WM8350_ISINK_A && reg <= WM8350_ISINK_B &&
1387 reg > wm8350->pmic.max_isink)
1388 return -ENODEV;
1389
1383 pdev = platform_device_alloc("wm8350-regulator", reg); 1390 pdev = platform_device_alloc("wm8350-regulator", reg);
1384 if (!pdev) 1391 if (!pdev)
1385 return -ENOMEM; 1392 return -ENOMEM;
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h
index d5ccce1643e4..e0c45574b0c8 100644
--- a/drivers/s390/net/qeth_core.h
+++ b/drivers/s390/net/qeth_core.h
@@ -643,7 +643,6 @@ struct qeth_card_options {
643 int macaddr_mode; 643 int macaddr_mode;
644 int fake_broadcast; 644 int fake_broadcast;
645 int add_hhlen; 645 int add_hhlen;
646 int fake_ll;
647 int layer2; 646 int layer2;
648 enum qeth_large_send_types large_send; 647 enum qeth_large_send_types large_send;
649 int performance_stats; 648 int performance_stats;
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index e783644a2105..6811dd529f48 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -287,8 +287,15 @@ int qeth_set_large_send(struct qeth_card *card,
287 card->options.large_send = type; 287 card->options.large_send = type;
288 switch (card->options.large_send) { 288 switch (card->options.large_send) {
289 case QETH_LARGE_SEND_EDDP: 289 case QETH_LARGE_SEND_EDDP:
290 card->dev->features |= NETIF_F_TSO | NETIF_F_SG | 290 if (card->info.type != QETH_CARD_TYPE_IQD) {
291 card->dev->features |= NETIF_F_TSO | NETIF_F_SG |
291 NETIF_F_HW_CSUM; 292 NETIF_F_HW_CSUM;
293 } else {
294 card->dev->features &= ~(NETIF_F_TSO | NETIF_F_SG |
295 NETIF_F_HW_CSUM);
296 card->options.large_send = QETH_LARGE_SEND_NO;
297 rc = -EOPNOTSUPP;
298 }
292 break; 299 break;
293 case QETH_LARGE_SEND_TSO: 300 case QETH_LARGE_SEND_TSO:
294 if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) { 301 if (qeth_is_supported(card, IPA_OUTBOUND_TSO)) {
@@ -572,6 +579,10 @@ static void qeth_send_control_data_cb(struct qeth_channel *channel,
572 card = CARD_FROM_CDEV(channel->ccwdev); 579 card = CARD_FROM_CDEV(channel->ccwdev);
573 if (qeth_check_idx_response(iob->data)) { 580 if (qeth_check_idx_response(iob->data)) {
574 qeth_clear_ipacmd_list(card); 581 qeth_clear_ipacmd_list(card);
582 if (((iob->data[2] & 0xc0) == 0xc0) && iob->data[4] == 0xf6)
583 dev_err(&card->gdev->dev,
584 "The qeth device is not configured "
585 "for the OSI layer required by z/VM\n");
575 qeth_schedule_recovery(card); 586 qeth_schedule_recovery(card);
576 goto out; 587 goto out;
577 } 588 }
@@ -1072,7 +1083,6 @@ static void qeth_set_intial_options(struct qeth_card *card)
1072 card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL; 1083 card->options.macaddr_mode = QETH_TR_MACADDR_NONCANONICAL;
1073 card->options.fake_broadcast = 0; 1084 card->options.fake_broadcast = 0;
1074 card->options.add_hhlen = DEFAULT_ADD_HHLEN; 1085 card->options.add_hhlen = DEFAULT_ADD_HHLEN;
1075 card->options.fake_ll = 0;
1076 card->options.performance_stats = 0; 1086 card->options.performance_stats = 0;
1077 card->options.rx_sg_cb = QETH_RX_SG_CB; 1087 card->options.rx_sg_cb = QETH_RX_SG_CB;
1078} 1088}
@@ -1682,6 +1692,7 @@ int qeth_send_control_data(struct qeth_card *card, int len,
1682 unsigned long flags; 1692 unsigned long flags;
1683 struct qeth_reply *reply = NULL; 1693 struct qeth_reply *reply = NULL;
1684 unsigned long timeout; 1694 unsigned long timeout;
1695 struct qeth_ipa_cmd *cmd;
1685 1696
1686 QETH_DBF_TEXT(TRACE, 2, "sendctl"); 1697 QETH_DBF_TEXT(TRACE, 2, "sendctl");
1687 1698
@@ -1728,17 +1739,34 @@ int qeth_send_control_data(struct qeth_card *card, int len,
1728 wake_up(&card->wait_q); 1739 wake_up(&card->wait_q);
1729 return rc; 1740 return rc;
1730 } 1741 }
1731 while (!atomic_read(&reply->received)) { 1742
1732 if (time_after(jiffies, timeout)) { 1743 /* we have only one long running ipassist, since we can ensure
1733 spin_lock_irqsave(&reply->card->lock, flags); 1744 process context of this command we can sleep */
1734 list_del_init(&reply->list); 1745 cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE);
1735 spin_unlock_irqrestore(&reply->card->lock, flags); 1746 if ((cmd->hdr.command == IPA_CMD_SETIP) &&
1736 reply->rc = -ETIME; 1747 (cmd->hdr.prot_version == QETH_PROT_IPV4)) {
1737 atomic_inc(&reply->received); 1748 if (!wait_event_timeout(reply->wait_q,
1738 wake_up(&reply->wait_q); 1749 atomic_read(&reply->received), timeout))
1739 } 1750 goto time_err;
1740 cpu_relax(); 1751 } else {
1741 }; 1752 while (!atomic_read(&reply->received)) {
1753 if (time_after(jiffies, timeout))
1754 goto time_err;
1755 cpu_relax();
1756 };
1757 }
1758
1759 rc = reply->rc;
1760 qeth_put_reply(reply);
1761 return rc;
1762
1763time_err:
1764 spin_lock_irqsave(&reply->card->lock, flags);
1765 list_del_init(&reply->list);
1766 spin_unlock_irqrestore(&reply->card->lock, flags);
1767 reply->rc = -ETIME;
1768 atomic_inc(&reply->received);
1769 wake_up(&reply->wait_q);
1742 rc = reply->rc; 1770 rc = reply->rc;
1743 qeth_put_reply(reply); 1771 qeth_put_reply(reply);
1744 return rc; 1772 return rc;
@@ -2250,7 +2278,8 @@ void qeth_print_status_message(struct qeth_card *card)
2250 } 2278 }
2251 /* fallthrough */ 2279 /* fallthrough */
2252 case QETH_CARD_TYPE_IQD: 2280 case QETH_CARD_TYPE_IQD:
2253 if (card->info.guestlan) { 2281 if ((card->info.guestlan) ||
2282 (card->info.mcl_level[0] & 0x80)) {
2254 card->info.mcl_level[0] = (char) _ebcasc[(__u8) 2283 card->info.mcl_level[0] = (char) _ebcasc[(__u8)
2255 card->info.mcl_level[0]]; 2284 card->info.mcl_level[0]];
2256 card->info.mcl_level[1] = (char) _ebcasc[(__u8) 2285 card->info.mcl_level[1] = (char) _ebcasc[(__u8)
diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 2c48591ced44..21627ba3093b 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -1126,9 +1126,11 @@ static int qeth_l2_recover(void *ptr)
1126 dev_info(&card->gdev->dev, 1126 dev_info(&card->gdev->dev,
1127 "Device successfully recovered!\n"); 1127 "Device successfully recovered!\n");
1128 else { 1128 else {
1129 rtnl_lock(); 1129 if (card->dev) {
1130 dev_close(card->dev); 1130 rtnl_lock();
1131 rtnl_unlock(); 1131 dev_close(card->dev);
1132 rtnl_unlock();
1133 }
1132 dev_warn(&card->gdev->dev, "The qeth device driver " 1134 dev_warn(&card->gdev->dev, "The qeth device driver "
1133 "failed to recover an error on the device\n"); 1135 "failed to recover an error on the device\n");
1134 } 1136 }
diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c
index c0b30b25a5f1..cfda1ecffdf2 100644
--- a/drivers/s390/net/qeth_l3_main.c
+++ b/drivers/s390/net/qeth_l3_main.c
@@ -1047,7 +1047,7 @@ static int qeth_l3_setadapter_parms(struct qeth_card *card)
1047 rc = qeth_setadpparms_change_macaddr(card); 1047 rc = qeth_setadpparms_change_macaddr(card);
1048 if (rc) 1048 if (rc)
1049 dev_warn(&card->gdev->dev, "Reading the adapter MAC" 1049 dev_warn(&card->gdev->dev, "Reading the adapter MAC"
1050 " address failed\n", rc); 1050 " address failed\n");
1051 } 1051 }
1052 1052
1053 if ((card->info.link_type == QETH_LINK_TYPE_HSTR) || 1053 if ((card->info.link_type == QETH_LINK_TYPE_HSTR) ||
@@ -1207,12 +1207,9 @@ static int qeth_l3_start_ipa_source_mac(struct qeth_card *card)
1207 1207
1208 QETH_DBF_TEXT(TRACE, 3, "stsrcmac"); 1208 QETH_DBF_TEXT(TRACE, 3, "stsrcmac");
1209 1209
1210 if (!card->options.fake_ll)
1211 return -EOPNOTSUPP;
1212
1213 if (!qeth_is_supported(card, IPA_SOURCE_MAC)) { 1210 if (!qeth_is_supported(card, IPA_SOURCE_MAC)) {
1214 dev_info(&card->gdev->dev, 1211 dev_info(&card->gdev->dev,
1215 "Inbound source address not supported on %s\n", 1212 "Inbound source MAC-address not supported on %s\n",
1216 QETH_CARD_IFNAME(card)); 1213 QETH_CARD_IFNAME(card));
1217 return -EOPNOTSUPP; 1214 return -EOPNOTSUPP;
1218 } 1215 }
@@ -1221,7 +1218,7 @@ static int qeth_l3_start_ipa_source_mac(struct qeth_card *card)
1221 IPA_CMD_ASS_START, 0); 1218 IPA_CMD_ASS_START, 0);
1222 if (rc) 1219 if (rc)
1223 dev_warn(&card->gdev->dev, 1220 dev_warn(&card->gdev->dev,
1224 "Starting proxy ARP support for %s failed\n", 1221 "Starting source MAC-address support for %s failed\n",
1225 QETH_CARD_IFNAME(card)); 1222 QETH_CARD_IFNAME(card));
1226 return rc; 1223 return rc;
1227} 1224}
@@ -1921,8 +1918,13 @@ static inline __u16 qeth_l3_rebuild_skb(struct qeth_card *card,
1921 memcpy(tg_addr, card->dev->dev_addr, 1918 memcpy(tg_addr, card->dev->dev_addr,
1922 card->dev->addr_len); 1919 card->dev->addr_len);
1923 } 1920 }
1924 card->dev->header_ops->create(skb, card->dev, prot, tg_addr, 1921 if (hdr->hdr.l3.ext_flags & QETH_HDR_EXT_SRC_MAC_ADDR)
1925 "FAKELL", card->dev->addr_len); 1922 card->dev->header_ops->create(skb, card->dev, prot,
1923 tg_addr, &hdr->hdr.l3.dest_addr[2],
1924 card->dev->addr_len);
1925 else
1926 card->dev->header_ops->create(skb, card->dev, prot,
1927 tg_addr, "FAKELL", card->dev->addr_len);
1926 } 1928 }
1927 1929
1928#ifdef CONFIG_TR 1930#ifdef CONFIG_TR
@@ -2080,9 +2082,11 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode)
2080 if (recovery_mode) 2082 if (recovery_mode)
2081 qeth_l3_stop(card->dev); 2083 qeth_l3_stop(card->dev);
2082 else { 2084 else {
2083 rtnl_lock(); 2085 if (card->dev) {
2084 dev_close(card->dev); 2086 rtnl_lock();
2085 rtnl_unlock(); 2087 dev_close(card->dev);
2088 rtnl_unlock();
2089 }
2086 } 2090 }
2087 if (!card->use_hard_stop) { 2091 if (!card->use_hard_stop) {
2088 rc = qeth_send_stoplan(card); 2092 rc = qeth_send_stoplan(card);
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c
index 185be760833e..2a129cb7bb56 100644
--- a/drivers/usb/core/inode.c
+++ b/drivers/usb/core/inode.c
@@ -279,7 +279,6 @@ static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t de
279 inode->i_mode = mode; 279 inode->i_mode = mode;
280 inode->i_uid = current_fsuid(); 280 inode->i_uid = current_fsuid();
281 inode->i_gid = current_fsgid(); 281 inode->i_gid = current_fsgid();
282 inode->i_blocks = 0;
283 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 282 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
284 switch (mode & S_IFMT) { 283 switch (mode & S_IFMT) {
285 default: 284 default:
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index c4e62a6297d7..2e71368f45b4 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1863,26 +1863,10 @@ static int do_write(struct fsg_dev *fsg)
1863static int fsync_sub(struct lun *curlun) 1863static int fsync_sub(struct lun *curlun)
1864{ 1864{
1865 struct file *filp = curlun->filp; 1865 struct file *filp = curlun->filp;
1866 struct inode *inode;
1867 int rc, err;
1868 1866
1869 if (curlun->ro || !filp) 1867 if (curlun->ro || !filp)
1870 return 0; 1868 return 0;
1871 if (!filp->f_op->fsync) 1869 return vfs_fsync(filp, filp->f_path.dentry, 1);
1872 return -EINVAL;
1873
1874 inode = filp->f_path.dentry->d_inode;
1875 mutex_lock(&inode->i_mutex);
1876 rc = filemap_fdatawrite(inode->i_mapping);
1877 err = filp->f_op->fsync(filp, filp->f_path.dentry, 1);
1878 if (!rc)
1879 rc = err;
1880 err = filemap_fdatawait(inode->i_mapping);
1881 if (!rc)
1882 rc = err;
1883 mutex_unlock(&inode->i_mutex);
1884 VLDBG(curlun, "fdatasync -> %d\n", rc);
1885 return rc;
1886} 1870}
1887 1871
1888static void fsync_all(struct fsg_dev *fsg) 1872static void fsync_all(struct fsg_dev *fsg)
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index eeb26c0f88e5..317b48fdbf01 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -2001,7 +2001,6 @@ gadgetfs_make_inode (struct super_block *sb,
2001 inode->i_mode = mode; 2001 inode->i_mode = mode;
2002 inode->i_uid = default_uid; 2002 inode->i_uid = default_uid;
2003 inode->i_gid = default_gid; 2003 inode->i_gid = default_gid;
2004 inode->i_blocks = 0;
2005 inode->i_atime = inode->i_mtime = inode->i_ctime 2004 inode->i_atime = inode->i_mtime = inode->i_ctime
2006 = CURRENT_TIME; 2005 = CURRENT_TIME;
2007 inode->i_private = data; 2006 inode->i_private = data;
diff --git a/firmware/Makefile b/firmware/Makefile
index 6968388818be..d872b7942a30 100644
--- a/firmware/Makefile
+++ b/firmware/Makefile
@@ -20,6 +20,15 @@ fw-external-y := $(subst ",,$(CONFIG_EXTRA_FIRMWARE))
20# accurate. In the latter case it doesn't matter -- it'll use $(fw-shipped-all). 20# accurate. In the latter case it doesn't matter -- it'll use $(fw-shipped-all).
21# But be aware that the config file might not be included at all. 21# But be aware that the config file might not be included at all.
22 22
23ifdef CONFIG_ACENIC_OMIT_TIGON_I
24acenic-objs := acenic/tg2.bin
25fw-shipped- += acenic/tg1.bin
26else
27acenic-objs := acenic/tg1.bin acenic/tg2.bin
28endif
29fw-shipped-$(CONFIG_ACENIC) += $(acenic-objs)
30fw-shipped-$(CONFIG_ADAPTEC_STARFIRE) += adaptec/starfire_rx.bin \
31 adaptec/starfire_tx.bin
23fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin 32fw-shipped-$(CONFIG_ATARI_DSP56K) += dsp56k/bootstrap.bin
24fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw 33fw-shipped-$(CONFIG_ATM_AMBASSADOR) += atmsar11.fw
25fw-shipped-$(CONFIG_CASSINI) += sun/cassini.bin 34fw-shipped-$(CONFIG_CASSINI) += sun/cassini.bin
@@ -38,6 +47,8 @@ fw-shipped-$(CONFIG_SND_SB16_CSP) += sb16/mulaw_main.csp sb16/alaw_main.csp \
38 sb16/ima_adpcm_capture.csp 47 sb16/ima_adpcm_capture.csp
39fw-shipped-$(CONFIG_SND_YMFPCI) += yamaha/ds1_ctrl.fw yamaha/ds1_dsp.fw \ 48fw-shipped-$(CONFIG_SND_YMFPCI) += yamaha/ds1_ctrl.fw yamaha/ds1_dsp.fw \
40 yamaha/ds1e_ctrl.fw 49 yamaha/ds1e_ctrl.fw
50fw-shipped-$(CONFIG_TIGON3) += tigon/tg3.bin tigon/tg3_tso.bin \
51 tigon/tg3_tso5.bin
41fw-shipped-$(CONFIG_USB_DABUSB) += dabusb/firmware.fw dabusb/bitstream.bin 52fw-shipped-$(CONFIG_USB_DABUSB) += dabusb/firmware.fw dabusb/bitstream.bin
42fw-shipped-$(CONFIG_USB_EMI26) += emi26/loader.fw emi26/firmware.fw \ 53fw-shipped-$(CONFIG_USB_EMI26) += emi26/loader.fw emi26/firmware.fw \
43 emi26/bitstream.fw 54 emi26/bitstream.fw
diff --git a/firmware/WHENCE b/firmware/WHENCE
index 8f06639ba3e7..1bb2cf4b1735 100644
--- a/firmware/WHENCE
+++ b/firmware/WHENCE
@@ -360,3 +360,52 @@ License: GPLv2 or OpenIB.org BSD license, no source visible
360 360
361-------------------------------------------------------------------------- 361--------------------------------------------------------------------------
362 362
363Driver: acenic -- Alteon AceNIC Gigabit Ethernet card
364
365File: acenic/tg1.bin
366File: acenic/tg2.bin
367
368Licence: Unknown
369
370Found in hex form in kernel source, but source allegedly available at
371http://alteon.shareable.org/
372
373--------------------------------------------------------------------------
374
375Driver: tigon3 -- Broadcom Tigon3 based gigabit Ethernet cards
376
377File: tigon/tg3.bin
378File: tigon/tg3_tso.bin
379File: tigon/tg3_tso5.bin
380
381Licence:
382 * Firmware is:
383 * Derived from proprietary unpublished source code,
384 * Copyright (C) 2000-2003 Broadcom Corporation.
385 *
386 * Permission is hereby granted for the distribution of this firmware
387 * data in hexadecimal or equivalent format, provided this copyright
388 * notice is accompanying it.
389
390Found in hex form in kernel source.
391
392--------------------------------------------------------------------------
393
394Driver: ADAPTEC_STARFIRE - Adaptec Starfire/DuraLAN support
395
396File: adaptec/starfire_rx.bin
397File: adaptec/starfire_tx.bin
398
399Licence: Allegedly GPLv2, but no source visible.
400
401Found in hex form in kernel source, with the following notice:
402
403 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE IT IS LICENSED "AS IS" AND
404 THERE IS NO WARRANTY FOR THE PROGRAM, INCLUDING BUT NOT LIMITED TO THE
405 IMPLIED WARRANTIES OF MERCHANTIBILITY OR FITNESS FOR A PARTICULAR PURPOSE
406 (TO THE EXTENT PERMITTED BY APPLICABLE LAW). USE OF THE PROGRAM IS AT YOUR
407 OWN RISK. IN NO EVENT WILL ADAPTEC OR ITS LICENSORS BE LIABLE TO YOU FOR
408 DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
409 ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM.
410
411--------------------------------------------------------------------------
diff --git a/firmware/acenic/tg1.bin.ihex b/firmware/acenic/tg1.bin.ihex
new file mode 100644
index 000000000000..bef2659d3645
--- /dev/null
+++ b/firmware/acenic/tg1.bin.ihex
@@ -0,0 +1,4573 @@
1:100000000C040B0000004000000040001000000342
2:10001000000000000000000D0000000D3C1D00016C
3:100020008FBD5C5403A0F0213C100000261040005E
4:100030000C00100C000000000000000D27BDFFD8D0
5:100040003C1CC0003C1B0013377BD8000000D021B3
6:100050003C17001336F7541802E02021340583E8DA
7:10006000AFBF00240C002488AFB000200C0023E8B0
8:10007000000000003C040001248451A42405000178
9:1000800002E03021000038213C10000126107E5093
10:10009000AFB000100C002403AFBB00143C02000FF3
11:1000A0003442FFFF020210240362102B10400009AB
12:1000B000240500033C040001248451B002003021D7
13:1000C000036038213C020010AFA200100C00240392
14:1000D000AFA00014000020213405C0003C01000145
15:1000E00000370821A02083B03C010001003708211F
16:1000F000A02083B23C01000100370821A02083B377
17:100100003C01000100370821AC2083B4A2E004D8F0
18:10011000000418C02484000100771021AC40727CD8
19:1001200000771021AC40728002E31021A445727C5C
20:100130002C8200201440FFF7000418C0000020218A
21:100140003405C000000418C0248400010077102189
22:10015000AC40737C00771021AC40738002E3102127
23:10016000A445737C2C8200805440FFF7000418C023
24:10017000AF800054AF80011C8F82004434420040A5
25:10018000AF8200448F82004434420020AF8200449A
26:100190008F420218304200021040000900000000A7
27:1001A0008F4202203C030002346300040043102508
28:1001B000AEE204C48F42021C0800107434420004F2
29:1001C0008F4202203C0300023463000600431025E6
30:1001D000AEE204C48F42021C34420006AEE204CCFC
31:1001E0008F420218304200101040000A0000000048
32:1001F0008F42021C34420004AEE204C88F42022047
33:100200003C03000A34630004004310250800108AF0
34:10021000AEE204C08F4202203C03000A34630006B1
35:1002200000431025AEE204C08F42021C3442000697
36:10023000AEE204C88F4202183042020010400003B0
37:100240002402000108001091A2E27248A2E0724864
38:1002500024020001AF8200A0AF8200B08F8300545F
39:100260008F82005408001099246300648F82005428
40:10027000006210232C4200651440FFFC00000000C7
41:10028000AF8000448F4202088F43020CAEE20010A0
42:10029000AEE300148EE400108EE5001426E2003078
43:1002A000AEE2002824020490AEE20018AF84009071
44:1002B000AF8500948EE20028AF8200B496E2001A67
45:1002C000AF82009C8F8200B08EE304CC00431025E7
46:1002D000AF8200B08F8200B0304200041440FFFDB6
47:1002E000000000008EE204508EE30454AEE304FCF0
48:1002F0008EE204FC2442E0002C4220011440000D58
49:1003000026E400308EE204508EE304543C040001E5
50:10031000248451BC3C050001AFA00010AFA0001424
51:100320008EE704FC34A5F0000C00240300603021AB
52:1003300026E400300C0024882405040027440080B3
53:100340000C0024882405008026E4777C0C00248897
54:10035000240504008F42025C26E40094AEE20060B3
55:100360008F4202602745020024060008AEE20068C2
56:10037000240200060C00249AAEE200643C023B9A80
57:100380003442CA000000202124030002AEE30074BE
58:10039000AEE30070AEE2006C240203E8AEE20104BA
59:1003A00024020001AEE30100AEE2010C3C030001B7
60:1003B0000064182190635C2002E410212484000171
61:1003C000A043009C2C82000F1440FFF800000000A6
62:1003D0008F82004002E418212484000100021702E9
63:1003E00024420030A062009C02E41021A040009C46
64:1003F00096E2046A30420003144000090000000045
65:1004000096E2047A30420003504001313C03080078
66:1004100096E2046A304200031040002A3C020700C2
67:1004200096E2047A30420003104000263C020700A6
68:1004300096E3047A96E2046A146200223C02070002
69:100440008EE204C024030001A2E34E2034420E00D9
70:10045000AEE204C08F420218304201001040000595
71:10046000000000003C0200012442E1680800111D68
72:10047000000211003C0200012442D35C0002110082
73:10048000000211823C030800004310253C010001DA
74:10049000AC2212383C0200012442F6800002110016
75:1004A000000211823C030800004310253C010001BA
76:1004B000AC2212788EE2000034424000080012386C
77:1004C000AEE2000034423000AFA200188EE206080F
78:1004D0008F43022824420001304900FF512300E2EB
79:1004E000AFA000108EE20608000210C000571021D5
80:1004F0008FA300188FA4001CAC43060CAC4406105C
81:100500008F8701202762380024E800200102102B89
82:1005100050400001276830008F820128110200043A
83:10052000000000008F820124150200070000102146
84:100530008EE201A40000302124420001AEE201A4B9
85:10054000080011A08EE201A48EE40608000420C079
86:10055000008018218EE404308EE5043400A32821A5
87:1005600000A3302B0082202100862021ACE4000073
88:10057000ACE500048EE3060824020008A4E2000EA5
89:100580002402000DACE20018ACE9001C000318C006
90:100590002463060C02E31021ACE200088EE204C4DE
91:1005A000ACE20010AF88012092E24E2014400037E8
92:1005B000240600018EE24E30000210C02442503862
93:1005C00002E220218C830000240200071462001F35
94:1005D000000000008EE34E308EE24E341062001BAD
95:1005E000240300408C82000424420001AC820004F9
96:1005F0008EE24E348EE54E30244200011043000757
97:10060000000000008EE24E342442000110A20005DA
98:10061000000000000800118A0000000014A000057E
99:10062000000000008F82012824420020AF820128B0
100:100630008F8201288C8200042C420011504000134C
101:10064000AC800000080011A0000000008EE24E30D7
102:100650002403004024420001504300030000102105
103:100660008EE24E3024420001AEE24E308EE24E3039
104:10067000000210C02442503802E220212402000768
105:10068000AC82000024020001AC82000454C0000CC3
106:10069000AEE906083C040001248451C8AFA0001054
107:1006A000AFA000148EE606088F4702283C0500091B
108:1006B0000C00240334A5F000080012230000000001
109:1006C0008F830120276238002466002000C2102B8F
110:1006D00050400001276630008F82012810C20004BC
111:1006E000000000008F82012414C2000700000000F7
112:1006F0008EE201A40000302124420001AEE201A4F8
113:10070000080012078EE201A48EE20608AC62001C0B
114:100710008EE404A08EE504A42462001CAC620008F0
115:1007200024020008A462000E24020011AC6200182A
116:10073000AC640000AC6500048EE204C4AC6200103E
117:10074000AF86012092E24E201440003724060001BB
118:100750008EE24E30000210C02442503802E22021C6
119:100760008C830000240200121462001F00000000AD
120:100770008EE34E308EE24E341062001B24030040A4
121:100780008C82000424420001AC8200048EE24E34CC
122:100790008EE54E30244200011043000700000000A7
123:1007A0008EE24E342442000110A200050000000039
124:1007B000080011F10000000014A000050000000076
125:1007C0008F82012824420020AF8201288F820128D5
126:1007D0008C8200042C42001150400013AC800000B9
127:1007E00008001207000000008EE24E302403004093
128:1007F0002442000150430003000010218EE24E30DD
129:1008000024420001AEE24E308EE24E30000210C0B3
130:100810002442503802E2202124020012AC8200005F
131:1008200024020001AC82000414C0001B0000000080
132:100830003C040001248451D0AFA00010AFA00014EC
133:100840008EE606088F4702283C0500090C002403A9
134:1008500034A5F0018EE201B024420001AEE201B005
135:10086000080012238EE201B03C040001248451DC14
136:10087000AFA000148EE606088F4702283C05000949
137:100880000C00240334A5F0058EE201AC24420001E3
138:10089000AEE201AC8EE201AC8EE201603C040001EC
139:1008A000248451E83405F00124420001AEE20160E5
140:1008B0008EE201600000302100003821AFA000105E
141:1008C0000C002403AFA00014080012380000000040
142:1008D0003C0200012442F5A800021100000211822E
143:1008E000004310253C010001AC22127896E2045A24
144:1008F00030420003104000253C050FFF8EE204C883
145:1009000034A5FFFF34420A00AEE204C88EE304C8F7
146:100910003C040001248451F424020001A2E204EC0E
147:10092000A2E204ED3C020002006218253C02000134
148:100930002442A3900045102400021082AEE304C8B4
149:100940003C030800004310253C010001AC221220AA
150:100950003C0200012442ADD4004510240002108264
151:10096000004310253C010001AC22128096E6045A97
152:100970000000382124050011AFA000100C00240352
153:10098000AFA0001408001268000000003C02000143
154:100990002442A9D400021100000211823C03080085
155:1009A000004310253C010001AC22128096E2046A4B
156:1009B00030420010144000090000000096E2047A62
157:1009C00030420010104001120000000096E2046A5C
158:1009D00030420010104000053C02070096E2047A05
159:1009E00030420010144001023C0207003442300043
160:1009F000AFA200188EE206088F43022824420001AD
161:100A0000304900FF512300E2AFA000108EE206083B
162:100A1000000210C0005710218FA300188FA4001CE3
163:100A2000AC43060CAC4406108F87012027623800C7
164:100A300024E800200102102B5040000127683000FC
165:100A40008F82012811020004000000008F8201241F
166:100A500015020007000010218EE201A400003021E1
167:100A600024420001AEE201A4080012EA8EE201A4D1
168:100A70008EE40608000420C0008018218EE40430B3
169:100A80008EE5043400A3282100A3302B008220210E
170:100A900000862021ACE40000ACE500048EE30608EB
171:100AA00024020008A4E2000E2402000DACE20018AB
172:100AB000ACE9001C000318C02463060C02E31021FB
173:100AC000ACE200088EE204C4ACE20010AF88012062
174:100AD00092E24E2014400037240600018EE24E3090
175:100AE000000210C02442503802E220218C83000012
176:100AF000240200071462001F000000008EE34E3045
177:100B00008EE24E341062001B240300408C820004ED
178:100B100024420001AC8200048EE24E348EE54E3059
179:100B20002442000110430007000000008EE24E3412
180:100B30002442000110A2000500000000080012D4A9
181:100B40000000000014A00005000000008F820128B2
182:100B500024420020AF8201288F8201288C82000469
183:100B60002C42001150400013AC800000080012EA33
184:100B7000000000008EE24E302403004024420001B9
185:100B800050430003000010218EE24E302442000149
186:100B9000AEE24E308EE24E30000210C02442503899
187:100BA00002E2202124020007AC820000240200019E
188:100BB000AC82000454C0000CAEE906083C040001FD
189:100BC000248451C8AFA00010AFA000148EE6060820
190:100BD0008F4702283C0500090C00240334A5F000CF
191:100BE0000800136D000000008F8301202762380089
192:100BF0002466002000C2102B504000012766300000
193:100C00008F82012810C20004000000008F8201249E
194:100C100014C20007000000008EE201A40000302191
195:100C200024420001AEE201A4080013518EE201A4A7
196:100C30008EE20608AC62001C8EE404A08EE504A4DB
197:100C40002462001CAC62000824020008A462000EAA
198:100C500024020011AC620018AC640000AC65000412
199:100C60008EE204C4AC620010AF86012092E24E20F6
200:100C700014400037240600018EE24E30000210C0FE
201:100C80002442503802E220218C830000240200120A
202:100C90001462001F000000008EE34E308EE24E34DE
203:100CA0001062001B240300408C82000424420001D7
204:100CB000AC8200048EE24E348EE54E3024420001B8
205:100CC00010430007000000008EE24E342442000171
206:100CD00010A20005000000000800133B0000000007
207:100CE00014A00005000000008F820128244200208B
208:100CF000AF8201288F8201288C8200042C420011CF
209:100D000050400013AC8000000800135100000000A8
210:100D10008EE24E3024030040244200015043000381
211:100D2000000010218EE24E3024420001AEE24E302F
212:100D30008EE24E30000210C02442503802E22021E0
213:100D400024020012AC82000024020001AC820004E4
214:100D500014C0001B000000003C040001248451D09A
215:100D6000AFA00010AFA000148EE606088F4702283F
216:100D70003C0500090C00240334A5F0018EE201B00B
217:100D800024420001AEE201B00800136D8EE201B012
218:100D90003C040001248451DCAFA000148EE6060858
219:100DA0008F4702283C0500090C00240334A5F005F8
220:100DB0008EE201AC24420001AEE201AC8EE201AC55
221:100DC0008EE201603C040001248451E83405F00205
222:100DD00024420001AEE201608EE201600000302199
223:100DE00000003821AFA000100C002403AFA00014B5
224:100DF00096E6047A96E7046A3C04000124845200D3
225:100E000024050012AFA000100C002403AFA00014B2
226:100E10000C004500000000000C002318000000003A
227:100E20003C06000134C63800AEE00608AF40022898
228:100E3000AF40022C96E304588EE400003C0512D823
229:100E400034A5C35827623800AEE2725827623800D2
230:100E5000AEE2726027623800AEE27264036610216F
231:100E6000AEE272702402FFFFAEE004D4AEE004E014
232:100E7000AEE004E4AEE004F0A2E004F4AEE00E0C58
233:100E8000AEE00E18AEE00E10AEE00E14AEE00E1C9A
234:100E9000AEE0724CAEE05244AEE05240AEE0523CA6
235:100EA000AEE07250AEE07254AEE0725CAEE07268DA
236:100EB000AEE004D02463FFFF00852025AEE304F8F4
237:100EC000AEE40000AF800060AF8200643C0201002D
238:100ED000AFA200188EE206088F43022824420001C8
239:100EE000304900FF512300E2AFA000108EE2060857
240:100EF000000210C0005710218FA300188FA4001CFF
241:100F0000AC43060CAC4406108F87012027623800E2
242:100F100024E800200102102B504000012768300017
243:100F20008F82012811020004000000008F8201243A
244:100F300015020007000010218EE201A400003021FC
245:100F400024420001AEE201A4080014228EE201A4B2
246:100F50008EE40608000420C0008018218EE40430CE
247:100F60008EE5043400A3282100A3302B0082202129
248:100F700000862021ACE40000ACE500048EE3060806
249:100F800024020008A4E2000E2402000DACE20018C6
250:100F9000ACE9001C000318C02463060C02E3102116
251:100FA000ACE200088EE204C4ACE20010AF8801207D
252:100FB00092E24E2014400037240600018EE24E30AB
253:100FC000000210C02442503802E220218C8300002D
254:100FD000240200071462001F000000008EE34E3060
255:100FE0008EE24E341062001B240300408C82000409
256:100FF00024420001AC8200048EE24E348EE54E3075
257:101000002442000110430007000000008EE24E342D
258:101010002442000110A20005000000000800140C8A
259:101020000000000014A00005000000008F820128CD
260:1010300024420020AF8201288F8201288C82000484
261:101040002C42001150400013AC8000000800142214
262:10105000000000008EE24E302403004024420001D4
263:1010600050430003000010218EE24E302442000164
264:10107000AEE24E308EE24E30000210C024425038B4
265:1010800002E2202124020007AC82000024020001B9
266:10109000AC82000454C0000CAEE906083C04000118
267:1010A000248451C8AFA00010AFA000148EE606083B
268:1010B0008F4702283C0500090C00240334A5F000EA
269:1010C000080014A5000000008F830120276238006B
270:1010D0002466002000C2102B50400001276630001B
271:1010E0008F82012810C20004000000008F820124BA
272:1010F00014C20007000000008EE201A400003021AD
273:1011000024420001AEE201A4080014898EE201A489
274:101110008EE20608AC62001C8EE404A08EE504A4F6
275:101120002462001CAC62000824020008A462000EC5
276:1011300024020011AC620018AC640000AC6500042D
277:101140008EE204C4AC620010AF86012092E24E2011
278:1011500014400037240600018EE24E30000210C019
279:101160002442503802E220218C8300002402001225
280:101170001462001F000000008EE34E308EE24E34F9
281:101180001062001B240300408C82000424420001F2
282:10119000AC8200048EE24E348EE54E3024420001D3
283:1011A00010430007000000008EE24E34244200018C
284:1011B00010A20005000000000800147300000000E9
285:1011C00014A00005000000008F82012824420020A6
286:1011D000AF8201288F8201288C8200042C420011EA
287:1011E00050400013AC80000008001489000000008B
288:1011F0008EE24E302403004024420001504300039D
289:10120000000010218EE24E3024420001AEE24E304A
290:101210008EE24E30000210C02442503802E22021FB
291:1012200024020012AC82000024020001AC820004FF
292:1012300014C0001B000000003C040001248451D0B5
293:10124000AFA00010AFA000148EE606088F4702285A
294:101250003C0500090C00240334A5F0018EE201B026
295:1012600024420001AEE201B0080014A58EE201B0F4
296:101270003C040001248451DCAFA000148EE6060873
297:101280008F4702283C0500090C00240334A5F00513
298:101290008EE201AC24420001AEE201AC8EE201AC70
299:1012A0008EE2015424420001AEE201540C0014DC31
300:1012B0008EE201548F8200A0304200041440FFFDF2
301:1012C000000000008F8200403042000114400008FE
302:1012D000000000008F43010424020001106200049A
303:1012E000000000008F420264104000060000000071
304:1012F0008EE2017C24420001AEE2017C080014C5AC
305:101300008EE2017C8F82004434420004AF820044AC
306:101310008EE2017824420001AEE201788EE201788B
307:101320008F8200D88F8300D400431023AEE2726C0A
308:101330008EE2726C1C4000033C030001004310214C
309:10134000AEE2726C0C004064000000000C004440EF
310:10135000AF8002288FBF00248FB0002003E0000878
311:1013600027BD002803E000080000000003E000089B
312:101370000000000000000000000000002402002C1B
313:10138000AF820050AEE072748F420238AEE27278E3
314:101390008F82005424420067AF820058AEE07B8801
315:1013A000AEE07B8CAEE07B843C010001003708217D
316:1013B000AC2083BC3C0100010037082103E0000899
317:1013C000A02083B927BDFFD8AFBF0024AFB0002055
318:1013D0008F8200543C0300018C635CD82442006778
319:1013E0001060000DAF8200583C0200010057102130
320:1013F000904283B8104000053C0302003C0100010C
321:101400000037082108001503A02083B88EE20000F1
322:1014100000431025AEE200008F4202183042010066
323:10142000104000C6000000008F8200B0304200046F
324:10143000104000C2000000003C03000100771821AA
325:101440008C6383D08F820104146200B4000000001A
326:101450003C030001007718218C6383D48F8200B491
327:10146000146200AE000000008F8200B03C030080D8
328:10147000004310241040000D000000008F82011C6A
329:1014800034420002AF82011C8F8200B02403FFFBB4
330:1014900000431024AF8200B08F82011C2403FFFDA3
331:1014A00000431024080015CCAF82011C3C0300014E
332:1014B000007718218C6383D08F820104146200822C
333:1014C000000000003C030001007718218C6383D4E6
334:1014D0008F8200B41462007C000000003C07000111
335:1014E00000F738218CE783D08F8200B03C040001E4
336:1014F00024845270AFA00014AFA200108F8600B0F9
337:101500003C0500050C00240334A509008F82011C52
338:1015100034420002AF82011C8F8301048F8200B02D
339:1015200034420001AF8200B0AF8301048F830120F9
340:10153000276238002466002000C2102B50400001B2
341:10154000276630008F82012810C2000400000000CE
342:101550008F82012414C20006000000008EE201A464
343:1015600024420001AEE201A4080015A08EE201A40D
344:101570008F4402088F45020C26E20030AC6200085E
345:1015800024020400A462000E2402000FAC620018C2
346:10159000AC60001CAC640000AC6500048EE204C4C6
347:1015A000AC620010AF86012092E24E20144000375A
348:1015B000000000008EE24E30000210C0244250387D
349:1015C00002E220218C830000240200071462001F25
350:1015D000000000008EE34E308EE24E341062001B9D
351:1015E000240300408C82000424420001AC820004E9
352:1015F0008EE24E348EE54E30244200011043000747
353:10160000000000008EE24E342442000110A20005CA
354:10161000000000000800158A0000000014A000056A
355:10162000000000008F82012824420020AF820128A0
356:101630008F8201288C8200042C420011504000133C
357:10164000AC800000080015A0000000008EE24E30C3
358:1016500024030040244200015043000300001021F5
359:101660008EE24E3024420001AEE24E308EE24E3029
360:10167000000210C02442503802E220212402000758
361:10168000AC82000024020001AC8200048F82011CA5
362:101690002403FFFD00431024AF82011C8EE201E40D
363:1016A0003C07000100F738218CE783D02442000179
364:1016B000AEE201E48EE201E43C0400012484527CA9
365:1016C000080015BDAFA000108F8201043C0100018D
366:1016D00000370821AC2283D08F8200B43C07000180
367:1016E00000F738218CE783D03C0400012484528425
368:1016F0003C01000100370821AC2283D4AFA00010C8
369:10170000AFA000148F8600B03C0500050C00240338
370:1017100034A50900080015CC000000008F820104E8
371:101720003C01000100370821AC2283D08F8200B435
372:101730003C01000100370821AC2283D48EE2727490
373:1017400092E304F42442006714600006AEE272746F
374:101750008EE272748F4302340043102B1440007BDE
375:10176000000000008EE304E48EE204F8146200043A
376:101770000000000092E204F450400074A2E004F47F
377:101780008F830120276238002466002000C2102BBE
378:1017900050400001276630008F82012810C20004EB
379:1017A000000000008F82012414C200070000000026
380:1017B0008EE201A40000802124420001AEE201A4D7
381:1017C000080016378EE201A48EE204E4AC62001C2D
382:1017D0008EE404B08EE504B42462001CAC62000800
383:1017E00024020008A462000E24020011AC6200185A
384:1017F000AC640000AC6500048EE204C4AC6200106E
385:10180000AF86012092E24E201440003724100001E0
386:101810008EE24E30000210C02442503802E22021F5
387:101820008C830000240200121462001F00000000DC
388:101830008EE34E308EE24E341062001B24030040D3
389:101840008C82000424420001AC8200048EE24E34FB
390:101850008EE54E30244200011043000700000000D6
391:101860008EE24E342442000110A200050000000068
392:10187000080016210000000014A000050000000070
393:101880008F82012824420020AF8201288F82012804
394:101890008C8200042C42001150400013AC800000E8
395:1018A00008001637000000008EE24E30240300408E
396:1018B0002442000150430003000010218EE24E300C
397:1018C00024420001AEE24E308EE24E30000210C0E3
398:1018D0002442503802E2202124020012AC8200008F
399:1018E00024020001AC8200045600000B2410000109
400:1018F0008EE204E43C0400012484528CAFA0001466
401:10190000AFA200108EE606088F4702283C050009AA
402:101910000C00240334A5F006160000032402000185
403:1019200008001650A2E204F48EE201702442000185
404:10193000AEE201708EE201708EE204E4A2E004F4F3
405:10194000AEE004F0AEE07274AEE204F88EE20E1C7B
406:101950001040006D000000008F83012027623800D6
407:101960002466002000C2102B504000012766300082
408:101970008F82012810C20004000000008F82012421
409:1019800014C20007000000008EE201A400008021C4
410:1019900024420001AEE201A4080016AD8EE201A4CB
411:1019A0008EE2724CAC62001C8EE404A88EE504AC9E
412:1019B0002462001CAC62000824020008A462000E2D
413:1019C00024020011AC620018AC640000AC65000495
414:1019D0008EE204C4AC620010AF86012092E24E2079
415:1019E00014400037241000018EE24E30000210C077
416:1019F0002442503802E220218C830000240200128D
417:101A00001462001F000000008EE34E308EE24E3460
418:101A10001062001B240300408C8200042442000159
419:101A2000AC8200048EE24E348EE54E30244200013A
420:101A300010430007000000008EE24E3424420001F3
421:101A400010A200050000000008001697000000002A
422:101A500014A00005000000008F820128244200200D
423:101A6000AF8201288F8201288C8200042C42001151
424:101A700050400013AC800000080016AD00000000CC
425:101A80008EE24E3024030040244200015043000304
426:101A9000000010218EE24E3024420001AEE24E30B2
427:101AA0008EE24E30000210C02442503802E2202163
428:101AB00024020012AC82000024020001AC82000467
429:101AC0005600000B241000018EE2724C3C04000111
430:101AD00024845298AFA00014AFA200108EE6724C7E
431:101AE0008F4702803C0500090C00240334A5F00850
432:101AF00056000001AEE00E1C8EE20174244200018B
433:101B0000AEE201748EE201748EE24E2410400019A0
434:101B100000000000AEE04E248F8200403042000101
435:101B200014400008000000008F430104240200015B
436:101B300010620004000000008F42026410400006A2
437:101B4000000000008EE2017C24420001AEE2017C34
438:101B5000080016DA8EE2017C8F82004434420004D1
439:101B6000AF8200448EE2017824420001AEE20178A7
440:101B70008EE201788EE272782442FF99AEE27278AA
441:101B80008EE272781C4002AD000000008F420238E5
442:101B9000104002AA000000003C0200010057102182
443:101BA000904283E0144002A5000000008F420080B4
444:101BB000AEE2004C8F4200C0AEE200488F4200848B
445:101BC000AEE200388F420084AEE202448F420088C9
446:101BD000AEE202488F42008CAEE2024C8F4200908F
447:101BE000AEE202508F420094AEE202548F4200985F
448:101BF000AEE202588F42009CAEE2025C8F4200A02F
449:101C0000AEE202608F4200A4AEE202648F4200A8FE
450:101C1000AEE202688F4200ACAEE2026C8F4200B0CE
451:101C2000AEE202708F4200B4AEE202748F4200B89E
452:101C3000AEE202788F4200BC24040001AEE2027CD6
453:101C4000AEE0003C00041080005710218EE3003C01
454:101C50008C42024424840001006218212C82000F6F
455:101C6000AEE3003C1440FFF8000410808F4200CC2B
456:101C7000AEE200508F4200D0AEE200548F830120CC
457:101C8000276238002466002000C2102B504000015B
458:101C9000276630008F82012810C200040000000077
459:101CA0008F82012414C20007000000008EE201A40C
460:101CB0000000802124420001AEE201A40800177553
461:101CC0008EE201A48F4402088F45020C26E2003008
462:101CD000AC62000824020400A462000E2402000F7B
463:101CE000AC620018AC60001CAC640000AC65000481
464:101CF0008EE204C4AC620010AF86012092E24E2056
465:101D000014400037241000018EE24E30000210C053
466:101D10002442503802E220218C8300002402000774
467:101D20001462001F000000008EE34E308EE24E343D
468:101D30001062001B240300408C8200042442000136
469:101D4000AC8200048EE24E348EE54E302442000117
470:101D500010430007000000008EE24E3424420001D0
471:101D600010A20005000000000800175F000000003E
472:101D700014A00005000000008F82012824420020EA
473:101D8000AF8201288F8201288C8200042C4200112E
474:101D900050400013AC8000000800177500000000E0
475:101DA0008EE24E30240300402442000150430003E1
476:101DB000000010218EE24E3024420001AEE24E308F
477:101DC0008EE24E30000210C02442503802E2202140
478:101DD00024020007AC82000024020001AC8200044F
479:101DE000120002123C020400AFA200183C020001E3
480:101DF00000571021904283B01040010B00000000FA
481:101E00008EE206088F43022824420001304A00FF78
482:101E1000514300FDAFA000108EE20608000210C082
483:101E2000005710218FA300188FA4001CAC43060C90
484:101E3000AC4406108F8300548F8200542469003212
485:101E4000012210232C4200331040006A0000582168
486:101E500024180008240F000D240D0007240C004056
487:101E6000240E00018F8701202762380024E800201B
488:101E70000102102B50400001276830008F8201289A
489:101E800011020004000000008F82012415020007E7
490:101E9000000010218EE201A40000802124420001F4
491:101EA000AEE201A4080017F38EE201A48EE4060856
492:101EB000000420C0008018218EE404308EE5043434
493:101EC00000A3282100A3302B00822021008620219E
494:101ED000ACE40000ACE500048EE20608A4F8000EB5
495:101EE000ACEF0018ACEA001C000210C02442060C43
496:101EF00002E21021ACE200088EE204C4ACE2001061
497:101F0000AF88012092E24E201440003324100001DB
498:101F10008EE24E30000210C02442503802E22021EE
499:101F20008C820000144D001F000000008EE34E3034
500:101F30008EE24E341062001B000000008C82000410
501:101F400024420001AC8200048EE24E348EE34E3017
502:101F500024420001104C0007000000008EE24E34C5
503:101F6000244200011062000500000000080017E094
504:101F70000000000014600005000000008F820128AE
505:101F800024420020AF8201288F8201288C82000425
506:101F90002C42001150400010AC800000080017F3E4
507:101FA000000000008EE24E3024420001504C00033D
508:101FB000000010218EE24E3024420001AEE24E308D
509:101FC0008EE24E30000210C02442503802E220213E
510:101FD000AC8D0000AC8E000456000006240B0001FE
511:101FE0008F820054012210232C4200331440FF9DA5
512:101FF00000000000316300FF24020001146200773A
513:102000003C050009AEEA06088F8300548F82005415
514:1020100024690032012210232C4200331040006159
515:1020200000005821240D0008240C0011240800127F
516:1020300024070040240A00018F8301202762380012
517:102040002466002000C2102B50400001276630009B
518:102050008F82012810C20004000000008F8201243A
519:1020600014C20007000000008EE201A400008021DD
520:1020700024420001AEE201A40800185F8EE201A430
521:102080008EE20608AC62001C8EE404A08EE504A477
522:102090002462001CAC620008A46D000EAC6C001839
523:1020A000AC640000AC6500048EE204C4AC620010B5
524:1020B000AF86012092E24E2014400033241000012C
525:1020C0008EE24E30000210C02442503802E220213D
526:1020D0008C8200001448001F000000008EE34E3088
527:1020E0008EE24E341062001B000000008C8200045F
528:1020F00024420001AC8200048EE24E348EE34E3066
529:102100002442000110470007000000008EE24E3418
530:102110002442000110620005000000000800184C75
531:102120000000000014600005000000008F820128FC
532:1021300024420020AF8201288F8201288C82000473
533:102140002C42001150400010AC8000000800185FC5
534:10215000000000008EE24E30244200015047000390
535:10216000000010218EE24E3024420001AEE24E30DB
536:102170008EE24E30000210C02442503802E220218C
537:10218000AC880000AC8A000456000006240B000155
538:102190008F820054012210232C4200331440FFA6EA
539:1021A00000000000316300FF2402000114620003FC
540:1021B0003C0500090800197C241000013C040001C2
541:1021C000248452A4AFA00010AFA000148F86012079
542:1021D0008F8701240800187B34A5F0113C0400010E
543:1021E000248452B0AFA00010AFA000148F8601204D
544:1021F0008F87012434A5F0100C00240300008021F7
545:102200000800197C000000003C040001248452BC3A
546:10221000AFA000148EE606088F4702283C0500098F
547:102220000800197534A5F00F8EE206088F430228C6
548:1022300024420001304900FF512300E2AFA000100A
549:102240008EE20608000210C0005710218FA300186C
550:102250008FA4001CAC43060CAC4406108F870120F1
551:102260002762380024E800200102102B50400001B2
552:10227000276830008F82012811020004000000004E
553:102280008F82012415020007000010218EE201A4B4
554:102290000000802124420001AEE201A4080018F7EA
555:1022A0008EE201A48EE40608000420C000801821FC
556:1022B0008EE404308EE5043400A3282100A3302BE3
557:1022C0000082202100862021ACE40000ACE500045F
558:1022D0008EE3060824020008A4E2000E2402000D8A
559:1022E000ACE20018ACE9001C000318C02463060C23
560:1022F00002E31021ACE200088EE204C4ACE200105C
561:10230000AF88012092E24E201440003724100001D3
562:102310008EE24E30000210C02442503802E22021EA
563:102320008C830000240200071462001F00000000DC
564:102330008EE34E308EE24E341062001B24030040C8
565:102340008C82000424420001AC8200048EE24E34F0
566:102350008EE54E30244200011043000700000000CB
567:102360008EE24E342442000110A20005000000005D
568:10237000080018E10000000014A0000500000000A3
569:102380008F82012824420020AF8201288F820128F9
570:102390008C8200042C42001150400013AC800000DD
571:1023A000080018F7000000008EE24E3024030040C1
572:1023B0002442000150430003000010218EE24E3001
573:1023C00024420001AEE24E308EE24E30000210C0D8
574:1023D0002442503802E2202124020007AC8200008F
575:1023E00024020001AC8200045600000CAEE906088D
576:1023F0003C040001248452C8AFA00010AFA0001418
577:102400008EE606088F4702283C0500090C002403CD
578:1024100034A5F0000800197C000000008F83012023
579:10242000276238002466002000C2102B50400001B3
580:10243000276630008F82012810C2000400000000CF
581:102440008F82012414C20007000000008EE201A464
582:102450000000802124420001AEE201A40800195EC0
583:102460008EE201A48EE20608AC62001C8EE404A099
584:102470008EE504A42462001CAC620008240200085B
585:10248000A462000E24020011AC620018AC640000CB
586:10249000AC6500048EE204C4AC620010AF8601207B
587:1024A00092E24E2014400037241000018EE24E309C
588:1024B000000210C02442503802E220218C83000028
589:1024C000240200121462001F000000008EE34E3050
590:1024D0008EE24E341062001B240300408C82000404
591:1024E00024420001AC8200048EE24E348EE54E3070
592:1024F0002442000110430007000000008EE24E3429
593:102500002442000110A20005000000000800194844
594:102510000000000014A00005000000008F820128C8
595:1025200024420020AF8201288F8201288C8200047F
596:102530002C42001150400013AC8000000800195ECE
597:10254000000000008EE24E302403004024420001CF
598:1025500050430003000010218EE24E30244200015F
599:10256000AEE24E308EE24E30000210C024425038AF
600:1025700002E2202124020012AC82000024020001A9
601:10258000AC8200045600001D241000013C04000130
602:10259000248452D0AFA00010AFA000148EE606082D
603:1025A0008F4702283C0500090C00240334A5F001E4
604:1025B0008EE201B024420001AEE201B00800197CB5
605:1025C0008EE201B03C040001248452DCAFA0001470
606:1025D0008EE606088F4702283C05000934A5F00561
607:1025E0000C002403000000008EE201AC00008021FA
608:1025F00024420001AEE201AC8EE201AC1200000CFC
609:10260000240200013C01000100370821A02083B012
610:102610008F4202388EE3015824630001AEE3015873
611:102620008EE301580800198CAEE272782402000192
612:102630003C01000100370821A02283B03C020001C8
613:102640008C425CD810400187000000008EE27B8441
614:1026500024430001284200C9144001A4AEE37B8456
615:102660008EE204D43042000214400119AEE07B84B3
616:102670008EE204D43C0306003463100034420002AE
617:10268000AEE204D4AFA300188EE206088F430228FE
618:1026900024420001304A00FF514300FDAFA000106A
619:1026A0008EE20608000210C0005710218FA3001808
620:1026B0008FA4001CAC43060CAC4406108F8300545E
621:1026C0008F82005424690032012210232C420033EF
622:1026D0001040006A0000582124180008240F000D43
623:1026E000240D0007240C0040240E00018F870120D8
624:1026F0002762380024E800200102102B504000011E
625:10270000276830008F8201281102000400000000B9
626:102710008F82012415020007000010218EE201A41F
627:102720000000802124420001AEE201A408001A1535
628:102730008EE201A48EE40608000420C00080182167
629:102740008EE404308EE5043400A3282100A3302B4E
630:102750000082202100862021ACE40000ACE50004CA
631:102760008EE20608A4F8000EACEF0018ACEA001CDC
632:10277000000210C02442060C02E21021ACE2000864
633:102780008EE204C4ACE20010AF88012092E24E2039
634:1027900014400033241000018EE24E30000210C0BD
635:1027A0002442503802E220218C820000144D001F88
636:1027B000000000008EE34E308EE24E341062001BAB
637:1027C000000000008C82000424420001AC8200045E
638:1027D0008EE24E348EE34E3024420001104C00074E
639:1027E000000000008EE24E34244200011062000519
640:1027F0000000000008001A0200000000146000053C
641:10280000000000008F82012824420020AF820128AE
642:102810008F8201288C8200042C420011504000104D
643:10282000AC80000008001A15000000008EE24E3057
644:1028300024420001504C0003000010218EE24E3073
645:1028400024420001AEE24E308EE24E30000210C053
646:102850002442503802E22021AC8D0000AC8E0004EE
647:1028600056000006240B00018F8200540122102321
648:102870002C4200331440FF9D00000000316300FF34
649:102880002402000154620078AFA00010AEEA0608EE
650:102890008F8300548F820054246900320122102358
651:1028A0002C4200331040006100005821240D000824
652:1028B000240C00112408001224070040240A0001FF
653:1028C0008F830120276238002466002000C2102B6D
654:1028D00050400001276630008F82012810C200049A
655:1028E000000000008F82012414C2000700000000D5
656:1028F0008EE201A40000802124420001AEE201A486
657:1029000008001A818EE201A48EE20608AC62001C67
658:102910008EE404A08EE504A42462001CAC620008CE
659:10292000A46D000EAC6C0018AC640000AC65000433
660:102930008EE204C4AC620010AF86012092E24E2009
661:1029400014400033241000018EE24E30000210C00B
662:102950002442503802E220218C8200001448001FDB
663:10296000000000008EE34E308EE24E341062001BF9
664:10297000000000008C82000424420001AC820004AC
665:102980008EE24E348EE34E302442000110470007A1
666:10299000000000008EE24E34244200011062000567
667:1029A0000000000008001A6E00000000146000051E
668:1029B000000000008F82012824420020AF820128FD
669:1029C0008F8201288C8200042C420011504000109C
670:1029D000AC80000008001A81000000008EE24E303A
671:1029E0002442000150470003000010218EE24E30C7
672:1029F00024420001AEE24E308EE24E30000210C0A2
673:102A00002442503802E22021AC880000AC8A000445
674:102A100056000006240B00018F820054012210236F
675:102A20002C4200331440FFA600000000316300FF79
676:102A30002402000110620022000000003C0400019A
677:102A4000248452A4AFA00010AFA000148F860120F0
678:102A50008F8701243C0500090C00240334A5F011E4
679:102A600008001AAD000000003C040001248452B0AC
680:102A7000AFA000148F8601208F8701243C05000938
681:102A80000C00240334A5F01008001AAD000000006B
682:102A90003C040001248452BCAFA000148EE606085A
683:102AA0008F4702283C0500090C00240334A5F00FD1
684:102AB0008EE201AC24420001AEE201AC8EE201AC38
685:102AC0008EE2015C24420001AEE2015C8EE2015C18
686:102AD0008EE204D430420001104000550000000096
687:102AE0008F42021830420080104000290000000090
688:102AF0008F82004434420040AF8200448EE27B7CEF
689:102B0000004028218EE200C08EE300C424060000AD
690:102B10002407FFFF00002021004610241444000D6C
691:102B2000006718241465000B000000008EE27B8013
692:102B3000004028218EE200E08EE300E40000202126
693:102B40000046102414440003006718241065000B8D
694:102B5000000000008EE200C08EE300C48EE400E0BE
695:102B60008EE500E4AEE37B7CAEE57B808F820044A3
696:102B70003842002008001B38AF8200448F82004496
697:102B80002403FFDF0043102408001B38AF820044F9
698:102B90008F8200442403FFDF00431024AF820044EF
699:102BA0008EE27B7C004028218EE200C08EE300C4D0
700:102BB000240600002407FFFF000020210046102407
701:102BC0001444000D006718241465000B0000000079
702:102BD0008EE27B80004028218EE200E08EE300E45C
703:102BE000000020210046102414440003006718242C
704:102BF0001065000B000000008EE200C08EE300C4F0
705:102C00008EE400E08EE500E4AEE37B7CAEE57B8005
706:102C10008F8200443842004008001B38AF820044D5
707:102C20008F8200443442004008001B38AF820044C9
708:102C30008F82004434420040AF8200448EE27B8C9D
709:102C4000244300012842001514400028AEE37B8C89
710:102C50008F82004438420020AF82004408001B38B5
711:102C6000AEE07B8C8EE204D43042000110400011B3
712:102C7000000000008F42021830420080104000091E
713:102C8000000000008F82004434420020AF820044E4
714:102C90008F8200442403FFBF0043102408001B362A
715:102CA000AF8200448F8200443442006008001B362B
716:102CB000AF8200448F82004434420040AF8200441F
717:102CC0008EE27B88244300012842138914400005CA
718:102CD000AEE37B888F82004438420020AF820044FC
719:102CE000AEE07B880C004603000000008FBF00248C
720:102CF0008FB0002003E0000827BD002827BDFFB8E3
721:102D0000AFBF0044AFB60040AFB5003CAFB4003831
722:102D1000AFB30034AFB20030AFB1002CAFB0002879
723:102D20008F96006432C200041040000C240200049C
724:102D3000AF8200648F420114AEE204E08F82006033
725:102D400034420008AF8200608EE2016C2442000130
726:102D5000AEE2016C080022F48EE2016C32C2000186
727:102D60001040000424020001AF820064080022F435
728:102D70000000000032C200021440000C3C050003B9
729:102D80003C0400012484535434A5000102C03021C6
730:102D900000003821AFA000100C002403AFA00014E5
731:102DA0002402FFF8080022F4AF8200648F43022C53
732:102DB0008F42010C5062000CAFA000108F42022C19
733:102DC00000021080005A10218C420300AFA20020A4
734:102DD0008F42022C24070001244200013042003FB0
735:102DE00008001B80AF42022C3C0400012484536085
736:102DF000AFA000148F46022C8F47010C3C05000346
737:102E00000C00240334A5F01F0000382114E0000357
738:102E100000000000080022EDAF96006493A200209D
739:102E20002443FFFF2C62001110400658000310805D
740:102E30003C010001002208218C22541800400008A7
741:102E4000000000008FA2002030420FFFAEE20E0C07
742:102E50008F82006034420200AF8200608EE201186F
743:102E600024420001AEE20118080022E88EE20118B7
744:102E70008FA20020240300013C010001003708213B
745:102E8000A02383B130420FFFAEE252388F82006040
746:102E900034420100AF8200608EE20144244200010E
747:102EA000AEE20144080022E88EE201448FA2002035
748:102EB0000002120000022502240200011082000517
749:102EC00024020002108200092402FFFE08001BC930
750:102ED000AFA000108EE204D4AEE40070AEE4007443
751:102EE0003442000108001BBDAEE204D48EE304D4DA
752:102EF000AEE40070AEE4007400621824AEE304D4C3
753:102F00008F8400540004144200041C8200431021EA
754:102F100000041CC20043102300041D0200431021C2
755:102F200000041D420043102308001BD0AEE20078CD
756:102F30003C0400012484536CAFA000148FA6002031
757:102F40003C0500030C00240334A500048EE20110AC
758:102F500024420001AEE20110080022E88EE20110D6
759:102F6000274402120C0022FE240500063049001FEF
760:102F7000000920C002E410219442727C30424000DB
761:102F80001040000A0097102197430212A443727E5A
762:102F90008F43021400971021AC43728002E4182181
763:102FA0003402800008001C79A462727C9443727E13
764:102FB000974202121462000602E4102100971021C9
765:102FC0008C4372808F4202141062009F02E4102131
766:102FD0009442727C304280001040002A2406FFFF99
767:102FE00000002021000410C002E210219442737CF2
768:102FF000304240005440000500803021248400010C
769:103000002C8200801440FFF8000410C004C100109E
770:10301000000618C0000610C0005718218C63737C8E
771:1030200000571021AFA300108C4273803C040001B4
772:1030300024845378AFA200148F4702143C05000388
773:103040000C00240334A5001308001C903C02080067
774:103050009744021200771021A444737E8F44021417
775:103060000077102102E31821AC4473803402800001
776:10307000A462737C000910C002E2102108001C79D0
777:10308000A446727C02E410219445727C08001C2E38
778:10309000000510C09443737E97420212146200062A
779:1030A000000510C0009710218C4373808F420214DA
780:1030B00010620065000510C002E210219445737C87
781:1030C000000510C002E210219442737C304280005F
782:1030D0001040FFF000971021000520C0009710213C
783:1030E0009443737E97420212146200062406FFFF87
784:1030F000009710218C4373808F420214106200539A
785:103100003C02080000002021000410C002E210214F
786:103110009442737C304240005440000500803021CE
787:10312000248400012C8200801440FFF8000410C0A9
788:1031300004C10023000618C0000910C00057182160
789:103140008C63727C00571021AFA300108C427280F8
790:103150003C04000124845384AFA200148F4702145E
791:103160003C0500030C00240334A5F01708001C9054
792:103170003C0208008F43021000B71021AC43777C5B
793:103180008F43021400B71021AC4377803C0200014A
794:10319000005710218C4283B4244200013C010001FD
795:1031A00000370821AC2283B43C03000100771821CA
796:1031B0008C6383B402E5102108001C82A443777C51
797:1031C0009744021200771021A444737E8F440214A6
798:1031D0000077102102E31821AC4473803402800090
799:1031E000A462737C000510C002E21021A446737C27
800:1031F00000002021000428C002E510219442777CC1
801:103200001040FFDC248400012C8200805440FFFA2F
802:10321000000428C092E204D81040000624020001F5
803:103220008EE304DC012210040062182508001C8FC4
804:10323000AEE304DC8F830228240200010122100483
805:1032400000621825AF8302283C02080034421000B7
806:10325000AFA200188EE206088F4302282442000124
807:10326000304A00FF514300FDAFA000108EE2060877
808:10327000000210C0005710218FA300188FA4001C5B
809:10328000AC43060CAC4406108F8300548F8200546C
810:1032900024690032012210232C4200331040006ABE
811:1032A0000000582124100008240F000D240D0007F1
812:1032B000240C0040240E00018F8701202762380073
813:1032C00024E800200102102B504000012768300044
814:1032D0008F82012811020004000000008F82012467
815:1032E00015020007000010218EE201A40000382121
816:1032F00024420001AEE201A408001D088EE201A4F0
817:103300008EE40608000420C0008018218EE40430FA
818:103310008EE5043400A3282100A3302B0082202155
819:1033200000862021ACE40000ACE500048EE2060833
820:10333000A4F0000EACEF0018ACEA001C000210C0B4
821:103340002442060C02E21021ACE200088EE204C422
822:10335000ACE20010AF88012092E24E20144000330E
823:10336000240700018EE24E30000210C02442503883
824:1033700002E220218C820000144D001F000000009A
825:103380008EE34E308EE24E341062001B00000000CF
826:103390008C82000424420001AC8200048EE24E3490
827:1033A0008EE34E3024420001104C00070000000064
828:1033B0008EE24E342442000110620005000000003D
829:1033C00008001CF50000000014600005000000006B
830:1033D0008F82012824420020AF8201288F82012899
831:1033E0008C8200042C42001150400010AC80000080
832:1033F00008001D08000000008EE24E30244200014B
833:10340000504C0003000010218EE24E302442000197
834:10341000AEE24E308EE24E30000210C024425038F0
835:1034200002E22021AC8D0000AC8E000454E00006C6
836:10343000240B00018F820054012210232C42003300
837:103440001440FF9D00000000316300FF24020001D2
838:1034500054620078AFA00010AEEA06088F830054D3
839:103460008F82005424690032012210232C42003341
840:103470001040006100005821240E0008240D0011A6
841:10348000240A001224080040240C00018F8301202C
842:10349000276238002466002000C2102B5040000133
843:1034A000276630008F82012810C20004000000004F
844:1034B0008F82012414C20007000000008EE201A4E4
845:1034C0000000382124420001AEE201A408001D746E
846:1034D0008EE201A48EE20608AC62001C8EE404A019
847:1034E0008EE504A42462001CAC620008A46E000EE9
848:1034F000AC6D0018AC640000AC6500048EE204C43E
849:10350000AC620010AF86012092E24E2014400033DE
850:10351000240700018EE24E30000210C024425038D1
851:1035200002E220218C820000144A001F00000000EB
852:103530008EE34E308EE24E341062001B000000001D
853:103540008C82000424420001AC8200048EE24E34DE
854:103550008EE34E30244200011048000700000000B6
855:103560008EE24E342442000110620005000000008B
856:1035700008001D610000000014600005000000004C
857:103580008F82012824420020AF8201288F820128E7
858:103590008C8200042C42001150400010AC800000CE
859:1035A00008001D74000000008EE24E30244200012D
860:1035B00050480003000010218EE24E3024420001EA
861:1035C000AEE24E308EE24E30000210C0244250383F
862:1035D00002E22021AC8A0000AC8C000454E000061A
863:1035E000240B00018F820054012210232C4200334F
864:1035F0001440FFA600000000316300FF2402000118
865:1036000010620022000000003C040001248453905A
866:10361000AFA00010AFA000148F8601208F87012477
867:103620003C0500090C00240334A5F01108001DA07E
868:10363000000000003C0400012484539CAFA000144F
869:103640008F8601208F8701243C0500090C0024038C
870:1036500034A5F01008001DA0000000003C0400018B
871:10366000248453A8AFA000148EE606088F470228D2
872:103670003C0500090C00240334A5F00F8EE201ACD8
873:1036800024420001AEE201AC8EE201AC8EE20124E4
874:1036900024420001AEE2012408001F978EE20124BB
875:1036A000274402120C0022FE240500063049001FA8
876:1036B000000928C002E510219442727C304280004B
877:1036C0001040002F02E510219442727C30424000ED
878:1036D0001440001C00B710219443727E97420212DE
879:1036E0001462001800B710218C4372808F420214BC
880:1036F00054620016AFA2001092E204D810400007F6
881:10370000240200018EE304DC0122100400021027D1
882:103710000062182408001DC9AEE304DC8F83022870
883:10372000012210040002102700621824AF8302282F
884:10373000000910C002E218213402C00008001E4E29
885:10374000A462727C8F420214AFA20010000910C064
886:10375000005710218C42727C3C040001248453B435
887:103760003C050003AFA200148F47021034A5F01CE3
888:103770000C0024030120302108001E833C020800B5
889:1037800000B710219443727E97420212146200190E
890:10379000000918C000B710218C4372808F420214B8
891:1037A00014620014000918C002E510219447727CCD
892:1037B000000720C0009710219443737E00B71021AA
893:1037C000A443727E009710218C43738000B71021B0
894:1037D000AC43728002E410219443737C02E5102113
895:1037E000A443727C02E418213402C00008001E4E7B
896:1037F000A462737C02E310219447727C00003021A4
897:10380000000720C002E410219442737C0000402194
898:10381000304280001440002500E028210060502143
899:10382000340BC000009710219443737E974202121C
900:103830005462001500E02821009710218C4373800A
901:103840008F4202145462001000E02821110000068B
902:1038500002E410219443737C000510C002E21021A1
903:1038600008001E1AA443737C9443737C02EA10215F
904:10387000A443727C000710C002E21021A44B737CA9
905:1038800008001E2824060001000510C002E21021D5
906:103890009447737C000720C002E410219442737C9B
907:1038A000304280001040FFDF2508000130C200FFD9
908:1038B0001440002500002021000720C0009710219F
909:1038C0009443737E974202121462000F000910C0E5
910:1038D000009710218C4373808F4202141462000AF7
911:1038E000000910C002E418213402C00015000015C0
912:1038F000A462737C000910C002E218213402800027
913:1039000008001E4EA462727C005710218C42727C0B
914:103910003C040001248453C03C050003AFA2001006
915:10392000000710C0005710218C42737C34A5001E84
916:10393000012030210C002403AFA2001408001E83D4
917:103940003C02080000002021000428C000B710211C
918:103950009443777E974202125462002B2484000124
919:1039600000B710218C4377808F42021454620026E6
920:10397000248400013C020001005710218C4283B4D2
921:103980002442FFFF3C01000100370821AC2283B430
922:103990003C020001005710218C4283B4008090212A
923:1039A0000242102B1040000E24B1777C24B07784A3
924:1039B00002F0202102F128210C00249024060008A6
925:1039C000263100083C020001005710218C4283B4CC
926:1039D000265200010242102B1440FFF52610000869
927:1039E0003C040001009720218C8483B42405000846
928:1039F000000420C02484777C0C00248802E4202169
929:103A000008001E833C0208002C8200801440FFCF77
930:103A1000000428C03C02080034422000AFA2001875
931:103A20008EE206088F43022824420001304A00FF3C
932:103A3000514300FDAFA000108EE20608000210C046
933:103A4000005710218FA300188FA4001CAC43060C54
934:103A5000AC4406108F8300548F82005424690032D6
935:103A6000012210232C4200331040006A000058212C
936:103A700024100008240F000D240D0007240C004022
937:103A8000240E00018F8701202762380024E80020DF
938:103A90000102102B50400001276830008F8201285E
939:103AA00011020004000000008F82012415020007AB
940:103AB000000010218EE201A4000038212442000100
941:103AC000AEE201A408001EFB8EE201A48EE406080B
942:103AD000000420C0008018218EE404308EE50434F8
943:103AE00000A3282100A3302B008220210086202162
944:103AF000ACE40000ACE500048EE20608A4F0000E81
945:103B0000ACEF0018ACEA001C000210C02442060C06
946:103B100002E21021ACE200088EE204C4ACE2001024
947:103B2000AF88012092E24E201440003324070001A8
948:103B30008EE24E30000210C02442503802E22021B2
949:103B40008C820000144D001F000000008EE34E30F8
950:103B50008EE24E341062001B000000008C820004D4
951:103B600024420001AC8200048EE24E348EE34E30DB
952:103B700024420001104C0007000000008EE24E3489
953:103B800024420001106200050000000008001EE849
954:103B90000000000014600005000000008F82012872
955:103BA00024420020AF8201288F8201288C820004E9
956:103BB0002C42001150400010AC80000008001EFB99
957:103BC000000000008EE24E3024420001504C000301
958:103BD000000010218EE24E3024420001AEE24E3051
959:103BE0008EE24E30000210C02442503802E2202102
960:103BF000AC8D0000AC8E000454E00006240B0001E4
961:103C00008F820054012210232C4200331440FF9D68
962:103C100000000000316300FF2402000154620078BC
963:103C2000AFA00010AEEA06088F8300548F820054C4
964:103C300024690032012210232C420033104000611D
965:103C400000005821240E0008240D0011240A00123F
966:103C500024080040240C00018F83012027623800D3
967:103C60002466002000C2102B50400001276630005F
968:103C70008F82012810C20004000000008F820124FE
969:103C800014C20007000000008EE201A400003821E9
970:103C900024420001AEE201A408001F678EE201A4E5
971:103CA0008EE20608AC62001C8EE404A08EE504A43B
972:103CB0002462001CAC620008A46E000EAC6D0018FB
973:103CC000AC640000AC6500048EE204C4AC62001079
974:103CD000AF86012092E24E201440003324070001F9
975:103CE0008EE24E30000210C02442503802E2202101
976:103CF0008C820000144A001F000000008EE34E304A
977:103D00008EE24E341062001B000000008C82000422
978:103D100024420001AC8200048EE24E348EE34E3029
979:103D20002442000110480007000000008EE24E34DB
980:103D300024420001106200050000000008001F542A
981:103D40000000000014600005000000008F820128C0
982:103D500024420020AF8201288F8201288C82000437
983:103D60002C42001150400010AC80000008001F677A
984:103D7000000000008EE24E30244200015048000353
985:103D8000000010218EE24E3024420001AEE24E309F
986:103D90008EE24E30000210C02442503802E2202150
987:103DA000AC8A0000AC8C000454E00006240B000137
988:103DB0008F820054012210232C4200331440FFA6AE
989:103DC00000000000316300FF2402000110620022A5
990:103DD000000000003C04000124845390AFA00010B8
991:103DE000AFA000148F8601208F8701243C050009B5
992:103DF0000C00240334A5F01108001F9300000000FC
993:103E00003C0400012484539CAFA000148F86012041
994:103E10008F8701243C0500090C00240334A5F01011
995:103E200008001F93000000003C040001248453A8F4
996:103E3000AFA000148EE606088F4702283C05000953
997:103E40000C00240334A5F00F8EE201AC24420001E3
998:103E5000AEE201AC8EE201AC8EE201282442000108
999:103E6000AEE201288EE201288EE2016424420001C4
1000:103E7000AEE20164080022E88EE201648FA2002015
1001:103E80000002120000021D0224020001106200055F
1002:103E9000240200021062000D0000000008001FB79D
1003:103EA000AFA0001092E204D81440000624020001E2
1004:103EB0008F820228AEE204DC2402FFFFAF820228D8
1005:103EC0002402000108001FBEA2E204D892E204D836
1006:103ED0005040000CA2E004D88EE204DCAF8202283D
1007:103EE00008001FBEA2E004D83C040001248453C88B
1008:103EF000AFA000148FA600203C0500030C00240393
1009:103F000034A5F0098EE2013C24420001AEE2013CFE
1010:103F1000080022E88EE2013C8FA20020000212007D
1011:103F20000002250224020001108200052402000282
1012:103F30001082000F0000000008001FE3AFA0001077
1013:103F40008F8202203C0308FF3463FFFF00431024EC
1014:103F500034420008AF820220240200013C0100012B
1015:103F600000370821A02283B208001FEAAEE401084E
1016:103F70008F8202203C0308FF3463FFF700431024C4
1017:103F8000AF8202203C01000100370821A02083B24B
1018:103F900008001FEAAEE401083C040001248453D465
1019:103FA000AFA000148FA600203C0500030C002403E2
1020:103FB00034A5F00A8EE2012C24420001AEE2012C6D
1021:103FC000080022E88EE2012C8FA2002000021200DD
1022:103FD00000021D02240200011062000524020002FA
1023:103FE0001062000E0000000008002011AFA00010B9
1024:103FF0008F8202203C0308FF3463FFFF004310243C
1025:1040000034420008AF820220240200013C0100017A
1026:104010000037082108002018A02283B33C020001C9
1027:1040200000571021904283B23C0100010037082163
1028:104030001440000EA02083B38F8202203C0308FFAF
1029:104040003463FFF70043102408002018AF820220D9
1030:104050003C040001248453E0AFA000148FA600208C
1031:104060003C0500030C00240334A5F00B8EE2011480
1032:1040700024420001AEE20114080022E88EE201149D
1033:1040800027840208274502000C00249A2406000811
1034:1040900026E40094274502000C00249A2406000818
1035:1040A0008EE2013424420001AEE20134080022E82D
1036:1040B0008EE201348F460248000020210C00510896
1037:1040C000240500048EE2013024420001AEE20130FA
1038:1040D000080022E88EE201308EF301CC8EF401D08C
1039:1040E0008EF501D88EE2014026E400302442000122
1040:1040F000AEE201408EF001408EF100748EF200704D
1041:104100000C00248824050400AEF301CCAEF401D0E9
1042:10411000AEF501D8AEF00140AEF10074AEF2007021
1043:104120008F42025C26E40094AEE200608F4202609F
1044:104130002745020024060008AEE2006824020006BB
1045:104140000C00249AAEE200643C023B9A3442CA005E
1046:10415000AEE2006C240203E8240400022403000100
1047:10416000AEE20104AEE40100AEE3010C8F82022056
1048:10417000304200081040000400000000AEE30108D7
1049:104180000800206100002021AEE401080000202189
1050:104190003C0300010064182190635C3002E41021AC
1051:1041A00024840001A043009C2C82000F1440FFF8DF
1052:1041B000000000008F82004002E4182124840001E6
1053:1041C0000002170224420030A062009C02E4102189
1054:1041D000080022E8A040009C240200013C010001EC
1055:1041E00000370821A02283E0240B040024080014D7
1056:1041F000240A0040240900018F8301002762300057
1057:104200002466002000C2102B5040000127662800C1
1058:104210008F82010810C20004000000008F82010498
1059:1042200014C2000726E200308EE201A80000382107
1060:1042300024420001AEE201A8080020A88EE201A8F5
1061:104240008EE404B88EE504BCAC620008A46B000EDA
1062:10425000AC680018AC60001CAC640000AC650004E5
1063:104260008EE204CCAC620010AF86010092E204EC56
1064:104270001440000E240700018EE24E282442000163
1065:10428000504A0003000010218EE24E282442000113
1066:10429000AEE24E288EE24E28000210C024424E3874
1067:1042A00002E21021AC480000AC49000410E0FFD24B
1068:1042B00000000000080022E8000000003C020900A5
1069:1042C000AEE05238AEE0523CAEE05240AEE0524476
1070:1042D000AEE001D03C01000100370821A02083B1ED
1071:1042E000AFA200188EE206088F4302282442000184
1072:1042F000304A00FF514300FDAFA000108EE20608D7
1073:10430000000210C0005710218FA300188FA4001CBA
1074:10431000AC43060CAC4406108F8300548F820054CB
1075:1043200024690032012210232C4200331040006A1D
1076:104330000000582124100008240F000D240D000750
1077:10434000240C0040240E00018F87012027623800D2
1078:1043500024E800200102102B5040000127683000A3
1079:104360008F82012811020004000000008F820124C6
1080:1043700015020007000010218EE201A40000382180
1081:1043800024420001AEE201A40800212C8EE201A427
1082:104390008EE40608000420C0008018218EE404305A
1083:1043A0008EE5043400A3282100A3302B00822021B5
1084:1043B00000862021ACE40000ACE500048EE2060893
1085:1043C000A4F0000EACEF0018ACEA001C000210C014
1086:1043D0002442060C02E21021ACE200088EE204C482
1087:1043E000ACE20010AF88012092E24E20144000336E
1088:1043F000240700018EE24E30000210C024425038E3
1089:1044000002E220218C820000144D001F00000000F9
1090:104410008EE34E308EE24E341062001B000000002E
1091:104420008C82000424420001AC8200048EE24E34EF
1092:104430008EE34E3024420001104C000700000000C3
1093:104440008EE24E342442000110620005000000009C
1094:1044500008002119000000001460000500000000A1
1095:104460008F82012824420020AF8201288F820128F8
1096:104470008C8200042C42001150400010AC800000DF
1097:104480000800212C000000008EE24E302442000182
1098:10449000504C0003000010218EE24E3024420001F7
1099:1044A000AEE24E308EE24E30000210C02442503850
1100:1044B00002E22021AC8D0000AC8E000454E0000626
1101:1044C000240B00018F820054012210232C42003360
1102:1044D0001440FF9D00000000316300FF2402000132
1103:1044E00054620078AFA00010AEEA06088F83005433
1104:1044F0008F82005424690032012210232C420033A1
1105:104500001040006100005821240E0008240D001105
1106:10451000240A001224080040240C00018F8301208B
1107:10452000276238002466002000C2102B5040000192
1108:10453000276630008F82012810C2000400000000AE
1109:104540008F82012414C20007000000008EE201A443
1110:104550000000382124420001AEE201A408002198A5
1111:104560008EE201A48EE20608AC62001C8EE404A078
1112:104570008EE504A42462001CAC620008A46E000E48
1113:10458000AC6D0018AC640000AC6500048EE204C49D
1114:10459000AC620010AF86012092E24E20144000333E
1115:1045A000240700018EE24E30000210C02442503831
1116:1045B00002E220218C820000144A001F000000004B
1117:1045C0008EE34E308EE24E341062001B000000007D
1118:1045D0008C82000424420001AC8200048EE24E343E
1119:1045E0008EE34E3024420001104800070000000016
1120:1045F0008EE24E34244200011062000500000000EB
1121:104600000800218500000000146000050000000083
1122:104610008F82012824420020AF8201288F82012846
1123:104620008C8200042C42001150400010AC8000002D
1124:1046300008002198000000008EE24E302442000164
1125:1046400050480003000010218EE24E302442000149
1126:10465000AEE24E308EE24E30000210C0244250389E
1127:1046600002E22021AC8A0000AC8C000454E0000679
1128:10467000240B00018F820054012210232C420033AE
1129:104680001440FFA600000000316300FF2402000177
1130:1046900010620022000000003C04000124845390BA
1131:1046A000AFA00010AFA000148F8601208F870124D7
1132:1046B0003C0500090C00240334A5F011080021C4B6
1133:1046C000000000003C0400012484539CAFA00014AF
1134:1046D0008F8601208F8701243C0500090C002403EC
1135:1046E00034A5F010080021C4000000003C040001C3
1136:1046F000248453A8AFA000148EE606088F47022832
1137:104700003C0500090C00240334A5F00F8EE201AC37
1138:1047100024420001AEE201AC8EE201AC8EE2012047
1139:1047200024420001AEE201208EE201208EE2016807
1140:1047300024420001AEE20168080022E88EE201682E
1141:104740008F42025C26E40094AEE200608F42026079
1142:1047500027450200240600080C00249AAEE20068F7
1143:104760008F8202203042000814400002240200011F
1144:1047700024020002AEE201088EE2011C2442000184
1145:10478000AEE2011C080022E88EE2011C3C0400019C
1146:10479000248453ECAFA00010AFA000148FA600201B
1147:1047A0003C0500030C00240334A5F00F93A2002065
1148:1047B0003C0307003463100000431025AFA200182B
1149:1047C0008EE206088F43022824420001304900FF90
1150:1047D000512300E2AFA000108EE20608000210C0D4
1151:1047E000005710218FA300188FA4001CAC43060CA7
1152:1047F000AC4406108F8701202762380024E800208F
1153:104800000102102B50400001276830008F820128E0
1154:1048100011020004000000008F820124150200072D
1155:10482000000010218EE201A4000038212442000182
1156:10483000AEE201A40800225D8EE201A48EE4060827
1157:10484000000420C0008018218EE404308EE504347A
1158:1048500000A3282100A3302B0082202100862021E4
1159:10486000ACE40000ACE500048EE306082402000876
1160:10487000A4E2000E2402000DACE20018ACE9001C1A
1161:10488000000318C02463060C02E31021ACE2000808
1162:104890008EE204C4ACE20010AF88012092E24E2008
1163:1048A00014400037240700018EE24E30000210C091
1164:1048B0002442503802E220218C83000024020007A9
1165:1048C0001462001F000000008EE34E308EE24E3472
1166:1048D0001062001B240300408C820004244200016B
1167:1048E000AC8200048EE24E348EE54E30244200014C
1168:1048F00010430007000000008EE24E342442000105
1169:1049000010A200050000000008002247000000007F
1170:1049100014A00005000000008F820128244200201E
1171:10492000AF8201288F8201288C8200042C42001162
1172:1049300050400013AC8000000800225D0000000021
1173:104940008EE24E3024030040244200015043000315
1174:10495000000010218EE24E3024420001AEE24E30C3
1175:104960008EE24E30000210C02442503802E2202174
1176:1049700024020007AC82000024020001AC82000483
1177:1049800054E0000CAEE906083C040001248453F412
1178:10499000AFA00010AFA000148EE606088F470228D3
1179:1049A0003C0500090C00240334A5F000080022E0B7
1180:1049B000000000008F830120276238002466002059
1181:1049C00000C2102B50400001276630008F82012862
1182:1049D00010C20004000000008F82012414C20007EE
1183:1049E000000000008EE201A40000382124420001F2
1184:1049F000AEE201A4080022C48EE201A48EE2060801
1185:104A0000AC62001C8EE404A08EE504A42462001CA9
1186:104A1000AC62000824020008A462000E2402001107
1187:104A2000AC620018AC640000AC6500048EE204C403
1188:104A3000AC620010AF86012092E24E201440003795
1189:104A4000240700018EE24E30000210C0244250388C
1190:104A500002E220218C830000240200121462001F55
1191:104A6000000000008EE34E308EE24E341062001BD8
1192:104A7000240300408C82000424420001AC82000424
1193:104A80008EE24E348EE54E30244200011043000782
1194:104A9000000000008EE24E342442000110A2000506
1195:104AA00000000000080022AE0000000014A0000575
1196:104AB000000000008F82012824420020AF820128DC
1197:104AC0008F8201288C8200042C4200115040001378
1198:104AD000AC800000080022C4000000008EE24E30CE
1199:104AE0002403004024420001504300030000102131
1200:104AF0008EE24E3024420001AEE24E308EE24E3065
1201:104B0000000210C02442503802E220212402001288
1202:104B1000AC82000024020001AC82000414E0001BFF
1203:104B2000000000003C040001248453FCAFA00010EE
1204:104B3000AFA000148EE606088F4702283C05000946
1205:104B40000C00240334A5F0018EE201B024420001E0
1206:104B5000AEE201B0080022E08EE201B03C040001A8
1207:104B600024845408AFA000148EE606088F4702285C
1208:104B70003C0500090C00240334A5F0058EE201ACCD
1209:104B800024420001AEE201AC8EE201AC8EE20150A3
1210:104B900024420001AEE201508EE201508EE201603B
1211:104BA00024420001AEE201608EE201608F43022CDC
1212:104BB0008F42010C1462000924020002AF820064DB
1213:104BC0008F82006414400005000000008F43022C17
1214:104BD0008F42010C1462F875000000008FBF004482
1215:104BE0008FB600408FB5003C8FB400388FB30034CF
1216:104BF0008FB200308FB1002C8FB0002803E0000886
1217:104C000027BD004827BDFFF82408FFFF10A00014AF
1218:104C1000000048213C0AEDB8354A83209087000007
1219:104C200024840001000030210107102630420001D9
1220:104C30001040000200081842006A18260060402157
1221:104C400024C600012CC200081440FFF700073842B8
1222:104C5000252900010125102B1440FFF00000000061
1223:104C60000100102103E0000827BD000827BDFFE870
1224:104C700027642800AFBF00100C0024882405100012
1225:104C800024020021AF800100AF800104AF80010841
1226:104C9000AF800110AF800114AF800118AF800120F8
1227:104CA000AF800124AF800128AF800130AF80013494
1228:104CB000AF800138AEE04E28AEE04E2CAEE04E3074
1229:104CC000AEE04E34AF82011C8F42021830420040E9
1230:104CD00010400004000000008F82011C34420004D8
1231:104CE000AF82011C8FBF001003E0000827BD001831
1232:104CF00027BDFFE0AFBF00188F820104AFA20010F4
1233:104D00008F8201003C050002AFA200148F8600B024
1234:104D10008F87011C3C040001248454C00C00240330
1235:104D200034A5F0008F8300B03C027F00006218249D
1236:104D30003C020400106200290043102B14400008BC
1237:104D40003C0220003C020100106200243C020200F0
1238:104D50001062001100000000080023740000000031
1239:104D6000106200083C0240001462001C00000000B9
1240:104D70008EE2019024420001AEE20190080023740B
1241:104D80008EE201908EE2018C24420001AEE2018CA1
1242:104D9000080023748EE2018C8F82011C34420002D1
1243:104DA000AF82011C8F8301048F8200B03442000166
1244:104DB000AF8200B0AF8301048F82011C2403FFFD8A
1245:104DC00000431024AF82011C8EE201A024420001A6
1246:104DD000AEE201A0080023778EE201A08F8200B02E
1247:104DE00034420001AF8200B08FBF001803E000081A
1248:104DF00027BD002027BDFFE0AFBF001CAFB00018EB
1249:104E00008F820120AFA200108F8201243C05000197
1250:104E1000AFA200148F8600A08F87011C3C04000104
1251:104E2000248454CC0C00240334A5F0008F8300A00C
1252:104E30003C027F00006218243C0204001062005310
1253:104E4000000080210043102B144000083C04200087
1254:104E50003C0201001062004D3C0202001062003A68
1255:104E600000000000080023E00000000010640003C0
1256:104E70003C02400014620045000000008F8200A048
1257:104E80000044102410400006000000008EE201944F
1258:104E900024420001AEE20194080023A98EE20194AD
1259:104EA0008EE2019824420001AEE201988EE2019860
1260:104EB0008F82011C34420002AF82011C8F82011CD0
1261:104EC000304202001040001B000000008F8300A051
1262:104ED0008F8401248F8200AC14400007240200015B
1263:104EE0003C0200013442F0000062102450400001F6
1264:104EF00024100001240200011200000DAF8200A066
1265:104F00008F8201242442FFE0AF8201248F8201249A
1266:104F10008F820124276330000043102B10400005CE
1267:104F2000276237E0AF820124080023CA0000000096
1268:104F3000AF8401248F82011C2403FFFD0043102451
1269:104F4000080023E3AF82011C8F82011C344200025F
1270:104F5000AF82011C8F8301248F8200A034420001A4
1271:104F6000AF8200A0AF8301248F82011C2403FFFDC8
1272:104F700000431024AF82011C8EE2019C24420001F8
1273:104F8000AEE2019C080023E38EE2019C8F8200A028
1274:104F900034420001AF8200A08FBF001C8FB0001808
1275:104FA00003E0000827BD0020000000003C020001D3
1276:104FB0008C425C5827BDFFE8AFBF001414400012BC
1277:104FC000AFB000103C10000126105DD0020020217F
1278:104FD0000C0024882405200026021FE03C0100016B
1279:104FE000AC225D943C010001AC225D90AF420250C6
1280:104FF00024022000AF500254AF42025824020001A4
1281:105000003C010001AC225C588FBF00148FB000102F
1282:1050100003E0000827BD00183C0300018C635D9489
1283:105020008C8200008FA800108FA90014AC620000D1
1284:105030003C0200018C425D948C830004AC4300046C
1285:10504000AC4500088F8400542443FFE0AC460010B8
1286:10505000AC470014AC480018AC49001C3C010001EE
1287:10506000AC235D94AC44000C3C02000124425DD0B2
1288:105070000062182B10600005000000003C020001D7
1289:105080008C425D903C010001AC225D943C03000128
1290:105090008C635D943C0200018C425C40AC62000079
1291:1050A0003C0300018C635D943C0200018C425C4037
1292:1050B000AC62000403E00008AF4302503C0300016F
1293:1050C0008C635D943C0200018C425C4027BDFFD0A4
1294:1050D000AFB400208FB40040AFB00010008080213A
1295:1050E000AFB500248FB500448FA40048AFB10014C1
1296:1050F00000A08821AFBF0028AFB3001CAFB20018DA
1297:10510000AC6200003C0500018CA55D943C020001EE
1298:105110008C425C4000C0902100E098211080000685
1299:10512000ACA2000424A500080C002490240600185A
1300:105130000800244E0000000024A400080C0024886D
1301:10514000240500183C0200018C425D943C050001DE
1302:1051500024A55DD02442FFE03C010001AC225D9417
1303:105160000045102B10400005000000003C0200012B
1304:105170008C425D903C010001AC225D943C03000137
1305:105180008C635D948E020000AC6200003C03000161
1306:105190008C635D948E020004AC620004AC71000864
1307:1051A0008F8400542462FFE03C010001AC225D9436
1308:1051B0000045102BAC720010AC730014AC740018D6
1309:1051C000AC75001C10400005AC64000C3C020001F2
1310:1051D0008C425D903C010001AC225D943C030001D7
1311:1051E0008C635D943C0200018C425C40AC62000028
1312:1051F0003C0300018C635D943C0200018C425C40E6
1313:10520000AC620004AF4302508FBF00288FB500246A
1314:105210008FB400208FB3001C8FB200188FB1001420
1315:105220008FB0001003E0000827BD003010A000057B
1316:1052300000000000AC80000024A5FFFC14A0FFFDCE
1317:105240002484000403E000080000000010C00007F0
1318:10525000000000008C8200002484000424C6FFFCAF
1319:10526000ACA2000014C0FFFB24A5000403E000086A
1320:105270000000000010C00007000000008CA2000029
1321:1052800024A5000424C6FFFCAC82000014C0FFFB70
1322:105290002484000403E000080000000003E000088C
1323:1052A0000000000027BDFFD8AFBF00208EE304E45C
1324:1052B0008EE204E010620436000000008EE204E496
1325:1052C0008EE304FC00021100006260219587000853
1326:1052D0008D8A00008D8B0004958D000A8EE2725C31
1327:1052E0008EE3726C30E4FFFF004410210062182B43
1328:1052F0001060001531A200048F8200D88EE372582E
1329:1053000000431023AEE2726C8EE2726C1C4000030C
1330:105310003C03000100431021AEE2726C8EE2725C2D
1331:105320008EE3726C004410210062182B106000069E
1332:1053300031A200048EE201B824420001AEE201B8BD
1333:10534000080028E18EE201B81040024031A20200BC
1334:105350001040014D0000482196E2045A30420010EE
1335:1053600010400149000000008F84010027623000D6
1336:105370002485002000A2102B504000012765280042
1337:105380008F82010810A20004000000008F82010437
1338:1053900014A200062402000C8EE201A8244200019F
1339:1053A000AEE201A80800252C8EE201A8AC8A00001C
1340:1053B000AC8B00048EE3726424060005A482000E08
1341:1053C000AC860018AC8300088EE204E4AC82001CBA
1342:1053D0008EE204C8AC820010AF85010092E204ECBA
1343:1053E00014400036240900018EE24E28000210C04D
1344:1053F00024424E3802E220218C8200001446001F15
1345:10540000000000008EE34E288EE24E2C1062001B3E
1346:10541000240300408C82000424420001AC8200047A
1347:105420008EE24E2C8EE54E282442000110430007E8
1348:10543000000000008EE24E2C2442000110A2000564
1349:1054400000000000080025160000000014A0000560
1350:10545000000000008F82010824420020AF82010872
1351:105460008F8201088C8200042C42001150400013EE
1352:10547000AC8000000800252C000000008EE24E28C1
1353:105480002403004024420001504300030000102187
1354:105490008EE24E2824420001AEE24E288EE24E28D3
1355:1054A000000210C024424E3802E2202124020005EE
1356:1054B000AC82000024020001AC8200041520000A26
1357:1054C0003C040001AFAB00108EE272643C040001AA
1358:1054D000248457303C050004AFA200148EE604E497
1359:1054E000080028BE34A5F1148EE2726434843800BA
1360:1054F00003641821244200100043102B1440007351
1361:10550000000000008EE27264244800100364102141
1362:105510000102102B144000023C02FFFF0102402157
1363:105520008F8501002762300024A6002000C2102BC6
1364:1055300050400001276628008F82010810C2000435
1365:10554000000000008F82010414C200072563000CD4
1366:105550008EE201A80000482124420001AEE201A829
1367:10556000080025A08EE201A82C64000C0144102143
1368:10557000ACA20000ACA3000424E2FFF4A4A2000E3D
1369:1055800024020006ACA80008ACA200188EE204E4D5
1370:10559000ACA2001C8EE204C83C03000200431025AC
1371:1055A000ACA20010AF86010092E204EC1440003778
1372:1055B000240900018EE24E28000210C024424E3819
1373:1055C00002E220218C830000240200051462001FE7
1374:1055D000000000008EE34E288EE24E2C1062001B6D
1375:1055E000240300408C82000424420001AC820004A9
1376:1055F0008EE24E2C8EE54E28244200011043000717
1377:10560000000000008EE24E2C2442000110A2000592
1378:10561000000000000800258A0000000014A000051A
1379:10562000000000008F82010824420020AF820108A0
1380:105630008F8201088C8200042C420011504000131C
1381:10564000AC800000080025A0000000008EE24E287B
1382:1056500024030040244200015043000300001021B5
1383:105660008EE24E2824420001AEE24E288EE24E2801
1384:10567000000210C024424E3802E22021240200051C
1385:10568000AC82000024020001AC8200041520000A54
1386:105690002508FFFCAFAB00108EE272643C040001F1
1387:1056A000248457303C050004AFA200148EE604E4C5
1388:1056B000080028BE34A5F12534028100A5020000AF
1389:1056C0009582000E0800261DA50200028F850100AC
1390:1056D0002762300024A6002000C2102B5040000199
1391:1056E000276628008F82010810C200040000000015
1392:1056F0008F82010414C200072563000C8EE201A80A
1393:105700000000482124420001AEE201A80800260D55
1394:105710008EE201A82C64000C01441021ACA2000010
1395:10572000ACA300048EE3726424E2FFF4A4A2000E92
1396:1057300024020006ACA2001824630010ACA30008E9
1397:105740008EE204E4ACA2001C8EE204C83C0300021A
1398:1057500000431025ACA20010AF86010092E204ECD9
1399:1057600014400037240900018EE24E28000210C0C8
1400:1057700024424E3802E220218C83000024020005DE
1401:105780001462001F000000008EE34E288EE24E2CB3
1402:105790001062001B240300408C820004244200019C
1403:1057A000AC8200048EE24E2C8EE54E28244200018D
1404:1057B00010430007000000008EE24E2C244200013E
1405:1057C00010A2000500000000080025F700000000FE
1406:1057D00014A00005000000008F8201082442002070
1407:1057E000AF8201088F8201088C8200042C420011D4
1408:1057F00050400013AC8000000800260D000000009F
1409:105800008EE24E282403004024420001504300034E
1410:10581000000010218EE24E2824420001AEE24E2804
1411:105820008EE24E28000210C024424E3802E22021AF
1412:1058300024020005AC82000024020001AC820004B6
1413:105840001520000A34028100AFAB00108EE27264B2
1414:105850003C040001248457303C050004AFA200142E
1415:105860008EE604E4080028BE34A5F0158EE37264C9
1416:10587000A462000C8EE372649582000EA462000E96
1417:105880000800268124E700048F840100276230008D
1418:105890002485002000A2102B50400001276528001D
1419:1058A0008F82010810A20004000000008F82010412
1420:1058B00014A20007240200068EE201A8000048217D
1421:1058C00024420001AEE201A8080026778EE201A87A
1422:1058D000AC8A0000AC8B00048EE37264A487000ED7
1423:1058E000AC820018AC8300088EE204E4AC82001C99
1424:1058F0008EE204C83C03000200431025AC82001075
1425:10590000AF85010092E204EC144000372409000145
1426:105910008EE24E28000210C024424E3802E22021BE
1427:105920008C830000240200051462001F00000000A8
1428:105930008EE34E288EE24E2C1062001B24030040A2
1429:105940008C82000424420001AC8200048EE24E2CC2
1430:105950008EE54E282442000110430007000000009D
1431:105960008EE24E2C2442000110A20005000000002F
1432:10597000080026610000000014A0000500000000DF
1433:105980008F82010824420020AF8201088F82010823
1434:105990008C8200042C42001150400013AC800000A7
1435:1059A00008002677000000008EE24E282403004005
1436:1059B0002442000150430003000010218EE24E28D3
1437:1059C00024420001AEE24E288EE24E28000210C0B2
1438:1059D00024424E3802E2202124020005AC8200005D
1439:1059E00024020001AC820004152000093C050004DB
1440:1059F000AFAB00108EE272643C0400012484573087
1441:105A0000AFA200148EE604E4080028BE34A5F0041A
1442:105A10008EE2725C30E7FFFF00471021AEE2725C5D
1443:105A20008EE204E48EE304FC8EE47258000211005E
1444:105A300000431021AC44000C8EE27258AFA2001853
1445:105A40008EE3725CAFA3001C8EE2725C2C42003CC1
1446:105A500010400004246200012403FFFE00431024D0
1447:105A6000AFA2001C8EE272643C06000134C638000E
1448:105A70008EE3725C2405FFF80047102124420007E2
1449:105A80000045102424630007AEE272588EE2726C67
1450:105A90008EE472580065182400431023AEE2726C45
1451:105AA000036610210082202B148000043C03FFFFBA
1452:105AB0008EE2725800431021AEE272588EE27258A4
1453:105AC000AEE272648F8200F024470008276218005B
1454:105AD00000E2102B50400001276710008F8200F475
1455:105AE00014E20007000000008EE201B4000048212B
1456:105AF00024420001AEE201B4080026C48EE201B4E3
1457:105B00008F8200F0240900018FA300188FA4001CCD
1458:105B1000AC430000AC440004AF8700F01520001235
1459:105B2000000D11428F8200F0AFA200108F8200F4AE
1460:105B30003C0400012484573CAFA200148FA6001837
1461:105B40008FA7001C3C0500040C00240334A5F005BD
1462:105B50008EE2008824420001AEE200888EE20088D6
1463:105B6000080028D3AEE0725C304300032402000238
1464:105B70001062001628620003104000052402000194
1465:105B80001062000800000000080027030000000069
1466:105B90002402000310620017000000000800270321
1467:105BA000000000008EE200E88EE300EC24630001B8
1468:105BB0002C64000100441021AEE200E8AEE300ECEA
1469:105BC0008EE200E8080027038EE300EC8EE200F08E
1470:105BD0008EE300F4246300012C64000100441021D2
1471:105BE000AEE200F0AEE300F48EE200F0080027031E
1472:105BF0008EE300F48EE200F88EE300FC24630001E3
1473:105C00002C64000100441021AEE200F8AEE300FC79
1474:105C10008EE200F88EE300FC8EE2725C8EE400E01F
1475:105C20008EE500E4004018210000102100A3282187
1476:105C300000A3302B0082202100862021AEE400E06A
1477:105C4000AEE500E4080028D3AEE0725C30E2FFFF6E
1478:105C5000104001C131A202001040014D0000482156
1479:105C600096E2045A30420010104001490000000042
1480:105C70008F840100276230002485002000A2102BB1
1481:105C800050400001276528008F82010810A20004FF
1482:105C9000000000008F82010414A200062402000C00
1483:105CA0008EE201A824420001AEE201A80800276E9E
1484:105CB0008EE201A8AC8A0000AC8B00048EE3726413
1485:105CC00024060005A482000EAC860018AC830008F0
1486:105CD0008EE204E4AC82001C8EE204C8AC820010A8
1487:105CE000AF85010092E204EC144000362409000163
1488:105CF0008EE24E28000210C024424E3802E22021DB
1489:105D00008C8200001446001F000000008EE34E2825
1490:105D10008EE24E2C1062001B240300408C82000493
1491:105D200024420001AC8200048EE24E2C8EE54E2807
1492:105D30002442000110430007000000008EE24E2CB8
1493:105D40002442000110A200050000000008002758AE
1494:105D50000000000014A00005000000008F82010870
1495:105D600024420020AF8201088F8201088C82000447
1496:105D70002C42001150400013AC8000000800276E38
1497:105D8000000000008EE24E2824030040244200015F
1498:105D900050430003000010218EE24E2824420001EF
1499:105DA000AEE24E288EE24E28000210C024424E3849
1500:105DB00002E2202124020005AC820000240200013E
1501:105DC000AC8200041520000A3C040001AFAB0010B7
1502:105DD0008EE272643C040001248457303C050004C8
1503:105DE000AFA200148EE604E4080028BE34A5F01427
1504:105DF0008EE2726434843800036418212442001057
1505:105E00000043102B14400073000000008EE2726407
1506:105E100024480010036410210102102B14400002DA
1507:105E20003C02FFFF010240218F8501002762300004
1508:105E300024A6002000C2102B504000012766280035
1509:105E40008F82010810C20004000000008F8201044C
1510:105E500014C200072563000C8EE201A8000048214F
1511:105E600024420001AEE201A8080027E28EE201A868
1512:105E70002C64000C01441021ACA20000ACA300046F
1513:105E800024E2FFF4A4A2000E24020006ACA800083D
1514:105E9000ACA200188EE204E4ACA2001C8EE204C89E
1515:105EA0003C03000200431025ACA20010AF860100A5
1516:105EB00092E204EC14400037240900018EE24E28DF
1517:105EC000000210C024424E3802E220218C830000E0
1518:105ED000240200051462001F000000008EE34E281B
1519:105EE0008EE24E2C1062001B240300408C820004C2
1520:105EF00024420001AC8200048EE24E2C8EE54E2836
1521:105F00002442000110430007000000008EE24E2CE6
1522:105F10002442000110A2000500000000080027CC68
1523:105F20000000000014A00005000000008F8201089E
1524:105F300024420020AF8201088F8201088C82000475
1525:105F40002C42001150400013AC800000080027E2F2
1526:105F5000000000008EE24E2824030040244200018D
1527:105F600050430003000010218EE24E28244200011D
1528:105F7000AEE24E288EE24E28000210C024424E3877
1529:105F800002E2202124020005AC820000240200016C
1530:105F9000AC8200041520000A2508FFFCAFAB0010FE
1531:105FA0008EE272643C040001248457303C050004F6
1532:105FB000AFA200148EE604E4080028BE34A5F01554
1533:105FC00034028100A50200009582000E0800285FBF
1534:105FD000A50200028F8501002762300024A6002060
1535:105FE00000C2102B50400001276628008F82010854
1536:105FF00010C20004000000008F82010414C20007D8
1537:106000002563000C8EE201A8000048212442000113
1538:10601000AEE201A80800284F8EE201A82C64000C13
1539:1060200001441021ACA20000ACA300048EE3726412
1540:1060300024E2FFF4A4A2000E24020006ACA2001881
1541:1060400024630010ACA300088EE204E4ACA2001CA0
1542:106050008EE204C83C03000200431025ACA20010ED
1543:10606000AF86010092E204EC1440003724090001DD
1544:106070008EE24E28000210C024424E3802E2202157
1545:106080008C830000240200051462001F0000000041
1546:106090008EE34E288EE24E2C1062001B240300403B
1547:1060A0008C82000424420001AC8200048EE24E2C5B
1548:1060B0008EE54E2824420001104300070000000036
1549:1060C0008EE24E2C2442000110A2000500000000C8
1550:1060D000080028390000000014A00005000000009E
1551:1060E0008F82010824420020AF8201088F820108BC
1552:1060F0008C8200042C42001150400013AC80000040
1553:106100000800284F000000008EE24E2824030040C3
1554:106110002442000150430003000010218EE24E286B
1555:1061200024420001AEE24E288EE24E28000210C04A
1556:1061300024424E3802E2202124020005AC820000F5
1557:1061400024020001AC8200041520000A3402810000
1558:10615000AFAB00108EE272643C040001248457301F
1559:106160003C050004AFA200148EE604E4080028BE3B
1560:1061700034A5F0168EE37264A462000C8EE37264A0
1561:106180009582000EA462000E080028C224E70004D5
1562:106190008F83010027623000246400200082102BCE
1563:1061A00050400001276428008F82010810820004FB
1564:1061B000000000008F8201041482000724050005FE
1565:1061C0008EE201A80000482124420001AEE201A8AD
1566:1061D000080028B68EE201A8AC6A0000AC6B00048F
1567:1061E0008EE27264A467000EAC650018AC62000811
1568:1061F0008EE204E4AC62001C8EE204C8AC620010C3
1569:10620000AF84010092E204EC14400036240900013E
1570:106210008EE24E28000210C024424E3802E22021B5
1571:106220008C8200001445001F000000008EE34E2801
1572:106230008EE24E2C1062001B240300408C8200046E
1573:1062400024420001AC8200048EE24E2C8EE54E28E2
1574:106250002442000110430007000000008EE24E2C93
1575:106260002442000110A2000500000000080028A040
1576:106270000000000014A00005000000008F8201084B
1577:1062800024420020AF8201088F8201088C82000422
1578:106290002C42001150400013AC800000080028B6CA
1579:1062A000000000008EE24E2824030040244200013A
1580:1062B00050430003000010218EE24E2824420001CA
1581:1062C000AEE24E288EE24E28000210C024424E3824
1582:1062D00002E2202124020005AC8200002402000119
1583:1062E000AC8200041520000B3C0500043C040001B6
1584:1062F00024845748AFAB0010AFA000148EE604E42E
1585:1063000034A5F0170C00240330E7FFFF080028E154
1586:10631000000000008EE272643C05000130E4FFFFE3
1587:1063200000441021AEE272648EE2725C8EE372640D
1588:1063300034A5380000441021AEE2725C03651021E0
1589:106340000062182B146000043C03FFFF8EE27264AD
1590:1063500000431021AEE272648EE304E496E2045836
1591:10636000246300012442FFFF00621824AEE304E42A
1592:106370008EE304E48EE204E01462000500000000F5
1593:106380008F8200602403FFF700431024AF82006077
1594:106390008FBF002003E0000827BD002827BDFFE0D5
1595:1063A000AFBF00188EE304E88EE204E010620189BA
1596:1063B000000000008EE204E88EE304FC00021100FD
1597:1063C000006218219467000892E204ED8C680000D6
1598:1063D0008C69000410400023946A000A8EE204C80D
1599:1063E00034460400314202001040001F000000004B
1600:1063F00096E2045A304200101040001B3C0280001C
1601:106400003C01000100370821AC2283D88EE272647F
1602:106410009464000E3C05000134A5380024420004B9
1603:10642000AEE272648EE372640004240003651021FE
1604:106430003C01000100370821AC2483DC0062182BEA
1605:106440001460000524E700048EE272643C03FFFF41
1606:1064500000431021AEE272648EE2726408002917D4
1607:10646000AEE272588EE604C88EE2726C30E4FFFF32
1608:106470000044102A10400015000000008F8200D850
1609:106480008EE3725800431023AEE2726C8EE2726C9F
1610:106490001C4000070044102A8EE2726C3C0300018D
1611:1064A00000431021AEE2726C8EE2726C0044102A3E
1612:1064B00010400006000000008EE201B824420001F6
1613:1064C000AEE201B808002A728EE201B83C02000177
1614:1064D000005710218C4283D85440000124E7FFFC70
1615:1064E00031420004104000B930E2FFFF3C020001DD
1616:1064F000005710218C4283D81040002F00005021FB
1617:106500008F840100276230002485002000A2102B18
1618:1065100050400001276528008F82010810A2003238
1619:10652000000000008F82010410A2002F2402001539
1620:10653000AC880000AC8900048EE37264A487000E6E
1621:10654000AC820018AC8300088EE204E83C03000132
1622:10655000007718218C6383DCAC8600100043102583
1623:10656000AC82001CAF85010092E204EC144000668E
1624:10657000240A00018EE24E28240300402442000138
1625:1065800050430003000010218EE24E2824420001F7
1626:10659000AEE24E288EE24E28000210C024424E3851
1627:1065A00002E2182124020015AC620000240200015E
1628:1065B000080029BFAC6200048F840100276230000C
1629:1065C0002485002000A2102B5040000127652800E0
1630:1065D0008F82010810A20004000000008F820104D5
1631:1065E00014A20006240200068EE201A82442000143
1632:1065F000AEE201A8080029BF8EE201A8AC88000025
1633:10660000AC8900048EE37264A487000EAC8200188B
1634:10661000AC8300088EE204E8AC860010AC82001C5B
1635:10662000AF85010092E204EC14400037240A000117
1636:106630008EE24E28000210C024424E3802E2202191
1637:106640008C830000240200051462001F000000007B
1638:106650008EE34E288EE24E2C1062001B2403004075
1639:106660008C82000424420001AC8200048EE24E2C95
1640:106670008EE54E2824420001104300070000000070
1641:106680008EE24E2C2442000110A200050000000002
1642:10669000080029A90000000014A000050000000067
1643:1066A0008F82010824420020AF8201088F820108F6
1644:1066B0008C8200042C42001150400013AC8000007A
1645:1066C000080029BF000000008EE24E28240300408D
1646:1066D0002442000150430003000010218EE24E28A6
1647:1066E00024420001AEE24E288EE24E28000210C085
1648:1066F00024424E3802E2202124020005AC82000030
1649:1067000024020001AC8200041540000A24020001AA
1650:10671000AFA900108EE272643C040001248457305B
1651:106720003C050004AFA200148EE604E408002A4FE2
1652:1067300034A5F204A2E204ED8EE204E88EE304FC48
1653:106740008EE472583C06000134C638003C0100015A
1654:1067500000370821AC2083D83C0100010037082114
1655:10676000AC2083DC0002110000431021AC44000C7B
1656:106770008EE272642405FFF830E3FFFF004310212E
1657:10678000244200070045102424630007AEE272583B
1658:106790008EE2726C8EE47258006518240043102358
1659:1067A000AEE2726C036610210082202B148000047C
1660:1067B0003C03FFFF8EE2725800431021AEE2725894
1661:1067C0008EE2725808002A64AEE2726410400073D0
1662:1067D000000000008F830100276230002464002045
1663:1067E0000082102B14400002000050212764280072
1664:1067F0008F82010810820004000000008F820104D3
1665:1068000014820006240500058EE201A8244200013E
1666:10681000AEE201A808002A468EE201A8AC6800009A
1667:10682000AC6900048EE27264A467000EAC650018C7
1668:10683000AC6200088EE204E8AC660010AC62001C9A
1669:10684000AF84010092E204EC14400036240A0001F7
1670:106850008EE24E28000210C024424E3802E220216F
1671:106860008C8200001445001F000000008EE34E28BB
1672:106870008EE24E2C1062001B240300408C82000428
1673:1068800024420001AC8200048EE24E2C8EE54E289C
1674:106890002442000110430007000000008EE24E2C4D
1675:1068A0002442000110A200050000000008002A3068
1676:1068B0000000000014A00005000000008F82010805
1677:1068C00024420020AF8201088F8201088C820004DC
1678:1068D0002C42001150400013AC80000008002A46F2
1679:1068E000000000008EE24E282403004024420001F4
1680:1068F00050430003000010218EE24E282442000184
1681:10690000AEE24E288EE24E28000210C024424E38DD
1682:1069100002E2202124020005AC82000024020001D2
1683:10692000AC8200041540000C30E5FFFF3C04000180
1684:10693000248457483C050004AFA90010AFA0001400
1685:106940008EE604E434A5F2370C00240330E7FFFFA1
1686:1069500008002A72000000008EE2726400451021D7
1687:10696000AEE272648EE2726C8EE372643C040001EB
1688:1069700034843800A2E004ED00451023AEE2726CCE
1689:10698000036410210062182B146000043C03FFFF15
1690:106990008EE2726400431021AEE272648EE304E87A
1691:1069A00096E20458246300012442FFFF0062182489
1692:1069B000AEE304E88EE304E88EE204E0146200052E
1693:1069C000000000008F8200602403FFF700431024C2
1694:1069D000AF8200608FBF001803E0000827BD0020D1
1695:1069E00027BDFFE0AFBF001CAFB000188F820100D1
1696:1069F0008EE34E2C8F8201048F8501082402004013
1697:106A00002463000150620003000010218EE24E2C2E
1698:106A100024420001AEE24E2C8EE24E2C8EE34E2C30
1699:106A2000000210C024424E3802E220218EE24E289D
1700:106A30008C8700041462000700A030218F820108B7
1701:106A400024420020AF8201088F82010808002AA298
1702:106A5000AC8000008EE24E2C240300402442000152
1703:106A600050430003000010218EE24E2C244200010E
1704:106A7000000210C024424E3802E220218C82000421
1705:106A80008F8301080002114000621821AF830108C2
1706:106A9000AC8000008CC200182443FFFE2C6200135F
1707:106AA000104000C1000310803C01000100220821B9
1708:106AB0008C22577000400008000000008EE204F0B5
1709:106AC00000471021AEE204F08EE204F08F43023C56
1710:106AD0000043102B144000BE000000008EE304E4CD
1711:106AE0008EE204F8506200BAA2E004F48F83012021
1712:106AF000276238002466002000C2102B504000019D
1713:106B0000276630008F82012810C2000400000000B8
1714:106B10008F82012414C20007000000008EE201A44D
1715:106B20000000802124420001AEE201A408002B12E3
1716:106B30008EE201A48EE204E4AC62001C8EE404B098
1717:106B40008EE504B42462001CAC6200082402000834
1718:106B5000A462000E24020011AC620018AC640000B4
1719:106B6000AC6500048EE204C4AC620010AF86012064
1720:106B700092E24E2014400037241000018EE24E3085
1721:106B8000000210C02442503802E220218C83000011
1722:106B9000240200121462001F000000008EE34E3039
1723:106BA0008EE24E341062001B240300408C820004ED
1724:106BB00024420001AC8200048EE24E348EE54E3059
1725:106BC0002442000110430007000000008EE24E3412
1726:106BD0002442000110A200050000000008002AFC69
1727:106BE0000000000014A00005000000008F820128B2
1728:106BF00024420020AF8201288F8201288C82000469
1729:106C00002C42001150400013AC80000008002B12F1
1730:106C1000000000008EE24E302403004024420001B8
1731:106C200050430003000010218EE24E302442000148
1732:106C3000AEE24E308EE24E30000210C02442503898
1733:106C400002E2202124020012AC8200002402000192
1734:106C5000AC8200045600000B241000018EE204E414
1735:106C60003C04000124845754AFA00014AFA20010CC
1736:106C70008EE606088F4702283C0500090C00240315
1737:106C800034A5F006160000032402000108002B7151
1738:106C9000A2E204F48EE2017024420001AEE201702F
1739:106CA0008EE201708EE204E4A2E004F4AEE004F0AF
1740:106CB000AEE204F88F42023C50400045AEE07274F0
1741:106CC0008EE2018424420001AEE201848EE201845E
1742:106CD00008002B71AEE072748EE2050424030040BC
1743:106CE0002442000150430003000010218EE20504FD
1744:106CF00024420001AEE205048EE205048CC30018B4
1745:106D000000021080005710218C4405082402000363
1746:106D10001462000F000000003C0200010057102127
1747:106D2000904283B110400014000000008EE201D0B8
1748:106D30008EE3524000441021AEE201D08EE201D831
1749:106D400000641821306300FF08002B59AEE3524065
1750:106D50008EE201CC8EE30E1000441021AEE201CC95
1751:106D60008EE201D800641821306301FFAEE30E10FB
1752:106D700000441021AEE201D88EE20000344200400F
1753:106D800008002B71AEE200008EE2014C3C010001D4
1754:106D900000370821A02083E024420001AEE2014C2C
1755:106DA00008002B718EE2014C94C7000E8CC2001CAF
1756:106DB0003C04000124845760AFA60014AFA2001069
1757:106DC0008CC600183C0500080C00240334A50910EB
1758:106DD0008FBF001C8FB0001803E0000827BD002003
1759:106DE00027BDFF98AFBF0060AFBE005CAFB60058D4
1760:106DF000AFB50054AFB40050AFB3004CAFB20048D1
1761:106E0000AFB10044AFB000408F8301088F8201040E
1762:106E1000AFA00024106203E7AFA0002C3C1E0001CD
1763:106E200037DE38003C0BFFFF8F9301088E6200189D
1764:106E30008F8301042443FFFE2C620014104003CF13
1765:106E4000000310803C010001002208218C2257C061
1766:106E500000400008000000009663000E8EE2725CA5
1767:106E60008EE404F000431021AEE2725C8E63001CDD
1768:106E700096E2045824840001AEE404F02463000187
1769:106E80002442FFFF00621824AEE304E48F42023C78
1770:106E90000082202B148003B9000000008F830120A2
1771:106EA000276238002466002000C2102B50400001E9
1772:106EB000276630008F82012810C200040000000005
1773:106EC0008F82012414C20007000000008EE201A49A
1774:106ED0000000802124420001AEE201A408002BFE44
1775:106EE0008EE201A48EE204E4AC62001C8EE404B0E5
1776:106EF0008EE504B42462001CAC6200082402000881
1777:106F0000A462000E24020011AC620018AC64000000
1778:106F1000AC6500048EE204C4AC620010AF860120B0
1779:106F200092E24E2014400037241000018EE24E30D1
1780:106F3000000210C02442503802E220218C8300005D
1781:106F4000240200121462001F000000008EE34E3085
1782:106F50008EE24E341062001B240C00408C82000430
1783:106F600024420001AC8200048EE24E348EE34E30A7
1784:106F700024420001104C0007000000008EE24E3455
1785:106F800024420001106200050000000008002BE808
1786:106F90000000000014600005000000008F8201283E
1787:106FA00024420020AF8201288F8201288C820004B5
1788:106FB0002C42001150400013AC80000008002BFE52
1789:106FC000000000008EE24E30240C004024420001FC
1790:106FD000504C0003000010218EE24E30244200018C
1791:106FE000AEE24E308EE24E30000210C024425038E5
1792:106FF00002E2202124020012240C0001AC820000D5
1793:10700000AC8C00045600000D241000018EE204E454
1794:107010003C04000124845754AFA00014AFA2001018
1795:107020008EE606088F4702283C05000934A5F006C5
1796:107030000C002403AFAB00388FAB00381200030AFA
1797:10704000240C000108002F1900000000966C001CA1
1798:10705000AFAC002C9662001E3C0C8000AFAC00244C
1799:10706000AE62001C8E75001C8EE204FC8EE404FCF3
1800:1070700000151900006210218C52000C92E27B98DE
1801:10708000006418219476000A1440000332C2000202
1802:10709000AEF27BA4AEF57B9C1040004B000080213B
1803:1070A00096E2045A304200021040004700000000FF
1804:1070B0008E63001C8EE204FC00032100008210217C
1805:1070C0008C42000C037E1821244200220043102B26
1806:1070D0001440000A240500148EE204FC00821021F2
1807:1070E0008C44000CAFAB00380C002F752484000ECC
1808:1070F0008FAB003808002C523050FFFF8EE204FCAA
1809:10710000008210218C42000C9450000E9443001019
1810:10711000944400129445001402038021020480214B
1811:107120000205802194430016944400189445001AE7
1812:107130000203802102048021020580219443001C67
1813:107140009444001E94420020020380210204802106
1814:107150000202802100101C023202FFFF0062802127
1815:107160008E63001C8EE204FC001024020003290040
1816:1071700000A210218C43000C3202FFFF008280210C
1817:10718000037E1021246300180062182B146000098C
1818:10719000000000008EE204FC00A210218C43000CD1
1819:1071A000001010273C01FFFF0023082108002C6F6E
1820:1071B000A42200188EE204FC00A210218C43000CD3
1821:1071C00000101027A462001896E2045A00008821DB
1822:1071D00030420008144000630000A0218E63001CB0
1823:1071E0008EE204FC0003310000C210218C42000C2E
1824:1071F000037E1821244200220043102B1440003546
1825:10720000000000008EE204FC00C210218C42000C41
1826:1072100024470010037E102100E2102B5040000193
1827:1072200000EB38218EE204FC94F1000000C2102132
1828:107230008C42000C24470016037E102100E2102B24
1829:10724000144000022634FFEC00EB38218EE204FCEF
1830:1072500090E3000100C210218C42000C2447001A68
1831:10726000037E102100E2102B1440000202838821CB
1832:1072700000EB382194E2000024E70002022288217A
1833:10728000037E102100E2102B5040000100EB38215A
1834:1072900094E2000024E7000202228821037E1021EC
1835:1072A00000E2102B5040000100EB382194E2000076
1836:1072B00024E7000202228821037E102100E2102B25
1837:1072C0005040000100EB382194E2000008002CD06F
1838:1072D000022288218EE204FC00C210218C43000CA3
1839:1072E0008EE204FC947100108EE304FC00C21021B5
1840:1072F0008C44000C00C318218C62000C2634FFEC77
1841:10730000908400178EE304FC9442001A02848821C2
1842:1073100000C318218C65000C8EE304FC0222882136
1843:107320008EE204FC00C3182100C210218C44000C22
1844:107330008C62000C94A3001C9484001E94420020D4
1845:1073400002238821022488210222882100111C02A4
1846:107350003222FFFF0062882100111C023222FFFF4F
1847:107360000062882132C20001104000B2000000001B
1848:1073700096E2045A30420001104000AE32C2008052
1849:10738000104000080000000092E27B9814400005C5
1850:1073900000000000240C0001A2EC7B98AEF57B9C61
1851:1073A000AEF27BA48EE304FC001511000043102113
1852:1073B0008C47000C037E182124E2000E0043102BA2
1853:1073C0001440000800E020212405000E0C002F7559
1854:1073D000AFAB00383042FFFF8FAB003808002D09FB
1855:1073E0000202802194E6000024E7000294E50000F8
1856:1073F00024E7000294E3000024E7000294E2000086
1857:1074000024E7000294E4000024E700020206802141
1858:1074100002058021020380210202802194E2000003
1859:1074200094E30002020480210202802102038021F1
1860:1074300000101C023202FFFF0062802100101C02BB
1861:107440003202FFFF8EE47B9C0062802114950004D1
1862:107450003205FFFF9662001608002D17005120210B
1863:107460009662001600542021000414023083FFFFAE
1864:1074700000432021008520230004140200822021E3
1865:107480003084FFFF508000013404FFFF8EE27BA4B4
1866:1074900024430017037E10210062102B504000018E
1867:1074A000006B182190630000240200111462003167
1868:1074B000240200068EE27BA4037E182124420028C9
1869:1074C0000043102B14400018000000008EE27B9C4B
1870:1074D00012A2000A32C201008EE27BA43C01FFFF2F
1871:1074E00000220821942200280082202100041C028E
1872:1074F0003082FFFF0062202132C2010014400004EC
1873:107500000004102792E27B98144000020004102728
1874:107510003044FFFF8EE27BA43C01FFFF00220821E4
1875:1075200008002D8AA42400288EE27B9C12A2000869
1876:1075300032C201008EE27BA4944200280082202106
1877:1075400000041C023082FFFF0062202132C20100D1
1878:10755000144000040004102792E27B9814400002BB
1879:10756000000410273044FFFF8EE27BA408002D8A20
1880:10757000A44400281462002F037E18218EE27BA40D
1881:10758000244200320043102B144000180000000079
1882:107590008EE27B9C12A2000A32C201008EE27BA422
1883:1075A0003C01FFFF002208219422003200822021AA
1884:1075B00000041C023082FFFF0062202132C2010061
1885:1075C000144000040004102792E27B98144000024B
1886:1075D000000410273044FFFF8EE27BA43C01FFFF34
1887:1075E0000022082108002D8AA42400328EE27B9C10
1888:1075F00012A2000832C201008EE27BA49442003243
1889:107600000082202100041C023082FFFF0062202142
1890:1076100032C20100144000040004102792E27B985B
1891:1076200014400002000410273044FFFF8EE27BA4C8
1892:10763000A44400328FAC00241180002C037E18215A
1893:107640008E420000AE42FFFC2642000A0043102B8F
1894:107650001440001B3403810026430004037E1021E4
1895:107660000062102B1440000300602021006B1821E1
1896:10767000006020218C62000024630004AE42000000
1897:10768000037E10210062102B50400001006B182176
1898:107690008C620000AC82000034028100A462000011
1899:1076A00024630002037E10210062102B5040000171
1900:1076B000006B182197AC002E08002DB4A46C0000BC
1901:1076C0008E4200048E440008A643000897AC002EAA
1902:1076D000A64C000AAE420000AE4400049662000EC2
1903:1076E0002652FFFC24420004A662000E9662000EA1
1904:1076F0008EE3725C00621821AEE3725CAFB20018D8
1905:107700008EE3725CAFA3001C8EE2725C2C42003CE4
1906:1077100010400004246200012403FFFE00431024F3
1907:10772000AFA2001C32C200801040000C32C2010027
1908:107730008EE27BA824430001000210C000571021F4
1909:10774000AEE37BA88FA300188FA4001CAC437BACD6
1910:10775000AC447BB008002EA0AEE0725C104000721A
1911:10776000000000008EE27BA824430001000210C04C
1912:1077700000571021AEE37BA88FA300188FA4001C34
1913:10778000AC437BACAC447BB08EE27BA81040006382
1914:1077900000004821000050218F8200F0244800089A
1915:1077A000276218000102102B5040000127681000CA
1916:1077B0008F8200F415020007000000008EE201B481
1917:1077C0000000802124420001AEE201B408002DFA3D
1918:1077D0008EE201B48F8300F02410000101571021C4
1919:1077E0008C447BAC8C457BB0AC640000AC65000481
1920:1077F000AF8800F01600000602EA10218EE2008831
1921:1078000024420001AEE2008808002E3F8EE200888C
1922:107810008C427BB08EE400E08EE500E48EE67B9C3B
1923:10782000004018210000102100A3282100A3382BBC
1924:1078300000822021008720218EE204FC00C9302133
1925:1078400000063100AEE400E0AEE500E400C2302105
1926:1078500094C2000A240C00020002114230430003CB
1927:10786000106C00162862000310400005240C000173
1928:10787000106C00080000000008002E3F000000000F
1929:10788000240C0003106C00170000000008002E3FBD
1930:10789000000000008EE200E88EE300EC24630001AB
1931:1078A0002C64000100441021AEE200E8AEE300ECDD
1932:1078B0008EE200E808002E3F8EE300EC8EE200F03E
1933:1078C0008EE300F4246300012C64000100441021C5
1934:1078D000AEE200F0AEE300F48EE200F008002E3FCE
1935:1078E0008EE300F48EE200F88EE300FC24630001D6
1936:1078F0002C64000100441021AEE200F8AEE300FC6D
1937:107900008EE200F88EE300FC8EE27BA825290001C0
1938:107910000122102B1440FFA0254A0008A2E07B980A
1939:1079200008002E9FAEE07BA88F8200F0244700085D
1940:107930002762180000E2102B50400001276710005A
1941:107940008F8200F414E20007000000008EE201B410
1942:107950000000802124420001AEE201B408002E5D47
1943:107960008EE201B48F8200F0241000018FA3001872
1944:107970008FA4001CAC430000AC440004AF8700F0AF
1945:1079800016000007000000008EE20088244200017B
1946:10799000AEE200888EE2008808002EA0AEE0725CA5
1947:1079A0008EE2725C8EE400E08EE500E4240C0002BE
1948:1079B000004018210000102100A3282100A3302B33
1949:1079C000008220210086202100161142304300034E
1950:1079D000AEE400E0AEE500E4106C00172C6200039A
1951:1079E00010400005240C0001106C0008000000008D
1952:1079F00008002EA0AEE0725C240C0003106C00198D
1953:107A00000000000008002EA0AEE0725C8EE200E8EC
1954:107A10008EE300EC246300012C640001004410217B
1955:107A2000AEE200E8AEE300EC8EE200E88EE300ECAC
1956:107A300008002EA0AEE0725C8EE200F08EE300F44F
1957:107A4000246300012C64000100441021AEE200F028
1958:107A5000AEE300F48EE200F08EE300F408002EA006
1959:107A6000AEE0725C8EE200F88EE300FC246300015D
1960:107A70002C64000100441021AEE200F8AEE300FCEB
1961:107A80008EE200F88EE300FCAEE0725C8E62001CB9
1962:107A900096E304588EE404F0244200012463FFFFBF
1963:107AA0000043102424840001AEE204E4AEE404F0B8
1964:107AB0008F42023C0082202B148000B000000000A6
1965:107AC0008F830120276238002466002000C2102B1B
1966:107AD00050400001276630008F82012810C2000448
1967:107AE000000000008F82012414C200070000000083
1968:107AF0008EE201A40000802124420001AEE201A434
1969:107B000008002F078EE201A48EE204E4AC62001CA0
1970:107B10008EE404B08EE504B42462001CAC6200085C
1971:107B200024020008A462000E24020011AC620018B6
1972:107B3000AC640000AC6500048EE204C4AC620010CA
1973:107B4000AF86012092E24E2014400037241000013D
1974:107B50008EE24E30000210C02442503802E2202152
1975:107B60008C830000240200121462001F0000000039
1976:107B70008EE34E308EE24E341062001B240C004027
1977:107B80008C82000424420001AC8200048EE24E3458
1978:107B90008EE34E3024420001104C0007000000002C
1979:107BA0008EE24E3424420001106200050000000005
1980:107BB00008002EF100000000146000050000000025
1981:107BC0008F82012824420020AF8201288F82012861
1982:107BD0008C8200042C42001150400013AC80000045
1983:107BE00008002F07000000008EE24E30240C0040F9
1984:107BF00024420001504C0003000010218EE24E3060
1985:107C000024420001AEE24E308EE24E30000210C03F
1986:107C10002442503802E2202124020012240C0001E8
1987:107C2000AC820000AC8C00045600000D2410000152
1988:107C30008EE204E43C04000124845754AFA00014F5
1989:107C4000AFA200108EE606088F4702283C05000907
1990:107C500034A5F0060C002403AFAB00388FAB00381E
1991:107C600016000003240C000108002F5CA2EC04F4B1
1992:107C70008EE2017024420001AEE201708EE20170DA
1993:107C80008EE204E4A2E004F4AEE004F0AEE072742C
1994:107C9000AEE204F88F42023C1040003800000000C1
1995:107CA0008EE2018424420001AEE2018408002F5CD0
1996:107CB0008EE201848EE20504240C0040244200017F
1997:107CC000504C0003000010218EE205042442000104
1998:107CD000AEE205048EE205048E630018240C000356
1999:107CE0000002108000571021146C000F8C4405080E
2000:107CF0003C02000100571021904283B11040001453
2001:107D0000000000008EE201D08EE3524000441021BA
2002:107D1000AEE201D08EE201D800641821306300FF8A
2003:107D200008002F4FAEE352408EE201CC8EE30E10DE
2004:107D300000441021AEE201CC8EE201D8006418218B
2005:107D4000306301FFAEE30E1000441021AEE201D813
2006:107D50008EE200003442004008002F5CAEE20000DA
2007:107D60008EE2014C3C01000100370821A02083E095
2008:107D700024420001AEE2014C8EE2014C8F820108E8
2009:107D800024420020AF8201088F8201088F820108FF
2010:107D9000276330000043102B1440000227622800A4
2011:107DA000AF8201088F8301088F8201041462FC1ED8
2012:107DB000000000008FBF00608FBE005C8FB60058CF
2013:107DC0008FB500548FB400508FB3004C8FB2004871
2014:107DD0008FB100448FB0004003E0000827BD006869
2015:107DE0000005284310A0000D000030213C030001D5
2016:107DF000346338003C07FFFF036310210082102B1F
2017:107E00005040000100872021948200002484000259
2018:107E100024A5FFFF14A0FFF800C2302100061C02B9
2019:107E200030C2FFFF0062302100061C0230C2FFFF9B
2020:107E30000062302103E0000830C2FFFF27BDFF8849
2021:107E4000240F0001AFBF0070AFBE006CAFB600687A
2022:107E5000AFB50064AFB40060AFB3005CAFB2005820
2023:107E6000AFB10054AFB00050A3A00027AFAF002CBB
2024:107E70008EE204D400008021304200011440002A28
2025:107E8000A3A000378F8700E08F8800C48F8200E8AE
2026:107E900000E220232C8210005040000124841000B6
2027:107EA000000420C2008018218EE400C88EE500CCBA
2028:107EB0000000102100A3282100A3302B00822021E4
2029:107EC00000862021AEE400C8AEE500CC8F8300C858
2030:107ED0003C02000A3442EFFF010320230044102B30
2031:107EE000104000033C02000A3442F00000822021CE
2032:107EF000008018218EE400C08EE500C4000010212F
2033:107F000000A3282100A3302B0082202100862021FD
2034:107F1000AEE400C0AEE500C4AF8800C8AF8700E49F
2035:107F2000080034CCAF8700E83C0200010057102164
2036:107F3000904283C01040000B000000003C14000180
2037:107F40000297A0218E9483C43C13000102779821EC
2038:107F50008E7383C83C1200010257902108003193B0
2039:107F60008E5283CC8F8300E08F8200E410430007A1
2040:107F7000000088218F8200E4241100018C4300005E
2041:107F80008C440004AFA30018AFA4001C1620000E00
2042:107F90003C02FFFF8F8200C4AFA200108F8200C896
2043:107FA0003C04000124845870AFA200148F8600E0C6
2044:107FB0008F8700E43C0500060C00240334A5F00084
2045:107FC000080034CC000000008FA3001C8FB2001802
2046:107FD0003074FFFF2694FFFC00621024104000580C
2047:107FE000024098213C020080006210241040000AE8
2048:107FF0003C0400408EE2007C24420001AEE2007CA2
2049:108000008EE2007C8EE201FC24420001AEE201FC23
2050:10801000080034C68EE201FC3C0600043C0B000163
2051:108020003C0A00023C0500103C0900088EE200807A
2052:108030003C0800203407800024420001AEE20080AA
2053:108040008EE200808FA2001C0044182410660021DC
2054:1080500000C3102B1440000700000000106B00113B
2055:1080600000000000106A0015000000000800304900
2056:10807000000420421065002300A3102B14400005CB
2057:1080800000000000106900190000000008003049DD
2058:108090000004204210680021000000000800304960
2059:1080A000000420428EE2003424420001AEE200349B
2060:1080B0008EE2003408003049000420428EE201ECD8
2061:1080C00024420001AEE201EC8EE201EC08003049EE
2062:1080D000000420428EE201F024420001AEE201F0F1
2063:1080E0008EE201F008003049000420428EE201F4E3
2064:1080F00024420001AEE201F48EE201F408003049AE
2065:10810000000420428EE2003024420001AEE2003042
2066:108110008EE2003008003049000420428EE201F86F
2067:1081200024420001AEE201F88EE201F80004204290
2068:108130001087047C000000000800300E00000000E2
2069:108140003C02000100571021904283B21440008489
2070:10815000240200013C03000100771821906383B3DF
2071:108160001462007F3C0201008E4300000062102474
2072:108170001040006F2402FFFF14620005241000016C
2073:10818000964300043402FFFF1062007500000000F7
2074:1081900092E204D814400072000000003C0200018A
2075:1081A000005710218C4283B4284200051040002063
2076:1081B000000038213C020001005710218C4283B49A
2077:1081C000184000160000282196660000000520C017
2078:1081D000009710219442777E1446000900971021E1
2079:1081E0009443778096620002146200050097102184
2080:1081F00094437782966200045062000824070001CD
2081:108200003C020001005710218C4283B424A50001D8
2082:1082100000A2102A5440FFEE000520C030E200FF0B
2083:108220001040044000000000080030D500000000AD
2084:10823000024020210C0022FE240500063044001FCD
2085:10824000000428C002E510219442727C30424000B4
2086:108250001440043400B710219443727E96620000EB
2087:108260001462000B000418C000B710219443728000
2088:108270009662000214620006000418C000B71021C4
2089:10828000944372829662000410620035000418C0A4
2090:1082900002E310219442727C304280001440042199
2091:1082A00002E31021944B727C96670000000B28C0FB
2092:1082B00000B710219442737E080030B700003021CF
2093:1082C000000420C002E410219443737C02E41021D6
2094:1082D000944B737C3063800014600010000B28C046
2095:1082E00000B710219442737E1447FFF501602021EE
2096:1082F00000B7102194437380966200025462FFF12C
2097:10830000000420C000B710219443738296620004D9
2098:108310005462FFEC000420C02406000130C200FFBC
2099:108320001040040000000000080030D500000000EC
2100:108330009743020296420000146203FA0000000014
2101:108340009743020496420002146203F60000000004
2102:108350009743020696420004146203F200000000F4
2103:10836000924200003A030001304200010043102411
2104:10837000104000742402FFFF8E63000014620004AA
2105:108380003402FFFF966300041062006F240F0002A6
2106:108390003C02000100571021904283B21440006A51
2107:1083A000240F000392E204D854400068AFAF002CC1
2108:1083B0003C020001005710218C4283B42842000582
2109:1083C00010400020000038213C020001005710211D
2110:1083D0008C4283B4184000160000282196660000E5
2111:1083E000000520C0009710219442777E14460009B2
2112:1083F0000097102194437780966200021462000572
2113:10840000009710219443778296620004506200081E
2114:10841000240700013C020001005710218C4283B464
2115:1084200024A5000100A2102A5440FFEE000520C040
2116:1084300030E200FF14400044240F0003080034C65B
2117:1084400000000000024020210C0022FE240500064E
2118:108450003044001F000428C002E510219442727CC1
2119:1084600030424000144003AF00B710219443727EA5
2120:10847000966200001462000B000418C000B71021BF
2121:10848000944372809662000214620006000418C0D1
2122:1084900000B7102194437282966200041062002794
2123:1084A000000418C002E310219442727C3042800024
2124:1084B0001440039C02E31021944B727C96670000E9
2125:1084C000000B28C000B710219442737E0800313C95
2126:1084D00000003021000420C002E410219443737C8A
2127:1084E00002E41021944B737C306380001460001010
2128:1084F000000B28C000B710219442737E1447FFF58B
2129:108500000160202100B7102194437380966200021D
2130:108510005462FFF1000420C000B71021944373821D
2131:10852000966200045462FFEC000420C0240600019F
2132:1085300030C200FF1040037B000000000800314FF4
2133:10854000240F0003240F0001AFAF002C8F42026004
2134:108550000054102B1040003A000000008F8300E40C
2135:108560008F8200E01062000324630008AF8300E400
2136:10857000AF8300E88EE400C08EE500C402801821BD
2137:108580000000102100A3282100A3302B008220210D
2138:1085900000862021AEE400C0AEE500C48EE20058A3
2139:1085A00024420001AEE200588EE200588EE2007CC8
2140:1085B00024420001AEE2007C8EE2007C8F8200E06B
2141:1085C000AFA200108F8200E43C040001248458789C
2142:1085D000AFA200148FA600188FA7001C3C05000650
2143:1085E0000C00240334A5F003080034CC0000000084
2144:1085F0008EE25240AFA200108EE252443C040001D1
2145:1086000024845884AFA200148EE60E108EE70E1854
2146:108610003C0500060C00240334A5F0028EE201C0E4
2147:1086200024420001AEE201C08EE200008EE301C0F0
2148:108630002403FFBF0043102408003470AEE20000A2
2149:1086400096E204680054102B104000030000000064
2150:10865000240F0001A3AF0027128003012416000796
2151:1086600024150040241E0001240E00128EE2724CDC
2152:108670008F43028024420001304207FF106202D380
2153:108680000000000093A2002710400014000000002A
2154:108690008EE352408EE252441062000926ED5244AD
2155:1086A0008EE652448EE35244000211402442524866
2156:1086B00002E2802124630001080031BF306B00FF1B
2157:1086C00092E272481440FFCA000000008EE201E00E
2158:1086D00024420001AEE201E08EE201E08EE30E10E2
2159:1086E0008EE20E181062FFC226ED0E188EE60E18EE
2160:1086F0008EE30E180002114024420E2002E2802177
2161:1087000024630001306B01FF96E2046A30420010DE
2162:1087100010400019000000009642000C340F810048
2163:10872000144F0015000000003C020001005710210A
2164:10873000904283C014400010000000009642000EDA
2165:10874000A60200168E4200088E4300048E440000EC
2166:108750002694FFFCAE42000CAE430008AE44000479
2167:108760009602000E26730004240F0001A3AF003709
2168:1087700034420200A602000E8E0200008E030004A6
2169:108780003C04000134843800306A0007026A9823F0
2170:10879000036410210262102B10400005028AA02100
2171:1087A00002641023036218233C0200200043982334
2172:1087B000268200072404FFF89603000A0044602480
2173:1087C000006A1821006C102B104000020180382133
2174:1087D00000603821AE1300188F88012024E20007C2
2175:1087E0000044382427623800250900200122102B7C
2176:1087F00050400001276930008F82012811220004B7
2177:10880000000000008F82012415220007014018217A
2178:108810008EE201A40000882124420001AEE201A4FE
2179:108820000800324C8EE201A48E0400008E05000484
2180:1088300000001021AD130008A507000EAD160018AA
2181:10884000AD06001C00A3302B00A3282300822023A8
2182:1088500000862023AD040000AD0500048EE204C0B4
2183:10886000AD020010AF89012092E24E201440003387
2184:10887000241100018EE24E30000210C02442503814
2185:1088800002E220218C8200001456001F000000002C
2186:108890008EE34E308EE24E341062001B000000006A
2187:1088A0008C82000424420001AC8200048EE24E342B
2188:1088B0008EE34E30244200011055000700000000F6
2189:1088C0008EE24E34244200011062000500000000D8
2190:1088D00008003239000000001460000500000000AC
2191:1088E0008F82012824420020AF8201288F82012834
2192:1088F0008C8200042C42001150400010AC8000001B
2193:108900000800324C000000008EE24E30244200018C
2194:1089100050550003000010218EE24E302442000129
2195:10892000AEE24E308EE24E30000210C0244250388B
2196:1089300002E22021AC960000AC9E00041620001834
2197:108940003C0500068E0200183C0400012484589067
2198:10895000AFA200108E0200008E03000434A5F009BF
2199:10896000020030210C002403AFA3001493A20037AF
2200:1089700010400216340F81008E4200048E4300081E
2201:108980008E44000CA64F000CAE420000AE43000423
2202:10899000AE4400089602001608003470A642000E8D
2203:1089A00014EC0168028A1823960C000A9603000E44
2204:1089B000028A1023A602000A34620004A602000EF6
2205:1089C0008F88012027623800250900200122102B02
2206:1089D00014400002306AFFFF276930008F820128AF
2207:1089E00011220004000000008F82012415220007DC
2208:1089F000240400208EE201A400008821244200010A
2209:108A0000AEE201A4080032CA8EE201A48EE5724CE7
2210:108A10008EE604908EE70494A504000E240400045E
2211:108A2000AD100008AD0400180005294000A0182171
2212:108A30000000102100E3382100E3202B00C2302188
2213:108A400000C43021AD060000AD0700048EE2724C78
2214:108A5000AD02001C8EE204C4AD020010AF890120FB
2215:108A600092E24E2014400033241100018EE24E3079
2216:108A7000000210C02442503802E220218C82000003
2217:108A80001456001F000000008EE34E308EE24E347C
2218:108A90001062001B000000008C82000424420001D0
2219:108AA000AC8200048EE24E348EE34E30244200014C
2220:108AB00010550007000000008EE24E3424420001F1
2221:108AC0001062000500000000080032B7000000003E
2222:108AD00014600005000000008F820128244200205D
2223:108AE000AF8201288F8201288C8200042C42001161
2224:108AF00050400010AC800000080032CA00000000A6
2225:108B00008EE24E3024420001505500030000102137
2226:108B10008EE24E3024420001AEE24E308EE24E3004
2227:108B2000000210C02442503802E22021AC9600001E
2228:108B3000AC9E00041620000D00000000A60C000AE8
2229:108B4000A60A000E8F820100AFA200108F820104DE
2230:108B50003C0400012484589C3C050006AFA200148C
2231:108B60008EE6724C0800343B34A5F00B3C0100014A
2232:108B700000370821A02083C0ADAB00008EE201D8F1
2233:108B80008EE3724C2442FFFFAEE201D88EE201D8A0
2234:108B900024630001306307FF26E2524415A2000659
2235:108BA000AEE3724C8EE201D02442FFFFAEE201D070
2236:108BB000080032EF8EE201D08EE201CC2442FFFFAA
2237:108BC000AEE201CC8EE201CC8F4202401040007335
2238:108BD000000000008EE20E1C24420001AEE20E1CDA
2239:108BE0008F4302400043102B144001760000A02167
2240:108BF0008F830120276238002466002000C2102BDA
2241:108C000050400001276630008F82012810C2000406
2242:108C1000000000008F82012414C200070000000041
2243:108C20008EE201A40000882124420001AEE201A4EA
2244:108C30000800334F8EE201A48EE2724CAC62001C3D
2245:108C40008EE404A88EE504AC2462001CAC6200082B
2246:108C500024020008A462000E24020011AC62001875
2247:108C6000AC640000AC6500048EE204C4AC62001089
2248:108C7000AF86012092E24E201440003324110001FF
2249:108C80008EE24E30000210C02442503802E2202111
2250:108C90008C820000144E001F000000008EE34E3056
2251:108CA0008EE24E341062001B000000008C82000433
2252:108CB00024420001AC8200048EE24E348EE34E303A
2253:108CC0002442000110550007000000008EE24E34DF
2254:108CD0002442000110620005000000000800333C3F
2255:108CE0000000000014600005000000008F820128D1
2256:108CF00024420020AF8201288F8201288C82000448
2257:108D00002C42001150400010AC8000000800334F8E
2258:108D1000000000008EE24E30244200015055000356
2259:108D2000000010218EE24E3024420001AEE24E30AF
2260:108D30008EE24E30000210C02442503802E2202160
2261:108D4000AC8E0000AC9E00045620000D24110001E2
2262:108D50008EE2724C3C040001248458A8AFA0001499
2263:108D6000AFA200108EE6724C8F4702803C050009CE
2264:108D700034A5F0080C002403AFAE00488FAE0048C5
2265:108D800056200001AEE00E1C8EE201882442000154
2266:108D9000AEE20188080033C88EE201888F8301208B
2267:108DA000276238002466002000C2102B50400001CA
2268:108DB000276630008F82012810C2000400000000E6
2269:108DC0008F82012414C20007000000008EE201A47B
2270:108DD0000000882124420001AEE201A4080033BA59
2271:108DE0008EE201A48EE2724CAC62001C8EE404A8F8
2272:108DF0008EE504AC2462001CAC620008240200086A
2273:108E0000A462000E24020011AC620018AC640000E1
2274:108E1000AC6500048EE204C4AC620010AF86012091
2275:108E200092E24E2014400033241100018EE24E30B5
2276:108E3000000210C02442503802E220218C8200003F
2277:108E4000144E001F000000008EE34E308EE24E34C0
2278:108E50001062001B000000008C820004244200010C
2279:108E6000AC8200048EE24E348EE34E302442000188
2280:108E700010550007000000008EE24E34244200012D
2281:108E80001062000500000000080033A70000000089
2282:108E900014600005000000008F8201282442002099
2283:108EA000AF8201288F8201288C8200042C4200119D
2284:108EB00050400010AC800000080033BA00000000F1
2285:108EC0008EE24E3024420001505500030000102174
2286:108ED0008EE24E3024420001AEE24E308EE24E3041
2287:108EE000000210C02442503802E22021AC8E000063
2288:108EF000AC9E00041620000D000000008EE2724CB3
2289:108F00003C040001248458A8AFA00014AFA20010B4
2290:108F10008EE6724C8F4702803C05000934A5F008AC
2291:108F20000C002403AFAE00488FAE00488EE20174FF
2292:108F300024420001AEE201748EE201740800346E36
2293:108F40000000A021960C000A0183102B5440000160
2294:108F500001801821A603000A8F88012027623800AB
2295:108F6000250900200122102B504000012769300004
2296:108F70008F82012811220004000000008F8201244A
2297:108F800015220007240400208EE201A4000088219D
2298:108F900024420001AEE201A40800342F8EE201A4B5
2299:108FA0008EE5724C8EE604908EE70494A504000EC4
2300:108FB00024040004AD100008AD0400180005294089
2301:108FC00000A018210000102100E3382100E3202B2D
2302:108FD00000C2302100C43021AD060000AD070004FE
2303:108FE0008EE2724CAD02001C8EE204C4AD02001091
2304:108FF000AF89012092E24E20144000332411000179
2305:109000008EE24E30000210C02442503802E220218D
2306:109010008C8200001456001F000000008EE34E30CA
2307:109020008EE24E341062001B000000008C820004AF
2308:1090300024420001AC8200048EE24E348EE34E30B6
2309:109040002442000110550007000000008EE24E345B
2310:109050002442000110620005000000000800341CDA
2311:109060000000000014600005000000008F8201284D
2312:1090700024420020AF8201288F8201288C820004C4
2313:109080002C42001150400010AC8000000800342F2A
2314:10909000000000008EE24E302442000150550003D3
2315:1090A000000010218EE24E3024420001AEE24E302C
2316:1090B0008EE24E30000210C02442503802E22021DD
2317:1090C000AC960000AC9E00041620001D00000000BD
2318:1090D000A60C000A8F820100AFA200108F8201044B
2319:1090E0003C0400012484589C3C050006AFA20014F7
2320:1090F0008EE6724C34A5F00D0C00240302003821DA
2321:1091000093A2003710400031340F81008E420004DA
2322:109110008E4300088E44000CA64F000CAE420000A7
2323:10912000AE430004AE44000896020016A642000EAC
2324:109130009602000E3042FDFF08003470A602000EB9
2325:109140008EE201D82442FFFFAEE201D88EE201D8C0
2326:109150008EE201CC3C04001F3C01000100370821D5
2327:10916000A03E83C02442FFFFAEE201CC9603000A7A
2328:109170003484FFFF8EE201CC006A1821026398213B
2329:109180000093202B108000033C02FFF534421000B6
2330:1091900002629821ADAB00008EE2724C24420001C5
2331:1091A000304207FFAEE2724C8F4202401040000492
2332:1091B0000283A0238EE20E1C24420001AEE20E1CAC
2333:1091C000A3A000271680FD290000000012800024C3
2334:1091D000000000003C01000100370821AC3483C4CA
2335:1091E0003C01000100370821AC3383C83C01000179
2336:1091F00000370821AC3283CC93A20037104000081E
2337:10920000000000003C020001005710218C4283CC7A
2338:10921000244200043C01000100370821AC2283CC29
2339:109220008EE2724C8F43028024420001304207FFDD
2340:1092300014620006000000008EE201C42442000116
2341:10924000AEE201C4080034CC8EE201C48EE201BC5F
2342:1092500024420001AEE201BC080034CC8EE201BC25
2343:1092600097A4001E2484FFFC008018218EE400C017
2344:109270008EE500C40000102100A3282100A3302B9C
2345:109280000082202100862021AEE400C0AEE500C4AB
2346:109290008FAF002C2402000211E2000F29E200032C
2347:1092A000144000172402000315E20015000000001E
2348:1092B0008EE200D08EE300D4246300012C64000110
2349:1092C00000441021AEE200D0AEE300D48EE200D024
2350:1092D000080034C68EE300D48EE200D88EE300DCB2
2351:1092E000246300012C64000100441021AEE200D888
2352:1092F000AEE300DC8EE200D8080034C68EE300DC6A
2353:109300008EE200C88EE300CC246300012C640001CF
2354:1093100000441021AEE200C8AEE300CC8EE200C8EB
2355:109320008EE300CC8F8300E48F8200E010620003A4
2356:1093300024630008AF8300E4AF8300E88FBF0070B0
2357:109340008FBE006C8FB600688FB500648FB400606C
2358:109350008FB3005C8FB200588FB100548FB00050B3
2359:1093600003E0000827BD007827BDFFB0AFB500447B
2360:109370000000A821AFB0003000008021AFBF004C3A
2361:10938000AFB60048AFB40040AFB3003CAFB2003856
2362:10939000AFB100348EE204D4241400013042000145
2363:1093A0001440002A0000B0218F8700E08F8800C49D
2364:1093B0008F8200E800E220232C8210005040000140
2365:1093C00024841000000420C2008018218EE400C80C
2366:1093D0008EE500CC0000102100A3282100A3302B33
2367:1093E0000082202100862021AEE400C8AEE500CC3A
2368:1093F0008F8300C83C02000A3442EFFF01032023A0
2369:109400000044102B104000033C02000A3442F000DC
2370:1094100000822021008018218EE400C08EE500C467
2371:109420000000102100A3282100A3302B008220215E
2372:1094300000862021AEE400C0AEE500C4AF8800C8BD
2373:10944000AF8700E408003850AF8700E83C02000115
2374:1094500000571021904283C01040000B0000000014
2375:109460003C130001027798218E7383C43C110001E4
2376:10947000023788218E3183C83C12000102579021A7
2377:10948000080036E88E5283CC8F8300E08F8200E4A0
2378:1094900010430007000048218F8200E424090001E6
2379:1094A0008C4300008C440004AFA30018AFA4001C40
2380:1094B0001520000E3C02FFFF8F8200C4AFA20010F7
2381:1094C0008F8200C83C04000124845870AFA20014AD
2382:1094D0008F8600E08F8700E43C0500060C00240323
2383:1094E00034A5F00008003850000000008FA3001CD5
2384:1094F0008FB200183073FFFF2673FFFC0062102448
2385:1095000010400058024088213C0200800062102474
2386:109510001040000A3C0400408EE2007C244200011E
2387:10952000AEE2007C8EE2007C8EE201FC244200016F
2388:10953000AEE201FC0800384A8EE201FC3C06000461
2389:109540003C0B00013C0A00023C0500103C090008ED
2390:109550008EE200803C080020340780002442000195
2391:10956000AEE200808EE200808FA2001C004418242E
2392:109570001066002100C3102B1440000700000000FB
2393:10958000106B001100000000106A001500000000C0
2394:1095900008003592000420421065002300A3102B20
2395:1095A00014400005000000001069001900000000D0
2396:1095B00008003592000420421068002100000000DD
2397:1095C00008003592000420428EE20034244200015B
2398:1095D000AEE200348EE200340800359200042042EE
2399:1095E0008EE201EC24420001AEE201EC8EE201ECDD
2400:1095F00008003592000420428EE201F0244200016E
2401:10960000AEE201F08EE201F0080035920004204243
2402:109610008EE201F424420001AEE201F48EE201F494
2403:1096200008003592000420428EE2003024420001FE
2404:10963000AEE200308EE20030080035920004204295
2405:109640008EE201F824420001AEE201F88EE201F858
2406:1096500000042042108702B70000000008003557C0
2407:10966000000000003C02000100571021904283B22C
2408:1096700014400084240200013C03000100771821FB
2409:10968000906383B31462007F3C0201008E430000AC
2410:10969000006210241040006F2402FFFF14620005D6
2411:1096A00024100001964300043402FFFF106200758D
2412:1096B0000000000092E204D8144000720000000094
2413:1096C0003C020001005710218C4283B4284200055F
2414:1096D00010400020000038213C02000100571021FA
2415:1096E0008C4283B418400016000028219626000002
2416:1096F000000520C0009710219442777E144600098F
2417:10970000009710219443778096220002146200058E
2418:10971000009710219443778296220004506200083B
2419:10972000240700013C020001005710218C4283B441
2420:1097300024A5000100A2102A5440FFEE000520C01D
2421:1097400030E200FF1040027B000000000800361EDF
2422:1097500000000000024020210C0022FE240500062B
2423:109760003044001F000428C002E510219442727C9E
2424:10977000304240001440026F00B710219443727EC3
2425:10978000962200001462000B000418C000B71021DC
2426:10979000944372809622000214620006000418C0EE
2427:1097A00000B71021944372829622000410620035A3
2428:1097B000000418C002E310219442727C3042800001
2429:1097C0001440025C02E310219448727C962700004A
2430:1097D000000828C000B710219442737E08003600AC
2431:1097E00000003021000420C002E410219443737C67
2432:1097F00002E410219448737C3063800014600010F0
2433:10980000000828C000B710219442737E1447FFF56A
2434:109810000100202100B7102194437380962200029A
2435:109820005462FFF1000420C000B7102194437382FA
2436:10983000962200045462FFEC000420C024060001BC
2437:1098400030C200FF1040023B000000000800361E3E
2438:1098500000000000974302029642000014620235A5
2439:109860000000000097430204964200021462023195
2440:109870000000000097430206964200041462022D85
2441:1098800000000000924200003A0300013042000153
2442:1098900000431024104000742402FFFF8E230000B8
2443:1098A000146200043402FFFF962300041062006F6C
2444:1098B000241400023C02000100571021904283B2A0
2445:1098C0001440006A2414000392E204D81440006794
2446:1098D000000000003C020001005710218C4283B4BC
2447:1098E0002842000510400020000038213C02000101
2448:1098F000005710218C4283B4184000160000282124
2449:1099000096260000000520C0009710219442777E23
2450:109910001446000900971021944377809622000294
2451:109920001462000500971021944377829622000468
2452:1099300050620008240700013C020001005710217A
2453:109940008C4283B424A5000100A2102A5440FFEEEB
2454:10995000000520C030E200FF14400044241400033E
2455:109960000800384A00000000024020210C0022FEBE
2456:10997000240500063044001F000428C002E5102121
2457:109980009442727C30424000144001EA00B710213A
2458:109990009443727E962200001462000B000418C0EB
2459:1099A00000B71021944372809622000214620006D0
2460:1099B000000418C000B7102194437282962200045C
2461:1099C00010620027000418C002E310219442727C48
2462:1099D00030428000144001D702E310219448727C89
2463:1099E00096270000000828C000B710219442737E1B
2464:1099F0000800368500003021000420C002E4102158
2465:109A00009443737C02E410219448737C306380009B
2466:109A100014600010000828C000B710219442737E23
2467:109A20001447FFF50100202100B7102194437380F3
2468:109A3000962200025462FFF1000420C000B71021FA
2469:109A400094437382962200045462FFEC000420C009
2470:109A50002406000130C200FF104001B600000000E3
2471:109A60000800369824140003241400018F42026079
2472:109A70000053102B10400049000000008F8300E4C9
2473:109A80008F8200E01062000324630008AF8300E4CB
2474:109A9000AF8300E88EE400C08EE500C402601821A8
2475:109AA0000000102100A3282100A3302B00822021D8
2476:109AB00000862021AEE400C0AEE500C48EE200586E
2477:109AC00024420001AEE200588EE200588EE2007C93
2478:109AD00024420001AEE2007C8EE2007C8F8200E036
2479:109AE000AFA200108F8200E43C0400012484587867
2480:109AF000AFA200148FA600188FA7001C3C0500061B
2481:109B00000C00240334A5F0030800385000000000C6
2482:109B10008EE25240AFA200108EE252443C0400019B
2483:109B200024845884AFA200148EE60E108EE70E181F
2484:109B30000C00240334A5F0028EE201C0244200018F
2485:109B4000AEE201C08EE200008EE301C02403FFBF3D
2486:109B500000431024080037F8AEE200008EE25240C5
2487:109B6000AFA200108EE252443C04000124845884C9
2488:109B7000AFA200148EE60E108EE70E183C0500060C
2489:109B80000C00240334A5F0028EE201C0244200013F
2490:109B9000AEE201C0080037F88EE201C096E2046828
2491:109BA0000053102B544000013C158000126001311D
2492:109BB0003C0C001F358CFFFF8EE2724C8F430280FD
2493:109BC00024420001304207FF10620108000000003B
2494:109BD00012A00014000000008EE352408EE25244B6
2495:109BE0001062000926EE52448EEB52448EE352443A
2496:109BF000000211402442524802E280212463000105
2497:109C000008003712306800FF92E272481440FFC02B
2498:109C10003C0500068EE201E024420001AEE201E0D4
2499:109C20008EE201E08EE30E108EE20E181062FFCB82
2500:109C300026EE0E188EEB0E180000A8218EE30E18EB
2501:109C40000002114024420E2002E280212463000120
2502:109C5000306801FF96E2046A30420010104000179D
2503:109C6000340281009643000C1462001400000000CE
2504:109C70003C02000100571021904283C01440000FA5
2505:109C8000000000009642000EA60200168E42000858
2506:109C90008E4300048E4400002673FFFCAE42000C8D
2507:109CA000AE430008AE4400049602000E26310004C4
2508:109CB0002416000134420200A602000E9603000A98
2509:109CC000026050210073102B1040000202606821D6
2510:109CD000006050212D42003D1040002A0000382134
2511:109CE0009623000C2402080054620027AE110018CD
2512:109CF0003C02000100571021904283C054400022D2
2513:109D0000AE110018262200170182102B10400013FC
2514:109D1000000000003C02FFF5005110219042101796
2515:109D2000384300062C630001384200112C42000128
2516:109D30000062182510600013262200100182102BEB
2517:109D40001040000E000000003C07FFF500F1382134
2518:109D500094E710100800375E24E7000E92220017E7
2519:109D6000384300062C630001384200112C420001E8
2520:109D70000062182550600004AE11001896270010EC
2521:109D800024E7000EAE1100183C020001005710211C
2522:109D9000904283C00002102B14E0000200024EC06B
2523:109DA000014038218F83012027623800246600207B
2524:109DB00000C2102B50400001276630008F8201281E
2525:109DC00010C20004000000008F82012414C20007AA
2526:109DD0002402000B8EE201A400004821244200016D
2527:109DE000AEE201A4080037BF8EE201A48E04000099
2528:109DF0008E050004AC62001801751025004910257D
2529:109E0000AC710008A467000EAC62001CAC640000DA
2530:109E1000AC6500048EE204C0AC620010AF86012085
2531:109E200092E24E2014400038240900018EE24E30A8
2532:109E3000000210C02442503802E220218C8300002E
2533:109E40002402000714620020000000008EE34E3060
2534:109E50008EE24E341062001C000000008C82000470
2535:109E600024420001AC8200048EE34E348EE54E3075
2536:109E7000240200402463000110620007000000007B
2537:109E80008EE24E342442000110A2000500000000C2
2538:109E9000080037A90000000014A000050000000021
2539:109EA0008F82012824420020AF8201288F8201285E
2540:109EB0008C8200042C42001150400013AC80000042
2541:109EC000080037BF000000008EE24E30240300403F
2542:109ED0002442000150430003000010218EE24E3066
2543:109EE00024420001AEE24E308EE24E30000210C03D
2544:109EF0002442503802E2202124020007AC820000F4
2545:109F000024020001AC820004152000183C05000664
2546:109F10008E0200183C04000124845890AFA2001067
2547:109F20008E0200008E03000434A5F00902003021E7
2548:109F30000C002403AFA3001432C200FF1040002B1A
2549:109F4000340281008E4300048E4400088E45000CCC
2550:109F5000A642000CAE430000AE440004AE4500082B
2551:109F600096020016080037F8A642000E154D000AAA
2552:109F7000000000009602000EA613000A34420004FE
2553:109F8000A602000E3C01000100370821A02083C07A
2554:109F9000080037F6000098219604000A0093102B61
2555:109FA00010400002026018210080182124020001E4
2556:109FB000A603000A3C01000100370821A02283C04B
2557:109FC0009604000A022488210191102B10400003FE
2558:109FD0003C02FFF5344210000222882102649823DB
2559:109FE0000000A8211660FEF4ADC800001260002138
2560:109FF00032C200FF3C01000100370821AC3383C4AA
2561:10A000003C01000100370821AC3183C83C0100014C
2562:10A010000037082110400008AC3283CC3C0200011C
2563:10A02000005710218C4283CC244200043C010001E3
2564:10A0300000370821AC2283CC8EE2724C8F43028021
2565:10A040002442000114620006000000008EE201C4F8
2566:10A0500024420001AEE201C4080038508EE201C47F
2567:10A060008EE201BC24420001AEE201BC080038507F
2568:10A070008EE201BC97A4001E2484FFFC00801821FE
2569:10A080008EE400C08EE500C40000102100A328214A
2570:10A0900000A3302B00822021008620212402000210
2571:10A0A000AEE400C0AEE500C41282000F2A820003B5
2572:10A0B000144000172402000316820015000000005F
2573:10A0C0008EE200D08EE300D4246300012C640001F2
2574:10A0D00000441021AEE200D0AEE300D48EE200D006
2575:10A0E0000800384A8EE300D48EE200D88EE300DC0C
2576:10A0F000246300012C64000100441021AEE200D86A
2577:10A10000AEE300DC8EE200D80800384A8EE300DCC3
2578:10A110008EE200C88EE300CC246300012C640001B1
2579:10A1200000441021AEE200C8AEE300CC8EE200C8CD
2580:10A130008EE300CC8F8300E48F8200E01062000386
2581:10A1400024630008AF8300E4AF8300E88FBF004CB6
2582:10A150008FB600488FB500448FB400408FB3003CE9
2583:10A160008FB200388FB100348FB0003003E00008A8
2584:10A1700027BD005027BDFF90AFB600600000B021A2
2585:10A18000AFBF0068AFBE0064AFB5005CAFB40058AD
2586:10A19000AFB30054AFB20050AFB1004CAFB0004805
2587:10A1A0008EE204D400008821241500013042000111
2588:10A1B0001440002AA3A0002F8F8700E08F8800C4DE
2589:10A1C0008F8200E800E220232C8210005040000122
2590:10A1D00024841000000420C2008018218EE400C8EE
2591:10A1E0008EE500CC0000102100A3282100A3302B15
2592:10A1F0000082202100862021AEE400C8AEE500CC1C
2593:10A200008F8300C83C02000A3442EFFF0103202381
2594:10A210000044102B104000033C02000A3442F000BE
2595:10A2200000822021008018218EE400C08EE500C449
2596:10A230000000102100A3282100A3302B0082202140
2597:10A2400000862021AEE400C0AEE500C4AF8800C89F
2598:10A25000AF8700E408003C5BAF8700E83C020001E8
2599:10A2600000571021904283C01040000B00000000F6
2600:10A270003C130001027798218E7383C43C100001C7
2601:10A28000021780218E1083C83C12000102579021D2
2602:10A2900008003A598E5283CC8F8300E08F8200E40D
2603:10A2A00010430007000038218F8200E424070001DA
2604:10A2B0008C4300008C440004AFA30018AFA4001C22
2605:10A2C00014E0000E3C02FFFF8F8200C4AFA200101A
2606:10A2D0008F8200C83C040001248458B4AFA200144B
2607:10A2E0008F8600E08F8700E43C0500060C00240305
2608:10A2F00034A5F20008003C5B000000008FA3001CA6
2609:10A300008FB200183073FFFF2673FFFC0062102429
2610:10A3100010400058024080213C020080006210245E
2611:10A320001040000A3C0400408EE2007C2442000100
2612:10A33000AEE2007C8EE2007C8EE201FC2442000151
2613:10A34000AEE201FC08003C558EE201FC3C06000434
2614:10A350003C0B00013C0A00023C0500103C090008CF
2615:10A360008EE200803C080020340780002442000177
2616:10A37000AEE200808EE200808FA2001C0044182410
2617:10A380001066002100C3102B1440000700000000DD
2618:10A39000106B001100000000106A001500000000A2
2619:10A3A00008003916000420421065002300A3102B7A
2620:10A3B00014400005000000001069001900000000B2
2621:10A3C0000800391600042042106800210000000037
2622:10A3D00008003916000420428EE2003424420001B5
2623:10A3E000AEE200348EE20034080039160004204248
2624:10A3F0008EE201EC24420001AEE201EC8EE201ECBF
2625:10A4000008003916000420428EE201F024420001C7
2626:10A41000AEE201F08EE201F008003916000420429D
2627:10A420008EE201F424420001AEE201F48EE201F476
2628:10A4300008003916000420428EE200302442000158
2629:10A44000AEE200308EE200300800391600042042EF
2630:10A450008EE201F824420001AEE201F88EE201F83A
2631:10A46000000420421087033E00000000080038DB93
2632:10A47000000000003C02000100571021904283B20E
2633:10A4800014400084240200013C03000100771821DD
2634:10A49000906383B31462007F3C0201008E4300008E
2635:10A4A000006210241040006F2402FFFF14620005B8
2636:10A4B00024110001964300043402FFFF106200756E
2637:10A4C0000000000092E204D8144000720000000076
2638:10A4D0003C020001005710218C4283B42842000541
2639:10A4E00010400020000038213C02000100571021DC
2640:10A4F0008C4283B418400016000028219606000004
2641:10A50000000520C0009710219442777E1446000970
2642:10A510000097102194437780960200021462000590
2643:10A52000009710219443778296020004506200083D
2644:10A53000240700013C020001005710218C4283B423
2645:10A5400024A5000100A2102A5440FFEE000520C0FF
2646:10A5500030E200FF1040030200000000080039A2B2
2647:10A5600000000000024020210C0022FE240500060D
2648:10A570003044001F000428C002E510219442727C80
2649:10A5800030424000144002F600B710219443727E1E
2650:10A59000960200001462000B000418C000B71021DE
2651:10A5A000944372809602000214620006000418C0F0
2652:10A5B00000B71021944372829602000410620035A5
2653:10A5C000000418C002E310219442727C30428000E3
2654:10A5D000144002E302E31021944D727C96070000C0
2655:10A5E000000D28C000B710219442737E0800398402
2656:10A5F00000003021000420C002E410219443737C49
2657:10A6000002E41021944D737C3063800014600010CC
2658:10A61000000D28C000B710219442737E1447FFF547
2659:10A6200001A0202100B710219443738096020002FC
2660:10A630005462FFF1000420C000B7102194437382DC
2661:10A64000960200045462FFEC000420C024060001BE
2662:10A6500030C200FF104002C200000000080039A212
2663:10A66000000000009743020296420000146202BC00
2664:10A67000000000009743020496420002146202B8F0
2665:10A68000000000009743020696420004146202B4E0
2666:10A6900000000000924200003A2300013042000115
2667:10A6A00000431024104000742402FFFF8E030000BA
2668:10A6B000146200043402FFFF960300041062006F6E
2669:10A6C000241500023C02000100571021904283B281
2670:10A6D0001440006A2415000392E204D81440006775
2671:10A6E000000000003C020001005710218C4283B49E
2672:10A6F0002842000510400020000038213C020001E3
2673:10A70000005710218C4283B4184000160000282105
2674:10A7100096060000000520C0009710219442777E25
2675:10A720001446000900971021944377809602000296
2676:10A73000146200050097102194437782960200046A
2677:10A7400050620008240700013C020001005710215C
2678:10A750008C4283B424A5000100A2102A5440FFEECD
2679:10A76000000520C030E200FF14400044241500031F
2680:10A7700008003C5500000000024020210C0022FE91
2681:10A78000240500063044001F000428C002E5102103
2682:10A790009442727C304240001440027100B7102194
2683:10A7A0009443727E960200001462000B000418C0ED
2684:10A7B00000B71021944372809602000214620006D2
2685:10A7C000000418C000B7102194437282960200045E
2686:10A7D00010620027000418C002E310219442727C2A
2687:10A7E000304280001440025E02E31021944D727CDE
2688:10A7F00096070000000D28C000B710219442737E18
2689:10A8000008003A0900003021000420C002E41021B1
2690:10A810009443737C02E41021944D737C3063800078
2691:10A8200014600010000D28C000B710219442737E00
2692:10A830001447FFF501A0202100B710219443738035
2693:10A84000960200025462FFF1000420C000B71021FC
2694:10A8500094437382960200045462FFEC000420C00B
2695:10A860002406000130C200FF1040023D000000003D
2696:10A8700008003A1C24150003241500018F420260D1
2697:10A880000053102B10400036000000008F8300E4BE
2698:10A890008F8200E01062000324630008AF8300E4AD
2699:10A8A000AF8300E88EE400C08EE500C4026018218A
2700:10A8B0000000102100A3282100A3302B00822021BA
2701:10A8C00000862021AEE400C0AEE500C48EE2005850
2702:10A8D00024420001AEE200588EE200588EE2007C75
2703:10A8E00024420001AEE2007C8EE2007C8F8200E018
2704:10A8F000AFA200108F8200E43C040001248458C001
2705:10A90000AFA200148FA600188FA7001C3C050006FC
2706:10A910000C00240334A5F20308003C5B0000000097
2707:10A920008EE25240AFA200108EE252443C0400017D
2708:10A93000248458CCAFA200148EE60E108EE70E18B9
2709:10A940003C0500060C00240334A5F2028EE201C08F
2710:10A9500024420001AEE201C008003C028EE201C0C8
2711:10A9600096E204680053102B544000013C1680000E
2712:10A97000126001CB3C0E001F35CEFFFF3C0FFFF5F0
2713:10A9800035EF1000241E00408EE2724C8F4302808F
2714:10A9900024420001304207FF1062019E00000000C7
2715:10A9A00012C00012000000008EE352408EE25244BA
2716:10A9B0001062000A26F852448EF45244AFB80024C4
2717:10A9C0008EE35244000211402442524802E28821A0
2718:10A9D0002463000108003A85306D00FF8EE201E03B
2719:10A9E00024420001AEE201E08EE201E08EE30E10AF
2720:10A9F0008EE20E181062FFCA26F80E188EF40E189A
2721:10AA00000000B021AFB800248EE30E180002114000
2722:10AA100024420E2002E2882124630001306D01FFF0
2723:10AA200096E2046A3042001010400018340281009F
2724:10AA30009643000C14620015000000003C02000167
2725:10AA400000571021904283C0144000100000000005
2726:10AA50009642000EA62200168E4200088E43000485
2727:10AA60008E4400002673FFFCAE42000CAE4300088B
2728:10AA7000AE4400049622000E2610000424180001A3
2729:10AA8000A3B8002F34420200A622000E8E2200003E
2730:10AA90008E2300043C04000134843800020030217D
2731:10AAA000306A0007020A8023036410210202102B7F
2732:10AAB00010400005026A9821020410230362182343
2733:10AAC0003C02002000438023266200079623000AF0
2734:10AAD0002418FFF80058C824006A18210079102BA8
2735:10AAE00010400002032060210060602101801821D5
2736:10AAF000246200072418FFF800586024026C102B11
2737:10AB000014400004019328230183282308003AC33A
2738:10AB100000C3102100D31021004A202301C4102BB0
2739:10AB200054400001008F202125420040004C102B92
2740:10AB3000144000350000582194C3000C2402080082
2741:10AB400054620032AE2600183C020001005710216A
2742:10AB5000904283C05440002DAE26001824C2001736
2743:10AB600001C2102B10400013000000003C02FFF552
2744:10AB70000046102190421017384300062C63000154
2745:10AB8000384200112C4200010062182510600014A8
2746:10AB900024C2001001C2102B1040000E0000000063
2747:10ABA0003C0BFFF501665821956B101008003AF434
2748:10ABB0002562000E90C20017384300062C63000186
2749:10ABC000384200112C420001006218251060000577
2750:10ABD0000160182194CB00102562000E004A582114
2751:10ABE00001601821246200072418FFF80058582437
2752:10ABF00000C31021004A202301C4102B1040000282
2753:10AC000001632823008F2021AE2600183C0200019A
2754:10AC100000571021904283C00002102B000216C082
2755:10AC200015600002AFA2004401805821308200016B
2756:10AC3000104000070000402190880000248400019B
2757:10AC400001C4102B1040000224A5FFFF008F20211B
2758:10AC500050A0001200081C022CA20002544000095F
2759:10AC600024A5FFFF948200002484000201024021F9
2760:10AC700001C4102B1040000624A5FFFE08003B2154
2761:10AC8000008F20219082000000021200010240216A
2762:10AC900014A0FFF22CA2000200081C023102FFFFE8
2763:10ACA000006240213108FFFF0140282111400011BE
2764:10ACB000020020212CA200025440000924A5FFFF1D
2765:10ACC00094820000248400020102402101C4102B60
2766:10ACD0001040000624A5FFFE08003B38008F20210D
2767:10ACE00090820000000212000102402114A0FFF235
2768:10ACF0002CA2000200081C023102FFFF006240216A
2769:10AD000000081C023102FFFF8F89012000624021F0
2770:10AD100027623800252300200062102B1440000217
2771:10AD20003108FFFF276330008F8201281062000482
2772:10AD3000000000008F8201241462000701402821D6
2773:10AD40008EE201A40000382124420001AEE201A4F9
2774:10AD500008003BC98EE201A48E2600008E27000465
2775:10AD6000000814003448000BAD300008A52B000E7D
2776:10AD7000AD2800188FB8004400002021029610254D
2777:10AD800000581025AD22001C00E5102B00E53823EB
2778:10AD900000C4302300C23023AD260000AD270004DC
2779:10ADA0008EE204C0AD220010AF83012092E24E205B
2780:10ADB0001440005F240700012502FFEE2C42000230
2781:10ADC00014400003240200111502002400000000BA
2782:10ADD0008EE24E30000210C02442503802E22021A0
2783:10ADE0008C830000240200121462000F0000000097
2784:10ADF0008EE34E308EE24E341062000B00000000F5
2785:10AE00008C82000424420001AC8200048EE24E34A5
2786:10AE10008EE34E3024420001105E002A0000000044
2787:10AE200008003BA8000000008EE24E3024420001E2
2788:10AE3000505E0003000010218EE24E3024420001DB
2789:10AE4000AEE24E308EE24E30000210C02442503846
2790:10AE500002E2202108003BC6240200128EE24E309E
2791:10AE6000000210C02442503802E220218C830000EE
2792:10AE7000240200071462001F000000008EE34E3021
2793:10AE80008EE24E341062001B000000008C82000431
2794:10AE900024420001AC8200048EE24E348EE34E3038
2795:10AEA00024420001105E0007000000008EE24E34D4
2796:10AEB00024420001106200050000000008003BB4BD
2797:10AEC0000000000014600005000000008F820128CF
2798:10AED00024420020AF8201288F8201288C82000446
2799:10AEE0002C42001150400012AC80000008003BC909
2800:10AEF000000000008EE24E3024420001505E00034C
2801:10AF0000000010218EE24E3024420001AEE24E30AD
2802:10AF10008EE24E30000210C02442503802E220215E
2803:10AF200024020007AC82000024020001AC8200046D
2804:10AF300014E000193C0500063C04000124845890EC
2805:10AF40008E22001834A5F209AFA200108E22000054
2806:10AF50008E23000402203021016038210C002403DC
2807:10AF6000AFA3001493A2002F1040002A34028100E6
2808:10AF70008E4300048E4400088E45000CA642000C4F
2809:10AF8000AE430000AE440004AE4500089622001611
2810:10AF900008003C02A642000E1599000A026A182316
2811:10AFA0009622000EA623000A34420004A622000EB8
2812:10AFB0003C01000100370821A02083C008003BFFAE
2813:10AFC000000098219624000A0083102B54400001B1
2814:10AFD0000080182124020001A623000A3C01000180
2815:10AFE00000370821A02283C09622000A004A1821B7
2816:10AFF0000203802101D0102B54400001020F802158
2817:10B00000026398230000B0218FB800241660FE5E12
2818:10B01000AF0D000012600022000000003C010001A2
2819:10B0200000370821AC3383C43C01000100370821FC
2820:10B03000AC3083C83C01000100370821AC3283CC1E
2821:10B0400093A2002F10400008000000003C02000105
2822:10B05000005710218C4283CC244200043C010001A3
2823:10B0600000370821AC2283CC8F4302808EE2724CE1
2824:10B0700014620006000000008EE201C424420001B8
2825:10B08000AEE201C408003C5B8EE201C48EE201BC6A
2826:10B0900024420001AEE201BC08003C5B8EE201BC30
2827:10B0A00097A4001E2484FFFC008018218EE400C0B9
2828:10B0B0008EE500C40000102100A3282100A3302B3E
2829:10B0C000008220210086202124020002AEE400C07C
2830:10B0D000AEE500C412A2000F2AA20003144000171C
2831:10B0E0002402000316A20015000000008EE200D02A
2832:10B0F0008EE300D4246300012C640001004410217D
2833:10B10000AEE200D0AEE300D48EE200D008003C55A1
2834:10B110008EE300D48EE200D88EE300DC24630001CD
2835:10B120002C64000100441021AEE200D8AEE300DC44
2836:10B130008EE200D808003C558EE300DC8EE200C8A9
2837:10B140008EE300CC246300012C6400010044102134
2838:10B15000AEE200C8AEE300CC8EE200C88EE300CCC5
2839:10B160008F8300E48F8200E01062000324630008F4
2840:10B17000AF8300E4AF8300E88FBF00688FBE006438
2841:10B180008FB600608FB5005C8FB400588FB3005449
2842:10B190008FB200508FB1004C8FB0004803E0000820
2843:10B1A00027BD007027BDFFE0AFBF00188EE30E146F
2844:10B1B0008EE20E0C10620074000000008EE30E0C94
2845:10B1C0008EE20E1400622023048200012484020017
2846:10B1D0008EE30E188EE20E140043102B1440000470
2847:10B1E000240202008EE30E1408003C7D0043182365
2848:10B1F0008EE20E188EE30E14004310232443FFFF4B
2849:10B20000008048210069102A544000010060482154
2850:10B210008F8701002762300024E800200102102BF4
2851:10B2200050400001276828008F82010811020004A5
2852:10B23000000000008F8201041502000700001021A9
2853:10B240008EE201A80000202124420001AEE201A804
2854:10B2500008003CBF8EE201A88EE40E1400042140D9
2855:10B26000008018218EE404608EE5046400A3282188
2856:10B2700000A3302B0082202100862021ACE40000B6
2857:10B28000ACE500048EE30E1400091140A4E2000EA8
2858:10B2900024020002ACE200180003194024630E20CF
2859:10B2A00002E31021ACE200088EE20E14ACE2001CB6
2860:10B2B0008EE204CCACE20010AF88010092E204EC14
2861:10B2C00014400011240400018EE24E2824030040A3
2862:10B2D0002442000150430003000010218EE24E285A
2863:10B2E00024420001AEE24E288EE24E28000210C039
2864:10B2F00024424E3802E2182124020002AC6200000F
2865:10B3000024020001AC6200041480000E24030040FB
2866:10B310008EE20E14AFA200108EE20E183C0500075C
2867:10B32000AFA200148EE60E0C8EE70E103C04000156
2868:10B33000248458D40C00240334A5F00108003CDD1B
2869:10B34000000000008EE2050024420001504300038B
2870:10B35000000010218EE2050024420001AEE205004B
2871:10B360008EE205000002108000571021AC4905084C
2872:10B370008EE20E1400491021304201FFAEE20E149D
2873:10B380008EE30E148EE20E0C146200050000000025
2874:10B390008F8200602403FDFF00431024AF82006011
2875:10B3A0008FBF001803E0000827BD002027BDFFE085
2876:10B3B000AFBF00188EE3523C8EE252381062007428
2877:10B3C000000000008EE352388EE2523C00622023DF
2878:10B3D00004820001248401008EE352448EE2523C38
2879:10B3E0000043102B14400004240201008EE3523C61
2880:10B3F00008003CFF004318238EE252448EE3523C87
2881:10B40000004310232443FFFF008048210069102AD5
2882:10B4100054400001006048218F87010027623000FE
2883:10B4200024E800200102102B50400001276828006A
2884:10B430008F82010811020004000000008F820104C5
2885:10B4400015020007000010218EE201A80000202153
2886:10B4500024420001AEE201A808003D418EE201A8AD
2887:10B460008EE4523C00042140008018218EE40470D8
2888:10B470008EE5047400A3282100A3302B0082202134
2889:10B4800000862021ACE40000ACE500048EE3523CD1
2890:10B4900000091140A4E2000E24020003ACE20018EF
2891:10B4A000000319402463524802E31021ACE2000873
2892:10B4B0008EE2523CACE2001C8EE204CCACE2001006
2893:10B4C000AF88010092E204EC144000112404000152
2894:10B4D0008EE24E2824030040244200015043000322
2895:10B4E000000010218EE24E2824420001AEE24E28D8
2896:10B4F0008EE24E28000210C024424E3802E218218B
2897:10B5000024020003AC62000024020001AC620004CB
2898:10B510001480000E240300408EE2523CAFA20010C3
2899:10B520008EE252443C050007AFA200148EE652386A
2900:10B530008EE752403C040001248458E00C002403B0
2901:10B5400034A5F01008003D5F000000008EE2050009
2902:10B550002442000150430003000010218EE2050048
2903:10B5600024420001AEE205008EE2050000021080D8
2904:10B5700000571021AC4905088EE2523C00491021C9
2905:10B58000304200FFAEE2523C8EE3523C8EE2523833
2906:10B5900014620005000000008F8200602403FEFF9B
2907:10B5A00000431024AF8200608FBF001803E0000842
2908:10B5B00027BD00208F8201208EE34E348F8201242C
2909:10B5C0008F8601282402004024630001506200039A
2910:10B5D000000010218EE24E3424420001AEE24E34CF
2911:10B5E0008EE24E348EE44E348EE34E30000210C0B4
2912:10B5F000244250381483000702E228218F82012858
2913:10B6000024420020AF8201288F82012808003D9249
2914:10B61000ACA000008EE24E3424030040244200011E
2915:10B6200050430003000010218EE24E3424420001FA
2916:10B63000000210C02442503802E228218CA20004EB
2917:10B640008F8301280002114000621821AF83012876
2918:10B65000ACA000008CC200182443FFFE2C62001234
2919:10B6600010400008000310803C0100010022082166
2920:10B670008C2258F000400008000000002402000165
2921:10B68000AEE24E2403E000080000000027BDFFC822
2922:10B69000AFBF0030AFB5002CAFB40028AFB300246B
2923:10B6A000AFB20020AFB1001CAFB000188F830128EB
2924:10B6B0008F820124106202B0000098213C11001F0B
2925:10B6C0003631FFFF3C12FFF53652100024150012F0
2926:10B6D000241400408F8C01288F82012824420020EE
2927:10B6E000AF8201289182001B8F8301282443FFFE33
2928:10B6F0002C6200121040029C000310803C010001EB
2929:10B70000002208218C225948004000080000000057
2930:10B710008F42021830420100104000070000000074
2931:10B720009583001695820018006218230003140206
2932:10B7300000431021A58200168D82001C3C0380006E
2933:10B740003044FFFF004368243C03080000431824F2
2934:10B7500011A00004AD84001C0004114008003DD875
2935:10B76000244252480004114024420E2002E2582193
2936:10B770009562000E3042FFFC10600004A562000ECE
2937:10B780009584001608003EC0000000008D69001876
2938:10B7900000004021952A000025290002952700007D
2939:10B7A0002529000295260000252900029525000084
2940:10B7B0002529000295240000252900029523000078
2941:10B7C0002529000295220000252900020147502169
2942:10B7D000014650210145502101445021014350218F
2943:10B7E00001425021000A1C023142FFFF0062502139
2944:10B7F000000A1C023142FFFF0062502196E2046AF7
2945:10B80000314EFFFF30420002104000440000502142
2946:10B81000252200140222102B1040001401201821B0
2947:10B820002405000A000020210223102B54400001AF
2948:10B8300000721821946200002463000224A5FFFF17
2949:10B8400014A0FFF90082202100041C023082FFFFB7
2950:10B8500000622021000414023083FFFF0043102106
2951:10B860003042FFFF08003E3301425021952A00007C
2952:10B8700025290002952800002529000295270000AF
2953:10B8800025290002952600002529000295250000A3
2954:10B890002529000295230000252900029522000099
2955:10B8A0002529000295240000252900020148502185
2956:10B8B00001475021014650210145502101435021AB
2957:10B8C000014250219522000095230002014450219D
2958:10B8D0000142502101435021000A1C023142FFFF66
2959:10B8E00000625021000A1C023142FFFF0062502119
2960:10B8F0003148FFFF510000013408FFFF8D6200183E
2961:10B900009443000C2402080054620005A56800104E
2962:10B910009562000E34420002A562000EA568001078
2963:10B9200096E2046A000028213042000814400056C4
2964:10B93000000030218D630018246200240222102BA5
2965:10B9400010400034246900100229102B54400001DB
2966:10B950000132482195250000246900140229102B8A
2967:10B960001040000224A5FFEC01324821952200007E
2968:10B9700030420FFF144000032529000208003E60FA
2969:10B98000241300010000982100A030210229102B6F
2970:10B990005440000101324821912200012529000272
2971:10B9A00000A228210229102B544000010132482115
2972:10B9B000252900020229102B5440000101324821A0
2973:10B9C000952200002529000200A228210229102B1F
2974:10B9D000544000010132482195220000252900022F
2975:10B9E00000A228210229102B5440000101324821D5
2976:10B9F000952200002529000200A228210229102BEF
2977:10BA000054400001013248219522000008003E996F
2978:10BA100000A2282194650010946200142469001685
2979:10BA200030420FFF1440000324A5FFEC08003E8CB9
2980:10BA3000241300010000982100A03021912300016F
2981:10BA400025290004952200002529000295240000E4
2982:10BA50002529000200A3282100A228219522000008
2983:10BA60009523000200A4282100A2282100A3282158
2984:10BA700000051C0230A2FFFF0062282100051C0205
2985:10BA800030A2FFFF0062282196E2046A30420001E2
2986:10BA90001040001E0000202195820016004E202339
2987:10BAA0000004140200822021326200FF5040000294
2988:10BAB000008620210085202100041402008220211C
2989:10BAC0003084FFFF508000013404FFFF8D620018B6
2990:10BAD000244300170223102B544000010072182148
2991:10BAE00090620000384300112C63000138420006C8
2992:10BAF0002C420001006218251060000400000000C4
2993:10BB00009562000E34420001A562000E9562000E9F
2994:10BB1000240A00023042000410400002A564001212
2995:10BB2000240A00048F88012027623800250900209C
2996:10BB30000122102B50400001276930008F8201281C
2997:10BB400011220004000000008F820124152200074A
2998:10BB5000240400208EE201A4000080212442000180
2999:10BB6000AEE201A408003F4F8EE201A48EE5724CC4
3000:10BB70008EE604908EE70494AD0B0008A504000E39
3001:10BB8000AD0A00180005294000A01821000010216E
3002:10BB900000E3382100E3202B00C2302100C4302113
3003:10BBA000AD060000AD0700048EE2724C004D10257A
3004:10BBB000AD02001C8EE204C4AD020010AF8901206A
3005:10BBC00092E24E2014400060241000012543FFEE55
3006:10BBD0002C630002394200112C420001006218253A
3007:10BBE00010600024000000008EE24E30000210C001
3008:10BBF0002442503802E220218C8200001455000FAC
3009:10BC0000000000008EE34E308EE24E341062000BD6
3010:10BC1000000000008C82000424420001AC82000479
3011:10BC20008EE24E348EE34E30244200011054002B3D
3012:10BC30000000000008003F2E000000008EE24E30A1
3013:10BC40002442000150540003000010218EE24E30C7
3014:10BC500024420001AEE24E308EE24E30000210C0AF
3015:10BC60002442503802E220212402000108003F4E05
3016:10BC7000AC9500008EE24E30000210C024425038D5
3017:10BC800002E220218C830000240200071462001FBE
3018:10BC9000000000008EE34E308EE24E341062001B36
3019:10BCA000000000008C82000424420001AC820004E9
3020:10BCB0008EE24E348EE34E302442000110540007D1
3021:10BCC000000000008EE24E342442000110620005A4
3022:10BCD0000000000008003F3A00000000146000056A
3023:10BCE000000000008F82012824420020AF8201283A
3024:10BCF0008F8201288C8200042C42001150400012D7
3025:10BD0000AC80000008003F4F000000008EE24E3083
3026:10BD10002442000150540003000010218EE24E30F6
3027:10BD200024420001AEE24E308EE24E30000210C0DE
3028:10BD30002442503802E2202124020007AC82000095
3029:10BD400024020001AC8200041600000D0000000077
3030:10BD50008F8201203C04000124845938AFA00014D4
3031:10BD6000AFA200108D86001C8F8701243C050008BF
3032:10BD70000C00240334A50001080040570000000017
3033:10BD80008EE2724C24420001304207FF11A00006EF
3034:10BD9000AEE2724C8EE201D02442FFFFAEE201D04F
3035:10BDA00008003F6B8EE201D08EE201CC2442FFFFFF
3036:10BDB000AEE201CC8EE201CC8EE201D82442FFFF3C
3037:10BDC000AEE201D8080040578EE201D88F4202400F
3038:10BDD000104000E5000000008EE20E1C244200012D
3039:10BDE00008004057AEE20E1C9582001EAD82001C7A
3040:10BDF0008F42024010400072000000008EE20E1CD4
3041:10BE000024420001AEE20E1C8F4302400043102B7F
3042:10BE1000144000D5000000008F8301202762380005
3043:10BE20002466002000C2102B50400001276630001D
3044:10BE30008F82012810C20004000000008F820124BC
3045:10BE400014C20007000000008EE201A4000080215F
3046:10BE500024420001AEE201A408003FDA8EE201A410
3047:10BE60008EE2724CAC62001C8EE404A88EE504AC39
3048:10BE70002462001CAC62000824020008A462000EC8
3049:10BE800024020011AC620018AC640000AC65000430
3050:10BE90008EE204C4AC620010AF86012092E24E2014
3051:10BEA00014400034241000018EE24E30000210C015
3052:10BEB0002442503802E220218C8200001455001FD9
3053:10BEC000000000008EE34E308EE24E341062001B04
3054:10BED000000000008C82000424420001AC820004B7
3055:10BEE0008EE24E348EE34E3024420001105400079F
3056:10BEF000000000008EE24E34244200011062000572
3057:10BF00000000000008003FC60000000014600005AB
3058:10BF1000000000008F82012824420020AF82012807
3059:10BF20008F8201288C8200042C42001150400011A5
3060:10BF3000AC80000008003FDA000000008EE24E30C6
3061:10BF40002442000150540003000010218EE24E30C4
3062:10BF500024420001AEE24E308EE24E30000210C0AC
3063:10BF60002442503802E2202124020001AC95000056
3064:10BF7000AC8200045600000B241000018EE2724CCB
3065:10BF80003C040001248458A8AFA00014AFA2001004
3066:10BF90008EE6724C8F4702803C0500090C0024039A
3067:10BFA00034A5F00856000001AEE00E1C8EE20188B8
3068:10BFB00024420001AEE20188080040508EE2018870
3069:10BFC0008F830120276238002466002000C2102BD6
3070:10BFD00050400001276630008F82012810C2000403
3071:10BFE000000000008F82012414C20007000000003E
3072:10BFF0008EE201A40000802124420001AEE201A4EF
3073:10C00000080040448EE201A48EE2724CAC62001C37
3074:10C010008EE404A88EE504AC2462001CAC62000827
3075:10C0200024020008A462000E24020011AC62001871
3076:10C03000AC640000AC6500048EE204C4AC62001085
3077:10C04000AF86012092E24E201440003424100001FB
3078:10C050008EE24E30000210C02442503802E220210D
3079:10C060008C8200001455001F000000008EE34E304B
3080:10C070008EE24E341062001B000000008C8200042F
3081:10C0800024420001AC8200048EE24E348EE34E3036
3082:10C090002442000110540007000000008EE24E34DC
3083:10C0A000244200011062000500000000080040303A
3084:10C0B0000000000014600005000000008F820128CD
3085:10C0C00024420020AF8201288F8201288C82000444
3086:10C0D0002C42001150400011AC8000000800404488
3087:10C0E000000000008EE24E30244200015054000354
3088:10C0F000000010218EE24E3024420001AEE24E30AC
3089:10C100008EE24E30000210C02442503802E220215C
3090:10C1100024020001AC950000AC8200041600000B64
3091:10C12000000000008EE2724C3C040001248458A8F8
3092:10C13000AFA00014AFA200108EE6724C8F470280B1
3093:10C140003C0500090C00240334A5F0088EE20174BC
3094:10C1500024420001AEE20174080040578EE20174EF
3095:10C1600024020001AEE24E248F8301288F82012435
3096:10C170001462FD58000000008FBF00308FB5002C06
3097:10C180008FB400288FB300248FB200208FB1001C21
3098:10C190008FB0001803E0000827BD003827BDFFE876
3099:10C1A000278402082745020024060008AFBF0014B8
3100:10C1B0000C00249AAFB000100000202124100001D0
3101:10C1C0002402241FAF900210AF900200AF8002043F
3102:10C1D000AF8202148F460248240300043C02004050
3103:10C1E0003C010001AC235CC43C010001AC235CC8F1
3104:10C1F0003C010001AC205D9C3C010001AC225CC014
3105:10C200003C010001AC235CC80C005108240500046B
3106:10C210000C004822000000008EE200003C03FEFFFC
3107:10C220003463FFFD00431024AEE200003C023C00FA
3108:10C23000AF82021C3C01000100370821AC3083AC06
3109:10C240008FBF00148FB0001003E0000827BD001856
3110:10C2500027BDFFE03C05000834A50400AFBF00186F
3111:10C26000AFA00010AFA000148F8602003C040001B4
3112:10C27000248459F00C002403000038218EE202804F
3113:10C2800024420001AEE202808EE202808F8302002F
3114:10C290003C023F00006218248FBF00183C020400DB
3115:10C2A00003E0000827BD002027BDFFD8AFBF002056
3116:10C2B000AFB1001CAFB000188F9002208EE20214C4
3117:10C2C0000000382124420001AEE202148EE2021482
3118:10C2D0003C02030002021024104000273C1104001D
3119:10C2E0000C00429B000000003C02010002021024EE
3120:10C2F00010400007000000008EE2021824420001F6
3121:10C30000AEE202188EE20218080040C63C03FDFFB0
3122:10C310008EE2021C24420001AEE2021C8EE2021CEC
3123:10C320003C03FDFF3463FFFF3C0808FF3508FFFFB7
3124:10C330008EE200003C040001248459FC3C05000806
3125:10C340000200302100431024AEE200008F82022060
3126:10C35000000038213C03030000481024004310254E
3127:10C36000AF820220AFA000100C002403AFA0001485
3128:10C370000800429600000000021110241040001F27
3129:10C380003C0240008F830224240214021462000B3A
3130:10C390003C03FDFF3C04000124845A083C050008CE
3131:10C3A000AFA00010AFA000148F86022434A5FFFFB9
3132:10C3B0000C002403000038213C03FDFF8EE2000046
3133:10C3C0003463FFFF02002021004310240C004E5470
3134:10C3D000AEE200008EE2022024420001AEE2022022
3135:10C3E0008EE202208F8202203C0308FF3463FFFFAD
3136:10C3F0000043102408004295005110250202102429
3137:10C4000010400142000000008EE2022C2442000194
3138:10C41000AEE2022C8EE2022C8F8202203C0308FF47
3139:10C420003463FFFF0043102434420004AF82022033
3140:10C430008F8300548F8200540800410E2463000251
3141:10C440008F820054006210232C4200031440FFFC32
3142:10C45000000000008F8600E08F8400E430C20007F7
3143:10C4600010400012000000008F8300E42402FFF857
3144:10C4700000C210241043000D000000008F82005401
3145:10C480008F8300E014C30009244400508F820054BD
3146:10C49000008210232C4200511040000400000000D4
3147:10C4A0008F8200E010C2FFF9000000008F8202209E
3148:10C4B0003C0308FF3463FFFD00431024AF820220D9
3149:10C4C0008F8600E030C20007104000032402FFF80E
3150:10C4D00000C23024AF8600E08F8300C43C02001FFE
3151:10C4E0003442FFFF246800080048102B104000036E
3152:10C4F0003C02FFF534421000010240218F8B00C83E
3153:10C500008F8501208F8401240800414500006021AF
3154:10C51000276238000082102B504000012764300051
3155:10C5200010A40010318200FF8C82001838430007ED
3156:10C530002C6300013842000B2C42000100621825D8
3157:10C540005060FFF3248400208EE20240240C00019E
3158:10C5500024420001AEE202408EE202408C8B0008D1
3159:10C56000318200FF14400065000000003C02000121
3160:10C5700000571021904283C014400060000000006A
3161:10C580008F8400E400C41023000218C30462000179
3162:10C59000246302008F8900C410600005240200019A
3163:10C5A0001062000900000000080041870000000040
3164:10C5B0008EE202300120582124420001AEE2023016
3165:10C5C000080041BC8EE202308EE202343C05000AD3
3166:10C5D00024420001AEE202348C8B000034A5F0004E
3167:10C5E0008EE20234012B182300A3102B54400001CB
3168:10C5F000006518212C62233F144000400000000019
3169:10C600008F8200E824420008AF8200E88F8200E8B1
3170:10C610008F8200E40120582124420008AF8200E408
3171:10C62000080041BC8F8200E48EE202383C03000A1D
3172:10C6300024420001AEE202388C8400003463F00032
3173:10C640008EE20238008838230067102B5440000126
3174:10C6500000E338213C02000334420D400047102B18
3175:10C660001040000300000000080041BC0080582179
3176:10C670008F8200E424440008AF8400E48F8400E447
3177:10C68000108600183C05000A34A5F0003C0A00039F
3178:10C69000354A0D408EE2007C24420001AEE2007C6F
3179:10C6A0008C8300008EE2007C0068382300A7102BEA
3180:10C6B0005440000100E538210147102B5440000789
3181:10C6C000006058218F8200E424440008AF8400E415
3182:10C6D0008F8400E41486FFEF00000000148600053C
3183:10C6E0000000000001205821AF8600E4080041BC92
3184:10C6F000AF8600E8AF8400E4AF8400E88F8200C812
3185:10C700003C03000A3463F000004838230067102B14
3186:10C710005440000100E338213C02000334420D3F45
3187:10C720000047102B544000070000602101683823A7
3188:10C730000067102B5440000300E33821080041CF6C
3189:10C740003C0200033C02000334420D3F0047102B23
3190:10C7500014400016318200FF144000060000000063
3191:10C760003C02000100571021904283C01040000F8E
3192:10C77000000000008EE2023C3C04FDFF8EE300005E
3193:10C780003484FFFF24420001AEE2023C8EE2023C10
3194:10C7900024020001006418243C0100010037082134
3195:10C7A000A02283B80800422CAEE30000AF8B00C883
3196:10C7B0008F8300C88F8200C43C04000A3484F000D8
3197:10C7C000006238230087102B5440000100E4382118
3198:10C7D0003C02000334420D400047102B2CE30001C3
3199:10C7E0000043102510400008000000008F82022046
3200:10C7F0003C0308FF3463FFFF004310243C03400068
3201:10C8000000431025AF8202208F8600E08F8400E471
3202:10C8100010C4002A000000008EE2007C24420001C7
3203:10C82000AEE2007C8EE2007C24C2FFF8AF8200E022
3204:10C830003C0200018C427E303C0300088F8600E001
3205:10C84000004310241040001D0000000010C4001B15
3206:10C85000240DFFF83C0A000A354AF0003C0C008029
3207:10C86000248500082762280050A2000127651800CF
3208:10C870008C8800048C8200008CA900003103FFFF2B
3209:10C8800000431021004D102424430010006B102B96
3210:10C8900054400001006A1821012B102B5440000164
3211:10C8A000012A482110690002010C1025AC82000405
3212:10C8B00000A0202114C4FFEB248500088F820220F1
3213:10C8C0003C0308FF3463FFFF00431024344200029E
3214:10C8D000AF8202208F8300548F82005408004237B9
3215:10C8E000246300018F820054006210232C42000256
3216:10C8F0001440FFFC000000008F8202203C0308FF70
3217:10C900003463FFFB00431024AF8202200601005570
3218:10C91000000000008EE2022824420001AEE202285C
3219:10C920008EE202288F8202203C0308FF3463FFFF5F
3220:10C930000043102434420004AF8202208F8300544D
3221:10C940008F82005408004251246300028F820054F9
3222:10C95000006210232C4200031440FFFC0000000082
3223:10C960008F8600E030C20007104000120000000077
3224:10C970008F8300E42402FFF800C210241043000D4E
3225:10C98000000000008F8200548F8300E014C3000970
3226:10C99000244400328F820054008210232C42003342
3227:10C9A00010400004000000008F8200E010C2FFF978
3228:10C9B000000000008F8202203C0308FF3463FFFD6B
3229:10C9C00000431024AF8202208F8600E030C20007AF
3230:10C9D000104000032402FFF800C23024AF8600E0BC
3231:10C9E000240301F58F8200E800673823000718C090
3232:10C9F00000431021AF8200E88F8200E8AF8200E49C
3233:10CA00008EE2007C3C0408FF3484FFFF00471021C5
3234:10CA1000AEE2007C8F8202203C038000346300027F
3235:10CA20000044102400431025AF8202208F8300545D
3236:10CA30008F8200540800428D246300018F820054CD
3237:10CA4000006210232C4200021440FFFC0000000092
3238:10CA50008F8202203C0308FF3463FFFB0043102455
3239:10CA6000AF8202208FBF00208FB1001C8FB0001852
3240:10CA700003E0000827BD00283C0200018C425CD87E
3241:10CA800027BDFFD810400012AFBF00203C040001BA
3242:10CA900024845A143C050008240200013C010001D2
3243:10CAA00000370821AC2283ACAFA00010AFA0001467
3244:10CAB0008F86022034A504983C010001AC205CD88C
3245:10CAC0003C010001AC225CCC0C00240300003821A6
3246:10CAD0008F4202683C037FFF3463FFFF0043102452
3247:10CAE000AF4202688EE204D08EE404D42403FFFE39
3248:10CAF00000431024308400021080011EAEE204D0F6
3249:10CB00008EE204D42403FFFD00431024AEE204D4DB
3250:10CB10008F8200443C03060034632000344200202E
3251:10CB2000AF820044AFA300188EE206088F430228AC
3252:10CB300024420001304A00FF514300FEAFA0001024
3253:10CB40008EE20608000210C0005710218FA30018C3
3254:10CB50008FA4001CAC43060CAC4406108F83005419
3255:10CB60008F82005424690032012210232C420033AA
3256:10CB70001040006A0000582124180008240F000DFE
3257:10CB8000240D0007240C0040240E00018F87012093
3258:10CB90002762380024E800200102102B50400001D9
3259:10CBA000276830008F820128110200040000000075
3260:10CBB0008F82012415020007000010218EE201A4DB
3261:10CBC0000000282124420001AEE201A40800433DF8
3262:10CBD0008EE201A48EE40608000420C00080182123
3263:10CBE0008EE404308EE5043400A3282100A3302B0A
3264:10CBF0000082202100862021ACE40000ACE5000486
3265:10CC00008EE20608A4F8000EACEF0018ACEA001C97
3266:10CC1000000210C02442060C02E21021ACE200081F
3267:10CC20008EE204C4ACE20010AF88012092E24E20F4
3268:10CC300014400033240500018EE24E30000210C083
3269:10CC40002442503802E220218C820000144D001F43
3270:10CC5000000000008EE34E308EE24E341062001B66
3271:10CC6000000000008C82000424420001AC82000419
3272:10CC70008EE24E348EE34E3024420001104C000709
3273:10CC8000000000008EE24E342442000110620005D4
3274:10CC9000000000000800432A0000000014600005A6
3275:10CCA000000000008F82012824420020AF8201286A
3276:10CCB0008F8201288C8200042C4200115040001009
3277:10CCC000AC8000000800433D000000008EE24E30C2
3278:10CCD00024420001504C0003000010218EE24E302F
3279:10CCE00024420001AEE24E308EE24E30000210C00F
3280:10CCF0002442503802E22021AC8D0000AC8E0004AA
3281:10CD000054A00006240B00018F820054012210233E
3282:10CD10002C4200331440FF9D00000000316300FFEF
3283:10CD20002402000154620079AFA00010AEEA0608A8
3284:10CD30008F8300548F820054246900320122102313
3285:10CD40002C4200331040006100005821240D0008DF
3286:10CD5000240C00112408001224070040240A0001BA
3287:10CD60008F830120276238002466002000C2102B28
3288:10CD700050400001276630008F82012810C2000455
3289:10CD8000000000008F82012414C200070000000090
3290:10CD90008EE201A40000282124420001AEE201A499
3291:10CDA000080043A98EE201A48EE20608AC62001CD2
3292:10CDB0008EE404A08EE504A42462001CAC6200088A
3293:10CDC000A46D000EAC6C0018AC640000AC650004EF
3294:10CDD0008EE204C4AC620010AF86012092E24E20C5
3295:10CDE00014400033240500018EE24E30000210C0D2
3296:10CDF0002442503802E220218C8200001448001F97
3297:10CE0000000000008EE34E308EE24E341062001BB4
3298:10CE1000000000008C82000424420001AC82000467
3299:10CE20008EE24E348EE34E3024420001104700075C
3300:10CE3000000000008EE24E34244200011062000522
3301:10CE40000000000008004396000000001460000588
3302:10CE5000000000008F82012824420020AF820128B8
3303:10CE60008F8201288C8200042C4200115040001057
3304:10CE7000AC800000080043A9000000008EE24E30A4
3305:10CE80002442000150470003000010218EE24E3082
3306:10CE900024420001AEE24E308EE24E30000210C05D
3307:10CEA0002442503802E22021AC880000AC8A000401
3308:10CEB00054A00006240B00018F820054012210238D
3309:10CEC0002C4200331440FFA600000000316300FF35
3310:10CED0002402000154620003AFA00010080043D6F2
3311:10CEE000000000003C04000124845A20AFA000147C
3312:10CEF0008F8601208F8701243C0500090C00240344
3313:10CF000034A5F011080043D6000000003C040001E5
3314:10CF100024845A2CAFA000148F8601208F8701240F
3315:10CF20003C0500090C00240334A5F010080043D68A
3316:10CF3000000000003C04000124845A38AFA0001413
3317:10CF40008EE606088F4702283C0500090C002403E2
3318:10CF500034A5F00F8EE201AC24420001AEE201AC38
3319:10CF60008EE201AC8EE2015C24420001AEE2015C83
3320:10CF70008EE2015C8FBF002003E0000827BD00287F
3321:10CF80003C0200018C425CD827BDFFE01440000D3C
3322:10CF9000AFBF00183C04000124845A443C0500083B
3323:10CFA000AFA00010AFA000148F86022034A5049912
3324:10CFB000240200013C010001AC225CD80C002403D7
3325:10CFC000000038218EE204D03C03000100771821D4
3326:10CFD000946383B23442000110600007AEE204D0D3
3327:10CFE0008F8202203C0308FF3463FFFF00431024BC
3328:10CFF00034420008AF820220000020210C0052A21F
3329:10D0000024050004AF4202688FBF001803E0000847
3330:10D0100027BD00200000000000000000000000000C
3331:10D020000000000000000000000000000000000000
3332:10D0300000000000000000000000000000000000F0
3333:10D0400000000000000000000000000000000000E0
3334:10D0500000000000000000000000000000000000D0
3335:10D0600000000000000000000000000000000000C0
3336:10D0700000000000000000000000000000000000B0
3337:10D0800000000000000000000000000000000000A0
3338:10D090000000000000000000000000000000000090
3339:10D0A0000000000000000000000000000000000080
3340:10D0B0000000000000000000000000000000000070
3341:10D0C0000000000000000000000000000000000060
3342:10D0D0000000000000000000000000000000000050
3343:10D0E0000000000000000000000000000000000040
3344:10D0F0000000000000000000000000000000000030
3345:10D100000000000000000000000000003C120001D0
3346:10D11000265212003C1400018E945C503C10000119
3347:10D12000261011203C15C00036B500608E8A000024
3348:10D130008EB30000026A400B0248000A0200F82188
3349:10D14000000000000000000D0000000000000000D2
3350:10D1500000000000000000000000000000000000CF
3351:10D1600000000000000000000000000000000000BF
3352:10D1700000000000000000000000000000000000AF
3353:10D18000000000000000000000000000000000009F
3354:10D19000000000000000000000000000000000008F
3355:10D1A000000000000000000000000000000000007F
3356:10D1B000000000000000000000000000000000006F
3357:10D1C000000000000000000000000000000000005F
3358:10D1D000000000000000000000000000000000004F
3359:10D1E000000000000000000000000000000000003F
3360:10D1F000000000000000000000000000000000002F
3361:10D20000000000000000000000000000080014D62C
3362:10D2100000000000080014D83C0A0001080014D8DF
3363:10D220003C0A0002080014D800000000080024A6F0
3364:10D2300000000000080014D83C0A0003080014D8BD
3365:10D240003C0A000408002F8C00000000080014D8DD
3366:10D250003C0A000508003CE80000000008003C66AD
3367:10D2600000000000080014D83C0A0006080014D88A
3368:10D270003C0A0007080014D800000000080014D879
3369:10D2800000000000080014D80000000008002A7503
3370:10D2900000000000080014D83C0A000B080014D855
3371:10D2A0003C0A000C080014D83C0A000D0800237A40
3372:10D2B000000000000800233900000000080014D816
3373:10D2C0003C0A000E08001B3C00000000080024A4DB
3374:10D2D00000000000080014D83C0A000F080040A716
3375:10D2E000000000000800409100000000080014D871
3376:10D2F0003C0A0010080014EE00000000080014D8DA
3377:10D300003C0A0011080014D83C0A0012080014D886
3378:10D310003C0A0013000000000000000000000000B4
3379:10D3200000000000000000000000000000000000FD
3380:10D3300000000000000000000000000000000000ED
3381:10D3400000000000000000000000000000000000DD
3382:10D3500000000000000000000000000000000000CD
3383:10D3600000000000000000000000000000000000BD
3384:10D3700000000000000000000000000000000000AD
3385:10D38000000000000000000000000000000000009D
3386:10D39000000000000000000000000000000000008D
3387:10D3A000000000000000000000000000000000007D
3388:10D3B000000000000000000000000000000000006D
3389:10D3C000000000000000000000000000000000005D
3390:10D3D000000000000000000000000000000000004D
3391:10D3E000000000000000000000000000000000003D
3392:10D3F000000000000000000000000000000000002D
3393:10D400000000000000000000000000003C030001DC
3394:10D4100034633800240500802404001F2406FFFF25
3395:10D4200024020001AF80021CAF820200AF82022002
3396:10D4300003631021AF8200C003631021AF8200C4D8
3397:10D4400003631021AF8200C827623800AF8200D08A
3398:10D4500027623800AF8200D427623800AF8200D83C
3399:10D4600027621800AF8200E027621800AF8200E454
3400:10D4700027621800AF8200E827621000AF8200F038
3401:10D4800027621000AF8200F427621000AF8200F81C
3402:10D49000ACA000002484FFFF1486FFFD24A5000437
3403:10D4A0008F8300403C02F000006218243C025000D0
3404:10D4B0001062000C0043102B144000063C02600078
3405:10D4C0003C024000106200082402080008004539B0
3406:10D4D0000000000010620004240208000800453922
3407:10D4E00000000000240207003C010001AC225CDCCB
3408:10D4F00003E000080000000027BDFFD8AFBF0024F4
3409:10D50000AFB000208F8300548F8200543C01000193
3410:10D51000AC205CC408004545246300648F8200543D
3411:10D52000006210232C4200651440FFFC0000000044
3412:10D530000C004D71000000002404000100002821AF
3413:10D5400027A60018340280000C00498EA7A20018FC
3414:10D550008F8300548F820054080045562463006472
3415:10D560008F820054006210232C4200651440FFFC9F
3416:10D5700024040001240500010C00494C27A60018D2
3417:10D580008F8300548F820054080045622463006436
3418:10D590008F820054006210232C4200651440FFFC6F
3419:10D5A00024040001240500010C00494C27A60018A2
3420:10D5B0008F8300548F8200540800456E24630064FA
3421:10D5C0008F820054006210232C4200651440FFFC3F
3422:10D5D000240400013C06000124C65DA00C00494C57
3423:10D5E000240500028F8300548F8200540800457B7D
3424:10D5F000246300648F820054006210232C42006573
3425:10D600001440FFFC24040001240500033C10000129
3426:10D6100026105DA20C00494C0200302197A600188C
3427:10D620003C07000194E75DA03C04000124845AB04B
3428:10D63000AFA00014960200003C05000D34A50100C7
3429:10D640000C002403AFA2001097A200181040004C59
3430:10D6500024036040960200003042FFF01443000AA9
3431:10D66000240200203C03000194635DA05462000981
3432:10D6700024027830240200033C010001AC225CC487
3433:10D68000080045AC240200053C03000194635DA042
3434:10D69000240278301462000F240300103C020001C1
3435:10D6A00094425DA23042FFF01443000A24020003BA
3436:10D6B0003C010001AC225CC4240200063C010001D4
3437:10D6C000AC225DB03C010001AC225DBC080045E627
3438:10D6D0003C09FFF03C0200018C425CC43C030001A9
3439:10D6E00094635DA0344200013C010001AC225CC4A3
3440:10D6F000240200151462000F000000003C0200012B
3441:10D7000094425DA23042FFF03843F4202C630001C4
3442:10D710003842F4302C4200010062182510600005E8
3443:10D72000240200033C010001AC225DBC080045E678
3444:10D730003C09FFF03C03000194635DA024027810D3
3445:10D740001462000B240200023C02000194425DA21C
3446:10D750003042FFF0144000062402000224020004BC
3447:10D760003C010001AC225DBC080045E63C09FFF02D
3448:10D770003C010001AC225DBC080045E63C09FFF01D
3449:10D780003C0200018C425CC4240300013C01000106
3450:10D79000AC235DBC344200043C010001AC225CC4FB
3451:10D7A0003C09FFF03529BDC03C0600018CC65CC4B5
3452:10D7B0003C04000124845AB0240200013C01000111
3453:10D7C000AC225CCC8F8200543C0700018CE75DBC2E
3454:10D7D0003C03000194635DA03C08000195085DA234
3455:10D7E0003C05000D34A501003C010001AC205CC8E3
3456:10D7F000004910213C010001AC225DACAFA3001038
3457:10D800000C002403AFA800148FBF00248FB00020A9
3458:10D8100003E0000827BD002827BDFFE83C05000104
3459:10D820008CA55CC8240600042402000114A2001484
3460:10D83000AFBF00103C0200018C427E3C30428000B1
3461:10D84000104000053C04000F3C0300018C635DBCEC
3462:10D8500008004617348442403C0400043C030001A5
3463:10D860008C635DBC348493E02402000514620016CE
3464:10D87000000000003C04003D0800462F34840900ED
3465:10D880003C0200018C427E3830428000104000058E
3466:10D890003C04001E3C0300018C635DBC0800462A6A
3467:10D8A000348484803C04000F3C0300018C635DBC25
3468:10D8B000348442402402000514620003000000008A
3469:10D8C0003C04007A348412003C0200018C425DACBE
3470:10D8D0008F83005400441021004310230044102B78
3471:10D8E00014400037000000003C0200018C425CD074
3472:10D8F00014400033000000003C01000110C000256E
3473:10D90000AC205CE03C0900018D295CC424070001C7
3474:10D910003C0440003C08000125087E3C250AFFFC31
3475:10D920000005284214A0000224C6FFFF24050008B9
3476:10D9300000A91024104000100000000014A70008E7
3477:10D94000000000008D020000004410241040000A76
3478:10D95000000000003C0100010800465BAC255CE0D3
3479:10D960008D4200000044102410400003000000001D
3480:10D970003C010001AC275CE03C0200018C425CE011
3481:10D980000006182B2C420001004310245440FFE5F0
3482:10D99000000528428F8200543C0300018C635CE048
3483:10D9A0003C010001AC225DAC1060002A24020001A1
3484:10D9B0003C010001AC255CC83C010001AC225CCC00
3485:10D9C0003C0200018C425CE010400022000000009C
3486:10D9D0003C0200018C425CCC1040000A2402000191
3487:10D9E0003C010001AC205CCC3C0100010037082167
3488:10D9F000AC2283AC3C010001AC205D4C3C01000139
3489:10DA0000AC225D043C030001007718218C6383ACD9
3490:10DA10002402000810620005240200010C00469553
3491:10DA20000000000008004692000000003C030001D6
3492:10DA30008C635CC8106200072402000E3C030001E6
3493:10DA40008C637DD010620003000000000C004E5477
3494:10DA50008F8402208FBF001003E0000827BD00184C
3495:10DA600027BDFFE03C02FDFFAFBF00188EE30000C2
3496:10DA70003C0500018CA55CC83C0400018C845CF072
3497:10DA80003442FFFF0062182414A40008AEE3000033
3498:10DA90003C030001007718218C6383AC3C02000139
3499:10DAA0008C425CF410620008000000003C0200019F
3500:10DAB000005710218C4283AC3C010001AC255CF086
3501:10DAC0003C010001AC225CF43C0300018C635CC8A7
3502:10DAD00024020002106201692C620003104000055C
3503:10DAE0002402000110620008000000000800481C29
3504:10DAF0000000000024020004106200B124020001B2
3505:10DB00000800481D000000003C02000100571021E1
3506:10DB10008C4283AC2443FFFF2C6200081040015A62
3507:10DB2000000310803C010001002208218C225AC809
3508:10DB300000400008000000003C0300018C635DBC55
3509:10DB40002402000514620014000000003C020001E1
3510:10DB50008C425CD41040000A240200030C004822CE
3511:10DB600000000000240200023C01000100370821EF
3512:10DB7000AC2283AC3C010001080046E0AC205CD440
3513:10DB80003C01000100370821AC2283AC3C010001BC
3514:10DB90000800481FAC205C600C0048220000000018
3515:10DBA0003C0200018C425CD43C010001AC205C6072
3516:10DBB000104000DD240200023C0100010037082172
3517:10DBC000AC2283AC3C0100010800481FAC205CD4AF
3518:10DBD0003C0300018C635DBC240200051462000359
3519:10DBE000240200013C010001AC225D000C0049CF81
3520:10DBF000000000003C0300018C635D000800478EBC
3521:10DC0000240200113C0500018CA55CC83C06000103
3522:10DC10008CC67E3C0C005108000020212402000527
3523:10DC20003C010001AC205CD43C010001003708211C
3524:10DC30000800481FAC2283AC3C04000124845ABC79
3525:10DC40003C05000F34A50100000030210000382100
3526:10DC5000AFA000100C002403AFA000140800481F60
3527:10DC6000000000008F8202203C03F70000431025D3
3528:10DC7000080047B7AF8202208F8202203C030004D5
3529:10DC800000431024144000A9240200078F8300548D
3530:10DC90003C0200018C425DA42463D8F000431023B1
3531:10DCA0002C422710144000F8240200010800481DEF
3532:10DCB000000000003C0500018CA55CC80C0052A2CD
3533:10DCC000000020210C005386000020213C030001AD
3534:10DCD0008C637E34046100EA240200013C020008E7
3535:10DCE0000062102410400006000000008F82021421
3536:10DCF0003C03FFFF00431024080047413442251F26
3537:10DD00008F8202143C03FFFF004310243442241F7F
3538:10DD1000AF8202148EE200003C0302000043102593
3539:10DD2000AEE200008F8202202403FFFB0043102498
3540:10DD3000AF8202208F82022034420002AF82022092
3541:10DD4000240200083C01000100370821AC2283AC0A
3542:10DD50008F8202203C03000400431024144000057D
3543:10DD6000000000008F8202203C03F70000431025D2
3544:10DD7000AF8202203C0300018C635DBC24020005DD
3545:10DD80001462000A000000003C02000194425DA2FF
3546:10DD900024429FBC2C4200041040000424040018BC
3547:10DDA000240500020C004D93240600200C0043DDE6
3548:10DDB000000000003C0100010800481FAC205D503D
3549:10DDC0003C020001005710218C4283AC2443FFFF2A
3550:10DDD0002C620008104000AC000310803C010001E0
3551:10DDE000002208218C225AE80040000800000000B0
3552:10DDF0000C00429B000000003C010001AC205CCC08
3553:10DE0000AF8002043C0100010C004822AC207E20BF
3554:10DE1000240200013C010001AC225CE42402000267
3555:10DE20003C010001003708210800481FAC2283ACE8
3556:10DE30000C00489F000000003C0300018C635CE480
3557:10DE40002402000914620090240200033C01000136
3558:10DE5000003708210800481FAC2283AC3C020001B7
3559:10DE60008C427E3830424000104000050000000027
3560:10DE70008F8200443C03FFFF0800479F34637FFF0D
3561:10DE80008F8200442403FF7F00431024AF820044AC
3562:10DE90008F830054080047B9240200048F83005484
3563:10DEA0003C0200018C425DA42463D8F0004310239F
3564:10DEB0002C42271014400074240200053C0100018C
3565:10DEC000003708210800481FAC2283AC8F82022053
3566:10DED0003C03F70000431025AF820220AF8002040C
3567:10DEE0003C010001AC207E208F83005424020006F8
3568:10DEF0003C01000100370821AC2283AC3C01000149
3569:10DF00000800481FAC235DA48F8300543C0200012D
3570:10DF10008C425DA42463FFF6004310232C42000AC8
3571:10DF20001440005900000000240200073C010001D9
3572:10DF3000003708210800481FAC2283AC8F820220E2
3573:10DF40003C04F70000441025AF8202208F8202209B
3574:10DF50003C03030000431024144000050000182176
3575:10DF60008F8202202403000100441025AF8202208A
3576:10DF700010600043240200018F8202143C03FFFF63
3577:10DF80003C0400018C845D98004310243442251F1A
3578:10DF9000AF820214240200083C010001003708216E
3579:10DFA0001080000BAC2283AC3C0200018C425D74FB
3580:10DFB00014400007240200013C010001AC227DD086
3581:10DFC0000C004E548F8402200800480C0000000012
3582:10DFD0008F8202203C0300080043102414400017E5
3583:10DFE0002402000E3C010001AC227DD08EE2000034
3584:10DFF000000020213C030200004310250C00538642
3585:10E00000AEE200008F8202202403FFFB00431024B5
3586:10E01000AF8202208F820220344200020C0043DDD6
3587:10E02000AF8202203C0500018CA55CC80C0052A206
3588:10E03000000020210800481F000000003C020001F1
3589:10E040008C425D7410400010000000003C02000192
3590:10E050008C425D702442FFFF3C010001AC225D70E8
3591:10E0600014400009240200023C010001AC205D7450
3592:10E070003C0100010800481FAC225D702402000131
3593:10E080003C010001AC225CCC8FBF001803E000080B
3594:10E0900027BD00208F8202008F8202208F82022003
3595:10E0A00034420004AF8202208F8202003C0600014D
3596:10E0B0008CC65CC834420004AF8202002402000215
3597:10E0C00010C2003A2CC200031040000524020001D7
3598:10E0D00010C20008000000000800486800000000AE
3599:10E0E0002402000410C20013240200010800486842
3600:10E0F000000000003C0300018C635CB83C0200019E
3601:10E100008C425CC03C0400018C845CDC3C0500015A
3602:10E110008CA55CBCAF860200AF860220346300226F
3603:10E1200000441025004510253442000208004867CD
3604:10E13000AF8302003C0300018C635D98AF82020054
3605:10E1400010600009AF8202203C0200018C425D7425
3606:10E15000144000053C033F003C0200018C425CB0CF
3607:10E160000800485B346300E03C0200018C425CB074
3608:10E170003C033F00346300E200431025AF820200FD
3609:10E180003C0300018C635CB43C04F7003C020001DA
3610:10E190008C425CC03C0500018CA55CDC0064182549
3611:10E1A0000043102500451025AF82022003E000083F
3612:10E1B000000000008F8202203C0300018C635CC8D9
3613:10E1C00034420004AF820220240200011062000FDA
3614:10E1D000000000008F8300548F82005424630002EB
3615:10E1E000006210232C4200031040001100000000C8
3616:10E1F0008F820054006210232C4200031040000C58
3617:10E200000000000008004879000000008F830054DF
3618:10E210008F82005408004885246300078F820054D1
3619:10E22000006210232C4200081440FFFC0000000094
3620:10E230008F8400E0308200071040000D00000000D5
3621:10E240008F8200548F8300E014830009244500323C
3622:10E250008F82005400A210232C420033104000048F
3623:10E26000000000008F8200E01082FFF90000000033
3624:10E270008F8202202403FFFD00431024AF8202207E
3625:10E2800003E00008000000003C0300018C635CE434
3626:10E290003C0200018C425CE8506200042463FFFFF2
3627:10E2A0003C010001AC235CE82463FFFF2C62000901
3628:10E2B0001040009D000310803C0100010022082155
3629:10E2C0008C225B0800400008000000008F820044A0
3630:10E2D00034428080AF8200448F8300540800493864
3631:10E2E000240200028F8300543C0200018C425DA88E
3632:10E2F0002463D8F0004310232C4227101440008AD6
3633:10E300002402000308004945000000008F820044F9
3634:10E310003C03FFFF34637FFF00431024AF820044BF
3635:10E320008F83005408004938240200048F8300546E
3636:10E330003C0200018C425DA82463FFF600431023D9
3637:10E340002C42000A144000782402000508004945C8
3638:10E35000000000008F8202203C03F70000431025DC
3639:10E36000AF8202208F8202202403FFFB004310248F
3640:10E37000AF8202208F82022034420002AF8202204C
3641:10E380003C023F00344200E0AF8202008F82020074
3642:10E390002403FFFD00431024AF8202002404000187
3643:10E3A0003405FFFFAF8402048F8300548F82005432
3644:10E3B000080048EC246300018F820054006210239F
3645:10E3C0002C4200021440FFFC000000008F82022457
3646:10E3D0000004204000A4102B1040FFF200000000B9
3647:10E3E0008F8202203C03F70000431025AF820220F9
3648:10E3F0008F8202143C03FFFF004310243442251F88
3649:10E40000AF8202148F8202202403FFFB00431024FA
3650:10E41000AF8202208F8202203C04F700348400087F
3651:10E4200034420002AF8202208F8202203C033F0070
3652:10E43000346300E200441025AF820220AF83020063
3653:10E440008F8400F0276217F81482000224850008E8
3654:10E45000276510008F8200F410A200073C038000A3
3655:10E46000346300403C02000124425C70AC82000036
3656:10E47000AC830004AF8500F08F8300540800493856
3657:10E48000240200068F8300543C0200018C425DA8E8
3658:10E490002463FFF6004310232C42000A144000229C
3659:10E4A0002402000708004945000000008F8200E0B8
3660:10E4B000AF8200E48F8200E0AF8200E88F8202200A
3661:10E4C00034420004AF8202208F8202202403FFF72F
3662:10E4D00000431024AF8202208F82004434428080A7
3663:10E4E000AF8200448F830054240200083C010001E5
3664:10E4F000AC225CE43C01000108004947AC235DA864
3665:10E500008F8300543C0200018C425DA82463D8F044
3666:10E51000004310232C42271014400003240200095A
3667:10E520003C010001AC225CE403E0000800000000B4
3668:10E5300000000000000000000000000027BDFFD820
3669:10E54000AFB2001800809021AFB3001C00A098214A
3670:10E55000AFB1001400C08821AFB0001000008021CE
3671:10E56000AFBF0020A62000000C004D4B240400018A
3672:10E57000261000012E0200201440FFFB00000000C6
3673:10E580000C004D4B000020210C004D4B24040001D9
3674:10E590000C004D4B240400010C004D4B00002021C9
3675:10E5A000241000100250102410400002000020210E
3676:10E5B000240400010C004D4B001080421600FFFAAD
3677:10E5C0000250102424100010027010241040000289
3678:10E5D00000002021240400010C004D4B001080425B
3679:10E5E0001600FFFA027010240C004D7134108000E8
3680:10E5F0000C004D71000000000C004D2B00000000CD
3681:10E600005040000500108042962200000050102566
3682:10E61000A6220000001080421600FFF70000000054
3683:10E620000C004D71000000008FBF00208FB3001C54
3684:10E630008FB200188FB100148FB0001003E00008F3
3685:10E6400027BD002827BDFFD8AFB100140080882166
3686:10E65000AFB2001800A09021AFB3001C00C09821F9
3687:10E66000AFB0001000008021AFBF00200C004D4B68
3688:10E6700024040001261000012E0200201440FFFB9C
3689:10E68000000000000C004D4B000020210C004D4B01
3690:10E69000240400010C004D4B000020210C004D4BC8
3691:10E6A0002404000124100010023010241040000245
3692:10E6B00000002021240400010C004D4B001080427A
3693:10E6C0001600FFFA0230102424100010025010240B
3694:10E6D0001040000200002021240400010C004D4BDA
3695:10E6E000001080421600FFFA025010240C004D4B1F
3696:10E6F000240400010C004D4B000020213410800048
3697:10E7000096620000005010241040000200002021FA
3698:10E71000240400010C004D4B001080421600FFF84D
3699:10E72000000000000C004D71000000008FBF0020B1
3700:10E730008FB3001C8FB200188FB100148FB000107F
3701:10E7400003E0000827BD00283C0300018C635D0046
3702:10E750003C0200018C425D4827BDFFD8AFBF0020BE
3703:10E76000AFB1001C10620003AFB000183C01000103
3704:10E77000AC235D482463FFFF2C6200131040034963
3705:10E78000000310803C010001002208218C225B3034
3706:10E7900000400008000000000C004D7100008021C6
3707:10E7A00034028000A7A2001027B100100C004D4BCE
3708:10E7B00024040001261000012E0200201440FFFB5B
3709:10E7C000000000000C004D4B000020210C004D4BC0
3710:10E7D000240400010C004D4B000020210C004D4B87
3711:10E7E0002404000124100010320200011040000235
3712:10E7F00000002021240400010C004D4B0010804239
3713:10E800001600FFFA32020001241000100C004D4BDC
3714:10E8100000002021001080421600FFFC00000000D4
3715:10E820000C004D4B240400010C004D4B0000202136
3716:10E830003410800096220000005010241040000286
3717:10E8400000002021240400010C004D4B00108042E8
3718:10E850001600FFF8000000000C004D7100000000E1
3719:10E8600008004D242402000227B10010A7A00010C8
3720:10E87000000080210C004D4B2404000126100001F3
3721:10E880002E0200201440FFFB000000000C004D4B46
3722:10E89000000020210C004D4B240400010C004D4BC6
3723:10E8A000240400010C004D4B000020212410001016
3724:10E8B0003202000110400002000020212404000167
3725:10E8C0000C004D4B001080421600FFFA320200018E
3726:10E8D000241000100C004D4B00002021001080423D
3727:10E8E0001600FFFC000000000C004D713410800089
3728:10E8F0000C004D71000000000C004D2B00000000CA
3729:10E900005040000500108042962200000050102563
3730:10E91000A6220000001080421600FFF70000000051
3731:10E920000C004D710000000097A2001030428000E2
3732:10E93000144002DC2402000308004D240000000003
3733:10E9400024021200A7A2001027B1001000008021AD
3734:10E950000C004D4B24040001261000012E02002063
3735:10E960001440FFFB000000000C004D4B0000202174
3736:10E970000C004D4B240400010C004D4B00002021E5
3737:10E980000C004D4B24040001241000103202000141
3738:10E990001040000200002021240400010C004D4B17
3739:10E9A000001080421600FFFA32020001241000100D
3740:10E9B0000C004D4B00002021001080421600FFFC8F
3741:10E9C000000000000C004D4B240400010C004D4BD6
3742:10E9D00000002021341080009622000000501024F6
3743:10E9E0001040000200002021240400010C004D4BC7
3744:10E9F000001080421600FFF8000000000C004D716E
3745:10EA0000000000008F83005408004D16240200040B
3746:10EA10008F8300543C0200018C425DB82463FF9C4C
3747:10EA2000004310232C4200641440029E2402000282
3748:10EA30003C0300018C635DBC106202972C620003F2
3749:10EA40001440029624020011240200031062000503
3750:10EA500024020004106202912402000F08004D24D9
3751:10EA60002402001108004D24240200052402001491
3752:10EA7000A7A2001027B10010000080210C004D4B10
3753:10EA800024040001261000012E0200201440FFFB88
3754:10EA9000000000000C004D4B000020210C004D4BED
3755:10EAA000240400010C004D4B000020210C004D4BB4
3756:10EAB0002404000124100010320200011040000262
3757:10EAC00000002021240400010C004D4B0010804266
3758:10EAD0001600FFFA32020001241000103202001268
3759:10EAE0001040000200002021240400010C004D4BC6
3760:10EAF000001080421600FFFA320200120C004D4B4B
3761:10EB0000240400010C004D4B000020213410800033
3762:10EB10009622000000501024104000020000202126
3763:10EB2000240400010C004D4B001080421600FFF839
3764:10EB3000000000000C004D71000000008F830054A5
3765:10EB400008004D16240200068F8300543C02000189
3766:10EB50008C425DB82463FF9C004310232C42006468
3767:10EB6000144002502402000708004D240000000059
3768:10EB700024020006A7A2001027B100100000802187
3769:10EB80000C004D4B24040001261000012E02002031
3770:10EB90001440FFFB000000000C004D4B0000202142
3771:10EBA0000C004D4B240400010C004D4B00002021B3
3772:10EBB0000C004D4B2404000124100010320200010F
3773:10EBC0001040000200002021240400010C004D4BE5
3774:10EBD000001080421600FFFA3202000124100010DB
3775:10EBE0003202001310400002000020212404000122
3776:10EBF0000C004D4B001080421600FFFA3202001349
3777:10EC00000C004D4B240400010C004D4B0000202152
3778:10EC100034108000962200000050102410400002A2
3779:10EC200000002021240400010C004D4B0010804204
3780:10EC30001600FFF8000000000C004D7100000000FD
3781:10EC40008F83005408004D16240200088F8300545F
3782:10EC50003C0200018C425DB82463FF9C00431023FA
3783:10EC60002C4200641440020F2402000908004D24C5
3784:10EC70000000000027B10010A7A0001000008021B4
3785:10EC80000C004D4B24040001261000012E02002030
3786:10EC90001440FFFB000000000C004D4B0000202141
3787:10ECA0000C004D4B240400010C004D4B24040001CA
3788:10ECB0000C004D4B000020212410001032020001F6
3789:10ECC0001040000200002021240400010C004D4BE4
3790:10ECD000001080421600FFFA3202000124100010DA
3791:10ECE000320200181040000200002021240400011C
3792:10ECF0000C004D4B001080421600FFFA3202001843
3793:10ED00000C004D71341080000C004D7100000000AB
3794:10ED10000C004D2B00000000504000050010804208
3795:10ED20009622000000501025A6220000001080420C
3796:10ED30001600FFF7000000000C004D71000080215C
3797:10ED400097A2001027B1001034420001A7A20010C2
3798:10ED50000C004D4B24040001261000012E0200205F
3799:10ED60001440FFFB000000000C004D4B0000202170
3800:10ED70000C004D4B240400010C004D4B00002021E1
3801:10ED80000C004D4B2404000124100010320200013D
3802:10ED90001040000200002021240400010C004D4B13
3803:10EDA000001080421600FFFA320200012410001009
3804:10EDB000320200181040000200002021240400014B
3805:10EDC0000C004D4B001080421600FFFA3202001872
3806:10EDD0000C004D4B240400010C004D4B0000202181
3807:10EDE00034108000962200000050102410400002D1
3808:10EDF00000002021240400010C004D4B0010804233
3809:10EE00001600FFF8000000000C004D71000000002B
3810:10EE10008F83005408004D162402000A8F8300548B
3811:10EE20003C0200018C425DB82463FF9C0043102328
3812:10EE30002C4200641440019B2402000B08004D2466
3813:10EE40000000000027B10010A7A0001000008021E2
3814:10EE50000C004D4B24040001261000012E0200205E
3815:10EE60001440FFFB000000000C004D4B000020216F
3816:10EE70000C004D4B240400010C004D4B24040001F8
3817:10EE80000C004D4B00002021241000103202000124
3818:10EE90001040000200002021240400010C004D4B12
3819:10EEA000001080421600FFFA320200012410001008
3820:10EEB000320200171040000200002021240400014B
3821:10EEC0000C004D4B001080421600FFFA3202001772
3822:10EED0000C004D71341080000C004D7100000000DA
3823:10EEE0000C004D2B00000000504000050010804237
3824:10EEF0009622000000501025A6220000001080423B
3825:10EF00001600FFF7000000000C004D71000080218A
3826:10EF100097A2001027B1001034420700A7A20010EA
3827:10EF20000C004D4B24040001261000012E0200208D
3828:10EF30001440FFFB000000000C004D4B000020219E
3829:10EF40000C004D4B240400010C004D4B000020210F
3830:10EF50000C004D4B2404000124100010320200016B
3831:10EF60001040000200002021240400010C004D4B41
3832:10EF7000001080421600FFFA320200012410001037
3833:10EF8000320200171040000200002021240400017A
3834:10EF90000C004D4B001080421600FFFA32020017A1
3835:10EFA0000C004D4B240400010C004D4B00002021AF
3836:10EFB00034108000962200000050102410400002FF
3837:10EFC00000002021240400010C004D4B0010804261
3838:10EFD0001600FFF8000000000C004D71000000005A
3839:10EFE0008F83005408004D162402000C8F830054B8
3840:10EFF0003C0200018C425DB82463FF9C0043102357
3841:10F000002C420064144001272402001208004D2401
3842:10F010000000000027B10010A7A000100000802110
3843:10F020000C004D4B24040001261000012E0200208C
3844:10F030001440FFFB000000000C004D4B000020219D
3845:10F040000C004D4B240400010C004D4B2404000126
3846:10F050000C004D4B00002021241000103202000152
3847:10F060001040000200002021240400010C004D4B40
3848:10F07000001080421600FFFA320200012410001036
3849:10F08000320200141040000200002021240400017C
3850:10F090000C004D4B001080421600FFFA32020014A3
3851:10F0A0000C004D71341080000C004D710000000008
3852:10F0B0000C004D2B00000000504000050010804265
3853:10F0C0009622000000501025A62200000010804269
3854:10F0D0001600FFF7000000000C004D7100008021B9
3855:10F0E00097A2001027B1001034420010A7A2001010
3856:10F0F0000C004D4B24040001261000012E020020BC
3857:10F100001440FFFB000000000C004D4B00002021CC
3858:10F110000C004D4B240400010C004D4B000020213D
3859:10F120000C004D4B24040001241000103202000199
3860:10F130001040000200002021240400010C004D4B6F
3861:10F14000001080421600FFFA320200012410001065
3862:10F1500032020014104000020000202124040001AB
3863:10F160000C004D4B001080421600FFFA32020014D2
3864:10F170000C004D4B240400010C004D4B00002021DD
3865:10F18000341080009622000000501024104000022D
3866:10F1900000002021240400010C004D4B001080428F
3867:10F1A0001600FFF8000000000C004D710000000088
3868:10F1B0008F83005408004D16240200138F830054DF
3869:10F1C0003C0200018C425DB82463FF9C0043102385
3870:10F1D0002C420064144000B32402000D08004D24AA
3871:10F1E0000000000027B10010A7A00010000080213F
3872:10F1F0000C004D4B24040001261000012E020020BB
3873:10F200001440FFFB000000000C004D4B00002021CB
3874:10F210000C004D4B240400010C004D4B2404000154
3875:10F220000C004D4B00002021241000103202000180
3876:10F230001040000200002021240400010C004D4B6E
3877:10F24000001080421600FFFA320200012410001064
3878:10F2500032020018104000020000202124040001A6
3879:10F260000C004D4B001080421600FFFA32020018CD
3880:10F270000C004D71341080000C004D710000000036
3881:10F280000C004D2B00000000504000050010804293
3882:10F290009622000000501025A62200000010804297
3883:10F2A0001600FFF7000000000C004D7100008021E7
3884:10F2B00097A2001027B100103042FFFEA7A2001055
3885:10F2C0000C004D4B24040001261000012E020020EA
3886:10F2D0001440FFFB000000000C004D4B00002021FB
3887:10F2E0000C004D4B240400010C004D4B000020216C
3888:10F2F0000C004D4B240400012410001032020001C8
3889:10F300001040000200002021240400010C004D4B9D
3890:10F31000001080421600FFFA320200012410001093
3891:10F3200032020018104000020000202124040001D5
3892:10F330000C004D4B001080421600FFFA32020018FC
3893:10F340000C004D4B240400010C004D4B000020210B
3894:10F35000341080009622000000501024104000025B
3895:10F3600000002021240400010C004D4B00108042BD
3896:10F370001600FFF8000000000C004D7100000000B6
3897:10F380008F83005408004D162402000E240208400A
3898:10F39000A7A2001027B10010000080210C004D4BE7
3899:10F3A00024040001261000012E0200201440FFFB5F
3900:10F3B000000000000C004D4B000020210C004D4BC4
3901:10F3C000240400010C004D4B000020210C004D4B8B
3902:10F3D0002404000124100010320200011040000239
3903:10F3E00000002021240400010C004D4B001080423D
3904:10F3F0001600FFFA3202000124100010320200133E
3905:10F400001040000200002021240400010C004D4B9C
3906:10F41000001080421600FFFA320200130C004D4B20
3907:10F42000240400010C004D4B00002021341080000A
3908:10F4300096220000005010241040000200002021FD
3909:10F44000240400010C004D4B001080421600FFF810
3910:10F45000000000000C004D71000000008F8300547C
3911:10F46000240200103C010001AC225D003C010001BF
3912:10F4700008004D26AC235DB88F8300543C02000188
3913:10F480008C425DB82463FF9C004310232C4200642F
3914:10F490001440000400000000240200113C0100019F
3915:10F4A000AC225D008FBF00208FB1001C8FB0001810
3916:10F4B00003E0000827BD00288F8500448F820044A8
3917:10F4C0003C030001004310253C030008AF820044C8
3918:10F4D0008F8400548F82005400A3282408004D37E5
3919:10F4E000248400018F820054008210232C420002E9
3920:10F4F0001440FFFC000000008F8200443C03FFFE2C
3921:10F500003463FFFF00431024AF8200448F83005414
3922:10F510008F82005408004D45246300018F820054FF
3923:10F52000006210232C4200021440FFFC0000000087
3924:10F5300003E0000800A010218F8300443C02FFF08C
3925:10F540003442FFFF00042480006218243C020002C1
3926:10F550000082202500641825AF8300448F82004478
3927:10F560003C03FFFE3463FFFF00431024AF820044DE
3928:10F570008F8300548F82005408004D5E2463000185
3929:10F580008F820054006210232C4200021440FFFCC2
3930:10F59000000000008F8200443C030001004310255E
3931:10F5A000AF8200448F8300548F82005408004D6B5B
3932:10F5B000246300018F820054006210232C42000259
3933:10F5C0001440FFFC0000000003E000080000000001
3934:10F5D0008F8200443C03FFF03463FFFF004310249C
3935:10F5E000AF8200448F8200443C0300010043102599
3936:10F5F000AF8200448F8300548F82005408004D7FF7
3937:10F60000246300018F820054006210232C42000208
3938:10F610001440FFFC000000008F8200443C03FFFE0A
3939:10F620003463FFFF00431024AF8200448F830054F3
3940:10F630008F82005408004D8D246300018F82005496
3941:10F64000006210232C4200021440FFFC0000000066
3942:10F6500003E000080000000027BDFFC8AFB300248E
3943:10F6600000809821AFB5002C00A0A821AFB20020E7
3944:10F6700000C0902132A2FFFFAFBF0030AFB400281E
3945:10F68000AFB1001CAFB0001814400034A7B2001096
3946:10F690003271FFFF27B20010000080210C004D4B9B
3947:10F6A00024040001261000012E0200201440FFFB5C
3948:10F6B000000000000C004D4B000020210C004D4BC1
3949:10F6C000240400010C004D4B000020210C004D4B88
3950:10F6D0002404000124100010320200011040000236
3951:10F6E00000002021240400010C004D4B001080423A
3952:10F6F0001600FFFA3202000124100010023010241C
3953:10F700001040000200002021240400010C004D4B99
3954:10F71000001080421600FFFA023010240C004D4BFE
3955:10F72000240400010C004D4B000020213410800007
3956:10F7300096420000005010241040000200002021DA
3957:10F74000240400010C004D4B001080421200007593
3958:10F750000000000008004DC9000000003274FFFFE7
3959:10F7600027B10010A7A00010000080210C004D4B15
3960:10F7700024040001261000012E0200201440FFFB8B
3961:10F78000000000000C004D4B000020210C004D4BF0
3962:10F79000240400010C004D4B240400010C004D4BCF
3963:10F7A000000020212410001032020001104000024D
3964:10F7B00000002021240400010C004D4B0010804269
3965:10F7C0001600FFFA320200012410001002901024EB
3966:10F7D0001040000200002021240400010C004D4BC9
3967:10F7E000001080421600FFFA029010240C004D71A8
3968:10F7F000341080000C004D71000000000C004D2BF7
3969:10F8000000000000504000050010804296220000D9
3970:10F8100000501025A6220000001080421600FFF7BD
3971:10F82000000000000C004D710000000032A5FFFF39
3972:10F830002402000154A200042402000297A2001036
3973:10F8400008004E140052102514A200063271FFFF6A
3974:10F8500097A200100012182700431024A7A200103E
3975:10F860003271FFFF27B20010000080210C004D4BC9
3976:10F8700024040001261000012E0200201440FFFB8A
3977:10F88000000000000C004D4B000020210C004D4BEF
3978:10F89000240400010C004D4B000020210C004D4BB6
3979:10F8A0002404000124100010320200011040000264
3980:10F8B00000002021240400010C004D4B0010804268
3981:10F8C0001600FFFA3202000124100010023010244A
3982:10F8D0001040000200002021240400010C004D4BC8
3983:10F8E000001080421600FFFA023010240C004D4B2D
3984:10F8F000240400010C004D4B000020213410800036
3985:10F900009642000000501024104000020000202108
3986:10F91000240400010C004D4B001080421600FFF83B
3987:10F92000000000000C004D71000000008FBF00308F
3988:10F930008FB5002C8FB400288FB300248FB2002025
3989:10F940008FB1001C8FB0001803E0000827BD0038FD
3990:10F9500000000000000000000000000027BDFFE8DC
3991:10F96000AFBF00103C030001007718218C6383AC0B
3992:10F97000240200081462022C008030213C020001A5
3993:10F980008C425D9814400033000000008F850224F3
3994:10F9900038A300202C63000138A200102C42000183
3995:10F9A000006218251460000D38A300302C6300019C
3996:10F9B00038A204002C4200010062182514600007E0
3997:10F9C00038A304022C63000138A204042C42000175
3998:10F9D0000062182510600005000000000C00429B2A
3999:10F9E0000000000008004E8D2402000E0C0043DDD4
4000:10F9F000000000003C0500018CA55CC80C0052A270
4001:10FA0000000020213C0300018C635CC82402000438
4002:10FA1000146200052403FFFB3C0200018C425CC41D
4003:10FA200008004E892403FFF73C0200018C425CC4AD
4004:10FA3000004310243C010001AC225CC42402000EEF
4005:10FA40003C0100010C00429BAC227DD00800508795
4006:10FA5000000000008F8202203C03040000431024B9
4007:10FA6000104000272403FFBF8F8502243C020001C1
4008:10FA70008C427DDC00A32024004310241482000C5F
4009:10FA8000000000003C0200018C427DE024420001A5
4010:10FA90003C010001AC227DE02C4200021440000831
4011:10FAA000240200013C01000108004EADAC227E00A2
4012:10FAB0003C010001AC207DE03C010001AC207E0057
4013:10FAC0003C0200018C427E001040000630A2004043
4014:10FAD00010400004240200013C01000108004EB85F
4015:10FAE000AC227E043C010001AC207E043C010001FC
4016:10FAF000AC257DDC3C01000108004EC8AC207E1026
4017:10FB0000240200013C010001AC227E103C010001F6
4018:10FB1000AC207E003C010001AC207DE03C010001F6
4019:10FB2000AC207E043C010001AC207DDC3C030001E4
4020:10FB30008C637DD03C0200018C427DD410620003B6
4021:10FB40003C0202003C010001AC237DD400C2102421
4022:10FB5000104000072463FFFF8F820220240300016E
4023:10FB60003C010001AC235CCC080050853C03F7004D
4024:10FB70002C62000E104001A8000310803C0100011F
4025:10FB8000002208218C225B80004000080000000059
4026:10FB90003C010001AC207E003C010001AC207DE076
4027:10FBA0003C010001AC207DDC3C010001AC207E0466
4028:10FBB0003C010001AC207DF83C010001AC207DF04F
4029:10FBC0000C00486AAF800224240200023C010001BC
4030:10FBD000AC227DD03C0200018C427E1014400056C5
4031:10FBE0003C03FDFF8EE200003463FFFF004310245E
4032:10FBF0000C00429BAEE20000AF8002048F82020044
4033:10FC00002403FFFD00431024AF8202003C010001E9
4034:10FC1000AC207E208F8300543C0200018C427DF892
4035:10FC2000240400013C010001AC247E0C24420001AC
4036:10FC30003C010001AC227DF82C4200043C01000193
4037:10FC4000AC237DF414400006240200033C010001B3
4038:10FC5000AC245CCC3C01000108005083AC207DF852
4039:10FC60003C01000108005083AC227DD08F830054FA
4040:10FC70003C0200018C427DF42463D8F00043102341
4041:10FC80002C42271014400003240200043C01000110
4042:10FC9000AC227DD03C0200018C427E101440002634
4043:10FCA0003C03FDFF8EE200003463FFFF004310249D
4044:10FCB00008005083AEE200003C0400018C845D9C8F
4045:10FCC0003C0100010C00508AAC207DE83C020001A0
4046:10FCD0008C427E1CAF8202043C0200018C427E10EA
4047:10FCE000144000153C03FDFF8EE200003463FFFF6B
4048:10FCF00000431024AEE200008F8202043042003044
4049:10FD00001440013C240200023C0300018C637E1C71
4050:10FD1000240200053C010001AC227DD03C01000121
4051:10FD200008005083AC237E203C0200018C427E10F0
4052:10FD3000104000103C03FDFF3C0200018C425D6C52
4053:10FD4000244200013C010001AC225D6C2C42000207
4054:10FD500014400131240200013C010001AC225D7419
4055:10FD60003C010001AC205D6C3C01000108005083A7
4056:10FD7000AC225CCC8EE200003463FFFF0043102411
4057:10FD8000AEE200003C0200018C427E0010400122E5
4058:10FD9000000000003C0200018C427DDC1040011E8E
4059:10FDA000000000003C010001AC227E082402000398
4060:10FDB0003C010001AC227DE0080050242402000632
4061:10FDC0003C010001AC207DE88F82020434420040F7
4062:10FDD000AF8202043C0200018C427E202403000713
4063:10FDE0003C010001AC237DD0344200403C010001C5
4064:10FDF000AC227E203C0200018C427E0010400005B7
4065:10FE0000000000003C0200018C427DDC104000F943
4066:10FE1000240200023C05000124A57DE08CA2000024
4067:10FE20002C424E21104000F3240200023C0200014B
4068:10FE30008C427E04104000F82404FFBF3C02000105
4069:10FE40008C427DDC3C0300018C637E08004410245E
4070:10FE50000064182410430004240200013C01000146
4071:10FE600008005083AC227DD024020003ACA2000025
4072:10FE7000240200083C010001AC227DD03C020001BC
4073:10FE80008C427E0C1040000C240200013C04000156
4074:10FE90000C0050978C847DDC3C0200018C427E2853
4075:10FEA00014400005240200013C0200018C427E2423
4076:10FEB00010400006240200013C010001AC225CCC91
4077:10FEC0003C01000108005083AC207DF83C02000199
4078:10FED0008C427DF03C0300018C637DDC2C420001F0
4079:10FEE000000210C0306300083C010001AC227DF02C
4080:10FEF0003C010001AC237DEC8F83005424020009F7
4081:10FF00003C010001AC227DD03C010001080050837F
4082:10FF1000AC237DF48F8300543C0200018C427DF4BD
4083:10FF20002463D8F0004310232C422710144000A86B
4084:10FF3000000000003C0200018C427E0010400005E1
4085:10FF4000000000003C0200018C427DDC104000A952
4086:10FF5000240200023C03000124637DE08C62000067
4087:10FF60002C424E21104000A3240200023C0200015A
4088:10FF70008C427E0C1040000E000000003C0200018C
4089:10FF80008C427DDC3C010001AC207E0C30420080C4
4090:10FF90001040002F2402000C8F82020430420080A7
4091:10FFA0001440000C24020003080050112402000C2D
4092:10FFB0003C0200018C427DDC304200801440000590
4093:10FFC000240200038F820204304200801040001F90
4094:10FFD00024020003AC6200002402000A3C0100017C
4095:10FFE000AC227DD03C04000124847E188C82000069
4096:10FFF0003C0300018C637DF000431025AF820204B6
4097:020000021000EC
4098:100000008C8300003C0400018C847DF02402000BF2
4099:100010003C010001AC227DD0006418253C010001A8
4100:10002000AC237E203C05000124A57DE08CA20000CD
4101:100030002C424E211040006F240200023C020001BD
4102:100040008C427E1010400005000000002402000CCD
4103:100050003C01000108005083AC227DD03C0200012D
4104:100060008C427E001040006C000000003C04000147
4105:100070008C847DDC1080005E308200083C0300012F
4106:100080008C637DEC10620064240200033C010001DB
4107:10009000AC247E08ACA20000240200063C01000152
4108:1000A00008005083AC227DD08F82020034420002CF
4109:1000B000AF8202008F8300542402000D3C01000136
4110:1000C000AC227DD03C010001AC237DF48F83005431
4111:1000D0003C0200018C427DF42463D8F000431023DD
4112:1000E0002C4227101440003A000000003C0200019E
4113:1000F0008C427E10104000292402000E3C030001B7
4114:100100008C637E243C01000114600015AC227DD07C
4115:100110000C0043DD000000003C0500018CA55CC81C
4116:100120000C0052A2000020213C0300018C635CC83B
4117:1001300024020004146200052403FFFB3C020001BA
4118:100140008C425CC4080050522403FFF73C020001BB
4119:100150008C425CC4004310243C010001AC225CC40E
4120:100160008EE200003C03020000431025AEE20000D6
4121:100170008F8202243C010001AC227E2C8F8202205F
4122:100180002403FFFB00431024AF8202208F82022051
4123:100190003442000208005083AF8202203C0200017A
4124:1001A0008C427E0010400005000000003C0200016F
4125:1001B0008C427DDC1040000F240200023C02000152
4126:1001C0008C427DE02C424E211040000A24020002A5
4127:1001D0003C0200018C427E001040000F0000000035
4128:1001E0003C0200018C427DDC1440000B000000004A
4129:1001F000240200023C01000108005083AC227DD0A3
4130:100200003C0200018C427E00104000030000000010
4131:100210000C00429B000000008F8202203C03F7008C
4132:1002200000431025AF8202208FBF001003E00008BA
4133:1002300027BD00183C03000124637E288C62000067
4134:1002400010400005344220003C010001AC227E1C1D
4135:1002500008005095AC6000003C010001AC247E1CFD
4136:1002600003E000080000000027BDFFE030820030FE
4137:10027000AFBF00183C010001AC227E24144000678F
4138:100280003C02FFFF34421F0E008210241440006124
4139:1002900024020030308220001040005D3083800056
4140:1002A00000031A0230820001000212003C04000127
4141:1002B0008C845D9C00621825000331C23C03000160
4142:1002C00024635D78308280000002120230840001D5
4143:1002D0000004220000441025000239C200061080EC
4144:1002E0000043102100471021904300002402000128
4145:1002F00010620025000000001060000724020002C8
4146:1003000010620013240200031062002C3C05000F51
4147:10031000080050F9000000008F8202002403FEFF55
4148:1003200000431024AF8202008F8202203C03FFFEB4
4149:100330003463FFFF00431024AF8202203C01000120
4150:10034000AC207E443C01000108005104AC207E4CEE
4151:100350008F82020034420100AF8202008F820220AD
4152:100360003C03FFFE3463FFFF00431024AF820220F2
4153:10037000240201003C010001AC227E443C0100014A
4154:1003800008005104AC207E4C8F8202002403FEFF43
4155:1003900000431024AF8202008F8202203C03000140
4156:1003A00000431025AF8202203C010001AC207E44B6
4157:1003B0003C01000108005104AC237E4C8F820200F6
4158:1003C00034420100AF8202008F8202203C03000110
4159:1003D00000431025AF820220240201003C010001ED
4160:1003E000AC227E443C01000108005104AC237E4C49
4161:1003F00034A5FFFF3C04000124845BB8AFA30010C8
4162:100400000C002403AFA000140800510400000000F9
4163:10041000240200303C010001AC227E288FBF00186E
4164:1004200003E0000827BD00200000000027BDFFC832
4165:10043000AFB2002800809021AFB3002C00A098211B
4166:10044000AFB0002000C080213C04000124845BD0B8
4167:100450003C0500093C0200018C425CC834A59001B7
4168:100460000240302102603821AFBF0030AFB100241C
4169:10047000A7A0001AAFB000140C002403AFA2001014
4170:1004800024020002126200832E6200031040000565
4171:10049000240200011262000A000000000800529BC2
4172:1004A0000000000024020004126200FA2402000886
4173:1004B000126200F93C02FFEC0800529B00000000B1
4174:1004C0003C0200018C425CC4304200021440000433
4175:1004D000001289403C02FFFB3442FFFF02028024ED
4176:1004E0003C01000100310821AC307E3C3C02400060
4177:1004F000020210241040004E001023C2308400304D
4178:10050000001013823042001C3C03000124635D088C
4179:1005100000431021008238213C02002002021024F6
4180:1005200010400006240201003C01000100310821B6
4181:10053000AC227E40080051503C0200803C0100018A
4182:1005400000310821AC207E403C02008002021024D1
4183:1005500010400006001219403C0200013C0100015D
4184:10056000002308210800515CAC227E480012114093
4185:100570003C01000100220821AC207E4894E40000E8
4186:100580003C0300018C635DBC240200051062001076
4187:10059000A7A400183202400010400002348240003C
4188:1005A000A7A200182404000194E20002240500041C
4189:1005B00024E60002344200010C00498EA4E200024D
4190:1005C00024040001000028210C00498E27A60018F1
4191:1005D0003C0200018C425CC8241100013C01000176
4192:1005E000AC315CD414530004320280000C00429BF6
4193:1005F00000000000320280001040011F00000000D7
4194:100600000C00429B000000003C0300018C635DBCB9
4195:100610002402000510620118240200023C010001BE
4196:10062000AC315CCC3C0100010800529BAC225CC8A0
4197:10063000240400012405000427B0001A0C00498E90
4198:100640000200302124040001000028210C00498E02
4199:10065000020030213C020001005110218C427E3406
4200:100660003C0400018C845CC83C03BFFF3463FFFF83
4201:100670003C010001AC335CD4004310243C01000178
4202:1006800000310821109300FAAC227E340800529BFE
4203:10069000000000003C02200002021024104000056F
4204:1006A000240200013C010001AC225D98080051AD1C
4205:1006B000001289403C010001AC205D980012894085
4206:1006C0003C01000100310821AC307E383C02400082
4207:1006D0000202102414400016000000003C02000139
4208:1006E0008C425D9810400008240400042405000199
4209:1006F0000C004D9324062000240200013C0100015F
4210:1007000000370821AC2283AC3C02000100511021CB
4211:100710008C427E303C03BFFF3463FFFF0043102454
4212:100720003C0100010031082108005299AC227E30C2
4213:100730003C0200018C425D98104000283C0300A060
4214:10074000020310245443000D3C0200203C0200012F
4215:100750008C425D9C240301003C0100010031082112
4216:10076000AC237E443C0300013C0100010031082120
4217:10077000AC237E4C080051F03442040002021024E5
4218:1007800010400008240301003C0200018C425D9CE3
4219:100790003C01000100310821AC237E44080051F0E7
4220:1007A000344208003C020080020210241040002E57
4221:1007B0003C0300013C0200018C425D9C3C010001B5
4222:1007C00000310821AC237E4C34420C003C01000176
4223:1007D000AC225D9C08005218240400013C02002059
4224:1007E0000202102410400006240201003C01000116
4225:1007F00000310821AC227E44080052013C020080F6
4226:100800003C01000100310821AC207E443C02008004
4227:100810000202102410400007001219403C0200019F
4228:100820003C01000100230821AC227E4C0800520F3D
4229:1008300024040001001211403C01000100220821A3
4230:10084000AC207E4C240400010000282127B0001EAB
4231:100850000C00494C02003021240400010000282132
4232:100860000C00494C02003021240400012405000141
4233:1008700027B0001C0C00494C020030212404000168
4234:10088000240500010C00494C020030210800529957
4235:10089000000000003C02FFEC3442FFFF0202802413
4236:1008A0003C02000802028025001211403C010001B8
4237:1008B00000220821AC307E383C02200002021024C5
4238:1008C00010400009000000003C0200018C425D74F1
4239:1008D00014400005240200013C010001AC225D9897
4240:1008E0000800523A3C0240003C010001AC205D98F7
4241:1008F0003C024000020210241440001E00000000D0
4242:100900003C0200018C425D983C010001AC205CE09F
4243:1009100010400007240220203C010001AC225D9C15
4244:10092000240200013C01000100370821AC2283AC05
4245:100930003C04BFFF001219403C020001004310219B
4246:100940008C427E303C0500018CA55CC83484FFFFDE
4247:10095000004410243C01000100230821AC227E3019
4248:100960002402000110A20044000000000800529977
4249:10097000000000003C0200018C425D981040001C09
4250:10098000240220003C010001AC225D9C3C0300A03D
4251:100990000203102414430005001211403402A00089
4252:1009A0003C01000108005294AC225D9C3C03000114
4253:1009B000006218218C637E383C0200200062102403
4254:1009C00010400004240220013C0100010800529460
4255:1009D000AC225D9C3C020080006210241040001F8D
4256:1009E0003402A0013C01000108005294AC225D9C3D
4257:1009F0003C0200200202102410400007001219409F
4258:100A0000240201003C01000100230821AC227E44A5
4259:100A1000080052883C020080001211403C01000195
4260:100A200000220821AC207E443C02008002021024F7
4261:100A300010400006001219403C0200013C01000178
4262:100A40000023082108005294AC227E4C0012114071
4263:100A50003C01000100220821AC207E4C3C03000137
4264:100A60008C635CC8240200011062000300000000D7
4265:100A70000C00429B000000008FBF00308FB3002CA1
4266:100A80008FB200288FB100248FB0002003E000084F
4267:100A900027BD003827BDFFD8AFB2002000809021CD
4268:100AA000AFB1001C0000882124020002AFBF002467
4269:100AB000AFB00018A7A0001210A200D3A7A000108A
4270:100AC0002CA20003104000052402000110A2000A1D
4271:100AD00000128140080053800220102124020004EB
4272:100AE00010A2007D2402000810A2007C0012294000
4273:100AF00008005380022010213C03000100701821DF
4274:100B00008C637E3C3C0240000062102414400009CB
4275:100B1000240400013C027FFF3442FFFF006288246E
4276:100B20003C01000100300821AC317E3408005380C4
4277:100B300002201021240500010C00494C27A60010BA
4278:100B400024040001240500010C00494C27A60010D4
4279:100B500097A2001030420004104000343C114000C5
4280:100B60003C0200018C425DBC2443FFFF2C62000666
4281:100B700010400034000310803C01000100220821D5
4282:100B80008C225BE00040000800000000240400010B
4283:100B90002405001127B000120C00494C020030213E
4284:100BA00024040001240500110C00494C02003021EE
4285:100BB00097A5001230A24000104000023C04001033
4286:100BC0003C0400083C0300010800530130A28000EF
4287:100BD000240400012405001427B000120C00494C25
4288:100BE0000200302124040001240500140C00494CAB
4289:100BF0000200302197A5001230A210001040000220
4290:100C00003C0400103C0400083C03000130A2080032
4291:100C1000544000013C0300023C02800002221025E7
4292:100C2000006418250800530E004388253C1100017C
4293:100C3000023088218E317E3C3C027FFF3442FFFF30
4294:100C4000022288243C0200018C425CD81040001D26
4295:100C5000001211403C0200018C425D9810400002DD
4296:100C60003C02200002228825001211403C010001B4
4297:100C7000002208218C227E40104000033C0200200C
4298:100C800008005322022288253C02FFDF3442FFFF86
4299:100C900002228824001211403C0100010022082198
4300:100CA0008C227E48104000033C0200800800532D37
4301:100CB000022288253C02FF7F3442FFFF0222882463
4302:100CC000001211403C01000100220821AC317E34A9
4303:100CD0000800538002201021001229403C0300012B
4304:100CE000006518218C637E383C02400000621024AD
4305:100CF000144000083C027FFF3442FFFF006288245A
4306:100D00003C01000100250821AC317E3008005380F1
4307:100D1000022010213C0200018C425CD810400033BC
4308:100D20003C11C00C3C0200018C425D743C04C00CC0
4309:100D3000348420003C0300018C635D980002102B7A
4310:100D40000002102300441024106000030051882585
4311:100D50003C022000022288253C02000100451021AF
4312:100D60008C427E44104000033C0200200800535D8A
4313:100D7000022288253C02FFDF3442FFFF0222882442
4314:100D8000001211403C010001002208218C227E4CFF
4315:100D9000104000033C0200800800536802228825AE
4316:100DA0003C02FF7F3442FFFF022288243C02000104
4317:100DB0008C425D60104000023C020800022288253F
4318:100DC0003C0200018C425D64104000023C020400C1
4319:100DD000022288253C0200018C425D68104000061A
4320:100DE0003C0201000800537B022288253C027FFF61
4321:100DF0003442FFFF00628824001211403C010001D0
4322:100E000000220821AC317E30022010218FBF002447
4323:100E10008FB200208FB1001C8FB0001803E00008D3
4324:100E200027BD002827BDFFD8AFB400200080A02137
4325:100E3000AFBF0024AFB3001CAFB20018AFB10014B5
4326:100E4000AFB000108F9002003C0300018C635CC8BF
4327:100E50008F93022024020002106200632C620003C0
4328:100E600010400005240200011062000A001419401D
4329:100E70000800544800000000240200041062005AD8
4330:100E800024020008106200590014914008005448E0
4331:100E9000000000003C040001008320218C847E3C83
4332:100EA0003C110001022388218E317E343C02400037
4333:100EB000008210241040003E3C0200080222102450
4334:100EC00010400020361000023C02000100431021B7
4335:100ED0008C427E4010400005361000203610010084
4336:100EE0003C020020080053BD022288252402FEFF98
4337:100EF000020280243C02FFDF3442FFFF02228824EA
4338:100F0000001411403C010001002208218C227E487F
4339:100F1000104000053C020001026298253C0200805E
4340:100F2000080053DC022288253C02FFFE3442FFFF0A
4341:100F3000026298243C02FF7F3442FFFF080053DC2A
4342:100F4000022288242402FEDF020280243C02FFFEEB
4343:100F50003442FFFF026298243C02FF5F3442FFFFED
4344:100F6000022288243C01000100230821AC207E409D
4345:100F70003C01000100230821AC207E480C00486A97
4346:100F800000000000AF900200AF9302208F82022089
4347:100F90002403FFFB00431024AF8202208F82022033
4348:100FA00034420002AF820220080053F300141140C3
4349:100FB0008F8202002403FFFD004310240C00486AC6
4350:100FC000AF8202003C02BFFF3442FFFF0C00429B95
4351:100FD00002228824001411403C0100010022082153
4352:100FE00008005448AC317E34001491403C040001A8
4353:100FF000009220218C847E383C110001023288212D
4354:101000008E317E303C0240000082102414400011DA
4355:10101000000000003C0200018C425D981440000674
4356:101020003C02BFFF8F820200344200020C00486A7B
4357:10103000AF8202003C02BFFF3442FFFF0C00429B24
4358:10104000022288243C010001003208210800544893
4359:10105000AC317E303C0200018C425D9810400005AE
4360:101060003C0200203C0200018C425D741040002BC9
4361:101070003C0200200082102410400007361000209F
4362:10108000240201003C01000100320821AC227E4410
4363:1010900008005428361001003C01000100320821EC
4364:1010A000AC207E442402FEFF020280243C02008029
4365:1010B0000082102410400007001419403C02000177
4366:1010C0003C01000100230821AC227E4C0800543969
4367:1010D00002629825001411403C0100010022082101
4368:1010E000AC207E4C3C02FFFE3442FFFF026298249B
4369:1010F0000C00486A00000000AF900200AF9302208D
4370:101100008F8202202403FFFB00431024AF820220C1
4371:101110008F82022034420002AF820220001411406C
4372:101120003C01000100220821AC317E308FBF002439
4373:101130008FB400208FB3001C8FB200188FB1001441
4374:101140008FB0001003E0000827BD00282448656127
4375:101150006465723A202F70726F6A656374732F72C0
4376:1011600063732F73772F67652F2E2F6E69632F663A
4377:10117000772F636F6D6D6F6E2F66776D61696E2E61
4378:10118000632C7620312E312E322E313120313939F7
4379:10119000382F30342F32372032323A31333A34322A
4380:1011A00020736875616E6720457870202400000008
4381:1011B0007468655F4441574E00000000535441433A
4382:1011C0004B5F312000000000426164536E64526E38
4383:1011D000670000003F456E71457674003F6E6F51A9
4384:1011E00064457650000000006576526E6746756C67
4385:1011F0006C000000496C6C436F6E66527800000012
4386:1012000053656E64436B53756D00000052656376E1
4387:10121000566C616E0000000000000000244865610B
4388:101220006465723A202F70726F6A656374732F72EF
4389:1012300063732F73772F67652F2E2F6E69632F6669
4390:10124000772F636F6D6D6F6E2F74696D65722E638E
4391:101250002C7620312E312E322E3820313939382F4C
4392:1012600030372F33312031373A35383A343520731F
4393:101270006875616E6720457870202400542D446D98
4394:101280006152643100000000542D446D61424200FF
4395:10129000542D446D613200003F6E6F5164547845A7
4396:1012A000000000003F6E6F5164527845000000005E
4397:1012B000656E714D4576504661696C00656E714D85
4398:1012C00045764661696C00006661696C456E454D06
4399:1012D000000000003F456E71457674003F6E6F510F
4400:1012E00064457650000000006576526E6746756C66
4401:1012F0006C00000000000000000000002448656150
4402:101300006465723A202F70726F6A656374732F720E
4403:1013100063732F73772F67652F2E2F6E69632F6688
4404:10132000772F636F6D6D6F6E2F636F6D6D616E6480
4405:101330002E632C7620312E312E322E313020313951
4406:1013400039382F31312F31382031373A31313A3174
4407:101350003820736875616E6720457870202400001E
4408:101360003F4D626F78457674000000004E4F636F0A
4409:101370006D616E6400000000687374655F455252D1
4410:1013800000000000412D45727242756300000000AC
4411:101390004552524F522D416464000000656E714DFC
4412:1013A0004576504661696C00656E714D45764661C3
4413:1013B000696C00006661696C456E454D0000000077
4414:1013C000442D4572724C617374000000442D4572C7
4415:1013D000723200006D4373744D6445525200000038
4416:1013E00070726F6D4D6445525200000046696C7416
4417:1013F0004D64455252000000636D645F45525200D7
4418:101400003F456E71457674003F6E6F51644576506E
4419:10141000000000006576526E6746756C6C00000037
4420:101420000000000000006EA000007FBC00006E38CD
4421:1014300000008734000082B00000878000008780B1
4422:1014400000006F540000769400007F0C000080A81C
4423:10145000000080740000878000007E70000080CC57
4424:1014600000006E64000081CC00000000244865612B
4425:101470006465723A202F70726F6A656374732F729D
4426:1014800063732F73772F67652F2E2F6E69632F6617
4427:10149000772F636F6D6D6F6E2F646D612E632C7689
4428:1014A00020312E312E322E3320313939382F30343D
4429:1014B0002F32372032323A31333A34312073687563
4430:1014C000616E67204578702024000000646D6172B1
4431:1014D0006441544E00000000646D61777241544EC7
4432:1014E00000000000000000000000000024486561CA
4433:1014F0006465723A202F70726F6A656374732F721D
4434:1015000063732F73772F67652F2E2F6E69632F6696
4435:10151000772F636F6D6D6F6E2F74726163652E63CD
4436:101520002C7620312E312E322E3220313939382F7F
4437:1015300030342F32372032323A31333A353020735B
4438:101540006875616E672045787020240024486561C5
4439:101550006465723A202F70726F6A656374732F72BC
4440:1015600063732F73772F67652F2E2F6E69632F6636
4441:10157000772F636F6D6D6F6E2F646174612E632CB6
4442:101580007620312E312E322E3220313939382F301B
4443:10159000342F32372032323A31333A3430207368C4
4444:1015A00075616E67204578702024000046575F56AD
4445:1015B000455253494F4E3A2023312046726920410B
4446:1015C000707220372031373A35353A34382050445C
4447:1015D000542032303030000046575F434F4D504961
4448:1015E0004C455F54494D453A2031373A35353A3408
4449:1015F0003800000046575F434F4D50494C455F420D
4450:10160000593A2064657672637300000046575F4361
4451:101610004F4D50494C455F484F53543A20636F6DCE
4452:10162000707574650000000046575F434F4D504988
4453:101630004C455F444F4D41494E3A20656E672E61DF
4454:101640006374656F6E2E636F6D00000046575F43D5
4455:101650004F4D50494C45523A20676363207665727E
4456:1016600073696F6E20322E372E32000000000000AA
4457:101670000000000000000000000000002448656138
4458:101680006465723A202F70726F6A656374732F728B
4459:1016900063732F73772F67652F2E2F6E69632F6605
4460:1016A000772F636F6D6D6F6E2F6D656D2E632C766A
4461:1016B00020312E312E322E3220313939382F30342C
4462:1016C0002F32372032323A31333A3434207368754E
4463:1016D000616E672045787020240000002448656111
4464:1016E0006465723A202F70726F6A656374732F722B
4465:1016F00063732F73772F67652F2E2F6E69632F66A5
4466:10170000772F636F6D6D6F6E2F73656E642E632C14
4467:101710007620312E312E322E313120313939382F89
4468:1017200031322F32322031373A31373A3535207362
4469:101730006875616E6720457870202400736E64645C
4470:10174000654E6F51200000006E6F454E515F54583A
4471:1017500000000000736E6464744E6F51200000003E
4472:101760003F6E6F516454784500000000756E6B72D7
4473:101770006474797065000000000000000000ACCCCB
4474:101780000000ACCC0000AD9C0000AAB00000AAB0E4
4475:101790000000AD9C0000AD9C0000AD9C0000AD9C25
4476:1017A0000000AD9C0000AD9C0000AD9C0000AD9C15
4477:1017B0000000AD9C0000AD9C0000AD9C0000AD9C05
4478:1017C0000000AD9C0000AD7C000000000000BCA843
4479:1017D0000000BCA80000BD700000AE4C0000B05876
4480:1017E0000000BD700000BD700000BD700000BD7045
4481:1017F0000000BD700000BD700000BD700000BD7035
4482:101800000000BD700000BD700000BD700000BD7024
4483:101810000000BD700000BD540000B0402448656168
4484:101820006465723A202F70726F6A656374732F72E9
4485:1018300063732F73772F67652F2E2F6E69632F6663
4486:10184000772F636F6D6D6F6E2F726563762E632CCD
4487:101850007620312E312E322E313920313939382F40
4488:1018600030372F32342032313A33303A303520732A
4489:101870006875616E6720457870202400706B52781F
4490:101880004552520066726D324C617267650000000D
4491:1018900072784E6F527842640000000072785144B2
4492:1018A0006D61444600000000727851446D6142460B
4493:1018B000000000003F6E6F51645278450000000048
4494:1018C000706B5278455252730000000066726D32A0
4495:1018D0004C7267530000000072784E6F42645300F0
4496:1018E0003F724264446D6146000000003F724A420C
4497:1018F00064446D4600000000000000000000F6781F
4498:101900000000F6780000F6780000F6780000F6781F
4499:101910000000F6780000F6780000F6780000F6780F
4500:101920000000F6780000F6780000F6780000F678FF
4501:101930000000F6780000F6780000F6700000F670FF
4502:101940000000F670572D444D41456E4600000000E2
4503:10195000000000000000FDC00001015C0000FDDC93
4504:101960000001015C0001015C0001015C0001015CFF
4505:101970000001015C0001015C0000F7040001015C52
4506:101980000001015C0001015C0001015C0001015CDF
4507:101990000001015400010154000101542448656113
4508:1019A0006465723A202F70726F6A656374732F7268
4509:1019B00063732F73772F67652F2E2F6E69632F66E2
4510:1019C000772F636F6D6D6F6E2F6D61632E632C7655
4511:1019D00020312E312E322E313220313939382F300C
4512:1019E000342F32372032323A31333A34322073686E
4513:1019F00075616E6720457870202400006D61637406
4514:101A00007841544E000000004E7453796E264C6BA2
4515:101A10000000000072656D61737372740000000055
4516:101A20006C696E6B444F574E00000000656E714D3F
4517:101A30004576504661696C00656E714D457646612C
4518:101A4000696C00006661696C456E454D00000000E0
4519:101A50006C696E6B55500000000000002448656101
4520:101A60006465723A202F70726F6A656374732F72A7
4521:101A700063732F73772F67652F2E2F6E69632F6621
4522:101A8000772F636F6D6D6F6E2F636B73756D2E6344
4523:101A90002C7620312E312E322E3220313939382F0A
4524:101AA00030342F32372032323A31333A33392073DF
4525:101AB0006875616E672045787020240050726F62EF
4526:101AC00065506879000000006C6E6B4153535254AE
4527:101AD0000000000000011B2C00011BC400011BF8CA
4528:101AE00000011C2C00011C5800011C6C00011CA8EA
4529:101AF0000001207C00011DE400011E2400011E5095
4530:101B000000011E9000011EC000011EFC00011F30DC
4531:101B10000001207C000122C0000122D80001230026
4532:101B2000000123200001234800012478000124A0A3
4533:101B3000000124F40001251C000000000001278C96
4534:101B40000001285C0001293400012A0400012A60F8
4535:101B500000012B3C00012B6400012C4000012C688B
4536:101B600000012E1000012E3800012FE0000131D8B5
4537:101B70000001346C000133800001346C00013498A2
4538:101B800000013008000131B00000000000013B847A
4539:101B900000013BC800013C6000013CAC00013D1C61
4540:101BA00000013DB400013DE800013E7000013F0826
4541:101BB00000013FD8000140180001409C000140C0D6
4542:101BC000000141F4646F42617365506700000000DA
4543:101BD00000000000000000000000000073746D6150
4544:101BE000634C4E4B000000000000000000014C3828
4545:101BF00000014C3800014B8000014BC400014C38FF
4546:101C000000014C380000000000000000000000004F
4547:101C100000000000000000000000000000000000C4
4548:101C2000000000000000000000000000416C74652E
4549:101C30006F6E204163654E4943205600416C7465C8
4550:101C40006F6E204163654E49432056004242424236
4551:101C50000000000000000000000000000013541805
4552:101C60000013E7FC0000000000000000000000007E
4553:101C70000000000000000000000000000060CF0035
4554:101C800000000060CF000000000000000000000025
4555:101C90000000000000000000000000000000000044
4556:101CA0000000000000000000000000000000000034
4557:101CB0000000000000000000000000000000000024
4558:101CC0000000000000000000000000000000000014
4559:101CD0000000000000000000000000030000000001
4560:101CE00000000001000000000000000000000000F3
4561:101CF00000000001000000000000000100000000E2
4562:101D000000000000000000000000000000000001D2
4563:101D100000000001000000000000000000000000C2
4564:101D20000000000000000000010000002100000091
4565:101D30001200014000000000000000002000000030
4566:101D4000120000A0000000001200006012000180DC
4567:101D5000120001E000000000000000000000000090
4568:101D60000000000100000000000000000000000072
4569:101D70000000000000000000000000000000000261
4570:101D8000000000000000000000030001000000014E
4571:0C1D900000030201000000000000000041
4572:00000001FF
4573/* tg1 firmware v12.4.11 */
diff --git a/firmware/acenic/tg2.bin.ihex b/firmware/acenic/tg2.bin.ihex
new file mode 100644
index 000000000000..a9ff4f431f22
--- /dev/null
+++ b/firmware/acenic/tg2.bin.ihex
@@ -0,0 +1,4844 @@
1:100000000C040B0000004000000040000000000055
2:1000100010000003000000000000000D0000000DB3
3:100020003C1D00018FBD6D2003A0F0213C1000009D
4:10003000261040000C0010C0000000000000000D61
5:100040003C1D00018FBD6D2403A0F0213C10000079
6:10005000261040000C0017E0000000000000000D1A
7:100060000000000000000000000000000000000090
8:100070000000000000000000000000000000000080
9:100080000000000000000000000000000000000070
10:100090000000000000000000000000000000000060
11:1000A0000000000000000000000000000000000050
12:1000B0000000000000000000000000000000000040
13:1000C0000000000000000000000000000000000030
14:1000D0000000000000000000000000000000000020
15:1000E0000000000000000000000000000000000010
16:1000F0000000000000000000000000000000000000
17:1001000000000000000000000000000002000008E5
18:10011000000000000800172F3C0A00010800172FFC
19:100120003C0A00020800172F0000000008002CAC59
20:100130000000000008002C4F000000000800172FEE
21:100140003C0A00040800328A0000000008001A522D
22:10015000000000000800394D00000000080038F4DD
23:10016000000000000800172F3C0A0006080039BBF9
24:100170003C0A00070800172F3C0A00080800172F48
25:100180003C0A000908003A130000000008002EA6EF
26:10019000000000000800172F3C0A000B0800172F72
27:1001A0003C0A000C0800172F3C0A000D080028FB31
28:1001B0000000000008002890000000000800172F31
29:1001C0003C0A000E0800208C0000000008001964A2
30:1001D0000000000008001A040000000008003CA60F
31:1001E0000000000008003C94000000000800172FE9
32:1001F000000000000800191A000000000800172F76
33:10020000000000000800172F3C0A00130800172FF9
34:100210003C0A001400000000000000000000000084
35:1002200000000000000000000000000000000000CE
36:1002300000000000000000000000000000000000BE
37:1002400000000000000000000000000000000000AE
38:10025000000000000000000000000000000000009E
39:10026000000000000000000000000000000000008E
40:10027000000000000000000000000000000000007E
41:10028000000000000000000000000000000000006E
42:10029000000000000000000000000000000000005E
43:1002A000000000000000000000000000000000004E
44:1002B000000000000000000000000000000000003E
45:1002C000000000000000000000000000000000002E
46:1002D000000000000000000000000000000000001E
47:1002E000000000000000000000000000000000000E
48:1002F00000000000000000000000000000000000FE
49:1003000000000000000000000000000027BDFFE02A
50:100310003C1CC000AFBF001CAFB000188F82014072
51:1003200024030003AF8300EC344200040C002B20B4
52:10033000AF8201403C0100C00C001763AC203FFCC1
53:10034000004018213C0200103C010001AC236E9CCF
54:10035000106200110043102B144000023C020020E8
55:100360003C0200081062000C240501003C0600015C
56:100370008CC66E9C3C04000124845C74000038210F
57:10038000AFA000100C002B3BAFA000143C020020DB
58:100390003C010001AC226E9C240200083C010001DB
59:1003A000AC226EB42402001F3C010001AC226EC4DA
60:1003B000240200163C010001AC226E983C05FFFEB1
61:1003C00034A56F083C0200018C426E9C3C03000285
62:1003D000246390103C0400018C846CC400431023FF
63:1003E00014800002004580212610FA382402F00013
64:1003F000020280240C00178502002021020228231B
65:100400003C0400200082182300651823247BB000E0
66:100410003C03FFFE3463BF080363B8213C0600BF02
67:1004200034C6F0003C0700018CE76CC03C0300BF01
68:100430003463E000008520233C010001AC246EA859
69:10044000008220233C010001AC256E90000528426B
70:100450003C010001AC226E8427620FFC3C010001CC
71:10046000AC226D2027621FFC00DB3023007B1823A9
72:100470003C010001AC246E883C010001AC256EAC4F
73:100480003C010001AC226D24AF86015010E0001148
74:10049000AF8302503C1D00018FBD6CCC03A0F02146
75:1004A0000C001749000000003C0200018C426CD097
76:1004B0003C0300018C636CD42442FE0024630200E0
77:1004C0003C010001AC226CD03C0100011000000492
78:1004D000AC236CD43C1D00018FBD6D2003A0F02126
79:1004E0003C0200018C426CC41040000D26FAFA3820
80:1004F0003C0200018C426CD03C0300018C636CD444
81:100500003C1A00018F5A6CD42442FA38246305C87F
82:100510003C010001AC226CD03C010001AC236CD446
83:100520003C0200018C426CC8144000030000000033
84:100530003C010001AC206CD00C0011510000000007
85:100540008FBF001C8FB0001803E0000827BD0020FB
86:100550003C0200018C426CD03C0300018C636CD4E3
87:1005600027BDFF98AFB000483C1000018E1066B860
88:10057000AFB200503C12000026524100AFBF0060F5
89:10058000AFBE005CAFB50058AFB30054AFB1004C84
90:10059000AFA20034AFA30030AFA00010AFA0001492
91:1005A0008F8600403C04000124845C802405020006
92:1005B0003C010001AC326E800C002B3B0200382164
93:1005C0008F8300403C02F000006218243C0260006F
94:1005D0001062000BA3A0003F240E00013C040001A8
95:1005E00024845C88A3AE003FAFA00010AFA000142D
96:1005F0008F860040240503000C002B3B02003821AD
97:100600008F8202403C03000100431025AF8202406C
98:10061000AF8000488F8200481440000500000000B1
99:10062000AF8000488F8200481040000400000000A6
100:10063000AF8000481000000302E02021AF80004C92
101:1006400002E020213C0500010C002BA834A540F855
102:10065000034020210C002BA8240505C83C02000102
103:100660008C426EA83C0D00018DAD6E883C030001EC
104:100670008C636E843C0800018D086E903C0900017B
105:100680008D296EAC3C0A00018D4A6EB43C0B000112
106:100690008D6B6EC43C0C00018D8C6E983C04000187
107:1006A00024845C9424050400AF42013C8F42013C49
108:1006B0002406000124070001AF400000AF4D0138BF
109:1006C000AF430144AF480148AF49014CAF4A015024
110:1006D000AF4B0154AF4C01582442FF80AF42014060
111:1006E00024020001AFA200100C002B3BAFA00014AD
112:1006F0008F420138AFA200108F42013CAFA200141C
113:100700008F4601448F4701483C04000124845CA0CB
114:100710000C002B3B24050500AFB70010AFBA001446
115:100720008F46014C8F4701503C04000124845CAC8F
116:100730000C002B3B240506003C0200018C426E9C01
117:10074000036038213C06000224C690102448FFFFB5
118:100750000106182400E810240043102B1040000666
119:10076000240509003C04000124845CB8AFA80010F3
120:100770000C002B3BAFA000148F82000CAFA2001026
121:100780008F82003CAFA200148F8600008F87000488
122:100790003C04000124845CC40C002B3B24051000A5
123:1007A0008C0202208C0302248C0602188C07021C87
124:1007B0003C04000124845CCC24051100AFA200108D
125:1007C0000C002B3BAFA30014AF800054AF80011C82
126:1007D0008C020218304200021040000900000000A4
127:1007E0008C0202203C030002346300040043102505
128:1007F000AF42000C8C02021C1000000834420004BE
129:100800008C0202203C0300023463000600431025E2
130:10081000AF42000C8C02021C34420006AF420014AE
131:100820008C020218304200101040000A0000000044
132:100830008C02021C34420004AF4200108C020220E1
133:100840003C03000A34630004004310251000000933
134:10085000AF4200088C0202203C03000A3463000609
135:1008600000431025AF4200088C02021C34420006EF
136:10087000AF42001024020001AF8200A0AF8200B09E
137:100880008F8300548F820054AF8000D0AF8000C0AF
138:1008900010000002246300648F8200540062102361
139:1008A0002C4200651440FFFC000000008C0402088C
140:1008B0008C05020C26E20028AEE2002024020490FF
141:1008C000AEE20010AEE40008AEE5000C26E400083D
142:1008D0008C8200008C830004AF820090AF83009470
143:1008E0008C820018AF8200B49482000AAF82009C10
144:1008F0008F420014AF8200B08F8200B030420004FB
145:100900001440FFFD000000008F8200B03C03EF00A8
146:100910000043102410400021000000008F8200B42A
147:10092000AFA200108F8200908F8300943C040001DE
148:1009300024845CD4AFA300148F8600B08F87009C02
149:100940003C0500010C002B3B34A5200D3C040001AC
150:1009500024845CE0240203C0AFA20010AFA0001406
151:100960008F8601443C07000124E75CE80C002B3B28
152:100970003405DEAD8F82011C34420002AF82011CBF
153:100980008F82022034420004AF8202208F82014015
154:100990003C03000100431025AF82014096E204723F
155:1009A00096E6045296E70462AFA2001096E2048233
156:1009B0003C04000124845D14240512000C002B3B30
157:1009C000AFA2001496F0045232020001104000025F
158:1009D0000000B02124160001320200025440000140
159:1009E00036D60002320200085440000136D6000418
160:1009F000320200105440000136D6000832020020B6
161:100A00005440000136D6001032020040544000012C
162:100A100036D60020320200805440000136D6004015
163:100A200096E6048230C202005440000136D64000EF
164:100A300096E304723062020010400003306201004D
165:100A40001000000336D620005440000136D61000B6
166:100A500096F0046232C24000144000043207009B4A
167:100A600030C2009B14E20007240E000132C22000B5
168:100A70001440000D320200013062009B10E20009B8
169:100A8000240E00013C04000124845D202405130091
170:100A900002003821A3AE003FAFA300100C002B3B97
171:100AA000AFA00014320200015440000136D600808D
172:100AB000320200025440000136D601003202000822
173:100AC0005440000136D602003202001054400001AA
174:100AD00036D60400320200805440000136D60800A9
175:100AE0008C02021830420200104000023C02000852
176:100AF00002C2B0258C0202183042080010400002E9
177:100B00003C02008002C2B0258C0202183042040070
178:100B1000104000023C02010002C2B0258C02021803
179:100B200030420100104000023C02020002C2B02527
180:100B30008C02021830420080104000023C02040087
181:100B400002C2B0258C020218304220001040000280
182:100B50003C02001002C2B0258C0202183042400054
183:100B6000104000023C02002002C2B0258C02021894
184:100B700030421000104000023C02004002C2B0258A
185:100B80008EE204988EE3049CAF420160AF4301649F
186:100B90008EE204A08EE304A4AF420168AF43016C6F
187:100BA0008EE204A88EE304ACAF420170AF4301743F
188:100BB0008EE204288EE3042CAF420178AF43017C1F
189:100BC0008EE204488EE3044CAF420180AF430184BF
190:100BD0008EE204588EE3045CAF420188AF43018C7F
191:100BE0008EE204688EE3046CAF420190AF4301943F
192:100BF0008EE204788EE3047CAF420198AF43019CFF
193:100C00008EE204888EE3048CAF4201A0AF4301A4BE
194:100C10008EE204B08EE304B424040080AF4201A845
195:100C2000AF4301AC0C002BA8240500808C02025CB1
196:100C300027440224AF4201F08C0202602405020026
197:100C4000240600080C002BBFAF4201F83C043B9A7D
198:100C50003484CA0000003821240200062403000264
199:100C6000AF4201F4240203E8AF430204AF430200A1
200:100C7000AF4401FCAF42029424020001AF43029052
201:100C8000AF42029C3C0300010067182190636CD8BE
202:100C90000347102124E70001A043022C2CE2000F9F
203:100CA0001440FFF80347182124E700013C08000125
204:100CB000350840F88F8200403C04000124845D2CFC
205:100CC000240514000002170224420030A062022C06
206:100CD00003471021A040022C8C07021802C03021CB
207:100CE000240205C8AFA200100C002B3BAFA80014D3
208:100CF0003C04000124845D383C05000024A55C8090
209:100D00002406001027B100300220382127B3003418
210:100D10000C0017A3AFB300103C0300018C636CC838
211:100D20001060000A004080218FA300302405FF00DE
212:100D30008FA20034246400FF008520240083182340
213:100D400000431023AFA20034AFA400303C040001E4
214:100D500024845D443C05000024A5410024060108CC
215:100D6000022038210C0017A3AFB3001000409021DF
216:100D700032C200033C010001AC326E8010400045DD
217:100D8000022038218F8200503C03001000431024C1
218:100D900010400016000000008C0202183042004093
219:100DA0001040000F240200018F8200508C030218B3
220:100DB000240E00013C04000124845D50A3AE003FDA
221:100DC000AFA20010AFA300148F87004024051500C8
222:100DD0000C002B3B02C0302110000004000000007A
223:100DE0003C01000100370821A02240F43C0400012E
224:100DF00024845D5C3C05000124A55B403C060001A9
225:100E000024C65BAC00C530238F42001027B30030EE
226:100E10000260382127B1003434420A00AF4200108A
227:100E20000C0017A3AFB100103C04000124845D70D6
228:100E30003C05000124A5B7143C06000124C6BA9065
229:100E400000C5302302603821AF4201080C0017A30F
230:100E5000AFB100103C04000124845D8C3C0500010E
231:100E600024A5BE583C06000124C6C90000C5302395
232:100E7000026038213C010001AC226EF40C0017A383
233:100E8000AFB100103C04000124845DA410000024D4
234:100E9000240516003C04000124845DAC3C050001DF
235:100EA00024A5A10C3C06000124C6A23800C53023AD
236:100EB0000C0017A3AFB300103C04000124845DBCF8
237:100EC0003C05000124A5B2B03C06000124C6B70CC5
238:100ED00000C5302302203821AF4201080C0017A3BF
239:100EE000AFB300103C04000124845DD03C05000138
240:100EF00024A5BA983C06000124C6BE5000C5302384
241:100F0000022038213C010001AC226EF40C0017A332
242:100F1000AFB300103C04000124845DE424051650A6
243:100F200002C03021000038213C010001AC226EF8E3
244:100F3000AFA000100C002B3BAFA0001432C2002069
245:100F40001040002127A700303C04000124845DF0FC
246:100F50003C05000124A5B13C3C06000124C6B2A812
247:100F600000C5302324022000AF42001C27A2003419
248:100F70000C0017A3AFA20010000219000003198291
249:100F80003C04080000641825AE4300282403001028
250:100F9000AF43003C96E30450AF4300408F43004012
251:100FA0003C04000124845E04AFA00014AFA3001031
252:100FB0008F47001C240516603C010001AC226EF036
253:100FC0001000002532C600208EE204488EE3044C57
254:100FD000AF43001C8F42001C2442E0002C42200141
255:100FE0001440000A240E00013C04000124845E1019
256:100FF000A3AE003FAFA00010AFA000148F46001CAE
257:10100000240517000C002B3B000038213C02000097
258:1010100024425CBC00021100000211823C03080063
259:1010200000431025AE42002824020008AF42003CD5
260:1010300096E20450AF4200408F4200403C04000161
261:1010400024845E1CAFA00014AFA200108F47001CC8
262:101050002405180032C600200C002B3B00000000C5
263:101060003C050FFF3C0300018C636EF434A5FFFFC9
264:10107000024030213C0200018C426EF83C04080022
265:101080000065182400031882006418250045102408
266:101090000002108200441025ACC2008032C20180E0
267:1010A00010400056ACC300208F82005C3C030080DF
268:1010B000004310241040000D000000008F820050FB
269:1010C000AFA200108F82005C240E00013C040001DE
270:1010D00024845E28A3AE003FAFA200148F87004097
271:1010E000240519000C002B3B02C030218F820050D8
272:1010F0003C030010004310241040001600000000C4
273:101100008C020218304200401040000F24020001FF
274:101110008F8200508C030218240E00013C04000151
275:1011200024845D50A3AE003FAFA20010AFA3001413
276:101130008F870040240520000C002B3B02C030218B
277:1011400010000004000000003C01000100370821ED
278:10115000A02240F43C04000124845E343C050001DC
279:1011600024A55AC03C06000124C65B3800C53023C4
280:101170008F42000827B300300260382127B10034C5
281:1011800034420E00AF4200080C0017A3AFB10010AC
282:101190003C04000124845E4C3C05000124A5D8B425
283:1011A0003C06000124C6E3C800C530230260382194
284:1011B000AF42010C0C0017A3AFB100103C040001BA
285:1011C00024845E643C05000124A5E9AC3C060001D2
286:1011D00024C6F0F000C53023026038213C01000134
287:1011E000AC226F040C0017A3AFB100103C04000147
288:1011F00024845E7C10000027240521003C040001AB
289:1012000024845E843C05000124A59FC83C0600019F
290:1012100024C6A10400C5302327B1003002203821A4
291:1012200027B300340C0017A3AFB300103C04000137
292:1012300024845E943C05000124A5CAD43C06000128
293:1012400024C6D8AC00C5302302203821AF42010C9F
294:101250000C0017A3AFB300103C04000124845EA46B
295:101260003C05000124A5E84C3C06000124C6E9A485
296:1012700000C53023022038213C010001AC226F045C
297:101280000C0017A3AFB300103C04000124845EB827
298:101290002405215002C03021000038213C0100010A
299:1012A000AC226F10AFA000100C002B3BAFA00014BD
300:1012B0003C110FFF3C0300018C636F043631FFFFCC
301:1012C000024098213C0200018C426F103C0E080045
302:1012D0000071182400031882006E18250051102494
303:1012E00000021082004E1025AE630038AE62007816
304:1012F0008C02021830420040144000042402000115
305:101300003C01000100370821A02240F43C04000108
306:1013100024845EC43C05000124A5E3D03C06000102
307:1013200024C6E52C00C5302327BE003003C0382179
308:1013300027B500340C0017A3AFB500103C01000125
309:10134000AC226EFC00511024000210823C0E0800FA
310:10135000004E1025AE62005032C220001040000640
311:1013600003C038213C02000024425CBC022210244D
312:101370001000000F000210823C04000124845ED89B
313:101380003C05000124A5E5343C06000124C6E6E442
314:1013900000C530230C0017A3AFB500103C010001BD
315:1013A000AC226F1400511024000210823C0E080081
316:1013B000004E1025AE62004832C2400010400005C9
317:1013C00027A700303C02000024425CBC1000000E45
318:1013D000000211003C04000124845EF03C05000181
319:1013E00024A5E6EC3C06000124C6E84400C53023F1
320:1013F00027A200340C0017A3AFA200103C0100018B
321:10140000AC226F0800021100000211823C030800A8
322:1014100000431025AE4200603C04000124845F08B4
323:101420003C05000124A582303C06000124C68650FC
324:1014300000C5302327B100300220382127B3003403
325:101440000C0017A3AFB300103C0E0FFF35CEFFFF0B
326:101450003C04000124845F143C05000024A564685A
327:101460003C06000024C6658800C5302302203821D0
328:101470000240F0213C010001AC226EDC004E102441
329:10148000000210823C15080000551025AFAE004444
330:10149000AFC200B80C0017A3AFB300103C040001AA
331:1014A00024845F203C05000024A565903C060000D4
332:1014B00024C668088FAE004400C5302302203821BE
333:1014C0003C010001AC226ED0004E102400021082BC
334:1014D00000551025AFC200E80C0017A3AFB30010F1
335:1014E0003C04000124845F383C05000024A56810FA
336:1014F0003C06000024C669408FAE004400C530237E
337:10150000022038213C010001AC226EC8004E10249C
338:101510000002108200551025AFC200C00C0017A3B6
339:10152000AFB300103C04000124845F503C0500016F
340:1015300024A5FAD03C06000124C6FBA88FAE0044C7
341:1015400000C53023022038213C010001AC226ED4BA
342:10155000004E10240002108200551025AFC200C8B2
343:101560000C0017A3AFB300103C04000124845F5C9F
344:101570003C05000124A5C93C3C06000124C6CA2044
345:1015800000C5302302203821AF4201100C0017A300
346:10159000AFB300103C04000124845F6C3C050001E3
347:1015A00024A5C9103C06000124C6C93400C5302357
348:1015B00002203821AF4201240C0017A3AFB3001062
349:1015C0003C04000124845F7C3C05000124A55A8072
350:1015D0003C06000124C65AAC00C530230220382145
351:1015E000AF420120AF4201140C0017A3AFB30010AB
352:1015F0003C04000124845F883C05000124A5F29886
353:101600003C06000124C6F6B400C530230220382170
354:10161000AF4201180C0017A3AFB300108FAE004407
355:101620003C010001AC226F18004E10240002108211
356:10163000005510250C003FC3AFC200D00C003C4049
357:10164000000000000C0027A800000000AC000228E9
358:10165000AC00022C96E204502442FFFFAF42003857
359:1016600096E20460AF42008032C2400014400003A2
360:101670000000000096E20480AF42008496E70490E8
361:1016800050E000012407080024E2FFFFAF42008879
362:10169000AF42007C2402080010E2000F32C240007A
363:1016A000104000032402040010E2000B00000000C0
364:1016B000240E00013C04000124845F98A3AE003F87
365:1016C00096E604902405217002C03821AFA00010D6
366:1016D0000C002B3BAFA000148F4301388F4401381E
367:1016E00024020001A34205C2AF430094AF44009816
368:1016F000AFA00010AFA000148F4600808F47008479
369:101700003C04000124845FA40C002B3B2405220030
370:101710000C0024A43C1108003C1433D83694CB5858
371:101720003C020800344200803C04000124845FB085
372:101730003C05000024A55D003C06000024C65D1C9D
373:1017400000C5302327A70030AF8200602402FFFFCE
374:10175000AF82006427A200340C0017A3AFA20010D0
375:101760003C010001AC226EB800021100000211829F
376:10177000005110250C0018FCAE4200008F82024080
377:101780003C03000100431025AF8202403C020000F0
378:1017900024424034AF820244AF8002408F82006016
379:1017A00000511024144000053C0308008F820060A3
380:1017B000004310241040FFFD000000000C003C4DD1
381:1017C000000088213C020100AFA200208F530018C6
382:1017D000240200FF56620001267100018C020228DB
383:1017E0001622000E001330C08F42033C2442000139
384:1017F000AF42033C8F42033C8C0202283C040001B0
385:1018000024845C243C050009AFA00014AFA20010A2
386:101810008FA600201000003F34A5010000D7102142
387:101820008FA300208FA40024AC4304C0AC4404C4A4
388:1018300000C018218F4401788F45017C00001021E1
389:1018400024070004AFA70010AFB100148F48000CAC
390:1018500024C604C002E63021AFA800188F48010C4E
391:101860002407000800A3282100A3482B0082202180
392:101870000100F809008920211440000B240700080A
393:101880008F820120AFA200108F8201243C0400014E
394:1018900024845C2C3C050009AFA200148FA6002014
395:1018A0001000001C34A502008F4401608F450164C4
396:1018B0008F43000CAF5100188F86012024020010C6
397:1018C000AFA20010AFB10014AFA300188F42010CFB
398:1018D0000040F80924C6001C14400010000000005D
399:1018E0008F42034024420001AF4203408F42034035
400:1018F0008F820120AFA200108F8201243C040001DE
401:1019000024845C343C050009AFA200148FA600209B
402:1019100034A503000C002B3B026038218F4202E407
403:1019200024420001AF4202E48F4202E493A2003F4E
404:10193000104000693C02070034423000AFA200288A
405:101940008F530018240200FF126200020000882159
406:10195000267100018C0202281622000E001330C0EE
407:101960008F42033C24420001AF42033C8F42033CC0
408:101970008C0202283C04000124845C243C050009FC
409:10198000AFA00014AFA200108FA600281000003FE7
410:1019900034A5010000D710218FA300288FA4002CAC
411:1019A000AC4304C0AC4404C400C018218F44017887
412:1019B0008F45017C0000102124070004AFA7001010
413:1019C000AFB100148F48000C24C604C002E63021D9
414:1019D000AFA800188F48010C2407000800A3282195
415:1019E00000A3482B008220210100F8090089202152
416:1019F0001440000B240700088F820120AFA20010C2
417:101A00008F8201243C04000124845C2C3C050009E5
418:101A1000AFA200148FA600281000001C34A50200FD
419:101A20008F4401608F4501648F43000CAF51001853
420:101A30008F86012024020010AFA20010AFB1001465
421:101A4000AFA300188F42010C0040F80924C6001C07
422:101A500014400010000000008F42034024420001A7
423:101A6000AF4203408F4203408F820120AFA200109B
424:101A70008F8201243C04000124845C343C0500096D
425:101A8000AFA200148FA6002834A503000C002B3B46
426:101A9000026038218F4202F024420001AF4202F07E
427:101AA0008F4202F03C04000124845FC0AFA000100C
428:101AB000AFA000148FA60028240523000C002B3BA8
429:101AC0000000382110000004000000008C020264B5
430:101AD00010400005000000008F8200A0304200048A
431:101AE0001440FFFA000000008F82004434420004DA
432:101AF000AF8200448F42030824420001AF42030832
433:101B00008F4203088F8200D88F8300D400431023B4
434:101B10002442FF80AF4200908F4200902842FF8114
435:101B200010400006240200018F4200908F430144C0
436:101B300000431021AF42009024020001AF42008C0C
437:101B400032C2000810400006000000008F8202141C
438:101B50003C0381003042FFFF00431025AF82021496
439:101B60003C0300018C636D94306200021040000958
440:101B7000306200013C04000124845FCC3C0500007D
441:101B800024A56D503C06000024C671C81000001248
442:101B900000C5302310400009000000003C04000193
443:101BA00024845FDC3C05000024A571D03C060000C5
444:101BB00024C676781000000800C530233C040001DC
445:101BC00024845FEC3C05000024A569483C06000025
446:101BD00024C66D4800C5302327A7003027A2003453
447:101BE0000C0017A3AFA200103C010001AC226ECC88
448:101BF0003C0200018C426ECC3C0308000002110044
449:101C00000002118200431025AE4200408F8200A0E6
450:101C1000AFA200108F8200B0AFA200148F86005CCC
451:101C20008F87011C3C04000124845FFC3C010001FF
452:101C3000AC366EA43C010001AC206E943C01000166
453:101C4000AC3C6E8C3C010001AC3B6EBC3C01000125
454:101C5000AC376EC03C010001AC3A6EA00C002B3BCF
455:101C6000240524008F820200AFA200108F82022080
456:101C7000AFA200148F8600448F8700503C040001FF
457:101C8000248460080C002B3B240525008F83006012
458:101C90000074100B0242000A0200F821000000004C
459:101CA0000000000D8FBF00608FBE005C8FB5005834
460:101CB0008FB300548FB200508FB1004C8FB00048EA
461:101CC00003E0000827BD006827BDFFE03C040001D9
462:101CD00024846014240526000000302100003821EF
463:101CE000AFBF0018AFA000100C002B3BAFA000143A
464:101CF0008FBF001803E0000827BD002003E00008A4
465:101D00000000000003E000080000000000000000E8
466:101D100000000000000000000000000000000000C3
467:101D200003E000080000000003E0000800000000DD
468:101D300027BDFDE027A500183C04DEAD3484BEEFCE
469:101D4000AFBF02188F8201503C03001F3463FFFFB6
470:101D5000AFA4001800A2282300A328248CA200000E
471:101D60001044000A00000000AFA500108CA2000083
472:101D7000AFA200148F8601508F8702503C040001EF
473:101D80002484601C0C002B3B240527008FBF021805
474:101D900003E0000827BD022027BDFFE03C06ABBAE8
475:101DA00034C6BABEAFB000183C1000043C07007F38
476:101DB00034E7FFFFAFBF001C001028408E04000076
477:101DC0008CA30000ACA00000AE0600008CA20000B6
478:101DD000ACA3000010460005AE04000000A0802166
479:101DE00000F0102B1040FFF5001028403C040001CB
480:101DF00024846028240528000200302100003821B6
481:101E0000AFA000100C002B3BAFA00014020010216B
482:101E10008FBF001C8FB0001803E0000827BD002012
483:101E20008C0202243047003F10E000100080302177
484:101E3000000028212403002000E3102410400002A9
485:101E40000006304200A62821000318421460FFFB60
486:101E500000E310242402F00000A228243402FFFF33
487:101E60000045102B144000033C0200011000000844
488:101E70003C0200013442FFFF008518230043102B71
489:101E80001440000300A010213C02FFFE008210213C
490:101E900003E000080000000027BDFFD0AFB5002818
491:101EA0008FB50040AFB2002000A09021AFB1001C60
492:101EB00024C60003AFBF002CAFB30024AFB000189E
493:101EC0008EA200002403FFFC00C380240050102BCE
494:101ED0001440001B00E088218E330000AFB00010DA
495:101EE0008EA20000AFA200148E270000240530004F
496:101EF0000C002B3B024030218E230000007020217B
497:101F00000064102B10400007024028218CA2000022
498:101F1000AC620000246300040064102B1440FFFB3B
499:101F200024A500048EA2000000501023AEA20000E1
500:101F30008E220000005010211000000BAE22000085
501:101F40002402002DA0820000AFB000108EA200007D
502:101F500002409821AFA200148E2700002405310012
503:101F60000C002B3B02603021026010218FBF002C3F
504:101F70008FB500288FB300248FB200208FB1001CD2
505:101F80008FB0001803E0000827BD003027BDFFE830
506:101F90003C1CC0003C05FFFE3C0300018C636E84CA
507:101FA0003C0400018C846E9034A5BF0824021FFC01
508:101FB0003C010001AC226CD03C0200C03C0100019D
509:101FC000AC226CD43C020020AFBF00103C0100C02A
510:101FD000AC201FFC0043102300441023245BB000FE
511:101FE0000365B8213C1D00018FBD6CCC03A0F0211E
512:101FF0003C0400C0348402003C1A00C03C0300C012
513:10200000346307C824021DFC3C010001AC226CD0E3
514:10201000240218343C010001AC246CD43C010001C2
515:10202000AC226CD03C010001AC236CD40C00180D28
516:10203000375A02008FBF001003E0000827BD0018C8
517:1020400027BDFFC83C04000124846034240532000D
518:102050003C0200018C426CD03C0300018C636CD4C8
519:102060000000302103603821AFBF0030AFB3002C37
520:10207000AFB20028AFB10024AFB00020AFA2001C67
521:10208000AFA30018AFB700100C002B3BAFBA001481
522:102090000C001916000000008F8202403442000438
523:1020A000AF82024024020001AF4200003C02000166
524:1020B00000571021904240F4104000922403FFFC8E
525:1020C0003C1000012610AC733C1200012652A84CB3
526:1020D00002121023004380248FA3001C3C04000143
527:1020E000248460400070102B1440001A27B300189D
528:1020F0008FB100182405300002403021AFB000102D
529:10210000AFA300140C002B3B022038218FA3001832
530:10211000007020210064102B104000070240302185
531:102120008CC20000AC620000246300040064102B29
532:102130001440FFFB24C600048FA2001C0050102393
533:10214000AFA2001C8E620000005010211000000A97
534:10215000AE6200000240882124053100AFB00010BB
535:10216000AFA300148FA70018022030212402002DF5
536:102170000C002B3BA0820000240700208FA3001C32
537:102180003C0400012484605C241200203C01000116
538:10219000AC316EB02C6200201440001D27B1001835
539:1021A0008FB00018240530003C06000124C66F5093
540:1021B000AFA70010AFA300140C002B3B0200382186
541:1021C0008FA300183C04000124846F502465002074
542:1021D0000065102B10400007000000008C820000FA
543:1021E000AC620000246300040065102B1440FFFB68
544:1021F000248400048FA2001C00521023AFA2001CF4
545:102200008E220000005210211000000BAE220000B0
546:102210003C10000126106F5024053100AFA70010BC
547:10222000AFA300148FA70018020030212402002D54
548:102230000C002B3BA0820000240700203C0400017E
549:10224000248460708FA3001C241200203C01000134
550:10225000AC306EE42C6200201440001D27B1001841
551:102260008FB00018240530003C06000124C66F70B2
552:10227000AFA70010AFA300140C002B3B02003821C5
553:102280008FA300183C04000124846F702465002093
554:102290000065102B10400007000000008C82000039
555:1022A000AC620000246300040065102B1440FFFBA7
556:1022B000248400048FA2001C00521023AFA2001C33
557:1022C0008E220000005210211000000BAE220000F0
558:1022D0003C10000126106F7024053100AFA70010DC
559:1022E000AFA300148FA70018020030212402002D94
560:1022F0000C002B3BA08200003C01000110000031CB
561:10230000AC306EE03C1000012610821F3C12000130
562:102310002652809C02121023004380248FA3001CAD
563:102320003C040001248460840070102B1440001AC7
564:1023300027B300188FB10018240530000240302167
565:10234000AFB00010AFA300140C002B3B02203821CB
566:102350008FA30018007020210064102B104000078C
567:10236000024030218CC20000AC62000024630004F3
568:102370000064102B1440FFFB24C600048FA2001C35
569:1023800000501023AFA2001C8E62000000501021EC
570:102390001000000AAE6200000240882124053100CE
571:1023A000AFB00010AFA300148FA700180220302197
572:1023B0002402002D0C002B3BA08200003C010001F8
573:1023C000AC316EB03C0300018C636EB0240204009B
574:1023D0000060F809AF8200708FBF00308FB3002C0F
575:1023E0008FB200288FB100248FB0002003E00008D6
576:1023F00027BD003800000000000000008F82004070
577:102400003C03F000004310243C036000144300062A
578:10241000000000008F8200502403FF80004310243E
579:1024200034420055AF8200508F820054244203E8AA
580:10243000AF820058240201F4AF4200E024020004FD
581:10244000AF4200E824020002AF4001B0AF4000E418
582:10245000AF4200DCAF4000D8AF4000D403E000083A
583:10246000AF4000D08F8200542442000503E00008F2
584:10247000AF82007827BDFFE8AFBF00108F82005405
585:10248000244203E8AF8200583C02080002C2102434
586:10249000104000043C02F7FF3442FFFF02C2B024A8
587:1024A000369400403C0200018C426DA81040001799
588:1024B0003C0202003C0300018C636F1C106000169C
589:1024C0000282A0253C0200018C426E44144000129E
590:1024D0003C0202003C0200018C426D943042000339
591:1024E0001440000D3C0202008F8302243C020002D3
592:1024F0008C428FEC106200083C0202000C003DAFE1
593:1025000000000000100000043C0202000C00419694
594:10251000000000003C02020002C210241040000330
595:10252000000000000C001F4B000000008F4200D88C
596:102530008F4300DC24420001AF4200D80043102B3F
597:102540001440000300000000AF4000D83694008023
598:102550008C0302381060000C000000008F4201B0B4
599:10256000244203E8AF4201B00043102B14400006A0
600:1025700000000000934205C5144000030000000065
601:102580000C001DA0000000008FBF001003E0000839
602:1025900027BD001803E000080000000027BDFFD899
603:1025A000AFBF00208F43002C8F42003810620059CB
604:1025B000000000003C02000100571021904240F052
605:1025C00010400026240700088F4401708F450174D5
606:1025D0008F48000C8F86012024020020AFA200103B
607:1025E000AFA30014AFA800188F42010C0040F809F7
608:1025F00024C6001C14400011240200013C0100010B
609:1026000000370821A02240F08F820124AFA20010E1
610:102610008F8201283C04000124846128AFA20014A9
611:102620008F46002C8F8701203C0500090C002B3BB6
612:1026300034A509001000005C000000008F42030078
613:1026400024420001AF4203008F4203008F42002C5E
614:10265000A34005C110000027AF4200388F4401702D
615:102660008F4501748F43002C8F48000C8F8601200A
616:1026700024020080AFA20010AFA30014AFA800187E
617:102680008F42010C0040F80924C6001C14400011C0
618:10269000240200013C01000100370821A02240F182
619:1026A0008F820124AFA200108F8201283C04000118
620:1026B00024846134AFA200148F46002C8F87012040
621:1026C0003C0500090C002B3B34A51100100000361E
622:1026D000000000008F4203008F43002C24420001C1
623:1026E000AF4203008F42030024020001A34205C150
624:1026F000AF4300383C01000100370821A02040F121
625:102700003C01000100370821A02040F01000002605
626:10271000AF400034934205C11040001D000000008E
627:10272000A34005C18F8200403042000114400008E0
628:10273000000020218C0301042402000150620005E6
629:10274000240400018C020264104000030080102168
630:102750002404000100801021104000060000000049
631:102760008F42030C24420001AF42030C100000080A
632:102770008F42030C8F82004434420004AF82004435
633:102780008F42030824420001AF4203088F4203082E
634:102790003C01000100370821A02040F03C0100016D
635:1027A00000370821A02040F18F42000010400007B0
636:1027B00000000000AF80004C8F82004C1040FFFDF5
637:1027C000000000001000000500000000AF8000487D
638:1027D0008F8200481040FFFD000000008F820060E3
639:1027E0003C03FF7F3463FFFF00431024AF8200608F
640:1027F0008F420000104000030000000010000002A3
641:10280000AF80004CAF8000488FBF002003E000087D
642:1028100027BD002803E000080000000027BDFFD806
643:10282000AFBF00208F4300448F42007C106200291C
644:10283000240700088F4401688F45016C8F48000C05
645:102840008F86012024020040AFA20010AFA3001425
646:10285000AFA800188F42010C0040F80924C6001CE4
647:1028600014400011240200013C010001003708213E
648:10287000A02240F28F820124AFA200108F82012893
649:102880003C0400012484613CAFA200148F46004444
650:102890008F8701203C0500090C002B3B34A5130059
651:1028A0001000000F000000008F42030424420001CA
652:1028B000AF4203048F4203048F420044AF42007CC6
653:1028C0003C01000100370821A02040F21000000464
654:1028D000AF4000783C01000100370821A02040F201
655:1028E0008F4200001040000700000000AF80004C45
656:1028F0008F82004C1040FFFD00000000100000051A
657:1029000000000000AF8000488F8200481040FFFDAB
658:10291000000000008F8200603C03FEFF3463FFFF75
659:1029200000431024AF8200608F420000104000037B
660:102930000000000010000002AF80004CAF80004893
661:102940008FBF002003E0000827BD002803E0000837
662:10295000000000003C0200018C426DA827BDFFA8CA
663:10296000AFBF0050AFBE004CAFB50048AFB300449E
664:10297000AFB20040AFB1003CAFB00038104000D55E
665:102980008F9000448F4200D0244300012842000B66
666:10299000144000E4AF4300D08F42000430420002F4
667:1029A0001440009CAF4000D08F4200043C03000163
668:1029B0008C636D9834420002AF420004240200018F
669:1029C000146200033C020600100000023442300092
670:1029D00034421000AFA200208F4A0018AFAA003482
671:1029E00027AA0020AFAA002C8FAA0034240200FFDF
672:1029F0001142000200001821254300018C02022828
673:102A0000006098211662000E3C0500098F42033CCD
674:102A100024420001AF42033C8F42033C8C02022857
675:102A20008FA700343C0400012484610CAFA0001483
676:102A3000AFA200108FA600201000007034A5050082
677:102A40008FAA0034000A38C000F710218FA300209D
678:102A50008FA40024AC4304C0AC4404C48F8300544E
679:102A60008F820054247103E8022210232C4203E9D0
680:102A70001040001B0000A82100E09021265E04C049
681:102A80008F4401788F45017C02401821240A0004FC
682:102A9000AFAA0010AFB300148F48000C0000102143
683:102AA00002FE3021AFA800188F48010C240700084F
684:102AB00000A3282100A3482B008220210100F8094F
685:102AC0000089202154400006241500018F82005403
686:102AD000022210232C4203E91440FFE90000000009
687:102AE00032A200FF54400018AF5300188F42037801
688:102AF00024420001AF4203788F4203788F82012085
689:102B00008FAA002C8FA70034AFA200108F8201245F
690:102B10003C04000124846118AFA200148D4600001B
691:102B20003C0500091000003534A506008F4203085B
692:102B30002415000124420001AF4203088F4203081C
693:102B40001000001E32A200FF8F8300548F820054B9
694:102B5000247103E8022210232C4203E910400016DE
695:102B60000000A8213C1E0020241200108F42000CFF
696:102B70008F4401608F4501648F860120AFB2001041
697:102B8000AFB30014005E1025AFA200188F42010CF5
698:102B9000240700080040F80924C6001C1440FFE385
699:102BA000000000008F820054022210232C4203E90F
700:102BB0001440FFEE0000000032A200FF144000119C
701:102BC0003C0500098F42037824420001AF4203789C
702:102BD0008F4203788F8201208FAA002C8FA70034A8
703:102BE000AFA200108F8201243C04000124846120E4
704:102BF000AFA200148D46000034A507000C002B3B4B
705:102C0000000000008F4202EC24420001AF4202ECBF
706:102C10008F4202EC8F4200043042000150400029F4
707:102C2000361000403C02040002C210241040001381
708:102C30002404FFDF8F4202508F4302548F4401B4BB
709:102C400014640006361000408F4202708F430274F5
710:102C50008F4401B8106400072402FFDF8F42025046
711:102C60008F4302548F4402708F450274100000128B
712:102C70003A1000201000002B020280248F420250E4
713:102C80008F4302548F4501B414650006020480246A
714:102C90008F4202708F4302748F4401B85064002148
715:102CA000361000408F4202508F4302548F4402700E
716:102CB0008F4502743A100040AF4301B41000001970
717:102CC000AF4501B88F4200D4244300011000001129
718:102CD000284200338F4200043042000110400009B6
719:102CE0003C02040002C21024104000042402FFDF52
720:102CF000020280241000000B361000401000000972
721:102D0000361000608F4200D436100040244300018A
722:102D1000284201F514400003AF4300D4AF4000D473
723:102D20003A100020AF9000442402FF7F0282A024CA
724:102D30008FBF00508FBE004C8FB500488FB300444A
725:102D40008FB200408FB1003C8FB0003803E0000824
726:102D500027BD005803E00008000000003C0200010D
727:102D60008C426DA827BDFFB0AFBF0048AFBE004486
728:102D7000AFB50040AFB3003CAFB20038AFB10034E4
729:102D8000104000C7AFB000308F4200D02443000194
730:102D90002842000B144000DAAF4300D08F420004F9
731:102DA0003042000214400097AF4000D08F42000430
732:102DB0003C0300018C636D9834420002AF42000472
733:102DC00024020001146200033C020600100000020D
734:102DD0003442300034421000AFA20020000018211D
735:102DE0008F5E001827AA0020240200FF13C20002F1
736:102DF000AFAA002C27C300018C020228006090219A
737:102E00001642000E001E38C08F42033C24420001CF
738:102E1000AF42033C8F42033C8C0202283C04000179
739:102E20002484610C3C050009AFA00014AFA200107F
740:102E30008FA600201000006D34A5050000F71021BA
741:102E40008FA300208FA40024AC4304C0AC4404C46E
742:102E50008F8300548F820054247003E802021023F1
743:102E60002C4203E91040001B0000982100E088215B
744:102E7000263504C08F4401788F45017C022018213B
745:102E8000240A0004AFAA0010AFB200148F48000C4F
746:102E90000000102102F53021AFA800188F48010C66
747:102EA0002407000800A3282100A3482B008220212A
748:102EB0000100F80900892021544000062413000174
749:102EC0008F820054020210232C4203E91440FFE9D0
750:102ED00000000000326200FF54400017AF5200189B
751:102EE0008F42037824420001AF4203788F42037877
752:102EF0008F8201208FAA002CAFA200108F820124A4
753:102F00003C040001248461183C050009AFA20014B0
754:102F10008D4600001000003534A506008F420308DE
755:102F20002413000124420001AF4203088F4203082A
756:102F30001000001E326200FF8F8300548F82005405
757:102F4000247003E8020210232C4203E9104000160B
758:102F5000000098213C150020241100108F42000C25
759:102F60008F4401608F4501648F860120AFB100104E
760:102F7000AFB2001400551025AFA200188F42010C0B
761:102F8000240700080040F80924C6001C1440FFE391
762:102F9000000000008F820054020210232C4203E93B
763:102FA0001440FFEE00000000326200FF14400011E8
764:102FB000000000008F42037824420001AF420378F2
765:102FC0008F4203788F8201208FAA002CAFA20010BD
766:102FD0008F8201243C040001248461203C05000907
767:102FE000AFA200148D46000034A507000C002B3B57
768:102FF00003C038218F4202EC24420001AF4202ECB0
769:103000008F4202EC8F420004304200011040001851
770:10301000240400018F4202508F4302548F4501B4B3
771:103020003C01000114650006A0246CF18F4202707F
772:103030008F4302748F4401B8106400210000000027
773:103040008F4202508F4302543C04000190846CF084
774:103050008F4602708F47027438840001AF4301B479
775:10306000AF4701B83C01000110000025A0246CF01E
776:103070008F4200D43C010001A0206CF024430001E9
777:10308000284200331440001EAF4300D43C0200012C
778:1030900090426CF1AF4000D410000017384200019C
779:1030A0008F42000430420001104000080000000080
780:1030B0000C00565A000020213C010001A0206CF1B8
781:1030C0003C0100011000000EA0206CF08F4200D4E3
782:1030D0003C010001A0206CF024430001284201F5CE
783:1030E00014400007AF4300D43C02000190426CF151
784:1030F000AF4000D4004210263C010001A0226CF138
785:103100003C0300018C636D98240200021462000CE1
786:103110003C0300023C03000190636CF124020001B7
787:103120005462001F000020213C02000190426CF01C
788:103130001443001B24040005100000192404000699
789:103140003C0200028C428FF4004310241040000B1C
790:10315000240200013C03000190636CF154620010F2
791:10316000000020213C02000190426CF01443000C4E
792:10317000240400031000000A240400043C0300019E
793:1031800090636CF114620006000020213C020001F3
794:1031900090426CF024040001504400012404000219
795:1031A0000C00565A000000002402FF7F0282A02477
796:1031B0008FBF00488FBE00448FB500408FB3003CE6
797:1031C0008FB200388FB100348FB0003003E00008B8
798:1031D00027BD005003E00008000000003C02000191
799:1031E0008C426DA827BDFFB0AFBF0048AFBE004402
800:1031F000AFB50040AFB3003CAFB20038AFB1003460
801:10320000104000DEAFB000308F4200D03C0400011F
802:103210008C846D98244300012842000BAF4400E8E1
803:10322000144000FEAF4300D08F4200043042000241
804:1032300014400095AF4000D08F4200043442000299
805:10324000AF42000424020001148200033C02060085
806:10325000100000023442300034421000AFA20020BF
807:10326000000018218F5E001827AA0020240200FF0A
808:1032700013C20002AFAA002C27C300018C0202284F
809:10328000006090211642000E001E38C08F42033CA1
810:1032900024420001AF42033C8F42033C8C020228CF
811:1032A0003C0400012484610C3C050009AFA000141B
812:1032B000AFA200108FA600201000006D34A50500FD
813:1032C00000F710218FA300208FA40024AC4304C07A
814:1032D000AC4404C48F8300548F820054247003E8EC
815:1032E000020210232C4203E91040001B0000982129
816:1032F00000E08821263504C08F4401788F45017C89
817:1033000002201821240A0004AFAA0010AFB2001452
818:103310008F48000C0000102102F53021AFA80018E2
819:103320008F48010C2407000800A3282100A3482B84
820:10333000008220210100F809008920215440000664
821:10334000241300018F820054020210232C4203E94F
822:103350001440FFE900000000326200FF54400017F3
823:10336000AF5200188F42037824420001AF42037825
824:103370008F4203788F8201208FAA002CAFA2001009
825:103380008F8201243C040001248461183C0500095B
826:10339000AFA200148D4600001000003534A50600D1
827:1033A0008F4203082413000124420001AF420308A6
828:1033B0008F4203081000001E326200FF8F8300540A
829:1033C0008F820054247003E8020210232C4203E988
830:1033D00010400016000098213C1500202411001018
831:1033E0008F42000C8F4401608F4501648F8601205D
832:1033F000AFB10010AFB2001400551025AFA20018F5
833:103400008F42010C240700080040F80924C6001C64
834:103410001440FFE3000000008F82005402021023DA
835:103420002C4203E91440FFEE00000000326200FF6E
836:1034300014400011000000008F4203782442000174
837:10344000AF4203788F4203788F8201208FAA002C2D
838:10345000AFA200108F8201243C040001248461206B
839:103460003C050009AFA200148D46000034A50700FA
840:103470000C002B3B03C038218F4202EC2442000198
841:10348000AF4202EC8F4202EC8F4200043042000156
842:10349000104000333C02040002C210241040001708
843:1034A00000000000934205C08F4402508F45025433
844:1034B0008F4301B43442002014A30006A34205C088
845:1034C0008F4202708F4302748F4401B81064000869
846:1034D000000000008F4202508F430254934405C005
847:1034E0008F4602708F470274100000163884004027
848:1034F000934205C010000048304200BF934205C00F
849:103500008F4402508F4502548F4301B4304200BFB4
850:1035100014A30006A34205C08F4202708F430274B9
851:103520008F4401B81064000B000000008F4202506D
852:103530008F430254934405C08F4602708F47027434
853:1035400038840020AF4301B4AF4701B81000003306
854:10355000A34405C0934205C01000002F3442002050
855:10356000934205C08F4300D434420020A34205C0DB
856:103570002462000110000023286300338F4200E41E
857:103580008F4300E024420001AF4200E40043102AD0
858:1035900014400006240300018F4200E81443000297
859:1035A000AF4000E424030004AF4300E88F4200046E
860:1035B000304200011040000D3C02040002C2102401
861:1035C0001040000700000000934205C03442004054
862:1035D000A34205C0934205C01000000F304200DF37
863:1035E000934205C01000000C34420060934205C0B5
864:1035F0008F4300D434420020A34205C0246200015E
865:10360000286300FB14600005AF4200D4934205C05C
866:10361000AF4000D438420040A34205C0934205C0E9
867:103620008F4300E83042007FA34205C0240200011E
868:103630001462000500000000934405C0000421024C
869:1036400010000003348400F0934405C03484000F5C
870:103650000C005640000000002402FF7F0282A024DC
871:103660008FBF00488FBE00448FB500408FB3003C31
872:103670008FB200388FB100348FB0003003E0000803
873:1036800027BD005003E000080000000027BDFFB088
874:10369000274401C026E30028246504000065102BA0
875:1036A000AFBF0048AFBE0044AFB50040AFB3003C71
876:1036B000AFB20038AFB1003410400007AFB00030F7
877:1036C0008C820000AC620000246300040065102BB3
878:1036D0001440FFFB248400048C020080AEE200440E
879:1036E0008C0200C0AEE200408C020084AEE20030EA
880:1036F0008C020084AEE2023C8C020088AEE2024002
881:103700008C02008CAEE202448C020090AEE20248D1
882:103710008C020094AEE2024C8C020098AEE20250A1
883:103720008C02009CAEE202548C0200A0AEE2025871
884:103730008C0200A4AEE2025C8C0200A8AEE2026041
885:103740008C0200ACAEE202648C0200B0AEE2026811
886:103750008C0200B4AEE2026C8C0200B8AEE20270E1
887:103760008C0200BC24040001AEE20274AEE000341E
888:1037700000041080005710218EE300348C42023C7C
889:1037800024840001006218212C82000FAEE3003473
890:103790001440FFF8000410808C0200CCAEE2004818
891:1037A0008C0200D0AEE2004C8C0200E0AEE201F8E8
892:1037B0008C0200E4AEE201FC8C0200E8AEE2020002
893:1037C0008C0200ECAEE202048C0200F0AEE20208D1
894:1037D0008EE400C08EE500C48C0200FC0045102B76
895:1037E0001040000B000000008EE200C08EE300C419
896:1037F0002404000124050000006518210065302B19
897:103800000044102100461021AEE200C0AEE300C427
898:103810008C0200FC8EE400C08EE500C42408FFFF8B
899:1038200024090000004018210000102100882024F5
900:1038300000A928240082202500A32825AEE400C08A
901:10384000AEE500C48EE400D08EE500D48C0200F416
902:103850000045102B1040000B000000008EE200D04D
903:103860008EE300D424040001240500000065182123
904:103870000065302B0044102100461021AEE200D03C
905:10388000AEE300D48C0200F48EE400D08EE500D4C8
906:1038900000401821000010210088202400A92824BD
907:1038A0000082202500A32825AEE400D0AEE500D498
908:1038B0008EE400C88EE500CC8C0200F80045102B89
909:1038C0001040000B000000008EE200C88EE300CC28
910:1038D0002404000124050000006518210065302B38
911:1038E0000044102100461021AEE200C8AEE300CC37
912:1038F0008C0200F88EE400C88EE500CC0040182150
913:10390000000010210088202400A9282400822025FE
914:1039100000A3282524020008AEE400C8AEE500CCD0
915:10392000AFA20010AFA000148F42000C8C0402085C
916:103930008C05020CAFA200188F42010C26E600286D
917:103940000040F80924070400104000F03C02040085
918:10395000AFA20020934205C6104000890000182144
919:103960008F5E001827AA0020240200FF13C2000265
920:10397000AFAA002C27C300018C020228006090210E
921:103980001642000E001E38C08F42033C2442000144
922:10399000AF42033C8F42033C8C0202283C040001EE
923:1039A0002484610C3C050009AFA00014AFA20010F4
924:1039B0008FA600201000006B34A5050000F7102131
925:1039C0008FA300208FA40024AC4304C0AC4404C4E3
926:1039D0008F8300548F820054247003E80202102366
927:1039E0002C4203E91040001B0000982100E08821D0
928:1039F000263504C08F4401788F45017C02201821B0
929:103A0000240A0004AFAA0010AFB200148F48000CC3
930:103A10000000102102F53021AFA800188F48010CDA
931:103A20002407000800A3282100A3482B008220219E
932:103A30000100F809008920215440000624130001E8
933:103A40008F820054020210232C4203E91440FFE944
934:103A500000000000326200FF54400017AF5200180F
935:103A60008F42037824420001AF4203788F420378EB
936:103A70008F8201208FAA002CAFA200108F82012418
937:103A80003C040001248461183C050009AFA2001425
938:103A90008D4600001000003334A506008F42030855
939:103AA0002413000124420001AF4203088F4203089F
940:103AB0001000001C326200FF8F8300548F8200547C
941:103AC000247003E8020210232C4203E91040001482
942:103AD00000009821241100108F42000C8F440160D7
943:103AE0008F4501648F860120AFB10010AFB2001482
944:103AF000AFA200188F42010C240700080040F8090B
945:103B000024C6001C1440FFE5000000008F82005412
946:103B1000020210232C4203E91440FFEF00000000D2
947:103B2000326200FF54400012240200018F420378E9
948:103B300024420001AF4203788F4203788F82012034
949:103B40008FAA002CAFA200108F8201243C04000138
950:103B5000248461203C050009AFA200148D460000BA
951:103B600034A507000C002B3B03C0382100001021B6
952:103B70001440005B240200011000006500000000FA
953:103B80008F510018240200FF122200020000802141
954:103B9000263000018C0202281602000E001130C0EF
955:103BA0008F42033C24420001AF42033C8F42033C5E
956:103BB0008C0202283C040001248460F43C050009C6
957:103BC000AFA00014AFA200108FA600201000003F8D
958:103BD00034A5010000D710218FA300208FA400245A
959:103BE000AC4304C0AC4404C400C018218F44017825
960:103BF0008F45017C0000102124070004AFA70010AE
961:103C0000AFB000148F48000C24C604C002E6302177
962:103C1000AFA800188F48010C2407000800A3282132
963:103C200000A3482B008220210100F80900892021EF
964:103C30001440000B240700088F820120AFA200105F
965:103C40008F8201243C040001248460FC3C050009AF
966:103C5000AFA200148FA600201000001C34A50200A3
967:103C60008F4401608F4501648F43000CAF500018F2
968:103C70008F86012024020010AFA20010AFB0001404
969:103C8000AFA300188F42010C0040F80924C6001CA5
970:103C900054400011240200018F42034024420001DD
971:103CA000AF4203408F4203408F820120AFA2001039
972:103CB0008F8201243C040001248461043C05000936
973:103CC000AFA200148FA6002034A503000C002B3BEC
974:103CD00002203821000010211040000D24020001B4
975:103CE0008F4202E8A34005C6AF4001B02442000164
976:103CF000AF4202E88F4202E88EE201502442000106
977:103D0000AEE20150100000038EE2015024020001D7
978:103D1000A34205C68FBF00488FBE00448FB5004048
979:103D20008FB3003C8FB200388FB100348FB00030B9
980:103D300003E0000827BD005027BDFFD8AFBF00201B
981:103D40008F8200B030420004104000680000000084
982:103D50008F4301288F8201041462000500000000D7
983:103D60008F4301308F8200B4106200060000000013
984:103D70008F820104AF4201288F8200B41000005BE3
985:103D8000AF4201308F8200B03C030080004310241A
986:103D90001040000D000000008F82011C3442000220
987:103DA000AF82011C8F8200B02403FFFB004310246C
988:103DB000AF8200B08F82011C2403FFFD004310245A
989:103DC0001000004AAF82011C8F4301288F8201043A
990:103DD00014620005000000008F4301308F8200B4A0
991:103DE00010620010000000008F820104AF42012821
992:103DF0008F8200B48F430128AF420130AFA300107F
993:103E00008F4201303C04000124846144AFA20014BD
994:103E10008F86011C8F8700B03C0500051000003123
995:103E200034A509008F420128AFA200108F42013053
996:103E30003C04000124846150AFA200148F86011C51
997:103E40008F8700B03C0500050C002B3B34A510000B
998:103E50008F82011C34420002AF82011C8F83010457
999:103E60008F8200B034420001AF8200B0240200080B
1000:103E7000AF830104AFA20010AFA000148F42000C6A
1001:103E80008C0402088C05020CAFA200188F42010CB2
1002:103E900026E600280040F809240704008F82011C50
1003:103EA0002403FFFD00431024AF82011C8EE201DCDD
1004:103EB00024420001AEE201DC8EE201DC8F420128E7
1005:103EC000AFA200108F4201303C0400012484615CE9
1006:103ED000AFA200148F86011C8F8700B03C0500053F
1007:103EE00034A511000C002B3B000000008F8200A0C5
1008:103EF0003042000410400069000000008F43012C94
1009:103F00008F82012414620005000000008F430134F9
1010:103F10008F8200A410620006000000008F8201243E
1011:103F2000AF42012C8F8200A41000005CAF4201342C
1012:103F30008F8200A03C030080004310241040000D3D
1013:103F4000000000008F82011C34420002AF82011C7D
1014:103F50008F8200A02403FFFB00431024AF8200A047
1015:103F60008F82011C2403FFFD004310241000004B2E
1016:103F7000AF82011C8F43012C8F8201241462000543
1017:103F8000000000008F4301348F8200A410620010F3
1018:103F9000000000008F820124AF42012C8F8200A418
1019:103FA0008F43012CAF420134AFA300108F42013484
1020:103FB0003C04000124846168AFA200148F86011CB8
1021:103FC0008F8700A03C0500051000003234A51200C8
1022:103FD0008F42012CAFA200108F4201343C0400013B
1023:103FE00024846174AFA200148F86011C8F8700A007
1024:103FF0003C0500050C002B3B34A513008F82011CEF
1025:1040000034420002AF82011C8F8301248F8200A002
1026:1040100034420001AF8200A024020080AF8301245B
1027:10402000AFA20010AFA000148F4200148C0402084D
1028:104030008C05020CAFA200188F4201083C0600015B
1029:1040400024C66ED80040F809240700048F82011CA2
1030:104050002403FFFD00431024AF82011C8EE201DC2B
1031:1040600024420001AEE201DC8EE201DC8F42012C31
1032:10407000AFA200108F4201343C040001248461800F
1033:10408000AFA200148F86011C8F8700A03C0500059D
1034:1040900034A514000C002B3B000000008FBF002053
1035:1040A00003E0000827BD00283C0810002407000199
1036:1040B0003C0600803C0501008F82007000481024FF
1037:1040C0001040FFFD000000008F82005424420005D4
1038:1040D000AF8200788C040234108000160000182192
1039:1040E0003C020001005710218C4240E824420005A8
1040:1040F0003C01000100370821AC2240E83C020001ED
1041:10410000005710218C4240E80044102B1440000955
1042:10411000000000003C0300803C0100010037082142
1043:10412000AC2040E83C010001003708211000000BE2
1044:10413000A02740F03C02000100571021904240F0BF
1045:1041400054400006006618253C020001005710216B
1046:10415000904240F154400001006618258C04023062
1047:1041600010800013000000003C02000100571021E5
1048:104170008C4240EC244200053C010001003708213C
1049:10418000AC2240EC3C020001005710218C4240EC74
1050:104190000044102B14400006000000003C01000108
1051:1041A00000370821AC2040EC1000000600651825FF
1052:1041B0003C02000100571021904240F2544000019F
1053:1041C000006518251060FFBC000000008F42000051
1054:1041D0001040000700000000AF80004C8F82004CB0
1055:1041E0001040FFFD0000000010000005000000006E
1056:1041F000AF8000488F8200481040FFFD00000000A3
1057:104200008F82006000431025AF8200608F42000063
1058:1042100010400003000000001000FFA7AF80004C1A
1059:104220001000FFA5AF80004803E000080000000078
1060:1042300000000000000000000000000027BDFFE0BB
1061:10424000AFBF00188F86006430C200041040002504
1062:10425000240400048C020114AF420020AF840064E7
1063:104260008F4202FC24420001AF4202FC8F4202FC5A
1064:104270008F820064304200041440000500000000FA
1065:104280008C0301148F4200201462FFF20000000032
1066:104290008F420000104000078F43003CAF80004C6D
1067:1042A0008F82004C1040FFFD000000001000000550
1068:1042B00000000000AF8000488F8200481040FFFDE2
1069:1042C000000000008F82006000431025AF82006074
1070:1042D0008F42000010400073000000001000006FCB
1071:1042E0000000000030C20008104000202404000834
1072:1042F0008C02011CAF420048AF8400648F4202A8C8
1073:1043000024420001AF4202A88F4202A88F820064BB
1074:104310003042000814400005000000008C03011C1E
1075:104320008F4200481462FFF2000000008F4200003C
1076:104330001040000700000000AF80004C8F82004C4E
1077:104340001040FFFD0000000010000005000000000C
1078:10435000AF8000488F8200481040FFFD0000000041
1079:104360008F8200601000FFD93442020030C200206A
1080:1043700010400023240400208C02012CAF4200686E
1081:10438000AF8400648F4202D824420001AF4202D8B9
1082:104390008F4202D88F820064304200201440000512
1083:1043A00032C240008C03012C8F4200681462FFF27D
1084:1043B00032C24000144000023C02000102C2B0259B
1085:1043C0008F4200001040000700000000AF80004C4A
1086:1043D0008F82004C1040FFFD00000000100000051F
1087:1043E00000000000AF8000488F8200481040FFFDB1
1088:1043F000000000008F8200601000FFB4344208000B
1089:1044000030C2001010400029240400108C02012446
1090:10441000AF420058AF8400648F4202D424420001AE
1091:10442000AF4202D48F4202D48F8200643042001027
1092:104430001440000532C220008C0301248F42005832
1093:104440001462FFF232C220005040000136D68000D4
1094:104450008F4200001040000700000000AF80004CB9
1095:104460008F82004C1040FFFD00000000100000058E
1096:1044700000000000AF8000488F8200481040FFFD20
1097:10448000000000008F82006034420100AF820060B3
1098:104490008F42000010400003000000001000006C7C
1099:1044A000AF80004C1000006AAF80004830C20001AD
1100:1044B0001040000424020001AF8200641000006478
1101:1044C0000000000030C200021440000B3C05000355
1102:1044D0003C0400012484624434A505000000382116
1103:1044E000AFA000100C002B3BAFA000142402FFC0B3
1104:1044F00010000057AF8200648C05022C8C02010C66
1105:1045000010A20048000510808C46030024A2000180
1106:104510003045003F24020003AC05022C00061E02B9
1107:1045200010620005240200101062001D30C20FFF4F
1108:1045300010000039000000008F4302A88F440000E3
1109:1045400030C20FFFAF42004824630001AF4302A80E
1110:10455000108000078F4202A8AF80004C8F82004C71
1111:104560001040FFFD000000001000000500000000EA
1112:10457000AF8000488F8200481040FFFD000000001F
1113:104580008F82006034420200AF8200608F420000E0
1114:104590001040001F000000001000001B0000000081
1115:1045A000AF42005832C220005040000136D6800091
1116:1045B0008F4202D48F43000024420001AF4202D454
1117:1045C000106000078F4202D4AF80004C8F82004CF5
1118:1045D0001040FFFD0000000010000005000000007A
1119:1045E000AF8000488F8200481040FFFD00000000AF
1120:1045F0008F82006034420100AF8200608F42000071
1121:10460000104000030000000010000006AF80004CC6
1122:1046100010000004AF8000480C00219600C020214B
1123:10462000004028218C02010C14A200022402000286
1124:10463000AF8200648F8200643042000214400004A4
1125:10464000000000008C02010C14A2FFAC000000006E
1126:104650008FBF001803E0000827BD002003E000081A
1127:104660000000000027BDFFA0AFB000400080802107
1128:10467000001016022442FFFF304300FF2C6200139B
1129:10468000AFBF0058AFBE0054AFB50050AFB3004C41
1130:10469000AFB20048AFB10044104001F3AFA5003401
1131:1046A000000310803C010001002208218C22628856
1132:1046B00000400008000000000010130230440FFF0B
1133:1046C0002402000110820005240200021082000C66
1134:1046D0002402FFFE100000243C0500038F43000469
1135:1046E0003C0200018C426F04AF440200AF4402045C
1136:1046F0003C0400018C846E801000000934630001CA
1137:104700008F430004AF440200AF4402043C040001A4
1138:104710008C846E80006218243C0200012442CA2866
1139:104720000002110000021182AF4300043C030800A4
1140:1047300000431025AC8200388F84005400041442DA
1141:1047400000041C820043102100041CC200431023FB
1142:1047500000041D020043102100041D4200431023E9
1143:1047600010000009AF4202083C040001248462509A
1144:1047700034A510000200302100003821AFA0001045
1145:104780000C002B3BAFA000148F4202A0244200017A
1146:10479000AF4202A01000021F8F4202A027B00028E3
1147:1047A00002002021240502100C002BBF2406000863
1148:1047B0000C00251802002021100002160000000045
1149:1047C0008FAA003427A40028000A1880254200017F
1150:1047D0003042003FAFA200348C6503008FAA003442
1151:1047E000000210808C430300254200013042003F4C
1152:1047F000AFA20034AC02022CAFA500280C00251893
1153:10480000AFA3002C100002030000000027B0002816
1154:1048100002002021240502100C002BBF24060008F2
1155:104820000C00265702002021100001FA00000000B1
1156:104830008FAA003427A40028000A1880254200010E
1157:104840003042003FAFA200348C6503008FAA0034D1
1158:10485000000210808C430300254200013042003FDB
1159:10486000AFA20034AC02022CAFA500280C002657E2
1160:10487000AFA3002C100001E700000000001013029D
1161:1048800030430FFF240200011062000524020002E1
1162:104890001062001E3C020002100000333C050003C1
1163:1048A0003C03000202C310245440003702C3B02569
1164:1048B0008F8202283C01000100370821AC2238D841
1165:1048C0008F82022C3C01000100370821AC2238DC29
1166:1048D0008F8202303C01000100370821AC2238E011
1167:1048E0008F8202343C01000100370821AC2238E4F9
1168:1048F0002402FFFFAF820228AF82022CAF82023077
1169:10490000AF8202341000002002C3B02502C210247E
1170:10491000104000123C02FFFD3C0200010057102134
1171:104920008C4238D8AF8202283C0200010057102187
1172:104930008C4238DCAF82022C3C020001005710216F
1173:104940008C4238E0AF8202303C0200010057102157
1174:104950008C4238E4AF8202343C02FFFD3442FFFF58
1175:104960001000000902C2B0243C0400012484625CEF
1176:1049700034A511000200302100003821AFA0001042
1177:104980000C002B3BAFA000148F4202CC244200014C
1178:10499000AF4202CC1000019F8F4202CC00101302E4
1179:1049A00030450FFF2402000110A20005240200027E
1180:1049B00010A2000D3C0408FF100000143C05000389
1181:1049C0003C0208FF3442FFFF8F8302203C040004B6
1182:1049D00002C4B0250062182434630008AF830220AB
1183:1049E00010000012AF4502983484FFF73C03FFFB30
1184:1049F0008F8202203463FFFF02C3B02400441024DE
1185:104A0000AF82022010000009AF4502983C0400016B
1186:104A10002484626834A5120002003021000038218D
1187:104A2000AFA000100C002B3BAFA000148F4202BCC3
1188:104A300024420001AF4202BC100001768F4202BC4A
1189:104A400027840208240502000C002BBF240600085E
1190:104A500027440224240502000C002BBF2406000872
1191:104A60008F4202C424420001AF4202C41000016917
1192:104A70008F4202C40010130230430FFF24020001D2
1193:104A8000106200112862000250400005240200025A
1194:104A90001060000700000000100000170000000078
1195:104AA0001062000F00000000100000130000000062
1196:104AB0008C060248000020210C005104240500044B
1197:104AC00010000007000000008C06024800002021B2
1198:104AD0000C00510424050004100000100000000028
1199:104AE0008C06024C000020210C005104240500011A
1200:104AF0001000000A000000003C04000124846274DD
1201:104B00003C05000334A513000200302100003821C9
1202:104B1000AFA000100C002B3BAFA000148F4202C0CE
1203:104B200024420001AF4202C01000013A8F4202C08D
1204:104B30000C002426000000001000013600000000D8
1205:104B400024020001A34205C5241001008F4401A8DE
1206:104B50008F4501ACAFB00010AFA000148F4200141D
1207:104B6000AFA200188F42010826E600280040F8098D
1208:104B7000240704001040FFF500000000100001258C
1209:104B8000000000003C03FFFF34637FFF8F42036897
1210:104B90008F44036002C3B02400001821AF400058C6
1211:104BA000AF40005CAF400060AF40006400441023A1
1212:104BB000AF4203683C020900AF400360AFA200208F
1213:104BC0008F5E001827AA0020240200FF13C20002F3
1214:104BD000AFAA003C27C300018C020228006090218C
1215:104BE0001642000E001E38C08F42033C24420001D2
1216:104BF000AF42033C8F42033C8C0202283C0400017C
1217:104C00002484620C3C050009AFA00014AFA2001080
1218:104C10008FA600201000006B34A5050000F71021BE
1219:104C20008FA300208FA40024AC4304C0AC4404C470
1220:104C30008F8300548F820054247003E802021023F3
1221:104C40002C4203E91040001B0000982100E088215D
1222:104C5000263504C08F4401788F45017C022018213D
1223:104C6000240A0004AFAA0010AFB200148F48000C51
1224:104C70000000102102F53021AFA800188F48010C68
1225:104C80002407000800A3282100A3482B008220212C
1226:104C90000100F80900892021544000062413000176
1227:104CA0008F820054020210232C4203E91440FFE9D2
1228:104CB00000000000326200FF54400017AF5200189D
1229:104CC0008F42037824420001AF4203788F42037879
1230:104CD0008F8201208FAA003CAFA200108F82012496
1231:104CE0003C040001248462183C050009AFA20014B2
1232:104CF0008D4600001000003334A506008F420308E3
1233:104D00002413000124420001AF4203088F4203082C
1234:104D10001000001C326200FF8F8300548F82005409
1235:104D2000247003E8020210232C4203E9104000140F
1236:104D300000009821241100108F42000C8F44016064
1237:104D40008F4501648F860120AFB10010AFB200140F
1238:104D5000AFA200188F42010C240700080040F80998
1239:104D600024C6001C1440FFE5000000008F820054A0
1240:104D7000020210232C4203E91440FFEF0000000060
1241:104D8000326200FF14400011000000008F420378DF
1242:104D900024420001AF4203788F4203788F820120C2
1243:104DA0008FAA003CAFA200108F8201243C040001B6
1244:104DB000248462203C050009AFA200148D46000047
1245:104DC00034A507000C002B3B03C038218F4202B0F2
1246:104DD00024420001AF4202B08F4202B08F4202F87B
1247:104DE00024420001AF4202F81000008A8F4202F80C
1248:104DF0008C02025C27440224AF4201F08C02026064
1249:104E000024050200240600080C002BBFAF4201F865
1250:104E10008F82022030420008144000022402000168
1251:104E200024020002AF4202988F4202AC24420001E9
1252:104E3000AF4202AC100000778F4202AC3C0200FF90
1253:104E40003442FFFF0202182432C2018014400006DF
1254:104E50003402FFFB0043102B14400003000000004D
1255:104E60001000006CAF4300BC3C040001248462804D
1256:104E70003C05000334A51500020030210000382154
1257:104E8000AFA000100C002B3BAFA000143C020700A9
1258:104E90003442100000101E0200621825AFA300204B
1259:104EA0008F510018240200FF12220002000080210E
1260:104EB000263000018C0202281602000E001130C0BC
1261:104EC0008F42033C24420001AF42033C8F42033C2B
1262:104ED0008C0202283C040001248461F43C05000992
1263:104EE000AFA00014AFA200108FA600201000003F5A
1264:104EF00034A5010000D710218FA300208FA4002427
1265:104F0000AC4304C0AC4404C400C018218F440178F1
1266:104F10008F45017C0000102124070004AFA700107A
1267:104F2000AFB000148F48000C24C604C002E6302144
1268:104F3000AFA800188F48010C2407000800A32821FF
1269:104F400000A3482B008220210100F80900892021BC
1270:104F50001440000B240700088F820120AFA200102C
1271:104F60008F8201243C040001248461FC3C0500097B
1272:104F7000AFA200148FA600201000001C34A5020070
1273:104F80008F4401608F4501648F43000CAF500018BF
1274:104F90008F86012024020010AFA20010AFB00014D1
1275:104FA000AFA300188F42010C0040F80924C6001C72
1276:104FB00014400010000000008F4203402442000112
1277:104FC000AF4203408F4203408F820120AFA2001006
1278:104FD0008F8201243C040001248462043C05000902
1279:104FE000AFA200148FA6002034A503000C002B3BB9
1280:104FF000022038218F4202E024420001AF4202E049
1281:105000008F4202E08F4202F024420001AF4202F0E0
1282:105010008F4202F08FA200348FBF00588FBE005421
1283:105020008FB500508FB3004C8FB200488FB1004451
1284:105030008FB0004003E0000827BD006027BDFFF8E7
1285:105040002408FFFF10A00014000048213C0AEDB81E
1286:10505000354A83209087000024840001000030211D
1287:1050600001071026304200011040000200081842DB
1288:10507000006A18260060402124C600012CC20008E6
1289:105080001440FFF700073842252900010125102BA5
1290:105090001440FFF0000000000100102103E00008B0
1291:1050A00027BD000827BDFFB0AFBF0048AFBE00441A
1292:1050B000AFB50040AFB3003CAFB20038AFB1003481
1293:1050C000AFB000308F870220AFA700248F87020087
1294:1050D000AFA7002C8F8202203C0308FF3463FFFF40
1295:1050E0000043102434420004AF8202208F82020069
1296:1050F0003C03C0FF3463FFFF00431024344200042C
1297:10510000AF8202008F5303588F55035C8F5E03609C
1298:105110008F470364AFA700148F470368AFA7001C35
1299:105120008F4202D0274401C024420001AF4202D086
1300:105130008F5002D08F5102048F5202000C002BA816
1301:1051400024050400AF530358AF55035CAF5E036002
1302:105150008FA70014AF4703648FA7001CAF470368F5
1303:10516000AF5002D0AF510204AF5202008C02025C79
1304:1051700027440224AF4201F08C02026024050200A1
1305:1051800024060008AF4201F8240200060C002BBFE1
1306:10519000AF4201F43C023B9A3442CA00AF4201FCE8
1307:1051A000240203E82404000224030001AF42029415
1308:1051B000AF440290AF43029C8F820220304200082D
1309:1051C0001040000400000000AF43029810000003EC
1310:1051D00000003021AF440298000030213C03000160
1311:1051E0000066182190636D000346102124C600015B
1312:1051F000A043022C2CC2000F1440FFF803461821D4
1313:1052000024C600018F820040240400802405008011
1314:105210000002170224420030A062022C0346102133
1315:105220000C002BA8A040022C8FA7002430E2000421
1316:1052300014400006000000008F8202203C0308FF9B
1317:105240003463FFFB00431024AF8202208FA7002CA1
1318:1052500030E2000414400006000000008F820200CB
1319:105260003C03C0FF3463FFFB00431024AF82020005
1320:105270008FBF00488FBE00448FB500408FB3003C05
1321:105280008FB200388FB100348FB0003003E00008D7
1322:1052900027BD00500000000000000000AF400104E6
1323:1052A00024040001000410C002E21821248200013D
1324:1052B0003C01000100230821A42234D00040202119
1325:1052C0002C8200801440FFF8000410C0240200016A
1326:1052D0003C01000100370821A42038D0AF42010072
1327:1052E000AF800228AF80022CAF800230AF80023442
1328:1052F00003E000080000000027BDFFE8AFBF001476
1329:10530000AFB000108F420104284200051040002673
1330:10531000008080213C0200018F430104344230D0E0
1331:1053200002E22021000318C00062182102E31821C4
1332:105330000083102B1040001500001021960700007C
1333:1053400024840006246600069482FFFC14470009AA
1334:10535000000028219483FFFE9602000214620006DA
1335:1053600000A0102194820000960300040043102640
1336:105370002C45000100A010211440000924840008DD
1337:105380000086102B1440FFF000001021304200FF77
1338:1053900014400030240200011000002E00001021F3
1339:1053A0001000FFFA24020001020020210C00240C4E
1340:1053B000240500063042007F000218C002E31021DD
1341:1053C0003C01000100220821942230D01040FFF25D
1342:1053D00002E310213C06000100C2302194C630D007
1343:1053E00010C0FFED3C080001350834D296070000DC
1344:1053F000000610C000572021008820219482000060
1345:10540000144700090000282194830002960200023C
1346:105410001462000600A01021948200049603000488
1347:10542000004310262C45000100A010211440000765
1348:10543000000610C002E210213C06000100C230212B
1349:1054400094C634D014C0FFEB000610C010C0FFD2C9
1350:10545000240200018FBF00148FB0001003E0000889
1351:1054600027BD001803E000080000000027BDFFB0C2
1352:1054700000801021AFB00030245000020200202133
1353:1054800024050006AFB1003400408821AFBF0048BA
1354:10549000AFBE0044AFB50040AFB3003C0C00240CDD
1355:1054A000AFB200383047007F000710C002E2102181
1356:1054B0003C05000100A2282194A530D050A0001C7A
1357:1054C00000A030213C090001352934D29628000281
1358:1054D000000510C00057202100892021948200007F
1359:1054E0001448000900003021948300029602000253
1360:1054F0001462000600C01021948200049603000488
1361:10550000004310262C46000100C010211440000763
1362:10551000000510C002E210213C05000100A2282174
1363:1055200094A534D014A0FFEB000510C000A03021DA
1364:1055300010C00014000610C0005718213C010001E3
1365:10554000002308218C2334D000571021AFA3001072
1366:105550003C010001002208218C2234D43C040001CB
1367:1055600024846394AFA200148E2600008E270004CA
1368:105570003C0500040C002B3B34A504001000006324
1369:105580003C0208008F45010010A00006000510C075
1370:1055900002E210213C01000100220821942234D0B3
1371:1055A000AF42010000A0302114C00011000628C045
1372:1055B000000710C002E21021AFA700103C0100015B
1373:1055C00000220821942230D03C040001248463A0EE
1374:1055D000AFA200148E2600008E2700043C050004B4
1375:1055E0000C002B3B34A50500100000483C020800CD
1376:1055F00000B718213C02000196040000344234D266
1377:1056000000621821A46400008E020002000720C07E
1378:10561000AC62000202E410213C0300010062182188
1379:10562000946330D002E510213C01000100220821E2
1380:10563000A42334D002E410213C01000100220821FF
1381:10564000A42630D08F420104244200012842008069
1382:105650001040000F3C0200028F4201043C04000194
1383:10566000348430D296030000000210C0005710218D
1384:1056700000441021A44300008E030002AC4300024A
1385:105680008F42010424420001AF4201043C020002A7
1386:1056900002C2102410400011000721423C03000107
1387:1056A000346338D824020003004410230002108021
1388:1056B0000057202100832021005710210043102192
1389:1056C00030E5001F8C4300002402000100A21004FA
1390:1056D000006218251000000CAC83000024020003B7
1391:1056E0000044102300021080005C2821005C10217F
1392:1056F00030E4001F8C4302282402000100821004C1
1393:1057000000621825ACA302283C02080034421000B5
1394:1057100000001821AFA200208F5E001827AA0020E9
1395:10572000240200FF13C20002AFAA002C27C300010D
1396:105730008C020228006090211642000E001E38C024
1397:105740008F42033C24420001AF42033C8F42033CA2
1398:105750008C0202283C0400012484635C3C0500099F
1399:10576000AFA00014AFA200108FA600201000006BA5
1400:1057700034A5050000F710218FA300208FA400247A
1401:10578000AC4304C0AC4404C48F8300548F820054E3
1402:10579000247003E8020210232C4203E91040001B8E
1403:1057A0000000982100E08821263504C08F4401784C
1404:1057B0008F45017C02201821240A0004AFAA0010A2
1405:1057C000AFB200148F48000C0000102102F5302108
1406:1057D000AFA800188F48010C2407000800A3282157
1407:1057E00000A3482B008220210100F8090089202114
1408:1057F00054400006241300018F820054020210233B
1409:105800002C4203E91440FFE900000000326200FF6F
1410:1058100054400017AF5200188F4203782442000111
1411:10582000AF4203788F4203788F8201208FAA002C29
1412:10583000AFA200108F8201243C040001248463681D
1413:105840003C050009AFA200148D4600001000003393
1414:1058500034A506008F4203082413000124420001EE
1415:10586000AF4203088F4203081000001C326200FFA1
1416:105870008F8300548F820054247003E802021023A7
1417:105880002C4203E91040001400009821241100105C
1418:105890008F42000C8F4401608F4501648F86012088
1419:1058A000AFB10010AFB20014AFA200188F42010CCC
1420:1058B000240700080040F80924C6001C1440FFE536
1421:1058C000000000008F820054020210232C4203E9E2
1422:1058D0001440FFEF00000000326200FF144000118E
1423:1058E000000000008F42037824420001AF42037899
1424:1058F0008F4203788F8201208FAA002CAFA2001064
1425:105900008F8201243C040001248463703C0500095B
1426:10591000AFA200148D46000034A507000C002B3BFD
1427:1059200003C038218F4202B424420001AF4202B4C6
1428:105930008F4202B48F4202F424420001AF4202F4CB
1429:105940008F4202F48FBF00488FBE00448FB50040E5
1430:105950008FB3003C8FB200388FB100348FB000306D
1431:1059600003E0000827BD005027BDFFA000801021E4
1432:10597000AFB00040245000020200202124050006A0
1433:10598000AFB1004400408821AFBF0058AFBE005403
1434:10599000AFB50050AFB3004C0C00240CAFB20048C0
1435:1059A0003048007F000810C002E210213C060001D0
1436:1059B00000C2302194C630D010C0001C0000382135
1437:1059C0003C0A0001354A34D296290002000610C074
1438:1059D00000572021008A20219482000014490009E8
1439:1059E000000028219483000296020002146200063F
1440:1059F00000A01021948200049603000400431026A6
1441:105A00002C45000100A0102114400008000610C021
1442:105A100000C0382102E210213C06000100C2302102
1443:105A200094C634D014C0FFEA000610C014C00011A0
1444:105A3000AFA70028000810C002E21021AFA8001094
1445:105A40003C01000100220821942230D03C040001D6
1446:105A5000248463ACAFA200148E2600008E270004BD
1447:105A60003C0500040C002B3B34A509001000007518
1448:105A70003C02080010E0000C000610C002E21021F9
1449:105A80003C03000100621821946334D0000710C069
1450:105A900002E210213C01000100220821A42334D09D
1451:105AA0001000000B3C04000102E210213C03000145
1452:105AB00000621821946334D0000810C002E2102163
1453:105AC0003C01000100220821A42330D03C04000145
1454:105AD000348430D08F430100000610C002E2102150
1455:105AE0003C01000100220821A42334D08F4201048C
1456:105AF00002E438210000282118400029AF460100A7
1457:105B000024E6000694C3FFFC96020000146200091C
1458:105B10000000202194C3FFFE9602000214620006DA
1459:105B20000080102194C20000960300040043102658
1460:105B30002C440001008010215040001424A50001D5
1461:105B40008F4201042442FFFF00A2102A1040000BE4
1462:105B500024E40004948200068C830008A482FFFEE3
1463:105B6000AC8300008F42010424A500012442FFFF02
1464:105B700000A2102A1440FFF7248400088F42010479
1465:105B80002442FFFF10000006AF4201048F420104CF
1466:105B900024C6000800A2102A1440FFDA24E70008F7
1467:105BA000000810C002E210213C010001002208217F
1468:105BB000942230D0144000233C0208003C02000232
1469:105BC00002C2102410400012000821423C030001D0
1470:105BD000346338D8240200030044102300021080EC
1471:105BE000005720210083202100571021004310215D
1472:105BF0003105001F240300018C42000000A318049B
1473:105C000000031827004310241000000DAC82000090
1474:105C1000240200030044102300021080005C2821AD
1475:105C2000005C10213104001F240300018C42022873
1476:105C3000008318040003182700431024ACA2022894
1477:105C40003C0208003442200000001821AFA20020CE
1478:105C50008F5E001827AB0020240200FF13C2000251
1479:105C6000AFAB003427C300018C02022800609021F2
1480:105C70001642000E001E38C08F42033C2442000131
1481:105C8000AF42033C8F42033C8C0202283C040001DB
1482:105C90002484635C3C050009AFA00014AFA200108F
1483:105CA0008FA600201000006B34A5050000F710211E
1484:105CB0008FA300208FA40024AC4304C0AC4404C4D0
1485:105CC0008F8300548F820054247003E80202102353
1486:105CD0002C4203E91040001B0000982100E08821BD
1487:105CE000263504C08F4401788F45017C022018219D
1488:105CF000240B0004AFAB0010AFB200148F48000CAF
1489:105D00000000102102F53021AFA800188F48010CC7
1490:105D10002407000800A3282100A3482B008220218B
1491:105D20000100F809008920215440000624130001D5
1492:105D30008F820054020210232C4203E91440FFE931
1493:105D400000000000326200FF54400017AF520018FC
1494:105D50008F42037824420001AF4203788F420378D8
1495:105D60008F8201208FAB0034AFA200108F820124FC
1496:105D70003C040001248463683C050009AFA20014C0
1497:105D80008D6600001000003334A506008F42030822
1498:105D90002413000124420001AF4203088F4203088C
1499:105DA0001000001C326200FF8F8300548F82005469
1500:105DB000247003E8020210232C4203E9104000146F
1501:105DC00000009821241100108F42000C8F440160C4
1502:105DD0008F4501648F860120AFB10010AFB200146F
1503:105DE000AFA200188F42010C240700080040F809F8
1504:105DF00024C6001C1440FFE5000000008F82005400
1505:105E0000020210232C4203E91440FFEF00000000BF
1506:105E1000326200FF14400011000000008F4203783E
1507:105E200024420001AF4203788F4203788F82012021
1508:105E30008FAB0034AFA200108F8201243C0400011C
1509:105E4000248463703C050009AFA200148D66000035
1510:105E500034A507000C002B3B03C038218F4202B849
1511:105E600024420001AF4202B88F4202B88F4202F4CE
1512:105E700024420001AF4202F48F4202F48FBF005867
1513:105E80008FBE00548FB500508FB3004C8FB20048C6
1514:105E90008FB100448FB0004003E0000827BD0060D0
1515:105EA00000000000000000000000000027BDFFE02F
1516:105EB00027644000AFBF00180C002BA82405100079
1517:105EC0003C03000134632CC03C04000134842EC820
1518:105ED00024020020AF82011C02E31021AF800100E8
1519:105EE000AF800104AF800108AF800110AF800114C2
1520:105EF000AF800118AF800120AF800124AF8001285E
1521:105F0000AF800130AF800134AF800138AF4200EC88
1522:105F100002E31021AF4200F002E41021AF4200F48E
1523:105F200002E41021AF4200F83C02000100571021AA
1524:105F3000904240F41440001C3C0500018F82011C7B
1525:105F40003C040001248464703C05000134420001DB
1526:105F5000AF82011CAFA00010AFA000148F86011CFF
1527:105F600034A501000C002B3B000038218C020218E4
1528:105F70003042004010400014000000008F82011CDD
1529:105F80003C0400012484647C3C050001344200048C
1530:105F9000AF82011CAFA00010AFA000148F86011CBF
1531:105FA0001000000734A502003C040001248464842E
1532:105FB000AFA00010AFA000148F86011C34A5030011
1533:105FC0000C002B3B000038218FBF001803E00008B5
1534:105FD00027BD00208FA900108F83012C8FAA0014E9
1535:105FE0008FAB00181060000A27624FE014620002B5
1536:105FF00024680020276848008F82012811020004CD
1537:10600000000000008F82012415020007000000003C
1538:106010008F4303340000102124630001AF43033495
1539:10602000100000398F430334AC640000AC650004F9
1540:10603000AC660008A467000EAC690018AC6A001CCE
1541:10604000AC6B0010AC620014AF8801208F4200FCE2
1542:106050008F4400F42442FFFFAF4200FC8C8200001A
1543:10606000104900053042FF8F104000193122FF8F88
1544:10607000104000183C0200018C8300042C620010C8
1545:10608000104000133C02000124630001AC830004B3
1546:106090008F4300F8344230C802E2102154620004F9
1547:1060A000246200083C02000134422EC802E21021A2
1548:1060B00014440015240200018F820128244200208C
1549:1060C000AF8201288F8201281000000F24020001F6
1550:1060D0003C020001344230C802E210215482000424
1551:1060E000248200083C02000134422EC802E2102142
1552:1060F0000040202124020001AF4400F4AC890000DC
1553:10610000AC8200042402000103E00008000000004B
1554:1061100003E00008000000008FA900108F83010C2D
1555:106120008FAA00148FAB00181060000A276247E0A6
1556:106130001462000224680020276840008F82010852
1557:1061400011020004000000008F8201041502000704
1558:10615000000000008F430338000010212463000179
1559:10616000AF430338100000358F430338AC640000A0
1560:10617000AC650004AC660008A467000EAC690018AA
1561:10618000AC6A001CAC6B0010AC620014AF8801005C
1562:106190008F4400EC8C820000304200061040001951
1563:1061A00031220006104000183C0200018C830004DC
1564:1061B0002C620010104000133C0200012463000117
1565:1061C000AC8300048F4300F034422EC002E2102161
1566:1061D00054620004246200083C02000134422CC0D6
1567:1061E00002E2102114440015240200018F820108EC
1568:1061F00024420020AF8201088F8201081000000FA6
1569:10620000240200013C02000134422EC002E21021AF
1570:1062100054820004248200083C02000134422CC055
1571:1062200002E210210040202124020001AF4400ECD2
1572:10623000AC890000AC8200042402000103E00008E5
1573:106240000000000003E000080000000027BDFFD8A8
1574:106250003C0400012484648C3C050001AFBF002491
1575:10626000AFB20020AFB1001CAFB000188F90010496
1576:106270008F9100B08F92011C34A525008F82010000
1577:106280000240302102203821AFA200100C002B3B2D
1578:10629000AFB000148E020008AFA200108E02000CF6
1579:1062A0003C04000124846498AFA200148E06000010
1580:1062B0008E0700043C0500010C002B3B34A5251083
1581:1062C0008E020018AFA200108E02001C3C040001D8
1582:1062D000248464A4AFA200148E0600108E0700145C
1583:1062E0003C0500010C002B3B34A525203C027F001F
1584:1062F000022210243C030800544300163C03020011
1585:106300008F82009C3042FFFF144000123C030200C9
1586:106310003C040001248464B03C05000234A5F03044
1587:10632000000030210000382136420002AF82011CFB
1588:1063300036220001AF8200B0AF900104AF92011C81
1589:10634000AFA000100C002B3BAFA0001410000024E5
1590:106350000000000002C310241040000D022310248E
1591:106360001040000B36420002AF82011C36220001B1
1592:10637000AF8200B0AF900104AF92011C8F42033096
1593:1063800024420001AF420330100000158F42033059
1594:106390003C040001248464B8240202A9AFA20010C6
1595:1063A000AFA000148F8601443C07000124E764C0BD
1596:1063B0000C002B3B3405DEAD8F82011C3442000201
1597:1063C000AF82011C8F82022034420004AF8202207F
1598:1063D0008F8201403C03000100431025AF82014041
1599:1063E0008FBF00248FB200208FB1001C8FB0001827
1600:1063F00003E0000827BD002827BDFFD83C040001AA
1601:10640000248464E83C050001AFBF0024AFB2002043
1602:10641000AFB1001CAFB000188F9001248F9100A085
1603:106420008F92011C34A526008F820120024030216A
1604:1064300002203821AFA200100C002B3BAFB000149B
1605:106440008E020008AFA200108E02000C3C04000176
1606:10645000248464F4AFA200148E0600008E070004AA
1607:106460003C0500010C002B3B34A526108E020018C1
1608:10647000AFA200108E02001C3C04000124846500C1
1609:10648000AFA200148E0600108E0700143C05000118
1610:106490000C002B3B34A526203C027F000222102456
1611:1064A0003C030800544300163C0302008F8200ACFA
1612:1064B0003042FFFF144000123C0302003C04000184
1613:1064C0002484650C3C05000134A5F0300000302127
1614:1064D0000000382136420002AF82011C3622000142
1615:1064E000AF8200A0AF900124AF92011CAFA00010BA
1616:1064F0000C002B3BAFA00014100000240000000093
1617:1065000002C310241040000D022310241040000B81
1618:1065100036420002AF82011C36220001AF8200A089
1619:10652000AF900124AF92011C8F42032C2442000142
1620:10653000AF42032C100000158F42032C3C040001D5
1621:10654000248464B8240202E2AFA20010AFA00014B9
1622:106550008F8601443C07000124E764C00C002B3BFC
1623:106560003405DEAD8F82011C34420002AF82011C73
1624:106570008F82022034420004AF8202208F820140C9
1625:106580003C03000100431025AF8201408FBF00246F
1626:106590008FB200208FB1001C8FB0001803E00008FC
1627:1065A00027BD00280000602100005021000030219C
1628:1065B0000000282100006821000048210000782107
1629:1065C000000070218F8801248F8701041580002E20
1630:1065D0008F8B011C11A00014316208008F820120F2
1631:1065E00010460029000000003C0400018C846EE489
1632:1065F0008CC200008CC30004AC820000AC83000499
1633:106600008CC20008AC82000894C2000EA482000E66
1634:106610008CC20010240C0001AC8200108CC200144B
1635:106620001000001224C600201040001700000000D7
1636:106630003C0400018C846EE48D0200008D03000494
1637:10664000AC820000AC8300048D020008AC8200081C
1638:106650009502000EA482000E8D0200102506002077
1639:10666000AC8200108D020014240C000100C018211F
1640:10667000AC82001427624FE00043102B544000010D
1641:1066800027634800006030211540002F316201006F
1642:1066900011200014316280008F8201001045002A11
1643:1066A000316201003C0400018C846EE08CA2000089
1644:1066B0008CA30004AC820000AC8300048CA2000810
1645:1066C000AC82000894A2000EA482000E8CA20010DE
1646:1066D000240A0001AC8200108CA2001410000012E9
1647:1066E00024A5002010400018316201003C04000184
1648:1066F0008C846EE08CE200008CE30004AC8200002D
1649:10670000AC8300048CE20008AC82000894E2000E26
1650:10671000A482000E8CE2001024E50020AC82001060
1651:106720008CE20014240A000100A01821AC8200149D
1652:10673000276247E00043102B5440000127634000CC
1653:1067400000602821316201005440001D31621000B8
1654:1067500011A0000931A20800104000042502002009
1655:106760008F8200A8A5E2000025020020AF8201244C
1656:106770008F8801240000682111800011316210000F
1657:106780003C0400018C846EE48C8200008C83000445
1658:10679000AF820080AF8300848C820008AF8200A4A7
1659:1067A0009482000EAF8200AC8C8200100000602149
1660:1067B000AF8200A08C8D00108C8F0014316210000D
1661:1067C0001440FF82000000001120000F3122080059
1662:1067D000104000043C0200028F8200B8A5C20000F5
1663:1067E0003C020002012210241040000424E2002098
1664:1067F0008F8200B4AF8200D424E20020AF82010473
1665:106800008F870104000048211140FF700000000044
1666:106810003C0400018C846EE08C8200008C830004B8
1667:10682000AF820090AF8300948C820008AF8200B4E6
1668:106830009482000EAF82009C8C82001000005021D8
1669:10684000AF8200B08C8900101000FF608C8E0014A5
1670:1068500003E0000800000000000060210000582153
1671:106860000000302100002821000068210000502194
1672:1068700000007821000070218F8801248F87010497
1673:106880003C1801001580002E8F89011C11A00014F6
1674:10689000312208008F8201201046002900000000EC
1675:1068A0003C0400018C846EE48CC200008CC30004A4
1676:1068B000AC820000AC8300048CC20008AC820008EB
1677:1068C00094C2000EA482000E8CC20010240C0001A1
1678:1068D000AC8200108CC200141000001224C60020EC
1679:1068E00010400017000000003C0400018C846EE49E
1680:1068F0008D0200008D030004AC820000AC83000414
1681:106900008D020008AC8200089502000EA482000EE1
1682:106910008D02001025060020AC8200108D020014AC
1683:10692000240C000100C01821AC82001427624FE043
1684:106930000043102B544000012763480000603021C1
1685:106940001560002F31220100114000143122800017
1686:106950008F8201001045002A312201003C04000111
1687:106960008C846EE08CA200008CA30004AC8200003A
1688:10697000AC8300048CA20008AC82000894A2000E34
1689:10698000A482000E8CA20010240B0001AC82001027
1690:106990008CA200141000001224A500201040001842
1691:1069A000312201003C0400018C846EE08CE2000086
1692:1069B0008CE30004AC820000AC8300048CE200088D
1693:1069C000AC82000894E2000EA482000E8CE200105B
1694:1069D00024E50020AC8200108CE20014240B00019E
1695:1069E00000A01821AC820014276247E00043102B5E
1696:1069F000544000012763400000602821312201003B
1697:106A00005440001D3122100011A0000931A20800DD
1698:106A100010400004250200208F8200A8A5E200009B
1699:106A200025020020AF8201248F8801240000682104
1700:106A300011800011312210003C0400018C846EE4AE
1701:106A40008C8200008C830004AF820080AF830084BE
1702:106A50008C820008AF8200A49482000EAF8200AC4A
1703:106A60008C82001000006021AF8200A08C8D00108D
1704:106A70008C8F00143122100014400022000000000E
1705:106A80001140000F31420800104000043C02000297
1706:106A90008F8200B8A5C200003C020002014210240F
1707:106AA0001040000424E200208F8200B4AF8200D4A2
1708:106AB00024E20020AF8201048F87010400005021EE
1709:106AC00011600010000000003C0400018C846EE0A6
1710:106AD0008C8200008C830004AF820090AF8300940E
1711:106AE0008C820008AF8200B49482000EAF82009CBA
1712:106AF0008C82001000005821AF8200B08C8A0010F8
1713:106B00008C8E00148F8200703C0310000043102410
1714:106B10001040FF5C000000008F82005424420005FA
1715:106B2000AF8200788C040234108000160000182117
1716:106B30003C020001005710218C4240E8244200052D
1717:106B40003C01000100370821AC2240E83C02000172
1718:106B5000005710218C4240E80044102B14400009DB
1719:106B6000240200013C0300803C01000100370821A1
1720:106B7000AC2040E83C010001003708211000000C67
1721:106B8000A02240F03C02000100571021904240F04A
1722:106B9000144000063C0200803C0200010057102116
1723:106BA000904240F1104000023C0200800062182533
1724:106BB0008C04023010800013000000003C02000131
1725:106BC000005710218C4240EC244200053C0100019A
1726:106BD00000370821AC2240EC3C0200010057102194
1727:106BE0008C4240EC0044102B1440000600000000D2
1728:106BF0003C01000100370821AC2040EC10000006E9
1729:106C0000007818253C02000100571021904240F204
1730:106C100054400001007818251060FF1A00000000A1
1731:106C20008F4200001040000700000000AF80004CC1
1732:106C30008F82004C1040FFFD000000001000000596
1733:106C400000000000AF8000488F8200481040FFFD28
1734:106C5000000000008F82006000431025AF820060BA
1735:106C60008F42000010400003000000001000FF05EC
1736:106C7000AF80004C1000FF03AF80004803E0000825
1737:106C80000000000000000000000000003C020001C5
1738:106C90008C426D2827BDFFE8AFBF001414400012DE
1739:106CA000AFB000103C10000126106F9002002021B0
1740:106CB0000C002BA82405200026021FE03C01000147
1741:106CC000AC226EEC3C010001AC226EE8AC0202503A
1742:106CD00024022000AC100254AC020258240200012D
1743:106CE0003C010001AC226D288FBF00148FB0001052
1744:106CF00003E0000827BD00183C0900018D296EEC57
1745:106D00008C8200008FA300108FA80014AD22000019
1746:106D10008C820004AD250008AD2200048F8200544F
1747:106D2000AD260010AD270014AD230018AD28001CBF
1748:106D3000AD22000C2529FFE03C02000124426F90A7
1749:106D40000122102B10400003000000003C0900014C
1750:106D50008D296EE83C0200018C426D10AD220000CE
1751:106D60003C0200018C426D103C010001AC296EEC2C
1752:106D7000AD220004AC09025003E00008000000004E
1753:106D800027BDFFD0AFB000103C1000018E106EEC9C
1754:106D90003C0200018C426D10AFB1001400808821CC
1755:106DA000AFBE00248FBE00408FA40048AFB20018D1
1756:106DB00000A09021AFBF0028AFB50020AFB3001CEA
1757:106DC000AE0200003C0200018C426D1000C0982110
1758:106DD00000E0A82110800006AE020004260500088D
1759:106DE0000C002BB324060018100000052610FFE04D
1760:106DF000260400080C002BA8240500182610FFE02C
1761:106E00003C03000124636F900203102B1040000329
1762:106E1000000000003C1000018E106EE88E22000081
1763:106E2000AE0200008E220004AE120008AE02000482
1764:106E30008F820054AE130010AE150014AE1E001861
1765:106E40008FA80044AE08001CAE02000C2610FFE024
1766:106E50000203102B10400003000000003C10000152
1767:106E60008E106EE83C0200018C426D10AE020000F4
1768:106E70003C0200018C426D103C010001AC306EEC14
1769:106E8000AE020004AC1002508FBF00288FBE002459
1770:106E90008FB500208FB3001C8FB200188FB1001483
1771:106EA0008FB0001003E0000827BD003000851821D6
1772:106EB0000083102B1040000600000000AC80000092
1773:106EC000248400040083102B5440FFFDAC8000009C
1774:106ED00003E000080000000000A6182100A3102B0A
1775:106EE00010400007000000008C820000ACA20000EF
1776:106EF00024A5000400A3102B1440FFFB24840004ED
1777:106F000003E0000800000000008618210083102B19
1778:106F100010400007000000008CA20000AC820000BE
1779:106F2000248400040083102B1440FFFB24A50004DC
1780:106F300003E00008000000000006308000861821F1
1781:106F40000083102B1040000600000000AC850000FC
1782:106F5000248400040083102B5440FFFDAC85000006
1783:106F600003E00008000000000000000026E5002803
1784:106F700000A03021274301C08F4D03588F47035C89
1785:106F80008F4803608F4903648F4A03688F4B020464
1786:106F90008F4C0200246404000064102B1040000891
1787:106FA0003C0208FF8CC20000AC62000024630004B5
1788:106FB0000064102B1440FFFB24C600043C0208FFB1
1789:106FC0003442FFFF3C03C0FFAF4D0358AF47035CA3
1790:106FD000AF480360AF490364AF4A0368AF4B020494
1791:106FE000AF4C02008F8402203463FFFF8F860200C3
1792:106FF000008210243442000400C3182434630004C7
1793:10700000AF820220AF8302008CA20214AC02008483
1794:107010008CA20218AC0200888CA2021CAC02008C6C
1795:107020008CA20220AC0200908CA20224AC0200943C
1796:107030008CA20228AC0200988CA2022CAC02009C0C
1797:107040008CA20230AC0200A08CA20234AC0200A4DC
1798:107050008CA20238AC0200A88CA2023CAC0200ACAC
1799:107060008CA20240AC0200B08CA20244AC0200B47C
1800:107070008CA20248AC0200B88CA2024CAC0200BC4C
1801:107080008CA2001CAC0200808CA20018AC0200C0D4
1802:107090008CA20020AC0200CC8CA20024AC0200D058
1803:1070A0008CA201D0AC0200E08CA201D4AC0200E4BE
1804:1070B0008CA201D8AC0200E88CA201DCAC0200EC8E
1805:1070C0008CA201E0AC0200F08CA200988CA3009C82
1806:1070D000AC0300FC8CA200A88CA300ACAC0300F4B1
1807:1070E0008CA200A08CA300A430840004AC0300F8A0
1808:1070F0001480000730C200048F8202203C0308FF86
1809:107100003463FFFB00431024AF82022030C200042E
1810:1071100014400006000000008F8202003C03C0FF04
1811:107120003463FFFB00431024AF8202008F4202DC75
1812:10713000A34005C524420001AF4202DC8F4202DCBD
1813:1071400003E000080000000027BDFFD8AFBF002407
1814:10715000AFB000208F4300248F420020106200381F
1815:10716000000000008F4300208F4200240062202393
1816:1071700004810003000000008F42004000822021B3
1817:107180008F4300308F4200240043102B1440000531
1818:10719000000000008F4300408F42002410000005D3
1819:1071A000006210238F4200308F43002400431023DD
1820:1071B0002442FFFF00406021008C102A544000014F
1821:1071C000008060218F4A00248F4900408F480024AE
1822:1071D0008F4401808F4501848F4600248F4B001C13
1823:1071E00024070001AFA7001000084100010018218A
1824:1071F000014C50212529FFFF01498024AFB0001424
1825:107200008F4700140000102100063100AFA70018BE
1826:1072100000A3282100A3382B0082202100872021F1
1827:107220008F420108016630210040F809000C390046
1828:1072300054400001AF5000248F4300248F420020AF
1829:1072400014620018000000008F4200001040000788
1830:1072500000000000AF80004C8F82004C1040FFFD0A
1831:10726000000000001000000500000000AF80004892
1832:107270008F8200481040FFFD000000008F820060F8
1833:107280002403FFEF00431024AF8200608F42000010
1834:10729000104000030000000010000002AF80004C0E
1835:1072A000AF8000488FBF00248FB0002003E00008AB
1836:1072B00027BD002803E000080000000027BDFFC034
1837:1072C00032C20020AFBF0038AFB30034AFB20030DD
1838:1072D000AFB1002C10400004AFB000288F5300283D
1839:1072E00010000002000000008F5300208F42003089
1840:1072F000105300EB000211008F43001C006280213C
1841:107300008E0400008E050004961200088F42009043
1842:107310009611000A3246FFFF0046102A104000175F
1843:10732000000000008F8200D88F4300980043102394
1844:107330002442DCBEAF4200908F4200902842DCBF66
1845:1073400010400005000000008F4200908F43014470
1846:1073500000431021AF4200908F4200900046102A57
1847:1073600010400006000000008F4203482442000144
1848:10737000AF420348100000E18F4203488F8200FCB7
1849:1073800014400006000000008F4203442442000124
1850:10739000AF420344100000D98F420344934205C218
1851:1073A0001040000B32C200081040000832220200D8
1852:1073B000104000063C0340009602000EAF4300ACB4
1853:1073C0000002140010000002AF4200B0AF4000AC59
1854:1073D000322200041040007F3222080010400003D7
1855:1073E0003247FFFF100000022402002024020004A4
1856:1073F000AFA200108F420030AFA200148F420010E5
1857:107400003C03000200431025AFA200188F460098ED
1858:107410008F4201080040F80900000000104000B74A
1859:10742000000000008F42009C8F4300940242102114
1860:10743000AF42009CAE03000C8F4200AC104000082D
1861:107440003C0340008F42009400431025AFA200206F
1862:107450008F42009C8F4300B01000000400431025B1
1863:107460008F420094AFA200208F42009CAFA2002464
1864:107470008F8200FC8FA300208FA40024AC43000067
1865:10748000AC44000424420008AF8200F08F42009C0C
1866:107490008F4402708F4502740040182100001021B3
1867:1074A00000A3282100A3302B008220210086202168
1868:1074B0003223006024020040AF440270AF450274E2
1869:1074C000106200172C6200411040000524020020C9
1870:1074D00010620008240200011000002600000000D5
1871:1074E0002402006010620019240200011000002133
1872:1074F000000000008F4202788F43027C2463000169
1873:107500002C64000100441021AF420278AF43027C9A
1874:107510008F4202788F43027C100000162402000183
1875:107520008F4202808F430284246300012C64000197
1876:1075300000441021AF420280AF4302848F42028098
1877:107540008F4302841000000B240200018F42028846
1878:107550008F43028C246300012C640001004410213D
1879:10756000AF420288AF43028C8F4202888F43028C65
1880:1075700024020001A34205C28F4200983244FFFF5B
1881:107580002406FFF88F45013C0044102124420007E7
1882:107590000046102424840007AF4200948F420090DC
1883:1075A0008F43009400862024004410230065182B8C
1884:1075B00014600005AF4200908F4200948F43014455
1885:1075C00000431023AF4200948F4200941000002328
1886:1075D000AF40009C3247FFFF50E0002232C2002043
1887:1075E000144000022402001024020002AFA2001086
1888:1075F0008F420030AFA200148F420010AFA20018DB
1889:107600008F4600988F4201080040F80900000000F2
1890:107610001040003A3245FFFF8F4200988F430090A0
1891:107620008F46013C00451021AF4200988F42009CDC
1892:107630008F440098A34005C200651823AF43009013
1893:10764000004510210086202B14800005AF42009CCD
1894:107650008F4200988F43014400431023AF420098AB
1895:1076600032C2002010400005000000008F42035885
1896:107670002442FFFFAF4203588F4203588F4200302D
1897:107680008F430040244200012463FFFF0043102485
1898:10769000AF4200308F420030145300180000000049
1899:1076A0008F4200001040000700000000AF80004C37
1900:1076B0008F82004C1040FFFD00000000100000050C
1901:1076C00000000000AF8000488F8200481040FFFD9E
1902:1076D000000000008F8200602403FFF700431024A5
1903:1076E000AF8200608F4200001040000300000000E5
1904:1076F00010000002AF80004CAF8000488FBF003800
1905:107700008FB300348FB200308FB1002C8FB00028BF
1906:1077100003E0000827BD004003E00008000000006F
1907:1077200027BDFFD032C20020AFBF002CAFB200286F
1908:10773000AFB1002410400004AFB000208F520028E9
1909:1077400010000002000000008F5200208F42003025
1910:10775000105200B5000211008F43001C006280210E
1911:107760008E0400008E050004961100088F420090E0
1912:107770009607000A3226FFFF0046102A1040001725
1913:10778000000000008F8200D88F4300980043102330
1914:107790002442DC46AF4200908F4200902842DC47F2
1915:1077A00010400005000000008F4200908F4301440C
1916:1077B00000431021AF4200908F4200900046102AF3
1917:1077C00010400006000000008F42034824420001E0
1918:1077D000AF420348100000AB8F4203488F8600FC85
1919:1077E00010C0000C000000008F8200F42403FFF89A
1920:1077F0000043102400461023000218C35860000103
1921:10780000246301008F42008C0043102B14400006BB
1922:10781000000712C28F42034424420001AF420344D6
1923:10782000100000988F420344934305C21060000F7C
1924:10783000304600018F4200103448040032C2000874
1925:107840001040000830E20200104000063C034000F7
1926:107850009602000EAF4300AC0002140010000004BA
1927:10786000AF4200B010000002AF4000AC8F480010E3
1928:1078700030E20004104000453227FFFF8F4900AC82
1929:107880001120000530C200FF144000062402004011
1930:10789000100000042402000814400002240200200A
1931:1078A00024020004AFA200108F4300301120000416
1932:1078B000AFA300148F4200B000621025AFA20014E5
1933:1078C0003C02000201021025AFA200188F4600986A
1934:1078D0008F4201080040F8090000000010400069D4
1935:1078E0003224FFFF8F42008C8F430094244200011A
1936:1078F000AF42008C24020001AE03000CA34205C27B
1937:107900008F4200982406FFF88F45013C0044102167
1938:10791000244200070046102424840007AF4200944C
1939:107920008F4200908F43009400862024004410234F
1940:107930000065182B14600005AF4200908F42009440
1941:107940008F43014400431023AF4200948F430094BF
1942:107950008F4201400043102B10400009000000003E
1943:107960008F43013C8F4400948F4200908F45013833
1944:107970000064182300431023AF420090AF450094E9
1945:107980008F4200941000001FAF42009810E0001DCD
1946:1079900030C200FF14400002240200102402000242
1947:1079A000AFA200108F420030AFA80018AFA20014A1
1948:1079B0008F4600988F4201080040F809000000003F
1949:1079C000104000303225FFFF8F4200988F44013C69
1950:1079D00000451021AF4200988F4200908F430098DD
1951:1079E000A34005C2004510230064182B1460000555
1952:1079F000AF4200908F4200988F4301440043102310
1953:107A0000AF4200988F4200308F4300402442000173
1954:107A10002463FFFF00431024AF4200308F42003048
1955:107A200014520018000000008F42000010400007B0
1956:107A300000000000AF80004C8F82004C1040FFFD22
1957:107A4000000000001000000500000000AF800048AA
1958:107A50008F8200481040FFFD000000008F82006010
1959:107A60002403FFF700431024AF8200608F42000020
1960:107A7000104000030000000010000002AF80004C26
1961:107A8000AF8000488FBF002C8FB200288FB1002438
1962:107A90008FB0002003E0000827BD003003E000089D
1963:107AA0000000000027BDFFD83C02000134422EC078
1964:107AB000AFBF00208F4300F08F84010802E2102145
1965:107AC00054620004246200083C02000134422CC0CD
1966:107AD00002E2102100401821AF4300F0AC6000002A
1967:107AE0008F4200EC8C660004146200043C0200012A
1968:107AF000248200201000000FAF8201088F4300F0A5
1969:107B000034422EC002E210215462000424620008B4
1970:107B10003C02000134422CC002E210210040182136
1971:107B20008C6200040002114000821021AF82010823
1972:107B3000AC6000008C85001830A200361040006C4C
1973:107B400030A200018C82001C8F4300408F4400341F
1974:107B5000244200012463FFFF0043102400862021FB
1975:107B6000AF42002C30A2003014400006AF44003475
1976:107B70008F4200348C03023C0043102B144000B4AD
1977:107B80000000000032C20010104000282407000846
1978:107B90008F4401708F4501748F43002C8F48000C77
1979:107BA0008F86012024020080AFA20010AFA3001432
1980:107BB000AFA800188F42010C0040F80924C6001C31
1981:107BC00014400011240200013C010001003708218B
1982:107BD000A02240F18F820124AFA200108F820128E1
1983:107BE0003C040001248467C4AFA200148F46002C1B
1984:107BF0008F8701203C0500090C002B3B34A51100A8
1985:107C000010000036000000008F4203008F43002C5C
1986:107C100024420001AF4203008F420300240200010E
1987:107C2000A34205C110000026AF4300388F44017005
1988:107C30008F4501748F43002C8F48000C8F860120E4
1989:107C400024020020AFA20010AFA30014AFA80018B8
1990:107C50008F42010C0040F80924C6001C144000119A
1991:107C6000240200013C01000100370821A02240F05D
1992:107C70008F820124AFA200108F8201283C040001F2
1993:107C8000248467B8AFA200148F46002C8F87012090
1994:107C90003C0500090C002B3B34A509001000000F27
1995:107CA000000000008F42030024420001AF420300A5
1996:107CB0008F4203008F42002CA34005C1AF42003821
1997:107CC0003C01000100370821A02040F13C010001E7
1998:107CD00000370821A02040F0AF4000348F42031449
1999:107CE00024420001AF420314100000598F420314D4
2000:107CF0001040002230A270008C85001C8F420028AA
2001:107D000000A2202304810003000000008F420040F5
2002:107D1000008220218F4203588F430000AF45002886
2003:107D20000044102110600007AF420358AF80004CA0
2004:107D30008F82004C1040FFFD000000001000000585
2005:107D400000000000AF8000488F8200481040FFFD17
2006:107D5000000000008F82006034420008AF820060A3
2007:107D60008F420000104000030000000010000038A7
2008:107D7000AF80004C10000036AF8000481040002F4C
2009:107D800030A210001040000C30A240008C83001C78
2010:107D90008F420050006220230482000124840200EC
2011:107DA0008F42035C00441021AF42035C8F420368A2
2012:107DB0001000001AAF4300501040000C32C2800087
2013:107DC0008C83001C8F42007000622023048200011B
2014:107DD000248404008F42036400441021AF420364F2
2015:107DE0008F4203681000000DAF4300701040000E7A
2016:107DF0003C0208008C83001C8F420060006220233C
2017:107E000004820001248401008F4203600044102199
2018:107E1000AF4203608F420368AF430060004410210B
2019:107E2000AF4203683C02080002C210245040000820
2020:107E300036940040100000060000000030A201004F
2021:107E400010400003000000000C002BD800000000D0
2022:107E50008FBF002003E0000827BD002803E00008D2
2023:107E60000000000027BDFFA8AFBF0050AFBE004C10
2024:107E7000AFB50048AFB30044AFB20040AFB1003C73
2025:107E8000AFB000388F91010826220020AF82010890
2026:107E90008E3200180000A82132420024104001BA9E
2027:107EA0000000F0218E26001C8F43001C00061100EC
2028:107EB000006218218C70000C9604000C962D0016A0
2029:107EC0009473000A2C8305DD388288702C420001EF
2030:107ED00000621825106000150000282132C2004001
2031:107EE00010400015240208009603001414620012CA
2032:107EF0003402AAAA9603000E146200070000202193
2033:107F00009603001024020300146200040080102174
2034:107F1000960200122C4400010080102154400006FB
2035:107F200024050016100000040000000024020800D0
2036:107F3000508200012405000E934205C3144000083E
2037:107F400000005821240B000132620180AF4500A8D7
2038:107F5000AF5000A010400002AF4600A4A34B05C3E1
2039:107F600010A0008502054021910200000000382188
2040:107F70003042000F0002508032C200021040001256
2041:107F8000010A1821326200021040001032C20001C2
2042:107F900001002021948200002484000200E23821A4
2043:107FA0000083102B1440FFFB30E2FFFF00071C0290
2044:107FB0000062382100071C0230E2FFFF0062382116
2045:107FC00000071027A502000A32C200011040006A13
2046:107FD0003262000110400068000000008F4200A8DB
2047:107FE00010400065000000008F4200A08F4300A8F1
2048:107FF00000431021904C0009318900FF392300060D
2049:108000000003182B392200110002102B00621824E3
2050:108010001060000C3C0500068F4200A43C040001E7
2051:10802000248467D4AFA200108F4200A034A546007C
2052:10803000012038210C002B3BAFA200141000004E91
2053:108040000000000032C20004144000130000282188
2054:10805000316200FF1440000400000000950200029D
2055:108060001000000D004A28239505000C9502000E13
2056:108070009503001000A2282100A3282195030012D7
2057:10808000910400099502000200A3282100A42821E0
2058:10809000004A102300A2282102002021948200001F
2059:1080A0002484000200E238210088102B1440FFFBDA
2060:1080B00000071C0230E2FFFF0062382100071C02AB
2061:1080C00030E2FFFF0062382101A5282100051C02D3
2062:1080D00030A2FFFF0062282100051C0230A2FFFF32
2063:1080E0000062282100A728230005140200A22821ED
2064:1080F00030A5FFFF50A000013405FFFF316200FFF3
2065:1081000014400008318300FF8F4300A08F4200A875
2066:1081100000624021910200003042000F00025080B6
2067:10812000318300FF2402000614620003010A1021BB
2068:10813000100000022444001024440006316200FFB5
2069:1081400014400006000000009482000000A22821D4
2070:1081500000051C0230A2FFFF00622821934205C3E4
2071:10816000104000033262010050400003A48500006B
2072:1081700000052827A48500009622000E8F43009C4E
2073:108180000062182132A200FF10400007AF43009C9C
2074:108190003C02400002021025AFA200208F42009C4A
2075:1081A00010000003005E1025AFB000208F42009C3D
2076:1081B000AFA2002432620080104000103262010041
2077:1081C0008F4200B424430001000210C00057102168
2078:1081D000AF4300B48FA300208FA400243C01000112
2079:1081E00000220821AC2338E83C01000100220821CC
2080:1081F000AC2438EC100000A532C20020104000640E
2081:10820000000000008F4200B424430001000210C0AF
2082:1082100000571021AF4300B48FA300208FA4002487
2083:108220003C01000100220821AC2338E83C01000198
2084:1082300000220821AC2438EC8F4200B410400051D9
2085:10824000000038213C090001352938E83C08001FAE
2086:108250003508FFFF240BFFFF340AFFFF000710C0A3
2087:1082600000571021004910218C4300008C44000469
2088:10827000AFA30028AFA4002C8F8200FC8FA300289E
2089:108280008FA4002CAC430000AC440004244200083E
2090:10829000AF8200F08F42008C2442FFFFAF42008C7F
2091:1082A00097A2002E8F4402708F450274004018215F
2092:1082B0000000102100A3282100A3302B00822021E0
2093:1082C00000862021AF440270AF4502748FA20028BF
2094:1082D0000048102490430000306300011460000B3C
2095:1082E000004020218F4202788F43027C24630001EA
2096:1082F0002C64000100441021AF420278AF43027C9D
2097:108300008F4202781000001A8F43027C8C8200009A
2098:10831000144B000E0000000094820004144A000B6D
2099:10832000000000008F4202888F43028C246300010A
2100:108330002C64000100441021AF420288AF43028C3C
2101:108340008F4202881000000A8F43028C8F42028005
2102:108350008F430284246300012C6400010044102137
2103:10836000AF420280AF4302848F4202808F43028477
2104:108370008F4200B424E7000100E2102B1440FFB844
2105:10838000000710C0A34005C31000003FAF4000B479
2106:108390008F8200FC8FA300208FA40024AC43000038
2107:1083A000AC44000424420008AF8200F08F42009CDD
2108:1083B0008F46008C8F4402708F4502740040182154
2109:1083C0000000102124C6FFFFAF46008C00A3282127
2110:1083D00000A3302B0082202100862021AF440270B0
2111:1083E000AF45027492020000304200011440000CBC
2112:1083F0002402FFFF8F4202788F43027C2463000136
2113:108400002C64000100441021AF420278AF43027C8B
2114:108410008F4202788F43027C1000001C32C2002081
2115:108420008E0300001462000F3402FFFF9603000465
2116:108430001462000C000000008F4202888F43028CFF
2117:10844000246300012C64000100441021AF42028823
2118:10845000AF43028C8F4202888F43028C1000000BC6
2119:1084600032C200208F4202808F43028424630001C5
2120:108470002C64000100441021AF420280AF4302840B
2121:108480008F4202808F43028432C2002010400005D8
2122:10849000AF40009C8F4203582442FFFFAF42035875
2123:1084A0008F4203588E22001C8F430040244200015B
2124:1084B0002463FFFF00431024AF42002C32420060CF
2125:1084C0001440000832C200108F42003424420001E0
2126:1084D000AF4200348C03023C0043102B14400102D5
2127:1084E00032C2001010400018240700088F440170A9
2128:1084F0008F4501748F43002C8F48000C8F8601201C
2129:1085000024020080AFA20010AFA30014AFA800188F
2130:108510008F42010C0040F80924C6001C104000479F
2131:10852000240200018F4203008F43002C24420001EB
2132:10853000AF4203008F42030024020001A34205C1A1
2133:108540001000007CAF4300388F4401708F450174E8
2134:108550008F43002C8F48000C8F86012024020020BE
2135:10856000AFA20010AFA30014AFA800188F42010CF7
2136:108570000040F80924C6001C1040005724020001E6
2137:10858000100000650000000032420012104000752B
2138:10859000324200019622000E8F43009C0062182197
2139:1085A00032C2002010400005AF43009C8F420358A8
2140:1085B0002442FFFFAF4203588F4203588E22001C13
2141:1085C0008F430040244200012463FFFF0043102436
2142:1085D000AF42002C324200101440000832C200109A
2143:1085E0008F42003424420001AF4200348C03023C2D
2144:1085F0000043102B144000BC32C200101040002871
2145:10860000240700088F4401708F4501748F43002CAC
2146:108610008F48000C8F86012024020080AFA200103A
2147:10862000AFA30014AFA800188F42010C0040F80956
2148:1086300024C6001C14400011240200013C0100016A
2149:1086400000370821A02240F18F820124AFA2001040
2150:108650008F8201283C040001248467C4AFA2001467
2151:108660008F46002C8F8701203C0500090C002B3B16
2152:1086700034A5110010000036000000008F420300F6
2153:108680008F43002C24420001AF4203008F420300BD
2154:1086900024020001A34205C110000026AF430038A8
2155:1086A0008F4401708F4501748F43002C8F48000C5C
2156:1086B0008F86012024020020AFA20010AFA3001477
2157:1086C000AFA800188F42010C0040F80924C6001C16
2158:1086D00014400011240200013C0100010037082170
2159:1086E000A02240F08F820124AFA200108F820128C7
2160:1086F0003C040001248467B8AFA200148F46002C0C
2161:108700008F8701203C0500090C002B3B34A5090094
2162:108710001000000F000000008F42030024420001FF
2163:10872000AF4203008F4203008F42002CA34005C1DB
2164:10873000AF4200383C01000100370821A02040F181
2165:108740003C01000100370821A02040F0AF40003478
2166:108750008F42031424420001AF4203141000006250
2167:108760008F42031410400022324270008E25001CFC
2168:108770008F42002800A22023048100030000000093
2169:108780008F420040008220218F4203588F43000017
2170:10879000AF4500280044102110600007AF42035885
2171:1087A000AF80004C8F82004C1040FFFD00000000A5
2172:1087B0001000000500000000AF8000488F820048D4
2173:1087C0001040FFFD000000008F820060344200086E
2174:1087D000AF8200608F4200001040000300000000E4
2175:1087E00010000041AF80004C1000003FAF800048F7
2176:1087F0001040002F324210001040000C3242400066
2177:108800008E23001C8F42005000622023048200014E
2178:10881000248402008F42035C00441021AF42035CB9
2179:108820008F4203681000001AAF4300501040000C44
2180:1088300032C280008E23001C8F4200700062202311
2181:1088400004820001248404008F4203640044102148
2182:10885000AF4203648F4203681000000DAF43007005
2183:108860001040000E3C0208008E23001C8F42006066
2184:108870000062202304820001248401008F420360EF
2185:1088800000441021AF4203608F420368AF43006091
2186:1088900000441021AF4203683C02080002C21024C9
2187:1088A00050400011369400401000000F00000000FE
2188:1088B0003242004810400007241500018E22001C9F
2189:1088C0003C03FFFF0043F0243042FFFF1000FD7522
2190:1088D000AE22001C324201001040000300000000E4
2191:1088E0000C002BD8000000008FBF00508FBE004C42
2192:1088F0008FB500488FB300448FB200408FB1003C69
2193:108900008FB0003803E0000827BD005803E00008DE
2194:108910000000000000000000000000008F8300E461
2195:108920008F8200E02404FFF8004410240062102627
2196:108930000002102B0002102303E000080062102444
2197:1089400003E000080000000027BDFFE0AFBF001CEF
2198:10895000AFB000188F8600C48F8400E08F8500E4DC
2199:108960002402FFF80082182410A3000927623FF8B0
2200:1089700014A2000224A200082762300000408021D7
2201:1089800016030005308200041040000400C02021BE
2202:1089900010000022000010218E0400008F42011CF4
2203:1089A00014A20003000000008F420120AF42011416
2204:1089B0008CA300008F420148008318230043102B32
2205:1089C00010400003000000008F420148006218219F
2206:1089D00094A20006244200500062102B1440000FA5
2207:1089E00000A01021AFA40010AFA300148CA60000BB
2208:1089F0008CA700043C0400010C002B3B24846894E9
2209:108A00008F42020C24420001AF42020C8F42020C42
2210:108A100000001021AF9000E8AF9000E48FBF001C71
2211:108A20008FB0001803E0000827BD002003E0000815
2212:108A3000000000008F8400E08F8800C48F8300E86E
2213:108A40002402FFF80082382400E320232C82100047
2214:108A50005040000124841000000420C2008018212E
2215:108A60008F4402588F45025C0000102100A328218A
2216:108A700000A3302B0082202100862021AF44025821
2217:108A8000AF45025C8F8300C88F4201480103202359
2218:108A90000082102B14400004008018218F420148EE
2219:108AA00000822021008018218F4402508F450254FB
2220:108AB0000000102100A3282100A3302B00822021D8
2221:108AC00000862021AF440250AF450254AF8800C851
2222:108AD000AF8700E4AF8700E803E000080000000073
2223:108AE00027BDFF30240A0001AFBF00C8AFBE00C4DD
2224:108AF000AFB500C0AFB300BCAFB200B8AFB100B407
2225:108B0000AFB000B0A3A00097AFA00044AFAA005C34
2226:108B1000934205C4A7A0008E1040000AA7A00086BB
2227:108B20008F4B00C4AFAB00648F4A00C0AFAA006C8B
2228:108B30008F4B00CCAFAB00748F4A00C810000129E6
2229:108B4000AFAA007C8F4201140040F8090000000029
2230:108B50000040302110C0034F000000008CC2000014
2231:108B60008CC30004AFA20020AFA300248FAB00246D
2232:108B70008FAA00203162FFFF2442FFFCAFA2006CED
2233:108B80003C02000602C21024AFAB007C144000156A
2234:108B9000AFAA006491420000304200011040001171
2235:108BA0002402FFFF8D430000146200043402FFFF23
2236:108BB000954300041062000B000000000C0024BB71
2237:108BC0008FA40064304200FF144000060000000043
2238:108BD0008F4201180040F809000000001000032D2A
2239:108BE000000000008FA200243C03FFBF3463FFFF9E
2240:108BF000004310243C03FFFF0043182414600003CB
2241:108C0000AFA2002410000040000018213C020080A8
2242:108C10000062102410400007000000008F42038C07
2243:108C200024420001AF42038C8F42038C10000036B7
2244:108C3000240300018F42021024420001AF420210BF
2245:108C40008F4202103C020001006210241040000616
2246:108C50003C0200028F4201C424420001AF4201C421
2247:108C60008F4201C43C020002006210241040000642
2248:108C70003C0200048F42037C24420001AF42037C8B
2249:108C80008F42037C3C020004006210241040000666
2250:108C90003C0200088F42038024420001AF4203805F
2251:108CA0008F4203803C02000800621024104000063E
2252:108CB0003C0200108F42038424420001AF4203842F
2253:108CC0008F4203843C020010006210241040000612
2254:108CD0003C0200208F4201C024420001AF4201C08B
2255:108CE0008F4201C03C0200200062102410400006A8
2256:108CF000240300018F42038824420001AF4203880D
2257:108D00008F420388240300018C0202608FAB006C49
2258:108D1000004B102B10400014307000FF8F4201E810
2259:108D200024420001AF4201E88F4201E88FAA007C93
2260:108D30008F8200E0354A0100AFAA007CAFA200108C
2261:108D40008F8200E4241000013C040001248468A008
2262:108D5000AFA200148FA600208FA700243C050007B7
2263:108D60000C002B3B34A50800120000103C020080D0
2264:108D700002C210241440000E32C204008FAB007CEB
2265:108D80003C020080344201000162102410400005C2
2266:108D9000000000008F42020C24420001AF42020C8E
2267:108DA0008F42020C100002B08FA3006C32C204008C
2268:108DB00010400015340281008FAA00649543000C16
2269:108DC000146200123C020100240B0200A7AB008ECB
2270:108DD0009542000E8D4300088D4400048D4500002F
2271:108DE0008FAA006C8FAB0064254AFFFCAFAA006C11
2272:108DF000A7A20086AD63000CAD640008AD65000459
2273:108E0000256B0004AFAB00643C02010002C21024D9
2274:108E100010400004000000008FAA006C254A0004E6
2275:108E2000AFAA006C8F4200BC5040000AAFA0007493
2276:108E30008FAB006C004B102B50400006AFA00074AD
2277:108E40008F4200BC01621023AFA200748F4A00BCA5
2278:108E5000AFAA006C8F4200808FAB006C004B102BD0
2279:108E60001040005632C280001040005E240A000309
2280:108E700032C210001040005BAFAA005C1000005826
2281:108E8000240B00048F4203502403FFBF0283A0245D
2282:108E900024420001AF4203501000024F8F420350A2
2283:108EA00002C2B0252402FFBF0282A0248F830128C2
2284:108EB0003C040001248468D026620001AFA20014A3
2285:108EC000AFA300108F8601208F8701243C05000787
2286:108ED0000C002B3B34A522501000023F0000000084
2287:108EE00002C2B0252402FFBF0282A0248F83012882
2288:108EF0003C040001248468D024020002AFA20014C4
2289:108F0000AFA300108F8601208F8701243C05000746
2290:108F10000C002B3B34A524501000022F0000000051
2291:108F20008EA200008EA300043C040001248468E8A3
2292:108F3000AFB00010AFBE00148EA7001834A52800F3
2293:108F40000C002B3B006030211000022300000000C9
2294:108F5000A6B1000A8F8201243C040001248468F039
2295:108F6000AFBE0014AFA200108F4600448F870120CF
2296:108F70003C0500070C002B3B34A530001000021606
2297:108F800000000000A6B1000AA6B2000E8F820124E4
2298:108F90003C040001248468FCAFBE0014AFA20010A2
2299:108FA0008F4600448F8701203C0500070C002B3BB7
2300:108FB00034A5320010000208000000008F42008437
2301:108FC0008FAA006C004A102B144000073C020001DD
2302:108FD00002C210241040000400000000240B000214
2303:108FE000AFAB005C8FAA006C1140021B27AB0020C6
2304:108FF000AFAB00A43C0A001F354AFFFFAFAA009C9C
2305:109000008FAB005C240A0001556A0021240A00028B
2306:109010008F4300548F4200501062000B274B0054C6
2307:109020008F5E00543403ECC0AFAB004C27C200018C
2308:10903000304201FFAFA20054001E11400043102136
2309:109040001000006B02E2A8218F4200448FAA006C3E
2310:109050003C040001248468ACAFAA0014AFA2001045
2311:109060008F4600548F4700503C0500070C002B3BF7
2312:1090700034A513008F4303502402FFBF0282A024B3
2313:1090800024630001AF430350100001D38F4203500B
2314:10909000156A001D000000008F4300748F420070AD
2315:1090A0001062000A274B00748F5E0074AFAB004C57
2316:1090B00027C20001304203FFAFA20054001E11403E
2317:1090C00024426CC01000004A02E2A8218F420044F2
2318:1090D0008FAA006C3C040001248468B83C0500079A
2319:1090E000AFAA0014AFA200108F4600748F47007023
2320:1090F00034A51500240B00010C002B3BAFAB005C2A
2321:109100001000FFC3000000008F4300648F42006026
2322:109110001062001A274A00648F5E00648FAB005C07
2323:10912000AFAA004C27C20001304200FFAFA200549A
2324:10913000240200041562000E001E1140001E118062
2325:1091400024420CC002E21021AFA200449442002A43
2326:109150008FAA00448FAB006C004B102B10400024F2
2327:1091600025550020240A000110000021A3AA009721
2328:1091700024424CC01000001E02E2A8218F4200448D
2329:109180008FAB006C3C040001248468C4AFAB0014B6
2330:10919000AFA200108F4600648F4700603C050007B7
2331:1091A0000C002B3B34A518003C02000802C210241E
2332:1091B0001440FF34000000008F420370240A0001B5
2333:1091C000AFAA005C24420001AF4203701000FF9080
2334:1091D0008F42037027A3003600131040006218214D
2335:1091E000946200000044102110000020A4620000DE
2336:1091F0008FAB0064AEAB001893A2009710400072D2
2337:10920000000098218FAA00448FA4006C8FA300A4B3
2338:1092100025420020AFA2002825420008AFA200305E
2339:1092200025420010AFAA002CAFA200349542002ABC
2340:10923000A7A2003895420018A7A2003A9542001A4A
2341:10924000A7A2003C9542001CA7A2003E9462001811
2342:1092500024630002008220231880FFDE26730001B1
2343:109260002E6200041440FFF9000000008F4200FC51
2344:109270002665000100A2102A1440002B24030001DF
2345:109280008F83012C10600023000000008F820124D6
2346:109290000043102300022143588000012484004031
2347:1092A0008F820128004310230002194358600001F7
2348:1092B000246300400064102A544000010060202113
2349:1092C000AF4400FC8F4200FC00A2102A10400011A5
2350:1092D0002403000110000015306200FF8FAB006412
2351:1092E00096070018AFAB00108E2200083C04000166
2352:1092F000248468DC8C4300048C42000034A52400E4
2353:10930000024030210C002B3BAFA300141000002BB7
2354:10931000000000008F4203340000182124420001A5
2355:10932000AF4203348F420334306200FF5040FEDC12
2356:109330003C02080012600021000090218FB100A4BF
2357:10934000022080218E220008960700188FA6006454
2358:109350008C4400008C450004240A0001AFAA0010D0
2359:10936000AFBE00148F420008AFA200188F42010C5C
2360:109370000040F809000000001040FFD83C0500073D
2361:10938000960200188FAB00648FAA009C01625821DE
2362:10939000014B102B10400004AFAB00648F4201481A
2363:1093A00001625823AFAB0064261000022652000170
2364:1093B0000253102B1440FFE3263100048FB0006CE1
2365:1093C0001000003697B100388F4200FC24050002DF
2366:1093D00000A2102A1440001B240300018F83012CDB
2367:1093E00010600013000000008F820124004310234E
2368:1093F0000002214358800001248400408F8201280C
2369:109400000043102300021943586000012463004008
2370:109410000064102A5440000100602021AF4400FC89
2371:109420008F4200FC00A2102A144000062403000111
2372:109430008F4203340000182124420001AF4203345C
2373:109440008F420334306200FF1040FEA53C0208004A
2374:1094500096B1000A8FB0006C3223FFFF0070102B12
2375:1094600054400001006080218EA400008EA50004FD
2376:10947000240B0001AFAB0010AFBE00148F420008F8
2377:109480008FA60064AFA200188F42010C0040F809BB
2378:10949000020038211040FEA23C05000796A3000EF2
2379:1094A00097AA008E1140000700609021934205C4E6
2380:1094B000144000040000000097AB0086006A1825E5
2381:1094C000A6AB00168FAA007C3C02FFFF01421024CD
2382:1094D00010400003000A140234630400A6A2001422
2383:1094E0008FAB006C560B0072A6A3000E3462000412
2384:1094F000A6A2000E8FAA0074016A1021A6A2000A7B
2385:109500008F4300448F4401A08F4501A434028000A2
2386:10951000AFA200108F42004402A030212407002097
2387:10952000AFA200148F42000C0003194000604821D4
2388:10953000AFA200188F42010C0000402100A9282191
2389:1095400000A9182B008820210040F8090083202161
2390:109550005040FE7FA6B2000E8F420368AFA0006CA1
2391:10956000A34005C42442FFFFAF4203688FAB005CF9
2392:10957000240A00018F420368156A0006240A0002CB
2393:109580008F42035C2442FFFFAF42035C1000000CDB
2394:109590008F42035C156A0006000000008F420364DE
2395:1095A0002442FFFFAF420364100000058F420364B2
2396:1095B0008F4203602442FFFFAF4203608F4203608B
2397:1095C0008FAA00548FAB004CAD6A00008F4200445C
2398:1095D0008F4400888F430078244200010044102407
2399:1095E00024630001AF420044AF4300788C02024084
2400:1095F0000062182B14600075240700088F4401686E
2401:109600008F45016C8F4300448F48000C8F860120EA
2402:1096100024020040AFA20010AFA30014AFA80018AE
2403:109620008F42010C0040F80924C6001C14400011B0
2404:10963000240B00013C01000100370821A02B40F25F
2405:109640008F820124AFA200108F8201283C04000108
2406:109650002484688CAFA200148F4600448F870120B9
2407:109660003C0500090C002B3B34A513001000000B37
2408:10967000000000008F42030424420001AF420304B3
2409:109680008F4203048F420044AF42007C3C01000142
2410:1096900000370821A02040F2AF4000788F42031825
2411:1096A00024420001AF420318100000488F42031803
2412:1096B000A6B0000A8F4300448F4401A08F4501A447
2413:1096C00034028000AFA200108F42004402A030217B
2414:1096D00024070020AFA200148F42000C00031940A1
2415:1096E00000604821AFA200188F42010C0000402109
2416:1096F00000A9282100A9182B008820210040F80982
2417:10970000008320211040FE1F240A0001A34A05C443
2418:109710008FAB006C8FAA006401705823AFAB006C54
2419:109720008FAB009C01505021016A102B10400004A7
2420:10973000AFAA00648F42014801425023AFAA0064DF
2421:109740008F4203682442FFFFAF4203688FAA005C88
2422:10975000240B00018F420368154B0006240B000206
2423:109760008F42035C2442FFFFAF42035C1000000CF9
2424:109770008F42035C114B0006000000008F42036023
2425:109780002442FFFFAF420360100000058F420360D8
2426:109790008F4203642442FFFFAF4203648F4203649D
2427:1097A0008FAB00548FAA004CAD4B00008F42004499
2428:1097B0008F4400888F430078244200010044102425
2429:1097C00024630001AF420044AF4300788FAA006CCD
2430:1097D0001540FE0B000000008FAB006C1160001EF6
2431:1097E00000000000934205C4104000090000000082
2432:1097F0008FAA0064AF4A00C4AF4B00C08FAB007C9F
2433:10980000AF4B00C88FAA00741000000EAF4A00CC06
2434:1098100097AB008E1160000B340381008FA20020F3
2435:109820008C46000CA443000C97AA00868C440004CC
2436:109830008C450008A44A000EAC440000AC4500046E
2437:10984000AC4600088F42034C24420001AF42034C57
2438:10985000100000108F42034C8FAB007C3164FFFF7F
2439:109860002484FFFC008018218F4402508F4502544D
2440:109870008F4601180000102100A3282100A3382BD7
2441:109880000082202100872021AF44025000C0F80947
2442:10989000AF4502548FBF00C88FBE00C48FB500C053
2443:1098A0008FB300BC8FB200B88FB100B48FB000B0DE
2444:1098B00003E0000827BD00D003E00008000000001E
2445:1098C00027BDFF38240B0001AFBF00C0AFBE00BCF6
2446:1098D000AFB500B8AFB300B4AFB200B0AFB100AC39
2447:1098E000AFB000A8A3A00087AFA00044AFAB005C5E
2448:1098F000934205C4A7A0007610400007A7A0007EF1
2449:109900008F4C00C0AFAC00648F4B00C88F5E00C4AA
2450:1099100010000130AFAB006C8F4201140040F80919
2451:10992000000000000040302110C002A10000000033
2452:109930008CC200008CC30004AFA20020AFA300249F
2453:109940008FAC00248FBE00203182FFFF2442FFFC39
2454:10995000AFA200643C02000602C2102414400015AD
2455:10996000AFAC006C93C20000304200011040001107
2456:109970002402FFFF8FC30000146200043402FFFFC3
2457:1099800097C300041062000B000000000C0024BB11
2458:1099900003C02021304200FF1440000600000000F8
2459:1099A0008F4201180040F8090000000010000280FA
2460:1099B000000000008FA200243C03FFBF3463FFFFC0
2461:1099C000004310243C03FFFF0043182414600003ED
2462:1099D000AFA2002410000040000080213C02008063
2463:1099E0000062102410400007000000008F42038C2A
2464:1099F00024420001AF42038C8F42038C10000036DA
2465:109A0000241000018F42021024420001AF420210D4
2466:109A10008F4202103C020001006210241040000638
2467:109A20003C0200028F4201C424420001AF4201C443
2468:109A30008F4201C43C020002006210241040000664
2469:109A40003C0200048F42037C24420001AF42037CAD
2470:109A50008F42037C3C020004006210241040000688
2471:109A60003C0200088F42038024420001AF42038081
2472:109A70008F4203803C020008006210241040000660
2473:109A80003C0200108F42038424420001AF42038451
2474:109A90008F4203843C020010006210241040000634
2475:109AA0003C0200208F4201C024420001AF4201C0AD
2476:109AB0008F4201C03C0200200062102410400006CA
2477:109AC000241000018F42038824420001AF42038822
2478:109AD0008F420388241000018C0202608FAB006467
2479:109AE000004B102B10400015320200FF8F4201E89E
2480:109AF00024420001AF4201E88F4201E88FAC006CC4
2481:109B00008F8200E0358C0100AFAC006CAFA200107A
2482:109B10008F8200E4241000013C040001248468A02A
2483:109B2000AFA200148FA600208FA700243C050007D9
2484:109B30000C002B3B34A53600320200FF1040001011
2485:109B40003C02008002C210241440000E32C2040005
2486:109B50008FAB006C3C020080344201000162102493
2487:109B600010400005000000008F42020C244200015A
2488:109B7000AF42020C8F42020C100002028FA300645D
2489:109B800032C20400104000123402810097C3000C5E
2490:109B90001462000F00000000240C0200A7AC007645
2491:109BA00097C2000E8FC300088FC400048FAB0064FF
2492:109BB0008FC50000256BFFFCAFAB0064A7A2007E41
2493:109BC000AFC3000CAFC40008AFC5000427DE00041B
2494:109BD0008FA70064320200FF144000343C020100F1
2495:109BE00097C4000C2C8305DD388288702C4200015C
2496:109BF00000621825106000150000282132C20800FC
2497:109C0000104000152402080097C3001414620012CB
2498:109C10003402AAAA97C3000E146200070000202194
2499:109C200097C3001024020300146200040080102176
2500:109C300097C200122C4400010080102154400006FD
2501:109C40002405001610000004000000002402080093
2502:109C5000508200012405000E10A0001303C520212E
2503:109C6000248300093C02001F3442FFFF0043102BF5
2504:109C700010400003000000008F42014800621823DA
2505:109C800090620000384300062C6300013842001146
2506:109C90002C42000100621825106000043C02010003
2507:109CA00094820002004538213C02010002C21024C7
2508:109CB0005040000EAFA700648FAC006410EC0008A9
2509:109CC0003C0500073C040001248469088FA6006459
2510:109CD00034A54000AFA000100C002B3BAFA0001437
2511:109CE0008FAB0064256B0004AFAB00648F42008033
2512:109CF0008FAC0064004C102B1040002C32C280004E
2513:109D000010400034240B000332C210001040003118
2514:109D1000AFAB005C1000002E240C00048F420350F7
2515:109D20002403FFBF0283A02424420001AF4203505A
2516:109D3000100001738F4203503C02080002C2B0259C
2517:109D40002402FFBF0282A0248F8301283C0400016B
2518:109D5000248468D026620001AFA20014AFA30010D3
2519:109D60008F8601208F8701243C0500070C002B3BC8
2520:109D700034A5530010000162000000008EA2000014
2521:109D80008EA300043C040001248468E8AFB00010F6
2522:109D9000AFB100148EA7001834A559000C002B3B5E
2523:109DA0000060302110000156000000008F42008446
2524:109DB0008FAB0064004B102B144000073C020001E5
2525:109DC00002C210241040000400000000240C000215
2526:109DD000AFAC005C8FAB00641160016627AC002063
2527:109DE000AFAC008C8FAB005C240C0001556C0021E3
2528:109DF000240C00028F4300548F4200501062000B6D
2529:109E0000274B00548F5100543403ECC0AFAB004CCF
2530:109E100026220001304201FFAFA200540011114080
2531:109E2000004310211000006B02E2A8218F42004481
2532:109E30008FAC00643C040001248468ACAFAC001417
2533:109E4000AFA200108F4600548F4700503C0500071A
2534:109E50000C002B3B34A543008F4303502402FFBF6B
2535:109E60000282A02424630001AF43035010000124A8
2536:109E70008F420350156C001D000000008F430074DA
2537:109E80008F4200701062000A274B00748F510074DB
2538:109E9000AFAB004C26220001304203FFAFA20054BA
2539:109EA0000011114024426CC01000004A02E2A821B7
2540:109EB0008F4200448FAC00643C040001248468B8E5
2541:109EC0003C050007AFAC0014AFA200108F46007431
2542:109ED0008F47007034A54500240B00010C002B3B7C
2543:109EE000AFAB005C1000FFC3000000008F430064B4
2544:109EF0008F4200601062001A274C00648F5100648A
2545:109F00008FAB005CAFAC004C26220001304200FF5A
2546:109F1000AFA20054240200041562000E001111408B
2547:109F20000011118024420CC002E21021AFA20044B3
2548:109F30009442002A8FAC00448FAB0064004B102B7E
2549:109F40001040002425950020240C00011000002161
2550:109F5000A3AC008724424CC01000001E02E2A821DE
2551:109F60008F4200448FAB00643C040001248468C429
2552:109F7000AFAB0014AFA200108F4600648F470060A3
2553:109F80003C0500070C002B3B34A548003C020008B0
2554:109F900002C210241440FF61000000008F420370D1
2555:109FA000240C0001AFAC005C24420001AF420370FE
2556:109FB0001000FF908F42037027A30036001310405B
2557:109FC0000062182194620000004410211000001F5C
2558:109FD000A4620000AEBE001893A200871040008467
2559:109FE000000098218FAB00448FA400648FA3008CE5
2560:109FF00025620020AFA2002825620008AFA2003031
2561:10A0000025620010AFAB002CAFA200349562002A8D
2562:10A01000A7A2003895620018A7A2003A9562001A1C
2563:10A02000A7A2003C9562001CA7A2003E9462001803
2564:10A0300024630002008220231880FFDF26730001C2
2565:10A040002E6200041440FFF9000000008F4200FC63
2566:10A050000262102A14400030240300018F83012C77
2567:10A0600010600028000000008F82012400431023AC
2568:10A070000002214358800001248400408F8201287F
2569:10A08000004310230002194358600001246300407C
2570:10A090000064102A5440000100602021AF4400FCFD
2571:10A0A0008F4200FC0262102A1040001624030001B7
2572:10A0B0001000001A306200FF8FAC008C00101040BE
2573:10A0C000004C10219447001800101080004C102103
2574:10A0D000AFBE00108C4200083C040001248468DC00
2575:10A0E0003C0500078C4300048C42000034A5550059
2576:10A0F000020030210C002B3BAFA3001410000039EC
2577:10A10000000000008F4203340000182124420001A7
2578:10A11000AF4203348F420334306200FF1040FF0629
2579:10A12000000080218F4300082402FBFF1260002DF5
2580:10A13000006250243C0B4000022B40258FB1008C64
2581:10A140002669FFFF022090218E4200089627001802
2582:10A150008C4400008C45000456090004240B0001C7
2583:10A16000240C000210000002AFAC0010AFAB0010D6
2584:10A1700016000004AFA800148F420008100000026F
2585:10A18000AFA20018AFAA00188F42010C03C0302103
2586:10A19000AFA80098AFA9009C0040F809AFAA00A0A2
2587:10A1A0008FA800988FA9009C8FAA00A01040FFC222
2588:10A1B0003C02001F962300183442FFFF03C3F02126
2589:10A1C000005E102B10400003263100028F42014830
2590:10A1D00003C2F023261000010213102B1440FFDAF3
2591:10A1E000265200048FB000641000001A0000000026
2592:10A1F00096A3000A8FB000640070102B5440000139
2593:10A20000006080218EA400008EA500048FAB005C4E
2594:10A21000240C0002AFAC0010934305C4000B1700E0
2595:10A2200010600003022230253C02080000C23025E5
2596:10A23000AFA600148F420008AFA200188F42010C95
2597:10A2400003C030210040F809020038211040FECB45
2598:10A250003C05000797AC00761180000796A3000E1E
2599:10A26000934205C4144000040000000097AB007E38
2600:10A27000006C1825A6AB00168FAC006C3C02FFFFEB
2601:10A280000182102410400003000C14023463040007
2602:10A29000A6A20014A6B0000A8FAB0064560B0006FD
2603:10A2A00003D0F02134620004AFA00064A6A2000E27
2604:10A2B0001000000DA34005C48FAC00643C02001FD9
2605:10A2C0003442FFFF005E102B01906023AFAC0064AE
2606:10A2D000A6A3000E240B000110400003A34B05C4ED
2607:10A2E0008F42014803C2F0238FAB00548FAC004C67
2608:10A2F000AD8B00008FAC00641580FEBA000000003A
2609:10A300008FAB00641160001B00000000934205C485
2610:10A310001040000600000000AF5E00C4AF4B00C05C
2611:10A320008FAC006C1000000EAF4C00C897AB0076ED
2612:10A330001160000B340381008FA200208C46000CBA
2613:10A34000A443000C97AC007E8C4400048C450008AC
2614:10A35000A44C000EAC440000AC450004AC46000820
2615:10A360008F42034C24420001AF42034C1000001006
2616:10A370008F42034C8FAB006C3164FFFF2484FFFCE1
2617:10A38000008018218F4402508F4502548F460118D7
2618:10A390000000102100A3282100A3382B00822021D7
2619:10A3A00000872021AF44025000C0F809AF45025495
2620:10A3B0008FBF00C08FBE00BC8FB500B88FB300B494
2621:10A3C0008FB200B08FB100AC8FB000A803E00008DE
2622:10A3D00027BD00C803E000080000000027BDFFD82B
2623:10A3E000AFBF0024AFB000208F43004C8F42004825
2624:10A3F00010620034000000008F4300488F42004C80
2625:10A400000062202304820001248402008F43005450
2626:10A410008F42004C0043102B144000042402020021
2627:10A420008F43004C10000005004310238F4200545E
2628:10A430008F43004C004310232442FFFF0040502173
2629:10A44000008A102A54400001008050218F49004C9E
2630:10A450008F48004C8F4401888F45018C8F46004CFB
2631:10A4600024071000AFA70010000841400100182188
2632:10A47000012A4821313001FFAFB000148F4700148A
2633:10A480000000102100063140AFA7001800A32821CA
2634:10A4900000A3382B00822021008720213402ECC049
2635:10A4A00000C230218F42010802E630210040F80945
2636:10A4B000000A394054400001AF50004C8F43004C1B
2637:10A4C0008F42004814620018000000008F42000014
2638:10A4D0001040000700000000AF80004C8F82004C4D
2639:10A4E0001040FFFD0000000010000005000000000B
2640:10A4F000AF8000488F8200481040FFFD0000000040
2641:10A500008F8200602403FDFF00431024AF820060AF
2642:10A510008F42000010400003000000001000000205
2643:10A52000AF80004CAF8000488FBF00248FB0002068
2644:10A5300003E0000827BD002803E000080000000039
2645:10A5400027BDFFD8AFBF0024AFB000208F43005C11
2646:10A550008F42005810620049000000008F430058ED
2647:10A560008F42005C006220230482000124840100E9
2648:10A570008F4300648F42005C0043102B14400004A2
2649:10A58000240201008F43005C1000000500431023EB
2650:10A590008F4200648F43005C004310232442FFFF7E
2651:10A5A000004038210087102A5440000100803821E3
2652:10A5B0008F42005C00471021305000FF32C2100073
2653:10A5C00010400015240820008F49005C8F44019042
2654:10A5D0008F4501948F46005C00073980AFA80010BA
2655:10A5E000AFB000148F4800140009498001201821E1
2656:10A5F0000000102100A3282100A3482B0082202165
2657:10A600000089202100063180AFA800188F42010880
2658:10A610001000001424C60CC08F49005C8F440190C8
2659:10A620008F4501948F46005C00073940AFA80010A9
2660:10A63000AFB000148F4800140009494001201821D0
2661:10A640000000102100A3282100A3482B0082202114
2662:10A650000089202100063140AFA800188F42010870
2663:10A6600024C64CC00040F80902E6302154400001E5
2664:10A67000AF50005C8F43005C8F420058146200189A
2665:10A68000000000008F4200001040000700000000A2
2666:10A69000AF80004C8F82004C1040FFFD0000000096
2667:10A6A0001000000500000000AF8000488F820048C5
2668:10A6B0001040FFFD000000008F8200602403FEFFB9
2669:10A6C00000431024AF8200608F420000104000035E
2670:10A6D0000000000010000002AF80004CAF80004876
2671:10A6E0008FBF00248FB0002003E0000827BD0028A2
2672:10A6F00003E000080000000027BDFFD8AFBF002422
2673:10A70000AFB000208F43006C8F42006810620033AE
2674:10A71000000000008F4300688F42006C006220231D
2675:10A7200004820001248404008F4300748F42006C73
2676:10A730000043102B14400004240204008F43006CDB
2677:10A7400010000005004310238F4200748F43006CFB
2678:10A75000004310232442FFFF00405021008A102AAA
2679:10A7600054400001008050218F49006C8F48006CDC
2680:10A770008F4401988F45019C8F46006C2407400050
2681:10A78000AFA700100008414001001821012A48210C
2682:10A79000313003FFAFB000148F47001400001021C8
2683:10A7A0000006314024C66CC0AFA7001800A32821C2
2684:10A7B00000A3382B00822021008720218F4201082E
2685:10A7C00002E630210040F809000A394054400001F7
2686:10A7D000AF50006C8F43006C8F4200681462001809
2687:10A7E000000000008F420000104000070000000041
2688:10A7F000AF80004C8F82004C1040FFFD0000000035
2689:10A800001000000500000000AF8000488F82004863
2690:10A810001040FFFD000000008F8200602403F7FF5E
2691:10A8200000431024AF8200608F42000010400003FC
2692:10A830000000000010000002AF80004CAF80004814
2693:10A840008FBF00248FB0002003E0000827BD002840
2694:10A8500003E00008000000008F4200FC3C03000100
2695:10A860008F4400F8346330C824420001AF4200FC3A
2696:10A870008F85012802E310215482000424820008FD
2697:10A880003C02000134422EC802E21021004018218F
2698:10A89000AF4300F8AC6000008F4200F41462000483
2699:10A8A0003C02000124A200201000000FAF8201280A
2700:10A8B0008F4300F8344230C802E210215462000491
2701:10A8C000246200083C02000134422EC802E210213A
2702:10A8D000004018218C6200040002114000A21021E7
2703:10A8E000AF820128AC6000008CA3001830620070B9
2704:10A8F0001040002D30620020104000043C02001087
2705:10A9000002C210241040000D000000003062004020
2706:10A91000104000043C02002002C210241040000736
2707:10A9200000000000306200101040001F3C02004098
2708:10A9300002C210241440001C000000008F8200405E
2709:10A940003042000114400008000020218C03010463
2710:10A950002402000150620005240400018C020264FC
2711:10A960001040000300801021240400010080102109
2712:10A9700010400006000000008F42030C244200013A
2713:10A98000AF42030C100000088F42030C8F8200447A
2714:10A9900034420004AF8200448F4203082442000185
2715:10A9A000AF4203088F42030803E0000800000000E4
2716:10A9B00003E000080000000027BDFF98AFBF006063
2717:10A9C000AFBE005CAFB50058AFB30054AFB200509B
2718:10A9D000AFB1004CAFB000488F4200FC24420001F0
2719:10A9E000AF4200FC8F88012825020020AF82012899
2720:10A9F0008D030018306200701040002E306200207D
2721:10AA0000104000043C02001002C210241040000D4F
2722:10AA10000000000030620040104000043C020020B2
2723:10AA200002C2102410400007000000003062001035
2724:10AA3000104001A93C02004002C21024144001A6AB
2725:10AA4000000000008F8200403042000114400008E6
2726:10AA5000000020218C030104240200015062000543
2727:10AA6000240400018C0202641040000300801021C5
2728:10AA700024040001008010211040000600000000A6
2729:10AA80008F42030C24420001AF42030C10000192DC
2730:10AA90008F42030C8F82004434420004AF82004492
2731:10AAA0008F42030824420001AF4203081000018ACC
2732:10AAB0008F420308306200021040014B3C02080044
2733:10AAC0008D1E001C001E5702AFAA0034950A001606
2734:10AAD00003C22024AFAA00248FAA0034240200015C
2735:10AAE0001542000633DEFFFF001E11403403ECC0A8
2736:10AAF000004310211000001002E2A82124020002ED
2737:10AB00001542000524020003001E114024426CC0BF
2738:10AB10001000000902E2A82115420005001E118064
2739:10AB2000001E114024424CC01000000302E2A82184
2740:10AB30000057102124550CE096A2000E304AFFFC6D
2741:10AB40003042040010400003AFAA002C100000E1C6
2742:10AB500000008821108000040000882197B10026A1
2743:10AB6000100000DDA6B100128EB30018966A000C2A
2744:10AB7000A7AA003E97A5003E2CA305DD38A2887049
2745:10AB80002C420001006218251060001500002021F1
2746:10AB900032C2080010400015240208009663001419
2747:10ABA000146200123402AAAA9663000E146200070F
2748:10ABB00000002821966300102402030014620004A0
2749:10ABC00000A01021966200122C45000100A0102167
2750:10ABD0005440000624040016100000040000000089
2751:10ABE0002402080050A200012404000E108000B9C5
2752:10ABF00002649021924200003042000F00028080E7
2753:10AC000032C2010010400020025018213C020020F6
2754:10AC10000043102B1440000E024020210000282188
2755:10AC2000948200002484000200A228210083102BBB
2756:10AC30001440FFFB30A2FFFF00051C020062282128
2757:10AC400000051C0230A2FFFF10000009006228214D
2758:10AC50008F4701488F420110001028423C06002017
2759:10AC60000040F809AFA800403045FFFF8FA8004022
2760:10AC700050A000013405FFFF8FAA002C354A0002C6
2761:10AC800010000002AFAA002C0000282132C2008070
2762:10AC900010400090A6A50010264300093C02001FAA
2763:10ACA0003442FFFF0043102B10400003000000005F
2764:10ACB0008F420148006218239066000030C200FFF6
2765:10ACC000384300062C630001384200112C42000179
2766:10ACD000006218251060007F24020800000088210F
2767:10ACE00097A3003E1462000F0260202196710000BD
2768:10ACF0009662000296630004966400060222882190
2769:10AD00000223882102248821966200089663000AA3
2770:10AD10009664000C0222882102238821100000077B
2771:10AD200002248821948200002484000202228821C7
2772:10AD30000092102B1440FFFB0000000000111C02C9
2773:10AD40003222FFFF0062882100111C023222FFFF25
2774:10AD50000062882132C2020010400003264400062F
2775:10AD60001000003E000080213C05001F34A5FFFFBD
2776:10AD700000A4102B10400003000000008F42014887
2777:10AD8000008220239482000030421FFF1040000404
2778:10AD90002644000C96420002100000300050802330
2779:10ADA0009642000226430014005080233C020020FB
2780:10ADB0000043102B1440000A00D080219642000C62
2781:10ADC000020280219642000E964300109644001223
2782:10ADD0000202802102038021100000200204802151
2783:10ADE00000A4102B10400003000000008F42014817
2784:10ADF0000082202394820000248400020202802129
2785:10AE000000A4102B10400003000000008F420148F6
2786:10AE10000082202394820000248400020202802108
2787:10AE200000A4102B10400003000000008F420148D6
2788:10AE300000822023948200002484000202028021E8
2789:10AE400000A4102B10400003000000008F420148B6
2790:10AE50000082202394820000020280213C02010033
2791:10AE600002C210241040000E000000008FAA002C27
2792:10AE7000314200041040000A000000009504000E5A
2793:10AE8000026420210C003EEC2484FFFC3042FFFFD2
2794:10AE90000222882100111C023222FFFF0062882159
2795:10AEA0008FAA002401518823001114020222882154
2796:10AEB0000230882100111402022288213231FFFF62
2797:10AEC000522000013411FFFF8FAA002C354A0001E7
2798:10AED000AFAA002CA6B1001297AA002EA6AA000EB7
2799:10AEE0008FAA002C314200041040000224091000F7
2800:10AEF000340980008F4800448F4401A08F4501A48D
2801:10AF0000AFA900108F4900440008414001001821FA
2802:10AF1000AFA900148F48000C02A0302124070020A4
2803:10AF2000AFA800188F48010C0000102100A32821B1
2804:10AF300000A3482B008220210100F809008920216C
2805:10AF40001440000B000000008F8201283C04000127
2806:10AF500024846914AFBE0014AFA200108F860124B0
2807:10AF60008F8701203C0500070C002B3B34A599205E
2808:10AF70008F4203682442FFFFAF4203688F420044C0
2809:10AF80008F4300882442000100431024AF42004454
2810:10AF90008FAA00348F440368240200011542000682
2811:10AFA000240200028F42035C2442FFFFAF42035C95
2812:10AFB000100000498F42035C1542000600000000AB
2813:10AFC0008F4203642442FFFFAF420364100000423B
2814:10AFD0008F4203648F4203602442FFFFAF4203604D
2815:10AFE0001000003D8F4203603062100010400005E9
2816:10AFF000306280008F420078244200011000003649
2817:10B00000AF42007810400034000000008F4200780A
2818:10B0100024420001AF4200788C0302400043102B11
2819:10B020001440002D240700088F4401688F45016CEF
2820:10B030008F4300448F48000C8F860120240200407B
2821:10B04000AFA20010AFA30014AFA800188F42010CEC
2822:10B050000040F80924C6001C14400011240200011D
2823:10B060003C01000100370821A02240F28F82012418
2824:10B07000AFA200108F8201283C0400012484688C58
2825:10B08000AFA200148F4600448F8701203C050009C1
2826:10B090000C002B3B34A513001000000B0000000037
2827:10B0A0008F42030424420001AF4203048F42030491
2828:10B0B0008F420044AF42007C3C0100010037082170
2829:10B0C000A02040F2AF4000788F42031824420001D4
2830:10B0D000AF4203188F4203188FBF00608FBE005C21
2831:10B0E0008FB500588FB300548FB200508FB1004C11
2832:10B0F0008FB0004803E0000827BD006803E00008A7
2833:10B100000000000000000000000000008F42013C31
2834:10B11000AF8200C08F42013CAF8200C48F42013C2D
2835:10B12000AF8200C88F420138AF8200D08F42013811
2836:10B13000AF8200D48F42013803E00008AF8200D80C
2837:10B1400027BDFFE02784020824050200AFBF0018D6
2838:10B150000C002BBF240600088C0202040C004012D5
2839:10B16000AF8202103C0200018C426D94304200021A
2840:10B170001040000E000020218C060248240200022C
2841:10B180003C010001AC226D980C0051042405000222
2842:10B19000000020218C060248240200013C0100012D
2843:10B1A000AC226D9810000011240500018C060248A5
2844:10B1B000240200043C010001AC226D980C005104F3
2845:10B1C000240500043C0200018C426D9430420001D1
2846:10B1D00010400008240200013C010001AC226D98DF
2847:10B1E00000002021240500013C06601B0C005104D6
2848:10B1F000000000003C040001248469D08F4201500B
2849:10B200008F4301543C0500088F4601580002164048
2850:10B21000000319403463040300431025000633C0C3
2851:10B2200000461025AF82021CAFA00010AFA0001492
2852:10B230008F86021C34A502000C002B3B0000382135
2853:10B240003C010001AC206D903C010001AC206DA8D8
2854:10B250008FBF001803E0000827BD002027BDFFE0D6
2855:10B260003C05000834A50300AFBF0018AFA00010D4
2856:10B27000AFA000148F8602003C040001248469DC26
2857:10B280000C002B3B000038218F42041024420001A7
2858:10B29000AF4204108F4204108FBF001803E0000873
2859:10B2A00027BD002027BDFFD8AFBF0020AFB1001CD5
2860:10B2B000AFB000188F4203A424420001AF4203A4A0
2861:10B2C0008F4203A48F9002208F8200E0AFA2001073
2862:10B2D0008F8200E4AFA200148F8600C48F8700C85D
2863:10B2E0003C040001248469E80C002B3B0200282167
2864:10B2F0003C04400002041024504000B43C0401000F
2865:10B300008F4203BC24420001AF4203BC8F4203BC06
2866:10B310008F8700C48F8300C88F42014800671823BD
2867:10B320000043102B10400003000000008F42014832
2868:10B330000062182110600005000000008F42014CDF
2869:10B340000043102B1040000B000000008F8200E033
2870:10B350008F430124AF42011CAF4301148F820220AE
2871:10B360003C0308FF3463FFFB00431024100000CEB1
2872:10B37000004410258F8202203C0308FF3463FFFF46
2873:10B380000043102434420004AF8202208F8200E088
2874:10B390008F430124AF42011CAF4301148F8600C8C4
2875:10B3A0008F8401208F8301241000000500002821D4
2876:10B3B0001462000224620020276248000040182125
2877:10B3C0001064000C30A200FF8C62001830420003B1
2878:10B3D0001040FFF727624FE08F4203D024050001A1
2879:10B3E00024420001AF4203D08F4203D08C66000894
2880:10B3F00030A200FF1440005800000000934205C432
2881:10B4000014400055000000008F8700C48F8800E0C2
2882:10B410008F8400E42402FFF8010240240104102379
2883:10B42000000218C3046200012463020010600005DA
2884:10B430002402000110620009000000001000001F3B
2885:10B44000000000008F4203C000E0302124420001D0
2886:10B45000AF4203C0100000408F4203C08F4203C4BC
2887:10B4600024420001AF4203C48C8600008F42014891
2888:10B470008F4303C400E618230043102B1040000440
2889:10B480002C62233F8F420148006218212C62233F27
2890:10B4900014400031000000008F42020C24420001E1
2891:10B4A000AF42020C8F42020C00E0302124820008DF
2892:10B4B000AF8200E410000028AF8200E88F4203C88A
2893:10B4C00024420001AF4203C88F4203C88C850000AC
2894:10B4D0008F42014800A718230043102B104000039F
2895:10B4E000000000008F420148006218218F42014C89
2896:10B4F0000043102B5440000A00A030218F42020C60
2897:10B5000024420001AF42020C8F42020C2482000848
2898:10B51000AF8200E48F8400E41488FFECAF8400E87D
2899:10B520001488000D27623000148200022482FFF884
2900:10B5300027623FF8944300063C02001F3442FFFF9D
2901:10B5400000C330210046102B104000030000000013
2902:10B550008F42014800C23023AF8600C88F8300C4E9
2903:10B560008F42014800C318230043102B10400003F2
2904:10B57000000000008F4201480062182110600005A1
2905:10B58000000000008F42014C0043102B5040000887
2906:10B590003C02FDFF8F8202203C0308FF3463FFFB67
2907:10B5A000004310243C0340001000003F00431025DE
2908:10B5B0008F4303CC3442FFFF0282A02424630001A6
2909:10B5C000AF4303CC100000398F4203CC0204102497
2910:10B5D0001040000E3C1102008F4203A824420001DB
2911:10B5E000AF4203A88F4203A88F8202203C0308FFCA
2912:10B5F0003463FFFF00431024004410250C003DAFCE
2913:10B60000AF82022010000029000000000211102467
2914:10B61000504000083C1104008F4203AC244200015A
2915:10B62000AF4203AC0C003DAF8F4203AC10000019D9
2916:10B6300000000000021110241040001C0000000057
2917:10B640008F83022424021402146200093C050008BE
2918:10B650003C040001248469F4AFA00010AFA00014E2
2919:10B660008F86022434A505000C002B3B00003821F6
2920:10B670008F4203B024420001AF4203B08F4203B0B7
2921:10B680008F82022002002021344200020C004E9CD6
2922:10B69000AF8202208F8202203C0308FF3463FFFF49
2923:10B6A0000043102400511025AF8202208FBF0020DC
2924:10B6B0008FB1001C8FB0001803E0000827BD0028E0
2925:10B6C00003E00008000000003C0200018C426DA86D
2926:10B6D00027BDFFB0AFBF0048AFBE0044AFB50040CC
2927:10B6E000AFB3003CAFB20038AFB100341040000F30
2928:10B6F000AFB000303C04000124846A003C0500081F
2929:10B70000AFA00010AFA000148F86022034A5060061
2930:10B71000240200013C010001AC206DA83C010001A5
2931:10B72000AC226D9C0C002B3B000038213C037FFFBA
2932:10B730008C0202683463FFFF3C04FDFF00431024C9
2933:10B74000AC0202688F4200043484FFFF30420002E2
2934:10B75000104000920284A0243C040600348420009F
2935:10B760008F420004000028212403FFFD0043102421
2936:10B77000AF420004AFA400208F5E001827AA00206B
2937:10B78000240200FF13C20002AFAA002C27C500014B
2938:10B790008C02022800A090211642000E001E38C024
2939:10B7A0008F42033C24420001AF42033C8F42033CE2
2940:10B7B0008C0202283C040001248469983C0500099D
2941:10B7C000AFA00014AFA200108FA600201000006DE3
2942:10B7D00034A5050000F710218FA300208FA40024BA
2943:10B7E000AC4304C0AC4404C48F8300548F82005423
2944:10B7F000247003E8020210232C4203E91040001BCE
2945:10B800000000982100E08821263504C08F4401788B
2946:10B810008F45017C02201821240A0004AFAA0010E1
2947:10B82000AFB200148F48000C0000102102F5302147
2948:10B83000AFA800188F48010C2407000800A3282196
2949:10B8400000A3482B008220210100F8090089202153
2950:10B8500054400006241300018F820054020210237A
2951:10B860002C4203E91440FFE900000000326200FFAF
2952:10B8700054400017AF5200188F4203782442000151
2953:10B88000AF4203788F4203788F8201208FAA002C69
2954:10B89000AFA200108F8201243C040001248469A41B
2955:10B8A0003C050009AFA200148D46000010000035D1
2956:10B8B00034A506008F42030824130001244200012E
2957:10B8C000AF4203088F4203081000001E326200FFDF
2958:10B8D0008F8300548F820054247003E802021023E7
2959:10B8E0002C4203E910400016000098213C1500206E
2960:10B8F000241100108F42000C8F4401608F450164B9
2961:10B900008F860120AFB10010AFB200140055102592
2962:10B91000AFA200188F42010C240700080040F8096C
2963:10B9200024C6001C1440FFE3000000008F82005476
2964:10B93000020210232C4203E91440FFEE0000000035
2965:10B94000326200FF14400011000000008F420378B3
2966:10B9500024420001AF4203788F4203788F82012096
2967:10B960008FAA002CAFA200108F8201243C0400019A
2968:10B97000248469AC3C050009AFA200148D46000088
2969:10B9800034A507000C002B3B03C038218F4202EC8A
2970:10B9900024420001AF4202EC8F4202EC8FBF00480C
2971:10B9A0008FBE00448FB500408FB3003C8FB200388B
2972:10B9B0008FB100348FB0003003E0000827BD005085
2973:10B9C0003C0200018C426DA827BDFFE01440000D31
2974:10B9D000AFBF00183C04000124846A0C3C05000839
2975:10B9E000AFA00010AFA000148F86022034A507007E
2976:10B9F000240200013C010001AC226DA80C002B3B8D
2977:10BA0000000038213C02000402C21024104000074C
2978:10BA1000000000008F8202203C0308FF3463FFFF18
2979:10BA20000043102434420008AF8202203C0500018C
2980:10BA30008CA56D982402000114A2000700002021AB
2981:10BA40000C00529B24050001AC02026C8C03026CBA
2982:10BA5000100000063C0200070C00529B0000202151
2983:10BA6000AC0202688C0302683C02000700621824E2
2984:10BA70003C0200025062000D3C0205F50043102B11
2985:10BA8000144000063C0200043C0200011062000960
2986:10BA90003C0200981000000B000000001462000936
2987:10BAA0003C023B9A100000043442CA00100000021D
2988:10BAB0003442E10034429680AF4201FC8F4201FCE7
2989:10BAC000AEE200648FBF001803E0000827BD00202D
2990:10BAD0000000000000000000000000000086102BA5
2991:10BAE000504000010087202300C410230002484377
2992:10BAF0000125102B1040001B00091040008240213E
2993:10BB00000088102B104000070000182194820000CC
2994:10BB100024840002006218210088102B1440FFFBCF
2995:10BB2000000000000060202100C7302300A910237E
2996:10BB30000002104000C2282100C5102B1040000751
2997:10BB40000000182194C2000024C6000200621821DF
2998:10BB500000C5102B1440FFFB000000001000000D7A
2999:10BB60000083202100051040008228210085102B31
3000:10BB70001040000700001821948200002484000275
3001:10BB8000006218210085102B1440FFFB000000000C
3002:10BB90000060202100041C023082FFFF006220218F
3003:10BBA00000041C023082FFFF0062202103E0000835
3004:10BBB0003082FFFF03E00008000000000080282121
3005:10BBC00030A200011040002B3C03001F3463FFFF34
3006:10BBD00024A200040062102B544000070065102BC3
3007:10BBE00090A2000190A4000390A3000090A5000281
3008:10BBF0001000002A00441021104000030000000043
3009:10BC00008F42014800A2282390A4000024A500012F
3010:10BC10000065102B10400003000000008F42014817
3011:10BC200000A2282390A2000024A500010002120017
3012:10BC3000008220210065102B10400003000000004E
3013:10BC40008F42014800A2282390A2000024A50001F1
3014:10BC5000008220210065102B10400003000000002E
3015:10BC60008F42014800A2282390A200001000002D5E
3016:10BC7000000212003463FFFF24A200040062102BB4
3017:10BC80005440000A0065102B90A2000090A400020E
3018:10BC900090A3000190A500030044102100021200AF
3019:10BCA00000651821100000200043202110400003EF
3020:10BCB000000000008F42014800A2282390A200004B
3021:10BCC00024A50001000222000065102B1040000393
3022:10BCD000000000008F42014800A2282390A200002B
3023:10BCE00024A50001008220210065102B10400003D4
3024:10BCF000000000008F42014800A2282390A200000B
3025:10BD000024A5000100021200008220210065102BF2
3026:10BD100010400003000000008F42014800A22823C9
3027:10BD200090A200000082202100041C023082FFFF4C
3028:10BD30000062202100041C023082FFFF00622021EB
3029:10BD400003E000083082FFFF000000008F82022025
3030:10BD500034420002AF8202203C0200028C428FF883
3031:10BD60003042400010400054240400018F82020041
3032:10BD700024067FFF8F830200304500022402FFFD6E
3033:10BD800000621824AF830200AF8402048F83005442
3034:10BD90008F82005410000002246300018F8200543F
3035:10BDA000006210232C4200021440FFFC000000003F
3036:10BDB0008F8202241444004D0004204000C4102B44
3037:10BDC0001040FFF1000000008F82020000451025A6
3038:10BDD000AF8202008F82022034428000AF820220B4
3039:10BDE0008F8300548F8200541000000224630001EE
3040:10BDF0008F820054006210232C4200021440FFFC8A
3041:10BE0000000000008F8202203C0300040043102445
3042:10BE10001440000F000000008F8202203C03FFFF4F
3043:10BE200034637FFF00431024AF8202208F830054CD
3044:10BE30008F82005410000002246300018F8200549E
3045:10BE4000006210232C4200021440FFFC000000009E
3046:10BE50008F8202203C030004004310241440000D94
3047:10BE6000000000008F82022034428000AF82022056
3048:10BE70008F8300548F82005410000002246300015D
3049:10BE80008F820054006210232C4200021440FFFCF9
3050:10BE9000000000008F8202203C03000400431024B5
3051:10BEA0001040001B000010218F830220240200019B
3052:10BEB000100000153C04F7008F8202203C04F700BC
3053:10BEC00000441025AF8202208F8202202403FFFD50
3054:10BED00000431024AF8202208F8202203C03030023
3055:10BEE000004310241440000300000000100000086C
3056:10BEF000000010218F82022034420002AF82022013
3057:10BF00008F8302202402000100641825AF830220E1
3058:10BF100003E0000800000000000020213C050100B3
3059:10BF200024020001AF80021CAF820200AF82022017
3060:10BF300027625000AF8200C027625000AF8200C469
3061:10BF400027625000AF8200C827625000AF8200D045
3062:10BF500027625000AF8200D427625000AF8200D821
3063:10BF600027623000AF8200E027623000AF8200E439
3064:10BF700027623000AF8200E827622800AF8200F01D
3065:10BF800027622800AF8200F427622800AF8200F801
3066:10BF9000000418C02484000103631021AC45300460
3067:10BFA00003631021AC403000288202001440FFF9E6
3068:10BFB000000418C000002021000418C024840001DF
3069:10BFC00003631021AC40280403631021AC40280017
3070:10BFD000288201001440FFF9000418C0AF80023C21
3071:10BFE0002403008024040100AC60000024630004EA
3072:10BFF0000064102B5440FFFDAC6000008F830040B4
3073:10C000003C02F000006218243C0250001062000C58
3074:10C010000043102B144000063C0260003C0240002C
3075:10C020001062000824020800100000080000000050
3076:10C030001062000424020800100000040000000048
3077:10C04000240207003C010001AC226DAC03E00008B3
3078:10C05000000000003C0200018C426DBC27BDFFD0F7
3079:10C06000AFBF002CAFB20028AFB10024AFB00020AA
3080:10C070003C01000110400005AC206D940C004D9E69
3081:10C08000000000003C010001AC206DBC8F83005417
3082:10C090008F82005410000002246300648F820054D9
3083:10C0A000006210232C4200651440FFFC00000000D9
3084:10C0B0000C004DB9000000002404000100002821FC
3085:10C0C00027A60018340280000C0045BEA7A2001865
3086:10C0D0008F8300548F820054100000022463006498
3087:10C0E0008F820054006210232C4200651440FFFC34
3088:10C0F00024040001240500010C00457C27A600183B
3089:10C100008F8300548F820054100000022463006467
3090:10C110008F820054006210232C4200651440FFFC03
3091:10C1200024040001240500010C00457C27A600180A
3092:10C130008F8300548F820054100000022463006437
3093:10C140008F820054006210232C4200651440FFFCD3
3094:10C15000240400013C06000124C66F240C00457C29
3095:10C16000240500028F8300548F82005410000002C7
3096:10C17000246300648F820054006210232C42006507
3097:10C180001440FFFC24040001240500033C100001BE
3098:10C1900026106F260C00457C0200302197A600185F
3099:10C1A0003C07000194E76F243C04000124846AE00A
3100:10C1B000AFA00014960200003C05000D34A501005C
3101:10C1C0000C002B3BAFA2001097A200181040004DAE
3102:10C1D00024036040960200003042FFF01443000C3C
3103:10C1E000240200203C03000194636F241462000BBE
3104:10C1F00024027830240200033C010001AC226D943B
3105:10C20000240200053C0100011000003FAC226F3405
3106:10C210003C03000194636F24240278301462000C04
3107:10C22000240300103C02000194426F263042FFF0CC
3108:10C2300014430007240200033C010001AC226D946A
3109:10C24000240200063C0100011000002FAC226F34D4
3110:10C250003C0200018C426D943C03000194636F2406
3111:10C26000344200013C010001AC226D94240200150F
3112:10C270001462000B000000003C02000194426F2693
3113:10C280003042FFF03843F4202C6300013842F43090
3114:10C290002C420001006218251460001B24020003D8
3115:10C2A0003C03000194636F2424027810146200168A
3116:10C2B000240200023C02000194426F263042FFF04B
3117:10C2C00014400011240200021000000F2402000498
3118:10C2D0003C0200018C426D94344200083C01000194
3119:10C2E000AC226D941000005E240200043C020001A8
3120:10C2F0008C426D94344200043C010001100000AFF8
3121:10C30000AC226D94240200013C010001AC226F407C
3122:10C310003C0200018C426D9430420002144000B295
3123:10C320003C09FFF024020E00AF8202388F840054D3
3124:10C330008F820054240300083C010001AC236D9857
3125:10C3400010000002248401F48F8200540082102324
3126:10C350002C4201F51440FFFC3C0200C8344201FBB2
3127:10C36000AF8202388F8300548F8200541000000285
3128:10C37000246301F48F820054006210232C4201F5E3
3129:10C380001440FFFC00008021241200012411000948
3130:10C390000C004482000000003C010001AC326DB48E
3131:10C3A0000C004547000000003C0200018C426DB4C7
3132:10C3B0001451FFFB3C0200C8344201F6AF82023840
3133:10C3C0008F8300548F820054100000022463000AFF
3134:10C3D0008F820054006210232C42000B1440FFFC9B
3135:10C3E000000000008F820220240400013442000279
3136:10C3F000AF8202208F83020024057FFF2402FFFD0D
3137:10C4000000621824AF830200AF8402048F830054BB
3138:10C410008F82005410000002246300018F820054B8
3139:10C42000006210232C4200021440FFFC00000000B8
3140:10C430008F8202241444000534028000000420404E
3141:10C4400000A4102B1040FFF0340280001082FFA0E7
3142:10C45000261000012E0200141440FFCD2402000417
3143:10C460003C010001AC226D980000802124120009DB
3144:10C470003C11FFFF36313F7F0C004482000000007A
3145:10C48000240200013C010001AC226DB40C004547C0
3146:10C49000000000003C0200018C426DB41452FFFB0E
3147:10C4A000000000008F82004400511024344250806C
3148:10C4B000AF8200448F8300548F820054100000022A
3149:10C4C0002463000A8F820054006210232C42000B68
3150:10C4D0001440FFFC000000008F8200440051102433
3151:10C4E0003442F080AF8200448F8300548F82005426
3152:10C4F000100000022463000A8F820054006210239F
3153:10C500002C42000B1440FFFC000000008F82022030
3154:10C510003C03F70000431025AF8202208F830054B4
3155:10C520008F82005410000002246300648F82005444
3156:10C53000006210232C4200651440FFFC0000000044
3157:10C540008F8202202404000134420002AF820220C4
3158:10C550008F83020024057FFF2402FFFD0062182460
3159:10C56000AF830200AF8402048F8300548F82005493
3160:10C5700010000002246300018F8200540062102327
3161:10C580002C4200021440FFFC000000008F820224B5
3162:10C5900014440005340280000004204000A4102B45
3163:10C5A0001040FFF0340280001082FF50261000017E
3164:10C5B0002E0200641440FFB0000000003C020001A5
3165:10C5C0008C426D9430420004144000073C09FFF097
3166:10C5D0008F8200443C03FFFF34633F7F00431024FD
3167:10C5E000AF8200443C09FFF03529BDC03C06000184
3168:10C5F0008CC66D943C04000124846AE0240200018E
3169:10C600003C010001AC226D9C8F8200543C0700016C
3170:10C610008CE76F403C03000194636F243C080001E9
3171:10C6200095086F263C05000D34A501003C01000172
3172:10C63000AC206D98004910213C010001AC226F3004
3173:10C64000AFA300100C002B3BAFA800148FBF002C31
3174:10C650008FB200288FB100248FB0002003E00008C3
3175:10C6600027BD003027BDFFE83C0500018CA56D9873
3176:10C67000240600042402000114A20014AFBF00101D
3177:10C680003C0200028C428FFC3042800010400005CA
3178:10C690003C04000F3C0300018C636F401000000558
3179:10C6A000348442403C0400043C0300018C636F402E
3180:10C6B000348493E024020005146200160000000098
3181:10C6C0003C04003D10000013348409003C020002C9
3182:10C6D0008C428FF830428000104000053C04001E60
3183:10C6E0003C0300018C636F4010000005348484809B
3184:10C6F0003C04000F3C0300018C636F4034844240D3
3185:10C700002402000514620003000000003C04007ACB
3186:10C71000348412003C0200018C426F308F8300543D
3187:10C7200000441021004310230044102B1440004CFF
3188:10C73000000000003C0200018C426DA01440004843
3189:10C74000000000003C01000110C00025AC206DB0CD
3190:10C750003C0900018D296D94240700013C04400030
3191:10C760003C08000225088FFC250AFFFC0005284232
3192:10C7700014A0000224C6FFFF2405000800A910240D
3193:10C78000104000100000000014A700080000000086
3194:10C790008D020000004410241040000A0000000038
3195:10C7A0003C01000110000007AC256DB08D42000077
3196:10C7B0000044102410400003000000003C01000170
3197:10C7C000AC276DB03C0200018C426DB00006182B06
3198:10C7D0002C420001004310245440FFE5000528428C
3199:10C7E0008F8200543C0300018C636DB03C0100015A
3200:10C7F000AC226F301060003B240200053C030001B6
3201:10C800008C636F403C010001AC256D9814620012EE
3202:10C81000240200013C0200028C428FF83C032000FD
3203:10C820003463500000431024144000062402000129
3204:10C830003C010001AC206F1C3C010001AC226D9852
3205:10C84000240200013C010001AC226E243C010001E5
3206:10C85000AC226DA4240200013C010001AC226D9CBD
3207:10C860003C0200018C426DB01040001E0000000030
3208:10C870003C0200018C426D9C104000082402000123
3209:10C880003C010001AC206D9CAEE204B83C0100010B
3210:10C89000AC206E1C3C010001AC226DD48EE304B8C8
3211:10C8A0002402000810620005240200010C00423935
3212:10C8B000000000001000000B000000003C0300011D
3213:10C8C0008C636D98106200072402000E3C03000286
3214:10C8D0008C638F9010620003000000000C004E9CDF
3215:10C8E0008F8402208FBF001003E0000827BD0018CE
3216:10C8F00027BDFFE03C03FDFF3C0400018C846D98E4
3217:10C900003C0200018C426DC03463FFFF0283A0240F
3218:10C9100014820006AFBF00188EE304B83C02000189
3219:10C920008C426DC410620006000000008EE204B864
3220:10C930003C010001AC246DC03C010001AC226DC47F
3221:10C940003C0300018C636D98240200021062019C7C
3222:10C950002C62000310400005240200011062000A4E
3223:10C960000000000010000226000000002402000465
3224:10C97000106200B6240200081062010A24020001BD
3225:10C980001000021F000000008EE204B82443FFFFE5
3226:10C990002C6200081040021C000310803C010001C2
3227:10C9A000002208218C226AF80040000800000000E4
3228:10C9B0003C0300018C636F402402000514620010E8
3229:10C9C000000000003C0200018C426DA410400008F1
3230:10C9D000240200030C004482000000002402000234
3231:10C9E000AEE204B83C01000110000002AC206DA4CE
3232:10C9F000AEE204B83C01000110000203AC206D302F
3233:10CA00000C004482000000003C0200018C426DA436
3234:10CA10003C010001AC206D301440017A2402000278
3235:10CA20001000019D240200073C0300018C636F404D
3236:10CA30002402000514620003240200013C010001ED
3237:10CA4000AC226DD00C0045FF000000003C0300014B
3238:10CA50008C636DD010000174240200113C050001AC
3239:10CA60008CA56D983C0600028CC68FFC0C0051040E
3240:10CA700000002021240200053C010001AC206DA42F
3241:10CA8000100001E1AEE204B83C04000124846AEC29
3242:10CA90003C05000F34A501000000302100003821C2
3243:10CAA000AFA000100C002B3BAFA00014100001D66B
3244:10CAB000000000008F8202203C0300040043102489
3245:10CAC00014400175240200078F8300543C020001CA
3246:10CAD0008C426F282463D8F0004310232C42271087
3247:10CAE00014400003240200013C010001AC226D9CB3
3248:10CAF0003C0200028C428FFC30425000104001C2C8
3249:10CB0000000000008F820220304280001040017D32
3250:10CB10000000000010000175000000003C0500014D
3251:10CB20008CA56D980C00529B000020210C00551B19
3252:10CB3000000020213C0300028C638FF4046101B0EB
3253:10CB4000240200013C02000800621024104000068C
3254:10CB5000000000008F8202143C03FFFF00431024FA
3255:10CB6000100000053442251F8F8202143C03FFFF92
3256:10CB7000004310243442241FAF8202148F8202200B
3257:10CB80003C03020034420002AF820220240200086B
3258:10CB9000AEE204B88F8202200283A0253C03000489
3259:10CBA0000043102414400016000000003C02000264
3260:10CBB0008C428FFC304250001040000D00000000FD
3261:10CBC0008F820220304280001040000600000000EA
3262:10CBD0008F8202203C03FFFF34637FFF10000003BD
3263:10CBE000004310248F82022034428000AF82022052
3264:10CBF0008F8202203C03F70000431025AF82022001
3265:10CC00003C0300018C636F40240200051462000A9B
3266:10CC1000000000003C02000194426F2624429FBCA9
3267:10CC20002C420004104000042404001824050002D3
3268:10CC30000C004DDB240600200C003E6D00000000BF
3269:10CC40003C01000110000170AC206E208EE204B89F
3270:10CC50002443FFFF2C6200081040016B000310808A
3271:10CC60003C010001002208218C226B1800400008C2
3272:10CC7000000000000C004547000000003C030001DC
3273:10CC80008C636DB4100000E8240200093C0200022D
3274:10CC90008C428FF830424000104000040000000039
3275:10CCA0008F820044100000063442F0808F820044DE
3276:10CCB0003C03FFFF34633F7F004310243442A080D5
3277:10CCC000AF8200448F830054100000EA2402000465
3278:10CCD0008F8300543C0200018C426F282463D8F0FB
3279:10CCE000004310232C422710144001472402000562
3280:10CCF000100000D8000000008F8202203C03F700E3
3281:10CD000000431025AF820220AF8002043C010002E4
3282:10CD1000100000D6AC208FE08F8300543C0200014D
3283:10CD20008C426F282463FFF6004310232C42000A34
3284:10CD30001440013524020007100000D70000000055
3285:10CD40000C003F50000000001040012D24020001A3
3286:10CD50008F8202143C03FFFF3C0400018C846F1C93
3287:10CD6000004310243442251FAF820214240200081D
3288:10CD700010800005AEE204B83C0200018C426E4413
3289:10CD800010400064240200018F8202203C0300084E
3290:10CD9000004310241040006A3C020200100000789A
3291:10CDA000000000008EE204B82443FFFF2C6200075D
3292:10CDB00010400115000310803C01000100220821F1
3293:10CDC0008C226B3800400008000000000C003DAFD2
3294:10CDD000000000003C010001AC206D9CAF8002040B
3295:10CDE0003C0100020C004482AC208FE024020001D0
3296:10CDF0003C010001AC226DB42402000210000102CB
3297:10CE0000AEE204B80C004547000000003C030001FE
3298:10CE10008C636DB410000084240200093C020002FF
3299:10CE20008C428FF830424000104000033C0200C8A2
3300:10CE300010000002344201F6344201FEAF82023893
3301:10CE40008F8300541000008B240200048F83005451
3302:10CE50003C0200018C426F282463D8F00043102369
3303:10CE60002C422710144000E824020005100000792D
3304:10CE7000000000008F8202203C03F70000431025D1
3305:10CE8000AF820220AF8002043C0100021000007754
3306:10CE9000AC208FE08F8300543C0200018C426F284D
3307:10CEA0002463FFF6004310232C42000A144000D6EE
3308:10CEB0002402000710000078000000000C003F5022
3309:10CEC00000000000104000CE240200018F820214F6
3310:10CED0003C03FFFF3C0400018C846F1C00431024C2
3311:10CEE0003442251FAF820214240200081080000F74
3312:10CEF000AEE204B83C0200018C426E441440000BC8
3313:10CF0000000000008F82022034420002AF82022023
3314:10CF1000240200013C010002AC228F900C004E9CC8
3315:10CF20008F84022010000016000000008F82022073
3316:10CF30003C03000800431024144000113C0202008E
3317:10CF40000282A0252402000E3C010002AC228F9038
3318:10CF50000C00551B000020218F8202203442000269
3319:10CF60000C003E6DAF8202203C0500018CA56D983F
3320:10CF70000C00529B00002021100000A300000000C4
3321:10CF80003C0200018C426E441040009F00000000F3
3322:10CF90003C0200018C426E402442FFFF3C01000134
3323:10CFA000AC226E4014400098240200023C010001B3
3324:10CFB000AC206E443C01000110000093AC226E4096
3325:10CFC0008EE204B82443FFFF2C6200071040008E5D
3326:10CFD000000310803C010001002208218C226B58C4
3327:10CFE00000400008000000003C0200018C426DA4DB
3328:10CFF00010400018240200050C00448200000000CC
3329:10D0000024020002AEE204B83C0100011000007EE0
3330:10D01000AC206DA40C004963000000003C0300013B
3331:10D020008C636DD42402000614620077240200038E
3332:10D0300010000075AEE204B83C0500018CA56D98A7
3333:10D040003C0600028CC68FF80C0051040000202121
3334:10D05000240200051000006CAEE204B88F820220AA
3335:10D060003C03F70000431025AF8202208F83005459
3336:10D0700024020006AEE204B83C0100011000006288
3337:10D08000AC236F288F8202203C030004004310244D
3338:10D0900010400003240200071000005BAEE204B859
3339:10D0A0008F8300543C0200018C426F282463D8F027
3340:10D0B000004310232C4227101440000324020001D7
3341:10D0C0003C010001AC226D9C3C0200028C428FF8B6
3342:10D0D000304250001040004C000000008F820220BF
3343:10D0E0003042800010400007000000008F820220C4
3344:10D0F0003C03FFFF34637FFF004310241000004215
3345:10D10000AF8202208F820220344280001000003E55
3346:10D11000AF8202203C0500018CA56D980C00529B4B
3347:10D12000000020210C00551B000020213C020002C1
3348:10D130008C428FF004410032240200018F820214DD
3349:10D140003C03FFFF004310243442251FAF8202142A
3350:10D1500024020008AEE204B88F82022034420002AA
3351:10D16000AF8202208F8202203C030004004310247F
3352:10D1700014400016000000003C0200028C428FF8B0
3353:10D18000304250001040000D000000008F8202204D
3354:10D190003042800010400006000000008F82022014
3355:10D1A0003C03FFFF34637FFF1000000300431024A3
3356:10D1B0008F82022034428000AF8202208F820220C0
3357:10D1C0003C03F70000431025AF8202203C0200011F
3358:10D1D00094426F2624429FBC2C420004104000045D
3359:10D1E00024040018240500020C004DDB2406002056
3360:10D1F0000C003E6D00000000100000030000000065
3361:10D200003C010001AC226D9C8FBF001803E00008B8
3362:10D2100027BD00208F8202008F8202208F82022091
3363:10D2200034420004AF8202208F8202003C050001DC
3364:10D230008CA56D9834420004AF82020024020002E3
3365:10D2400010A2004B2CA20003104000052402000194
3366:10D2500010A2000A00000000100000B10000000051
3367:10D260002402000410A200722402000810A200850B
3368:10D270003C02F0FF100000AA000000008F83005065
3369:10D280003C02F0FF3442FFFF3C0400018C846F40FD
3370:10D29000006218243C0207000062182524020E00D8
3371:10D2A0002484FFFB2C840002AF830050AF85020072
3372:10D2B000AF85022014800006AF8202388F820044BE
3373:10D2C0003C03FFFF34633F7F00431024AF820044E0
3374:10D2D0003C0300018C636F402402000514620004CB
3375:10D2E000000000008F82004434425000AF820044AE
3376:10D2F0003C0200018C426D883C0300018C636F404E
3377:10D30000344200222463FFFC2C6300021460000CF2
3378:10D31000AF8202003C0200018C426DAC3C03000174
3379:10D320008C636D903C0400018C846D8C34428000D1
3380:10D3300000621825006418251000000A34620002FB
3381:10D340003C0200018C426D903C0300018C636DAC8B
3382:10D350003C0400018C846D8C004310250044102592
3383:10D3600034420002AF8202201000002F240200018C
3384:10D3700024020E01AF8202388F8300503C02F0FF7E
3385:10D380003442FFFF3C0400018C846F1C00621824AF
3386:10D390003C020D000062182524020001AF830050FA
3387:10D3A000AF820200AF820220108000053C033F00E4
3388:10D3B0003C0200018C426D80100000043463007058
3389:10D3C0003C0200018C426D803463007200431025E2
3390:10D3D000AF8202003C0300018C636D843C02F700C5
3391:10D3E000006218253C0200018C426D903C04000153
3392:10D3F0008C846DAC3C0500018CA56F40004310256A
3393:10D4000000441025AF8202202402000514A2000669
3394:10D41000240200018F8200442403AFFF0043102444
3395:10D42000AF820044240200011000003DAF820238A8
3396:10D430008F8300503C02F0FF3442FFFF3C040001A8
3397:10D440008C846F1C006218243C020A0000621825BC
3398:10D4500024020001AF830050AF8202001080001E42
3399:10D46000AF8202203C0200018C426E441440001A3C
3400:10D470003C033F003C0200018C426D801000001A0A
3401:10D48000346300E08F8300503C0400018C846F1CE7
3402:10D490003442FFFF006218241080000FAF83005059
3403:10D4A0003C0200018C426E441440000B3C043F00DF
3404:10D4B0003C0300018C636D80348400E02402000191
3405:10D4C000AF820200AF82022000641825AF83020001
3406:10D4D000100000083C05F7003C0200018C426D8002
3407:10D4E0003C033F00346300E200431025AF8202009A
3408:10D4F0003C05F70034A580003C0300018C636D847B
3409:10D500003C0200018C426D903C0400018C846DACA7
3410:10D51000006518250043102500441025AF82022025
3411:10D5200003E00008000000003C0300018C636DB4C0
3412:10D530003C0200018C426DB810620003240200021C
3413:10D540003C010001AC236DB81062001D2C62000389
3414:10D55000104000252402000114620023240200046C
3415:10D560003C0300018C636D981062000624020008E1
3416:10D570001462000C3C0200C8344201FB1000000998
3417:10D58000AF82023824020E01AF8202388F8200443B
3418:10D590003C03FFFF34633F7F00431024344200808C
3419:10D5A000AF8200448F830054240200023C0100013A
3420:10D5B000AC226DB43C0100011000000BAC236F2CB9
3421:10D5C0008F8300543C0200018C426F2C2463D8F0FE
3422:10D5D000004310232C4227101440000324020009AA
3423:10D5E0003C010001AC226DB403E000080000000023
3424:10D5F00000000000000000000000000027BDFFD870
3425:10D60000AFB2001800809021AFB3001C00A0982199
3426:10D61000AFB1001400C08821AFB00010000080211D
3427:10D62000AFBF0020A62000000C004D7824040001AC
3428:10D63000261000012E0200201440FFFB0000000015
3429:10D640000C004D78000020210C004D7824040001CE
3430:10D650000C004D78240400010C004D7800002021BE
3431:10D66000241000100250102410400002000020215D
3432:10D67000240400010C004D78001080421600FFFACF
3433:10D6800002501024241000100270102410400002D8
3434:10D6900000002021240400010C004D78001080427D
3435:10D6A0001600FFFA027010240C004DB934108000EF
3436:10D6B0000C004DB9000000000C004D5800000000A7
3437:10D6C00050400005001080429622000000501025B6
3438:10D6D000A6220000001080421600FFF700000000A4
3439:10D6E0000C004DB9000000008FBF00208FB3001C5C
3440:10D6F0008FB200188FB100148FB0001003E0000843
3441:10D7000027BD002827BDFFD8AFB1001400808821B5
3442:10D71000AFB2001800A09021AFB3001C00C0982148
3443:10D72000AFB0001000008021AFBF00200C004D788A
3444:10D7300024040001261000012E0200201440FFFBEB
3445:10D74000000000000C004D78000020210C004D78F6
3446:10D75000240400010C004D78000020210C004D78BD
3447:10D760002404000124100010023010241040000294
3448:10D7700000002021240400010C004D78001080429C
3449:10D780001600FFFA0230102424100010025010245A
3450:10D790001040000200002021240400010C004D78FC
3451:10D7A000001080421600FFFA025010240C004D7841
3452:10D7B000240400010C004D7800002021341080006A
3453:10D7C000966200000050102410400002000020214A
3454:10D7D000240400010C004D78001080421600FFF870
3455:10D7E000000000000C004DB9000000008FBF0020B9
3456:10D7F0008FB3001C8FB200188FB100148FB00010CF
3457:10D8000003E0000827BD00283C0400018C846DD093
3458:10D810003C0200018C426E1827BDFFD8AFBF00202C
3459:10D82000AFB1001C10820003AFB000183C01000132
3460:10D83000AC246E183C0300018C636F402402000589
3461:10D84000146200052483FFFF0C0049630000000000
3462:10D850001000034C000000002C620013104003492C
3463:10D86000000310803C010001002208218C226B8003
3464:10D8700000400008000000000C004DB900008021AD
3465:10D8800034028000A7A2001027B100100C004D78D0
3466:10D8900024040001261000012E0200201440FFFB8A
3467:10D8A000000000000C004D78000020210C004D7895
3468:10D8B000240400010C004D78000020210C004D785C
3469:10D8C0002404000124100010320200011040000264
3470:10D8D00000002021240400010C004D78001080423B
3471:10D8E0001600FFFA32020001241000100C004D78DF
3472:10D8F00000002021001080421600FFFC0000000004
3473:10D900000C004D78240400010C004D78000020210B
3474:10D9100034108000962200000050102410400002B5
3475:10D9200000002021240400010C004D7800108042EA
3476:10D930001600FFF8000000000C004DB900000000C8
3477:10D940001000030E2402000227B10010A7A000104F
3478:10D95000000080210C004D782404000126100001F5
3479:10D960002E0200201440FFFB000000000C004D7848
3480:10D97000000020210C004D78240400010C004D789B
3481:10D98000240400010C004D78000020212410001018
3482:10D990003202000110400002000020212404000196
3483:10D9A0000C004D78001080421600FFFA3202000190
3484:10D9B000241000100C004D7800002021001080423F
3485:10D9C0001600FFFC000000000C004DB93410800070
3486:10D9D0000C004DB9000000000C004D580000000084
3487:10D9E0005040000500108042962200000050102593
3488:10D9F000A6220000001080421600FFF70000000081
3489:10DA00000C004DB90000000097A2001030428000C9
3490:10DA1000144002DC24020003100002D800000000C1
3491:10DA200024021200A7A2001027B1001000008021DC
3492:10DA30000C004D7824040001261000012E02002065
3493:10DA40001440FFFB000000000C004D780000202176
3494:10DA50000C004D78240400010C004D7800002021BA
3495:10DA60000C004D7824040001241000103202000143
3496:10DA70001040000200002021240400010C004D7819
3497:10DA8000001080421600FFFA32020001241000103C
3498:10DA90000C004D7800002021001080421600FFFC91
3499:10DAA000000000000C004D78240400010C004D78AB
3500:10DAB0000000202134108000962200000050102425
3501:10DAC0001040000200002021240400010C004D78C9
3502:10DAD000001080421600FFF8000000000C004DB955
3503:10DAE000000000008F8300541000029624020004FE
3504:10DAF0008F8300543C0200018C426F3C2463FF9CE6
3505:10DB0000004310232C4200641440029E24020002B1
3506:10DB10003C0300018C636F40106202972C6200038B
3507:10DB20001440029624020011240200031062000532
3508:10DB300024020004106202912402000F1000028FE0
3509:10DB4000240200111000028D24020005240200149A
3510:10DB5000A7A2001027B10010000080210C004D7812
3511:10DB600024040001261000012E0200201440FFFBB7
3512:10DB7000000000000C004D78000020210C004D78C2
3513:10DB8000240400010C004D78000020210C004D7889
3514:10DB90002404000124100010320200011040000291
3515:10DBA00000002021240400010C004D780010804268
3516:10DBB0001600FFFA32020001241000103202001297
3517:10DBC0001040000200002021240400010C004D78C8
3518:10DBD000001080421600FFFA320200120C004D784D
3519:10DBE000240400010C004D78000020213410800036
3520:10DBF0009622000000501024104000020000202156
3521:10DC0000240400010C004D78001080421600FFF83B
3522:10DC1000000000000C004DB9000000008F8300548C
3523:10DC200010000248240200068F8300543C020001C9
3524:10DC30008C426F3C2463FF9C004310232C42006401
3525:10DC400014400250240200071000024C00000000A3
3526:10DC500024020006A7A2001027B1001000008021B6
3527:10DC60000C004D7824040001261000012E02002033
3528:10DC70001440FFFB000000000C004D780000202144
3529:10DC80000C004D78240400010C004D780000202188
3530:10DC90000C004D7824040001241000103202000111
3531:10DCA0001040000200002021240400010C004D78E7
3532:10DCB000001080421600FFFA32020001241000100A
3533:10DCC0003202001310400002000020212404000151
3534:10DCD0000C004D78001080421600FFFA320200134B
3535:10DCE0000C004D78240400010C004D780000202128
3536:10DCF00034108000962200000050102410400002D2
3537:10DD000000002021240400010C004D780010804206
3538:10DD10001600FFF8000000000C004DB900000000E4
3539:10DD20008F83005410000207240200088F830054E0
3540:10DD30003C0200018C426F3C2463FF9C0043102393
3541:10DD40002C4200641440020F240200091000020B50
3542:10DD50000000000027B10010A7A0001000008021E3
3543:10DD60000C004D7824040001261000012E02002032
3544:10DD70001440FFFB000000000C004D780000202143
3545:10DD80000C004D78240400010C004D78240400019F
3546:10DD90000C004D78000020212410001032020001F8
3547:10DDA0001040000200002021240400010C004D78E6
3548:10DDB000001080421600FFFA320200012410001009
3549:10DDC000320200181040000200002021240400014B
3550:10DDD0000C004D78001080421600FFFA3202001845
3551:10DDE0000C004DB9341080000C004DB9000000004B
3552:10DDF0000C004D580000000050400005001080420B
3553:10DE00009622000000501025A6220000001080423B
3554:10DE10001600FFF7000000000C004DB90000802143
3555:10DE200097A2001027B1001034420001A7A20010F1
3556:10DE30000C004D7824040001261000012E02002061
3557:10DE40001440FFFB000000000C004D780000202172
3558:10DE50000C004D78240400010C004D7800002021B6
3559:10DE60000C004D782404000124100010320200013F
3560:10DE70001040000200002021240400010C004D7815
3561:10DE8000001080421600FFFA320200012410001038
3562:10DE9000320200181040000200002021240400017A
3563:10DEA0000C004D78001080421600FFFA3202001874
3564:10DEB0000C004D78240400010C004D780000202156
3565:10DEC0003410800096220000005010241040000200
3566:10DED00000002021240400010C004D780010804235
3567:10DEE0001600FFF8000000000C004DB90000000013
3568:10DEF0008F830054100001932402000A8F83005482
3569:10DF00003C0200018C426F3C2463FF9C00431023C1
3570:10DF10002C4200641440019B2402000B1000019766
3571:10DF20000000000027B10010A7A000100000802111
3572:10DF30000C004D7824040001261000012E02002060
3573:10DF40001440FFFB000000000C004D780000202171
3574:10DF50000C004D78240400010C004D7824040001CD
3575:10DF60000C004D7800002021241000103202000126
3576:10DF70001040000200002021240400010C004D7814
3577:10DF8000001080421600FFFA320200012410001037
3578:10DF9000320200171040000200002021240400017A
3579:10DFA0000C004D78001080421600FFFA3202001774
3580:10DFB0000C004DB9341080000C004DB90000000079
3581:10DFC0000C004D5800000000504000050010804239
3582:10DFD0009622000000501025A6220000001080426A
3583:10DFE0001600FFF7000000000C004DB90000802172
3584:10DFF00097A2001027B1001034420700A7A200101A
3585:10E000000C004D7824040001261000012E0200208F
3586:10E010001440FFFB000000000C004D7800002021A0
3587:10E020000C004D78240400010C004D7800002021E4
3588:10E030000C004D782404000124100010320200016D
3589:10E040001040000200002021240400010C004D7843
3590:10E05000001080421600FFFA320200012410001066
3591:10E0600032020017104000020000202124040001A9
3592:10E070000C004D78001080421600FFFA32020017A3
3593:10E080000C004D78240400010C004D780000202184
3594:10E09000341080009622000000501024104000022E
3595:10E0A00000002021240400010C004D780010804263
3596:10E0B0001600FFF8000000000C004DB90000000041
3597:10E0C0008F8300541000011F2402000C8F83005422
3598:10E0D0003C0200018C426F3C2463FF9C00431023F0
3599:10E0E0002C42006414400127240200121000012376
3600:10E0F0000000000027B10010A7A000100000802140
3601:10E100000C004D7824040001261000012E0200208E
3602:10E110001440FFFB000000000C004D78000020219F
3603:10E120000C004D78240400010C004D7824040001FB
3604:10E130000C004D7800002021241000103202000154
3605:10E140001040000200002021240400010C004D7842
3606:10E15000001080421600FFFA320200012410001065
3607:10E1600032020014104000020000202124040001AB
3608:10E170000C004D78001080421600FFFA32020014A5
3609:10E180000C004DB9341080000C004DB900000000A7
3610:10E190000C004D5800000000504000050010804267
3611:10E1A0009622000000501025A62200000010804298
3612:10E1B0001600FFF7000000000C004DB900008021A0
3613:10E1C00097A2001027B1001034420010A7A200103F
3614:10E1D0000C004D7824040001261000012E020020BE
3615:10E1E0001440FFFB000000000C004D7800002021CF
3616:10E1F0000C004D78240400010C004D780000202113
3617:10E200000C004D782404000124100010320200019B
3618:10E210001040000200002021240400010C004D7871
3619:10E22000001080421600FFFA320200012410001094
3620:10E2300032020014104000020000202124040001DA
3621:10E240000C004D78001080421600FFFA32020014D4
3622:10E250000C004D78240400010C004D7800002021B2
3623:10E26000341080009622000000501024104000025C
3624:10E2700000002021240400010C004D780010804291
3625:10E280001600FFF8000000000C004DB9000000006F
3626:10E290008F830054100000AB240200138F830054BE
3627:10E2A0003C0200018C426F3C2463FF9C004310231E
3628:10E2B0002C420064144000B32402000D100000AF93
3629:10E2C0000000000027B10010A7A00010000080216E
3630:10E2D0000C004D7824040001261000012E020020BD
3631:10E2E0001440FFFB000000000C004D7800002021CE
3632:10E2F0000C004D78240400010C004D78240400012A
3633:10E300000C004D7800002021241000103202000182
3634:10E310001040000200002021240400010C004D7870
3635:10E32000001080421600FFFA320200012410001093
3636:10E3300032020018104000020000202124040001D5
3637:10E340000C004D78001080421600FFFA32020018CF
3638:10E350000C004DB9341080000C004DB900000000D5
3639:10E360000C004D5800000000504000050010804295
3640:10E370009622000000501025A622000000108042C6
3641:10E380001600FFF7000000000C004DB900008021CE
3642:10E3900097A2001027B100103042FFFEA7A2001084
3643:10E3A0000C004D7824040001261000012E020020EC
3644:10E3B0001440FFFB000000000C004D7800002021FD
3645:10E3C0000C004D78240400010C004D780000202141
3646:10E3D0000C004D78240400012410001032020001CA
3647:10E3E0001040000200002021240400010C004D78A0
3648:10E3F000001080421600FFFA3202000124100010C3
3649:10E400003202001810400002000020212404000104
3650:10E410000C004D78001080421600FFFA32020018FE
3651:10E420000C004D78240400010C004D7800002021E0
3652:10E43000341080009622000000501024104000028A
3653:10E4400000002021240400010C004D7800108042BF
3654:10E450001600FFF8000000000C004DB9000000009D
3655:10E460008F830054100000372402000E240208405D
3656:10E47000A7A2001027B10010000080210C004D78E9
3657:10E4800024040001261000012E0200201440FFFB8E
3658:10E49000000000000C004D78000020210C004D7899
3659:10E4A000240400010C004D78000020210C004D7860
3660:10E4B0002404000124100010320200011040000268
3661:10E4C00000002021240400010C004D78001080423F
3662:10E4D0001600FFFA3202000124100010320200136D
3663:10E4E0001040000200002021240400010C004D789F
3664:10E4F000001080421600FFFA320200130C004D7823
3665:10E50000240400010C004D7800002021341080000C
3666:10E51000962200000050102410400002000020212C
3667:10E52000240400010C004D78001080421600FFF812
3668:10E53000000000000C004DB9000000008F83005463
3669:10E54000240200103C010001AC226DD03C0100010E
3670:10E550001000000CAC236F3C8F8300543C02000180
3671:10E560008C426F3C2463FF9C004310232C420064C8
3672:10E570001440000400000000240200113C010001CE
3673:10E58000AC226DD08FBF00208FB1001C8FB000185F
3674:10E5900003E0000827BD00283C0300018C636D9850
3675:10E5A00027BDFFC824020002AFBF0034AFB2003065
3676:10E5B000AFB1002C14620004AFB000283C1200027E
3677:10E5C000100000038E528FF83C1200028E528FFC16
3678:10E5D0003C0300018C636DD43C0200018C426E1C34
3679:10E5E000506200042463FFFF3C010001AC236E1C59
3680:10E5F0002463FFFF2C6200061040037700031080A5
3681:10E600003C010001002208218C226BD80040000848
3682:10E610000000000000002021000028210C004DDB3C
3683:10E6200034068000240400102405000224060002A1
3684:10E63000240200020C004DDBA7A2001824020002F5
3685:10E640003C01000110000364AC226DD427B1001816
3686:10E65000A7A00018000080210C004D7824040001C0
3687:10E66000261000012E0200201440FFFB00000000D5
3688:10E670000C004D78000020210C004D78240400018E
3689:10E680000C004D78240400010C004D78000020217E
3690:10E69000241000103202000110400002000020216E
3691:10E6A000240400010C004D78001080421600FFFA8F
3692:10E6B00032020001241000100C004D7800002021CF
3693:10E6C000001080421600FFFC000000000C004DB955
3694:10E6D000341080000C004DB9000000000C004D58B3
3695:10E6E000000000005040000500108042962200000B
3696:10E6F00000501025A6220000001080421600FFF7EF
3697:10E70000000000000C004DB90000000097A20018A6
3698:10E710003042800014400004240200033C01000148
3699:10E72000AC226DD4240200033C0100011000032A36
3700:10E73000AC226DD42404001024050002240600023B
3701:10E74000240200020C004DDBA7A200183C030001CC
3702:10E750008C636E2024020001146201E1000080211C
3703:10E7600027B10018A7A000180C004D782404000160
3704:10E77000261000012E0200201440FFFB00000000C4
3705:10E780000C004D78000020210C004D78240400017D
3706:10E790000C004D78240400010C004D78000020216D
3707:10E7A000241000103202000110400002000020215D
3708:10E7B000240400010C004D78001080421600FFFA7E
3709:10E7C0003202000124100010320200181040000232
3710:10E7D00000002021240400010C004D78001080422C
3711:10E7E0001600FFFA320200180C004DB934108000F8
3712:10E7F0000C004DB9000000000C004D580000000056
3713:10E800005040000500108042962200000050102564
3714:10E81000A6220000001080421600FFF70000000052
3715:10E820000C004DB90000802127B10018A7A00018E6
3716:10E830000C004D7824040001261000012E02002057
3717:10E840001440FFFB000000000C004D780000202168
3718:10E850000C004D78240400010C004D7824040001C4
3719:10E860000C004D780000202124100010320200011D
3720:10E870001040000200002021240400010C004D780B
3721:10E88000001080421600FFFA32020001241000102E
3722:10E890003202001810400002000020212404000170
3723:10E8A0000C004D78001080421600FFFA320200186A
3724:10E8B0000C004DB9341080000C004DB90000000070
3725:10E8C0000C004D5800000000504000050010804230
3726:10E8D0009622000000501025A62200000010804261
3727:10E8E0001600FFF7000000000C004DB90000802169
3728:10E8F00024040018000028210C004DDB2406040429
3729:10E90000A7A0001A0C004D78240400012610000175
3730:10E910002E0200201440FFFB000000000C004D7888
3731:10E92000000020210C004D78240400010C004D78DB
3732:10E93000240400010C004D78000020212410001058
3733:10E9400032020001104000020000202124040001D6
3734:10E950000C004D78001080421600FFFA32020001D0
3735:10E960002410001032020018104000020000202184
3736:10E97000240400010C004D78001080421600FFFABC
3737:10E98000320200180C004DB9341080000C004DB953
3738:10E99000000000000C004D58000000005040000531
3739:10E9A0000010804297A2001A00501025A7A2001A5A
3740:10E9B000001080421600FFF7000000000C004DB967
3741:10E9C00000008021A7A0001A0C004D78240400014B
3742:10E9D000261000012E0200201440FFFB0000000062
3743:10E9E0000C004D78000020210C004D78240400011B
3744:10E9F0000C004D78240400010C004D78000020210B
3745:10EA000024100010320200011040000200002021FA
3746:10EA1000240400010C004D78001080421600FFFA1B
3747:10EA200032020001241000103202001810400002CF
3748:10EA300000002021240400010C004D7800108042C9
3749:10EA40001600FFFA320200180C004DB93410800095
3750:10EA50000C004DB9000000000C004D5800000000F3
3751:10EA6000504000050010804297A2001A0050102567
3752:10EA7000A7A2001A001080421600FFF70000000055
3753:10EA80000C004DB900008021A7A0001C0C004D789F
3754:10EA900024040001261000012E0200201440FFFB78
3755:10EAA000000000000C004D78000020210C004D7883
3756:10EAB000240400010C004D78240400010C004D7862
3757:10EAC00000002021241000100C004D7800002021AF
3758:10EAD000001080421600FFFC00000000241000100F
3759:10EAE0003202001E10400002000020212404000118
3760:10EAF0000C004D78001080421600FFFA3202001E12
3761:10EB00000C004DB9341080000C004DB9000000001D
3762:10EB10000C004D58000000005040000500108042DD
3763:10EB200097A2001C00501025A7A2001C00108042D4
3764:10EB30001600FFF7000000000C004DB90000802116
3765:10EB4000A7A0001C0C004D78240400012610000131
3766:10EB50002E0200201440FFFB000000000C004D7846
3767:10EB6000000020210C004D78240400010C004D7899
3768:10EB7000240400010C004D78000020212410001016
3769:10EB80000C004D7800002021001080421600FFFC90
3770:10EB900000000000241000103202001E104000028D
3771:10EBA00000002021240400010C004D780010804258
3772:10EBB0001600FFFA3202001E0C004DB9341080001E
3773:10EBC0000C004DB9000000000C004D580000000082
3774:10EBD000504000050010804297A2001C00501025F4
3775:10EBE000A7A2001C001080421600FFF700000000E2
3776:10EBF0000C004DB90000802124020002A7A2001ED3
3777:10EC00000C004D7824040001261000012E02002083
3778:10EC10001440FFFB000000000C004D780000202194
3779:10EC20000C004D78240400010C004D7800002021D8
3780:10EC30000C004D7824040001241000100C004D78C5
3781:10EC400000002021001080421600FFFC00000000A0
3782:10EC5000241000103202001E10400002000020218B
3783:10EC6000240400010C004D78001080421600FFFAC9
3784:10EC70003202001E0C004D78240400010C004D7877
3785:10EC8000000020213410800097A2001E00501024A4
3786:10EC90001040000200002021240400010C004D78E7
3787:10ECA000001080421600FFF8000000000C004DB973
3788:10ECB00000008021A7A000200C004D782404000152
3789:10ECC000261000012E0200201440FFFB000000006F
3790:10ECD0000C004D78000020210C004D782404000128
3791:10ECE0000C004D78240400010C004D780000202118
3792:10ECF000241000100C004D780000202100108042EC
3793:10ED00001600FFFC00000000241000103202001E5C
3794:10ED10001040000200002021240400010C004D7866
3795:10ED2000001080421600FFFA3202001E0C004DB99E
3796:10ED3000341080000C004DB9000000000C004D584C
3797:10ED400000000000504000050010804297A2002003
3798:10ED500000501025A7A20020001080421600FFF7E7
3799:10ED6000000000000C004DB900008021A7A0002089
3800:10ED70000C004D7824040001261000012E02002012
3801:10ED80001440FFFB000000000C004D780000202123
3802:10ED90000C004D78240400010C004D78240400017F
3803:10EDA0000C004D7800002021241000100C004D783C
3804:10EDB00000002021001080421600FFFC000000002F
3805:10EDC000241000103202001E10400002000020211A
3806:10EDD000240400010C004D78001080421600FFFA58
3807:10EDE0003202001E0C004DB9341080000C004DB9E9
3808:10EDF000000000000C004D580000000050400005CD
3809:10EE00000010804297A2002000501025A7A20020E9
3810:10EE1000001080421600FFF7000000000C004DB902
3811:10EE200000008021A7A000220C004D7824040001DE
3812:10EE3000261000012E0200201440FFFB00000000FD
3813:10EE40000C004D78000020210C004D7824040001B6
3814:10EE50000C004D78000020210C004D7824040001A6
3815:10EE6000241000100C004D7800002021001080427A
3816:10EE70001600FFFC00000000241000100C004D786C
3817:10EE800000002021001080421600FFFC000000005E
3818:10EE90000C004D78240400010C004D780000202166
3819:10EEA0003410800097A2002200501024104000026D
3820:10EEB00000002021240400010C004D780010804245
3821:10EEC0001600FFF8000000000C004DB90000000023
3822:10EED00024040018240500020C004DDB2406000465
3823:10EEE0003C1000018E106E24240200011602011D48
3824:10EEF000000000003C02000194426F263C0100012A
3825:10EF0000AC206E2424429FBC2C4200041040000C14
3826:10EF100024040009240500010C004DDB2406040034
3827:10EF200024040018240500010C004DDB24060020F9
3828:10EF300024040018240500010C004DDB24062000E9
3829:10EF40003C02400002421024104001233C022000F9
3830:10EF50000242102410400004000000003C010001A7
3831:10EF600010000003AC306F1C3C010001AC206F1C92
3832:10EF70003C0300018C636F3424020005146200F925
3833:10EF8000000000003C0200018C426F1C1040006732
3834:10EF90003C0200040242102410400011A7A00018F7
3835:10EFA0003C02000802421024104000022402020029
3836:10EFB000A7A200183C0200100242102410400004D6
3837:10EFC0000000000097A2001834420100A7A2001818
3838:10EFD00097A600182404000910000004000028214E
3839:10EFE0002404000900002821000030210C004DDB22
3840:10EFF0000000000024020001A7A2001A3C02000841
3841:10F00000024210241040000C3C0200020242102474
3842:10F010001040000224020101A7A2001A3C020001D4
3843:10F0200002421024104000053C02001097A2001A72
3844:10F0300034420040A7A2001A3C02001002421024F1
3845:10F040001040000E3C020002024210241040000555
3846:10F050003C02000197A2001A34420080A7A2001AC5
3847:10F060003C02000102421024104000053C0300A0B5
3848:10F0700097A2001A34420020A7A2001A3C0300A065
3849:10F0800002431024544300043C02002097A2001ABB
3850:10F090001000000C344204000242102450400004CE
3851:10F0A0003C02008097A2001A1000000634420800BB
3852:10F0B00002421024104000040000000097A2001A31
3853:10F0C00034420C00A7A2001A97A6001A24040004D8
3854:10F0D0000C004DDB000028213C02000402421024F9
3855:10F0E00010400004A7A0001C32425000144000044D
3856:10F0F00000000000324240001040000500002021C6
3857:10F100000C004CF902402021100000960000000085
3858:10F1100097A6001C0000282134C612000C004DDB0D
3859:10F12000A7A6001C1000008F00000000024210245F
3860:10F1300010400004A7A00018324250001440000400
3861:10F140000000000032424000104000053C02001068
3862:10F150000C004CF90240202110000019A7A0001A51
3863:10F1600002421024104000040000000097A2001882
3864:10F1700010000004A7A2001897A200183442010052
3865:10F18000A7A200183C020001024210241040000413
3866:10F190000000000097A2001810000004A7A20018A9
3867:10F1A00097A2001834422000A7A2001897A60018C2
3868:10F1B000000020210C004DDB00002821A7A0001A30
3869:10F1C000000080210C004D7824040001261000016D
3870:10F1D0002E0200201440FFFB000000000C004D78C0
3871:10F1E000000020210C004D78240400010C004D7813
3872:10F1F000240400010C004D78000020212410001090
3873:10F20000320200011040000200002021240400010D
3874:10F210000C004D78001080421600FFFA3202000107
3875:10F22000241000100C004D780000202100108042B6
3876:10F230001600FFFC000000000C004DB934108000E7
3877:10F240000C004DB9000000000C004D5800000000FB
3878:10F25000504000050010804297A2001A005010256F
3879:10F26000A7A2001A001080421600FFF7000000005D
3880:10F270000C004DB900008021A7A0001A0C004D78A9
3881:10F2800024040001261000012E0200201440FFFB80
3882:10F29000000000000C004D78000020210C004D788B
3883:10F2A000240400010C004D78240400010C004D786A
3884:10F2B0000000202124100010320200011040000242
3885:10F2C00000002021240400010C004D780010804231
3886:10F2D0001600FFFA32020001241000100C004D78D5
3887:10F2E00000002021001080421600FFFC00000000FA
3888:10F2F0000C004DB9341080000C004DB90000000026
3889:10F300000C004D58000000005040000500108042E5
3890:10F3100097A2001A00501025A7A2001A00108042E0
3891:10F320001600FFF7000000000C004DB900000000BF
3892:10F330003C04000124846BCC97A6001897A7001A00
3893:10F340003C0200018C426D983C0300018C636F1CF1
3894:10F350003C05000D34A50205AFA200100C002B3BAC
3895:10F36000AFA300148F830054240200043C01000169
3896:10F37000AC226DD43C01000110000017AC236F38A3
3897:10F380008F8300543C0200018C426F382463FF9C41
3898:10F39000004310232C4200641440000F00000000C2
3899:10F3A0008F820220240300053C010001AC236DD4B0
3900:10F3B0003C03F7000043102510000007AF82022035
3901:10F3C000240200063C010001AC226DD4240200118D
3902:10F3D0003C010001AC226DD08FBF00348FB20030F1
3903:10F3E0008FB1002C8FB0002803E0000827BD003843
3904:10F3F00027BDFFD8AFB0001800808021AFB1001C3E
3905:10F40000000088213202400010400013AFBF0020EE
3906:10F410003C020010020210242C42000100021023C2
3907:10F42000304341003C020001020210241440000657
3908:10F43000347140003C020002020210241440000219
3909:10F440003471600034714040000020210000282108
3910:10F45000100000360220302132021000104000352A
3911:10F4600000002021000028210C004DDB2406004074
3912:10F4700024040018000028210C004DDB24060C0099
3913:10F4800024040017000028210C004DDB2406040092
3914:10F4900024040016000028210C004DDB2406000681
3915:10F4A00024040017000028210C004DDB2406250051
3916:10F4B00024040016000028210C004DDB2406000661
3917:10F4C00024040017000028210C004DDB2406460010
3918:10F4D00024040016000028210C004DDB2406000641
3919:10F4E00024040017000028210C004DDB24066700CF
3920:10F4F00024040016000028210C004DDB2406000621
3921:10F500002404001F000028210C004DDB24060010FD
3922:10F5100024040009000028210C004DDB24061500FE
3923:10F52000240400090000282124061D000C004DDBE6
3924:10F53000000000003C04000124846BF03C05000E38
3925:10F5400034A501000200302102203821AFA00010B4
3926:10F550000C002B3BAFA000148FBF00208FB1001C0C
3927:10F560008FB0001803E0000827BD00288F850044F5
3928:10F570008F8200443C030001004310253C03000837
3929:10F58000AF8200448F8400548F82005400A328244B
3930:10F5900010000002248400018F8200540082102396
3931:10F5A0002C4200021440FFFC000000008F82004447
3932:10F5B0003C03FFFE3463FFFF00431024AF8200448E
3933:10F5C0008F8300548F8200541000000224630001D6
3934:10F5D0008F820054006210232C4200021440FFFC72
3935:10F5E0000000000003E0000800A010218F83004409
3936:10F5F0003C02FFF03442FFFF000424800062182424
3937:10F600003C0200020082202500641825AF830044DC
3938:10F610008F8200443C03FFFE3463FFFF004310244D
3939:10F62000AF8200448F8300548F8200541000000288
3940:10F63000246300018F820054006210232C420002D8
3941:10F640001440FFFC000000008F8200443C030001D6
3942:10F6500000431025AF8200448F8300548F820054F2
3943:10F6600010000002246300018F8200540062102306
3944:10F670002C4200021440FFFC0000000003E00008E0
3945:10F68000000000008F8200442403FF7F0043102409
3946:10F69000AF8200448F8300548F8200541000000218
3947:10F6A000246300018F820054006210232C42000268
3948:10F6B0001440FFFC000000008F82004434420080B0
3949:10F6C000AF8200448F8300548F82005410000002E8
3950:10F6D000246300018F820054006210232C42000238
3951:10F6E0001440FFFC0000000003E0000800000000E0
3952:10F6F0008F8200443C03FFF03463FFFF004310247B
3953:10F70000AF8200448F8200443C0300010043102577
3954:10F71000AF8200448F8300548F8200541000000297
3955:10F72000246300018F820054006210232C420002E7
3956:10F730001440FFFC000000008F8200443C03FFFEE9
3957:10F740003463FFFF00431024AF8200448F830054D2
3958:10F750008F82005410000002246300018F82005445
3959:10F76000006210232C4200021440FFFC0000000045
3960:10F7700003E000080000000027BDFFC8AFB300246D
3961:10F7800000809821AFBE002C00A0F021AFB2002075
3962:10F7900000C0902133C2FFFFAFBF0030AFB50028DB
3963:10F7A000AFB1001CAFB0001814400034A7B2001075
3964:10F7B0003271FFFF27B20010000080210C004D784D
3965:10F7C00024040001261000012E0200201440FFFB3B
3966:10F7D000000000000C004D78000020210C004D7846
3967:10F7E000240400010C004D78000020210C004D780D
3968:10F7F0002404000124100010320200011040000215
3969:10F8000000002021240400010C004D7800108042EB
3970:10F810001600FFFA320200012410001002301024FA
3971:10F820001040000200002021240400010C004D784B
3972:10F83000001080421600FFFA023010240C004D78B0
3973:10F84000240400010C004D780000202134108000B9
3974:10F8500096420000005010241040000200002021B9
3975:10F86000240400010C004D78001080421200007545
3976:10F87000000000001000FFF6000000003275FFFFDE
3977:10F8800027B10010A7A00010000080210C004D78C7
3978:10F8900024040001261000012E0200201440FFFB6A
3979:10F8A000000000000C004D78000020210C004D7875
3980:10F8B000240400010C004D78240400010C004D7854
3981:10F8C000000020212410001032020001104000022C
3982:10F8D00000002021240400010C004D78001080421B
3983:10F8E0001600FFFA320200012410001002B01024AA
3984:10F8F0001040000200002021240400010C004D787B
3985:10F90000001080421600FFFA02B010240C004DB91E
3986:10F91000341080000C004DB9000000000C004D5860
3987:10F9200000000000504000050010804296220000B8
3988:10F9300000501025A6220000001080421600FFF79C
3989:10F94000000000000C004DB90000000033C5FFFFAF
3990:10F950002402000154A200042402000297A2001015
3991:10F96000100000060052102514A200063271FFFF9D
3992:10F9700097A200100012182700431024A7A200101D
3993:10F980003271FFFF27B20010000080210C004D787B
3994:10F9900024040001261000012E0200201440FFFB69
3995:10F9A000000000000C004D78000020210C004D7874
3996:10F9B000240400010C004D78000020210C004D783B
3997:10F9C0002404000124100010320200011040000243
3998:10F9D00000002021240400010C004D78001080421A
3999:10F9E0001600FFFA32020001241000100230102429
4000:10F9F0001040000200002021240400010C004D787A
4001:10FA0000001080421600FFFA023010240C004D78DE
4002:10FA1000240400010C004D780000202134108000E7
4003:10FA200096420000005010241040000200002021E7
4004:10FA3000240400010C004D78001080421600FFF8ED
4005:10FA4000000000000C004DB9000000008FBF003026
4006:10FA50008FBE002C8FB500288FB300248FB20020FA
4007:10FA60008FB1001C8FB0001803E0000827BD0038DC
4008:10FA700000000000000000000000000027BDFFE8BB
4009:10FA8000AFBF00108EE304B824020008146201E046
4010:10FA9000000000003C0200018C426F1C1440000575
4011:10FAA000000000000C003DAF8F840224100001D83C
4012:10FAB000000000008F8202203C0300080043102455
4013:10FAC00010400026240200018F8402248F8202202D
4014:10FAD0003C03040000431024104000060000000016
4015:10FAE0003C010002AC208FA03C0100021000000B82
4016:10FAF000AC208FC03C03000224638FA08C62000006
4017:10FB000024420001AC6200002C42000214400003B9
4018:10FB1000240200013C010002AC228FC03C02000222
4019:10FB20008C428FC01040000630820040104000041C
4020:10FB3000240200013C01000210000003AC228FC42B
4021:10FB40003C010002AC208FC43C010002AC248F9C1D
4022:10FB50003C0100021000000BAC208FD03C010002E1
4023:10FB6000AC228FD03C010002AC208FC03C010002CF
4024:10FB7000AC208FA03C010002AC208FC43C010002ED
4025:10FB8000AC208F9C3C0300028C638F903C020002EF
4026:10FB90008C428F94506200042463FFFF3C010002FA
4027:10FBA000AC238F942463FFFF2C62000E104001945D
4028:10FBB000000310803C010001002208218C226C000F
4029:10FBC0000040000800000000240200023C01000286
4030:10FBD000AC208FC03C010002AC208FA03C01000291
4031:10FBE000AC208F9C3C010002AC208FC43C01000281
4032:10FBF000AC208FB83C010002AC208FB0AF80022453
4033:10FC00003C010002AC228F903C0200028C428FD05B
4034:10FC10001440004F3C02FDFF3442FFFF0C003DAF9B
4035:10FC20000282A024AF8002048F8202002403FFFD21
4036:10FC300000431024AF8202003C010002AC208FE0A0
4037:10FC40008F8300543C0200028C428FB824040001D0
4038:10FC50003C010002AC248FCC244200013C01000294
4039:10FC6000AC228FB82C4200043C010002AC238FB4BC
4040:10FC700014400006240200033C010001AC246D9CEA
4041:10FC80003C0100021000015EAC208FB83C01000274
4042:10FC90001000015BAC228F908F8300543C02000265
4043:10FCA0008C428FB42463D8F0004310232C422710D9
4044:10FCB00014400003240200043C010002AC228F9097
4045:10FCC0003C0200028C428FD0144000213C02FDFF18
4046:10FCD0003442FFFF1000014A0282A0243C040001CC
4047:10FCE0008C846F203C0100020C005084AC208FA853
4048:10FCF0003C0200028C428FDCAF8202043C02000214
4049:10FD00008C428FD0144000123C03FDFF8F8202040E
4050:10FD10003463FFFF304200301440012F0283A024DF
4051:10FD20003C0300028C638FDC240200053C010002CE
4052:10FD3000AC228F903C01000210000131AC238FE017
4053:10FD40003C0200028C428FD0104000103C02FDFFAC
4054:10FD50003C0200018C426E3C244200013C01000147
4055:10FD6000AC226E3C2C42000214400125240200010A
4056:10FD70003C010001AC226E443C010001AC206E3C11
4057:10FD80003C0100011000011EAC226D9C3C030002EE
4058:10FD90008C638FC03442FFFF106001190282A024DF
4059:10FDA0003C0200028C428F9C1040011500000000B4
4060:10FDB0003C010002AC228FC8240200033C01000277
4061:10FDC000AC228FA0100000B8240200063C01000203
4062:10FDD000AC208FA88F82020434420040AF8202041C
4063:10FDE0003C0200028C428FE0240300073C01000229
4064:10FDF000AC238F90344200403C010002AC228FE0E3
4065:10FE00003C0200028C428FC0104000050000000040
4066:10FE10003C0200028C428F9C104000F02402000241
4067:10FE20003C05000224A58FA08CA200002C424E218C
4068:10FE3000104000EA240200023C0200028C428FC4FF
4069:10FE4000104000EF2404FFBF3C0200028C428F9C54
4070:10FE50003C0300028C638FC8004410240064182403
4071:10FE600010430004240200013C010002100000E4E1
4072:10FE7000AC228F9024020003ACA2000024020008F0
4073:10FE80003C010002AC228F903C0200028C428FCCDD
4074:10FE90001040000C240200013C0400020C005091B0
4075:10FEA0008C848F9C3C0200028C428FE81440000539
4076:10FEB000240200013C0200028C428FE41040000644
4077:10FEC000240200013C010001AC226D9C3C010002B7
4078:10FED000100000CBAC208FB83C0200028C428FB0E7
4079:10FEE0003C0300028C638F9C2C420001000210C076
4080:10FEF000306300083C010002AC228FB03C010002DC
4081:10FF0000AC238FAC8F830054240200093C01000213
4082:10FF1000AC228F903C010002100000B9AC238FB4DA
4083:10FF20008F8300543C0200028C428FB42463D8F0CB
4084:10FF3000004310232C4227101440009F00000000B3
4085:10FF40003C0200028C428FC01040000500000000FF
4086:10FF50003C0200028C428F9C104000A02402000250
4087:10FF60003C03000224638FA08C6200002C424E21CF
4088:10FF70001040009A240200023C0200028C428FCC06
4089:10FF80001040000E000000003C0200028C428F9CDA
4090:10FF90003C010002AC208FCC304200801040002F8A
4091:10FFA0002402000C8F820204304200801440000CB6
4092:10FFB00024020003100000292402000C3C0200026D
4093:10FFC0008C428F9C304200801440000524020003C4
4094:10FFD0008F820204304200801040001F2402000380
4095:10FFE000AC6200002402000A3C010002AC228F90A7
4096:10FFF0003C04000224848FD88C8200003C03000261
4097:020000021000EC
4098:100000008C638FB000431025AF8202048C83000004
4099:100010003C0400028C848FB02402000B3C010002DF
4100:10002000AC228F90006418253C010002AC238FE0C5
4101:100030003C05000224A58FA08CA200002C424E217A
4102:1000400010400066240200023C0200028C428FD065
4103:1000500010400005000000002402000C3C010002DA
4104:1000600010000067AC228F903C0200028C428FC0CF
4105:1000700010400063000000003C0400028C848F9C50
4106:1000800010800055308200083C0300028C638FAC66
4107:100090001062005B240200033C010002AC248FC804
4108:1000A000ACA20000240200063C0100021000005433
4109:1000B000AC228F908F82020034420002AF82020095
4110:1000C0008F8300542402000D3C010002AC228F906B
4111:1000D0003C010002AC238FB48F8300543C02000229
4112:1000E0008C428FB42463D8F0004310232C42271095
4113:1000F00014400031000000003C0200028C428FD00E
4114:10010000104000202402000E3C0300028C638FE4A8
4115:100110003C01000214600015AC228F900C003E6D73
4116:10012000000000003C0500018CA56D980C00529B5E
4117:10013000000020213C0300018C636D982402000420
4118:10014000146200052403FFFB3C0200018C426D9405
4119:10015000100000032403FFF73C0200018C426D9461
4120:10016000004310243C010001AC226D948F830224D3
4121:100170003C0202003C010002AC238FEC1000002086
4122:100180000282A0253C0200028C428FC01040000574
4123:10019000000000003C0200028C428F9C1040000FC7
4124:1001A000240200023C0200028C428FA02C424E210D
4125:1001B0001040000A240200023C0200028C428FC060
4126:1001C0001040000F000000003C0200028C428F9C97
4127:1001D0001440000B00000000240200023C01000259
4128:1001E00010000007AC228F903C0200028C428FC0AE
4129:1001F00010400003000000000C003DAF00000000B4
4130:100200008F8202203C03F70000431025AF820220BA
4131:100210008FBF001003E0000827BD00183C03000258
4132:1002200024638FE88C6200001040000534422000F7
4133:100230003C010002AC228FDC10000003AC60000027
4134:100240003C010002AC248FDC03E000080000000049
4135:1002500027BDFFE030820030AFBF00183C01000234
4136:10026000AC228FE4144000673C02FFFF34421F0EB3
4137:1002700000821024144000612402003030822000EB
4138:100280001040005D3083800000031A0230820001BC
4139:10029000000212003C0400018C846F2000621825CB
4140:1002A000000331C23C03000124636E4830828000A9
4141:1002B00000021202308400010004220000441025D4
4142:1002C000000239C2000610800043102100471021AF
4143:1002D000904300002402000110620025000000008D
4144:1002E00010600007240200021062001324020003C1
4145:1002F0001062002C3C05000F1000003700000000C9
4146:100300008F8202002403FEFF00431024AF8202000C
4147:100310008F8202203C03FFFE3463FFFF0043102462
4148:10032000AF8202203C010002AC2090043C0100029C
4149:1003300010000034AC20900C8F8202003442010087
4150:10034000AF8202008F8202203C03FFFE3463FFFF76
4151:1003500000431024AF820220240201003C0100026D
4152:10036000AC2290043C01000210000026AC20900C4E
4153:100370008F8202002403FEFF00431024AF8202009C
4154:100380008F8202203C03000100431025AF8202202F
4155:100390003C010002AC2090043C0100021000001956
4156:1003A000AC23900C8F82020034420100AF82020025
4157:1003B0008F8202203C03000100431025AF820220FF
4158:1003C000240201003C010002AC2290043C01000226
4159:1003D0001000000CAC23900C34A5FFFF3C0400017E
4160:1003E00024846C38AFA300100C002B3BAFA000148A
4161:1003F0001000000400000000240200303C01000254
4162:10040000AC228FE88FBF001803E0000827BD002052
4163:1004100000000000000000000000000027BDFFC831
4164:10042000AFB2002800809021AFB3002C00A098212B
4165:10043000AFB0002000C080213C04000124846C5037
4166:100440003C0500093C0200018C426D9834A59001E6
4167:100450000240302102603821AFBF0030AFB100242C
4168:10046000A7A0001AAFB000140C002B3BAFA20010E5
4169:1004700024020002126200832E6200031040000575
4170:10048000240200011262000A000000001000017343
4171:100490000000000024020004126200F82402000898
4172:1004A000126200F73C02FFEC1000016C000000003B
4173:1004B0003C0200018C426D94304200021440000462
4174:1004C000001289403C02FFFB3442FFFF02028024FD
4175:1004D0003C01000200310821AC308FFC3C0240009E
4176:1004E000020210241040004E001023C2308400305D
4177:1004F000001013823042001C3C03000124636DD8BD
4178:1005000000431021008238213C0200200202102406
4179:1005100010400006240201003C01000200310821C5
4180:10052000AC229000100000053C0200803C0100025B
4181:1005300000310821AC2090003C020080020210240F
4182:1005400010400006001219403C0200013C0100026C
4183:100550000023082110000005AC2290080012114071
4184:100560003C01000200220821AC20900894E4000025
4185:100570003C0300018C636F402402000510620010F0
4186:10058000A7A400183202400010400002348240004C
4187:10059000A7A200182404000194E20002240500042C
4188:1005A00024E60002344200010C0045BEA4E2000231
4189:1005B00024040001000028210C0045BE27A60018D5
4190:1005C0003C0200018C426D98241100013C010001A5
4191:1005D000AC316DA414530004320280000C003DAF16
4192:1005E00000000000320280001040011C00000000EA
4193:1005F0000C003DAF000000003C0300018C636F4025
4194:100600002402000510620115240200023C010001D1
4195:10061000AC316D9C3C01000110000110AC226D98C2
4196:10062000240400012405000427B0001A0C0045BE74
4197:100630000200302124040001000028210C0045BEE6
4198:10064000020030213C020002005110218C428FF444
4199:100650003C0400018C846D983C03BFFF3463FFFFB2
4200:100660003C010001AC336DA4004310243C010002A6
4201:1006700000310821109300F7AC228FF4100000F72E
4202:10068000000000003C02200002021024104000057F
4203:10069000240200013C010001AC226F1C1000000488
4204:1006A000001289403C010001AC206F1C00128940FF
4205:1006B0003C01000200310821AC308FF83C024000C0
4206:1006C0000202102414400014000000003C0200014B
4207:1006D0008C426F1C10400006240400042405000115
4208:1006E0000C004DDB2406200024020001AEE204B819
4209:1006F0003C020002005110218C428FF03C03BFFFEE
4210:100700003463FFFF004310243C0100020031082144
4211:10071000100000D0AC228FF03C0200018C426F1C14
4212:10072000104000283C0300A0020310245443000D95
4213:100730003C0200203C0200018C426F202403010097
4214:100740003C01000200310821AC2390043C0300016D
4215:100750003C01000200310821AC23900C1000001570
4216:100760003442040002021024104000082403010057
4217:100770003C0200018C426F203C0100020031082144
4218:10078000AC2390041000000B344208003C020080AF
4219:10079000020210241040002E3C0300013C02000124
4220:1007A0008C426F203C01000200310821AC23900CE8
4221:1007B00034420C003C010001AC226F2010000025E7
4222:1007C000240400013C020020020210241040000614
4223:1007D000240201003C01000200310821AC229004F7
4224:1007E000100000053C0200803C010002003108219D
4225:1007F000AC2090043C02008002021024104000074C
4226:10080000001219403C0200013C01000200230821B3
4227:10081000AC22900C100000062404000100121140CC
4228:100820003C01000200220821AC20900C24040001AD
4229:100830000000282127B0001E0C00457C020030215A
4230:1008400024040001000028210C00457C0200302116
4231:10085000240400012405000127B0001C0C00457C85
4232:100860000200302124040001240500010C00457C15
4233:100870000200302110000077000000003C02FFEC75
4234:100880003442FFFF020280243C020008020280255D
4235:10089000001211403C01000200220821AC308FF808
4236:1008A0003C02200002021024104000090000000059
4237:1008B0003C0200018C426E441440000524020001F9
4238:1008C0003C010001AC226F1C100000043C024000FF
4239:1008D0003C010001AC206F1C3C02400002021024CD
4240:1008E0001440001D24020E013C0300018C636F1CA8
4241:1008F000AF8202383C010001AC206DB010600005F1
4242:10090000240220203C010001AC226F2024020001BF
4243:10091000AEE204B83C04BFFF001219403C020002E2
4244:10092000004310218C428FF03C0500018CA56D988E
4245:100930003484FFFF004410243C01000200230821FE
4246:10094000AC228FF02402000110A20044000000003D
4247:1009500010000040000000003C0200018C426F1CAF
4248:100960001040001C240220003C010001AC226F203A
4249:100970003C0300A0020310241443000500121140A0
4250:100980003402A0003C0100011000002DAC226F20B9
4251:100990003C030002006218218C638FF83C020020A7
4252:1009A0000062102410400004240220013C010001D8
4253:1009B00010000023AC226F203C0200800062102453
4254:1009C0001040001F3402A0013C0100011000001C77
4255:1009D000AC226F203C0200200202102410400007CD
4256:1009E00000121940240201003C01000200230821EA
4257:1009F000AC229004100000063C020080001211405E
4258:100A00003C01000200220821AC2090043C0200803E
4259:100A10000202102410400006001219403C0200019E
4260:100A20003C0100020023082110000005AC22900CBC
4261:100A3000001211403C01000200220821AC20900C61
4262:100A40003C0300018C636D982402000110620003D6
4263:100A5000000000000C003DAF000000008FBF003020
4264:100A60008FB3002C8FB200288FB100248FB00020EC
4265:100A700003E0000827BD003827BDFFB0AFB3003C3E
4266:100A800000009821AFB500400000A821AFB10034AC
4267:100A90000000882124020002AFBF0048AFBE00441E
4268:100AA000AFB20038AFB00030AFA4002CA7A0001A3E
4269:100AB000A7A00018A7A00020A7A0001EA7A00022A2
4270:100AC00010A20130A7A0001C2CA2000310400005BA
4271:100AD0002402000110A2000A3C0240001000025D46
4272:100AE000022010212402000410A2020A240200089D
4273:100AF00010A202080220102110000256000000007F
4274:100B00008FA8002C000881403C03000200701821CF
4275:100B10008C638FFC0062102414400009240400013F
4276:100B20003C027FFF3442FFFF006288243C01000248
4277:100B300000300821AC318FF4100002460220102151
4278:100B4000240500010C00457C27A6001824040001A0
4279:100B5000240500010C00457C27A6001897A2001868
4280:100B600030420004104000D93C1140003C0200011A
4281:100B70008C426F402443FFFF2C620006104000D9D6
4282:100B8000000310803C010001002208218C226C68C7
4283:100B900000400008000000002404000124050011AA
4284:100BA00027B0001A0C00457C02003021240400010B
4285:100BB000240500110C00457C0200302197A3001A87
4286:100BC00030624000104000023C1500103C15000847
4287:100BD00030628000104000AA3C130001100000A801
4288:100BE0003C130002240400012405001427B0001A5D
4289:100BF0000C00457C0200302124040001240500146F
4290:100C00000C00457C0200302197A3001A30621000CE
4291:100C1000104000023C1500103C150008306208002E
4292:100C2000104000973C130001100000953C13000297
4293:100C3000240400012405001927B0001C0C00457C89
4294:100C40000200302124040001240500190C00457C19
4295:100C50000200302197A2001C304307002402040048
4296:100C600010620027286204011040000E24020200D6
4297:100C70001062001F286202011040000524020100DA
4298:100C80005062001E3C1300011000001E24040001ED
4299:100C900024020300506200193C13000210000019E6
4300:100CA00024040001240206001062000D28620601DF
4301:100CB00010400005240205005062000B3C130002A6
4302:100CC0001000001024040001240207001462000D2B
4303:100CD000240400013C1300041000000A3C15000825
4304:100CE000100000063C130004100000053C1500082D
4305:100CF0003C130001100000023C1500083C150010D8
4306:100D0000240400012405001827B0001E0C00457CB7
4307:100D10000200302124040001240500180C00457C49
4308:100D2000020030218FA8002C97A7001E0008114058
4309:100D30003C06000200C230218CC68FF497A200222C
4310:100D40003C10000126106C5C02002021AFA20010B4
4311:100D500097A2001C3C05000C34A503030C002B3BA0
4312:100D6000AFA200143C020004166200103C02000115
4313:100D70008F84005424030001240200023C0100017E
4314:100D8000AC236D9C3C010001AC226D983C0100013C
4315:100D9000AC236DA43C010001AC236E243C01000196
4316:100DA000AC246F301000004F02B388251662003962
4317:100DB0003C0280003C0200018C426E201440001E68
4318:100DC0002404001800002021000028210C004DDB25
4319:100DD000340680008F8300548F82005402B388252C
4320:100DE00010000002246300328F820054006210233E
4321:100DF0002C4200331440FFFC000000008F8300549D
4322:100E0000240200013C010001AC226E203C010001E3
4323:100E1000AC226D9C3C010001AC226D983C010001AC
4324:100E2000AC226DA43C010001AC226E243C01000107
4325:100E30001000002CAC236F30000028210C004DDB8B
4326:100E400024060404000020212405001E27A6001803
4327:100E5000240200020C0045BEA7A2001800002021B9
4328:100E60000000282127A600180C0045BEA7A00018E6
4329:100E700024040018240500020C004DDB24060004A5
4330:100E80003C0280000222102502B318251000001534
4331:100E90000043882502221025027518250043882565
4332:100EA0000200202197A6001C3C0700018CE76D98EA
4333:100EB0003C05000C34A50326AFB300100C002B3BFF
4334:100EC000AFB1001410000007000000003C11000248
4335:100ED000023088218E318FFC3C027FFF3442FFFFBD
4336:100EE000022288243C0200018C426DA81040001EA2
4337:100EF000000000003C0200018C426F1C1040000208
4338:100F00003C022000022288258FA8002C00081140F6
4339:100F10003C010002002208218C22900010400003B6
4340:100F20003C02002010000005022288253C02FFDF61
4341:100F30003442FFFF022288248FA8002C00081140B1
4342:100F40003C010002002208218C229008104000037E
4343:100F50003C02008010000004022288253C02FF7F32
4344:100F60003442FFFF022288248FA8002C0008114081
4345:100F70003C01000200220821AC318FF41000013541
4346:100F8000022010218FA8002C0008F1403C03000231
4347:100F9000007E18218C638FF83C0240000062102410
4348:100FA00014400009240400013C027FFF3442FFFF8B
4349:100FB000006288243C010002003E0821AC318FF021
4350:100FC0001000012402201021000028210C00457C83
4351:100FD00027A6001824040001000028210C00457CED
4352:100FE00027A60018240400012405000127B20020D0
4353:100FF0000C00457C0240302124040001240500013E
4354:101000000C00457C0240302124040001240500042A
4355:1010100027B1001E0C00457C022030212404000171
4356:10102000240500040C00457C02203021240400012A
4357:101030002405000527B000220C00457C0200302169
4358:1010400024040001240500050C00457C0200302129
4359:1010500024040001240500100C00457C27A600187C
4360:1010600024040001240500100C00457C27A600186C
4361:10107000240400012405000A0C00457C02403021B4
4362:10108000240400012405000A0C00457C02403021A4
4363:1010900024040001240500180C00457C02203021A6
4364:1010A00024040001240500180C00457C0220302196
4365:1010B00024040001240500010C00457C27A600182B
4366:1010C00024040001240500010C00457C27A600181B
4367:1010D00097A2001830420004104000663C11400006
4368:1010E0003C0300018C636F34240200051462006726
4369:1010F000240400012405001927B0001C0C00457CC5
4370:101100000200302124040001240500190C00457C54
4371:101110000200302197A2001C304307002402040083
4372:1011200010620027286204011040000E2402020011
4373:101130001062001F28620201104000052402010015
4374:101140005062001E3C1300011000001E3C0200040F
4375:1011500024020300506200193C1300021000001921
4376:101160003C020004240206001062000D2862060101
4377:1011700010400005240205005062000B3C130002E1
4378:10118000100000103C020004240207001462000D4D
4379:101190003C0200043C1300041000000A3C15000847
4380:1011A000100000063C130004100000053C15000868
4381:1011B0003C130001100000023C1500083C15001013
4382:1011C0003C020004126200173C0280008F8200542F
4383:1011D000241000013C010001AC306D9C3C01000179
4384:1011E000AC306D983C010001AC306DA43C010001B5
4385:1011F000AC306E243C010001AC226F303C02000197
4386:101200001662002202758825000020210000282196
4387:101210000C004DDB340680003C0100011000001B77
4388:10122000AC306E200222102502B318250043882519
4389:1012300097A6001C3C0200018C426F1C3C07000179
4390:101240008CE76D983C04000124846C5CAFA2001014
4391:1012500097A2001E3C05000C34A503233C010001AD
4392:10126000AC206E200C002B3BAFA200141000000736
4393:10127000000000003C110002023E88218E318FF0F8
4394:101280003C027FFF3442FFFF022288243C0200011F
4395:101290008C426DA810400069000000003C02000173
4396:1012A0008C426F1C104000023C0220000222882564
4397:1012B0008FA8002C000811403C01000200220821E8
4398:1012C0008C229004104000033C0200201000000516
4399:1012D000022288253C02FFDF3442FFFF02228824DD
4400:1012E0008FA8002C000811403C01000200220821B8
4401:1012F0008C22900C104000033C0200801000004F34
4402:10130000022288253C02FF7F3442FFFF1000004B81
4403:10131000022288248FA8002C000829403C030002E8
4404:10132000006518218C638FF83C0240000062102495
4405:10133000144000083C027FFF3442FFFF0062882413
4406:101340003C01000200250821AC318FF01000004163
4407:10135000022010213C0200018C426DA81040003494
4408:101360003C11C00C3C0200018C426E443C04C00C99
4409:10137000348420003C0300018C636F1C0002102B9E
4410:10138000000210230044102410600003005188253F
4411:101390003C022000022288253C0200020045102168
4412:1013A0008C429004104000033C0200201000000416
4413:1013B000022288253C02FFDF3442FFFF02228824FC
4414:1013C0008FA8002C000811403C01000200220821D7
4415:1013D0008C22900C104000033C020080100000049E
4416:1013E000022288253C02FF7F3442FFFF022288242C
4417:1013F0003C0200018C426E30104000023C020800AA
4418:10140000022288253C0200018C426E34104000020A
4419:101410003C020400022288253C0200018C426E3806
4420:10142000104000063C020100100000040222882542
4421:101430003C027FFF3442FFFF006288248FA8002C0B
4422:10144000000811403C01000200220821AC318FF05D
4423:10145000022010218FBF00488FBE00448FB500408E
4424:101460008FB3003C8FB200388FB100348FB00030A2
4425:1014700003E0000827BD005027BDFFD0AFB2002811
4426:1014800000809021AFBF002CAFB10024AFB000208E
4427:101490008F8402003C1000018E106D988F86022010
4428:1014A000240200021202005C2E020003104000051C
4429:1014B000240200011202000A001219401000010C5F
4430:1014C0000000000024020004120200BF24020008F1
4431:1014D000120200BE00128940100001050000000049
4432:1014E0003C05000200A328218CA58FFC3C100002C3
4433:1014F000020380218E108FF43C02400000A21024D1
4434:10150000104000383C020008020210241040002065
4435:10151000348400023C020002004310218C429000FF
4436:101520001040000534840020348401003C02002077
4437:1015300010000006020280252402FEFF0082202403
4438:101540003C02FFDF3442FFFF020280240012114000
4439:101550003C010002002208218C2290081040000566
4440:101560003C02000100C230253C0200801000001641
4441:10157000020280253C02FFFE3442FFFF00C23024FD
4442:101580003C02FF7F3442FFFF1000000F0202802464
4443:101590002402FEDF008220243C02FFFE3442FFFFD3
4444:1015A00000C230243C02FF5F3442FFFF020280246D
4445:1015B0003C01000200230821AC2090003C01000205
4446:1015C00000230821AC209008AF840200AF860220DF
4447:1015D0008F82022034420002AF8202201000000AF3
4448:1015E000001211403C02BFFF3442FFFF8F83020014
4449:1015F000020280242402FFFD006218240C003DAF8B
4450:10160000AF830200001211403C01000200220821B9
4451:10161000100000B7AC308FF43C0200018C426F1C0C
4452:101620001040006924050004240400010C00457CDE
4453:1016300027A6001824040001240500050C00457CA1
4454:1016400027A6001A97A3001897A2001A3C040001CD
4455:1016500024846E4830630C0000031A8230420C0070
4456:1016600000021282A7A2001A00021080004410217A
4457:1016700000431021A7A30018904800002402000195
4458:101680003103FFFF106200292862000210400005AC
4459:101690000000000010600009000000001000003D84
4460:1016A0000000000010700013240200031062002CE0
4461:1016B0000000000010000037000000008F820200D0
4462:1016C0002403FEFF00431024AF8202008F82022019
4463:1016D0003C03FFFE3463FFFF00431024AF8202206F
4464:1016E0003C010002AC2090043C01000210000032DA
4465:1016F000AC20900C8F82020034420100AF820200C5
4466:101700008F8202203C03FFFE3463FFFF004310245E
4467:10171000AF820220240201003C010002AC229004AE
4468:101720003C01000210000024AC20900C8F820200CB
4469:101730002403FEFF00431024AF8202008F820220A8
4470:101740003C03000100431025AF8202203C0100024F
4471:10175000AC2090043C01000210000017AC23900C58
4472:101760008F82020034420100AF8202008F82022089
4473:101770003C03000100431025AF8202202402010037
4474:101780003C010002AC2290043C0100021000000A5F
4475:10179000AC23900C3C04000124846C8097A6001AB2
4476:1017A00097A700183C05000134A5FFFFAFA8001063
4477:1017B0000C002B3BAFA000148F82020034420002C9
4478:1017C0001000004BAF820200001289403C0500026D
4479:1017D00000B128218CA58FF83C1000020211802155
4480:1017E0008E108FF03C02400000A210241440001024
4481:1017F000000000003C0200018C426F1C14400005F8
4482:101800003C02BFFF8F82020034420002AF8202001E
4483:101810003C02BFFF3442FFFF0C003DAF02028024B8
4484:101820003C0100020031082110000031AC308FF083
4485:101830003C0200018C426F1C104000053C0200205D
4486:101840003C0200018C426E44104000253C02002006
4487:1018500000A210241040000734840020240201005C
4488:101860003C01000200310821AC2290041000000667
4489:10187000348401003C01000200310821AC209004B6
4490:101880002402FEFF008220243C02008000A21024DB
4491:1018900010400007001219403C0200013C01000208
4492:1018A00000230821AC22900C1000000800C2302553
4493:1018B000001211403C01000200220821AC20900CD3
4494:1018C0003C02FFFE3442FFFF00C23024AF8402001E
4495:1018D000AF8602208F82022034420002AF820220B3
4496:1018E000001211403C01000200220821AC308FF0B0
4497:1018F0008FBF002C8FB200288FB100248FB0002042
4498:1019000003E0000827BD003000000000000018219F
4499:10191000308400FF2405FFDF2406FFBF00641007AA
4500:101920003042000110400004000000008F8200449B
4501:1019300010000003344200408F820044004610240F
4502:10194000AF8200448F82004434420020AF820044C2
4503:101950008F82004400451024AF82004424630001BC
4504:10196000286200085440FFEE0064100703E00008FE
4505:10197000000000002C8200081040001B0000000046
4506:101980002405FFDF2406FFBF000418803C0200018D
4507:1019900024426E60006218212464000490620000FA
4508:1019A00010400004000000008F820044100000037B
4509:1019B000344200408F82004400461024AF8200442D
4510:1019C0008F82004434420020AF8200448F82004462
4511:1019D00000451024AF820044246300010064102BF2
4512:1019E0001440FFEE0000000003E0000800000000CB
4513:1019F0000000000000000000000000008F8400C410
4514:101A00008F8600E08F8700E42402FFF800C22824BC
4515:101A100010E5001A27623FF814E2000224E80008EB
4516:101A200027683000550500048D0A000030C200040C
4517:101A300014400012008050218CE900008F42013CCC
4518:101A4000014948230049182B94EB0006106000025E
4519:101A500025630050004948210123182B5040000302
4520:101A60008F4201FC03E0000800E01021AF8800E88D
4521:101A700024420001AF4201FCAF8800E403E000080B
4522:101A80000000102103E00008000000008F8300E444
4523:101A900027623FF81062000424620008AF8200E869
4524:101AA00003E00008AF8200E427623000AF8200E864
4525:101AB00003E00008AF8200E403E00008000000003B
4526:101AC0000000000000000000000000008F880120DE
4527:101AD00027624FE08F8301281502000225090020AC
4528:101AE00027694800112300128FA20010AD040000E6
4529:101AF000AD050004AD060008A507000E8FA3001475
4530:101B0000AD0200188FA20018AD03001C25030016BB
4531:101B1000AD020010AD030014AF8901208F4300FC1B
4532:101B2000240200012463FFFF03E00008AF4300FC30
4533:101B30008F430324000010212463000103E0000808
4534:101B4000AF43032403E00008000000008F88010079
4535:101B5000276247E08F830108150200022509002053
4536:101B6000276940001123000F8FA20010AD04000070
4537:101B7000AD050004AD060008A507000E8FA30014F4
4538:101B8000AD0200188FA20018AD03001C250300163B
4539:101B9000AD020010AD030014AF89010003E000089E
4540:101BA000240200018F430328000010212463000158
4541:101BB00003E00008AF43032803E000080000000032
4542:101BC00000000000000000000000000024486561E3
4543:101BD0006465723A202F70726F6A656374732F7236
4544:101BE00063732F73772F67652F2E2F6E69632F66B0
4545:101BF00077322F636F6D6D6F6E2F66776D61696ED3
4546:101C00002E632C7620312E312E322E343520313970
4547:101C100039392F30312F32342030303A31303A35A3
4548:101C20003520736875616E67204578702024000048
4549:101C3000657674526E674600516576744600000002
4550:101C400051657674505F46004D657674526E6746F6
4551:101C5000000000004D516576744600004D516576D8
4552:101C6000505F46005173436F6E495F4600000000AD
4553:101C70005173436F6E734600517250726F64460029
4554:101C80006261644D656D537A0000000068775665A7
4555:101C900072000000626164487756657200000000BF
4556:101CA0002A2A4441574E5F41000000007478527860
4557:101CB0004266537A00000000626641746E4D726B9A
4558:101CC000000000007265645A6F6E6531000000000C
4559:101CD000706369436F6E660067656E436F6E660082
4560:101CE0002A646D615244666C000000002A50414E27
4561:101CF00049432A002E2E2F2E2E2F2E2E2F2E2E2F02
4562:101D00002E2E2F7372632F6E69632F6677322F63C7
4563:101D10006F6D6D6F6E2F66776D61696E2E6300005B
4564:101D2000726362466C616773000000006261645216
4565:101D30007852636200000000676C6F62466C6773E4
4566:101D4000000000002B5F646973705F6C6F6F700040
4567:101D50002B65765F68616E646C65720063616E749A
4568:101D600031446D61000000002B715F646D615F7430
4569:101D70006F5F6E69635F636B73756D002B685F7374
4570:101D8000656E645F646174615F72656164795F63ED
4571:101D90006B73756D000000002B685F646D615F728E
4572:101DA000645F6173736973745F636B73756D000057
4573:101DB00074436B736D4F6E002B715F646D615F7464
4574:101DC0006F5F6E69630000002B685F73656E645F10
4575:101DD000646174615F726561647900002B685F649F
4576:101DE0006D615F72645F61737369737400000000FA
4577:101DF00074436B736D4F6666000000002B685F7361
4578:101E0000656E645F62645F72656164790000000002
4579:101E10006873745352696E67000000006261645316
4580:101E200052696E67000000006E69635352696E6705
4581:101E30000000000077446D61416C6C4100000000BF
4582:101E40002B715F646D615F746F5F686F73745F6344
4583:101E50006B73756D000000002B685F6D61635F72CE
4584:101E6000785F636F6D705F636B73756D000000006A
4585:101E70002B685F646D615F77725F61737369737400
4586:101E80005F636B73756D000072436B736D4F6E0013
4587:101E90002B715F646D615F746F5F686F73740000B6
4588:101EA0002B685F6D61635F72785F636F6D700000B8
4589:101EB0002B685F646D615F77725F617373697374C0
4590:101EC0000000000072436B736D4F666600000000F7
4591:101ED0002B685F726563765F62645F7265616479C7
4592:101EE000000000002B685F726563765F6A756D6243
4593:101EF0006F5F62645F726561647900002B685F7276
4594:101F00006563765F6D696E695F62645F7265616467
4595:101F1000790000002B6D685F636F6D6D616E64000A
4596:101F20002B685F74696D6572000000002B685F6448
4597:101F30006F5F7570646174655F74785F636F6E73F3
4598:101F4000000000002B685F646F5F757064617465EA
4599:101F50005F72785F70726F64000000002B636B73B8
4600:101F6000756D3136000000002B7065656B5F6D612B
4601:101F7000635F72785F7761002B7065656B5F6D6181
4602:101F8000635F7278000000002B6465715F6D6163B0
4603:101F90005F7278002B685F6D61635F72785F617458
4604:101FA000746E0000626164526574537A0000000030
4605:101FB000727842644266537A000000002B6E756CA2
4606:101FC0006C5F68616E646C657200000066774F70CC
4607:101FD0004661696C000000002B685F757064617475
4608:101FE000655F6C65643400002B685F7570646174B4
4609:101FF000655F6C65643600002B685F7570646174A2
4610:10200000655F6C6564320000696E74537461746559
4611:10201000000000002A2A696E697443700000000005
4612:102020002373637265616D0069537461636B4572FC
4613:102030000000000070726F62654D656D0000000069
4614:102040002A2A4441574E5F42000000002B73775FFD
4615:10205000646D615F6173736973745F706C75735FD6
4616:1020600074696D65720000002B267072656C6F617B
4617:10207000645F77725F646573637200002B26707211
4618:10208000656C6F61645F72645F64657363720000A6
4619:102090002B685F68665F74696D65720024486561CE
4620:1020A0006465723A202F70726F6A656374732F7261
4621:1020B00063732F73772F67652F2E2F6E69632F66DB
4622:1020C00077322F636F6D6D6F6E2F74696D65722E31
4623:1020D000632C7620312E312E322E33352031393992
4624:1020E000392F30312F32372031393A30393A3530C3
4625:1020F0002068617965732045787020240000000015
4626:10210000657674526E67460051657674460000002D
4627:1021100051657674505F46004D657674526E674621
4628:10212000000000004D516576744600004D51657603
4629:10213000505F46005173436F6E495F4600000000D8
4630:102140005173436F6E734600517250726F64460054
4631:10215000542D446D6152643200000000542D446DD2
4632:102160006152643100000000542D446D615264429C
4633:1021700000000000542D446D6157723200000000D1
4634:10218000542D446D6157723100000000542D446D90
4635:1021900061577242000000000000000024486561A1
4636:1021A0006465723A202F70726F6A656374732F7260
4637:1021B00063732F73772F67652F2E2F6E69632F66DA
4638:1021C00077322F636F6D6D6F6E2F636F6D6D616E04
4639:1021D000642E632C7620312E312E322E323820316F
4640:1021E0003939392F30312F32302031393A34393AB8
4641:1021F000343920736875616E67204578702024003B
4642:10220000657674526E67460051657674460000002C
4643:1022100051657674505F46004D657674526E674620
4644:10222000000000004D516576744600004D51657602
4645:10223000505F46005173436F6E495F4600000000D7
4646:102240005173436F6E734600517250726F64460053
4647:102250003F48636D644D6278000000003F636D6429
4648:1022600048737453000000003F636D644D634D6418
4649:10227000000000003F636D6450726F6D000000004D
4650:102280003F636D644C696E6B000000003F636D64DA
4651:1022900045727200000086AC00008E5C00008E5C0F
4652:1022A00000008DE400008B7800008E3000008E5C12
4653:1022B00000008790000088000000899000008A6874
4654:1022C00000008A3400008E5C0000887000008B24BF
4655:1022D00000008E5C00008B34000087B4000088246E
4656:1022E00000000000000000000000000024486561BC
4657:1022F0006465723A202F70726F6A656374732F720F
4658:1023000063732F73772F67652F2E2F6E69632F6688
4659:1023100077322F636F6D6D6F6E2F6D636173742EE7
4660:10232000632C7620312E312E322E38203139393837
4661:102330002F31322F30382030323A33363A3336208C
4662:10234000736875616E672045787020240000000076
4663:10235000657674526E6746005165767446000000DB
4664:1023600051657674505F46004D657674526E6746CF
4665:10237000000000004D516576744600004D516576B1
4666:10238000505F46005173436F6E495F460000000086
4667:102390005173436F6E734600517250726F64460002
4668:1023A0006164644D63447570000000006164644DB5
4669:1023B0006346756C0000000064656C4D634E6F45AC
4670:1023C00000000000000000000000000024486561DB
4671:1023D0006465723A202F70726F6A656374732F722E
4672:1023E00063732F73772F67652F2E2F6E69632F66A8
4673:1023F00077322F636F6D6D6F6E2F646D612E632C5E
4674:102400007620312E312E322E323420313939382F88
4675:1024100031322F32312030303A33333A3039207371
4676:102420006875616E67204578702024006576745267
4677:102430006E674600516576744600000051657674FB
4678:10244000505F46004D657674526E6746000000008E
4679:102450004D516576744600004D516576505F4600DB
4680:102460005173436F6E495F46000000005173436F24
4681:102470006E734600517250726F6446007377446DFC
4682:10248000614F66660000000031446D614F6E0000D0
4683:102490007377446D614F6E002372446D6141544EF9
4684:1024A0000000000072446D6141544E300000000095
4685:1024B00072446D6141544E310000000072446D6100
4686:1024C000344762002A50414E49432A002E2E2F2EB7
4687:1024D0002E2F2E2E2F2E2E2F2E2E2F7372632F6E19
4688:1024E00069632F6677322F636F6D6D6F6E2F646D2A
4689:1024F000612E63002377446D6141544E000000005B
4690:1025000077446D6141544E300000000077446D61A6
4691:1025100041544E310000000077446D613447620041
4692:102520000000000000000000000000002448656179
4693:102530006465723A202F70726F6A656374732F72CC
4694:1025400063732F73772F67652F2E2F6E69632F6646
4695:1025500077322F636F6D6D6F6E2F74726163652EAE
4696:10256000632C7620312E312E322E352031393938F8
4697:102570002F30392F33302031383A35303A32382045
4698:10258000736875616E672045787020240000000034
4699:102590000000000000000000000000002448656109
4700:1025A0006465723A202F70726F6A656374732F725C
4701:1025B00063732F73772F67652F2E2F6E69632F66D6
4702:1025C00077322F636F6D6D6F6E2F646174612E6350
4703:1025D0002C7620312E312E322E31322031393939BC
4704:1025E0002F30312F32302031393A34393A353120D9
4705:1025F000736875616E6720457870202400000000C4
4706:1026000046575F56455253494F4E3A202331204694
4707:1026100072692041707220372031373A35373A35A8
4708:1026200032205044542032303030000046575F434F
4709:102630004F4D50494C455F54494D453A2031373A4A
4710:1026400035373A353200000046575F434F4D504909
4711:102650004C455F42593A206465767263730000000E
4712:1026600046575F434F4D50494C455F484F53543A8E
4713:1026700020636F6D707574650000000046575F43FE
4714:102680004F4D50494C455F444F4D41494E3A2065AE
4715:102690006E672E616374656F6E2E636F6D00000050
4716:1026A00046575F434F4D50494C45523A206763634C
4717:1026B0002076657273696F6E20322E372E320000DD
4718:1026C00000000000120411000000000024486561B1
4719:1026D0006465723A202F70726F6A656374732F722B
4720:1026E00063732F73772F67652F2E2F6E69632F66A5
4721:1026F00077322F636F6D6D6F6E2F6D656D2E632C4E
4722:102700007620312E312E322E3520313939382F3086
4723:10271000392F33302031383A35303A303820736829
4724:1027200075616E672045787020240000244865613B
4725:102730006465723A202F70726F6A656374732F72CA
4726:1027400063732F73772F67652F2E2F6E69632F6644
4727:1027500077322F636F6D6D6F6E2F73656E642E63AE
4728:102760002C7620312E312E322E3434203139393826
4729:102770002F31322F32312030303A33333A31382052
4730:10278000736875616E672045787020240000000032
4731:10279000657674526E674600516576744600000097
4732:1027A00051657674505F46004D657674526E67468B
4733:1027B000000000004D516576744600004D5165766D
4734:1027C000505F46005173436F6E495F460000000042
4735:1027D0005173436F6E734600517250726F644600BE
4736:1027E00069736E745463705500000000244865617D
4737:1027F0006465723A202F70726F6A656374732F720A
4738:1028000063732F73772F67652F2E2F6E69632F6683
4739:1028100077322F636F6D6D6F6E2F726563762E63E7
4740:102820002C7620312E312E322E3533203139393964
4741:102830002F30312F31362030323A35353A3433208B
4742:10284000736875616E672045787020240000000071
4743:10285000657674526E6746005165767446000000D6
4744:1028600051657674505F46004D657674526E6746CA
4745:10287000000000004D516576744600004D516576AC
4746:10288000505F46005173436F6E495F460000000081
4747:102890005173436F6E734600517250726F644600FD
4748:1028A000724D616343686B300000000072784672BD
4749:1028B0006D324C670000000072784E6F53744264B2
4750:1028C0000000000072784E6F4D6942640000000005
4751:1028D00072784E6F4A6D4264000000007278436B5C
4752:1028E000446D614600000000727851446D457846A1
4753:1028F00000000000727851446D61460072785144C6
4754:102900004C42644600000000727851446D426446B7
4755:1029100000000000727843726350616400000000A0
4756:1029200072536D51446D614600000000244865619A
4757:102930006465723A202F70726F6A656374732F72C8
4758:1029400063732F73772F67652F2E2F6E69632F6642
4759:1029500077322F636F6D6D6F6E2F6D61632E632CF9
4760:102960007620312E312E322E323220313939382F25
4761:1029700031322F30382030323A33363A3330207308
4762:102980006875616E67204578702024006576745202
4763:102990006E67460051657674460000005165767496
4764:1029A000505F46004D657674526E67460000000029
4765:1029B0004D516576744600004D516576505F460076
4766:1029C0005173436F6E495F46000000005173436FBF
4767:1029D0006E734600517250726F6446006D616354AD
4768:1029E000687265730000000023744D616341544EAA
4769:1029F0000000000023724D616341544E000000004E
4770:102A000072656D4173737274000000006C696E6BC7
4771:102A1000444F574E000000006C696E6B555000002B
4772:102A20000000000000000000000000002448656174
4773:102A30006465723A202F70726F6A656374732F72C7
4774:102A400063732F73772F67652F2E2F6E69632F6641
4775:102A500077322F636F6D6D6F6E2F636B73756D2E95
4776:102A6000632C7620312E312E322E392031393939EE
4777:102A70002F30312F31342030303A30333A3438204F
4778:102A8000736875616E67204578702024000000002F
4779:102A9000657674526E674600516576744600000094
4780:102AA00051657674505F46004D657674526E674688
4781:102AB000000000004D516576744600004D5165766A
4782:102AC000505F46005173436F6E495F46000000003F
4783:102AD0005173436F6E734600517250726F644600BB
4784:102AE00000000000000000000000000050726F6253
4785:102AF00065506879000000006C6E6B41535352546E
4786:102B000000000000000109A400010A1C00010A5095
4787:102B100000010A7C0001105000010AA800010B10FE
4788:102B2000000111FC00010DC000010C6800010C80C7
4789:102B300000010CC400010CEC00010D0C00010D346F
4790:102B4000000111FC00010DC000010DF800010E1084
4791:102B500000010E4000010E6800010E8800010EB059
4792:102B60000000000000010FDC000110080001102C23
4793:102B7000000111FC00011050000110780001110843
4794:102B80000000000000000000000000000001186CC0
4795:102B90000001193C00011A1400011AE400011B4055
4796:102BA00000011C1C00011C4400011D2000011D48E7
4797:102BB00000011EF000011F18000120C0000122B812
4798:102BC0000001254C000124600001254C00012578FE
4799:102BD000000120E8000122907273745F676D6969DB
4800:102BE00000000000000126080001264000012728FF
4801:102BF00000013374000133B4000133CC7365746C8D
4802:102C00006F6F7000000000000000000000013BBC7E
4803:102C100000013BFC00013C8C00013CD000013D3434
4804:102C200000013DC000013DF400013E7C00013F1465
4805:102C300000013FE400014024000140A8000140CC15
4806:102C4000000141DC646F4261736550670000000061
4807:102C500000000000000000000000000073746D61BF
4808:102C6000634C4E4B000000006765746D636C6E6BC7
4809:102C70000000000000014ED800014ED800014B8C2E
4810:102C800000014BD800014C2400014ED87365746DCF
4811:102C90006163616374000000000000000000000038
4812:102CA0000000000000000000000000000000000024
4813:102CB0000000000000000000000000000000000014
4814:102CC0000000000000000000000000000000000103
4815:102CD000000000010000000100C001FC00003FFCFA
4816:102CE00000C00000416C74656F6E204163654E4901
4817:102CF000432056000000000000000000000000001B
4818:102D0000000000000000000000000000416C74653D
4819:102D10006F6E204163654E49432056004242424255
4820:102D2000000000000000000000000000001FFFFC89
4821:102D3000001FFF7C000000000000000000000000F9
4822:102D40000000000000000000000000000060CF0054
4823:102D500000000060CF000000000000000000000044
4824:102D60000000000000000000000000000000000063
4825:102D70000000000000000000000000000000000053
4826:102D80000000000000000000000000000000000043
4827:102D90000000000000000000000000000000000033
4828:102DA0000000000000000000000000030000000020
4829:102DB0000000000100000000000000000000000012
4830:102DC0000000000100000000000000010000000001
4831:102DD00000000000000000000000000000000001F2
4832:102DE00000000001000000000000000000000000E2
4833:102DF00000000000000000000100000021000000B1
4834:102E0000120001400000000000000000200000004F
4835:102E1000120000A0000000001200006012000180FB
4836:102E2000120001E0000000000000000000000000AF
4837:102E30000000000100000000000000000000000091
4838:102E40000000000000000000000000000000000280
4839:102E5000000000000000000000030001000000016D
4840:102E60000003020100000000000000000101010158
4841:102E70000101010000010100010100010001000148
4842:0C2E800001000101000001010000000041
4843:00000001FF
4844/* tg2 firmware v12.4.11 */
diff --git a/firmware/adaptec/starfire_rx.bin.ihex b/firmware/adaptec/starfire_rx.bin.ihex
new file mode 100644
index 000000000000..6b1fae0d18eb
--- /dev/null
+++ b/firmware/adaptec/starfire_rx.bin.ihex
@@ -0,0 +1,53 @@
1:10000000010003DC00000000040004210000008661
2:10001000800000150000180E8100001500006664C5
3:100020001A0040AB00000B06142000110000000075
4:10003000142040220000AAAA14204022000003003D
5:1000400014204022000000001A0040AB00000B14F6
6:1000500014200011000000008300001500000002C1
7:10006000040000210000000000000010000000005B
8:1000700004000421000000870000001000000000C0
9:1000800000000010000000000000801500000000CB
10:100090000000003E00000000000000100000000012
11:1000A0008200001500004000009E8050000000000B
12:1000B000030080150000000086008015000000008D
13:1000C00082000015000080000100001C00000000FC
14:1000D000000050A00000010C4E20D011000060086C
15:1000E0001420D012000040080000F09000007000C2
16:1000F0000000C8B0000030000000404000000000D8
17:10010000001080150000000000A2C1500000400057
18:1001100000A400B000000014000000200000000057
19:100120002500400D0000252500047220000031004C
20:10013000009340700000000000000020000000005C
21:1001400000924460000001842B20C01100000000D8
22:100150000000C42000000540360140180000422D78
23:100160001420001100000000009244600000018390
24:100170003200001F0000003402AC00150000000235
25:1001800000A601100000000842200011000000003D
26:1001900000924060000001030000001E000000000B
27:1001A00000000020000001000000001E0000000010
28:1001B00000924460000000860000408000000000C3
29:1001C0000092C0700000000000924060000001003A
30:1001D0000000C8900000500000A6C1100000000000
31:1001E00000B0C09000000012021C001500000000CA
32:1001F0003200001F0000003400924460000005102F
33:100200004421001100000000420000110000000025
34:1002100083000015000000400092446000000508C3
35:100220004501401800004545008080500000000056
36:10023000622080120000000082000015000008000B
37:100240001520001100000000000000100000000058
38:10025000000000100000000000000010000000007E
39:10026000000000100000000000000010000000006E
40:10027000800000150000EEA4810000150000005F62
41:1002800000000060000000000000412000000000AD
42:1002900000004A000000400000924460000001900D
43:1002A0005601401A000059561400001100000000C9
44:1002B0000093405000000018009300500000001808
45:1002C0003601403A0000002D000643A9000000005E
46:1002D0000000C420000001405601401A0000595699
47:1002E00014000011000000000000001000000000D9
48:1002F0000000001000000000000642A900000000FD
49:1003000000024420000001835601401A00005956A3
50:1003100082000015000020001520001100000000E0
51:1003200082000015000000101520001100000000E0
52:1003300082000015000000101520001100000000D0
53:00000001FF
diff --git a/firmware/adaptec/starfire_tx.bin.ihex b/firmware/adaptec/starfire_tx.bin.ihex
new file mode 100644
index 000000000000..6b1fae0d18eb
--- /dev/null
+++ b/firmware/adaptec/starfire_tx.bin.ihex
@@ -0,0 +1,53 @@
1:10000000010003DC00000000040004210000008661
2:10001000800000150000180E8100001500006664C5
3:100020001A0040AB00000B06142000110000000075
4:10003000142040220000AAAA14204022000003003D
5:1000400014204022000000001A0040AB00000B14F6
6:1000500014200011000000008300001500000002C1
7:10006000040000210000000000000010000000005B
8:1000700004000421000000870000001000000000C0
9:1000800000000010000000000000801500000000CB
10:100090000000003E00000000000000100000000012
11:1000A0008200001500004000009E8050000000000B
12:1000B000030080150000000086008015000000008D
13:1000C00082000015000080000100001C00000000FC
14:1000D000000050A00000010C4E20D011000060086C
15:1000E0001420D012000040080000F09000007000C2
16:1000F0000000C8B0000030000000404000000000D8
17:10010000001080150000000000A2C1500000400057
18:1001100000A400B000000014000000200000000057
19:100120002500400D0000252500047220000031004C
20:10013000009340700000000000000020000000005C
21:1001400000924460000001842B20C01100000000D8
22:100150000000C42000000540360140180000422D78
23:100160001420001100000000009244600000018390
24:100170003200001F0000003402AC00150000000235
25:1001800000A601100000000842200011000000003D
26:1001900000924060000001030000001E000000000B
27:1001A00000000020000001000000001E0000000010
28:1001B00000924460000000860000408000000000C3
29:1001C0000092C0700000000000924060000001003A
30:1001D0000000C8900000500000A6C1100000000000
31:1001E00000B0C09000000012021C001500000000CA
32:1001F0003200001F0000003400924460000005102F
33:100200004421001100000000420000110000000025
34:1002100083000015000000400092446000000508C3
35:100220004501401800004545008080500000000056
36:10023000622080120000000082000015000008000B
37:100240001520001100000000000000100000000058
38:10025000000000100000000000000010000000007E
39:10026000000000100000000000000010000000006E
40:10027000800000150000EEA4810000150000005F62
41:1002800000000060000000000000412000000000AD
42:1002900000004A000000400000924460000001900D
43:1002A0005601401A000059561400001100000000C9
44:1002B0000093405000000018009300500000001808
45:1002C0003601403A0000002D000643A9000000005E
46:1002D0000000C420000001405601401A0000595699
47:1002E00014000011000000000000001000000000D9
48:1002F0000000001000000000000642A900000000FD
49:1003000000024420000001835601401A00005956A3
50:1003100082000015000020001520001100000000E0
51:1003200082000015000000101520001100000000E0
52:1003300082000015000000101520001100000000D0
53:00000001FF
diff --git a/firmware/tigon/tg3.bin.ihex b/firmware/tigon/tg3.bin.ihex
new file mode 100644
index 000000000000..d842d7cc91b5
--- /dev/null
+++ b/firmware/tigon/tg3.bin.ihex
@@ -0,0 +1,175 @@
1:10000000000000000800000000000A80000000005E
2:1000100010000003000000000000000D0000000DB3
3:100020003C1D080037BD3FFC03A0F0213C10080038
4:10003000261000000E000018000000000000000D57
5:100040003C1D080037BD3FFC03A0F0213C10080018
6:10005000261000340E00021C000000000000000DFD
7:1000600000000000000000000000000027BDFFE0CD
8:100070003C1CC000AFBF0018AF80680C0E00004CE5
9:10008000241B210597850000978700029782002C8A
10:100090009783002E3C040800248409C0AFA00014FC
11:1000A000000214000062182500052C00AFA3001008
12:1000B0008F86001000E528250E000060240701024D
13:1000C0003C02AC00344201003C03AC01346301004B
14:1000D000AF8204903C02FFFFAF820494AF83049888
15:1000E000AF82049C24020001AF825CE00E00003F5E
16:1000F000AF825D000E000140000000008FBF0018BD
17:1001000003E0000827BD00202402FFFFAF82540453
18:100110008F83540034630400AF835400AF825404CF
19:100120003C02080024420034AF82541C03E0000863
20:10013000AF80540000000000000000003C020800F6
21:10014000344230003C030800346330003C040800B3
22:10015000348437FF3C010800AC220A6424020040CA
23:100160003C010800AC220A683C010800AC200A608F
24:10017000AC600000246300040083102B5040FFFD9E
25:10018000AC60000003E0000800000000008048218F
26:100190008FAA00103C0208008C420A603C04080050
27:1001A0008C840A688FAB0014244300010044102B98
28:1001B0003C010800AC230A60144000030000402109
29:1001C0003C010800AC200A603C0208008C420A6036
30:1001D0003C0308008C630A64912400000002114073
31:1001E000004310210048102125080001A044000010
32:1001F000290200081440FFF4252900013C020800F0
33:100200008C420A603C0308008C630A648F84680C8B
34:100210000002114000431021AC440008AC45000C22
35:10022000AC460010AC470014AC4A001803E00008CC
36:10023000AC4B001C000000000000000000000000AB
37:1002400000000000000000000000000000000000AE
38:10025000000000000000000000000000000000009E
39:10026000000000000000000000000000000000008E
40:10027000000000000000000000000000000000007E
41:10028000000000000000000000000000000000006E
42:10029000000000000000000000000000000000005E
43:1002A000000000000000000000000000000000004E
44:1002B000000000000000000000000000000000003E
45:1002C000000000000000000000000000000000002E
46:1002D000000000000000000000000000000000001E
47:1002E000000000000000000000000000000000000E
48:1002F00000000000000000000000000000000000FE
49:1003000000000000000000000000000002000008E3
50:10031000000000000A0001E33C0A00010A0001E3BA
51:100320003C0A00020A0001E3000000000A0001E3A9
52:10033000000000000A0001E3000000000A0001E3E1
53:10034000000000000A0001E3000000000A0001E3D1
54:10035000000000000A0001E3000000000A0001E3C1
55:10036000000000000A0001E3000000000A0001E3B1
56:100370003C0A00070A0001E33C0A00080A0001E306
57:100380003C0A00090A0001E3000000000A0001E342
58:10039000000000000A0001E33C0A000B0A0001E330
59:1003A0003C0A000C0A0001E33C0A000D0A0001E3CC
60:1003B000000000000A0001E3000000000A0001E361
61:1003C0003C0A000E0A0001E3000000000A0001E3FD
62:1003D000000000000A0001E3000000000A0001E341
63:1003E000000000000A0001E3000000000A0001E331
64:1003F000000000000A0001E3000000000A0001E321
65:10040000000000000A0001E33C0A00130A0001E3B7
66:100410003C0A001400000000000000000000000082
67:1004200000000000000000000000000000000000CC
68:1004300000000000000000000000000000000000BC
69:1004400000000000000000000000000000000000AC
70:10045000000000000000000000000000000000009C
71:10046000000000000000000000000000000000008C
72:10047000000000000000000000000000000000007C
73:10048000000000000000000000000000000000006C
74:10049000000000000000000000000000000000005C
75:1004A000000000000000000000000000000000004C
76:1004B000000000000000000000000000000000003C
77:1004C000000000000000000000000000000000002C
78:1004D000000000000000000000000000000000001C
79:1004E000000000000000000000000000000000000C
80:1004F00000000000000000000000000000000000FC
81:1005000000000000000000000000000027BDFFE028
82:100510000000182100001021AFBF0018AFB1001477
83:10052000AFB000103C01080000220821AC200A7086
84:100530003C01080000220821AC200A743C0108009C
85:1005400000220821AC200A78246300011860FFF51E
86:100550002442000C241100018F9068103202000424
87:1005600014400005240400013C0208008C420A7873
88:1005700018400003000020210E000182000000004E
89:100580003202000110400003000000000E0001696B
90:10059000000000000A000153AF9150288FBF0018DF
91:1005A0008FB100148FB0001003E0000827BD0020B9
92:1005B0003C0508008CA50A703C0608008CC60A8021
93:1005C0003C0708008CE70A7827BDFFE03C040800E0
94:1005D000248409D0AFBF0018AFA000100E00006047
95:1005E000AFA000140E00017B000020218FBF001877
96:1005F00003E0000827BD0020240200018F8368105B
97:1006000000821004000210270062182403E0000892
98:10061000AF83681027BDFFD8AFBF00241080002E25
99:10062000AFB000208F825CECAFA200188F825CEC30
100:100630003C10080026100A78AFA2001C340280008B
101:10064000AF825CEC8E020000184000160000000033
102:100650003C02080094420A748FA3001C000221C0CF
103:10066000AC8300048FA2001C3C0108000E000201B4
104:10067000AC220A7410400005000000008E02000049
105:10068000244200010A0001DFAE0200003C02080023
106:100690008C420A7000021C02000321C00A0001C53E
107:1006A000AFA2001C0E000201000000001040001F5D
108:1006B000000000008E0200008FA3001C24420001F5
109:1006C0003C010800AC230A703C010800AC230A740A
110:1006D0000A0001DFAE0200003C10080026100A7874
111:1006E0008E02000018400028000000000E000201E9
112:1006F0000000000014400024000000008E020000F2
113:100700003C0308008C630A702442FFFFAFA3001C67
114:1007100018400006AE02000000031402000221C0CF
115:100720008C8200043C010800AC220A7097A2001ED3
116:100730002442FF002C4203001440000B240240001E
117:100740003C040800248409DCAFA00010AFA0001412
118:100750008FA6001C240500080E0000600000382150
119:100760000A0001DF00000000AF825CF83C020800D4
120:100770008C420A408FA3001C24420001AF835CF826
121:100780003C010800AC220A408FBF00248FB000203B
122:1007900003E0000827BD002827BDFFE03C04080057
123:1007A000248409E8000028210000302100003821BD
124:1007B000AFBF0018AFA000100E000060AFA0001483
125:1007C0008FBF001803E0000827BD00208F82680C4F
126:1007D0008F85680C000218270003182B00031823CC
127:1007E000004310240044102100A2282B10A0000672
128:1007F00000000000004018218F82680C0043102B7D
129:100800001440FFFD0000000003E0000800000000AD
130:100810003C0408008C8400003C0308008C630A4000
131:100820000064102B54400002008310230064102346
132:100830002C42000803E000083842000127BDFFE019
133:10084000008028213C04080024840A000000302194
134:1008500000003821AFBF0018AFA000100E000060EC
135:10086000AFA000140A000216000000008FBF00189D
136:1008700003E0000827BD00200000000027BDFFE0C6
137:100880003C1CC000AFBF00180E00004CAF80680CCD
138:100890003C04080024840A10038028210000302131
139:1008A00000003821AFA000100E000060AFA00014BF
140:1008B0002402FFFFAF8254043C0200AA0E0002345F
141:1008C000AF8254348FBF001803E0000827BD00201A
142:1008D00000000000000000000000000027BDFFE84D
143:1008E000AFB0001024100001AFBF00143C01C003E2
144:1008F000AC2000008F8268103042200010400003BE
145:10090000000000000E000246000000000A00023A4B
146:10091000AF9054288FBF00148FB0001003E0000880
147:1009200027BD001827BDFFF88F845D0C3C0200FF37
148:100930003C0308008C630A503442FFF80082102404
149:100940001043001E3C0500FF34A5FFF83C06C00321
150:100950003C074000008518248C6200103C01080010
151:10096000AC230A50304200081040000500871025D3
152:100970008CC2000024420001ACC200000087102598
153:10098000AF825D0C8FA2000024420001AFA20000E4
154:100990008FA200008FA2000024420001AFA200003D
155:1009A0008FA200008F845D0C3C0308008C630A500A
156:1009B000008510241443FFE80085182427BD000893
157:1009C00003E000080000000000000000353730316F
158:1009D000726C734100000000000000005377457600
159:1009E000656E743000000000726C704576656E7440
160:1009F00031000000556E6B6E45766E74000000008D
161:100A0000000000000000000000000000666174614A
162:100A10006C45727200000000000000004D61696EBC
163:100A2000437075420000000000000000000000005C
164:100A300000000000000000000000000000000000B6
165:100A400000000000000000000000000000000000A6
166:100A50000000000000000000000000000000000096
167:0C0A60000000000000000000000000008A
168:00000001FF
169 * Firmware is:
170 * Derived from proprietary unpublished source code,
171 * Copyright (C) 2000-2003 Broadcom Corporation.
172 *
173 * Permission is hereby granted for the distribution of this firmware
174 * data in hexadecimal or equivalent format, provided this copyright
175 * notice is accompanying it.
diff --git a/firmware/tigon/tg3_tso.bin.ihex b/firmware/tigon/tg3_tso.bin.ihex
new file mode 100644
index 000000000000..f10c4ef90513
--- /dev/null
+++ b/firmware/tigon/tg3_tso.bin.ihex
@@ -0,0 +1,446 @@
1:100000000106000008000000000024140E00000398
2:100010000000000008001B24000000001000000386
3:10002000000000000000000D0000000D3C1D080055
4:1000300037BD400003A0F0213C100800261000004E
5:100040000E000010000000000000000D27BDFFE0C2
6:100050003C04FEFEAFBF00180E0005D83484000239
7:100060000E000668000000003C03080090631B6857
8:10007000240200023C04080024841AAC1462000329
9:10008000240500013C04080024841AA0240600066C
10:1000900000003821AFA000100E00067CAFA00014B5
11:1000A0008F625C5034420001AF625C508F625C90A2
12:1000B00034420001AF625C902402FFFF0E00003466
13:1000C000AF6254048FBF001803E0000827BD002072
14:1000D00000000000000000000000000027BDFFE05D
15:1000E000AFBF001CAFB20018AFB100140E00005B30
16:1000F000AFB0001024120002241100018F7068209C
17:100100003202010010400003000000000E0000BB9E
18:10011000000000008F7068203202200010400004B0
19:10012000320200010E0001F024040001320200013D
20:1001300010400003000000000E0000A300000000BB
21:100140003C02080090421B9814520003000000007B
22:100150000E0004C0000000000A00003CAF715028EF
23:100160008FBF001C8FB200188FB100148FB0001029
24:1001700003E0000827BD002027BDFFE03C04080085
25:1001800024841AC0000028210000302100003821FA
26:10019000AFBF0018AFA000100E00067CAFA0001487
27:1001A0003C040800248423D8A48000003C010800FB
28:1001B000A0201B983C010800AC201B9C3C010800BF
29:1001C000AC201BA03C010800AC201BA43C01080093
30:1001D000AC201BAC3C010800AC201BB83C01080063
31:1001E000AC201BBC8F6244343C010800AC221B884D
32:1001F0008F6244383C010800AC221B8C8F62441093
33:10020000AC80F7A83C010800AC201B843C0108002E
34:10021000AC2023E03C010800AC2023C83C010800CE
35:10022000AC2023CC3C010800AC2024003C01080099
36:10023000AC221B908F6200682403000700021702A3
37:1002400010430005000000008F62006800021702E2
38:1002500014400004240200013C0108000A00009739
39:10026000AC20240CAC8200343C04080024841ACC5A
40:100270003C0508008CA5240C00003021000038212A
41:10028000AFA000100E00067CAFA000148FBF0018B6
42:1002900003E0000827BD002027BDFFE03C04080064
43:1002A00024841AD8000028210000302100003821C1
44:1002B000AFBF0018AFA000100E00067CAFA0001466
45:1002C0000E00005B000000000E0000B400002021C2
46:1002D0008FBF001803E0000827BD002024020001A2
47:1002E0008F63682000821004000210270062182427
48:1002F00003E00008AF63682027BDFFD0AFBF002C2C
49:10030000AFB60028AFB50024AFB40020AFB3001CD7
50:10031000AFB20018AFB10014AFB000108F675C5CD3
51:100320003C03080024631BBC8C62000014470005DA
52:100330003C0200FF3C02080090421B981440011947
53:100340003C0200FF3442FFF800E28824AC67000062
54:1003500000111902306300FF30E20003000211C0F7
55:100360000062282500A04021000716023C03080077
56:1003700090631B983044000F1460003600804821C1
57:10038000240200013C010800A0221B980005110076
58:10039000008210253C010800AC201B9C3C01080099
59:1003A000AC201BA03C010800AC201BA43C010800B1
60:1003B000AC201BAC3C010800AC201BB83C01080081
61:1003C000AC201BB03C010800AC201BB43C01080071
62:1003D000A42223D89622000C30437FFF3C01080062
63:1003E000A4222410304280003C010800A4231BC634
64:1003F00010400005240200013C010800AC2223F457
65:100400000A0001022406003E240600363C010800D2
66:10041000AC2023F49622000A3C03080094631BC618
67:100420003C010800AC2023F03C010800AC2023F87C
68:10043000000213020002108000C210210062182185
69:100440003C010800A42223D03C0108000A00011549
70:10045000A4231B969622000C3C010800A42223EC46
71:100460003C04080024841B9C8C82000000021100C4
72:100470003C01080000220821AC311BC88C8200001E
73:10048000000211003C01080000220821AC271BCC0F
74:100490008C82000025030001306601FF000211007C
75:1004A0003C01080000220821AC261BD08C820000F1
76:1004B000000211003C01080000220821AC291BD4D5
77:1004C000962300083C0208008C421BAC0043282104
78:1004D0003C010800AC251BAC9622000A3042000407
79:1004E00014400018000611008F630C143063000FD5
80:1004F0002C6200021440000B3C02C0008F630C14FD
81:100500003C0208008C421B403063000F2442000173
82:100510003C010800AC221B402C6200021040FFF797
83:100520003C02C00000E21825AF635C5C8F625C5047
84:100530003042000210400014000000000A00014791
85:10054000000000003C0308008C631B803C04080092
86:1005500094841B94012210253C010800A42223DA74
87:10056000240200013C010800AC221BB824630001F6
88:100570000085202A3C01080010800003AC231B806A
89:100580003C010800A4251B943C06080024C61B9CC3
90:100590008CC2000024420001ACC20000284200804E
91:1005A00014400005000000000E000656240400025E
92:1005B0000A0001E6000000003C0208008C421BB863
93:1005C00010400078240200013C05080090A51B980B
94:1005D00014A20072000000003C15080096B51B969E
95:1005E0003C0408008C841BAC32A3FFFF0083102A5C
96:1005F0001440006C000000001483000300000000A1
97:100600003C010800AC2523F01060005C0000902144
98:1006100024D600040060A02124D300148EC2000060
99:10062000000281003C110800023088210E000625DE
100:100630008E311BC80040282110A00054000000008B
101:100640009628000A31020040104000052407180CCB
102:100650008E22000C2407188C00021400ACA2001893
103:100660003C030800007018218C631BD03C0208007A
104:10067000005010218C421BD400031D000002140006
105:1006800000621825ACA300148EC300049622000853
106:10069000004320233242FFFF3083FFFF004310213D
107:1006A0000282102A1440000202B23023008030215E
108:1006B0008E62000030C4FFFF00441021AE620000D3
109:1006C0008E220000ACA200008E2200048E63FFF494
110:1006D00000431021ACA20004A4A6000E8E62FFF419
111:1006E00000441021AE62FFF4962300080043102A54
112:1006F00014400005024690218E62FFF0AE60FFF4C8
113:1007000024420001AE62FFF0ACA000083242FFFFBD
114:1007100014540008240203053102008054400001F3
115:1007200034E7001024020905A4A2000C0A0001CB42
116:1007300034E70020A4A2000C3C0208008C4223F005
117:10074000104000033C024B650A0001D3344276544A
118:100750003C02B49A344289ABACA2001C30E2FFFFE9
119:10076000ACA200100E0005A200A020213242FFFF23
120:100770000054102B1440FFA90000000024020002C6
121:100780003C0108000A0001E6A0221B988EC2083C2A
122:10079000244200010A0001E6AEC2083C0E0004C07B
123:1007A000000000008FBF002C8FB600288FB50024FA
124:1007B0008FB400208FB3001C8FB200188FB10014CB
125:1007C0008FB0001003E0000827BD003027BDFFD028
126:1007D000AFBF0028AFB30024AFB20020AFB1001C00
127:1007E000AFB000188F725C9C3C0200FF3442FFF8EF
128:1007F0003C07080024E71BB4024288249623000E1D
129:100800008CE2000000431021ACE200008E220010B8
130:100810003042002014400011008098210E00063B59
131:10082000022020213C02C00002421825AF635C9CDC
132:100830008F625C90304200021040011E00000000F8
133:10084000AF635C9C8F625C903042000210400119E3
134:10085000000000000A00020D000000008E240008C5
135:100860008E23001400041402000231C0000315029C
136:10087000304201FF2442FFFF3042007F0003194253
137:1008800030637800000211002442400000624821D9
138:100890009522000A3084FFFF30420008104000B06B
139:1008A000000429C03C0208008C42240014400024AB
140:1008B00024C5000894C200143C010800A42223D0DF
141:1008C0008CC40010000414023C010800A42223D2AE
142:1008D0003C010800A42423D494C2000E3083FFFFFF
143:1008E000004310233C010800AC22240894C2001AE3
144:1008F0003C010800AC2624003C010800AC32240472
145:100900003C010800AC2223FC3C02C0000242182536
146:10091000AF635C9C8F625C9030420002104000E547
147:1009200000000000AF635C9C8F625C90304200026C
148:10093000104000E0000000000A0002460000000035
149:1009400094C2000E3C030800946323D40043402368
150:100950003103FFFF2C6200081040001C0000000063
151:1009600094C200142442002800A22821000310424F
152:100970001840000B0000202124E6084800403821E0
153:1009800094A300008CC200002484000100431021C5
154:10099000ACC200000087102A1440FFF924A5000211
155:1009A000310200011040001F3C0240003C040800DE
156:1009B000248423FCA0A0000194A300008C820000EA
157:1009C000004310210A000285AC8200008F6268009B
158:1009D0003C030010004310241040000900000000F8
159:1009E00094C2001A3C0308008C6323FC00431021CE
160:1009F0003C010800AC2223FC0A0002863C024000B5
161:100A000094C2001A94C4001C3C0308008C6323FCAD
162:100A100000441023006218213C010800AC2323FC91
163:100A20003C02400002421825AF635C9C8F625C90E0
164:100A3000304200021440FFFC000000009522000A32
165:100A4000304200101040009B000000003C030800F2
166:100A5000946323D43C07080024E724008CE40000BE
167:100A60008F62680024630030008328213C0300105B
168:100A7000004310241440000A0000000094A2000467
169:100A80003C0408008C8424083C0308008C6323FC8D
170:100A900000441023006218213C010800AC2323FC11
171:100AA0003C0408008C8423FC00041C023082FFFFFD
172:100AB000006220210004140200822021000410277B
173:100AC000A4A200063C0308008C6324043C0200FF3F
174:100AD0003442FFF8006288249622000824050001B1
175:100AE00024034000000231C000801021A4C2001A7B
176:100AF000A4C0001CACE000003C010800AC251B6059
177:100B0000AF635CB88F625CB03042000210400003FB
178:100B1000000000003C010800AC201B608E22000891
179:100B2000AF625CB88F625CB03042000210400003DC
180:100B3000000000003C010800AC201B603C020800E3
181:100B40008C421B601040FFEC000000003C040800D9
182:100B50000E00063B8C8424040A00032A00000000D7
183:100B60003C03080090631B982402000214620003F7
184:100B70003C034B650A0002E1000080218E22001C2C
185:100B80003463765410430002241000022410000144
186:100B900000C020210E000350020030212402000377
187:100BA0003C010800A0221B98240200021202000A45
188:100BB000240200013C0308008C6323F0106200064D
189:100BC000000000003C020800944223D800021400F8
190:100BD0000A00031FAE2200143C040800248423DA18
191:100BE0009482000000021400AE2200143C020800AF
192:100BF0008C421BBC3C03C0003C010800A0201B9899
193:100C000000431025AF625C5C8F625C503042000292
194:100C100010400009000000002484F7E28C820000EC
195:100C200000431025AF625C5C8F625C503042000272
196:100C30001440FFFA000000003C02080024421B841C
197:100C40008C43000024630001AC4300008F630C144C
198:100C50003063000F2C6200021440000C3C02400084
199:100C60008F630C143C0208008C421B403063000F61
200:100C7000244200013C010800AC221B402C6200020F
201:100C80001040FFF7000000003C024000024218251F
202:100C9000AF635C9C8F625C90304200021440FFFCAA
203:100CA0000000000012600003000000000E0004C0FD
204:100CB000000000008FBF00288FB300248FB20020F7
205:100CC0008FB1001C8FB0001803E0000827BD003072
206:100CD0008F6344503C04080024841B888C820000ED
207:100CE00000031C020043102B144000073C0380004B
208:100CF0008C8400048F62445000021C020083102B7D
209:100D00001040FFFC3C038000AF6344448F624444C6
210:100D1000004310241440FFFD000000008F6244488F
211:100D200003E000083042FFFF3C0240000082202523
212:100D3000AF645C388F625C30304200021440FFFCCC
213:100D40000000000003E000080000000027BDFFE0F5
214:100D50000080582114C00011256E00083C020800D4
215:100D60008C4223F410400007240200163C010800C6
216:100D7000A42223D22402002A3C0108000A000364B2
217:100D8000A42223D48D670010000714023C01080040
218:100D9000A42223D23C010800A42723D43C04080049
219:100DA000948423D43C030800946323D295CF000697
220:100DB0003C020800944223D00083202301E2C02398
221:100DC0003065FFFF24A2002801C248213082FFFFC6
222:100DD00014C0001A012260219582000C3042003FAD
223:100DE0003C010800A42223D69582000495830006C6
224:100DF0003C010800AC2023E43C010800AC2023E8BF
225:100E000000021400004310253C010800AC221BC066
226:100E1000952200043C010800A4221BC49523000273
227:100E200001E510230043102A1040001024020001A5
228:100E30003C0108000A000398AC2223F83C03080098
229:100E40008C6323E83C02080094421BC40043102139
230:100E5000A52200043C02080094421BC0A5820004A5
231:100E60003C0208008C421BC0A58200063C02080020
232:100E70008C4223F03C0D08008DAD23E43C0A0800B1
233:100E8000144000E58D4A23E83C02080094421BC44C
234:100E9000004A18213063FFFF0062182B2402000271
235:100EA00010C2000D014350233C020800944223D697
236:100EB0003042000910400008000000009582000C3C
237:100EC0003042FFF6A582000C3C020800944223D673
238:100ED0003042000901A268233C0208008C4223F83A
239:100EE0001040004A012038213C020800944223D2DD
240:100EF00000004021A520000A01E21023A5220002E3
241:100F00003082FFFF0002104218400008000030212C
242:100F10000040182194E200002508000100C23021A1
243:100F20000103102A1440FFFB24E7000200061C0204
244:100F300030C2FFFF006230210006140200C23021DF
245:100F400000C0282100061027A522000A0000302139
246:100F50002527000C0000402194E200002508000134
247:100F600000C230212D0200041440FFFB24E70002E0
248:100F70009522000200004021912300090044202313
249:100F8000018038213082FFFFA4E0001000621821A8
250:100F9000000210421840001000C3302100404821D8
251:100FA00094E2000024E7000200C2302130E2007F1A
252:100FB00014400006250800018D6300003C02007FFC
253:100FC0003442FF8000625824256700080109102A76
254:100FD0001440FFF3000000003082000110400005C3
255:100FE00000061C02A0E0000194E2000000C23021D3
256:100FF00000061C0230C2FFFF00623021000614020E
257:1010000000C230210A00047D30C6FFFF2402000226
258:1010100014C20081000000003C0208008C42240C35
259:1010200014400007000000003C020800944223D254
260:101030009523000201E210231062007700000000F7
261:101040003C020800944223D201E21023A5220002B0
262:101050003C0208008C42240C1040001A31E3FFFFD0
263:101060008DC700103C02080094421B9600E040210E
264:1010700000072C0200AA20210043102300823823FD
265:101080000007240230E2FFFF00823821000710270A
266:10109000A522000A3102FFFF3C040800948423D4F7
267:1010A0000045302300E0282100641823006D18213A
268:1010B00000C3302100061C0230C2FFFF0A00047D7D
269:1010C0000062302101203821000040213082FFFFE2
270:1010D0000002104218400008000030210040182192
271:1010E00094E200002508000100C230210103102A0B
272:1010F0001440FFFB24E7000200061C0230C2FFFF81
273:10110000006230210006140200C2302100C02821F4
274:1011100000061027A522000A000030212527000C18
275:101120000000402194E200002508000100C23021A7
276:101130002D0200041440FFFB24E700029522000268
277:101140000000402191230009004420230180382120
278:101150003082FFFFA4E000103C040800948423D4F4
279:101160000062182100C3302100061C0230C2FFFFBC
280:101170000062302100061C023C020800944223D089
281:1011800000C348210044102300021FC20043102165
282:1011900000021043184000100000302100402021C0
283:1011A00094E2000024E7000200C2302130E2007F18
284:1011B00014400006250800018D6300003C02007FFA
285:1011C0003442FF8000625824256700080104102A79
286:1011D0001440FFF3000000003C020800944223EC9E
287:1011E00000C230213122FFFF00C2302100061C0264
288:1011F00030C2FFFF006230210006140200C230211D
289:1012000000C0402100061027A5820010ADC00014C8
290:101210000A00049DADC000008DC7001000E0402111
291:101220001140000700072C0200AA3021000614021A
292:1012300030C3FFFF004330210006140200C2282102
293:1012400000051027A522000A3C030800946323D45C
294:101250003102FFFF01E210210043302300CD302195
295:1012600000061C0230C2FFFF00623021000614029B
296:1012700000C2302100C0402100061027A5820010C6
297:101280003102FFFF00051C0000431025ADC2001015
298:101290003C0208008C4223F4104000052DE205EBCF
299:1012A0001440000225E2FFF234028870A5C2003427
300:1012B0003C030800246323E88C6200002442000100
301:1012C000AC6200003C0408008C8423E43C0208006B
302:1012D0008C421BC03303FFFF0083202100431821F1
303:1012E0000062102B3C010800AC2423E410400003F2
304:1012F0002482FFFF3C010800AC2223E43C010800EB
305:10130000AC231BC003E0000827BD002027BDFFB8A9
306:101310003C05080024A51B96AFBF0044AFBE0040AB
307:10132000AFB7003CAFB60038AFB50034AFB4003053
308:10133000AFB3002CAFB20028AFB10024AFB0002093
309:1013400094A900003C020800944223D03C0308000A
310:101350008C631BB03C0408008C841BAC012210235E
311:101360000064182AA7A9001E106000BEA7A20016DC
312:1013700024BE002297B6001E24B3001A24B700161C
313:101380008FC2000014400008000000008FC2FFF868
314:1013900097A300168FC4FFF4004310210082202A77
315:1013A000148000B00000000097D5081832A2FFFF9B
316:1013B000104000A3000090210040A02100008821DF
317:1013C0000E000625000000000040302114C0000778
318:1013D000000000003C0208008C4223DC2442000193
319:1013E0003C0108000A000596AC2223DC3C100800F2
320:1013F000021180218E101BC89608000A310200409D
321:10140000104000052407180C8E02000C2407188CCD
322:1014100000021400ACC200183102008054400001E8
323:1014200034E700103C020800005110218C421BD010
324:101430003C030800007118218C631BD400021500C6
325:1014400000031C0000431025ACC2001496040008E1
326:101450003242FFFF008210210282102A1440000253
327:1014600002B22823008028218E020000024590212C
328:10147000ACC200008E02000400C020212631001002
329:10148000AC82000430E2FFFFAC800008A485000EAF
330:10149000AC820010240203050E0005A2A482000CF9
331:1014A0003242FFFF0054102B1440FFC53242FFFFB1
332:1014B0000A00058E000000008E6200008E63FFFCB3
333:1014C0000043102A10400067000000008E62FFF009
334:1014D000000289003C100800021180210E00062540
335:1014E0008E101BC80040302114C000050000000011
336:1014F0008E62082C244200010A000596AE62082C78
337:101500009608000A31020040104000052407180C1C
338:101510008E02000C2407188C00021400ACC20018C4
339:101520003C020800005110218C421BD03C030800F3
340:10153000007118218C631BD40002150000031C00ED
341:1015400000431025ACC200148E63FFF4960200081D
342:10155000004320233242FFFF3083FFFF004310216E
343:1015600002C2102A104000030080282197A9001E03
344:10157000013228238E62000030A4FFFF00441021B6
345:10158000AE620000A4C5000E8E020000ACC20000D6
346:101590008E0200048E63FFF400431021ACC20004ED
347:1015A0008E63FFF496020008006418210062102A7E
348:1015B00014400006024590218E62FFF0AE60FFF4F9
349:1015C000244200010A000571AE62FFF0AE63FFF431
350:1015D000ACC000083242FFFF105600033102000485
351:1015E000104000062402030531020080544000012F
352:1015F00034E7001034E7002024020905A4C2000CDF
353:101600008EE300008EE20004146200073C02B49AEC
354:101610008EE208605440000134E704003C024B6550
355:101620000A00058834427654344289ABACC2001CAF
356:1016300030E2FFFFACC200100E0005A200C0202166
357:101640003242FFFF0056102B1440FF9B00000000A9
358:101650008E6200008E63FFFC0043102A1440FF4896
359:10166000000000008FBF00448FBE00408FB7003CD9
360:101670008FB600388FB500348FB400308FB3002C94
361:101680008FB200288FB100248FB0002003E0000843
362:1016900027BD004827BDFFE8AFBF0014AFB0001062
363:1016A0008F6244508F6344100A0005B1008080218E
364:1016B0008F626820304220001040000300000000CC
365:1016C0000E0001F0000020218F6244508F6344100F
366:1016D0003042FFFF0043102B1440FFF500000000D4
367:1016E0008F630C143063000F2C6200021440000B57
368:1016F000000000008F630C143C0208008C421B4069
369:101700003063000F244200013C010800AC221B4062
370:101710002C6200021040FFF700000000AF705C1860
371:101720008F625C103042000210400009000000008F
372:101730008F626820304220001040FFF80000000057
373:101740000E0001F0000020210A0005C40000000086
374:101750008FBF00148FB0001003E0000827BD0018F1
375:1017600000000000000000000000000027BDFFE8AE
376:101770003C1BC000AFBF0014AFB00010AF60680CDE
377:101780008F62680434420082AF6268048F63400055
378:1017900024020B503C010800AC221B5424020B789D
379:1017A0003C010800AC221B6434630002AF634000BC
380:1017B0000E000605008080213C010800A0221B6865
381:1017C000304200FF24030002144300050000000023
382:1017D0003C0208008C421B540A0005F8AC5000C0C3
383:1017E0003C0208008C421B54AC5000BC8F62443455
384:1017F0008F6344388F6444103C010800AC221B5CAA
385:101800003C010800AC231B6C3C010800AC241B58B5
386:101810008FBF00148FB0001003E0000827BD001830
387:101820003C0408008C8700003C03AA553463AA5589
388:101830003C06C003AC8300008CC2000014430007C8
389:10184000240500023C0355AA346355AAAC8300006A
390:101850008CC2000050430001240500013C02080036
391:10186000AC47000003E0000800A0102127BDFFF8EE
392:1018700018800009000028218F63680C8F62680CB3
393:101880001043FFFE0000000024A5000100A4102A60
394:101890001440FFF90000000003E0000827BD000825
395:1018A0008F6344503C0208008C421B5C00031C0206
396:1018B0000043102B144000083C0380003C04080047
397:1018C0008C841B6C8F62445000021C020083102B1E
398:1018D0001040FFFC3C038000AF6344448F624444EB
399:1018E000004310241440FFFD000000008F624448B4
400:1018F00003E000083042FFFF3082FFFF2442E00097
401:101900002C422001144000033C0240000A0006481B
402:101910002402FFFF00822025AF645C388F625C30B8
403:10192000304200021440FFFC0000102103E00008D8
404:10193000000000008F6244503C0308008C631B5879
405:101940000A0006513042FFFF8F6244503042FFFFD1
406:101950000043102B1440FFFC0000000003E00008CF
407:101960000000000027BDFFE0008028213C040800A3
408:1019700024841AF00000302100003821AFBF001885
409:10198000AFA000100E00067CAFA000140A00066095
410:10199000000000008FBF001803E0000827BD0020F2
411:1019A0000000000000000000000000003C020800F1
412:1019B000344230003C030800346330003C0408002B
413:1019C000348437FF3C010800AC221B742402004021
414:1019D0003C010800AC221B783C010800AC201B70C5
415:1019E000AC600000246300040083102B5040FFFD16
416:1019F000AC60000003E00008000000000080482107
417:101A00008FAA00103C0208008C421B703C040800A6
418:101A10008C841B788FAB0014244300010044102BEE
419:101A20003C010800AC231B7014400003000040215F
420:101A30003C010800AC201B703C0208008C421B706B
421:101A40003C0308008C631B749124000000021140C9
422:101A5000004310210048102125080001A044000087
423:101A6000290200081440FFF4252900013C02080067
424:101A70008C421B703C0308008C631B748F64680CE1
425:101A80000002114000431021AC440008AC45000C9A
426:101A9000AC460010AC470014AC4A001803E0000844
427:101AA000AC4B001C00000000000000004D61696E9E
428:101AB00043707542000000004D61696E43707541CE
429:101AC00000000000000000000000000073746B6F55
430:101AD00066666C64496E000073746B6F66662A2AD2
431:101AE0000000000053774576656E743000000000FA
432:101AF000000000000000000000000000666174614A
433:101B00006C45727200000000000000000000000040
434:101B100000000000000000000000000000000000C5
435:101B200000000000000000000000000000000000B5
436:101B300073746B6F66666C645F76312E362E300080
437:101B40000000000000000000000000000000000095
438:0C1B500000000000000000000000000089
439:00000001FF
440 * Firmware is:
441 * Derived from proprietary unpublished source code,
442 * Copyright (C) 2000-2003 Broadcom Corporation.
443 *
444 * Permission is hereby granted for the distribution of this firmware
445 * data in hexadecimal or equivalent format, provided this copyright
446 * notice is accompanying it.
diff --git a/firmware/tigon/tg3_tso5.bin.ihex b/firmware/tigon/tg3_tso5.bin.ihex
new file mode 100644
index 000000000000..33672514eab3
--- /dev/null
+++ b/firmware/tigon/tg3_tso5.bin.ihex
@@ -0,0 +1,252 @@
1:10000000010200000001000000000FD80C004003B6
2:100010000000000000010F040000000010000003B9
3:10002000000000000000000D0000000D3C1D00015C
4:1000300037BDE00003A0F0213C10000126100000B5
5:100040000C004010000000000000000D27BDFFE084
6:100050003C04FEFEAFBF00180C0042E834840002EE
7:100060000C004364000000003C03000190630F3467
8:10007000240200023C04000124840E9C146200034C
9:10008000240500013C04000124840E902406000293
10:1000900000003821AFA000100C004378AFA000147E
11:1000A0000C00402C000000008FBF001803E0000887
12:1000B00027BD0020000000000000000027BDFFE079
13:1000C000AFBF001CAFB20018AFB100140C0042D497
14:1000D000AFB000103C128000241100018F70681036
15:1000E0003202040010400007000000008F64100876
16:1000F0000092102414400003000000000C00406433
17:10010000000000003C02000190420F561051000315
18:10011000320202001040FFF1000000000C0041B468
19:100120000000000008004034000000008FBF001CE9
20:100130008FB200188FB100148FB0001003E00008D8
21:1001400027BD002027BDFFE03C04000124840EB041
22:10015000000028210000302100003821AFBF001826
23:10016000AFA000100C004378AFA000140000D02115
24:1001700024020130AF6250003C010001A4200F5066
25:100180003C010001A0200F578FBF001803E00008BA
26:1001900027BD002000000000000000003C0300011B
27:1001A00024630F609062000027BDFFF0144000033D
28:1001B0000080C02108004073000048213C0220005C
29:1001C00003021024104000032409000208004073B9
30:1001D000A0600000240900010018104030431F8077
31:1001E000346F80081520004B25EB00283C040001EB
32:1001F000008320218C8480103C05000124A50F7A07
33:1002000000041402A0A200003C010001A0240F7B06
34:100210003C02000100431021944280143C01000183
35:10022000A0220F7C3C0C0001018360218D8C801882
36:10023000304200FF24420008000220C324020001D3
37:100240003C010001A0220F600124102B1040000C83
38:100250000000382124A6000E016028218CA2000095
39:100260008CA3000424A5000824E70001ACC2000010
40:10027000ACC3000400E4102B1440FFF824C60008AF
41:10028000000038213C08000125080F7B9106000082
42:100290003C02000190420F7C2503000D00C3282181
43:1002A0000046102300021FC2004310210002104329
44:1002B0001840000C0000202191020001004610238C
45:1002C00000021FC2004310210002184394A2000044
46:1002D00024E700010082202100E3102A1440FFFBE4
47:1002E00024A5000200041C023082FFFF00622021CE
48:1002F00000041402008220213C02FFFF018210242E
49:100300003083FFFF004310253C010001080040FA44
50:10031000AC220F803C05000124A50F7C90A20000B8
51:100320003C0C0001018360218D8C8018000220C2EA
52:100330001080000E000038210160302124A5000C3F
53:100340008CA200008CA3000424A5000824E700016F
54:10035000ACC20000ACC3000400E4102B1440FFF852
55:1003600024C600083C05000124A50F7C90A20000D3
56:1003700030430007240200041062001128620005C7
57:10038000104000052402000210620008000710C09F
58:10039000080040FA00000000240200061062000E6F
59:1003A000000710C0080040FA0000000000A2182159
60:1003B0009463000C004B1021080040FAA443000095
61:1003C000000710C000A218218C63000C004B102104
62:1003D000080040FAAC43000000A218218C63000C16
63:1003E000004B202100A21021AC8300009442001099
64:1003F000A482000495E700063C02000190420F7CB5
65:100400003C03000190630F7A00E2C8233C02000124
66:1004100090420F7B2463002801E3402124420028FE
67:100420001520001201E2302194C2000C3C010001B1
68:10043000A4220F7894C2000494C300063C0100017A
69:10044000A4200F763C010001A4200F7200021400CA
70:10045000004310253C010001AC220F6C9502000402
71:100460003C01000108004124A4220F703C0200015D
72:1004700094420F703C03000194630F7200431021FB
73:10048000A50200043C02000194420F6CA4C20004C7
74:100490003C0200018C420F6CA4C200063C04000127
75:1004A00094840F723C02000194420F703C0A0001D8
76:1004B000954A0F76004418213063FFFF0062182A26
77:1004C000240200021122000B008320233C030001C0
78:1004D00094630F7830620009104000063062FFF626
79:1004E000A4C2000C3C02000194420F783042000983
80:1004F00001425023240200011122001B2922000284
81:1005000050400005240200021120000731A2FFFF25
82:1005100008004197000000001122001D240200166F
83:100520000800419731A2FFFF3C0E000195CE0F80DD
84:10053000108000050180682101C4202100041C02F4
85:100540003082FFFF00627021000E1027A502000A12
86:100550003C03000190630F7B31A2FFFF00E21021FA
87:100560000800418D004320233C02000194420F808B
88:100570000044202100041C023082FFFF0062202181
89:10058000008070210004102708004185A502000AA0
90:100590003C05000124A50F7A90A30000146200021C
91:1005A00024E2FFF2A5E2003490A2000000E2102352
92:1005B000A50200023C03000194630F803C0200018D
93:1005C00094420F5A30E5FFFF0064182100451023C4
94:1005D0000062202300041C023082FFFF0062202101
95:1005E00000041027A502000A3C03000190630F7C61
96:1005F0002462000114A20005008070210163102113
97:10060000904200000800418500026200246200025E
98:1006100014A20003306200FE004B1021944C000035
99:100620003C02000194420F823183FFFF3C04000131
100:1006300090840F7B0043102100E21021004420230E
101:10064000008A202100041C023082FFFF006220216A
102:100650000004140200822021008068210004102779
103:10066000A4C2001031A2FFFF000E1C0000431025A1
104:100670003C04000124840F72ADE20010948200005B
105:100680003C05000194A50F763C0300018C630F6CC0
106:100690002442000100B92821A48200003322FFFF78
107:1006A000006220210083182B3C010001A4250F7655
108:1006B0001060000324A2FFFF3C010001A4220F767A
109:1006C0003C024000030210253C010001AC240F6CE9
110:1006D000AF62100803E0000827BD00103C030001D2
111:1006E00090630F5627BDFFE824020001AFBF00143E
112:1006F00010620026AFB000108F620CF42442FFFF9E
113:100700003042007F000211008C4340003C01000198
114:10071000AC230F648C434008244440008C5C4004AC
115:1007200030620040144000022402008824020008C5
116:100730003C010001A4220F68306200041040000553
117:10074000240200013C010001A0220F57080041D5FE
118:10075000000314023C010001A0200F570003140203
119:100760003C010001A4220F549483000C24020001D8
120:100770003C010001A4200F503C010001A0220F56B3
121:100780003C010001A4230F62240200011342001E59
122:10079000000000001340000524020003134200671C
123:1007A00000000000080042CF000000003C020001F1
124:1007B00094420F62241A00013C010001A4200F5E44
125:1007C0003C010001A4200F52304407FF00021BC26D
126:1007D000000318233063003E3463003600021242E7
127:1007E0003042003C006218213C010001A4240F5853
128:1007F00000832021246300303C010001A4240F5A0F
129:100800003C010001A4230F5C3C06000124C60F52EA
130:1008100094C5000094C300023C04000194840F5A64
131:10082000006510210044102A104000133C10800085
132:1008300000A31021A4C200003C02A000AF620CF48F
133:100840003C010001A0200F568F6410080090102476
134:1008500014400003000000000C0040640000000091
135:100860008F620CF400501024104000B7000000000C
136:100870000800420F000000003C03000194630F5089
137:1008800000851023A4C40000006218213042FFFF3D
138:100890003C010001A4230F50AF620CE83C020001B0
139:1008A00094420F6834420024AF620CEC94C30002FF
140:1008B0003C02000194420F50146200123C0280007E
141:1008C0003C1080003C02A000AF620CF43C0100012F
142:1008D000A0200F568F6410080090102414400003CD
143:1008E000000000000C004064000000008F620CF467
144:1008F000005010241440FFF700000000080042CF11
145:10090000241A0003AF620CF43C1080008F641008BE
146:100910000090102414400003000000000C0040640C
147:10092000000000008F620CF4005010241440FFF708
148:1009300000000000080042CF241A00033C07000119
149:1009400024E70F5094E2000003821021AF620CE014
150:100950003C0200018C420F64AF620CE43C050001D4
151:1009600094A50F5494E300003C04000194840F58B4
152:100970003C02000194420F5E00A328230082202342
153:1009800030A6FFFF3083FFFF00C3102B144000434D
154:10099000000000003C02000194420F5C00021400C1
155:1009A00000621025AF620CE894E200003C030001F5
156:1009B00094630F5400441021A4E200003042FFFF72
157:1009C000144300213C0200083C02000190420F57F2
158:1009D000104000063C03000C3C02000194420F68EA
159:1009E000346306240800427C0000D0213C02000150
160:1009F00094420F683C03000834630624004310252A
161:100A0000AF620CEC3C1080003C02A000AF620CF422
162:100A10003C010001A0200F568F64100800901024A4
163:100A200014400003000000000C00406400000000BF
164:100A30008F620CF4005010241040001500000000DC
165:100A400008004283000000003C03000194630F682B
166:100A5000344206243C108000006218253C028000CD
167:100A6000AF630CECAF620CF48F641008009010249C
168:100A700014400003000000000C004064000000006F
169:100A80008F620CF4005010241440FFF700000000A7
170:100A90003C010001080042CFA4200F5E3C0200018F
171:100AA00094420F5C0002140000C21025AF620CE8F3
172:100AB0003C02000190420F57104000093C03000C1B
173:100AC0003C02000194420F68346306240000D021E8
174:100AD00000431025AF620CEC080042C13C108000BE
175:100AE0003C02000194420F683C0300083463060492
176:100AF00000431025AF620CEC3C02000194420F5EF3
177:100B0000004510213C010001A4220F5E3C10800032
178:100B10003C02A000AF620CF43C010001A0200F5683
179:100B20008F6410080090102414400003000000009F
180:100B30000C004064000000008F620CF40050102490
181:100B40001440FFF7000000008FBF00148FB00010AA
182:100B500003E0000827BD00180000000027BDFFE0EB
183:100B60003C04000124840EC0000028210000302134
184:100B700000003821AFBF0018AFA000100C00437870
185:100B8000AFA000140000D02124020130AF62500059
186:100B90003C010001A4200F503C010001A0200F5790
187:100BA0008FBF001803E0000827BD002027BDFFE825
188:100BB0003C1BC000AFBF0014AFB00010AF60680CAA
189:100BC0008F62680434420082AF6268048F63400021
190:100BD00024020B503C010001AC220F2024020B78B0
191:100BE0003C010001AC220F3034630002AF634000CF
192:100BF0000C004315008080213C010001A0220F342D
193:100C0000304200FF240300021443000500000000EE
194:100C10003C0200018C420F2008004308AC5000C089
195:100C20003C0200018C420F20AC5000BC8F62443467
196:100C30008F6344388F6444103C010001AC220F28BC
197:100C40003C010001AC230F383C010001AC240F240F
198:100C50008FBF00148FB0001003E0000827BD0018FC
199:100C600003E000082402000127BDFFF818800009F6
200:100C7000000028218F63680C8F62680C1043FFFE10
201:100C80000000000024A5000100A4102A1440FFF970
202:100C90000000000003E0000827BD00088F634450F7
203:100CA0003C0200018C420F2800031C020043102B61
204:100CB000144000083C0380003C0400018C840F3881
205:100CC0008F62445000021C020083102B1040FFFC76
206:100CD0003C038000AF6344448F62444400431024CB
207:100CE0001440FFFD000000008F62444803E000084C
208:100CF0003042FFFF3082FFFF2442E0002C422001FF
209:100D0000144000033C024000080043472402FFFF58
210:100D100000822025AF645C388F625C303042000274
211:100D20001440FFFC0000102103E000080000000058
212:100D30008F6244503C0300018C630F240800435031
213:100D40003042FFFF8F6244503042FFFF0043102BC0
214:100D50001440FFFC0000000003E000080000000059
215:100D600027BDFFE0008028213C04000124840ED030
216:100D70000000302100003821AFBF0018AFA00010E4
217:100D80000C004378AFA000140800435F000000008F
218:100D90008FBF001803E0000827BD00203C020001BF
219:100DA0003442D6003C0300013463D6003C04000109
220:100DB0003484DDFF3C010001AC220F4024020040DE
221:100DC0003C010001AC220F443C010001AC200F3C6F
222:100DD000AC600000246300040083102B5040FFFD32
223:100DE000AC60000003E00008000000000080482123
224:100DF0008FAA00103C0200018C420F3C3C04000111
225:100E00008C840F448FAB0014244300010044102B4A
226:100E10003C010001AC230F3C1440000300004021C2
227:100E20003C010001AC200F3C3C0200018C420F3C15
228:100E30003C0300018C630F4091240000000211402C
229:100E4000004310210048102125080001A0440000A3
230:100E5000290200081440FFF4252900013C0200018A
231:100E60008C420F3C3C0300018C630F408F64680C84
232:100E70000002114000431021AC440008AC45000CB6
233:100E8000AC460010AC470014AC4A001803E0000860
234:100E9000AC4B001C00000000000000004D61696EBA
235:100EA00043707542000000004D61696E43707541EA
236:100EB00000000000000000000000000073746B6F71
237:100EC00066666C64000000000000000073746B6FC5
238:100ED00066666C64000000000000000066617461DA
239:100EE0006C4572720000000000000000000000006D
240:100EF00000000000000000000000000000000000F2
241:100F000000000000000000000000000000000000E1
242:100F100073746B6F66666C645F76312E322E3000B0
243:0C0F2000000000000000000000000000C5
244:00000001FF
245 * Firmware is:
246 * Derived from proprietary unpublished source code,
247 * Copyright (C) 2000-2003 Broadcom Corporation.
248 *
249 * Permission is hereby granted for the distribution of this firmware
250 * data in hexadecimal or equivalent format, provided this copyright
251 * notice is accompanying it.
252/* 5705 needs a special version of the TSO firmware. */
diff --git a/fs/Kconfig b/fs/Kconfig
index ff0e81980207..f9b6e2979aaa 100644
--- a/fs/Kconfig
+++ b/fs/Kconfig
@@ -189,6 +189,8 @@ config OCFS2_FS
189 select CONFIGFS_FS 189 select CONFIGFS_FS
190 select JBD2 190 select JBD2
191 select CRC32 191 select CRC32
192 select QUOTA
193 select QUOTA_TREE
192 help 194 help
193 OCFS2 is a general purpose extent based shared disk cluster file 195 OCFS2 is a general purpose extent based shared disk cluster file
194 system with many similarities to ext3. It supports 64 bit inode 196 system with many similarities to ext3. It supports 64 bit inode
@@ -258,15 +260,14 @@ config OCFS2_DEBUG_FS
258 this option for debugging only as it is likely to decrease 260 this option for debugging only as it is likely to decrease
259 performance of the filesystem. 261 performance of the filesystem.
260 262
261config OCFS2_COMPAT_JBD 263config OCFS2_FS_POSIX_ACL
262 bool "Use JBD for compatibility" 264 bool "OCFS2 POSIX Access Control Lists"
263 depends on OCFS2_FS 265 depends on OCFS2_FS
266 select FS_POSIX_ACL
264 default n 267 default n
265 select JBD
266 help 268 help
267 The ocfs2 filesystem now uses JBD2 for its journalling. JBD2 269 Posix Access Control Lists (ACLs) support permissions for users and
268 is backwards compatible with JBD. It is safe to say N here. 270 groups beyond the owner/group/world scheme.
269 However, if you really want to use the original JBD, say Y here.
270 271
271endif # BLOCK 272endif # BLOCK
272 273
@@ -303,6 +304,10 @@ config PRINT_QUOTA_WARNING
303 Note that this behavior is currently deprecated and may go away in 304 Note that this behavior is currently deprecated and may go away in
304 future. Please use notification via netlink socket instead. 305 future. Please use notification via netlink socket instead.
305 306
307# Generic support for tree structured quota files. Seleted when needed.
308config QUOTA_TREE
309 tristate
310
306config QFMT_V1 311config QFMT_V1
307 tristate "Old quota format support" 312 tristate "Old quota format support"
308 depends on QUOTA 313 depends on QUOTA
@@ -314,6 +319,7 @@ config QFMT_V1
314config QFMT_V2 319config QFMT_V2
315 tristate "Quota format v2 support" 320 tristate "Quota format v2 support"
316 depends on QUOTA 321 depends on QUOTA
322 select QUOTA_TREE
317 help 323 help
318 This quota format allows using quotas with 32-bit UIDs/GIDs. If you 324 This quota format allows using quotas with 32-bit UIDs/GIDs. If you
319 need this functionality say Y here. 325 need this functionality say Y here.
diff --git a/fs/Makefile b/fs/Makefile
index e6f423d1d228..c830611550d3 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_GENERIC_ACL) += generic_acl.o
54obj-$(CONFIG_QUOTA) += dquot.o 54obj-$(CONFIG_QUOTA) += dquot.o
55obj-$(CONFIG_QFMT_V1) += quota_v1.o 55obj-$(CONFIG_QFMT_V1) += quota_v1.o
56obj-$(CONFIG_QFMT_V2) += quota_v2.o 56obj-$(CONFIG_QFMT_V2) += quota_v2.o
57obj-$(CONFIG_QUOTA_TREE) += quota_tree.o
57obj-$(CONFIG_QUOTACTL) += quota.o 58obj-$(CONFIG_QUOTACTL) += quota.o
58 59
59obj-$(CONFIG_PROC_FS) += proc/ 60obj-$(CONFIG_PROC_FS) += proc/
diff --git a/fs/affs/inode.c b/fs/affs/inode.c
index 415d9c67ac16..3c4ec7d864c4 100644
--- a/fs/affs/inode.c
+++ b/fs/affs/inode.c
@@ -119,8 +119,7 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino)
119 goto bad_inode; 119 goto bad_inode;
120#else 120#else
121 inode->i_mode |= S_IFDIR; 121 inode->i_mode |= S_IFDIR;
122 inode->i_op = NULL; 122 /* ... and leave ->i_op and ->i_fop pointing to empty */
123 inode->i_fop = NULL;
124 break; 123 break;
125#endif 124#endif
126 case ST_LINKFILE: 125 case ST_LINKFILE:
diff --git a/fs/autofs/inode.c b/fs/autofs/inode.c
index c773680d5c60..e1734f2d6e26 100644
--- a/fs/autofs/inode.c
+++ b/fs/autofs/inode.c
@@ -251,13 +251,11 @@ struct inode *autofs_iget(struct super_block *sb, unsigned long ino)
251 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO; 251 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO;
252 inode->i_nlink = 2; 252 inode->i_nlink = 2;
253 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 253 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
254 inode->i_blocks = 0;
255 254
256 if (ino == AUTOFS_ROOT_INO) { 255 if (ino == AUTOFS_ROOT_INO) {
257 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 256 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
258 inode->i_op = &autofs_root_inode_operations; 257 inode->i_op = &autofs_root_inode_operations;
259 inode->i_fop = &autofs_root_operations; 258 inode->i_fop = &autofs_root_operations;
260 inode->i_uid = inode->i_gid = 0; /* Changed in read_super */
261 goto done; 259 goto done;
262 } 260 }
263 261
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 7b19802cfef4..cfc23e53b6f4 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -455,11 +455,7 @@ struct inode *autofs4_get_inode(struct super_block *sb,
455 if (sb->s_root) { 455 if (sb->s_root) {
456 inode->i_uid = sb->s_root->d_inode->i_uid; 456 inode->i_uid = sb->s_root->d_inode->i_uid;
457 inode->i_gid = sb->s_root->d_inode->i_gid; 457 inode->i_gid = sb->s_root->d_inode->i_gid;
458 } else {
459 inode->i_uid = 0;
460 inode->i_gid = 0;
461 } 458 }
462 inode->i_blocks = 0;
463 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 459 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
464 460
465 if (S_ISDIR(inf->mode)) { 461 if (S_ISDIR(inf->mode)) {
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index f2744ab4e5b3..e1158cb4fbd6 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -496,9 +496,6 @@ static struct inode *bm_get_inode(struct super_block *sb, int mode)
496 496
497 if (inode) { 497 if (inode) {
498 inode->i_mode = mode; 498 inode->i_mode = mode;
499 inode->i_uid = 0;
500 inode->i_gid = 0;
501 inode->i_blocks = 0;
502 inode->i_atime = inode->i_mtime = inode->i_ctime = 499 inode->i_atime = inode->i_mtime = inode->i_ctime =
503 current_fs_time(inode->i_sb); 500 current_fs_time(inode->i_sb);
504 } 501 }
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index f247da9f4edc..5ab9896fdcb2 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -1641,7 +1641,7 @@ do_expand:
1641 i_size_write(inode, offset); 1641 i_size_write(inode, offset);
1642 spin_unlock(&inode->i_lock); 1642 spin_unlock(&inode->i_lock);
1643out_truncate: 1643out_truncate:
1644 if (inode->i_op && inode->i_op->truncate) 1644 if (inode->i_op->truncate)
1645 inode->i_op->truncate(inode); 1645 inode->i_op->truncate(inode);
1646 return 0; 1646 return 0;
1647out_sig: 1647out_sig:
diff --git a/fs/coda/file.c b/fs/coda/file.c
index 466303db2df6..6a347fbc998a 100644
--- a/fs/coda/file.c
+++ b/fs/coda/file.c
@@ -201,8 +201,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file)
201int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync) 201int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
202{ 202{
203 struct file *host_file; 203 struct file *host_file;
204 struct dentry *host_dentry; 204 struct inode *coda_inode = coda_dentry->d_inode;
205 struct inode *host_inode, *coda_inode = coda_dentry->d_inode;
206 struct coda_file_info *cfi; 205 struct coda_file_info *cfi;
207 int err = 0; 206 int err = 0;
208 207
@@ -214,14 +213,7 @@ int coda_fsync(struct file *coda_file, struct dentry *coda_dentry, int datasync)
214 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); 213 BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC);
215 host_file = cfi->cfi_container; 214 host_file = cfi->cfi_container;
216 215
217 if (host_file->f_op && host_file->f_op->fsync) { 216 err = vfs_fsync(host_file, host_file->f_path.dentry, datasync);
218 host_dentry = host_file->f_path.dentry;
219 host_inode = host_dentry->d_inode;
220 mutex_lock(&host_inode->i_mutex);
221 err = host_file->f_op->fsync(host_file, host_dentry, datasync);
222 mutex_unlock(&host_inode->i_mutex);
223 }
224
225 if ( !err && !datasync ) { 217 if ( !err && !datasync ) {
226 lock_kernel(); 218 lock_kernel();
227 err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode)); 219 err = venus_fsync(coda_inode->i_sb, coda_i2f(coda_inode));
diff --git a/fs/configfs/inode.c b/fs/configfs/inode.c
index 4803ccc94480..5d349d38e056 100644
--- a/fs/configfs/inode.c
+++ b/fs/configfs/inode.c
@@ -117,8 +117,6 @@ int configfs_setattr(struct dentry * dentry, struct iattr * iattr)
117static inline void set_default_inode_attr(struct inode * inode, mode_t mode) 117static inline void set_default_inode_attr(struct inode * inode, mode_t mode)
118{ 118{
119 inode->i_mode = mode; 119 inode->i_mode = mode;
120 inode->i_uid = 0;
121 inode->i_gid = 0;
122 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 120 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
123} 121}
124 122
@@ -136,7 +134,6 @@ struct inode * configfs_new_inode(mode_t mode, struct configfs_dirent * sd)
136{ 134{
137 struct inode * inode = new_inode(configfs_sb); 135 struct inode * inode = new_inode(configfs_sb);
138 if (inode) { 136 if (inode) {
139 inode->i_blocks = 0;
140 inode->i_mapping->a_ops = &configfs_aops; 137 inode->i_mapping->a_ops = &configfs_aops;
141 inode->i_mapping->backing_dev_info = &configfs_backing_dev_info; 138 inode->i_mapping->backing_dev_info = &configfs_backing_dev_info;
142 inode->i_op = &configfs_inode_operations; 139 inode->i_op = &configfs_inode_operations;
diff --git a/fs/cramfs/inode.c b/fs/cramfs/inode.c
index f40423eb1a14..a07338d2d140 100644
--- a/fs/cramfs/inode.c
+++ b/fs/cramfs/inode.c
@@ -83,8 +83,6 @@ static struct inode *get_cramfs_inode(struct super_block *sb,
83 inode->i_op = &page_symlink_inode_operations; 83 inode->i_op = &page_symlink_inode_operations;
84 inode->i_data.a_ops = &cramfs_aops; 84 inode->i_data.a_ops = &cramfs_aops;
85 } else { 85 } else {
86 inode->i_size = 0;
87 inode->i_blocks = 0;
88 init_special_inode(inode, inode->i_mode, 86 init_special_inode(inode, inode->i_mode,
89 old_decode_dev(cramfs_inode->size)); 87 old_decode_dev(cramfs_inode->size));
90 } 88 }
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 3dbe2169cf36..81ae9ea3c6e1 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -37,9 +37,6 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
37 37
38 if (inode) { 38 if (inode) {
39 inode->i_mode = mode; 39 inode->i_mode = mode;
40 inode->i_uid = 0;
41 inode->i_gid = 0;
42 inode->i_blocks = 0;
43 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 40 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
44 switch (mode & S_IFMT) { 41 switch (mode & S_IFMT) {
45 default: 42 default:
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index fff96e152c0c..5f3231b9633f 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -189,8 +189,6 @@ static int mknod_ptmx(struct super_block *sb)
189 } 189 }
190 190
191 inode->i_ino = 2; 191 inode->i_ino = 2;
192 inode->i_uid = inode->i_gid = 0;
193 inode->i_blocks = 0;
194 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 192 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
195 193
196 mode = S_IFCHR|opts->ptmxmode; 194 mode = S_IFCHR|opts->ptmxmode;
@@ -300,8 +298,6 @@ devpts_fill_super(struct super_block *s, void *data, int silent)
300 goto free_fsi; 298 goto free_fsi;
301 inode->i_ino = 1; 299 inode->i_ino = 1;
302 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 300 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
303 inode->i_blocks = 0;
304 inode->i_uid = inode->i_gid = 0;
305 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; 301 inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR;
306 inode->i_op = &simple_dir_inode_operations; 302 inode->i_op = &simple_dir_inode_operations;
307 inode->i_fop = &simple_dir_operations; 303 inode->i_fop = &simple_dir_operations;
diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c
index 8bf31e3fbf01..dc2ad6008b2d 100644
--- a/fs/dlm/ast.c
+++ b/fs/dlm/ast.c
@@ -2,7 +2,7 @@
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved. 4** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
5** Copyright (C) 2004-2005 Red Hat, Inc. All rights reserved. 5** Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
6** 6**
7** This copyrighted material is made available to anyone wishing to use, 7** This copyrighted material is made available to anyone wishing to use,
8** modify, copy, or redistribute it subject to the terms and conditions 8** modify, copy, or redistribute it subject to the terms and conditions
@@ -33,10 +33,10 @@ void dlm_del_ast(struct dlm_lkb *lkb)
33 spin_unlock(&ast_queue_lock); 33 spin_unlock(&ast_queue_lock);
34} 34}
35 35
36void dlm_add_ast(struct dlm_lkb *lkb, int type) 36void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
37{ 37{
38 if (lkb->lkb_flags & DLM_IFL_USER) { 38 if (lkb->lkb_flags & DLM_IFL_USER) {
39 dlm_user_add_ast(lkb, type); 39 dlm_user_add_ast(lkb, type, bastmode);
40 return; 40 return;
41 } 41 }
42 42
@@ -46,6 +46,8 @@ void dlm_add_ast(struct dlm_lkb *lkb, int type)
46 list_add_tail(&lkb->lkb_astqueue, &ast_queue); 46 list_add_tail(&lkb->lkb_astqueue, &ast_queue);
47 } 47 }
48 lkb->lkb_ast_type |= type; 48 lkb->lkb_ast_type |= type;
49 if (bastmode)
50 lkb->lkb_bastmode = bastmode;
49 spin_unlock(&ast_queue_lock); 51 spin_unlock(&ast_queue_lock);
50 52
51 set_bit(WAKE_ASTS, &astd_wakeflags); 53 set_bit(WAKE_ASTS, &astd_wakeflags);
@@ -59,50 +61,40 @@ static void process_asts(void)
59 struct dlm_lkb *lkb; 61 struct dlm_lkb *lkb;
60 void (*cast) (void *astparam); 62 void (*cast) (void *astparam);
61 void (*bast) (void *astparam, int mode); 63 void (*bast) (void *astparam, int mode);
62 int type = 0, found, bmode; 64 int type = 0, bastmode;
63 65
64 for (;;) { 66repeat:
65 found = 0; 67 spin_lock(&ast_queue_lock);
66 spin_lock(&ast_queue_lock); 68 list_for_each_entry(lkb, &ast_queue, lkb_astqueue) {
67 list_for_each_entry(lkb, &ast_queue, lkb_astqueue) { 69 r = lkb->lkb_resource;
68 r = lkb->lkb_resource; 70 ls = r->res_ls;
69 ls = r->res_ls; 71
70 72 if (dlm_locking_stopped(ls))
71 if (dlm_locking_stopped(ls)) 73 continue;
72 continue;
73
74 list_del(&lkb->lkb_astqueue);
75 type = lkb->lkb_ast_type;
76 lkb->lkb_ast_type = 0;
77 found = 1;
78 break;
79 }
80 spin_unlock(&ast_queue_lock);
81 74
82 if (!found) 75 list_del(&lkb->lkb_astqueue);
83 break; 76 type = lkb->lkb_ast_type;
77 lkb->lkb_ast_type = 0;
78 bastmode = lkb->lkb_bastmode;
84 79
80 spin_unlock(&ast_queue_lock);
85 cast = lkb->lkb_astfn; 81 cast = lkb->lkb_astfn;
86 bast = lkb->lkb_bastfn; 82 bast = lkb->lkb_bastfn;
87 bmode = lkb->lkb_bastmode;
88 83
89 if ((type & AST_COMP) && cast) 84 if ((type & AST_COMP) && cast)
90 cast(lkb->lkb_astparam); 85 cast(lkb->lkb_astparam);
91 86
92 /* FIXME: Is it safe to look at lkb_grmode here
93 without doing a lock_rsb() ?
94 Look at other checks in v1 to avoid basts. */
95
96 if ((type & AST_BAST) && bast) 87 if ((type & AST_BAST) && bast)
97 if (!dlm_modes_compat(lkb->lkb_grmode, bmode)) 88 bast(lkb->lkb_astparam, bastmode);
98 bast(lkb->lkb_astparam, bmode);
99 89
100 /* this removes the reference added by dlm_add_ast 90 /* this removes the reference added by dlm_add_ast
101 and may result in the lkb being freed */ 91 and may result in the lkb being freed */
102 dlm_put_lkb(lkb); 92 dlm_put_lkb(lkb);
103 93
104 schedule(); 94 cond_resched();
95 goto repeat;
105 } 96 }
97 spin_unlock(&ast_queue_lock);
106} 98}
107 99
108static inline int no_asts(void) 100static inline int no_asts(void)
diff --git a/fs/dlm/ast.h b/fs/dlm/ast.h
index 6ee276c74c52..1b5fc5f428fd 100644
--- a/fs/dlm/ast.h
+++ b/fs/dlm/ast.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5** 5**
6** This copyrighted material is made available to anyone wishing to use, 6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions 7** modify, copy, or redistribute it subject to the terms and conditions
@@ -13,7 +13,7 @@
13#ifndef __ASTD_DOT_H__ 13#ifndef __ASTD_DOT_H__
14#define __ASTD_DOT_H__ 14#define __ASTD_DOT_H__
15 15
16void dlm_add_ast(struct dlm_lkb *lkb, int type); 16void dlm_add_ast(struct dlm_lkb *lkb, int type, int bastmode);
17void dlm_del_ast(struct dlm_lkb *lkb); 17void dlm_del_ast(struct dlm_lkb *lkb);
18 18
19void dlm_astd_wake(void); 19void dlm_astd_wake(void);
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index 8fc24f4507a3..2f107d1a6a45 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2******************************************************************************* 2*******************************************************************************
3** 3**
4** Copyright (C) 2005 Red Hat, Inc. All rights reserved. 4** Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved.
5** 5**
6** This copyrighted material is made available to anyone wishing to use, 6** This copyrighted material is made available to anyone wishing to use,
7** modify, copy, or redistribute it subject to the terms and conditions 7** modify, copy, or redistribute it subject to the terms and conditions
@@ -27,7 +27,7 @@ static struct dentry *dlm_root;
27 27
28struct rsb_iter { 28struct rsb_iter {
29 int entry; 29 int entry;
30 int locks; 30 int format;
31 int header; 31 int header;
32 struct dlm_ls *ls; 32 struct dlm_ls *ls;
33 struct list_head *next; 33 struct list_head *next;
@@ -60,8 +60,8 @@ static char *print_lockmode(int mode)
60 } 60 }
61} 61}
62 62
63static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb, 63static void print_format1_lock(struct seq_file *s, struct dlm_lkb *lkb,
64 struct dlm_rsb *res) 64 struct dlm_rsb *res)
65{ 65{
66 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode)); 66 seq_printf(s, "%08x %s", lkb->lkb_id, print_lockmode(lkb->lkb_grmode));
67 67
@@ -83,7 +83,7 @@ static void print_resource_lock(struct seq_file *s, struct dlm_lkb *lkb,
83 seq_printf(s, "\n"); 83 seq_printf(s, "\n");
84} 84}
85 85
86static int print_resource(struct dlm_rsb *res, struct seq_file *s) 86static int print_format1(struct dlm_rsb *res, struct seq_file *s)
87{ 87{
88 struct dlm_lkb *lkb; 88 struct dlm_lkb *lkb;
89 int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list; 89 int i, lvblen = res->res_ls->ls_lvblen, recover_list, root_list;
@@ -134,15 +134,15 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s)
134 /* Print the locks attached to this resource */ 134 /* Print the locks attached to this resource */
135 seq_printf(s, "Granted Queue\n"); 135 seq_printf(s, "Granted Queue\n");
136 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue) 136 list_for_each_entry(lkb, &res->res_grantqueue, lkb_statequeue)
137 print_resource_lock(s, lkb, res); 137 print_format1_lock(s, lkb, res);
138 138
139 seq_printf(s, "Conversion Queue\n"); 139 seq_printf(s, "Conversion Queue\n");
140 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue) 140 list_for_each_entry(lkb, &res->res_convertqueue, lkb_statequeue)
141 print_resource_lock(s, lkb, res); 141 print_format1_lock(s, lkb, res);
142 142
143 seq_printf(s, "Waiting Queue\n"); 143 seq_printf(s, "Waiting Queue\n");
144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue) 144 list_for_each_entry(lkb, &res->res_waitqueue, lkb_statequeue)
145 print_resource_lock(s, lkb, res); 145 print_format1_lock(s, lkb, res);
146 146
147 if (list_empty(&res->res_lookup)) 147 if (list_empty(&res->res_lookup))
148 goto out; 148 goto out;
@@ -160,23 +160,24 @@ static int print_resource(struct dlm_rsb *res, struct seq_file *s)
160 return 0; 160 return 0;
161} 161}
162 162
163static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb *r) 163static void print_format2_lock(struct seq_file *s, struct dlm_lkb *lkb,
164 struct dlm_rsb *r)
164{ 165{
165 unsigned int waiting = 0; 166 u64 xid = 0;
166 uint64_t xid = 0; 167 u64 us;
167 168
168 if (lkb->lkb_flags & DLM_IFL_USER) { 169 if (lkb->lkb_flags & DLM_IFL_USER) {
169 if (lkb->lkb_ua) 170 if (lkb->lkb_ua)
170 xid = lkb->lkb_ua->xid; 171 xid = lkb->lkb_ua->xid;
171 } 172 }
172 173
173 if (lkb->lkb_timestamp) 174 /* microseconds since lkb was added to current queue */
174 waiting = jiffies_to_msecs(jiffies - lkb->lkb_timestamp); 175 us = ktime_to_us(ktime_sub(ktime_get(), lkb->lkb_timestamp));
175 176
176 /* id nodeid remid pid xid exflags flags sts grmode rqmode time_ms 177 /* id nodeid remid pid xid exflags flags sts grmode rqmode time_us
177 r_nodeid r_len r_name */ 178 r_nodeid r_len r_name */
178 179
179 seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %u %u %d \"%s\"\n", 180 seq_printf(s, "%x %d %x %u %llu %x %x %d %d %d %llu %u %d \"%s\"\n",
180 lkb->lkb_id, 181 lkb->lkb_id,
181 lkb->lkb_nodeid, 182 lkb->lkb_nodeid,
182 lkb->lkb_remid, 183 lkb->lkb_remid,
@@ -187,26 +188,114 @@ static void print_lock(struct seq_file *s, struct dlm_lkb *lkb, struct dlm_rsb *
187 lkb->lkb_status, 188 lkb->lkb_status,
188 lkb->lkb_grmode, 189 lkb->lkb_grmode,
189 lkb->lkb_rqmode, 190 lkb->lkb_rqmode,
190 waiting, 191 (unsigned long long)us,
191 r->res_nodeid, 192 r->res_nodeid,
192 r->res_length, 193 r->res_length,
193 r->res_name); 194 r->res_name);
194} 195}
195 196
196static int print_locks(struct dlm_rsb *r, struct seq_file *s) 197static int print_format2(struct dlm_rsb *r, struct seq_file *s)
197{ 198{
198 struct dlm_lkb *lkb; 199 struct dlm_lkb *lkb;
199 200
200 lock_rsb(r); 201 lock_rsb(r);
201 202
202 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue) 203 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue)
203 print_lock(s, lkb, r); 204 print_format2_lock(s, lkb, r);
204 205
205 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue) 206 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue)
206 print_lock(s, lkb, r); 207 print_format2_lock(s, lkb, r);
207 208
208 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue) 209 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue)
209 print_lock(s, lkb, r); 210 print_format2_lock(s, lkb, r);
211
212 unlock_rsb(r);
213 return 0;
214}
215
216static void print_format3_lock(struct seq_file *s, struct dlm_lkb *lkb,
217 int rsb_lookup)
218{
219 u64 xid = 0;
220
221 if (lkb->lkb_flags & DLM_IFL_USER) {
222 if (lkb->lkb_ua)
223 xid = lkb->lkb_ua->xid;
224 }
225
226 seq_printf(s, "lkb %x %d %x %u %llu %x %x %d %d %d %d %d %d %u %llu %llu\n",
227 lkb->lkb_id,
228 lkb->lkb_nodeid,
229 lkb->lkb_remid,
230 lkb->lkb_ownpid,
231 (unsigned long long)xid,
232 lkb->lkb_exflags,
233 lkb->lkb_flags,
234 lkb->lkb_status,
235 lkb->lkb_grmode,
236 lkb->lkb_rqmode,
237 lkb->lkb_highbast,
238 rsb_lookup,
239 lkb->lkb_wait_type,
240 lkb->lkb_lvbseq,
241 (unsigned long long)ktime_to_ns(lkb->lkb_timestamp),
242 (unsigned long long)ktime_to_ns(lkb->lkb_time_bast));
243}
244
245static int print_format3(struct dlm_rsb *r, struct seq_file *s)
246{
247 struct dlm_lkb *lkb;
248 int i, lvblen = r->res_ls->ls_lvblen;
249 int print_name = 1;
250
251 lock_rsb(r);
252
253 seq_printf(s, "rsb %p %d %x %lx %d %d %u %d ",
254 r,
255 r->res_nodeid,
256 r->res_first_lkid,
257 r->res_flags,
258 !list_empty(&r->res_root_list),
259 !list_empty(&r->res_recover_list),
260 r->res_recover_locks_count,
261 r->res_length);
262
263 for (i = 0; i < r->res_length; i++) {
264 if (!isascii(r->res_name[i]) || !isprint(r->res_name[i]))
265 print_name = 0;
266 }
267
268 seq_printf(s, "%s", print_name ? "str " : "hex");
269
270 for (i = 0; i < r->res_length; i++) {
271 if (print_name)
272 seq_printf(s, "%c", r->res_name[i]);
273 else
274 seq_printf(s, " %02x", (unsigned char)r->res_name[i]);
275 }
276 seq_printf(s, "\n");
277
278 if (!r->res_lvbptr)
279 goto do_locks;
280
281 seq_printf(s, "lvb %u %d", r->res_lvbseq, lvblen);
282
283 for (i = 0; i < lvblen; i++)
284 seq_printf(s, " %02x", (unsigned char)r->res_lvbptr[i]);
285 seq_printf(s, "\n");
286
287 do_locks:
288 list_for_each_entry(lkb, &r->res_grantqueue, lkb_statequeue)
289 print_format3_lock(s, lkb, 0);
290
291 list_for_each_entry(lkb, &r->res_convertqueue, lkb_statequeue)
292 print_format3_lock(s, lkb, 0);
293
294 list_for_each_entry(lkb, &r->res_waitqueue, lkb_statequeue)
295 print_format3_lock(s, lkb, 0);
296
297 list_for_each_entry(lkb, &r->res_lookup, lkb_rsb_lookup)
298 print_format3_lock(s, lkb, 1);
210 299
211 unlock_rsb(r); 300 unlock_rsb(r);
212 return 0; 301 return 0;
@@ -231,7 +320,7 @@ static int rsb_iter_next(struct rsb_iter *ri)
231 break; 320 break;
232 } 321 }
233 read_unlock(&ls->ls_rsbtbl[i].lock); 322 read_unlock(&ls->ls_rsbtbl[i].lock);
234 } 323 }
235 ri->entry = i; 324 ri->entry = i;
236 325
237 if (ri->entry >= ls->ls_rsbtbl_size) 326 if (ri->entry >= ls->ls_rsbtbl_size)
@@ -248,7 +337,7 @@ static int rsb_iter_next(struct rsb_iter *ri)
248 read_unlock(&ls->ls_rsbtbl[i].lock); 337 read_unlock(&ls->ls_rsbtbl[i].lock);
249 dlm_put_rsb(old); 338 dlm_put_rsb(old);
250 goto top; 339 goto top;
251 } 340 }
252 ri->rsb = list_entry(ri->next, struct dlm_rsb, res_hashchain); 341 ri->rsb = list_entry(ri->next, struct dlm_rsb, res_hashchain);
253 dlm_hold_rsb(ri->rsb); 342 dlm_hold_rsb(ri->rsb);
254 read_unlock(&ls->ls_rsbtbl[i].lock); 343 read_unlock(&ls->ls_rsbtbl[i].lock);
@@ -274,6 +363,7 @@ static struct rsb_iter *rsb_iter_init(struct dlm_ls *ls)
274 ri->ls = ls; 363 ri->ls = ls;
275 ri->entry = 0; 364 ri->entry = 0;
276 ri->next = NULL; 365 ri->next = NULL;
366 ri->format = 1;
277 367
278 if (rsb_iter_next(ri)) { 368 if (rsb_iter_next(ri)) {
279 rsb_iter_free(ri); 369 rsb_iter_free(ri);
@@ -325,16 +415,26 @@ static int rsb_seq_show(struct seq_file *file, void *iter_ptr)
325{ 415{
326 struct rsb_iter *ri = iter_ptr; 416 struct rsb_iter *ri = iter_ptr;
327 417
328 if (ri->locks) { 418 switch (ri->format) {
419 case 1:
420 print_format1(ri->rsb, file);
421 break;
422 case 2:
329 if (ri->header) { 423 if (ri->header) {
330 seq_printf(file, "id nodeid remid pid xid exflags flags " 424 seq_printf(file, "id nodeid remid pid xid exflags "
331 "sts grmode rqmode time_ms r_nodeid " 425 "flags sts grmode rqmode time_ms "
332 "r_len r_name\n"); 426 "r_nodeid r_len r_name\n");
333 ri->header = 0; 427 ri->header = 0;
334 } 428 }
335 print_locks(ri->rsb, file); 429 print_format2(ri->rsb, file);
336 } else { 430 break;
337 print_resource(ri->rsb, file); 431 case 3:
432 if (ri->header) {
433 seq_printf(file, "version rsb 1.1 lvb 1.1 lkb 1.1\n");
434 ri->header = 0;
435 }
436 print_format3(ri->rsb, file);
437 break;
338 } 438 }
339 439
340 return 0; 440 return 0;
@@ -385,7 +485,7 @@ static struct rsb_iter *locks_iter_init(struct dlm_ls *ls, loff_t *pos)
385 ri->ls = ls; 485 ri->ls = ls;
386 ri->entry = 0; 486 ri->entry = 0;
387 ri->next = NULL; 487 ri->next = NULL;
388 ri->locks = 1; 488 ri->format = 2;
389 489
390 if (*pos == 0) 490 if (*pos == 0)
391 ri->header = 1; 491 ri->header = 1;
@@ -448,6 +548,84 @@ static const struct file_operations locks_fops = {
448}; 548};
449 549
450/* 550/*
551 * Dump all rsb/lvb/lkb state in compact listing, more complete than _locks
552 * This can replace both formats 1 and 2 eventually.
553 */
554
555static struct rsb_iter *all_iter_init(struct dlm_ls *ls, loff_t *pos)
556{
557 struct rsb_iter *ri;
558
559 ri = kzalloc(sizeof *ri, GFP_KERNEL);
560 if (!ri)
561 return NULL;
562
563 ri->ls = ls;
564 ri->entry = 0;
565 ri->next = NULL;
566 ri->format = 3;
567
568 if (*pos == 0)
569 ri->header = 1;
570
571 if (rsb_iter_next(ri)) {
572 rsb_iter_free(ri);
573 return NULL;
574 }
575
576 return ri;
577}
578
579static void *all_seq_start(struct seq_file *file, loff_t *pos)
580{
581 struct rsb_iter *ri;
582 loff_t n = *pos;
583
584 ri = all_iter_init(file->private, pos);
585 if (!ri)
586 return NULL;
587
588 while (n--) {
589 if (rsb_iter_next(ri)) {
590 rsb_iter_free(ri);
591 return NULL;
592 }
593 }
594
595 return ri;
596}
597
598static struct seq_operations all_seq_ops = {
599 .start = all_seq_start,
600 .next = rsb_seq_next,
601 .stop = rsb_seq_stop,
602 .show = rsb_seq_show,
603};
604
605static int all_open(struct inode *inode, struct file *file)
606{
607 struct seq_file *seq;
608 int ret;
609
610 ret = seq_open(file, &all_seq_ops);
611 if (ret)
612 return ret;
613
614 seq = file->private_data;
615 seq->private = inode->i_private;
616
617 return 0;
618}
619
620static const struct file_operations all_fops = {
621 .owner = THIS_MODULE,
622 .open = all_open,
623 .read = seq_read,
624 .llseek = seq_lseek,
625 .release = seq_release
626};
627
628/*
451 * dump lkb's on the ls_waiters list 629 * dump lkb's on the ls_waiters list
452 */ 630 */
453 631
@@ -489,30 +667,33 @@ static const struct file_operations waiters_fops = {
489 .read = waiters_read 667 .read = waiters_read
490}; 668};
491 669
670void dlm_delete_debug_file(struct dlm_ls *ls)
671{
672 if (ls->ls_debug_rsb_dentry)
673 debugfs_remove(ls->ls_debug_rsb_dentry);
674 if (ls->ls_debug_waiters_dentry)
675 debugfs_remove(ls->ls_debug_waiters_dentry);
676 if (ls->ls_debug_locks_dentry)
677 debugfs_remove(ls->ls_debug_locks_dentry);
678 if (ls->ls_debug_all_dentry)
679 debugfs_remove(ls->ls_debug_all_dentry);
680}
681
492int dlm_create_debug_file(struct dlm_ls *ls) 682int dlm_create_debug_file(struct dlm_ls *ls)
493{ 683{
494 char name[DLM_LOCKSPACE_LEN+8]; 684 char name[DLM_LOCKSPACE_LEN+8];
495 685
686 /* format 1 */
687
496 ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name, 688 ls->ls_debug_rsb_dentry = debugfs_create_file(ls->ls_name,
497 S_IFREG | S_IRUGO, 689 S_IFREG | S_IRUGO,
498 dlm_root, 690 dlm_root,
499 ls, 691 ls,
500 &rsb_fops); 692 &rsb_fops);
501 if (!ls->ls_debug_rsb_dentry) 693 if (!ls->ls_debug_rsb_dentry)
502 return -ENOMEM; 694 goto fail;
503 695
504 memset(name, 0, sizeof(name)); 696 /* format 2 */
505 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name);
506
507 ls->ls_debug_waiters_dentry = debugfs_create_file(name,
508 S_IFREG | S_IRUGO,
509 dlm_root,
510 ls,
511 &waiters_fops);
512 if (!ls->ls_debug_waiters_dentry) {
513 debugfs_remove(ls->ls_debug_rsb_dentry);
514 return -ENOMEM;
515 }
516 697
517 memset(name, 0, sizeof(name)); 698 memset(name, 0, sizeof(name));
518 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name); 699 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_locks", ls->ls_name);
@@ -522,23 +703,38 @@ int dlm_create_debug_file(struct dlm_ls *ls)
522 dlm_root, 703 dlm_root,
523 ls, 704 ls,
524 &locks_fops); 705 &locks_fops);
525 if (!ls->ls_debug_locks_dentry) { 706 if (!ls->ls_debug_locks_dentry)
526 debugfs_remove(ls->ls_debug_waiters_dentry); 707 goto fail;
527 debugfs_remove(ls->ls_debug_rsb_dentry); 708
528 return -ENOMEM; 709 /* format 3 */
529 } 710
711 memset(name, 0, sizeof(name));
712 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_all", ls->ls_name);
713
714 ls->ls_debug_all_dentry = debugfs_create_file(name,
715 S_IFREG | S_IRUGO,
716 dlm_root,
717 ls,
718 &all_fops);
719 if (!ls->ls_debug_all_dentry)
720 goto fail;
721
722 memset(name, 0, sizeof(name));
723 snprintf(name, DLM_LOCKSPACE_LEN+8, "%s_waiters", ls->ls_name);
724
725 ls->ls_debug_waiters_dentry = debugfs_create_file(name,
726 S_IFREG | S_IRUGO,
727 dlm_root,
728 ls,
729 &waiters_fops);
730 if (!ls->ls_debug_waiters_dentry)
731 goto fail;
530 732
531 return 0; 733 return 0;
532}
533 734
534void dlm_delete_debug_file(struct dlm_ls *ls) 735 fail:
535{ 736 dlm_delete_debug_file(ls);
536 if (ls->ls_debug_rsb_dentry) 737 return -ENOMEM;
537 debugfs_remove(ls->ls_debug_rsb_dentry);
538 if (ls->ls_debug_waiters_dentry)
539 debugfs_remove(ls->ls_debug_waiters_dentry);
540 if (ls->ls_debug_locks_dentry)
541 debugfs_remove(ls->ls_debug_locks_dentry);
542} 738}
543 739
544int __init dlm_register_debugfs(void) 740int __init dlm_register_debugfs(void)
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c
index 85defeb64df4..92969f879a17 100644
--- a/fs/dlm/dir.c
+++ b/fs/dlm/dir.c
@@ -374,7 +374,7 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
374 struct list_head *list; 374 struct list_head *list;
375 struct dlm_rsb *r; 375 struct dlm_rsb *r;
376 int offset = 0, dir_nodeid; 376 int offset = 0, dir_nodeid;
377 uint16_t be_namelen; 377 __be16 be_namelen;
378 378
379 down_read(&ls->ls_root_sem); 379 down_read(&ls->ls_root_sem);
380 380
@@ -410,15 +410,15 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
410 410
411 if (offset + sizeof(uint16_t)*2 + r->res_length > outlen) { 411 if (offset + sizeof(uint16_t)*2 + r->res_length > outlen) {
412 /* Write end-of-block record */ 412 /* Write end-of-block record */
413 be_namelen = 0; 413 be_namelen = cpu_to_be16(0);
414 memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 414 memcpy(outbuf + offset, &be_namelen, sizeof(__be16));
415 offset += sizeof(uint16_t); 415 offset += sizeof(__be16);
416 goto out; 416 goto out;
417 } 417 }
418 418
419 be_namelen = cpu_to_be16(r->res_length); 419 be_namelen = cpu_to_be16(r->res_length);
420 memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 420 memcpy(outbuf + offset, &be_namelen, sizeof(__be16));
421 offset += sizeof(uint16_t); 421 offset += sizeof(__be16);
422 memcpy(outbuf + offset, r->res_name, r->res_length); 422 memcpy(outbuf + offset, r->res_name, r->res_length);
423 offset += r->res_length; 423 offset += r->res_length;
424 } 424 }
@@ -430,9 +430,9 @@ void dlm_copy_master_names(struct dlm_ls *ls, char *inbuf, int inlen,
430 430
431 if ((list == &ls->ls_root_list) && 431 if ((list == &ls->ls_root_list) &&
432 (offset + sizeof(uint16_t) <= outlen)) { 432 (offset + sizeof(uint16_t) <= outlen)) {
433 be_namelen = 0xFFFF; 433 be_namelen = cpu_to_be16(0xFFFF);
434 memcpy(outbuf + offset, &be_namelen, sizeof(uint16_t)); 434 memcpy(outbuf + offset, &be_namelen, sizeof(__be16));
435 offset += sizeof(uint16_t); 435 offset += sizeof(__be16);
436 } 436 }
437 437
438 out: 438 out:
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index 868e4c9ef127..ef2f1e353966 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -245,7 +245,8 @@ struct dlm_lkb {
245 struct list_head lkb_astqueue; /* need ast to be sent */ 245 struct list_head lkb_astqueue; /* need ast to be sent */
246 struct list_head lkb_ownqueue; /* list of locks for a process */ 246 struct list_head lkb_ownqueue; /* list of locks for a process */
247 struct list_head lkb_time_list; 247 struct list_head lkb_time_list;
248 unsigned long lkb_timestamp; 248 ktime_t lkb_time_bast; /* for debugging */
249 ktime_t lkb_timestamp;
249 unsigned long lkb_timeout_cs; 250 unsigned long lkb_timeout_cs;
250 251
251 char *lkb_lvbptr; 252 char *lkb_lvbptr;
@@ -481,6 +482,7 @@ struct dlm_ls {
481 struct dentry *ls_debug_rsb_dentry; /* debugfs */ 482 struct dentry *ls_debug_rsb_dentry; /* debugfs */
482 struct dentry *ls_debug_waiters_dentry; /* debugfs */ 483 struct dentry *ls_debug_waiters_dentry; /* debugfs */
483 struct dentry *ls_debug_locks_dentry; /* debugfs */ 484 struct dentry *ls_debug_locks_dentry; /* debugfs */
485 struct dentry *ls_debug_all_dentry; /* debugfs */
484 486
485 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */ 487 wait_queue_head_t ls_uevent_wait; /* user part of join/leave */
486 int ls_uevent_result; 488 int ls_uevent_result;
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 724ddac91538..6cfe65bbf4a2 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -307,7 +307,7 @@ static void queue_cast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rv)
307 lkb->lkb_lksb->sb_status = rv; 307 lkb->lkb_lksb->sb_status = rv;
308 lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags; 308 lkb->lkb_lksb->sb_flags = lkb->lkb_sbflags;
309 309
310 dlm_add_ast(lkb, AST_COMP); 310 dlm_add_ast(lkb, AST_COMP, 0);
311} 311}
312 312
313static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb) 313static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb)
@@ -318,12 +318,12 @@ static inline void queue_cast_overlap(struct dlm_rsb *r, struct dlm_lkb *lkb)
318 318
319static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode) 319static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode)
320{ 320{
321 lkb->lkb_time_bast = ktime_get();
322
321 if (is_master_copy(lkb)) 323 if (is_master_copy(lkb))
322 send_bast(r, lkb, rqmode); 324 send_bast(r, lkb, rqmode);
323 else { 325 else
324 lkb->lkb_bastmode = rqmode; 326 dlm_add_ast(lkb, AST_BAST, rqmode);
325 dlm_add_ast(lkb, AST_BAST);
326 }
327} 327}
328 328
329/* 329/*
@@ -744,6 +744,8 @@ static void add_lkb(struct dlm_rsb *r, struct dlm_lkb *lkb, int status)
744 744
745 DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb);); 745 DLM_ASSERT(!lkb->lkb_status, dlm_print_lkb(lkb););
746 746
747 lkb->lkb_timestamp = ktime_get();
748
747 lkb->lkb_status = status; 749 lkb->lkb_status = status;
748 750
749 switch (status) { 751 switch (status) {
@@ -1013,10 +1015,8 @@ static void add_timeout(struct dlm_lkb *lkb)
1013{ 1015{
1014 struct dlm_ls *ls = lkb->lkb_resource->res_ls; 1016 struct dlm_ls *ls = lkb->lkb_resource->res_ls;
1015 1017
1016 if (is_master_copy(lkb)) { 1018 if (is_master_copy(lkb))
1017 lkb->lkb_timestamp = jiffies;
1018 return; 1019 return;
1019 }
1020 1020
1021 if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) && 1021 if (test_bit(LSFL_TIMEWARN, &ls->ls_flags) &&
1022 !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) { 1022 !(lkb->lkb_exflags & DLM_LKF_NODLCKWT)) {
@@ -1031,7 +1031,6 @@ static void add_timeout(struct dlm_lkb *lkb)
1031 DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb);); 1031 DLM_ASSERT(list_empty(&lkb->lkb_time_list), dlm_print_lkb(lkb););
1032 mutex_lock(&ls->ls_timeout_mutex); 1032 mutex_lock(&ls->ls_timeout_mutex);
1033 hold_lkb(lkb); 1033 hold_lkb(lkb);
1034 lkb->lkb_timestamp = jiffies;
1035 list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout); 1034 list_add_tail(&lkb->lkb_time_list, &ls->ls_timeout);
1036 mutex_unlock(&ls->ls_timeout_mutex); 1035 mutex_unlock(&ls->ls_timeout_mutex);
1037} 1036}
@@ -1059,6 +1058,7 @@ void dlm_scan_timeout(struct dlm_ls *ls)
1059 struct dlm_rsb *r; 1058 struct dlm_rsb *r;
1060 struct dlm_lkb *lkb; 1059 struct dlm_lkb *lkb;
1061 int do_cancel, do_warn; 1060 int do_cancel, do_warn;
1061 s64 wait_us;
1062 1062
1063 for (;;) { 1063 for (;;) {
1064 if (dlm_locking_stopped(ls)) 1064 if (dlm_locking_stopped(ls))
@@ -1069,14 +1069,15 @@ void dlm_scan_timeout(struct dlm_ls *ls)
1069 mutex_lock(&ls->ls_timeout_mutex); 1069 mutex_lock(&ls->ls_timeout_mutex);
1070 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) { 1070 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) {
1071 1071
1072 wait_us = ktime_to_us(ktime_sub(ktime_get(),
1073 lkb->lkb_timestamp));
1074
1072 if ((lkb->lkb_exflags & DLM_LKF_TIMEOUT) && 1075 if ((lkb->lkb_exflags & DLM_LKF_TIMEOUT) &&
1073 time_after_eq(jiffies, lkb->lkb_timestamp + 1076 wait_us >= (lkb->lkb_timeout_cs * 10000))
1074 lkb->lkb_timeout_cs * HZ/100))
1075 do_cancel = 1; 1077 do_cancel = 1;
1076 1078
1077 if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) && 1079 if ((lkb->lkb_flags & DLM_IFL_WATCH_TIMEWARN) &&
1078 time_after_eq(jiffies, lkb->lkb_timestamp + 1080 wait_us >= dlm_config.ci_timewarn_cs * 10000)
1079 dlm_config.ci_timewarn_cs * HZ/100))
1080 do_warn = 1; 1081 do_warn = 1;
1081 1082
1082 if (!do_cancel && !do_warn) 1083 if (!do_cancel && !do_warn)
@@ -1122,12 +1123,12 @@ void dlm_scan_timeout(struct dlm_ls *ls)
1122void dlm_adjust_timeouts(struct dlm_ls *ls) 1123void dlm_adjust_timeouts(struct dlm_ls *ls)
1123{ 1124{
1124 struct dlm_lkb *lkb; 1125 struct dlm_lkb *lkb;
1125 long adj = jiffies - ls->ls_recover_begin; 1126 u64 adj_us = jiffies_to_usecs(jiffies - ls->ls_recover_begin);
1126 1127
1127 ls->ls_recover_begin = 0; 1128 ls->ls_recover_begin = 0;
1128 mutex_lock(&ls->ls_timeout_mutex); 1129 mutex_lock(&ls->ls_timeout_mutex);
1129 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list) 1130 list_for_each_entry(lkb, &ls->ls_timeout, lkb_time_list)
1130 lkb->lkb_timestamp += adj; 1131 lkb->lkb_timestamp = ktime_add_us(lkb->lkb_timestamp, adj_us);
1131 mutex_unlock(&ls->ls_timeout_mutex); 1132 mutex_unlock(&ls->ls_timeout_mutex);
1132} 1133}
1133 1134
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 3962262f991a..103a5ebd1371 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -295,6 +295,7 @@ static int add_sock(struct socket *sock, struct connection *con)
295 con->sock->sk->sk_write_space = lowcomms_write_space; 295 con->sock->sk->sk_write_space = lowcomms_write_space;
296 con->sock->sk->sk_state_change = lowcomms_state_change; 296 con->sock->sk->sk_state_change = lowcomms_state_change;
297 con->sock->sk->sk_user_data = con; 297 con->sock->sk->sk_user_data = con;
298 con->sock->sk->sk_allocation = GFP_NOFS;
298 return 0; 299 return 0;
299} 300}
300 301
@@ -823,7 +824,6 @@ static void sctp_init_assoc(struct connection *con)
823 len = e->len; 824 len = e->len;
824 offset = e->offset; 825 offset = e->offset;
825 spin_unlock(&con->writequeue_lock); 826 spin_unlock(&con->writequeue_lock);
826 kmap(e->page);
827 827
828 /* Send the first block off the write queue */ 828 /* Send the first block off the write queue */
829 iov[0].iov_base = page_address(e->page)+offset; 829 iov[0].iov_base = page_address(e->page)+offset;
@@ -854,7 +854,6 @@ static void sctp_init_assoc(struct connection *con)
854 854
855 if (e->len == 0 && e->users == 0) { 855 if (e->len == 0 && e->users == 0) {
856 list_del(&e->list); 856 list_del(&e->list);
857 kunmap(e->page);
858 free_entry(e); 857 free_entry(e);
859 } 858 }
860 spin_unlock(&con->writequeue_lock); 859 spin_unlock(&con->writequeue_lock);
@@ -1203,8 +1202,6 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc)
1203 1202
1204 if (e) { 1203 if (e) {
1205 got_one: 1204 got_one:
1206 if (users == 0)
1207 kmap(e->page);
1208 *ppc = page_address(e->page) + offset; 1205 *ppc = page_address(e->page) + offset;
1209 return e; 1206 return e;
1210 } 1207 }
@@ -1233,7 +1230,6 @@ void dlm_lowcomms_commit_buffer(void *mh)
1233 if (users) 1230 if (users)
1234 goto out; 1231 goto out;
1235 e->len = e->end - e->offset; 1232 e->len = e->end - e->offset;
1236 kunmap(e->page);
1237 spin_unlock(&con->writequeue_lock); 1233 spin_unlock(&con->writequeue_lock);
1238 1234
1239 if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) { 1235 if (!test_and_set_bit(CF_WRITE_PENDING, &con->flags)) {
@@ -1272,7 +1268,6 @@ static void send_to_sock(struct connection *con)
1272 offset = e->offset; 1268 offset = e->offset;
1273 BUG_ON(len == 0 && e->users == 0); 1269 BUG_ON(len == 0 && e->users == 0);
1274 spin_unlock(&con->writequeue_lock); 1270 spin_unlock(&con->writequeue_lock);
1275 kmap(e->page);
1276 1271
1277 ret = 0; 1272 ret = 0;
1278 if (len) { 1273 if (len) {
@@ -1294,7 +1289,6 @@ static void send_to_sock(struct connection *con)
1294 1289
1295 if (e->len == 0 && e->users == 0) { 1290 if (e->len == 0 && e->users == 0) {
1296 list_del(&e->list); 1291 list_del(&e->list);
1297 kunmap(e->page);
1298 free_entry(e); 1292 free_entry(e);
1299 continue; 1293 continue;
1300 } 1294 }
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 54c14c6d06cb..c1775b84ebab 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -39,7 +39,7 @@ char *dlm_allocate_lvb(struct dlm_ls *ls)
39{ 39{
40 char *p; 40 char *p;
41 41
42 p = kzalloc(ls->ls_lvblen, GFP_KERNEL); 42 p = kzalloc(ls->ls_lvblen, ls->ls_allocation);
43 return p; 43 return p;
44} 44}
45 45
@@ -57,7 +57,7 @@ struct dlm_rsb *dlm_allocate_rsb(struct dlm_ls *ls, int namelen)
57 57
58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,); 58 DLM_ASSERT(namelen <= DLM_RESNAME_MAXLEN,);
59 59
60 r = kzalloc(sizeof(*r) + namelen, GFP_KERNEL); 60 r = kzalloc(sizeof(*r) + namelen, ls->ls_allocation);
61 return r; 61 return r;
62} 62}
63 63
@@ -72,7 +72,7 @@ struct dlm_lkb *dlm_allocate_lkb(struct dlm_ls *ls)
72{ 72{
73 struct dlm_lkb *lkb; 73 struct dlm_lkb *lkb;
74 74
75 lkb = kmem_cache_zalloc(lkb_cache, GFP_KERNEL); 75 lkb = kmem_cache_zalloc(lkb_cache, ls->ls_allocation);
76 return lkb; 76 return lkb;
77} 77}
78 78
diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
index 07ac709f3ed7..f3396c622aec 100644
--- a/fs/dlm/midcomms.c
+++ b/fs/dlm/midcomms.c
@@ -112,7 +112,7 @@ int dlm_process_incoming_buffer(int nodeid, const void *base,
112 ordinary messages). */ 112 ordinary messages). */
113 113
114 if (msglen > sizeof(__tmp) && p == &__tmp.p) { 114 if (msglen > sizeof(__tmp) && p == &__tmp.p) {
115 p = kmalloc(dlm_config.ci_buffer_size, GFP_KERNEL); 115 p = kmalloc(dlm_config.ci_buffer_size, GFP_NOFS);
116 if (p == NULL) 116 if (p == NULL)
117 return ret; 117 return ret;
118 } 118 }
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c
index aa2a5775a027..ccc9d62c462d 100644
--- a/fs/dlm/netlink.c
+++ b/fs/dlm/netlink.c
@@ -115,7 +115,6 @@ static void fill_data(struct dlm_lock_data *data, struct dlm_lkb *lkb)
115 data->status = lkb->lkb_status; 115 data->status = lkb->lkb_status;
116 data->grmode = lkb->lkb_grmode; 116 data->grmode = lkb->lkb_grmode;
117 data->rqmode = lkb->lkb_rqmode; 117 data->rqmode = lkb->lkb_rqmode;
118 data->timestamp = lkb->lkb_timestamp;
119 if (lkb->lkb_ua) 118 if (lkb->lkb_ua)
120 data->xid = lkb->lkb_ua->xid; 119 data->xid = lkb->lkb_ua->xid;
121 if (r) { 120 if (r) {
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
index b3832c67194a..065149e84f42 100644
--- a/fs/dlm/user.c
+++ b/fs/dlm/user.c
@@ -175,7 +175,7 @@ static int lkb_is_endoflife(struct dlm_lkb *lkb, int sb_status, int type)
175/* we could possibly check if the cancel of an orphan has resulted in the lkb 175/* we could possibly check if the cancel of an orphan has resulted in the lkb
176 being removed and then remove that lkb from the orphans list and free it */ 176 being removed and then remove that lkb from the orphans list and free it */
177 177
178void dlm_user_add_ast(struct dlm_lkb *lkb, int type) 178void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode)
179{ 179{
180 struct dlm_ls *ls; 180 struct dlm_ls *ls;
181 struct dlm_user_args *ua; 181 struct dlm_user_args *ua;
@@ -208,6 +208,8 @@ void dlm_user_add_ast(struct dlm_lkb *lkb, int type)
208 208
209 ast_type = lkb->lkb_ast_type; 209 ast_type = lkb->lkb_ast_type;
210 lkb->lkb_ast_type |= type; 210 lkb->lkb_ast_type |= type;
211 if (bastmode)
212 lkb->lkb_bastmode = bastmode;
211 213
212 if (!ast_type) { 214 if (!ast_type) {
213 kref_get(&lkb->lkb_ref); 215 kref_get(&lkb->lkb_ref);
diff --git a/fs/dlm/user.h b/fs/dlm/user.h
index 35eb6a13d616..1c9686492286 100644
--- a/fs/dlm/user.h
+++ b/fs/dlm/user.h
@@ -9,7 +9,7 @@
9#ifndef __USER_DOT_H__ 9#ifndef __USER_DOT_H__
10#define __USER_DOT_H__ 10#define __USER_DOT_H__
11 11
12void dlm_user_add_ast(struct dlm_lkb *lkb, int type); 12void dlm_user_add_ast(struct dlm_lkb *lkb, int type, int bastmode);
13int dlm_user_init(void); 13int dlm_user_init(void);
14void dlm_user_exit(void); 14void dlm_user_exit(void);
15int dlm_device_deregister(struct dlm_ls *ls); 15int dlm_device_deregister(struct dlm_ls *ls);
diff --git a/fs/dquot.c b/fs/dquot.c
index c237ccc8581c..61bfff64e5af 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -211,8 +211,6 @@ static struct hlist_head *dquot_hash;
211 211
212struct dqstats dqstats; 212struct dqstats dqstats;
213 213
214static void dqput(struct dquot *dquot);
215
216static inline unsigned int 214static inline unsigned int
217hashfn(const struct super_block *sb, unsigned int id, int type) 215hashfn(const struct super_block *sb, unsigned int id, int type)
218{ 216{
@@ -415,6 +413,17 @@ out_dqlock:
415 return ret; 413 return ret;
416} 414}
417 415
416void dquot_destroy(struct dquot *dquot)
417{
418 kmem_cache_free(dquot_cachep, dquot);
419}
420EXPORT_SYMBOL(dquot_destroy);
421
422static inline void do_destroy_dquot(struct dquot *dquot)
423{
424 dquot->dq_sb->dq_op->destroy_dquot(dquot);
425}
426
418/* Invalidate all dquots on the list. Note that this function is called after 427/* Invalidate all dquots on the list. Note that this function is called after
419 * quota is disabled and pointers from inodes removed so there cannot be new 428 * quota is disabled and pointers from inodes removed so there cannot be new
420 * quota users. There can still be some users of quotas due to inodes being 429 * quota users. There can still be some users of quotas due to inodes being
@@ -463,9 +472,44 @@ restart:
463 remove_dquot_hash(dquot); 472 remove_dquot_hash(dquot);
464 remove_free_dquot(dquot); 473 remove_free_dquot(dquot);
465 remove_inuse(dquot); 474 remove_inuse(dquot);
466 kmem_cache_free(dquot_cachep, dquot); 475 do_destroy_dquot(dquot);
476 }
477 spin_unlock(&dq_list_lock);
478}
479
480/* Call callback for every active dquot on given filesystem */
481int dquot_scan_active(struct super_block *sb,
482 int (*fn)(struct dquot *dquot, unsigned long priv),
483 unsigned long priv)
484{
485 struct dquot *dquot, *old_dquot = NULL;
486 int ret = 0;
487
488 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
489 spin_lock(&dq_list_lock);
490 list_for_each_entry(dquot, &inuse_list, dq_inuse) {
491 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
492 continue;
493 if (dquot->dq_sb != sb)
494 continue;
495 /* Now we have active dquot so we can just increase use count */
496 atomic_inc(&dquot->dq_count);
497 dqstats.lookups++;
498 spin_unlock(&dq_list_lock);
499 dqput(old_dquot);
500 old_dquot = dquot;
501 ret = fn(dquot, priv);
502 if (ret < 0)
503 goto out;
504 spin_lock(&dq_list_lock);
505 /* We are safe to continue now because our dquot could not
506 * be moved out of the inuse list while we hold the reference */
467 } 507 }
468 spin_unlock(&dq_list_lock); 508 spin_unlock(&dq_list_lock);
509out:
510 dqput(old_dquot);
511 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
512 return ret;
469} 513}
470 514
471int vfs_quota_sync(struct super_block *sb, int type) 515int vfs_quota_sync(struct super_block *sb, int type)
@@ -479,7 +523,7 @@ int vfs_quota_sync(struct super_block *sb, int type)
479 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 523 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
480 if (type != -1 && cnt != type) 524 if (type != -1 && cnt != type)
481 continue; 525 continue;
482 if (!sb_has_quota_enabled(sb, cnt)) 526 if (!sb_has_quota_active(sb, cnt))
483 continue; 527 continue;
484 spin_lock(&dq_list_lock); 528 spin_lock(&dq_list_lock);
485 dirty = &dqopt->info[cnt].dqi_dirty_list; 529 dirty = &dqopt->info[cnt].dqi_dirty_list;
@@ -504,8 +548,8 @@ int vfs_quota_sync(struct super_block *sb, int type)
504 } 548 }
505 549
506 for (cnt = 0; cnt < MAXQUOTAS; cnt++) 550 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
507 if ((cnt == type || type == -1) && sb_has_quota_enabled(sb, cnt) 551 if ((cnt == type || type == -1) && sb_has_quota_active(sb, cnt)
508 && info_dirty(&dqopt->info[cnt])) 552 && info_dirty(&dqopt->info[cnt]))
509 sb->dq_op->write_info(sb, cnt); 553 sb->dq_op->write_info(sb, cnt);
510 spin_lock(&dq_list_lock); 554 spin_lock(&dq_list_lock);
511 dqstats.syncs++; 555 dqstats.syncs++;
@@ -527,7 +571,7 @@ static void prune_dqcache(int count)
527 remove_dquot_hash(dquot); 571 remove_dquot_hash(dquot);
528 remove_free_dquot(dquot); 572 remove_free_dquot(dquot);
529 remove_inuse(dquot); 573 remove_inuse(dquot);
530 kmem_cache_free(dquot_cachep, dquot); 574 do_destroy_dquot(dquot);
531 count--; 575 count--;
532 head = free_dquots.prev; 576 head = free_dquots.prev;
533 } 577 }
@@ -558,7 +602,7 @@ static struct shrinker dqcache_shrinker = {
558 * NOTE: If you change this function please check whether dqput_blocks() works right... 602 * NOTE: If you change this function please check whether dqput_blocks() works right...
559 * MUST be called with either dqptr_sem or dqonoff_mutex held 603 * MUST be called with either dqptr_sem or dqonoff_mutex held
560 */ 604 */
561static void dqput(struct dquot *dquot) 605void dqput(struct dquot *dquot)
562{ 606{
563 int ret; 607 int ret;
564 608
@@ -584,7 +628,7 @@ we_slept:
584 /* We have more than one user... nothing to do */ 628 /* We have more than one user... nothing to do */
585 atomic_dec(&dquot->dq_count); 629 atomic_dec(&dquot->dq_count);
586 /* Releasing dquot during quotaoff phase? */ 630 /* Releasing dquot during quotaoff phase? */
587 if (!sb_has_quota_enabled(dquot->dq_sb, dquot->dq_type) && 631 if (!sb_has_quota_active(dquot->dq_sb, dquot->dq_type) &&
588 atomic_read(&dquot->dq_count) == 1) 632 atomic_read(&dquot->dq_count) == 1)
589 wake_up(&dquot->dq_wait_unused); 633 wake_up(&dquot->dq_wait_unused);
590 spin_unlock(&dq_list_lock); 634 spin_unlock(&dq_list_lock);
@@ -625,11 +669,17 @@ we_slept:
625 spin_unlock(&dq_list_lock); 669 spin_unlock(&dq_list_lock);
626} 670}
627 671
672struct dquot *dquot_alloc(struct super_block *sb, int type)
673{
674 return kmem_cache_zalloc(dquot_cachep, GFP_NOFS);
675}
676EXPORT_SYMBOL(dquot_alloc);
677
628static struct dquot *get_empty_dquot(struct super_block *sb, int type) 678static struct dquot *get_empty_dquot(struct super_block *sb, int type)
629{ 679{
630 struct dquot *dquot; 680 struct dquot *dquot;
631 681
632 dquot = kmem_cache_zalloc(dquot_cachep, GFP_NOFS); 682 dquot = sb->dq_op->alloc_dquot(sb, type);
633 if(!dquot) 683 if(!dquot)
634 return NODQUOT; 684 return NODQUOT;
635 685
@@ -647,15 +697,33 @@ static struct dquot *get_empty_dquot(struct super_block *sb, int type)
647} 697}
648 698
649/* 699/*
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/*
650 * Get reference to dquot 718 * Get reference to dquot
651 * MUST be called with either dqptr_sem or dqonoff_mutex held 719 * MUST be called with either dqptr_sem or dqonoff_mutex held
652 */ 720 */
653static struct dquot *dqget(struct super_block *sb, unsigned int id, int type) 721struct dquot *dqget(struct super_block *sb, unsigned int id, int type)
654{ 722{
655 unsigned int hashent = hashfn(sb, id, type); 723 unsigned int hashent = hashfn(sb, id, type);
656 struct dquot *dquot, *empty = NODQUOT; 724 struct dquot *dquot, *empty = NODQUOT;
657 725
658 if (!sb_has_quota_enabled(sb, type)) 726 if (!sb_has_quota_active(sb, type))
659 return NODQUOT; 727 return NODQUOT;
660we_slept: 728we_slept:
661 spin_lock(&dq_list_lock); 729 spin_lock(&dq_list_lock);
@@ -682,7 +750,7 @@ we_slept:
682 dqstats.lookups++; 750 dqstats.lookups++;
683 spin_unlock(&dq_list_lock); 751 spin_unlock(&dq_list_lock);
684 if (empty) 752 if (empty)
685 kmem_cache_free(dquot_cachep, empty); 753 do_destroy_dquot(empty);
686 } 754 }
687 /* Wait for dq_lock - after this we know that either dquot_release() is already 755 /* Wait for dq_lock - after this we know that either dquot_release() is already
688 * finished or it will be canceled due to dq_count > 1 test */ 756 * finished or it will be canceled due to dq_count > 1 test */
@@ -820,7 +888,7 @@ static void drop_dquot_ref(struct super_block *sb, int type)
820 } 888 }
821} 889}
822 890
823static inline void dquot_incr_inodes(struct dquot *dquot, unsigned long number) 891static inline void dquot_incr_inodes(struct dquot *dquot, qsize_t number)
824{ 892{
825 dquot->dq_dqb.dqb_curinodes += number; 893 dquot->dq_dqb.dqb_curinodes += number;
826} 894}
@@ -830,9 +898,10 @@ static inline void dquot_incr_space(struct dquot *dquot, qsize_t number)
830 dquot->dq_dqb.dqb_curspace += number; 898 dquot->dq_dqb.dqb_curspace += number;
831} 899}
832 900
833static inline void dquot_decr_inodes(struct dquot *dquot, unsigned long number) 901static inline void dquot_decr_inodes(struct dquot *dquot, qsize_t number)
834{ 902{
835 if (dquot->dq_dqb.dqb_curinodes > number) 903 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
904 dquot->dq_dqb.dqb_curinodes >= number)
836 dquot->dq_dqb.dqb_curinodes -= number; 905 dquot->dq_dqb.dqb_curinodes -= number;
837 else 906 else
838 dquot->dq_dqb.dqb_curinodes = 0; 907 dquot->dq_dqb.dqb_curinodes = 0;
@@ -843,11 +912,12 @@ static inline void dquot_decr_inodes(struct dquot *dquot, unsigned long number)
843 912
844static inline void dquot_decr_space(struct dquot *dquot, qsize_t number) 913static inline void dquot_decr_space(struct dquot *dquot, qsize_t number)
845{ 914{
846 if (dquot->dq_dqb.dqb_curspace > number) 915 if (sb_dqopt(dquot->dq_sb)->flags & DQUOT_NEGATIVE_USAGE ||
916 dquot->dq_dqb.dqb_curspace >= number)
847 dquot->dq_dqb.dqb_curspace -= number; 917 dquot->dq_dqb.dqb_curspace -= number;
848 else 918 else
849 dquot->dq_dqb.dqb_curspace = 0; 919 dquot->dq_dqb.dqb_curspace = 0;
850 if (toqb(dquot->dq_dqb.dqb_curspace) <= dquot->dq_dqb.dqb_bsoftlimit) 920 if (dquot->dq_dqb.dqb_curspace <= dquot->dq_dqb.dqb_bsoftlimit)
851 dquot->dq_dqb.dqb_btime = (time_t) 0; 921 dquot->dq_dqb.dqb_btime = (time_t) 0;
852 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 922 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
853} 923}
@@ -1023,10 +1093,11 @@ static inline char ignore_hardlimit(struct dquot *dquot)
1023} 1093}
1024 1094
1025/* needs dq_data_lock */ 1095/* needs dq_data_lock */
1026static int check_idq(struct dquot *dquot, ulong inodes, char *warntype) 1096static int check_idq(struct dquot *dquot, qsize_t inodes, char *warntype)
1027{ 1097{
1028 *warntype = QUOTA_NL_NOWARN; 1098 *warntype = QUOTA_NL_NOWARN;
1029 if (inodes <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) 1099 if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_type) ||
1100 test_bit(DQ_FAKE_B, &dquot->dq_flags))
1030 return QUOTA_OK; 1101 return QUOTA_OK;
1031 1102
1032 if (dquot->dq_dqb.dqb_ihardlimit && 1103 if (dquot->dq_dqb.dqb_ihardlimit &&
@@ -1058,11 +1129,12 @@ static int check_idq(struct dquot *dquot, ulong inodes, char *warntype)
1058static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warntype) 1129static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *warntype)
1059{ 1130{
1060 *warntype = QUOTA_NL_NOWARN; 1131 *warntype = QUOTA_NL_NOWARN;
1061 if (space <= 0 || test_bit(DQ_FAKE_B, &dquot->dq_flags)) 1132 if (!sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_type) ||
1133 test_bit(DQ_FAKE_B, &dquot->dq_flags))
1062 return QUOTA_OK; 1134 return QUOTA_OK;
1063 1135
1064 if (dquot->dq_dqb.dqb_bhardlimit && 1136 if (dquot->dq_dqb.dqb_bhardlimit &&
1065 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bhardlimit && 1137 dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bhardlimit &&
1066 !ignore_hardlimit(dquot)) { 1138 !ignore_hardlimit(dquot)) {
1067 if (!prealloc) 1139 if (!prealloc)
1068 *warntype = QUOTA_NL_BHARDWARN; 1140 *warntype = QUOTA_NL_BHARDWARN;
@@ -1070,7 +1142,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
1070 } 1142 }
1071 1143
1072 if (dquot->dq_dqb.dqb_bsoftlimit && 1144 if (dquot->dq_dqb.dqb_bsoftlimit &&
1073 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit && 1145 dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit &&
1074 dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime && 1146 dquot->dq_dqb.dqb_btime && get_seconds() >= dquot->dq_dqb.dqb_btime &&
1075 !ignore_hardlimit(dquot)) { 1147 !ignore_hardlimit(dquot)) {
1076 if (!prealloc) 1148 if (!prealloc)
@@ -1079,7 +1151,7 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
1079 } 1151 }
1080 1152
1081 if (dquot->dq_dqb.dqb_bsoftlimit && 1153 if (dquot->dq_dqb.dqb_bsoftlimit &&
1082 toqb(dquot->dq_dqb.dqb_curspace + space) > dquot->dq_dqb.dqb_bsoftlimit && 1154 dquot->dq_dqb.dqb_curspace + space > dquot->dq_dqb.dqb_bsoftlimit &&
1083 dquot->dq_dqb.dqb_btime == 0) { 1155 dquot->dq_dqb.dqb_btime == 0) {
1084 if (!prealloc) { 1156 if (!prealloc) {
1085 *warntype = QUOTA_NL_BSOFTWARN; 1157 *warntype = QUOTA_NL_BSOFTWARN;
@@ -1096,10 +1168,11 @@ static int check_bdq(struct dquot *dquot, qsize_t space, int prealloc, char *war
1096 return QUOTA_OK; 1168 return QUOTA_OK;
1097} 1169}
1098 1170
1099static int info_idq_free(struct dquot *dquot, ulong inodes) 1171static int info_idq_free(struct dquot *dquot, qsize_t inodes)
1100{ 1172{
1101 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || 1173 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) ||
1102 dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit) 1174 dquot->dq_dqb.dqb_curinodes <= dquot->dq_dqb.dqb_isoftlimit ||
1175 !sb_has_quota_limits_enabled(dquot->dq_sb, dquot->dq_type))
1103 return QUOTA_NL_NOWARN; 1176 return QUOTA_NL_NOWARN;
1104 1177
1105 if (dquot->dq_dqb.dqb_curinodes - inodes <= dquot->dq_dqb.dqb_isoftlimit) 1178 if (dquot->dq_dqb.dqb_curinodes - inodes <= dquot->dq_dqb.dqb_isoftlimit)
@@ -1113,15 +1186,13 @@ static int info_idq_free(struct dquot *dquot, ulong inodes)
1113static int info_bdq_free(struct dquot *dquot, qsize_t space) 1186static int info_bdq_free(struct dquot *dquot, qsize_t space)
1114{ 1187{
1115 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) || 1188 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) ||
1116 toqb(dquot->dq_dqb.dqb_curspace) <= dquot->dq_dqb.dqb_bsoftlimit) 1189 dquot->dq_dqb.dqb_curspace <= dquot->dq_dqb.dqb_bsoftlimit)
1117 return QUOTA_NL_NOWARN; 1190 return QUOTA_NL_NOWARN;
1118 1191
1119 if (toqb(dquot->dq_dqb.dqb_curspace - space) <= 1192 if (dquot->dq_dqb.dqb_curspace - space <= dquot->dq_dqb.dqb_bsoftlimit)
1120 dquot->dq_dqb.dqb_bsoftlimit)
1121 return QUOTA_NL_BSOFTBELOW; 1193 return QUOTA_NL_BSOFTBELOW;
1122 if (toqb(dquot->dq_dqb.dqb_curspace) >= dquot->dq_dqb.dqb_bhardlimit && 1194 if (dquot->dq_dqb.dqb_curspace >= dquot->dq_dqb.dqb_bhardlimit &&
1123 toqb(dquot->dq_dqb.dqb_curspace - space) < 1195 dquot->dq_dqb.dqb_curspace - space < dquot->dq_dqb.dqb_bhardlimit)
1124 dquot->dq_dqb.dqb_bhardlimit)
1125 return QUOTA_NL_BHARDBELOW; 1196 return QUOTA_NL_BHARDBELOW;
1126 return QUOTA_NL_NOWARN; 1197 return QUOTA_NL_NOWARN;
1127} 1198}
@@ -1166,17 +1237,23 @@ out_err:
1166 * Release all quotas referenced by inode 1237 * Release all quotas referenced by inode
1167 * Transaction must be started at an entry 1238 * Transaction must be started at an entry
1168 */ 1239 */
1169int dquot_drop(struct inode *inode) 1240int dquot_drop_locked(struct inode *inode)
1170{ 1241{
1171 int cnt; 1242 int cnt;
1172 1243
1173 down_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1174 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 1244 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
1175 if (inode->i_dquot[cnt] != NODQUOT) { 1245 if (inode->i_dquot[cnt] != NODQUOT) {
1176 dqput(inode->i_dquot[cnt]); 1246 dqput(inode->i_dquot[cnt]);
1177 inode->i_dquot[cnt] = NODQUOT; 1247 inode->i_dquot[cnt] = NODQUOT;
1178 } 1248 }
1179 } 1249 }
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);
1180 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem); 1257 up_write(&sb_dqopt(inode->i_sb)->dqptr_sem);
1181 return 0; 1258 return 0;
1182} 1259}
@@ -1264,7 +1341,7 @@ warn_put_all:
1264/* 1341/*
1265 * This operation can block, but only after everything is updated 1342 * This operation can block, but only after everything is updated
1266 */ 1343 */
1267int dquot_alloc_inode(const struct inode *inode, unsigned long number) 1344int dquot_alloc_inode(const struct inode *inode, qsize_t number)
1268{ 1345{
1269 int cnt, ret = NO_QUOTA; 1346 int cnt, ret = NO_QUOTA;
1270 char warntype[MAXQUOTAS]; 1347 char warntype[MAXQUOTAS];
@@ -1349,7 +1426,7 @@ out_sub:
1349/* 1426/*
1350 * This operation can block, but only after everything is updated 1427 * This operation can block, but only after everything is updated
1351 */ 1428 */
1352int dquot_free_inode(const struct inode *inode, unsigned long number) 1429int dquot_free_inode(const struct inode *inode, qsize_t number)
1353{ 1430{
1354 unsigned int cnt; 1431 unsigned int cnt;
1355 char warntype[MAXQUOTAS]; 1432 char warntype[MAXQUOTAS];
@@ -1495,7 +1572,7 @@ warn_put_all:
1495/* Wrapper for transferring ownership of an inode */ 1572/* Wrapper for transferring ownership of an inode */
1496int vfs_dq_transfer(struct inode *inode, struct iattr *iattr) 1573int vfs_dq_transfer(struct inode *inode, struct iattr *iattr)
1497{ 1574{
1498 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) { 1575 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode)) {
1499 vfs_dq_init(inode); 1576 vfs_dq_init(inode);
1500 if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA) 1577 if (inode->i_sb->dq_op->transfer(inode, iattr) == NO_QUOTA)
1501 return 1; 1578 return 1;
@@ -1533,54 +1610,27 @@ struct dquot_operations dquot_operations = {
1533 .acquire_dquot = dquot_acquire, 1610 .acquire_dquot = dquot_acquire,
1534 .release_dquot = dquot_release, 1611 .release_dquot = dquot_release,
1535 .mark_dirty = dquot_mark_dquot_dirty, 1612 .mark_dirty = dquot_mark_dquot_dirty,
1536 .write_info = dquot_commit_info 1613 .write_info = dquot_commit_info,
1614 .alloc_dquot = dquot_alloc,
1615 .destroy_dquot = dquot_destroy,
1537}; 1616};
1538 1617
1539static inline void set_enable_flags(struct quota_info *dqopt, int type)
1540{
1541 switch (type) {
1542 case USRQUOTA:
1543 dqopt->flags |= DQUOT_USR_ENABLED;
1544 dqopt->flags &= ~DQUOT_USR_SUSPENDED;
1545 break;
1546 case GRPQUOTA:
1547 dqopt->flags |= DQUOT_GRP_ENABLED;
1548 dqopt->flags &= ~DQUOT_GRP_SUSPENDED;
1549 break;
1550 }
1551}
1552
1553static inline void reset_enable_flags(struct quota_info *dqopt, int type,
1554 int remount)
1555{
1556 switch (type) {
1557 case USRQUOTA:
1558 dqopt->flags &= ~DQUOT_USR_ENABLED;
1559 if (remount)
1560 dqopt->flags |= DQUOT_USR_SUSPENDED;
1561 else
1562 dqopt->flags &= ~DQUOT_USR_SUSPENDED;
1563 break;
1564 case GRPQUOTA:
1565 dqopt->flags &= ~DQUOT_GRP_ENABLED;
1566 if (remount)
1567 dqopt->flags |= DQUOT_GRP_SUSPENDED;
1568 else
1569 dqopt->flags &= ~DQUOT_GRP_SUSPENDED;
1570 break;
1571 }
1572}
1573
1574
1575/* 1618/*
1576 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount) 1619 * Turn quota off on a device. type == -1 ==> quotaoff for all types (umount)
1577 */ 1620 */
1578int vfs_quota_off(struct super_block *sb, int type, int remount) 1621int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags)
1579{ 1622{
1580 int cnt, ret = 0; 1623 int cnt, ret = 0;
1581 struct quota_info *dqopt = sb_dqopt(sb); 1624 struct quota_info *dqopt = sb_dqopt(sb);
1582 struct inode *toputinode[MAXQUOTAS]; 1625 struct inode *toputinode[MAXQUOTAS];
1583 1626
1627 /* Cannot turn off usage accounting without turning off limits, or
1628 * suspend quotas and simultaneously turn quotas off. */
1629 if ((flags & DQUOT_USAGE_ENABLED && !(flags & DQUOT_LIMITS_ENABLED))
1630 || (flags & DQUOT_SUSPENDED && flags & (DQUOT_LIMITS_ENABLED |
1631 DQUOT_USAGE_ENABLED)))
1632 return -EINVAL;
1633
1584 /* We need to serialize quota_off() for device */ 1634 /* We need to serialize quota_off() for device */
1585 mutex_lock(&dqopt->dqonoff_mutex); 1635 mutex_lock(&dqopt->dqonoff_mutex);
1586 1636
@@ -1589,7 +1639,7 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1589 * sometimes we are called when fill_super() failed and calling 1639 * sometimes we are called when fill_super() failed and calling
1590 * sync_fs() in such cases does no good. 1640 * sync_fs() in such cases does no good.
1591 */ 1641 */
1592 if (!sb_any_quota_enabled(sb) && !sb_any_quota_suspended(sb)) { 1642 if (!sb_any_quota_loaded(sb)) {
1593 mutex_unlock(&dqopt->dqonoff_mutex); 1643 mutex_unlock(&dqopt->dqonoff_mutex);
1594 return 0; 1644 return 0;
1595 } 1645 }
@@ -1597,17 +1647,28 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1597 toputinode[cnt] = NULL; 1647 toputinode[cnt] = NULL;
1598 if (type != -1 && cnt != type) 1648 if (type != -1 && cnt != type)
1599 continue; 1649 continue;
1600 /* If we keep inodes of quota files after remount and quotaoff 1650 if (!sb_has_quota_loaded(sb, cnt))
1601 * is called, drop kept inodes. */
1602 if (!remount && sb_has_quota_suspended(sb, cnt)) {
1603 iput(dqopt->files[cnt]);
1604 dqopt->files[cnt] = NULL;
1605 reset_enable_flags(dqopt, cnt, 0);
1606 continue; 1651 continue;
1652
1653 if (flags & DQUOT_SUSPENDED) {
1654 dqopt->flags |=
1655 dquot_state_flag(DQUOT_SUSPENDED, cnt);
1656 } else {
1657 dqopt->flags &= ~dquot_state_flag(flags, cnt);
1658 /* Turning off suspended quotas? */
1659 if (!sb_has_quota_loaded(sb, cnt) &&
1660 sb_has_quota_suspended(sb, cnt)) {
1661 dqopt->flags &= ~dquot_state_flag(
1662 DQUOT_SUSPENDED, cnt);
1663 iput(dqopt->files[cnt]);
1664 dqopt->files[cnt] = NULL;
1665 continue;
1666 }
1607 } 1667 }
1608 if (!sb_has_quota_enabled(sb, cnt)) 1668
1669 /* We still have to keep quota loaded? */
1670 if (sb_has_quota_loaded(sb, cnt) && !(flags & DQUOT_SUSPENDED))
1609 continue; 1671 continue;
1610 reset_enable_flags(dqopt, cnt, remount);
1611 1672
1612 /* Note: these are blocking operations */ 1673 /* Note: these are blocking operations */
1613 drop_dquot_ref(sb, cnt); 1674 drop_dquot_ref(sb, cnt);
@@ -1623,7 +1684,7 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1623 put_quota_format(dqopt->info[cnt].dqi_format); 1684 put_quota_format(dqopt->info[cnt].dqi_format);
1624 1685
1625 toputinode[cnt] = dqopt->files[cnt]; 1686 toputinode[cnt] = dqopt->files[cnt];
1626 if (!remount) 1687 if (!sb_has_quota_loaded(sb, cnt))
1627 dqopt->files[cnt] = NULL; 1688 dqopt->files[cnt] = NULL;
1628 dqopt->info[cnt].dqi_flags = 0; 1689 dqopt->info[cnt].dqi_flags = 0;
1629 dqopt->info[cnt].dqi_igrace = 0; 1690 dqopt->info[cnt].dqi_igrace = 0;
@@ -1631,6 +1692,11 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1631 dqopt->ops[cnt] = NULL; 1692 dqopt->ops[cnt] = NULL;
1632 } 1693 }
1633 mutex_unlock(&dqopt->dqonoff_mutex); 1694 mutex_unlock(&dqopt->dqonoff_mutex);
1695
1696 /* Skip syncing and setting flags if quota files are hidden */
1697 if (dqopt->flags & DQUOT_QUOTA_SYS_FILE)
1698 goto put_inodes;
1699
1634 /* Sync the superblock so that buffers with quota data are written to 1700 /* Sync the superblock so that buffers with quota data are written to
1635 * disk (and so userspace sees correct data afterwards). */ 1701 * disk (and so userspace sees correct data afterwards). */
1636 if (sb->s_op->sync_fs) 1702 if (sb->s_op->sync_fs)
@@ -1646,7 +1712,7 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1646 mutex_lock(&dqopt->dqonoff_mutex); 1712 mutex_lock(&dqopt->dqonoff_mutex);
1647 /* If quota was reenabled in the meantime, we have 1713 /* If quota was reenabled in the meantime, we have
1648 * nothing to do */ 1714 * nothing to do */
1649 if (!sb_has_quota_enabled(sb, cnt)) { 1715 if (!sb_has_quota_loaded(sb, cnt)) {
1650 mutex_lock_nested(&toputinode[cnt]->i_mutex, I_MUTEX_QUOTA); 1716 mutex_lock_nested(&toputinode[cnt]->i_mutex, I_MUTEX_QUOTA);
1651 toputinode[cnt]->i_flags &= ~(S_IMMUTABLE | 1717 toputinode[cnt]->i_flags &= ~(S_IMMUTABLE |
1652 S_NOATIME | S_NOQUOTA); 1718 S_NOATIME | S_NOQUOTA);
@@ -1655,26 +1721,43 @@ int vfs_quota_off(struct super_block *sb, int type, int remount)
1655 mark_inode_dirty(toputinode[cnt]); 1721 mark_inode_dirty(toputinode[cnt]);
1656 } 1722 }
1657 mutex_unlock(&dqopt->dqonoff_mutex); 1723 mutex_unlock(&dqopt->dqonoff_mutex);
1724 }
1725 if (sb->s_bdev)
1726 invalidate_bdev(sb->s_bdev);
1727put_inodes:
1728 for (cnt = 0; cnt < MAXQUOTAS; cnt++)
1729 if (toputinode[cnt]) {
1658 /* On remount RO, we keep the inode pointer so that we 1730 /* On remount RO, we keep the inode pointer so that we
1659 * can reenable quota on the subsequent remount RW. 1731 * can reenable quota on the subsequent remount RW. We
1660 * But we have better not keep inode pointer when there 1732 * have to check 'flags' variable and not use sb_has_
1661 * is pending delete on the quota file... */ 1733 * function because another quotaon / quotaoff could
1662 if (!remount) 1734 * change global state before we got here. We refuse
1735 * to suspend quotas when there is pending delete on
1736 * the quota file... */
1737 if (!(flags & DQUOT_SUSPENDED))
1663 iput(toputinode[cnt]); 1738 iput(toputinode[cnt]);
1664 else if (!toputinode[cnt]->i_nlink) 1739 else if (!toputinode[cnt]->i_nlink)
1665 ret = -EBUSY; 1740 ret = -EBUSY;
1666 } 1741 }
1667 if (sb->s_bdev)
1668 invalidate_bdev(sb->s_bdev);
1669 return ret; 1742 return ret;
1670} 1743}
1671 1744
1745int vfs_quota_off(struct super_block *sb, int type, int remount)
1746{
1747 return vfs_quota_disable(sb, type, remount ? DQUOT_SUSPENDED :
1748 (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED));
1749}
1750
1672/* 1751/*
1673 * Turn quotas on on a device 1752 * Turn quotas on on a device
1674 */ 1753 */
1675 1754
1676/* Helper function when we already have the inode */ 1755/*
1677static int vfs_quota_on_inode(struct inode *inode, int type, int format_id) 1756 * Helper function to turn quotas on when we already have the inode of
1757 * quota file and no quota information is loaded.
1758 */
1759static int vfs_load_quota_inode(struct inode *inode, int type, int format_id,
1760 unsigned int flags)
1678{ 1761{
1679 struct quota_format_type *fmt = find_quota_format(format_id); 1762 struct quota_format_type *fmt = find_quota_format(format_id);
1680 struct super_block *sb = inode->i_sb; 1763 struct super_block *sb = inode->i_sb;
@@ -1696,27 +1779,37 @@ static int vfs_quota_on_inode(struct inode *inode, int type, int format_id)
1696 error = -EINVAL; 1779 error = -EINVAL;
1697 goto out_fmt; 1780 goto out_fmt;
1698 } 1781 }
1782 /* Usage always has to be set... */
1783 if (!(flags & DQUOT_USAGE_ENABLED)) {
1784 error = -EINVAL;
1785 goto out_fmt;
1786 }
1699 1787
1700 /* As we bypass the pagecache we must now flush the inode so that 1788 if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE)) {
1701 * we see all the changes from userspace... */ 1789 /* As we bypass the pagecache we must now flush the inode so
1702 write_inode_now(inode, 1); 1790 * that we see all the changes from userspace... */
1703 /* And now flush the block cache so that kernel sees the changes */ 1791 write_inode_now(inode, 1);
1704 invalidate_bdev(sb->s_bdev); 1792 /* And now flush the block cache so that kernel sees the
1793 * changes */
1794 invalidate_bdev(sb->s_bdev);
1795 }
1705 mutex_lock(&inode->i_mutex); 1796 mutex_lock(&inode->i_mutex);
1706 mutex_lock(&dqopt->dqonoff_mutex); 1797 mutex_lock(&dqopt->dqonoff_mutex);
1707 if (sb_has_quota_enabled(sb, type) || 1798 if (sb_has_quota_loaded(sb, type)) {
1708 sb_has_quota_suspended(sb, type)) {
1709 error = -EBUSY; 1799 error = -EBUSY;
1710 goto out_lock; 1800 goto out_lock;
1711 } 1801 }
1712 /* We don't want quota and atime on quota files (deadlocks possible) 1802
1713 * Also nobody should write to the file - we use special IO operations 1803 if (!(dqopt->flags & DQUOT_QUOTA_SYS_FILE)) {
1714 * which ignore the immutable bit. */ 1804 /* We don't want quota and atime on quota files (deadlocks
1715 down_write(&dqopt->dqptr_sem); 1805 * possible) Also nobody should write to the file - we use
1716 oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | S_NOQUOTA); 1806 * special IO operations which ignore the immutable bit. */
1717 inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE; 1807 down_write(&dqopt->dqptr_sem);
1718 up_write(&dqopt->dqptr_sem); 1808 oldflags = inode->i_flags & (S_NOATIME | S_IMMUTABLE | S_NOQUOTA);
1719 sb->dq_op->drop(inode); 1809 inode->i_flags |= S_NOQUOTA | S_NOATIME | S_IMMUTABLE;
1810 up_write(&dqopt->dqptr_sem);
1811 sb->dq_op->drop(inode);
1812 }
1720 1813
1721 error = -EIO; 1814 error = -EIO;
1722 dqopt->files[type] = igrab(inode); 1815 dqopt->files[type] = igrab(inode);
@@ -1737,7 +1830,7 @@ static int vfs_quota_on_inode(struct inode *inode, int type, int format_id)
1737 } 1830 }
1738 mutex_unlock(&dqopt->dqio_mutex); 1831 mutex_unlock(&dqopt->dqio_mutex);
1739 mutex_unlock(&inode->i_mutex); 1832 mutex_unlock(&inode->i_mutex);
1740 set_enable_flags(dqopt, type); 1833 dqopt->flags |= dquot_state_flag(flags, type);
1741 1834
1742 add_dquot_ref(sb, type); 1835 add_dquot_ref(sb, type);
1743 mutex_unlock(&dqopt->dqonoff_mutex); 1836 mutex_unlock(&dqopt->dqonoff_mutex);
@@ -1770,20 +1863,23 @@ static int vfs_quota_on_remount(struct super_block *sb, int type)
1770 struct quota_info *dqopt = sb_dqopt(sb); 1863 struct quota_info *dqopt = sb_dqopt(sb);
1771 struct inode *inode; 1864 struct inode *inode;
1772 int ret; 1865 int ret;
1866 unsigned int flags;
1773 1867
1774 mutex_lock(&dqopt->dqonoff_mutex); 1868 mutex_lock(&dqopt->dqonoff_mutex);
1775 if (!sb_has_quota_suspended(sb, type)) { 1869 if (!sb_has_quota_suspended(sb, type)) {
1776 mutex_unlock(&dqopt->dqonoff_mutex); 1870 mutex_unlock(&dqopt->dqonoff_mutex);
1777 return 0; 1871 return 0;
1778 } 1872 }
1779 BUG_ON(sb_has_quota_enabled(sb, type));
1780
1781 inode = dqopt->files[type]; 1873 inode = dqopt->files[type];
1782 dqopt->files[type] = NULL; 1874 dqopt->files[type] = NULL;
1783 reset_enable_flags(dqopt, type, 0); 1875 flags = dqopt->flags & dquot_state_flag(DQUOT_USAGE_ENABLED |
1876 DQUOT_LIMITS_ENABLED, type);
1877 dqopt->flags &= ~dquot_state_flag(DQUOT_STATE_FLAGS, type);
1784 mutex_unlock(&dqopt->dqonoff_mutex); 1878 mutex_unlock(&dqopt->dqonoff_mutex);
1785 1879
1786 ret = vfs_quota_on_inode(inode, type, dqopt->info[type].dqi_fmt_id); 1880 flags = dquot_generic_flag(flags, type);
1881 ret = vfs_load_quota_inode(inode, type, dqopt->info[type].dqi_fmt_id,
1882 flags);
1787 iput(inode); 1883 iput(inode);
1788 1884
1789 return ret; 1885 return ret;
@@ -1799,12 +1895,12 @@ int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
1799 if (path->mnt->mnt_sb != sb) 1895 if (path->mnt->mnt_sb != sb)
1800 error = -EXDEV; 1896 error = -EXDEV;
1801 else 1897 else
1802 error = vfs_quota_on_inode(path->dentry->d_inode, type, 1898 error = vfs_load_quota_inode(path->dentry->d_inode, type,
1803 format_id); 1899 format_id, DQUOT_USAGE_ENABLED |
1900 DQUOT_LIMITS_ENABLED);
1804 return error; 1901 return error;
1805} 1902}
1806 1903
1807/* Actual function called from quotactl() */
1808int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name, 1904int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
1809 int remount) 1905 int remount)
1810{ 1906{
@@ -1823,6 +1919,50 @@ int vfs_quota_on(struct super_block *sb, int type, int format_id, char *name,
1823} 1919}
1824 1920
1825/* 1921/*
1922 * More powerful function for turning on quotas allowing setting
1923 * of individual quota flags
1924 */
1925int vfs_quota_enable(struct inode *inode, int type, int format_id,
1926 unsigned int flags)
1927{
1928 int ret = 0;
1929 struct super_block *sb = inode->i_sb;
1930 struct quota_info *dqopt = sb_dqopt(sb);
1931
1932 /* Just unsuspend quotas? */
1933 if (flags & DQUOT_SUSPENDED)
1934 return vfs_quota_on_remount(sb, type);
1935 if (!flags)
1936 return 0;
1937 /* Just updating flags needed? */
1938 if (sb_has_quota_loaded(sb, type)) {
1939 mutex_lock(&dqopt->dqonoff_mutex);
1940 /* Now do a reliable test... */
1941 if (!sb_has_quota_loaded(sb, type)) {
1942 mutex_unlock(&dqopt->dqonoff_mutex);
1943 goto load_quota;
1944 }
1945 if (flags & DQUOT_USAGE_ENABLED &&
1946 sb_has_quota_usage_enabled(sb, type)) {
1947 ret = -EBUSY;
1948 goto out_lock;
1949 }
1950 if (flags & DQUOT_LIMITS_ENABLED &&
1951 sb_has_quota_limits_enabled(sb, type)) {
1952 ret = -EBUSY;
1953 goto out_lock;
1954 }
1955 sb_dqopt(sb)->flags |= dquot_state_flag(flags, type);
1956out_lock:
1957 mutex_unlock(&dqopt->dqonoff_mutex);
1958 return ret;
1959 }
1960
1961load_quota:
1962 return vfs_load_quota_inode(inode, type, format_id, flags);
1963}
1964
1965/*
1826 * This function is used when filesystem needs to initialize quotas 1966 * This function is used when filesystem needs to initialize quotas
1827 * during mount time. 1967 * during mount time.
1828 */ 1968 */
@@ -1843,7 +1983,8 @@ int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
1843 1983
1844 error = security_quota_on(dentry); 1984 error = security_quota_on(dentry);
1845 if (!error) 1985 if (!error)
1846 error = vfs_quota_on_inode(dentry->d_inode, type, format_id); 1986 error = vfs_load_quota_inode(dentry->d_inode, type, format_id,
1987 DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED);
1847 1988
1848out: 1989out:
1849 dput(dentry); 1990 dput(dentry);
@@ -1866,14 +2007,24 @@ int vfs_dq_quota_on_remount(struct super_block *sb)
1866 return ret; 2007 return ret;
1867} 2008}
1868 2009
2010static inline qsize_t qbtos(qsize_t blocks)
2011{
2012 return blocks << QIF_DQBLKSIZE_BITS;
2013}
2014
2015static inline qsize_t stoqb(qsize_t space)
2016{
2017 return (space + QIF_DQBLKSIZE - 1) >> QIF_DQBLKSIZE_BITS;
2018}
2019
1869/* Generic routine for getting common part of quota structure */ 2020/* Generic routine for getting common part of quota structure */
1870static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di) 2021static void do_get_dqblk(struct dquot *dquot, struct if_dqblk *di)
1871{ 2022{
1872 struct mem_dqblk *dm = &dquot->dq_dqb; 2023 struct mem_dqblk *dm = &dquot->dq_dqb;
1873 2024
1874 spin_lock(&dq_data_lock); 2025 spin_lock(&dq_data_lock);
1875 di->dqb_bhardlimit = dm->dqb_bhardlimit; 2026 di->dqb_bhardlimit = stoqb(dm->dqb_bhardlimit);
1876 di->dqb_bsoftlimit = dm->dqb_bsoftlimit; 2027 di->dqb_bsoftlimit = stoqb(dm->dqb_bsoftlimit);
1877 di->dqb_curspace = dm->dqb_curspace; 2028 di->dqb_curspace = dm->dqb_curspace;
1878 di->dqb_ihardlimit = dm->dqb_ihardlimit; 2029 di->dqb_ihardlimit = dm->dqb_ihardlimit;
1879 di->dqb_isoftlimit = dm->dqb_isoftlimit; 2030 di->dqb_isoftlimit = dm->dqb_isoftlimit;
@@ -1918,28 +2069,36 @@ static int do_set_dqblk(struct dquot *dquot, struct if_dqblk *di)
1918 if (di->dqb_valid & QIF_SPACE) { 2069 if (di->dqb_valid & QIF_SPACE) {
1919 dm->dqb_curspace = di->dqb_curspace; 2070 dm->dqb_curspace = di->dqb_curspace;
1920 check_blim = 1; 2071 check_blim = 1;
2072 __set_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);
1921 } 2073 }
1922 if (di->dqb_valid & QIF_BLIMITS) { 2074 if (di->dqb_valid & QIF_BLIMITS) {
1923 dm->dqb_bsoftlimit = di->dqb_bsoftlimit; 2075 dm->dqb_bsoftlimit = qbtos(di->dqb_bsoftlimit);
1924 dm->dqb_bhardlimit = di->dqb_bhardlimit; 2076 dm->dqb_bhardlimit = qbtos(di->dqb_bhardlimit);
1925 check_blim = 1; 2077 check_blim = 1;
2078 __set_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags);
1926 } 2079 }
1927 if (di->dqb_valid & QIF_INODES) { 2080 if (di->dqb_valid & QIF_INODES) {
1928 dm->dqb_curinodes = di->dqb_curinodes; 2081 dm->dqb_curinodes = di->dqb_curinodes;
1929 check_ilim = 1; 2082 check_ilim = 1;
2083 __set_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags);
1930 } 2084 }
1931 if (di->dqb_valid & QIF_ILIMITS) { 2085 if (di->dqb_valid & QIF_ILIMITS) {
1932 dm->dqb_isoftlimit = di->dqb_isoftlimit; 2086 dm->dqb_isoftlimit = di->dqb_isoftlimit;
1933 dm->dqb_ihardlimit = di->dqb_ihardlimit; 2087 dm->dqb_ihardlimit = di->dqb_ihardlimit;
1934 check_ilim = 1; 2088 check_ilim = 1;
2089 __set_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags);
1935 } 2090 }
1936 if (di->dqb_valid & QIF_BTIME) 2091 if (di->dqb_valid & QIF_BTIME) {
1937 dm->dqb_btime = di->dqb_btime; 2092 dm->dqb_btime = di->dqb_btime;
1938 if (di->dqb_valid & QIF_ITIME) 2093 __set_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags);
2094 }
2095 if (di->dqb_valid & QIF_ITIME) {
1939 dm->dqb_itime = di->dqb_itime; 2096 dm->dqb_itime = di->dqb_itime;
2097 __set_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags);
2098 }
1940 2099
1941 if (check_blim) { 2100 if (check_blim) {
1942 if (!dm->dqb_bsoftlimit || toqb(dm->dqb_curspace) < dm->dqb_bsoftlimit) { 2101 if (!dm->dqb_bsoftlimit || dm->dqb_curspace < dm->dqb_bsoftlimit) {
1943 dm->dqb_btime = 0; 2102 dm->dqb_btime = 0;
1944 clear_bit(DQ_BLKS_B, &dquot->dq_flags); 2103 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
1945 } 2104 }
@@ -1970,12 +2129,14 @@ int vfs_set_dqblk(struct super_block *sb, int type, qid_t id, struct if_dqblk *d
1970 int rc; 2129 int rc;
1971 2130
1972 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); 2131 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
1973 if (!(dquot = dqget(sb, id, type))) { 2132 dquot = dqget(sb, id, type);
1974 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2133 if (!dquot) {
1975 return -ESRCH; 2134 rc = -ESRCH;
2135 goto out;
1976 } 2136 }
1977 rc = do_set_dqblk(dquot, di); 2137 rc = do_set_dqblk(dquot, di);
1978 dqput(dquot); 2138 dqput(dquot);
2139out:
1979 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2140 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
1980 return rc; 2141 return rc;
1981} 2142}
@@ -1986,7 +2147,7 @@ int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
1986 struct mem_dqinfo *mi; 2147 struct mem_dqinfo *mi;
1987 2148
1988 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); 2149 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
1989 if (!sb_has_quota_enabled(sb, type)) { 2150 if (!sb_has_quota_active(sb, type)) {
1990 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2151 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
1991 return -ESRCH; 2152 return -ESRCH;
1992 } 2153 }
@@ -2005,11 +2166,12 @@ int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
2005int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii) 2166int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
2006{ 2167{
2007 struct mem_dqinfo *mi; 2168 struct mem_dqinfo *mi;
2169 int err = 0;
2008 2170
2009 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); 2171 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
2010 if (!sb_has_quota_enabled(sb, type)) { 2172 if (!sb_has_quota_active(sb, type)) {
2011 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2173 err = -ESRCH;
2012 return -ESRCH; 2174 goto out;
2013 } 2175 }
2014 mi = sb_dqopt(sb)->info + type; 2176 mi = sb_dqopt(sb)->info + type;
2015 spin_lock(&dq_data_lock); 2177 spin_lock(&dq_data_lock);
@@ -2023,8 +2185,9 @@ int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii)
2023 mark_info_dirty(sb, type); 2185 mark_info_dirty(sb, type);
2024 /* Force write to disk */ 2186 /* Force write to disk */
2025 sb->dq_op->write_info(sb, type); 2187 sb->dq_op->write_info(sb, type);
2188out:
2026 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); 2189 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
2027 return 0; 2190 return err;
2028} 2191}
2029 2192
2030struct quotactl_ops vfs_quotactl_ops = { 2193struct quotactl_ops vfs_quotactl_ops = {
@@ -2186,10 +2349,13 @@ EXPORT_SYMBOL(register_quota_format);
2186EXPORT_SYMBOL(unregister_quota_format); 2349EXPORT_SYMBOL(unregister_quota_format);
2187EXPORT_SYMBOL(dqstats); 2350EXPORT_SYMBOL(dqstats);
2188EXPORT_SYMBOL(dq_data_lock); 2351EXPORT_SYMBOL(dq_data_lock);
2352EXPORT_SYMBOL(vfs_quota_enable);
2189EXPORT_SYMBOL(vfs_quota_on); 2353EXPORT_SYMBOL(vfs_quota_on);
2190EXPORT_SYMBOL(vfs_quota_on_path); 2354EXPORT_SYMBOL(vfs_quota_on_path);
2191EXPORT_SYMBOL(vfs_quota_on_mount); 2355EXPORT_SYMBOL(vfs_quota_on_mount);
2356EXPORT_SYMBOL(vfs_quota_disable);
2192EXPORT_SYMBOL(vfs_quota_off); 2357EXPORT_SYMBOL(vfs_quota_off);
2358EXPORT_SYMBOL(dquot_scan_active);
2193EXPORT_SYMBOL(vfs_quota_sync); 2359EXPORT_SYMBOL(vfs_quota_sync);
2194EXPORT_SYMBOL(vfs_get_dqinfo); 2360EXPORT_SYMBOL(vfs_get_dqinfo);
2195EXPORT_SYMBOL(vfs_set_dqinfo); 2361EXPORT_SYMBOL(vfs_set_dqinfo);
@@ -2202,7 +2368,11 @@ EXPORT_SYMBOL(dquot_release);
2202EXPORT_SYMBOL(dquot_mark_dquot_dirty); 2368EXPORT_SYMBOL(dquot_mark_dquot_dirty);
2203EXPORT_SYMBOL(dquot_initialize); 2369EXPORT_SYMBOL(dquot_initialize);
2204EXPORT_SYMBOL(dquot_drop); 2370EXPORT_SYMBOL(dquot_drop);
2371EXPORT_SYMBOL(dquot_drop_locked);
2205EXPORT_SYMBOL(vfs_dq_drop); 2372EXPORT_SYMBOL(vfs_dq_drop);
2373EXPORT_SYMBOL(dqget);
2374EXPORT_SYMBOL(dqput);
2375EXPORT_SYMBOL(dquot_is_cached);
2206EXPORT_SYMBOL(dquot_alloc_space); 2376EXPORT_SYMBOL(dquot_alloc_space);
2207EXPORT_SYMBOL(dquot_alloc_inode); 2377EXPORT_SYMBOL(dquot_alloc_inode);
2208EXPORT_SYMBOL(dquot_free_space); 2378EXPORT_SYMBOL(dquot_free_space);
diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
index eb3dc4c7ac06..713834371229 100644
--- a/fs/ecryptfs/file.c
+++ b/fs/ecryptfs/file.c
@@ -275,18 +275,9 @@ static int ecryptfs_release(struct inode *inode, struct file *file)
275static int 275static int
276ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync) 276ecryptfs_fsync(struct file *file, struct dentry *dentry, int datasync)
277{ 277{
278 struct file *lower_file = ecryptfs_file_to_lower(file); 278 return vfs_fsync(ecryptfs_file_to_lower(file),
279 struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry); 279 ecryptfs_dentry_to_lower(dentry),
280 struct inode *lower_inode = lower_dentry->d_inode; 280 datasync);
281 int rc = -EINVAL;
282
283 if (lower_inode->i_fop->fsync) {
284 mutex_lock(&lower_inode->i_mutex);
285 rc = lower_inode->i_fop->fsync(lower_file, lower_dentry,
286 datasync);
287 mutex_unlock(&lower_inode->i_mutex);
288 }
289 return rc;
290} 281}
291 282
292static int ecryptfs_fasync(int fd, struct file *file, int flag) 283static int ecryptfs_fasync(int fd, struct file *file, int flag)
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 5e78fc179886..0111906a8877 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -612,8 +612,7 @@ ecryptfs_readlink(struct dentry *dentry, char __user * buf, int bufsiz)
612 struct ecryptfs_crypt_stat *crypt_stat; 612 struct ecryptfs_crypt_stat *crypt_stat;
613 613
614 lower_dentry = ecryptfs_dentry_to_lower(dentry); 614 lower_dentry = ecryptfs_dentry_to_lower(dentry);
615 if (!lower_dentry->d_inode->i_op || 615 if (!lower_dentry->d_inode->i_op->readlink) {
616 !lower_dentry->d_inode->i_op->readlink) {
617 rc = -EINVAL; 616 rc = -EINVAL;
618 goto out; 617 goto out;
619 } 618 }
diff --git a/fs/exec.c b/fs/exec.c
index 3ef9cf9b1871..9c33f542dc77 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -51,6 +51,7 @@
51#include <linux/audit.h> 51#include <linux/audit.h>
52#include <linux/tracehook.h> 52#include <linux/tracehook.h>
53#include <linux/kmod.h> 53#include <linux/kmod.h>
54#include <linux/fsnotify.h>
54 55
55#include <asm/uaccess.h> 56#include <asm/uaccess.h>
56#include <asm/mmu_context.h> 57#include <asm/mmu_context.h>
@@ -132,6 +133,8 @@ asmlinkage long sys_uselib(const char __user * library)
132 if (IS_ERR(file)) 133 if (IS_ERR(file))
133 goto out; 134 goto out;
134 135
136 fsnotify_open(file->f_path.dentry);
137
135 error = -ENOEXEC; 138 error = -ENOEXEC;
136 if(file->f_op) { 139 if(file->f_op) {
137 struct linux_binfmt * fmt; 140 struct linux_binfmt * fmt;
@@ -684,6 +687,8 @@ struct file *open_exec(const char *name)
684 if (IS_ERR(file)) 687 if (IS_ERR(file))
685 return file; 688 return file;
686 689
690 fsnotify_open(file->f_path.dentry);
691
687 err = deny_write_access(file); 692 err = deny_write_access(file);
688 if (err) { 693 if (err) {
689 fput(file); 694 fput(file);
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index f6c94f232ec1..c22d01467bd1 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -713,7 +713,9 @@ static struct dquot_operations ext3_quota_operations = {
713 .acquire_dquot = ext3_acquire_dquot, 713 .acquire_dquot = ext3_acquire_dquot,
714 .release_dquot = ext3_release_dquot, 714 .release_dquot = ext3_release_dquot,
715 .mark_dirty = ext3_mark_dquot_dirty, 715 .mark_dirty = ext3_mark_dquot_dirty,
716 .write_info = ext3_write_info 716 .write_info = ext3_write_info,
717 .alloc_dquot = dquot_alloc,
718 .destroy_dquot = dquot_destroy,
717}; 719};
718 720
719static struct quotactl_ops ext3_qctl_operations = { 721static struct quotactl_ops ext3_qctl_operations = {
@@ -1035,8 +1037,7 @@ static int parse_options (char *options, struct super_block *sb,
1035 case Opt_grpjquota: 1037 case Opt_grpjquota:
1036 qtype = GRPQUOTA; 1038 qtype = GRPQUOTA;
1037set_qf_name: 1039set_qf_name:
1038 if ((sb_any_quota_enabled(sb) || 1040 if (sb_any_quota_loaded(sb) &&
1039 sb_any_quota_suspended(sb)) &&
1040 !sbi->s_qf_names[qtype]) { 1041 !sbi->s_qf_names[qtype]) {
1041 printk(KERN_ERR 1042 printk(KERN_ERR
1042 "EXT3-fs: Cannot change journaled " 1043 "EXT3-fs: Cannot change journaled "
@@ -1075,8 +1076,7 @@ set_qf_name:
1075 case Opt_offgrpjquota: 1076 case Opt_offgrpjquota:
1076 qtype = GRPQUOTA; 1077 qtype = GRPQUOTA;
1077clear_qf_name: 1078clear_qf_name:
1078 if ((sb_any_quota_enabled(sb) || 1079 if (sb_any_quota_loaded(sb) &&
1079 sb_any_quota_suspended(sb)) &&
1080 sbi->s_qf_names[qtype]) { 1080 sbi->s_qf_names[qtype]) {
1081 printk(KERN_ERR "EXT3-fs: Cannot change " 1081 printk(KERN_ERR "EXT3-fs: Cannot change "
1082 "journaled quota options when " 1082 "journaled quota options when "
@@ -1095,8 +1095,7 @@ clear_qf_name:
1095 case Opt_jqfmt_vfsv0: 1095 case Opt_jqfmt_vfsv0:
1096 qfmt = QFMT_VFS_V0; 1096 qfmt = QFMT_VFS_V0;
1097set_qf_format: 1097set_qf_format:
1098 if ((sb_any_quota_enabled(sb) || 1098 if (sb_any_quota_loaded(sb) &&
1099 sb_any_quota_suspended(sb)) &&
1100 sbi->s_jquota_fmt != qfmt) { 1099 sbi->s_jquota_fmt != qfmt) {
1101 printk(KERN_ERR "EXT3-fs: Cannot change " 1100 printk(KERN_ERR "EXT3-fs: Cannot change "
1102 "journaled quota options when " 1101 "journaled quota options when "
@@ -1115,8 +1114,7 @@ set_qf_format:
1115 set_opt(sbi->s_mount_opt, GRPQUOTA); 1114 set_opt(sbi->s_mount_opt, GRPQUOTA);
1116 break; 1115 break;
1117 case Opt_noquota: 1116 case Opt_noquota:
1118 if (sb_any_quota_enabled(sb) || 1117 if (sb_any_quota_loaded(sb)) {
1119 sb_any_quota_suspended(sb)) {
1120 printk(KERN_ERR "EXT3-fs: Cannot change quota " 1118 printk(KERN_ERR "EXT3-fs: Cannot change quota "
1121 "options when quota turned on.\n"); 1119 "options when quota turned on.\n");
1122 return 0; 1120 return 0;
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 04158ad74dbb..9494bb249390 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -803,7 +803,9 @@ static struct dquot_operations ext4_quota_operations = {
803 .acquire_dquot = ext4_acquire_dquot, 803 .acquire_dquot = ext4_acquire_dquot,
804 .release_dquot = ext4_release_dquot, 804 .release_dquot = ext4_release_dquot,
805 .mark_dirty = ext4_mark_dquot_dirty, 805 .mark_dirty = ext4_mark_dquot_dirty,
806 .write_info = ext4_write_info 806 .write_info = ext4_write_info,
807 .alloc_dquot = dquot_alloc,
808 .destroy_dquot = dquot_destroy,
807}; 809};
808 810
809static struct quotactl_ops ext4_qctl_operations = { 811static struct quotactl_ops ext4_qctl_operations = {
@@ -1142,8 +1144,7 @@ static int parse_options(char *options, struct super_block *sb,
1142 case Opt_grpjquota: 1144 case Opt_grpjquota:
1143 qtype = GRPQUOTA; 1145 qtype = GRPQUOTA;
1144set_qf_name: 1146set_qf_name:
1145 if ((sb_any_quota_enabled(sb) || 1147 if (sb_any_quota_loaded(sb) &&
1146 sb_any_quota_suspended(sb)) &&
1147 !sbi->s_qf_names[qtype]) { 1148 !sbi->s_qf_names[qtype]) {
1148 printk(KERN_ERR 1149 printk(KERN_ERR
1149 "EXT4-fs: Cannot change journaled " 1150 "EXT4-fs: Cannot change journaled "
@@ -1182,8 +1183,7 @@ set_qf_name:
1182 case Opt_offgrpjquota: 1183 case Opt_offgrpjquota:
1183 qtype = GRPQUOTA; 1184 qtype = GRPQUOTA;
1184clear_qf_name: 1185clear_qf_name:
1185 if ((sb_any_quota_enabled(sb) || 1186 if (sb_any_quota_loaded(sb) &&
1186 sb_any_quota_suspended(sb)) &&
1187 sbi->s_qf_names[qtype]) { 1187 sbi->s_qf_names[qtype]) {
1188 printk(KERN_ERR "EXT4-fs: Cannot change " 1188 printk(KERN_ERR "EXT4-fs: Cannot change "
1189 "journaled quota options when " 1189 "journaled quota options when "
@@ -1202,8 +1202,7 @@ clear_qf_name:
1202 case Opt_jqfmt_vfsv0: 1202 case Opt_jqfmt_vfsv0:
1203 qfmt = QFMT_VFS_V0; 1203 qfmt = QFMT_VFS_V0;
1204set_qf_format: 1204set_qf_format:
1205 if ((sb_any_quota_enabled(sb) || 1205 if (sb_any_quota_loaded(sb) &&
1206 sb_any_quota_suspended(sb)) &&
1207 sbi->s_jquota_fmt != qfmt) { 1206 sbi->s_jquota_fmt != qfmt) {
1208 printk(KERN_ERR "EXT4-fs: Cannot change " 1207 printk(KERN_ERR "EXT4-fs: Cannot change "
1209 "journaled quota options when " 1208 "journaled quota options when "
@@ -1222,7 +1221,7 @@ set_qf_format:
1222 set_opt(sbi->s_mount_opt, GRPQUOTA); 1221 set_opt(sbi->s_mount_opt, GRPQUOTA);
1223 break; 1222 break;
1224 case Opt_noquota: 1223 case Opt_noquota:
1225 if (sb_any_quota_enabled(sb)) { 1224 if (sb_any_quota_loaded(sb)) {
1226 printk(KERN_ERR "EXT4-fs: Cannot change quota " 1225 printk(KERN_ERR "EXT4-fs: Cannot change quota "
1227 "options when quota turned on.\n"); 1226 "options when quota turned on.\n");
1228 return 0; 1227 return 0;
diff --git a/fs/filesystems.c b/fs/filesystems.c
index d0e20ced62dd..d488dcd7f2bb 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -253,24 +253,27 @@ static int __init proc_filesystems_init(void)
253module_init(proc_filesystems_init); 253module_init(proc_filesystems_init);
254#endif 254#endif
255 255
256struct file_system_type *get_fs_type(const char *name) 256static struct file_system_type *__get_fs_type(const char *name, int len)
257{ 257{
258 struct file_system_type *fs; 258 struct file_system_type *fs;
259 const char *dot = strchr(name, '.');
260 unsigned len = dot ? dot - name : strlen(name);
261 259
262 read_lock(&file_systems_lock); 260 read_lock(&file_systems_lock);
263 fs = *(find_filesystem(name, len)); 261 fs = *(find_filesystem(name, len));
264 if (fs && !try_module_get(fs->owner)) 262 if (fs && !try_module_get(fs->owner))
265 fs = NULL; 263 fs = NULL;
266 read_unlock(&file_systems_lock); 264 read_unlock(&file_systems_lock);
267 if (!fs && (request_module("%.*s", len, name) == 0)) { 265 return fs;
268 read_lock(&file_systems_lock); 266}
269 fs = *(find_filesystem(name, len)); 267
270 if (fs && !try_module_get(fs->owner)) 268struct file_system_type *get_fs_type(const char *name)
271 fs = NULL; 269{
272 read_unlock(&file_systems_lock); 270 struct file_system_type *fs;
273 } 271 const char *dot = strchr(name, '.');
272 int len = dot ? dot - name : strlen(name);
273
274 fs = __get_fs_type(name, len);
275 if (!fs && (request_module("%.*s", len, name) == 0))
276 fs = __get_fs_type(name, len);
274 277
275 if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) { 278 if (dot && fs && !(fs->fs_flags & FS_HAS_SUBTYPE)) {
276 put_filesystem(fs); 279 put_filesystem(fs);
diff --git a/fs/gfs2/Makefile b/fs/gfs2/Makefile
index ec65851ec80a..c1b4ec6a9650 100644
--- a/fs/gfs2/Makefile
+++ b/fs/gfs2/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_GFS2_FS) += gfs2.o 1obj-$(CONFIG_GFS2_FS) += gfs2.o
2gfs2-y := acl.o bmap.o daemon.o dir.o eaops.o eattr.o glock.o \ 2gfs2-y := acl.o bmap.o dir.o eaops.o eattr.o glock.o \
3 glops.o inode.o log.o lops.o locking.o main.o meta_io.o \ 3 glops.o inode.o log.o lops.o locking.o main.o meta_io.o \
4 mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \ 4 mount.o ops_address.o ops_dentry.o ops_export.o ops_file.o \
5 ops_fstype.o ops_inode.o ops_super.o quota.o \ 5 ops_fstype.o ops_inode.o ops_super.o quota.o \
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index 3e9bd46f27e3..e335dceb6a4f 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -91,7 +91,7 @@ static int acl_get(struct gfs2_inode *ip, int access, struct posix_acl **acl,
91 struct gfs2_ea_location el_this; 91 struct gfs2_ea_location el_this;
92 int error; 92 int error;
93 93
94 if (!ip->i_di.di_eattr) 94 if (!ip->i_eattr)
95 return 0; 95 return 0;
96 96
97 memset(&er, 0, sizeof(struct gfs2_ea_request)); 97 memset(&er, 0, sizeof(struct gfs2_ea_request));
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c
index bec76b1c2bb0..11ffc56f1f81 100644
--- a/fs/gfs2/bmap.c
+++ b/fs/gfs2/bmap.c
@@ -75,9 +75,9 @@ static int gfs2_unstuffer_page(struct gfs2_inode *ip, struct buffer_head *dibh,
75 void *kaddr = kmap(page); 75 void *kaddr = kmap(page);
76 76
77 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), 77 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
78 ip->i_di.di_size); 78 ip->i_disksize);
79 memset(kaddr + ip->i_di.di_size, 0, 79 memset(kaddr + ip->i_disksize, 0,
80 PAGE_CACHE_SIZE - ip->i_di.di_size); 80 PAGE_CACHE_SIZE - ip->i_disksize);
81 kunmap(page); 81 kunmap(page);
82 82
83 SetPageUptodate(page); 83 SetPageUptodate(page);
@@ -132,7 +132,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
132 if (error) 132 if (error)
133 goto out; 133 goto out;
134 134
135 if (ip->i_di.di_size) { 135 if (ip->i_disksize) {
136 /* Get a free block, fill it with the stuffed data, 136 /* Get a free block, fill it with the stuffed data,
137 and write it out to disk */ 137 and write it out to disk */
138 138
@@ -159,7 +159,7 @@ int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page)
159 di = (struct gfs2_dinode *)dibh->b_data; 159 di = (struct gfs2_dinode *)dibh->b_data;
160 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 160 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
161 161
162 if (ip->i_di.di_size) { 162 if (ip->i_disksize) {
163 *(__be64 *)(di + 1) = cpu_to_be64(block); 163 *(__be64 *)(di + 1) = cpu_to_be64(block);
164 gfs2_add_inode_blocks(&ip->i_inode, 1); 164 gfs2_add_inode_blocks(&ip->i_inode, 1);
165 di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); 165 di->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
@@ -926,7 +926,7 @@ static int do_grow(struct gfs2_inode *ip, u64 size)
926 } 926 }
927 } 927 }
928 928
929 ip->i_di.di_size = size; 929 ip->i_disksize = size;
930 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 930 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
931 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 931 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
932 gfs2_dinode_out(ip, dibh->b_data); 932 gfs2_dinode_out(ip, dibh->b_data);
@@ -1033,7 +1033,7 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
1033 goto out; 1033 goto out;
1034 1034
1035 if (gfs2_is_stuffed(ip)) { 1035 if (gfs2_is_stuffed(ip)) {
1036 ip->i_di.di_size = size; 1036 ip->i_disksize = size;
1037 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1037 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1038 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1038 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1039 gfs2_dinode_out(ip, dibh->b_data); 1039 gfs2_dinode_out(ip, dibh->b_data);
@@ -1045,9 +1045,9 @@ static int trunc_start(struct gfs2_inode *ip, u64 size)
1045 error = gfs2_block_truncate_page(ip->i_inode.i_mapping); 1045 error = gfs2_block_truncate_page(ip->i_inode.i_mapping);
1046 1046
1047 if (!error) { 1047 if (!error) {
1048 ip->i_di.di_size = size; 1048 ip->i_disksize = size;
1049 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1049 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1050 ip->i_di.di_flags |= GFS2_DIF_TRUNC_IN_PROG; 1050 ip->i_diskflags |= GFS2_DIF_TRUNC_IN_PROG;
1051 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1051 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1052 gfs2_dinode_out(ip, dibh->b_data); 1052 gfs2_dinode_out(ip, dibh->b_data);
1053 } 1053 }
@@ -1114,13 +1114,13 @@ static int trunc_end(struct gfs2_inode *ip)
1114 if (error) 1114 if (error)
1115 goto out; 1115 goto out;
1116 1116
1117 if (!ip->i_di.di_size) { 1117 if (!ip->i_disksize) {
1118 ip->i_height = 0; 1118 ip->i_height = 0;
1119 ip->i_goal = ip->i_no_addr; 1119 ip->i_goal = ip->i_no_addr;
1120 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode)); 1120 gfs2_buffer_clear_tail(dibh, sizeof(struct gfs2_dinode));
1121 } 1121 }
1122 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1122 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1123 ip->i_di.di_flags &= ~GFS2_DIF_TRUNC_IN_PROG; 1123 ip->i_diskflags &= ~GFS2_DIF_TRUNC_IN_PROG;
1124 1124
1125 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 1125 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
1126 gfs2_dinode_out(ip, dibh->b_data); 1126 gfs2_dinode_out(ip, dibh->b_data);
@@ -1205,9 +1205,9 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
1205 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode))) 1205 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), S_ISREG(ip->i_inode.i_mode)))
1206 return -EINVAL; 1206 return -EINVAL;
1207 1207
1208 if (size > ip->i_di.di_size) 1208 if (size > ip->i_disksize)
1209 error = do_grow(ip, size); 1209 error = do_grow(ip, size);
1210 else if (size < ip->i_di.di_size) 1210 else if (size < ip->i_disksize)
1211 error = do_shrink(ip, size); 1211 error = do_shrink(ip, size);
1212 else 1212 else
1213 /* update time stamps */ 1213 /* update time stamps */
@@ -1219,7 +1219,7 @@ int gfs2_truncatei(struct gfs2_inode *ip, u64 size)
1219int gfs2_truncatei_resume(struct gfs2_inode *ip) 1219int gfs2_truncatei_resume(struct gfs2_inode *ip)
1220{ 1220{
1221 int error; 1221 int error;
1222 error = trunc_dealloc(ip, ip->i_di.di_size); 1222 error = trunc_dealloc(ip, ip->i_disksize);
1223 if (!error) 1223 if (!error)
1224 error = trunc_end(ip); 1224 error = trunc_end(ip);
1225 return error; 1225 return error;
@@ -1231,35 +1231,6 @@ int gfs2_file_dealloc(struct gfs2_inode *ip)
1231} 1231}
1232 1232
1233/** 1233/**
1234 * gfs2_write_calc_reserv - calculate number of blocks needed to write to a file
1235 * @ip: the file
1236 * @len: the number of bytes to be written to the file
1237 * @data_blocks: returns the number of data blocks required
1238 * @ind_blocks: returns the number of indirect blocks required
1239 *
1240 */
1241
1242void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
1243 unsigned int *data_blocks, unsigned int *ind_blocks)
1244{
1245 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
1246 unsigned int tmp;
1247
1248 if (gfs2_is_dir(ip)) {
1249 *data_blocks = DIV_ROUND_UP(len, sdp->sd_jbsize) + 2;
1250 *ind_blocks = 3 * (sdp->sd_max_jheight - 1);
1251 } else {
1252 *data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
1253 *ind_blocks = 3 * (sdp->sd_max_height - 1);
1254 }
1255
1256 for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
1257 tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
1258 *ind_blocks += tmp;
1259 }
1260}
1261
1262/**
1263 * gfs2_write_alloc_required - figure out if a write will require an allocation 1234 * gfs2_write_alloc_required - figure out if a write will require an allocation
1264 * @ip: the file being written to 1235 * @ip: the file being written to
1265 * @offset: the offset to write to 1236 * @offset: the offset to write to
@@ -1276,6 +1247,7 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
1276 struct buffer_head bh; 1247 struct buffer_head bh;
1277 unsigned int shift; 1248 unsigned int shift;
1278 u64 lblock, lblock_stop, size; 1249 u64 lblock, lblock_stop, size;
1250 u64 end_of_file;
1279 1251
1280 *alloc_required = 0; 1252 *alloc_required = 0;
1281 1253
@@ -1291,19 +1263,12 @@ int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
1291 1263
1292 *alloc_required = 1; 1264 *alloc_required = 1;
1293 shift = sdp->sd_sb.sb_bsize_shift; 1265 shift = sdp->sd_sb.sb_bsize_shift;
1294 if (gfs2_is_dir(ip)) { 1266 BUG_ON(gfs2_is_dir(ip));
1295 unsigned int bsize = sdp->sd_jbsize; 1267 end_of_file = (ip->i_disksize + sdp->sd_sb.sb_bsize - 1) >> shift;
1296 lblock = offset; 1268 lblock = offset >> shift;
1297 do_div(lblock, bsize); 1269 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
1298 lblock_stop = offset + len + bsize - 1; 1270 if (lblock_stop > end_of_file)
1299 do_div(lblock_stop, bsize); 1271 return 0;
1300 } else {
1301 u64 end_of_file = (ip->i_di.di_size + sdp->sd_sb.sb_bsize - 1) >> shift;
1302 lblock = offset >> shift;
1303 lblock_stop = (offset + len + sdp->sd_sb.sb_bsize - 1) >> shift;
1304 if (lblock_stop > end_of_file)
1305 return 0;
1306 }
1307 1272
1308 size = (lblock_stop - lblock) << shift; 1273 size = (lblock_stop - lblock) << shift;
1309 do { 1274 do {
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h
index 4e6cde2943bd..c983177e05ac 100644
--- a/fs/gfs2/bmap.h
+++ b/fs/gfs2/bmap.h
@@ -10,10 +10,40 @@
10#ifndef __BMAP_DOT_H__ 10#ifndef __BMAP_DOT_H__
11#define __BMAP_DOT_H__ 11#define __BMAP_DOT_H__
12 12
13#include "inode.h"
14
13struct inode; 15struct inode;
14struct gfs2_inode; 16struct gfs2_inode;
15struct page; 17struct page;
16 18
19
20/**
21 * gfs2_write_calc_reserv - calculate number of blocks needed to write to a file
22 * @ip: the file
23 * @len: the number of bytes to be written to the file
24 * @data_blocks: returns the number of data blocks required
25 * @ind_blocks: returns the number of indirect blocks required
26 *
27 */
28
29static inline void gfs2_write_calc_reserv(const struct gfs2_inode *ip,
30 unsigned int len,
31 unsigned int *data_blocks,
32 unsigned int *ind_blocks)
33{
34 const struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
35 unsigned int tmp;
36
37 BUG_ON(gfs2_is_dir(ip));
38 *data_blocks = (len >> sdp->sd_sb.sb_bsize_shift) + 3;
39 *ind_blocks = 3 * (sdp->sd_max_height - 1);
40
41 for (tmp = *data_blocks; tmp > sdp->sd_diptrs;) {
42 tmp = DIV_ROUND_UP(tmp, sdp->sd_inptrs);
43 *ind_blocks += tmp;
44 }
45}
46
17int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); 47int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page);
18int gfs2_block_map(struct inode *inode, sector_t lblock, struct buffer_head *bh, int create); 48int gfs2_block_map(struct inode *inode, sector_t lblock, struct buffer_head *bh, int create);
19int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); 49int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen);
@@ -21,10 +51,6 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi
21int gfs2_truncatei(struct gfs2_inode *ip, u64 size); 51int gfs2_truncatei(struct gfs2_inode *ip, u64 size);
22int gfs2_truncatei_resume(struct gfs2_inode *ip); 52int gfs2_truncatei_resume(struct gfs2_inode *ip);
23int gfs2_file_dealloc(struct gfs2_inode *ip); 53int gfs2_file_dealloc(struct gfs2_inode *ip);
24
25void gfs2_write_calc_reserv(struct gfs2_inode *ip, unsigned int len,
26 unsigned int *data_blocks,
27 unsigned int *ind_blocks);
28int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset, 54int gfs2_write_alloc_required(struct gfs2_inode *ip, u64 offset,
29 unsigned int len, int *alloc_required); 55 unsigned int len, int *alloc_required);
30 56
diff --git a/fs/gfs2/daemon.c b/fs/gfs2/daemon.c
deleted file mode 100644
index e51991947d2c..000000000000
--- a/fs/gfs2/daemon.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#include <linux/sched.h>
11#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/completion.h>
14#include <linux/buffer_head.h>
15#include <linux/kthread.h>
16#include <linux/delay.h>
17#include <linux/gfs2_ondisk.h>
18#include <linux/lm_interface.h>
19#include <linux/freezer.h>
20
21#include "gfs2.h"
22#include "incore.h"
23#include "daemon.h"
24#include "glock.h"
25#include "log.h"
26#include "quota.h"
27#include "recovery.h"
28#include "super.h"
29#include "util.h"
30
31/* This uses schedule_timeout() instead of msleep() because it's good for
32 the daemons to wake up more often than the timeout when unmounting so
33 the user's unmount doesn't sit there forever.
34
35 The kthread functions used to start these daemons block and flush signals. */
36
37/**
38 * gfs2_glockd - Reclaim unused glock structures
39 * @sdp: Pointer to GFS2 superblock
40 *
41 * One or more of these daemons run, reclaiming glocks on sd_reclaim_list.
42 * Number of daemons can be set by user, with num_glockd mount option.
43 */
44
45int gfs2_glockd(void *data)
46{
47 struct gfs2_sbd *sdp = data;
48
49 while (!kthread_should_stop()) {
50 while (atomic_read(&sdp->sd_reclaim_count))
51 gfs2_reclaim_glock(sdp);
52
53 wait_event_interruptible(sdp->sd_reclaim_wq,
54 (atomic_read(&sdp->sd_reclaim_count) ||
55 kthread_should_stop()));
56 if (freezing(current))
57 refrigerator();
58 }
59
60 return 0;
61}
62
63/**
64 * gfs2_recoverd - Recover dead machine's journals
65 * @sdp: Pointer to GFS2 superblock
66 *
67 */
68
69int gfs2_recoverd(void *data)
70{
71 struct gfs2_sbd *sdp = data;
72 unsigned long t;
73
74 while (!kthread_should_stop()) {
75 gfs2_check_journals(sdp);
76 t = gfs2_tune_get(sdp, gt_recoverd_secs) * HZ;
77 if (freezing(current))
78 refrigerator();
79 schedule_timeout_interruptible(t);
80 }
81
82 return 0;
83}
84
85/**
86 * gfs2_quotad - Write cached quota changes into the quota file
87 * @sdp: Pointer to GFS2 superblock
88 *
89 */
90
91int gfs2_quotad(void *data)
92{
93 struct gfs2_sbd *sdp = data;
94 unsigned long t;
95 int error;
96
97 while (!kthread_should_stop()) {
98 /* Update the master statfs file */
99
100 t = sdp->sd_statfs_sync_time +
101 gfs2_tune_get(sdp, gt_statfs_quantum) * HZ;
102
103 if (time_after_eq(jiffies, t)) {
104 error = gfs2_statfs_sync(sdp);
105 if (error &&
106 error != -EROFS &&
107 !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
108 fs_err(sdp, "quotad: (1) error=%d\n", error);
109 sdp->sd_statfs_sync_time = jiffies;
110 }
111
112 /* Update quota file */
113
114 t = sdp->sd_quota_sync_time +
115 gfs2_tune_get(sdp, gt_quota_quantum) * HZ;
116
117 if (time_after_eq(jiffies, t)) {
118 error = gfs2_quota_sync(sdp);
119 if (error &&
120 error != -EROFS &&
121 !test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
122 fs_err(sdp, "quotad: (2) error=%d\n", error);
123 sdp->sd_quota_sync_time = jiffies;
124 }
125
126 gfs2_quota_scan(sdp);
127
128 t = gfs2_tune_get(sdp, gt_quotad_secs) * HZ;
129 if (freezing(current))
130 refrigerator();
131 schedule_timeout_interruptible(t);
132 }
133
134 return 0;
135}
136
diff --git a/fs/gfs2/daemon.h b/fs/gfs2/daemon.h
deleted file mode 100644
index 4be084fb6a62..000000000000
--- a/fs/gfs2/daemon.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __DAEMON_DOT_H__
11#define __DAEMON_DOT_H__
12
13int gfs2_glockd(void *data);
14int gfs2_recoverd(void *data);
15int gfs2_quotad(void *data);
16
17#endif /* __DAEMON_DOT_H__ */
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index eed040d8ba3a..b7c8e5c70791 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -36,7 +36,7 @@
36 * the block. In leaves, they begin at offset sizeof(struct gfs2_leaf) from the 36 * the block. In leaves, they begin at offset sizeof(struct gfs2_leaf) from the
37 * beginning of the leaf block. The dirents reside in leaves when 37 * beginning of the leaf block. The dirents reside in leaves when
38 * 38 *
39 * dip->i_di.di_flags & GFS2_DIF_EXHASH is true 39 * dip->i_diskflags & GFS2_DIF_EXHASH is true
40 * 40 *
41 * Otherwise, the dirents are "linear", within a single stuffed dinode block. 41 * Otherwise, the dirents are "linear", within a single stuffed dinode block.
42 * 42 *
@@ -128,8 +128,8 @@ static int gfs2_dir_write_stuffed(struct gfs2_inode *ip, const char *buf,
128 128
129 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 129 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
130 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size); 130 memcpy(dibh->b_data + offset + sizeof(struct gfs2_dinode), buf, size);
131 if (ip->i_di.di_size < offset + size) 131 if (ip->i_disksize < offset + size)
132 ip->i_di.di_size = offset + size; 132 ip->i_disksize = offset + size;
133 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 133 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
134 gfs2_dinode_out(ip, dibh->b_data); 134 gfs2_dinode_out(ip, dibh->b_data);
135 135
@@ -226,8 +226,8 @@ out:
226 if (error) 226 if (error)
227 return error; 227 return error;
228 228
229 if (ip->i_di.di_size < offset + copied) 229 if (ip->i_disksize < offset + copied)
230 ip->i_di.di_size = offset + copied; 230 ip->i_disksize = offset + copied;
231 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 231 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
232 232
233 gfs2_trans_add_bh(ip->i_gl, dibh, 1); 233 gfs2_trans_add_bh(ip->i_gl, dibh, 1);
@@ -277,11 +277,11 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset,
277 int copied = 0; 277 int copied = 0;
278 int error = 0; 278 int error = 0;
279 279
280 if (offset >= ip->i_di.di_size) 280 if (offset >= ip->i_disksize)
281 return 0; 281 return 0;
282 282
283 if (offset + size > ip->i_di.di_size) 283 if (offset + size > ip->i_disksize)
284 size = ip->i_di.di_size - offset; 284 size = ip->i_disksize - offset;
285 285
286 if (!size) 286 if (!size)
287 return 0; 287 return 0;
@@ -755,12 +755,12 @@ static struct gfs2_dirent *gfs2_dirent_search(struct inode *inode,
755 struct gfs2_inode *ip = GFS2_I(inode); 755 struct gfs2_inode *ip = GFS2_I(inode);
756 int error; 756 int error;
757 757
758 if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { 758 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
759 struct gfs2_leaf *leaf; 759 struct gfs2_leaf *leaf;
760 unsigned hsize = 1 << ip->i_depth; 760 unsigned hsize = 1 << ip->i_depth;
761 unsigned index; 761 unsigned index;
762 u64 ln; 762 u64 ln;
763 if (hsize * sizeof(u64) != ip->i_di.di_size) { 763 if (hsize * sizeof(u64) != ip->i_disksize) {
764 gfs2_consist_inode(ip); 764 gfs2_consist_inode(ip);
765 return ERR_PTR(-EIO); 765 return ERR_PTR(-EIO);
766 } 766 }
@@ -858,8 +858,8 @@ static int dir_make_exhash(struct inode *inode)
858 return -ENOSPC; 858 return -ENOSPC;
859 bn = bh->b_blocknr; 859 bn = bh->b_blocknr;
860 860
861 gfs2_assert(sdp, dip->i_di.di_entries < (1 << 16)); 861 gfs2_assert(sdp, dip->i_entries < (1 << 16));
862 leaf->lf_entries = cpu_to_be16(dip->i_di.di_entries); 862 leaf->lf_entries = cpu_to_be16(dip->i_entries);
863 863
864 /* Copy dirents */ 864 /* Copy dirents */
865 865
@@ -905,9 +905,9 @@ static int dir_make_exhash(struct inode *inode)
905 for (x = sdp->sd_hash_ptrs; x--; lp++) 905 for (x = sdp->sd_hash_ptrs; x--; lp++)
906 *lp = cpu_to_be64(bn); 906 *lp = cpu_to_be64(bn);
907 907
908 dip->i_di.di_size = sdp->sd_sb.sb_bsize / 2; 908 dip->i_disksize = sdp->sd_sb.sb_bsize / 2;
909 gfs2_add_inode_blocks(&dip->i_inode, 1); 909 gfs2_add_inode_blocks(&dip->i_inode, 1);
910 dip->i_di.di_flags |= GFS2_DIF_EXHASH; 910 dip->i_diskflags |= GFS2_DIF_EXHASH;
911 911
912 for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ; 912 for (x = sdp->sd_hash_ptrs, y = -1; x; x >>= 1, y++) ;
913 dip->i_depth = y; 913 dip->i_depth = y;
@@ -1082,7 +1082,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
1082 int error = 0; 1082 int error = 0;
1083 1083
1084 hsize = 1 << dip->i_depth; 1084 hsize = 1 << dip->i_depth;
1085 if (hsize * sizeof(u64) != dip->i_di.di_size) { 1085 if (hsize * sizeof(u64) != dip->i_disksize) {
1086 gfs2_consist_inode(dip); 1086 gfs2_consist_inode(dip);
1087 return -EIO; 1087 return -EIO;
1088 } 1088 }
@@ -1091,7 +1091,7 @@ static int dir_double_exhash(struct gfs2_inode *dip)
1091 1091
1092 buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS | __GFP_NOFAIL); 1092 buf = kcalloc(3, sdp->sd_hash_bsize, GFP_NOFS | __GFP_NOFAIL);
1093 1093
1094 for (block = dip->i_di.di_size >> sdp->sd_hash_bsize_shift; block--;) { 1094 for (block = dip->i_disksize >> sdp->sd_hash_bsize_shift; block--;) {
1095 error = gfs2_dir_read_data(dip, (char *)buf, 1095 error = gfs2_dir_read_data(dip, (char *)buf,
1096 block * sdp->sd_hash_bsize, 1096 block * sdp->sd_hash_bsize,
1097 sdp->sd_hash_bsize, 1); 1097 sdp->sd_hash_bsize, 1);
@@ -1370,7 +1370,7 @@ static int dir_e_read(struct inode *inode, u64 *offset, void *opaque,
1370 unsigned depth = 0; 1370 unsigned depth = 0;
1371 1371
1372 hsize = 1 << dip->i_depth; 1372 hsize = 1 << dip->i_depth;
1373 if (hsize * sizeof(u64) != dip->i_di.di_size) { 1373 if (hsize * sizeof(u64) != dip->i_disksize) {
1374 gfs2_consist_inode(dip); 1374 gfs2_consist_inode(dip);
1375 return -EIO; 1375 return -EIO;
1376 } 1376 }
@@ -1426,10 +1426,10 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
1426 int copied = 0; 1426 int copied = 0;
1427 int error; 1427 int error;
1428 1428
1429 if (!dip->i_di.di_entries) 1429 if (!dip->i_entries)
1430 return 0; 1430 return 0;
1431 1431
1432 if (dip->i_di.di_flags & GFS2_DIF_EXHASH) 1432 if (dip->i_diskflags & GFS2_DIF_EXHASH)
1433 return dir_e_read(inode, offset, opaque, filldir); 1433 return dir_e_read(inode, offset, opaque, filldir);
1434 1434
1435 if (!gfs2_is_stuffed(dip)) { 1435 if (!gfs2_is_stuffed(dip)) {
@@ -1453,17 +1453,17 @@ int gfs2_dir_read(struct inode *inode, u64 *offset, void *opaque,
1453 error = PTR_ERR(dent); 1453 error = PTR_ERR(dent);
1454 goto out; 1454 goto out;
1455 } 1455 }
1456 if (dip->i_di.di_entries != g.offset) { 1456 if (dip->i_entries != g.offset) {
1457 fs_warn(sdp, "Number of entries corrupt in dir %llu, " 1457 fs_warn(sdp, "Number of entries corrupt in dir %llu, "
1458 "ip->i_di.di_entries (%u) != g.offset (%u)\n", 1458 "ip->i_entries (%u) != g.offset (%u)\n",
1459 (unsigned long long)dip->i_no_addr, 1459 (unsigned long long)dip->i_no_addr,
1460 dip->i_di.di_entries, 1460 dip->i_entries,
1461 g.offset); 1461 g.offset);
1462 error = -EIO; 1462 error = -EIO;
1463 goto out; 1463 goto out;
1464 } 1464 }
1465 error = do_filldir_main(dip, offset, opaque, filldir, darr, 1465 error = do_filldir_main(dip, offset, opaque, filldir, darr,
1466 dip->i_di.di_entries, &copied); 1466 dip->i_entries, &copied);
1467out: 1467out:
1468 kfree(darr); 1468 kfree(darr);
1469 } 1469 }
@@ -1612,7 +1612,7 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1612 dent = gfs2_init_dirent(inode, dent, name, bh); 1612 dent = gfs2_init_dirent(inode, dent, name, bh);
1613 gfs2_inum_out(nip, dent); 1613 gfs2_inum_out(nip, dent);
1614 dent->de_type = cpu_to_be16(type); 1614 dent->de_type = cpu_to_be16(type);
1615 if (ip->i_di.di_flags & GFS2_DIF_EXHASH) { 1615 if (ip->i_diskflags & GFS2_DIF_EXHASH) {
1616 leaf = (struct gfs2_leaf *)bh->b_data; 1616 leaf = (struct gfs2_leaf *)bh->b_data;
1617 be16_add_cpu(&leaf->lf_entries, 1); 1617 be16_add_cpu(&leaf->lf_entries, 1);
1618 } 1618 }
@@ -1621,14 +1621,14 @@ int gfs2_dir_add(struct inode *inode, const struct qstr *name,
1621 if (error) 1621 if (error)
1622 break; 1622 break;
1623 gfs2_trans_add_bh(ip->i_gl, bh, 1); 1623 gfs2_trans_add_bh(ip->i_gl, bh, 1);
1624 ip->i_di.di_entries++; 1624 ip->i_entries++;
1625 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME; 1625 ip->i_inode.i_mtime = ip->i_inode.i_ctime = CURRENT_TIME;
1626 gfs2_dinode_out(ip, bh->b_data); 1626 gfs2_dinode_out(ip, bh->b_data);
1627 brelse(bh); 1627 brelse(bh);
1628 error = 0; 1628 error = 0;
1629 break; 1629 break;
1630 } 1630 }
1631 if (!(ip->i_di.di_flags & GFS2_DIF_EXHASH)) { 1631 if (!(ip->i_diskflags & GFS2_DIF_EXHASH)) {
1632 error = dir_make_exhash(inode); 1632 error = dir_make_exhash(inode);
1633 if (error) 1633 if (error)
1634 break; 1634 break;
@@ -1691,7 +1691,7 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
1691 } 1691 }
1692 1692
1693 dirent_del(dip, bh, prev, dent); 1693 dirent_del(dip, bh, prev, dent);
1694 if (dip->i_di.di_flags & GFS2_DIF_EXHASH) { 1694 if (dip->i_diskflags & GFS2_DIF_EXHASH) {
1695 struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data; 1695 struct gfs2_leaf *leaf = (struct gfs2_leaf *)bh->b_data;
1696 u16 entries = be16_to_cpu(leaf->lf_entries); 1696 u16 entries = be16_to_cpu(leaf->lf_entries);
1697 if (!entries) 1697 if (!entries)
@@ -1704,10 +1704,10 @@ int gfs2_dir_del(struct gfs2_inode *dip, const struct qstr *name)
1704 if (error) 1704 if (error)
1705 return error; 1705 return error;
1706 1706
1707 if (!dip->i_di.di_entries) 1707 if (!dip->i_entries)
1708 gfs2_consist_inode(dip); 1708 gfs2_consist_inode(dip);
1709 gfs2_trans_add_bh(dip->i_gl, bh, 1); 1709 gfs2_trans_add_bh(dip->i_gl, bh, 1);
1710 dip->i_di.di_entries--; 1710 dip->i_entries--;
1711 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME; 1711 dip->i_inode.i_mtime = dip->i_inode.i_ctime = CURRENT_TIME;
1712 gfs2_dinode_out(dip, bh->b_data); 1712 gfs2_dinode_out(dip, bh->b_data);
1713 brelse(bh); 1713 brelse(bh);
@@ -1748,7 +1748,7 @@ int gfs2_dir_mvino(struct gfs2_inode *dip, const struct qstr *filename,
1748 gfs2_inum_out(nip, dent); 1748 gfs2_inum_out(nip, dent);
1749 dent->de_type = cpu_to_be16(new_type); 1749 dent->de_type = cpu_to_be16(new_type);
1750 1750
1751 if (dip->i_di.di_flags & GFS2_DIF_EXHASH) { 1751 if (dip->i_diskflags & GFS2_DIF_EXHASH) {
1752 brelse(bh); 1752 brelse(bh);
1753 error = gfs2_meta_inode_buffer(dip, &bh); 1753 error = gfs2_meta_inode_buffer(dip, &bh);
1754 if (error) 1754 if (error)
@@ -1784,7 +1784,7 @@ static int foreach_leaf(struct gfs2_inode *dip, leaf_call_t lc, void *data)
1784 int error = 0; 1784 int error = 0;
1785 1785
1786 hsize = 1 << dip->i_depth; 1786 hsize = 1 << dip->i_depth;
1787 if (hsize * sizeof(u64) != dip->i_di.di_size) { 1787 if (hsize * sizeof(u64) != dip->i_disksize) {
1788 gfs2_consist_inode(dip); 1788 gfs2_consist_inode(dip);
1789 return -EIO; 1789 return -EIO;
1790 } 1790 }
diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h
index 8a468cac9328..4f919440c3be 100644
--- a/fs/gfs2/dir.h
+++ b/fs/gfs2/dir.h
@@ -11,6 +11,7 @@
11#define __DIR_DOT_H__ 11#define __DIR_DOT_H__
12 12
13#include <linux/dcache.h> 13#include <linux/dcache.h>
14#include <linux/crc32.h>
14 15
15struct inode; 16struct inode;
16struct gfs2_inode; 17struct gfs2_inode;
diff --git a/fs/gfs2/eattr.c b/fs/gfs2/eattr.c
index e3f76f451b0a..0d1c76d906ae 100644
--- a/fs/gfs2/eattr.c
+++ b/fs/gfs2/eattr.c
@@ -114,11 +114,11 @@ static int ea_foreach(struct gfs2_inode *ip, ea_call_t ea_call, void *data)
114 __be64 *eablk, *end; 114 __be64 *eablk, *end;
115 int error; 115 int error;
116 116
117 error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &bh); 117 error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &bh);
118 if (error) 118 if (error)
119 return error; 119 return error;
120 120
121 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) { 121 if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT)) {
122 error = ea_foreach_i(ip, bh, ea_call, data); 122 error = ea_foreach_i(ip, bh, ea_call, data);
123 goto out; 123 goto out;
124 } 124 }
@@ -414,7 +414,7 @@ int gfs2_ea_list(struct gfs2_inode *ip, struct gfs2_ea_request *er)
414 if (error) 414 if (error)
415 return error; 415 return error;
416 416
417 if (ip->i_di.di_eattr) { 417 if (ip->i_eattr) {
418 struct ea_list ei = { .ei_er = er, .ei_size = 0 }; 418 struct ea_list ei = { .ei_er = er, .ei_size = 0 };
419 419
420 error = ea_foreach(ip, ea_list_i, &ei); 420 error = ea_foreach(ip, ea_list_i, &ei);
@@ -514,7 +514,7 @@ int gfs2_ea_get_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
514 struct gfs2_ea_location el; 514 struct gfs2_ea_location el;
515 int error; 515 int error;
516 516
517 if (!ip->i_di.di_eattr) 517 if (!ip->i_eattr)
518 return -ENODATA; 518 return -ENODATA;
519 519
520 error = gfs2_ea_find(ip, er, &el); 520 error = gfs2_ea_find(ip, er, &el);
@@ -741,7 +741,7 @@ static int ea_init_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
741 if (error) 741 if (error)
742 return error; 742 return error;
743 743
744 ip->i_di.di_eattr = bh->b_blocknr; 744 ip->i_eattr = bh->b_blocknr;
745 error = ea_write(ip, GFS2_EA_BH2FIRST(bh), er); 745 error = ea_write(ip, GFS2_EA_BH2FIRST(bh), er);
746 746
747 brelse(bh); 747 brelse(bh);
@@ -935,10 +935,10 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
935 int error; 935 int error;
936 int mh_size = sizeof(struct gfs2_meta_header); 936 int mh_size = sizeof(struct gfs2_meta_header);
937 937
938 if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { 938 if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
939 __be64 *end; 939 __be64 *end;
940 940
941 error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, 941 error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT,
942 &indbh); 942 &indbh);
943 if (error) 943 if (error)
944 return error; 944 return error;
@@ -972,9 +972,9 @@ static int ea_set_block(struct gfs2_inode *ip, struct gfs2_ea_request *er,
972 gfs2_buffer_clear_tail(indbh, mh_size); 972 gfs2_buffer_clear_tail(indbh, mh_size);
973 973
974 eablk = (__be64 *)(indbh->b_data + mh_size); 974 eablk = (__be64 *)(indbh->b_data + mh_size);
975 *eablk = cpu_to_be64(ip->i_di.di_eattr); 975 *eablk = cpu_to_be64(ip->i_eattr);
976 ip->i_di.di_eattr = blk; 976 ip->i_eattr = blk;
977 ip->i_di.di_flags |= GFS2_DIF_EA_INDIRECT; 977 ip->i_diskflags |= GFS2_DIF_EA_INDIRECT;
978 gfs2_add_inode_blocks(&ip->i_inode, 1); 978 gfs2_add_inode_blocks(&ip->i_inode, 1);
979 979
980 eablk++; 980 eablk++;
@@ -1015,7 +1015,7 @@ static int ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er,
1015 if (error) 1015 if (error)
1016 return error; 1016 return error;
1017 1017
1018 if (!(ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT)) 1018 if (!(ip->i_diskflags & GFS2_DIF_EA_INDIRECT))
1019 blks++; 1019 blks++;
1020 if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize) 1020 if (GFS2_EAREQ_SIZE_STUFFED(er) > GFS2_SB(&ip->i_inode)->sd_jbsize)
1021 blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize); 1021 blks += DIV_ROUND_UP(er->er_data_len, GFS2_SB(&ip->i_inode)->sd_jbsize);
@@ -1040,7 +1040,7 @@ int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1040 struct gfs2_ea_location el; 1040 struct gfs2_ea_location el;
1041 int error; 1041 int error;
1042 1042
1043 if (!ip->i_di.di_eattr) { 1043 if (!ip->i_eattr) {
1044 if (er->er_flags & XATTR_REPLACE) 1044 if (er->er_flags & XATTR_REPLACE)
1045 return -ENODATA; 1045 return -ENODATA;
1046 return ea_init(ip, er); 1046 return ea_init(ip, er);
@@ -1051,7 +1051,7 @@ int gfs2_ea_set_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1051 return error; 1051 return error;
1052 1052
1053 if (el.el_ea) { 1053 if (el.el_ea) {
1054 if (ip->i_di.di_flags & GFS2_DIF_APPENDONLY) { 1054 if (ip->i_diskflags & GFS2_DIF_APPENDONLY) {
1055 brelse(el.el_bh); 1055 brelse(el.el_bh);
1056 return -EPERM; 1056 return -EPERM;
1057 } 1057 }
@@ -1145,7 +1145,7 @@ int gfs2_ea_remove_i(struct gfs2_inode *ip, struct gfs2_ea_request *er)
1145 struct gfs2_ea_location el; 1145 struct gfs2_ea_location el;
1146 int error; 1146 int error;
1147 1147
1148 if (!ip->i_di.di_eattr) 1148 if (!ip->i_eattr)
1149 return -ENODATA; 1149 return -ENODATA;
1150 1150
1151 error = gfs2_ea_find(ip, er, &el); 1151 error = gfs2_ea_find(ip, er, &el);
@@ -1309,7 +1309,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1309 1309
1310 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list)); 1310 memset(&rlist, 0, sizeof(struct gfs2_rgrp_list));
1311 1311
1312 error = gfs2_meta_read(ip->i_gl, ip->i_di.di_eattr, DIO_WAIT, &indbh); 1312 error = gfs2_meta_read(ip->i_gl, ip->i_eattr, DIO_WAIT, &indbh);
1313 if (error) 1313 if (error)
1314 return error; 1314 return error;
1315 1315
@@ -1388,7 +1388,7 @@ static int ea_dealloc_indirect(struct gfs2_inode *ip)
1388 if (bstart) 1388 if (bstart)
1389 gfs2_free_meta(ip, bstart, blen); 1389 gfs2_free_meta(ip, bstart, blen);
1390 1390
1391 ip->i_di.di_flags &= ~GFS2_DIF_EA_INDIRECT; 1391 ip->i_diskflags &= ~GFS2_DIF_EA_INDIRECT;
1392 1392
1393 error = gfs2_meta_inode_buffer(ip, &dibh); 1393 error = gfs2_meta_inode_buffer(ip, &dibh);
1394 if (!error) { 1394 if (!error) {
@@ -1416,7 +1416,7 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1416 struct buffer_head *dibh; 1416 struct buffer_head *dibh;
1417 int error; 1417 int error;
1418 1418
1419 rgd = gfs2_blk2rgrpd(sdp, ip->i_di.di_eattr); 1419 rgd = gfs2_blk2rgrpd(sdp, ip->i_eattr);
1420 if (!rgd) { 1420 if (!rgd) {
1421 gfs2_consist_inode(ip); 1421 gfs2_consist_inode(ip);
1422 return -EIO; 1422 return -EIO;
@@ -1432,9 +1432,9 @@ static int ea_dealloc_block(struct gfs2_inode *ip)
1432 if (error) 1432 if (error)
1433 goto out_gunlock; 1433 goto out_gunlock;
1434 1434
1435 gfs2_free_meta(ip, ip->i_di.di_eattr, 1); 1435 gfs2_free_meta(ip, ip->i_eattr, 1);
1436 1436
1437 ip->i_di.di_eattr = 0; 1437 ip->i_eattr = 0;
1438 gfs2_add_inode_blocks(&ip->i_inode, -1); 1438 gfs2_add_inode_blocks(&ip->i_inode, -1);
1439 1439
1440 error = gfs2_meta_inode_buffer(ip, &dibh); 1440 error = gfs2_meta_inode_buffer(ip, &dibh);
@@ -1479,7 +1479,7 @@ int gfs2_ea_dealloc(struct gfs2_inode *ip)
1479 if (error) 1479 if (error)
1480 goto out_rindex; 1480 goto out_rindex;
1481 1481
1482 if (ip->i_di.di_flags & GFS2_DIF_EA_INDIRECT) { 1482 if (ip->i_diskflags & GFS2_DIF_EA_INDIRECT) {
1483 error = ea_dealloc_indirect(ip); 1483 error = ea_dealloc_indirect(ip);
1484 if (error) 1484 if (error)
1485 goto out_rindex; 1485 goto out_rindex;
diff --git a/fs/gfs2/glock.c b/fs/gfs2/glock.c
index c962283d4e7f..6b983aef785d 100644
--- a/fs/gfs2/glock.c
+++ b/fs/gfs2/glock.c
@@ -40,6 +40,7 @@
40#include "quota.h" 40#include "quota.h"
41#include "super.h" 41#include "super.h"
42#include "util.h" 42#include "util.h"
43#include "bmap.h"
43 44
44struct gfs2_gl_hash_bucket { 45struct gfs2_gl_hash_bucket {
45 struct hlist_head hb_list; 46 struct hlist_head hb_list;
@@ -61,9 +62,10 @@ static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int
61 62
62static DECLARE_RWSEM(gfs2_umount_flush_sem); 63static DECLARE_RWSEM(gfs2_umount_flush_sem);
63static struct dentry *gfs2_root; 64static struct dentry *gfs2_root;
64static struct task_struct *scand_process;
65static unsigned int scand_secs = 5;
66static struct workqueue_struct *glock_workqueue; 65static struct workqueue_struct *glock_workqueue;
66static LIST_HEAD(lru_list);
67static atomic_t lru_count = ATOMIC_INIT(0);
68static DEFINE_SPINLOCK(lru_lock);
67 69
68#define GFS2_GL_HASH_SHIFT 15 70#define GFS2_GL_HASH_SHIFT 15
69#define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT) 71#define GFS2_GL_HASH_SIZE (1 << GFS2_GL_HASH_SHIFT)
@@ -174,6 +176,22 @@ static void gfs2_glock_hold(struct gfs2_glock *gl)
174} 176}
175 177
176/** 178/**
179 * gfs2_glock_schedule_for_reclaim - Add a glock to the reclaim list
180 * @gl: the glock
181 *
182 */
183
184static void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl)
185{
186 spin_lock(&lru_lock);
187 if (list_empty(&gl->gl_lru) && gl->gl_state != LM_ST_UNLOCKED) {
188 list_add_tail(&gl->gl_lru, &lru_list);
189 atomic_inc(&lru_count);
190 }
191 spin_unlock(&lru_lock);
192}
193
194/**
177 * gfs2_glock_put() - Decrement reference count on glock 195 * gfs2_glock_put() - Decrement reference count on glock
178 * @gl: The glock to put 196 * @gl: The glock to put
179 * 197 *
@@ -187,14 +205,23 @@ int gfs2_glock_put(struct gfs2_glock *gl)
187 if (atomic_dec_and_test(&gl->gl_ref)) { 205 if (atomic_dec_and_test(&gl->gl_ref)) {
188 hlist_del(&gl->gl_list); 206 hlist_del(&gl->gl_list);
189 write_unlock(gl_lock_addr(gl->gl_hash)); 207 write_unlock(gl_lock_addr(gl->gl_hash));
208 spin_lock(&lru_lock);
209 if (!list_empty(&gl->gl_lru)) {
210 list_del_init(&gl->gl_lru);
211 atomic_dec(&lru_count);
212 }
213 spin_unlock(&lru_lock);
190 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_UNLOCKED); 214 GLOCK_BUG_ON(gl, gl->gl_state != LM_ST_UNLOCKED);
191 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_reclaim)); 215 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_lru));
192 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders)); 216 GLOCK_BUG_ON(gl, !list_empty(&gl->gl_holders));
193 glock_free(gl); 217 glock_free(gl);
194 rv = 1; 218 rv = 1;
195 goto out; 219 goto out;
196 } 220 }
197 write_unlock(gl_lock_addr(gl->gl_hash)); 221 write_unlock(gl_lock_addr(gl->gl_hash));
222 /* 1 for being hashed, 1 for having state != LM_ST_UNLOCKED */
223 if (atomic_read(&gl->gl_ref) == 2)
224 gfs2_glock_schedule_for_reclaim(gl);
198out: 225out:
199 return rv; 226 return rv;
200} 227}
@@ -289,10 +316,13 @@ static void gfs2_holder_wake(struct gfs2_holder *gh)
289 * do_promote - promote as many requests as possible on the current queue 316 * do_promote - promote as many requests as possible on the current queue
290 * @gl: The glock 317 * @gl: The glock
291 * 318 *
292 * Returns: true if there is a blocked holder at the head of the list 319 * Returns: 1 if there is a blocked holder at the head of the list, or 2
320 * if a type specific operation is underway.
293 */ 321 */
294 322
295static int do_promote(struct gfs2_glock *gl) 323static int do_promote(struct gfs2_glock *gl)
324__releases(&gl->gl_spin)
325__acquires(&gl->gl_spin)
296{ 326{
297 const struct gfs2_glock_operations *glops = gl->gl_ops; 327 const struct gfs2_glock_operations *glops = gl->gl_ops;
298 struct gfs2_holder *gh, *tmp; 328 struct gfs2_holder *gh, *tmp;
@@ -310,6 +340,8 @@ restart:
310 ret = glops->go_lock(gh); 340 ret = glops->go_lock(gh);
311 spin_lock(&gl->gl_spin); 341 spin_lock(&gl->gl_spin);
312 if (ret) { 342 if (ret) {
343 if (ret == 1)
344 return 2;
313 gh->gh_error = ret; 345 gh->gh_error = ret;
314 list_del_init(&gh->gh_list); 346 list_del_init(&gh->gh_list);
315 gfs2_holder_wake(gh); 347 gfs2_holder_wake(gh);
@@ -414,6 +446,7 @@ static void finish_xmote(struct gfs2_glock *gl, unsigned int ret)
414 const struct gfs2_glock_operations *glops = gl->gl_ops; 446 const struct gfs2_glock_operations *glops = gl->gl_ops;
415 struct gfs2_holder *gh; 447 struct gfs2_holder *gh;
416 unsigned state = ret & LM_OUT_ST_MASK; 448 unsigned state = ret & LM_OUT_ST_MASK;
449 int rv;
417 450
418 spin_lock(&gl->gl_spin); 451 spin_lock(&gl->gl_spin);
419 state_change(gl, state); 452 state_change(gl, state);
@@ -468,7 +501,6 @@ retry:
468 gfs2_demote_wake(gl); 501 gfs2_demote_wake(gl);
469 if (state != LM_ST_UNLOCKED) { 502 if (state != LM_ST_UNLOCKED) {
470 if (glops->go_xmote_bh) { 503 if (glops->go_xmote_bh) {
471 int rv;
472 spin_unlock(&gl->gl_spin); 504 spin_unlock(&gl->gl_spin);
473 rv = glops->go_xmote_bh(gl, gh); 505 rv = glops->go_xmote_bh(gl, gh);
474 if (rv == -EAGAIN) 506 if (rv == -EAGAIN)
@@ -479,10 +511,13 @@ retry:
479 goto out; 511 goto out;
480 } 512 }
481 } 513 }
482 do_promote(gl); 514 rv = do_promote(gl);
515 if (rv == 2)
516 goto out_locked;
483 } 517 }
484out: 518out:
485 clear_bit(GLF_LOCK, &gl->gl_flags); 519 clear_bit(GLF_LOCK, &gl->gl_flags);
520out_locked:
486 spin_unlock(&gl->gl_spin); 521 spin_unlock(&gl->gl_spin);
487 gfs2_glock_put(gl); 522 gfs2_glock_put(gl);
488} 523}
@@ -511,6 +546,8 @@ static unsigned int gfs2_lm_lock(struct gfs2_sbd *sdp, void *lock,
511 */ 546 */
512 547
513static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target) 548static void do_xmote(struct gfs2_glock *gl, struct gfs2_holder *gh, unsigned int target)
549__releases(&gl->gl_spin)
550__acquires(&gl->gl_spin)
514{ 551{
515 const struct gfs2_glock_operations *glops = gl->gl_ops; 552 const struct gfs2_glock_operations *glops = gl->gl_ops;
516 struct gfs2_sbd *sdp = gl->gl_sbd; 553 struct gfs2_sbd *sdp = gl->gl_sbd;
@@ -576,8 +613,11 @@ static inline struct gfs2_holder *find_first_holder(const struct gfs2_glock *gl)
576 */ 613 */
577 614
578static void run_queue(struct gfs2_glock *gl, const int nonblock) 615static void run_queue(struct gfs2_glock *gl, const int nonblock)
616__releases(&gl->gl_spin)
617__acquires(&gl->gl_spin)
579{ 618{
580 struct gfs2_holder *gh = NULL; 619 struct gfs2_holder *gh = NULL;
620 int ret;
581 621
582 if (test_and_set_bit(GLF_LOCK, &gl->gl_flags)) 622 if (test_and_set_bit(GLF_LOCK, &gl->gl_flags))
583 return; 623 return;
@@ -596,8 +636,11 @@ static void run_queue(struct gfs2_glock *gl, const int nonblock)
596 } else { 636 } else {
597 if (test_bit(GLF_DEMOTE, &gl->gl_flags)) 637 if (test_bit(GLF_DEMOTE, &gl->gl_flags))
598 gfs2_demote_wake(gl); 638 gfs2_demote_wake(gl);
599 if (do_promote(gl) == 0) 639 ret = do_promote(gl);
640 if (ret == 0)
600 goto out; 641 goto out;
642 if (ret == 2)
643 return;
601 gh = find_first_waiter(gl); 644 gh = find_first_waiter(gl);
602 gl->gl_target = gh->gh_state; 645 gl->gl_target = gh->gh_state;
603 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB))) 646 if (!(gh->gh_flags & (LM_FLAG_TRY | LM_FLAG_TRY_1CB)))
@@ -820,7 +863,7 @@ static void wait_on_demote(struct gfs2_glock *gl)
820 */ 863 */
821 864
822static void handle_callback(struct gfs2_glock *gl, unsigned int state, 865static void handle_callback(struct gfs2_glock *gl, unsigned int state,
823 int remote, unsigned long delay) 866 unsigned long delay)
824{ 867{
825 int bit = delay ? GLF_PENDING_DEMOTE : GLF_DEMOTE; 868 int bit = delay ? GLF_PENDING_DEMOTE : GLF_DEMOTE;
826 869
@@ -828,9 +871,6 @@ static void handle_callback(struct gfs2_glock *gl, unsigned int state,
828 if (gl->gl_demote_state == LM_ST_EXCLUSIVE) { 871 if (gl->gl_demote_state == LM_ST_EXCLUSIVE) {
829 gl->gl_demote_state = state; 872 gl->gl_demote_state = state;
830 gl->gl_demote_time = jiffies; 873 gl->gl_demote_time = jiffies;
831 if (remote && gl->gl_ops->go_type == LM_TYPE_IOPEN &&
832 gl->gl_object)
833 gfs2_glock_schedule_for_reclaim(gl);
834 } else if (gl->gl_demote_state != LM_ST_UNLOCKED && 874 } else if (gl->gl_demote_state != LM_ST_UNLOCKED &&
835 gl->gl_demote_state != state) { 875 gl->gl_demote_state != state) {
836 gl->gl_demote_state = LM_ST_UNLOCKED; 876 gl->gl_demote_state = LM_ST_UNLOCKED;
@@ -877,6 +917,8 @@ void gfs2_print_dbg(struct seq_file *seq, const char *fmt, ...)
877 */ 917 */
878 918
879static inline void add_to_queue(struct gfs2_holder *gh) 919static inline void add_to_queue(struct gfs2_holder *gh)
920__releases(&gl->gl_spin)
921__acquires(&gl->gl_spin)
880{ 922{
881 struct gfs2_glock *gl = gh->gh_gl; 923 struct gfs2_glock *gl = gh->gh_gl;
882 struct gfs2_sbd *sdp = gl->gl_sbd; 924 struct gfs2_sbd *sdp = gl->gl_sbd;
@@ -998,7 +1040,7 @@ void gfs2_glock_dq(struct gfs2_holder *gh)
998 1040
999 spin_lock(&gl->gl_spin); 1041 spin_lock(&gl->gl_spin);
1000 if (gh->gh_flags & GL_NOCACHE) 1042 if (gh->gh_flags & GL_NOCACHE)
1001 handle_callback(gl, LM_ST_UNLOCKED, 0, 0); 1043 handle_callback(gl, LM_ST_UNLOCKED, 0);
1002 1044
1003 list_del_init(&gh->gh_list); 1045 list_del_init(&gh->gh_list);
1004 if (find_first_holder(gl) == NULL) { 1046 if (find_first_holder(gl) == NULL) {
@@ -1269,12 +1311,26 @@ static void blocking_cb(struct gfs2_sbd *sdp, struct lm_lockname *name,
1269 delay = gl->gl_ops->go_min_hold_time; 1311 delay = gl->gl_ops->go_min_hold_time;
1270 1312
1271 spin_lock(&gl->gl_spin); 1313 spin_lock(&gl->gl_spin);
1272 handle_callback(gl, state, 1, delay); 1314 handle_callback(gl, state, delay);
1273 spin_unlock(&gl->gl_spin); 1315 spin_unlock(&gl->gl_spin);
1274 if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0) 1316 if (queue_delayed_work(glock_workqueue, &gl->gl_work, delay) == 0)
1275 gfs2_glock_put(gl); 1317 gfs2_glock_put(gl);
1276} 1318}
1277 1319
1320static void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid)
1321{
1322 struct gfs2_jdesc *jd;
1323
1324 spin_lock(&sdp->sd_jindex_spin);
1325 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
1326 if (jd->jd_jid != jid)
1327 continue;
1328 jd->jd_dirty = 1;
1329 break;
1330 }
1331 spin_unlock(&sdp->sd_jindex_spin);
1332}
1333
1278/** 1334/**
1279 * gfs2_glock_cb - Callback used by locking module 1335 * gfs2_glock_cb - Callback used by locking module
1280 * @sdp: Pointer to the superblock 1336 * @sdp: Pointer to the superblock
@@ -1338,80 +1394,83 @@ void gfs2_glock_cb(void *cb_data, unsigned int type, void *data)
1338 * Returns: 1 if it's ok 1394 * Returns: 1 if it's ok
1339 */ 1395 */
1340 1396
1341static int demote_ok(struct gfs2_glock *gl) 1397static int demote_ok(const struct gfs2_glock *gl)
1342{ 1398{
1343 const struct gfs2_glock_operations *glops = gl->gl_ops; 1399 const struct gfs2_glock_operations *glops = gl->gl_ops;
1344 int demote = 1;
1345
1346 if (test_bit(GLF_STICKY, &gl->gl_flags))
1347 demote = 0;
1348 else if (glops->go_demote_ok)
1349 demote = glops->go_demote_ok(gl);
1350
1351 return demote;
1352}
1353
1354/**
1355 * gfs2_glock_schedule_for_reclaim - Add a glock to the reclaim list
1356 * @gl: the glock
1357 *
1358 */
1359
1360void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl)
1361{
1362 struct gfs2_sbd *sdp = gl->gl_sbd;
1363 1400
1364 spin_lock(&sdp->sd_reclaim_lock); 1401 if (gl->gl_state == LM_ST_UNLOCKED)
1365 if (list_empty(&gl->gl_reclaim)) { 1402 return 0;
1366 gfs2_glock_hold(gl); 1403 if (!list_empty(&gl->gl_holders))
1367 list_add(&gl->gl_reclaim, &sdp->sd_reclaim_list); 1404 return 0;
1368 atomic_inc(&sdp->sd_reclaim_count); 1405 if (glops->go_demote_ok)
1369 spin_unlock(&sdp->sd_reclaim_lock); 1406 return glops->go_demote_ok(gl);
1370 wake_up(&sdp->sd_reclaim_wq); 1407 return 1;
1371 } else
1372 spin_unlock(&sdp->sd_reclaim_lock);
1373} 1408}
1374 1409
1375/**
1376 * gfs2_reclaim_glock - process the next glock on the filesystem's reclaim list
1377 * @sdp: the filesystem
1378 *
1379 * Called from gfs2_glockd() glock reclaim daemon, or when promoting a
1380 * different glock and we notice that there are a lot of glocks in the
1381 * reclaim list.
1382 *
1383 */
1384 1410
1385void gfs2_reclaim_glock(struct gfs2_sbd *sdp) 1411static int gfs2_shrink_glock_memory(int nr, gfp_t gfp_mask)
1386{ 1412{
1387 struct gfs2_glock *gl; 1413 struct gfs2_glock *gl;
1388 int done_callback = 0; 1414 int may_demote;
1415 int nr_skipped = 0;
1416 int got_ref = 0;
1417 LIST_HEAD(skipped);
1389 1418
1390 spin_lock(&sdp->sd_reclaim_lock); 1419 if (nr == 0)
1391 if (list_empty(&sdp->sd_reclaim_list)) { 1420 goto out;
1392 spin_unlock(&sdp->sd_reclaim_lock);
1393 return;
1394 }
1395 gl = list_entry(sdp->sd_reclaim_list.next,
1396 struct gfs2_glock, gl_reclaim);
1397 list_del_init(&gl->gl_reclaim);
1398 spin_unlock(&sdp->sd_reclaim_lock);
1399 1421
1400 atomic_dec(&sdp->sd_reclaim_count); 1422 if (!(gfp_mask & __GFP_FS))
1401 atomic_inc(&sdp->sd_reclaimed); 1423 return -1;
1402 1424
1403 spin_lock(&gl->gl_spin); 1425 spin_lock(&lru_lock);
1404 if (find_first_holder(gl) == NULL && 1426 while(nr && !list_empty(&lru_list)) {
1405 gl->gl_state != LM_ST_UNLOCKED && demote_ok(gl)) { 1427 gl = list_entry(lru_list.next, struct gfs2_glock, gl_lru);
1406 handle_callback(gl, LM_ST_UNLOCKED, 0, 0); 1428 list_del_init(&gl->gl_lru);
1407 done_callback = 1; 1429 atomic_dec(&lru_count);
1430
1431 /* Test for being demotable */
1432 if (!test_and_set_bit(GLF_LOCK, &gl->gl_flags)) {
1433 gfs2_glock_hold(gl);
1434 got_ref = 1;
1435 spin_unlock(&lru_lock);
1436 spin_lock(&gl->gl_spin);
1437 may_demote = demote_ok(gl);
1438 spin_unlock(&gl->gl_spin);
1439 clear_bit(GLF_LOCK, &gl->gl_flags);
1440 if (may_demote) {
1441 handle_callback(gl, LM_ST_UNLOCKED, 0);
1442 nr--;
1443 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
1444 gfs2_glock_put(gl);
1445 }
1446 spin_lock(&lru_lock);
1447 if (may_demote)
1448 continue;
1449 }
1450 if (list_empty(&gl->gl_lru) &&
1451 (atomic_read(&gl->gl_ref) <= (2 + got_ref))) {
1452 nr_skipped++;
1453 list_add(&gl->gl_lru, &skipped);
1454 }
1455 if (got_ref) {
1456 spin_unlock(&lru_lock);
1457 gfs2_glock_put(gl);
1458 spin_lock(&lru_lock);
1459 got_ref = 0;
1460 }
1408 } 1461 }
1409 spin_unlock(&gl->gl_spin); 1462 list_splice(&skipped, &lru_list);
1410 if (!done_callback || 1463 atomic_add(nr_skipped, &lru_count);
1411 queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 1464 spin_unlock(&lru_lock);
1412 gfs2_glock_put(gl); 1465out:
1466 return (atomic_read(&lru_count) / 100) * sysctl_vfs_cache_pressure;
1413} 1467}
1414 1468
1469static struct shrinker glock_shrinker = {
1470 .shrink = gfs2_shrink_glock_memory,
1471 .seeks = DEFAULT_SEEKS,
1472};
1473
1415/** 1474/**
1416 * examine_bucket - Call a function for glock in a hash bucket 1475 * examine_bucket - Call a function for glock in a hash bucket
1417 * @examiner: the function 1476 * @examiner: the function
@@ -1457,26 +1516,6 @@ out:
1457} 1516}
1458 1517
1459/** 1518/**
1460 * scan_glock - look at a glock and see if we can reclaim it
1461 * @gl: the glock to look at
1462 *
1463 */
1464
1465static void scan_glock(struct gfs2_glock *gl)
1466{
1467 if (gl->gl_ops == &gfs2_inode_glops && gl->gl_object)
1468 return;
1469 if (test_bit(GLF_LOCK, &gl->gl_flags))
1470 return;
1471
1472 spin_lock(&gl->gl_spin);
1473 if (find_first_holder(gl) == NULL &&
1474 gl->gl_state != LM_ST_UNLOCKED && demote_ok(gl))
1475 gfs2_glock_schedule_for_reclaim(gl);
1476 spin_unlock(&gl->gl_spin);
1477}
1478
1479/**
1480 * clear_glock - look at a glock and see if we can free it from glock cache 1519 * clear_glock - look at a glock and see if we can free it from glock cache
1481 * @gl: the glock to look at 1520 * @gl: the glock to look at
1482 * 1521 *
@@ -1484,23 +1523,16 @@ static void scan_glock(struct gfs2_glock *gl)
1484 1523
1485static void clear_glock(struct gfs2_glock *gl) 1524static void clear_glock(struct gfs2_glock *gl)
1486{ 1525{
1487 struct gfs2_sbd *sdp = gl->gl_sbd; 1526 spin_lock(&lru_lock);
1488 int released; 1527 if (!list_empty(&gl->gl_lru)) {
1489 1528 list_del_init(&gl->gl_lru);
1490 spin_lock(&sdp->sd_reclaim_lock); 1529 atomic_dec(&lru_count);
1491 if (!list_empty(&gl->gl_reclaim)) {
1492 list_del_init(&gl->gl_reclaim);
1493 atomic_dec(&sdp->sd_reclaim_count);
1494 spin_unlock(&sdp->sd_reclaim_lock);
1495 released = gfs2_glock_put(gl);
1496 gfs2_assert(sdp, !released);
1497 } else {
1498 spin_unlock(&sdp->sd_reclaim_lock);
1499 } 1530 }
1531 spin_unlock(&lru_lock);
1500 1532
1501 spin_lock(&gl->gl_spin); 1533 spin_lock(&gl->gl_spin);
1502 if (find_first_holder(gl) == NULL && gl->gl_state != LM_ST_UNLOCKED) 1534 if (find_first_holder(gl) == NULL && gl->gl_state != LM_ST_UNLOCKED)
1503 handle_callback(gl, LM_ST_UNLOCKED, 0, 0); 1535 handle_callback(gl, LM_ST_UNLOCKED, 0);
1504 spin_unlock(&gl->gl_spin); 1536 spin_unlock(&gl->gl_spin);
1505 gfs2_glock_hold(gl); 1537 gfs2_glock_hold(gl);
1506 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0) 1538 if (queue_delayed_work(glock_workqueue, &gl->gl_work, 0) == 0)
@@ -1548,6 +1580,20 @@ void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
1548 } 1580 }
1549} 1581}
1550 1582
1583void gfs2_glock_finish_truncate(struct gfs2_inode *ip)
1584{
1585 struct gfs2_glock *gl = ip->i_gl;
1586 int ret;
1587
1588 ret = gfs2_truncatei_resume(ip);
1589 gfs2_assert_withdraw(gl->gl_sbd, ret == 0);
1590
1591 spin_lock(&gl->gl_spin);
1592 clear_bit(GLF_LOCK, &gl->gl_flags);
1593 run_queue(gl, 1);
1594 spin_unlock(&gl->gl_spin);
1595}
1596
1551static const char *state2str(unsigned state) 1597static const char *state2str(unsigned state)
1552{ 1598{
1553 switch(state) { 1599 switch(state) {
@@ -1623,8 +1669,6 @@ static const char *gflags2str(char *buf, const unsigned long *gflags)
1623 char *p = buf; 1669 char *p = buf;
1624 if (test_bit(GLF_LOCK, gflags)) 1670 if (test_bit(GLF_LOCK, gflags))
1625 *p++ = 'l'; 1671 *p++ = 'l';
1626 if (test_bit(GLF_STICKY, gflags))
1627 *p++ = 's';
1628 if (test_bit(GLF_DEMOTE, gflags)) 1672 if (test_bit(GLF_DEMOTE, gflags))
1629 *p++ = 'D'; 1673 *p++ = 'D';
1630 if (test_bit(GLF_PENDING_DEMOTE, gflags)) 1674 if (test_bit(GLF_PENDING_DEMOTE, gflags))
@@ -1743,34 +1787,6 @@ static int gfs2_dump_lockstate(struct gfs2_sbd *sdp)
1743 return error; 1787 return error;
1744} 1788}
1745 1789
1746/**
1747 * gfs2_scand - Look for cached glocks and inodes to toss from memory
1748 * @sdp: Pointer to GFS2 superblock
1749 *
1750 * One of these daemons runs, finding candidates to add to sd_reclaim_list.
1751 * See gfs2_glockd()
1752 */
1753
1754static int gfs2_scand(void *data)
1755{
1756 unsigned x;
1757 unsigned delay;
1758
1759 while (!kthread_should_stop()) {
1760 for (x = 0; x < GFS2_GL_HASH_SIZE; x++)
1761 examine_bucket(scan_glock, NULL, x);
1762 if (freezing(current))
1763 refrigerator();
1764 delay = scand_secs;
1765 if (delay < 1)
1766 delay = 1;
1767 schedule_timeout_interruptible(delay * HZ);
1768 }
1769
1770 return 0;
1771}
1772
1773
1774 1790
1775int __init gfs2_glock_init(void) 1791int __init gfs2_glock_init(void)
1776{ 1792{
@@ -1784,28 +1800,21 @@ int __init gfs2_glock_init(void)
1784 } 1800 }
1785#endif 1801#endif
1786 1802
1787 scand_process = kthread_run(gfs2_scand, NULL, "gfs2_scand");
1788 if (IS_ERR(scand_process))
1789 return PTR_ERR(scand_process);
1790
1791 glock_workqueue = create_workqueue("glock_workqueue"); 1803 glock_workqueue = create_workqueue("glock_workqueue");
1792 if (IS_ERR(glock_workqueue)) { 1804 if (IS_ERR(glock_workqueue))
1793 kthread_stop(scand_process);
1794 return PTR_ERR(glock_workqueue); 1805 return PTR_ERR(glock_workqueue);
1795 } 1806
1807 register_shrinker(&glock_shrinker);
1796 1808
1797 return 0; 1809 return 0;
1798} 1810}
1799 1811
1800void gfs2_glock_exit(void) 1812void gfs2_glock_exit(void)
1801{ 1813{
1814 unregister_shrinker(&glock_shrinker);
1802 destroy_workqueue(glock_workqueue); 1815 destroy_workqueue(glock_workqueue);
1803 kthread_stop(scand_process);
1804} 1816}
1805 1817
1806module_param(scand_secs, uint, S_IRUGO|S_IWUSR);
1807MODULE_PARM_DESC(scand_secs, "The number of seconds between scand runs");
1808
1809static int gfs2_glock_iter_next(struct gfs2_glock_iter *gi) 1818static int gfs2_glock_iter_next(struct gfs2_glock_iter *gi)
1810{ 1819{
1811 struct gfs2_glock *gl; 1820 struct gfs2_glock *gl;
diff --git a/fs/gfs2/glock.h b/fs/gfs2/glock.h
index 695c6b193611..543ec7ecfbda 100644
--- a/fs/gfs2/glock.h
+++ b/fs/gfs2/glock.h
@@ -129,9 +129,9 @@ int gfs2_lvb_hold(struct gfs2_glock *gl);
129void gfs2_lvb_unhold(struct gfs2_glock *gl); 129void gfs2_lvb_unhold(struct gfs2_glock *gl);
130 130
131void gfs2_glock_cb(void *cb_data, unsigned int type, void *data); 131void gfs2_glock_cb(void *cb_data, unsigned int type, void *data);
132void gfs2_glock_schedule_for_reclaim(struct gfs2_glock *gl);
133void gfs2_reclaim_glock(struct gfs2_sbd *sdp); 132void gfs2_reclaim_glock(struct gfs2_sbd *sdp);
134void gfs2_gl_hash_clear(struct gfs2_sbd *sdp); 133void gfs2_gl_hash_clear(struct gfs2_sbd *sdp);
134void gfs2_glock_finish_truncate(struct gfs2_inode *ip);
135 135
136int __init gfs2_glock_init(void); 136int __init gfs2_glock_init(void);
137void gfs2_glock_exit(void); 137void gfs2_glock_exit(void);
diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c
index c6c318c2a0f6..8522d3aa64fc 100644
--- a/fs/gfs2/glops.c
+++ b/fs/gfs2/glops.c
@@ -201,19 +201,12 @@ static void inode_go_inval(struct gfs2_glock *gl, int flags)
201 * Returns: 1 if it's ok 201 * Returns: 1 if it's ok
202 */ 202 */
203 203
204static int inode_go_demote_ok(struct gfs2_glock *gl) 204static int inode_go_demote_ok(const struct gfs2_glock *gl)
205{ 205{
206 struct gfs2_sbd *sdp = gl->gl_sbd; 206 struct gfs2_sbd *sdp = gl->gl_sbd;
207 int demote = 0; 207 if (sdp->sd_jindex == gl->gl_object || sdp->sd_rindex == gl->gl_object)
208 208 return 0;
209 if (!gl->gl_object && !gl->gl_aspace->i_mapping->nrpages) 209 return 1;
210 demote = 1;
211 else if (!sdp->sd_args.ar_localcaching &&
212 time_after_eq(jiffies, gl->gl_stamp +
213 gfs2_tune_get(sdp, gt_demote_secs) * HZ))
214 demote = 1;
215
216 return demote;
217} 210}
218 211
219/** 212/**
@@ -227,6 +220,7 @@ static int inode_go_demote_ok(struct gfs2_glock *gl)
227static int inode_go_lock(struct gfs2_holder *gh) 220static int inode_go_lock(struct gfs2_holder *gh)
228{ 221{
229 struct gfs2_glock *gl = gh->gh_gl; 222 struct gfs2_glock *gl = gh->gh_gl;
223 struct gfs2_sbd *sdp = gl->gl_sbd;
230 struct gfs2_inode *ip = gl->gl_object; 224 struct gfs2_inode *ip = gl->gl_object;
231 int error = 0; 225 int error = 0;
232 226
@@ -239,10 +233,16 @@ static int inode_go_lock(struct gfs2_holder *gh)
239 return error; 233 return error;
240 } 234 }
241 235
242 if ((ip->i_di.di_flags & GFS2_DIF_TRUNC_IN_PROG) && 236 if ((ip->i_diskflags & GFS2_DIF_TRUNC_IN_PROG) &&
243 (gl->gl_state == LM_ST_EXCLUSIVE) && 237 (gl->gl_state == LM_ST_EXCLUSIVE) &&
244 (gh->gh_state == LM_ST_EXCLUSIVE)) 238 (gh->gh_state == LM_ST_EXCLUSIVE)) {
245 error = gfs2_truncatei_resume(ip); 239 spin_lock(&sdp->sd_trunc_lock);
240 if (list_empty(&ip->i_trunc_list))
241 list_add(&sdp->sd_trunc_list, &ip->i_trunc_list);
242 spin_unlock(&sdp->sd_trunc_lock);
243 wake_up(&sdp->sd_quota_wait);
244 return 1;
245 }
246 246
247 return error; 247 return error;
248} 248}
@@ -260,10 +260,13 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
260 const struct gfs2_inode *ip = gl->gl_object; 260 const struct gfs2_inode *ip = gl->gl_object;
261 if (ip == NULL) 261 if (ip == NULL)
262 return 0; 262 return 0;
263 gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%08lx\n", 263 gfs2_print_dbg(seq, " I: n:%llu/%llu t:%u f:0x%02lx d:0x%08x s:%llu/%llu\n",
264 (unsigned long long)ip->i_no_formal_ino, 264 (unsigned long long)ip->i_no_formal_ino,
265 (unsigned long long)ip->i_no_addr, 265 (unsigned long long)ip->i_no_addr,
266 IF2DT(ip->i_inode.i_mode), ip->i_flags); 266 IF2DT(ip->i_inode.i_mode), ip->i_flags,
267 (unsigned int)ip->i_diskflags,
268 (unsigned long long)ip->i_inode.i_size,
269 (unsigned long long)ip->i_disksize);
267 return 0; 270 return 0;
268} 271}
269 272
@@ -274,7 +277,7 @@ static int inode_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
274 * Returns: 1 if it's ok 277 * Returns: 1 if it's ok
275 */ 278 */
276 279
277static int rgrp_go_demote_ok(struct gfs2_glock *gl) 280static int rgrp_go_demote_ok(const struct gfs2_glock *gl)
278{ 281{
279 return !gl->gl_aspace->i_mapping->nrpages; 282 return !gl->gl_aspace->i_mapping->nrpages;
280} 283}
@@ -318,7 +321,9 @@ static int rgrp_go_dump(struct seq_file *seq, const struct gfs2_glock *gl)
318 const struct gfs2_rgrpd *rgd = gl->gl_object; 321 const struct gfs2_rgrpd *rgd = gl->gl_object;
319 if (rgd == NULL) 322 if (rgd == NULL)
320 return 0; 323 return 0;
321 gfs2_print_dbg(seq, " R: n:%llu\n", (unsigned long long)rgd->rd_addr); 324 gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n",
325 (unsigned long long)rgd->rd_addr, rgd->rd_flags,
326 rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes);
322 return 0; 327 return 0;
323} 328}
324 329
@@ -374,13 +379,25 @@ static int trans_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh)
374} 379}
375 380
376/** 381/**
382 * trans_go_demote_ok
383 * @gl: the glock
384 *
385 * Always returns 0
386 */
387
388static int trans_go_demote_ok(const struct gfs2_glock *gl)
389{
390 return 0;
391}
392
393/**
377 * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock 394 * quota_go_demote_ok - Check to see if it's ok to unlock a quota glock
378 * @gl: the glock 395 * @gl: the glock
379 * 396 *
380 * Returns: 1 if it's ok 397 * Returns: 1 if it's ok
381 */ 398 */
382 399
383static int quota_go_demote_ok(struct gfs2_glock *gl) 400static int quota_go_demote_ok(const struct gfs2_glock *gl)
384{ 401{
385 return !atomic_read(&gl->gl_lvb_count); 402 return !atomic_read(&gl->gl_lvb_count);
386} 403}
@@ -414,6 +431,7 @@ const struct gfs2_glock_operations gfs2_rgrp_glops = {
414const struct gfs2_glock_operations gfs2_trans_glops = { 431const struct gfs2_glock_operations gfs2_trans_glops = {
415 .go_xmote_th = trans_go_sync, 432 .go_xmote_th = trans_go_sync,
416 .go_xmote_bh = trans_go_xmote_bh, 433 .go_xmote_bh = trans_go_xmote_bh,
434 .go_demote_ok = trans_go_demote_ok,
417 .go_type = LM_TYPE_NONDISK, 435 .go_type = LM_TYPE_NONDISK,
418}; 436};
419 437
diff --git a/fs/gfs2/incore.h b/fs/gfs2/incore.h
index f566ec1b4e8e..608849d00021 100644
--- a/fs/gfs2/incore.h
+++ b/fs/gfs2/incore.h
@@ -68,12 +68,6 @@ struct gfs2_bitmap {
68 u32 bi_len; 68 u32 bi_len;
69}; 69};
70 70
71struct gfs2_rgrp_host {
72 u32 rg_free;
73 u32 rg_dinodes;
74 u64 rg_igeneration;
75};
76
77struct gfs2_rgrpd { 71struct gfs2_rgrpd {
78 struct list_head rd_list; /* Link with superblock */ 72 struct list_head rd_list; /* Link with superblock */
79 struct list_head rd_list_mru; 73 struct list_head rd_list_mru;
@@ -83,14 +77,16 @@ struct gfs2_rgrpd {
83 u32 rd_length; /* length of rgrp header in fs blocks */ 77 u32 rd_length; /* length of rgrp header in fs blocks */
84 u32 rd_data; /* num of data blocks in rgrp */ 78 u32 rd_data; /* num of data blocks in rgrp */
85 u32 rd_bitbytes; /* number of bytes in data bitmaps */ 79 u32 rd_bitbytes; /* number of bytes in data bitmaps */
86 struct gfs2_rgrp_host rd_rg; 80 u32 rd_free;
81 u32 rd_free_clone;
82 u32 rd_dinodes;
83 u64 rd_igeneration;
87 struct gfs2_bitmap *rd_bits; 84 struct gfs2_bitmap *rd_bits;
88 unsigned int rd_bh_count;
89 struct mutex rd_mutex; 85 struct mutex rd_mutex;
90 u32 rd_free_clone;
91 struct gfs2_log_element rd_le; 86 struct gfs2_log_element rd_le;
92 u32 rd_last_alloc;
93 struct gfs2_sbd *rd_sbd; 87 struct gfs2_sbd *rd_sbd;
88 unsigned int rd_bh_count;
89 u32 rd_last_alloc;
94 unsigned char rd_flags; 90 unsigned char rd_flags;
95#define GFS2_RDF_CHECK 0x01 /* Need to check for unlinked inodes */ 91#define GFS2_RDF_CHECK 0x01 /* Need to check for unlinked inodes */
96#define GFS2_RDF_NOALLOC 0x02 /* rg prohibits allocation */ 92#define GFS2_RDF_NOALLOC 0x02 /* rg prohibits allocation */
@@ -129,7 +125,7 @@ struct gfs2_glock_operations {
129 void (*go_xmote_th) (struct gfs2_glock *gl); 125 void (*go_xmote_th) (struct gfs2_glock *gl);
130 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh); 126 int (*go_xmote_bh) (struct gfs2_glock *gl, struct gfs2_holder *gh);
131 void (*go_inval) (struct gfs2_glock *gl, int flags); 127 void (*go_inval) (struct gfs2_glock *gl, int flags);
132 int (*go_demote_ok) (struct gfs2_glock *gl); 128 int (*go_demote_ok) (const struct gfs2_glock *gl);
133 int (*go_lock) (struct gfs2_holder *gh); 129 int (*go_lock) (struct gfs2_holder *gh);
134 void (*go_unlock) (struct gfs2_holder *gh); 130 void (*go_unlock) (struct gfs2_holder *gh);
135 int (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl); 131 int (*go_dump)(struct seq_file *seq, const struct gfs2_glock *gl);
@@ -159,7 +155,6 @@ struct gfs2_holder {
159 155
160enum { 156enum {
161 GLF_LOCK = 1, 157 GLF_LOCK = 1,
162 GLF_STICKY = 2,
163 GLF_DEMOTE = 3, 158 GLF_DEMOTE = 3,
164 GLF_PENDING_DEMOTE = 4, 159 GLF_PENDING_DEMOTE = 4,
165 GLF_DEMOTE_IN_PROGRESS = 5, 160 GLF_DEMOTE_IN_PROGRESS = 5,
@@ -194,7 +189,7 @@ struct gfs2_glock {
194 unsigned long gl_tchange; 189 unsigned long gl_tchange;
195 void *gl_object; 190 void *gl_object;
196 191
197 struct list_head gl_reclaim; 192 struct list_head gl_lru;
198 193
199 struct gfs2_sbd *gl_sbd; 194 struct gfs2_sbd *gl_sbd;
200 195
@@ -233,29 +228,24 @@ enum {
233 GIF_USER = 4, /* user inode, not metadata addr space */ 228 GIF_USER = 4, /* user inode, not metadata addr space */
234}; 229};
235 230
236struct gfs2_dinode_host {
237 u64 di_size; /* number of bytes in file */
238 u64 di_generation; /* generation number for NFS */
239 u32 di_flags; /* GFS2_DIF_... */
240 /* These only apply to directories */
241 u32 di_entries; /* The number of entries in the directory */
242 u64 di_eattr; /* extended attribute block number */
243};
244 231
245struct gfs2_inode { 232struct gfs2_inode {
246 struct inode i_inode; 233 struct inode i_inode;
247 u64 i_no_addr; 234 u64 i_no_addr;
248 u64 i_no_formal_ino; 235 u64 i_no_formal_ino;
236 u64 i_generation;
237 u64 i_eattr;
238 loff_t i_disksize;
249 unsigned long i_flags; /* GIF_... */ 239 unsigned long i_flags; /* GIF_... */
250
251 struct gfs2_dinode_host i_di; /* To be replaced by ref to block */
252
253 struct gfs2_glock *i_gl; /* Move into i_gh? */ 240 struct gfs2_glock *i_gl; /* Move into i_gh? */
254 struct gfs2_holder i_iopen_gh; 241 struct gfs2_holder i_iopen_gh;
255 struct gfs2_holder i_gh; /* for prepare/commit_write only */ 242 struct gfs2_holder i_gh; /* for prepare/commit_write only */
256 struct gfs2_alloc *i_alloc; 243 struct gfs2_alloc *i_alloc;
257 u64 i_goal; /* goal block for allocations */ 244 u64 i_goal; /* goal block for allocations */
258 struct rw_semaphore i_rw_mutex; 245 struct rw_semaphore i_rw_mutex;
246 struct list_head i_trunc_list;
247 u32 i_entries;
248 u32 i_diskflags;
259 u8 i_height; 249 u8 i_height;
260 u8 i_depth; 250 u8 i_depth;
261}; 251};
@@ -406,13 +396,11 @@ struct gfs2_args {
406struct gfs2_tune { 396struct gfs2_tune {
407 spinlock_t gt_spin; 397 spinlock_t gt_spin;
408 398
409 unsigned int gt_demote_secs; /* Cache retention for unheld glock */
410 unsigned int gt_incore_log_blocks; 399 unsigned int gt_incore_log_blocks;
411 unsigned int gt_log_flush_secs; 400 unsigned int gt_log_flush_secs;
412 401
413 unsigned int gt_recoverd_secs; 402 unsigned int gt_recoverd_secs;
414 unsigned int gt_logd_secs; 403 unsigned int gt_logd_secs;
415 unsigned int gt_quotad_secs;
416 404
417 unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */ 405 unsigned int gt_quota_simul_sync; /* Max quotavals to sync at once */
418 unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */ 406 unsigned int gt_quota_warn_period; /* Secs between quota warn msgs */
@@ -488,10 +476,6 @@ struct gfs2_sbd {
488 /* Lock Stuff */ 476 /* Lock Stuff */
489 477
490 struct lm_lockstruct sd_lockstruct; 478 struct lm_lockstruct sd_lockstruct;
491 struct list_head sd_reclaim_list;
492 spinlock_t sd_reclaim_lock;
493 wait_queue_head_t sd_reclaim_wq;
494 atomic_t sd_reclaim_count;
495 struct gfs2_holder sd_live_gh; 479 struct gfs2_holder sd_live_gh;
496 struct gfs2_glock *sd_rename_gl; 480 struct gfs2_glock *sd_rename_gl;
497 struct gfs2_glock *sd_trans_gl; 481 struct gfs2_glock *sd_trans_gl;
@@ -519,7 +503,6 @@ struct gfs2_sbd {
519 spinlock_t sd_statfs_spin; 503 spinlock_t sd_statfs_spin;
520 struct gfs2_statfs_change_host sd_statfs_master; 504 struct gfs2_statfs_change_host sd_statfs_master;
521 struct gfs2_statfs_change_host sd_statfs_local; 505 struct gfs2_statfs_change_host sd_statfs_local;
522 unsigned long sd_statfs_sync_time;
523 506
524 /* Resource group stuff */ 507 /* Resource group stuff */
525 508
@@ -552,8 +535,6 @@ struct gfs2_sbd {
552 struct task_struct *sd_recoverd_process; 535 struct task_struct *sd_recoverd_process;
553 struct task_struct *sd_logd_process; 536 struct task_struct *sd_logd_process;
554 struct task_struct *sd_quotad_process; 537 struct task_struct *sd_quotad_process;
555 struct task_struct *sd_glockd_process[GFS2_GLOCKD_MAX];
556 unsigned int sd_glockd_num;
557 538
558 /* Quota stuff */ 539 /* Quota stuff */
559 540
@@ -561,13 +542,15 @@ struct gfs2_sbd {
561 atomic_t sd_quota_count; 542 atomic_t sd_quota_count;
562 spinlock_t sd_quota_spin; 543 spinlock_t sd_quota_spin;
563 struct mutex sd_quota_mutex; 544 struct mutex sd_quota_mutex;
545 wait_queue_head_t sd_quota_wait;
546 struct list_head sd_trunc_list;
547 spinlock_t sd_trunc_lock;
564 548
565 unsigned int sd_quota_slots; 549 unsigned int sd_quota_slots;
566 unsigned int sd_quota_chunks; 550 unsigned int sd_quota_chunks;
567 unsigned char **sd_quota_bitmap; 551 unsigned char **sd_quota_bitmap;
568 552
569 u64 sd_quota_sync_gen; 553 u64 sd_quota_sync_gen;
570 unsigned long sd_quota_sync_time;
571 554
572 /* Log stuff */ 555 /* Log stuff */
573 556
@@ -624,10 +607,6 @@ struct gfs2_sbd {
624 struct mutex sd_freeze_lock; 607 struct mutex sd_freeze_lock;
625 unsigned int sd_freeze_count; 608 unsigned int sd_freeze_count;
626 609
627 /* Counters */
628
629 atomic_t sd_reclaimed;
630
631 char sd_fsname[GFS2_FSNAME_LEN]; 610 char sd_fsname[GFS2_FSNAME_LEN];
632 char sd_table_name[GFS2_FSNAME_LEN]; 611 char sd_table_name[GFS2_FSNAME_LEN];
633 char sd_proto_name[GFS2_FSNAME_LEN]; 612 char sd_proto_name[GFS2_FSNAME_LEN];
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index d57616840e89..3b87c188da41 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -32,7 +32,6 @@
32#include "log.h" 32#include "log.h"
33#include "meta_io.h" 33#include "meta_io.h"
34#include "ops_address.h" 34#include "ops_address.h"
35#include "ops_inode.h"
36#include "quota.h" 35#include "quota.h"
37#include "rgrp.h" 36#include "rgrp.h"
38#include "trans.h" 37#include "trans.h"
@@ -248,7 +247,6 @@ fail:
248 247
249static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf) 248static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
250{ 249{
251 struct gfs2_dinode_host *di = &ip->i_di;
252 const struct gfs2_dinode *str = buf; 250 const struct gfs2_dinode *str = buf;
253 struct timespec atime; 251 struct timespec atime;
254 u16 height, depth; 252 u16 height, depth;
@@ -274,8 +272,8 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
274 * to do that. 272 * to do that.
275 */ 273 */
276 ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink); 274 ip->i_inode.i_nlink = be32_to_cpu(str->di_nlink);
277 di->di_size = be64_to_cpu(str->di_size); 275 ip->i_disksize = be64_to_cpu(str->di_size);
278 i_size_write(&ip->i_inode, di->di_size); 276 i_size_write(&ip->i_inode, ip->i_disksize);
279 gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks)); 277 gfs2_set_inode_blocks(&ip->i_inode, be64_to_cpu(str->di_blocks));
280 atime.tv_sec = be64_to_cpu(str->di_atime); 278 atime.tv_sec = be64_to_cpu(str->di_atime);
281 atime.tv_nsec = be32_to_cpu(str->di_atime_nsec); 279 atime.tv_nsec = be32_to_cpu(str->di_atime_nsec);
@@ -287,9 +285,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
287 ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec); 285 ip->i_inode.i_ctime.tv_nsec = be32_to_cpu(str->di_ctime_nsec);
288 286
289 ip->i_goal = be64_to_cpu(str->di_goal_meta); 287 ip->i_goal = be64_to_cpu(str->di_goal_meta);
290 di->di_generation = be64_to_cpu(str->di_generation); 288 ip->i_generation = be64_to_cpu(str->di_generation);
291 289
292 di->di_flags = be32_to_cpu(str->di_flags); 290 ip->i_diskflags = be32_to_cpu(str->di_flags);
293 gfs2_set_inode_flags(&ip->i_inode); 291 gfs2_set_inode_flags(&ip->i_inode);
294 height = be16_to_cpu(str->di_height); 292 height = be16_to_cpu(str->di_height);
295 if (unlikely(height > GFS2_MAX_META_HEIGHT)) 293 if (unlikely(height > GFS2_MAX_META_HEIGHT))
@@ -300,9 +298,9 @@ static int gfs2_dinode_in(struct gfs2_inode *ip, const void *buf)
300 if (unlikely(depth > GFS2_DIR_MAX_DEPTH)) 298 if (unlikely(depth > GFS2_DIR_MAX_DEPTH))
301 goto corrupt; 299 goto corrupt;
302 ip->i_depth = (u8)depth; 300 ip->i_depth = (u8)depth;
303 di->di_entries = be32_to_cpu(str->di_entries); 301 ip->i_entries = be32_to_cpu(str->di_entries);
304 302
305 di->di_eattr = be64_to_cpu(str->di_eattr); 303 ip->i_eattr = be64_to_cpu(str->di_eattr);
306 if (S_ISREG(ip->i_inode.i_mode)) 304 if (S_ISREG(ip->i_inode.i_mode))
307 gfs2_set_aops(&ip->i_inode); 305 gfs2_set_aops(&ip->i_inode);
308 306
@@ -388,7 +386,6 @@ int gfs2_dinode_dealloc(struct gfs2_inode *ip)
388 gfs2_free_di(rgd, ip); 386 gfs2_free_di(rgd, ip);
389 387
390 gfs2_trans_end(sdp); 388 gfs2_trans_end(sdp);
391 clear_bit(GLF_STICKY, &ip->i_gl->gl_flags);
392 389
393out_rg_gunlock: 390out_rg_gunlock:
394 gfs2_glock_dq_uninit(&al->al_rgd_gh); 391 gfs2_glock_dq_uninit(&al->al_rgd_gh);
@@ -690,7 +687,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
690 return error; 687 return error;
691 } 688 }
692 689
693 if (dip->i_di.di_entries == (u32)-1) 690 if (dip->i_entries == (u32)-1)
694 return -EFBIG; 691 return -EFBIG;
695 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1) 692 if (S_ISDIR(mode) && dip->i_inode.i_nlink == (u32)-1)
696 return -EMLINK; 693 return -EMLINK;
@@ -790,11 +787,11 @@ static void init_dinode(struct gfs2_inode *dip, struct gfs2_glock *gl,
790 di->di_flags = 0; 787 di->di_flags = 0;
791 788
792 if (S_ISREG(mode)) { 789 if (S_ISREG(mode)) {
793 if ((dip->i_di.di_flags & GFS2_DIF_INHERIT_JDATA) || 790 if ((dip->i_diskflags & GFS2_DIF_INHERIT_JDATA) ||
794 gfs2_tune_get(sdp, gt_new_files_jdata)) 791 gfs2_tune_get(sdp, gt_new_files_jdata))
795 di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA); 792 di->di_flags |= cpu_to_be32(GFS2_DIF_JDATA);
796 } else if (S_ISDIR(mode)) { 793 } else if (S_ISDIR(mode)) {
797 di->di_flags |= cpu_to_be32(dip->i_di.di_flags & 794 di->di_flags |= cpu_to_be32(dip->i_diskflags &
798 GFS2_DIF_INHERIT_JDATA); 795 GFS2_DIF_INHERIT_JDATA);
799 } 796 }
800 797
@@ -1068,7 +1065,7 @@ int gfs2_rmdiri(struct gfs2_inode *dip, const struct qstr *name,
1068 struct qstr dotname; 1065 struct qstr dotname;
1069 int error; 1066 int error;
1070 1067
1071 if (ip->i_di.di_entries != 2) { 1068 if (ip->i_entries != 2) {
1072 if (gfs2_consist_inode(ip)) 1069 if (gfs2_consist_inode(ip))
1073 gfs2_dinode_print(ip); 1070 gfs2_dinode_print(ip);
1074 return -EIO; 1071 return -EIO;
@@ -1168,7 +1165,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
1168 return error; 1165 return error;
1169 } 1166 }
1170 1167
1171 if (!ip->i_di.di_size) { 1168 if (!ip->i_disksize) {
1172 gfs2_consist_inode(ip); 1169 gfs2_consist_inode(ip);
1173 error = -EIO; 1170 error = -EIO;
1174 goto out; 1171 goto out;
@@ -1178,7 +1175,7 @@ int gfs2_readlinki(struct gfs2_inode *ip, char **buf, unsigned int *len)
1178 if (error) 1175 if (error)
1179 goto out; 1176 goto out;
1180 1177
1181 x = ip->i_di.di_size + 1; 1178 x = ip->i_disksize + 1;
1182 if (x > *len) { 1179 if (x > *len) {
1183 *buf = kmalloc(x, GFP_NOFS); 1180 *buf = kmalloc(x, GFP_NOFS);
1184 if (!*buf) { 1181 if (!*buf) {
@@ -1242,7 +1239,6 @@ int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr)
1242 1239
1243void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf) 1240void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
1244{ 1241{
1245 const struct gfs2_dinode_host *di = &ip->i_di;
1246 struct gfs2_dinode *str = buf; 1242 struct gfs2_dinode *str = buf;
1247 1243
1248 str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC); 1244 str->di_header.mh_magic = cpu_to_be32(GFS2_MAGIC);
@@ -1256,7 +1252,7 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
1256 str->di_uid = cpu_to_be32(ip->i_inode.i_uid); 1252 str->di_uid = cpu_to_be32(ip->i_inode.i_uid);
1257 str->di_gid = cpu_to_be32(ip->i_inode.i_gid); 1253 str->di_gid = cpu_to_be32(ip->i_inode.i_gid);
1258 str->di_nlink = cpu_to_be32(ip->i_inode.i_nlink); 1254 str->di_nlink = cpu_to_be32(ip->i_inode.i_nlink);
1259 str->di_size = cpu_to_be64(di->di_size); 1255 str->di_size = cpu_to_be64(ip->i_disksize);
1260 str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode)); 1256 str->di_blocks = cpu_to_be64(gfs2_get_inode_blocks(&ip->i_inode));
1261 str->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec); 1257 str->di_atime = cpu_to_be64(ip->i_inode.i_atime.tv_sec);
1262 str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec); 1258 str->di_mtime = cpu_to_be64(ip->i_inode.i_mtime.tv_sec);
@@ -1264,17 +1260,17 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
1264 1260
1265 str->di_goal_meta = cpu_to_be64(ip->i_goal); 1261 str->di_goal_meta = cpu_to_be64(ip->i_goal);
1266 str->di_goal_data = cpu_to_be64(ip->i_goal); 1262 str->di_goal_data = cpu_to_be64(ip->i_goal);
1267 str->di_generation = cpu_to_be64(di->di_generation); 1263 str->di_generation = cpu_to_be64(ip->i_generation);
1268 1264
1269 str->di_flags = cpu_to_be32(di->di_flags); 1265 str->di_flags = cpu_to_be32(ip->i_diskflags);
1270 str->di_height = cpu_to_be16(ip->i_height); 1266 str->di_height = cpu_to_be16(ip->i_height);
1271 str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) && 1267 str->di_payload_format = cpu_to_be32(S_ISDIR(ip->i_inode.i_mode) &&
1272 !(ip->i_di.di_flags & GFS2_DIF_EXHASH) ? 1268 !(ip->i_diskflags & GFS2_DIF_EXHASH) ?
1273 GFS2_FORMAT_DE : 0); 1269 GFS2_FORMAT_DE : 0);
1274 str->di_depth = cpu_to_be16(ip->i_depth); 1270 str->di_depth = cpu_to_be16(ip->i_depth);
1275 str->di_entries = cpu_to_be32(di->di_entries); 1271 str->di_entries = cpu_to_be32(ip->i_entries);
1276 1272
1277 str->di_eattr = cpu_to_be64(di->di_eattr); 1273 str->di_eattr = cpu_to_be64(ip->i_eattr);
1278 str->di_atime_nsec = cpu_to_be32(ip->i_inode.i_atime.tv_nsec); 1274 str->di_atime_nsec = cpu_to_be32(ip->i_inode.i_atime.tv_nsec);
1279 str->di_mtime_nsec = cpu_to_be32(ip->i_inode.i_mtime.tv_nsec); 1275 str->di_mtime_nsec = cpu_to_be32(ip->i_inode.i_mtime.tv_nsec);
1280 str->di_ctime_nsec = cpu_to_be32(ip->i_inode.i_ctime.tv_nsec); 1276 str->di_ctime_nsec = cpu_to_be32(ip->i_inode.i_ctime.tv_nsec);
@@ -1282,22 +1278,21 @@ void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf)
1282 1278
1283void gfs2_dinode_print(const struct gfs2_inode *ip) 1279void gfs2_dinode_print(const struct gfs2_inode *ip)
1284{ 1280{
1285 const struct gfs2_dinode_host *di = &ip->i_di;
1286
1287 printk(KERN_INFO " no_formal_ino = %llu\n", 1281 printk(KERN_INFO " no_formal_ino = %llu\n",
1288 (unsigned long long)ip->i_no_formal_ino); 1282 (unsigned long long)ip->i_no_formal_ino);
1289 printk(KERN_INFO " no_addr = %llu\n", 1283 printk(KERN_INFO " no_addr = %llu\n",
1290 (unsigned long long)ip->i_no_addr); 1284 (unsigned long long)ip->i_no_addr);
1291 printk(KERN_INFO " di_size = %llu\n", (unsigned long long)di->di_size); 1285 printk(KERN_INFO " i_disksize = %llu\n",
1286 (unsigned long long)ip->i_disksize);
1292 printk(KERN_INFO " blocks = %llu\n", 1287 printk(KERN_INFO " blocks = %llu\n",
1293 (unsigned long long)gfs2_get_inode_blocks(&ip->i_inode)); 1288 (unsigned long long)gfs2_get_inode_blocks(&ip->i_inode));
1294 printk(KERN_INFO " i_goal = %llu\n", 1289 printk(KERN_INFO " i_goal = %llu\n",
1295 (unsigned long long)ip->i_goal); 1290 (unsigned long long)ip->i_goal);
1296 printk(KERN_INFO " di_flags = 0x%.8X\n", di->di_flags); 1291 printk(KERN_INFO " i_diskflags = 0x%.8X\n", ip->i_diskflags);
1297 printk(KERN_INFO " i_height = %u\n", ip->i_height); 1292 printk(KERN_INFO " i_height = %u\n", ip->i_height);
1298 printk(KERN_INFO " i_depth = %u\n", ip->i_depth); 1293 printk(KERN_INFO " i_depth = %u\n", ip->i_depth);
1299 printk(KERN_INFO " di_entries = %u\n", di->di_entries); 1294 printk(KERN_INFO " i_entries = %u\n", ip->i_entries);
1300 printk(KERN_INFO " di_eattr = %llu\n", 1295 printk(KERN_INFO " i_eattr = %llu\n",
1301 (unsigned long long)di->di_eattr); 1296 (unsigned long long)ip->i_eattr);
1302} 1297}
1303 1298
diff --git a/fs/gfs2/inode.h b/fs/gfs2/inode.h
index 2d43f69610a0..d5329364cdff 100644
--- a/fs/gfs2/inode.h
+++ b/fs/gfs2/inode.h
@@ -10,6 +10,7 @@
10#ifndef __INODE_DOT_H__ 10#ifndef __INODE_DOT_H__
11#define __INODE_DOT_H__ 11#define __INODE_DOT_H__
12 12
13#include <linux/fs.h>
13#include "util.h" 14#include "util.h"
14 15
15static inline int gfs2_is_stuffed(const struct gfs2_inode *ip) 16static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
@@ -19,7 +20,7 @@ static inline int gfs2_is_stuffed(const struct gfs2_inode *ip)
19 20
20static inline int gfs2_is_jdata(const struct gfs2_inode *ip) 21static inline int gfs2_is_jdata(const struct gfs2_inode *ip)
21{ 22{
22 return ip->i_di.di_flags & GFS2_DIF_JDATA; 23 return ip->i_diskflags & GFS2_DIF_JDATA;
23} 24}
24 25
25static inline int gfs2_is_writeback(const struct gfs2_inode *ip) 26static inline int gfs2_is_writeback(const struct gfs2_inode *ip)
@@ -97,5 +98,15 @@ struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
97void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf); 98void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
98void gfs2_dinode_print(const struct gfs2_inode *ip); 99void gfs2_dinode_print(const struct gfs2_inode *ip);
99 100
101extern const struct inode_operations gfs2_file_iops;
102extern const struct inode_operations gfs2_dir_iops;
103extern const struct inode_operations gfs2_symlink_iops;
104extern const struct file_operations gfs2_file_fops;
105extern const struct file_operations gfs2_dir_fops;
106extern const struct file_operations gfs2_file_fops_nolock;
107extern const struct file_operations gfs2_dir_fops_nolock;
108
109extern void gfs2_set_inode_flags(struct inode *inode);
110
100#endif /* __INODE_DOT_H__ */ 111#endif /* __INODE_DOT_H__ */
101 112
diff --git a/fs/gfs2/locking/dlm/mount.c b/fs/gfs2/locking/dlm/mount.c
index 0c4cbe6c8285..1aa7eb6a0226 100644
--- a/fs/gfs2/locking/dlm/mount.c
+++ b/fs/gfs2/locking/dlm/mount.c
@@ -194,17 +194,25 @@ out:
194static void gdlm_recovery_done(void *lockspace, unsigned int jid, 194static void gdlm_recovery_done(void *lockspace, unsigned int jid,
195 unsigned int message) 195 unsigned int message)
196{ 196{
197 char env_jid[20];
198 char env_status[20];
199 char *envp[] = { env_jid, env_status, NULL };
197 struct gdlm_ls *ls = lockspace; 200 struct gdlm_ls *ls = lockspace;
198 ls->recover_jid_done = jid; 201 ls->recover_jid_done = jid;
199 ls->recover_jid_status = message; 202 ls->recover_jid_status = message;
200 kobject_uevent(&ls->kobj, KOBJ_CHANGE); 203 sprintf(env_jid, "JID=%d", jid);
204 sprintf(env_status, "RECOVERY=%s",
205 message == LM_RD_SUCCESS ? "Done" : "Failed");
206 kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
201} 207}
202 208
203static void gdlm_others_may_mount(void *lockspace) 209static void gdlm_others_may_mount(void *lockspace)
204{ 210{
211 char *message = "FIRSTMOUNT=Done";
212 char *envp[] = { message, NULL };
205 struct gdlm_ls *ls = lockspace; 213 struct gdlm_ls *ls = lockspace;
206 ls->first_done = 1; 214 ls->first_done = 1;
207 kobject_uevent(&ls->kobj, KOBJ_CHANGE); 215 kobject_uevent_env(&ls->kobj, KOBJ_CHANGE, envp);
208} 216}
209 217
210/* Userspace gets the offline uevent, blocks new gfs locks on 218/* Userspace gets the offline uevent, blocks new gfs locks on
diff --git a/fs/gfs2/locking/dlm/sysfs.c b/fs/gfs2/locking/dlm/sysfs.c
index 4ec571c3d8a9..9b7edcf7bd49 100644
--- a/fs/gfs2/locking/dlm/sysfs.c
+++ b/fs/gfs2/locking/dlm/sysfs.c
@@ -195,9 +195,23 @@ void gdlm_kobject_release(struct gdlm_ls *ls)
195 kobject_put(&ls->kobj); 195 kobject_put(&ls->kobj);
196} 196}
197 197
198static int gdlm_uevent(struct kset *kset, struct kobject *kobj,
199 struct kobj_uevent_env *env)
200{
201 struct gdlm_ls *ls = container_of(kobj, struct gdlm_ls, kobj);
202 add_uevent_var(env, "LOCKTABLE=%s:%s", ls->clustername, ls->fsname);
203 add_uevent_var(env, "LOCKPROTO=lock_dlm");
204 return 0;
205}
206
207static struct kset_uevent_ops gdlm_uevent_ops = {
208 .uevent = gdlm_uevent,
209};
210
211
198int gdlm_sysfs_init(void) 212int gdlm_sysfs_init(void)
199{ 213{
200 gdlm_kset = kset_create_and_add("lock_dlm", NULL, kernel_kobj); 214 gdlm_kset = kset_create_and_add("lock_dlm", &gdlm_uevent_ops, kernel_kobj);
201 if (!gdlm_kset) { 215 if (!gdlm_kset) {
202 printk(KERN_WARNING "%s: can not create kset\n", __func__); 216 printk(KERN_WARNING "%s: can not create kset\n", __func__);
203 return -ENOMEM; 217 return -ENOMEM;
diff --git a/fs/gfs2/main.c b/fs/gfs2/main.c
index bb2cc303ac29..7cacfde32194 100644
--- a/fs/gfs2/main.c
+++ b/fs/gfs2/main.c
@@ -19,7 +19,7 @@
19 19
20#include "gfs2.h" 20#include "gfs2.h"
21#include "incore.h" 21#include "incore.h"
22#include "ops_fstype.h" 22#include "super.h"
23#include "sys.h" 23#include "sys.h"
24#include "util.h" 24#include "util.h"
25#include "glock.h" 25#include "glock.h"
@@ -30,6 +30,7 @@ static void gfs2_init_inode_once(void *foo)
30 30
31 inode_init_once(&ip->i_inode); 31 inode_init_once(&ip->i_inode);
32 init_rwsem(&ip->i_rw_mutex); 32 init_rwsem(&ip->i_rw_mutex);
33 INIT_LIST_HEAD(&ip->i_trunc_list);
33 ip->i_alloc = NULL; 34 ip->i_alloc = NULL;
34} 35}
35 36
@@ -42,7 +43,7 @@ static void gfs2_init_glock_once(void *foo)
42 INIT_LIST_HEAD(&gl->gl_holders); 43 INIT_LIST_HEAD(&gl->gl_holders);
43 gl->gl_lvb = NULL; 44 gl->gl_lvb = NULL;
44 atomic_set(&gl->gl_lvb_count, 0); 45 atomic_set(&gl->gl_lvb_count, 0);
45 INIT_LIST_HEAD(&gl->gl_reclaim); 46 INIT_LIST_HEAD(&gl->gl_lru);
46 INIT_LIST_HEAD(&gl->gl_ail_list); 47 INIT_LIST_HEAD(&gl->gl_ail_list);
47 atomic_set(&gl->gl_ail_count, 0); 48 atomic_set(&gl->gl_ail_count, 0);
48} 49}
@@ -93,6 +94,12 @@ static int __init init_gfs2_fs(void)
93 if (!gfs2_rgrpd_cachep) 94 if (!gfs2_rgrpd_cachep)
94 goto fail; 95 goto fail;
95 96
97 gfs2_quotad_cachep = kmem_cache_create("gfs2_quotad",
98 sizeof(struct gfs2_quota_data),
99 0, 0, NULL);
100 if (!gfs2_quotad_cachep)
101 goto fail;
102
96 error = register_filesystem(&gfs2_fs_type); 103 error = register_filesystem(&gfs2_fs_type);
97 if (error) 104 if (error)
98 goto fail; 105 goto fail;
@@ -112,6 +119,9 @@ fail_unregister:
112fail: 119fail:
113 gfs2_glock_exit(); 120 gfs2_glock_exit();
114 121
122 if (gfs2_quotad_cachep)
123 kmem_cache_destroy(gfs2_quotad_cachep);
124
115 if (gfs2_rgrpd_cachep) 125 if (gfs2_rgrpd_cachep)
116 kmem_cache_destroy(gfs2_rgrpd_cachep); 126 kmem_cache_destroy(gfs2_rgrpd_cachep);
117 127
@@ -140,6 +150,7 @@ static void __exit exit_gfs2_fs(void)
140 unregister_filesystem(&gfs2_fs_type); 150 unregister_filesystem(&gfs2_fs_type);
141 unregister_filesystem(&gfs2meta_fs_type); 151 unregister_filesystem(&gfs2meta_fs_type);
142 152
153 kmem_cache_destroy(gfs2_quotad_cachep);
143 kmem_cache_destroy(gfs2_rgrpd_cachep); 154 kmem_cache_destroy(gfs2_rgrpd_cachep);
144 kmem_cache_destroy(gfs2_bufdata_cachep); 155 kmem_cache_destroy(gfs2_bufdata_cachep);
145 kmem_cache_destroy(gfs2_inode_cachep); 156 kmem_cache_destroy(gfs2_inode_cachep);
diff --git a/fs/gfs2/mount.c b/fs/gfs2/mount.c
index f96eb90a2cfa..3cb0a44ba023 100644
--- a/fs/gfs2/mount.c
+++ b/fs/gfs2/mount.c
@@ -32,7 +32,6 @@ enum {
32 Opt_debug, 32 Opt_debug,
33 Opt_nodebug, 33 Opt_nodebug,
34 Opt_upgrade, 34 Opt_upgrade,
35 Opt_num_glockd,
36 Opt_acl, 35 Opt_acl,
37 Opt_noacl, 36 Opt_noacl,
38 Opt_quota_off, 37 Opt_quota_off,
@@ -57,7 +56,6 @@ static const match_table_t tokens = {
57 {Opt_debug, "debug"}, 56 {Opt_debug, "debug"},
58 {Opt_nodebug, "nodebug"}, 57 {Opt_nodebug, "nodebug"},
59 {Opt_upgrade, "upgrade"}, 58 {Opt_upgrade, "upgrade"},
60 {Opt_num_glockd, "num_glockd=%d"},
61 {Opt_acl, "acl"}, 59 {Opt_acl, "acl"},
62 {Opt_noacl, "noacl"}, 60 {Opt_noacl, "noacl"},
63 {Opt_quota_off, "quota=off"}, 61 {Opt_quota_off, "quota=off"},
@@ -87,16 +85,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
87 int error = 0; 85 int error = 0;
88 86
89 if (!remount) { 87 if (!remount) {
90 /* If someone preloaded options, use those instead */
91 spin_lock(&gfs2_sys_margs_lock);
92 if (gfs2_sys_margs) {
93 data = gfs2_sys_margs;
94 gfs2_sys_margs = NULL;
95 }
96 spin_unlock(&gfs2_sys_margs_lock);
97
98 /* Set some defaults */ 88 /* Set some defaults */
99 args->ar_num_glockd = GFS2_GLOCKD_DEFAULT;
100 args->ar_quota = GFS2_QUOTA_DEFAULT; 89 args->ar_quota = GFS2_QUOTA_DEFAULT;
101 args->ar_data = GFS2_DATA_DEFAULT; 90 args->ar_data = GFS2_DATA_DEFAULT;
102 } 91 }
@@ -105,7 +94,7 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
105 process them */ 94 process them */
106 95
107 for (options = data; (o = strsep(&options, ",")); ) { 96 for (options = data; (o = strsep(&options, ",")); ) {
108 int token, option; 97 int token;
109 substring_t tmp[MAX_OPT_ARGS]; 98 substring_t tmp[MAX_OPT_ARGS];
110 99
111 if (!*o) 100 if (!*o)
@@ -196,22 +185,6 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
196 goto cant_remount; 185 goto cant_remount;
197 args->ar_upgrade = 1; 186 args->ar_upgrade = 1;
198 break; 187 break;
199 case Opt_num_glockd:
200 if ((error = match_int(&tmp[0], &option))) {
201 fs_info(sdp, "problem getting num_glockd\n");
202 goto out_error;
203 }
204
205 if (remount && option != args->ar_num_glockd)
206 goto cant_remount;
207 if (!option || option > GFS2_GLOCKD_MAX) {
208 fs_info(sdp, "0 < num_glockd <= %u (not %u)\n",
209 GFS2_GLOCKD_MAX, option);
210 error = -EINVAL;
211 goto out_error;
212 }
213 args->ar_num_glockd = option;
214 break;
215 case Opt_acl: 188 case Opt_acl:
216 args->ar_posix_acl = 1; 189 args->ar_posix_acl = 1;
217 sdp->sd_vfs->s_flags |= MS_POSIXACL; 190 sdp->sd_vfs->s_flags |= MS_POSIXACL;
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c
index 15f710f2d4da..6e4ea36c6605 100644
--- a/fs/gfs2/ops_address.c
+++ b/fs/gfs2/ops_address.c
@@ -210,25 +210,23 @@ static int gfs2_jdata_writepage(struct page *page, struct writeback_control *wbc
210{ 210{
211 struct inode *inode = page->mapping->host; 211 struct inode *inode = page->mapping->host;
212 struct gfs2_sbd *sdp = GFS2_SB(inode); 212 struct gfs2_sbd *sdp = GFS2_SB(inode);
213 int error; 213 int ret;
214 int done_trans = 0; 214 int done_trans = 0;
215 215
216 error = gfs2_writepage_common(page, wbc);
217 if (error <= 0)
218 return error;
219
220 if (PageChecked(page)) { 216 if (PageChecked(page)) {
221 if (wbc->sync_mode != WB_SYNC_ALL) 217 if (wbc->sync_mode != WB_SYNC_ALL)
222 goto out_ignore; 218 goto out_ignore;
223 error = gfs2_trans_begin(sdp, RES_DINODE + 1, 0); 219 ret = gfs2_trans_begin(sdp, RES_DINODE + 1, 0);
224 if (error) 220 if (ret)
225 goto out_ignore; 221 goto out_ignore;
226 done_trans = 1; 222 done_trans = 1;
227 } 223 }
228 error = __gfs2_jdata_writepage(page, wbc); 224 ret = gfs2_writepage_common(page, wbc);
225 if (ret > 0)
226 ret = __gfs2_jdata_writepage(page, wbc);
229 if (done_trans) 227 if (done_trans)
230 gfs2_trans_end(sdp); 228 gfs2_trans_end(sdp);
231 return error; 229 return ret;
232 230
233out_ignore: 231out_ignore:
234 redirty_page_for_writepage(wbc, page); 232 redirty_page_for_writepage(wbc, page);
@@ -453,8 +451,8 @@ static int stuffed_readpage(struct gfs2_inode *ip, struct page *page)
453 451
454 kaddr = kmap_atomic(page, KM_USER0); 452 kaddr = kmap_atomic(page, KM_USER0);
455 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode), 453 memcpy(kaddr, dibh->b_data + sizeof(struct gfs2_dinode),
456 ip->i_di.di_size); 454 ip->i_disksize);
457 memset(kaddr + ip->i_di.di_size, 0, PAGE_CACHE_SIZE - ip->i_di.di_size); 455 memset(kaddr + ip->i_disksize, 0, PAGE_CACHE_SIZE - ip->i_disksize);
458 kunmap_atomic(kaddr, KM_USER0); 456 kunmap_atomic(kaddr, KM_USER0);
459 flush_dcache_page(page); 457 flush_dcache_page(page);
460 brelse(dibh); 458 brelse(dibh);
@@ -627,7 +625,7 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
627{ 625{
628 struct gfs2_inode *ip = GFS2_I(mapping->host); 626 struct gfs2_inode *ip = GFS2_I(mapping->host);
629 struct gfs2_sbd *sdp = GFS2_SB(mapping->host); 627 struct gfs2_sbd *sdp = GFS2_SB(mapping->host);
630 unsigned int data_blocks, ind_blocks, rblocks; 628 unsigned int data_blocks = 0, ind_blocks = 0, rblocks;
631 int alloc_required; 629 int alloc_required;
632 int error = 0; 630 int error = 0;
633 struct gfs2_alloc *al; 631 struct gfs2_alloc *al;
@@ -641,11 +639,13 @@ static int gfs2_write_begin(struct file *file, struct address_space *mapping,
641 if (unlikely(error)) 639 if (unlikely(error))
642 goto out_uninit; 640 goto out_uninit;
643 641
644 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
645 error = gfs2_write_alloc_required(ip, pos, len, &alloc_required); 642 error = gfs2_write_alloc_required(ip, pos, len, &alloc_required);
646 if (error) 643 if (error)
647 goto out_unlock; 644 goto out_unlock;
648 645
646 if (alloc_required || gfs2_is_jdata(ip))
647 gfs2_write_calc_reserv(ip, len, &data_blocks, &ind_blocks);
648
649 if (alloc_required) { 649 if (alloc_required) {
650 al = gfs2_alloc_get(ip); 650 al = gfs2_alloc_get(ip);
651 if (!al) { 651 if (!al) {
@@ -782,7 +782,7 @@ static int gfs2_stuffed_write_end(struct inode *inode, struct buffer_head *dibh,
782 782
783 if (inode->i_size < to) { 783 if (inode->i_size < to) {
784 i_size_write(inode, to); 784 i_size_write(inode, to);
785 ip->i_di.di_size = inode->i_size; 785 ip->i_disksize = inode->i_size;
786 di->di_size = cpu_to_be64(inode->i_size); 786 di->di_size = cpu_to_be64(inode->i_size);
787 mark_inode_dirty(inode); 787 mark_inode_dirty(inode);
788 } 788 }
@@ -847,9 +847,9 @@ static int gfs2_write_end(struct file *file, struct address_space *mapping,
847 847
848 ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata); 848 ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
849 849
850 if (likely(ret >= 0) && (inode->i_size > ip->i_di.di_size)) { 850 if (likely(ret >= 0) && (inode->i_size > ip->i_disksize)) {
851 di = (struct gfs2_dinode *)dibh->b_data; 851 di = (struct gfs2_dinode *)dibh->b_data;
852 ip->i_di.di_size = inode->i_size; 852 ip->i_disksize = inode->i_size;
853 di->di_size = cpu_to_be64(inode->i_size); 853 di->di_size = cpu_to_be64(inode->i_size);
854 mark_inode_dirty(inode); 854 mark_inode_dirty(inode);
855 } 855 }
diff --git a/fs/gfs2/ops_dentry.c b/fs/gfs2/ops_dentry.c
index 4a5e676b4420..c2ad36330ca3 100644
--- a/fs/gfs2/ops_dentry.c
+++ b/fs/gfs2/ops_dentry.c
@@ -19,7 +19,7 @@
19#include "incore.h" 19#include "incore.h"
20#include "dir.h" 20#include "dir.h"
21#include "glock.h" 21#include "glock.h"
22#include "ops_dentry.h" 22#include "super.h"
23#include "util.h" 23#include "util.h"
24#include "inode.h" 24#include "inode.h"
25 25
diff --git a/fs/gfs2/ops_dentry.h b/fs/gfs2/ops_dentry.h
deleted file mode 100644
index 5caa3db4d3f5..000000000000
--- a/fs/gfs2/ops_dentry.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __OPS_DENTRY_DOT_H__
11#define __OPS_DENTRY_DOT_H__
12
13#include <linux/dcache.h>
14
15extern struct dentry_operations gfs2_dops;
16
17#endif /* __OPS_DENTRY_DOT_H__ */
diff --git a/fs/gfs2/ops_export.c b/fs/gfs2/ops_export.c
index bbb8c36403a9..7fdeb14ddd1a 100644
--- a/fs/gfs2/ops_export.c
+++ b/fs/gfs2/ops_export.c
@@ -22,8 +22,7 @@
22#include "glock.h" 22#include "glock.h"
23#include "glops.h" 23#include "glops.h"
24#include "inode.h" 24#include "inode.h"
25#include "ops_dentry.h" 25#include "super.h"
26#include "ops_fstype.h"
27#include "rgrp.h" 26#include "rgrp.h"
28#include "util.h" 27#include "util.h"
29 28
@@ -214,7 +213,7 @@ static struct dentry *gfs2_get_dentry(struct super_block *sb,
214 } 213 }
215 214
216 error = -EIO; 215 error = -EIO;
217 if (GFS2_I(inode)->i_di.di_flags & GFS2_DIF_SYSTEM) { 216 if (GFS2_I(inode)->i_diskflags & GFS2_DIF_SYSTEM) {
218 iput(inode); 217 iput(inode);
219 goto fail; 218 goto fail;
220 } 219 }
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 3a747f8e2188..289c5f54ba53 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -39,7 +39,6 @@
39#include "util.h" 39#include "util.h"
40#include "eaops.h" 40#include "eaops.h"
41#include "ops_address.h" 41#include "ops_address.h"
42#include "ops_inode.h"
43 42
44/** 43/**
45 * gfs2_llseek - seek to a location in a file 44 * gfs2_llseek - seek to a location in a file
@@ -158,8 +157,8 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
158 if (error) 157 if (error)
159 return error; 158 return error;
160 159
161 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags); 160 fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_diskflags);
162 if (!S_ISDIR(inode->i_mode) && ip->i_di.di_flags & GFS2_DIF_JDATA) 161 if (!S_ISDIR(inode->i_mode) && ip->i_diskflags & GFS2_DIF_JDATA)
163 fsflags |= FS_JOURNAL_DATA_FL; 162 fsflags |= FS_JOURNAL_DATA_FL;
164 if (put_user(fsflags, ptr)) 163 if (put_user(fsflags, ptr))
165 error = -EFAULT; 164 error = -EFAULT;
@@ -172,17 +171,16 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
172void gfs2_set_inode_flags(struct inode *inode) 171void gfs2_set_inode_flags(struct inode *inode)
173{ 172{
174 struct gfs2_inode *ip = GFS2_I(inode); 173 struct gfs2_inode *ip = GFS2_I(inode);
175 struct gfs2_dinode_host *di = &ip->i_di;
176 unsigned int flags = inode->i_flags; 174 unsigned int flags = inode->i_flags;
177 175
178 flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC); 176 flags &= ~(S_SYNC|S_APPEND|S_IMMUTABLE|S_NOATIME|S_DIRSYNC);
179 if (di->di_flags & GFS2_DIF_IMMUTABLE) 177 if (ip->i_diskflags & GFS2_DIF_IMMUTABLE)
180 flags |= S_IMMUTABLE; 178 flags |= S_IMMUTABLE;
181 if (di->di_flags & GFS2_DIF_APPENDONLY) 179 if (ip->i_diskflags & GFS2_DIF_APPENDONLY)
182 flags |= S_APPEND; 180 flags |= S_APPEND;
183 if (di->di_flags & GFS2_DIF_NOATIME) 181 if (ip->i_diskflags & GFS2_DIF_NOATIME)
184 flags |= S_NOATIME; 182 flags |= S_NOATIME;
185 if (di->di_flags & GFS2_DIF_SYNC) 183 if (ip->i_diskflags & GFS2_DIF_SYNC)
186 flags |= S_SYNC; 184 flags |= S_SYNC;
187 inode->i_flags = flags; 185 inode->i_flags = flags;
188} 186}
@@ -221,7 +219,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
221 if (error) 219 if (error)
222 goto out_drop_write; 220 goto out_drop_write;
223 221
224 flags = ip->i_di.di_flags; 222 flags = ip->i_diskflags;
225 new_flags = (flags & ~mask) | (reqflags & mask); 223 new_flags = (flags & ~mask) | (reqflags & mask);
226 if ((new_flags ^ flags) == 0) 224 if ((new_flags ^ flags) == 0)
227 goto out; 225 goto out;
@@ -260,7 +258,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
260 if (error) 258 if (error)
261 goto out_trans_end; 259 goto out_trans_end;
262 gfs2_trans_add_bh(ip->i_gl, bh, 1); 260 gfs2_trans_add_bh(ip->i_gl, bh, 1);
263 ip->i_di.di_flags = new_flags; 261 ip->i_diskflags = new_flags;
264 gfs2_dinode_out(ip, bh->b_data); 262 gfs2_dinode_out(ip, bh->b_data);
265 brelse(bh); 263 brelse(bh);
266 gfs2_set_inode_flags(inode); 264 gfs2_set_inode_flags(inode);
@@ -357,7 +355,6 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
357 goto out; 355 goto out;
358 356
359 set_bit(GIF_SW_PAGED, &ip->i_flags); 357 set_bit(GIF_SW_PAGED, &ip->i_flags);
360 gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
361 ret = gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE, &alloc_required); 358 ret = gfs2_write_alloc_required(ip, pos, PAGE_CACHE_SIZE, &alloc_required);
362 if (ret || !alloc_required) 359 if (ret || !alloc_required)
363 goto out_unlock; 360 goto out_unlock;
@@ -369,6 +366,7 @@ static int gfs2_page_mkwrite(struct vm_area_struct *vma, struct page *page)
369 ret = gfs2_quota_lock_check(ip); 366 ret = gfs2_quota_lock_check(ip);
370 if (ret) 367 if (ret)
371 goto out_alloc_put; 368 goto out_alloc_put;
369 gfs2_write_calc_reserv(ip, PAGE_CACHE_SIZE, &data_blocks, &ind_blocks);
372 al->al_requested = data_blocks + ind_blocks; 370 al->al_requested = data_blocks + ind_blocks;
373 ret = gfs2_inplace_reserve(ip); 371 ret = gfs2_inplace_reserve(ip);
374 if (ret) 372 if (ret)
@@ -479,7 +477,7 @@ static int gfs2_open(struct inode *inode, struct file *file)
479 goto fail; 477 goto fail;
480 478
481 if (!(file->f_flags & O_LARGEFILE) && 479 if (!(file->f_flags & O_LARGEFILE) &&
482 ip->i_di.di_size > MAX_NON_LFS) { 480 ip->i_disksize > MAX_NON_LFS) {
483 error = -EOVERFLOW; 481 error = -EOVERFLOW;
484 goto fail_gunlock; 482 goto fail_gunlock;
485 } 483 }
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c
index b117fcf2c4f5..f91eebdde581 100644
--- a/fs/gfs2/ops_fstype.c
+++ b/fs/gfs2/ops_fstype.c
@@ -22,20 +22,18 @@
22#include "gfs2.h" 22#include "gfs2.h"
23#include "incore.h" 23#include "incore.h"
24#include "bmap.h" 24#include "bmap.h"
25#include "daemon.h"
26#include "glock.h" 25#include "glock.h"
27#include "glops.h" 26#include "glops.h"
28#include "inode.h" 27#include "inode.h"
29#include "mount.h" 28#include "mount.h"
30#include "ops_fstype.h"
31#include "ops_dentry.h"
32#include "ops_super.h"
33#include "recovery.h" 29#include "recovery.h"
34#include "rgrp.h" 30#include "rgrp.h"
35#include "super.h" 31#include "super.h"
36#include "sys.h" 32#include "sys.h"
37#include "util.h" 33#include "util.h"
38#include "log.h" 34#include "log.h"
35#include "quota.h"
36#include "dir.h"
39 37
40#define DO 0 38#define DO 0
41#define UNDO 1 39#define UNDO 1
@@ -58,12 +56,10 @@ static void gfs2_tune_init(struct gfs2_tune *gt)
58{ 56{
59 spin_lock_init(&gt->gt_spin); 57 spin_lock_init(&gt->gt_spin);
60 58
61 gt->gt_demote_secs = 300;
62 gt->gt_incore_log_blocks = 1024; 59 gt->gt_incore_log_blocks = 1024;
63 gt->gt_log_flush_secs = 60; 60 gt->gt_log_flush_secs = 60;
64 gt->gt_recoverd_secs = 60; 61 gt->gt_recoverd_secs = 60;
65 gt->gt_logd_secs = 1; 62 gt->gt_logd_secs = 1;
66 gt->gt_quotad_secs = 5;
67 gt->gt_quota_simul_sync = 64; 63 gt->gt_quota_simul_sync = 64;
68 gt->gt_quota_warn_period = 10; 64 gt->gt_quota_warn_period = 10;
69 gt->gt_quota_scale_num = 1; 65 gt->gt_quota_scale_num = 1;
@@ -91,10 +87,6 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
91 87
92 gfs2_tune_init(&sdp->sd_tune); 88 gfs2_tune_init(&sdp->sd_tune);
93 89
94 INIT_LIST_HEAD(&sdp->sd_reclaim_list);
95 spin_lock_init(&sdp->sd_reclaim_lock);
96 init_waitqueue_head(&sdp->sd_reclaim_wq);
97
98 mutex_init(&sdp->sd_inum_mutex); 90 mutex_init(&sdp->sd_inum_mutex);
99 spin_lock_init(&sdp->sd_statfs_spin); 91 spin_lock_init(&sdp->sd_statfs_spin);
100 92
@@ -110,6 +102,9 @@ static struct gfs2_sbd *init_sbd(struct super_block *sb)
110 INIT_LIST_HEAD(&sdp->sd_quota_list); 102 INIT_LIST_HEAD(&sdp->sd_quota_list);
111 spin_lock_init(&sdp->sd_quota_spin); 103 spin_lock_init(&sdp->sd_quota_spin);
112 mutex_init(&sdp->sd_quota_mutex); 104 mutex_init(&sdp->sd_quota_mutex);
105 init_waitqueue_head(&sdp->sd_quota_wait);
106 INIT_LIST_HEAD(&sdp->sd_trunc_list);
107 spin_lock_init(&sdp->sd_trunc_lock);
113 108
114 spin_lock_init(&sdp->sd_log_lock); 109 spin_lock_init(&sdp->sd_log_lock);
115 110
@@ -443,24 +438,11 @@ out:
443static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh, 438static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
444 int undo) 439 int undo)
445{ 440{
446 struct task_struct *p;
447 int error = 0; 441 int error = 0;
448 442
449 if (undo) 443 if (undo)
450 goto fail_trans; 444 goto fail_trans;
451 445
452 for (sdp->sd_glockd_num = 0;
453 sdp->sd_glockd_num < sdp->sd_args.ar_num_glockd;
454 sdp->sd_glockd_num++) {
455 p = kthread_run(gfs2_glockd, sdp, "gfs2_glockd");
456 error = IS_ERR(p);
457 if (error) {
458 fs_err(sdp, "can't start glockd thread: %d\n", error);
459 goto fail;
460 }
461 sdp->sd_glockd_process[sdp->sd_glockd_num] = p;
462 }
463
464 error = gfs2_glock_nq_num(sdp, 446 error = gfs2_glock_nq_num(sdp,
465 GFS2_MOUNT_LOCK, &gfs2_nondisk_glops, 447 GFS2_MOUNT_LOCK, &gfs2_nondisk_glops,
466 LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE, 448 LM_ST_EXCLUSIVE, LM_FLAG_NOEXP | GL_NOCACHE,
@@ -493,7 +475,6 @@ static int init_locking(struct gfs2_sbd *sdp, struct gfs2_holder *mount_gh,
493 fs_err(sdp, "can't create transaction glock: %d\n", error); 475 fs_err(sdp, "can't create transaction glock: %d\n", error);
494 goto fail_rename; 476 goto fail_rename;
495 } 477 }
496 set_bit(GLF_STICKY, &sdp->sd_trans_gl->gl_flags);
497 478
498 return 0; 479 return 0;
499 480
@@ -506,9 +487,6 @@ fail_live:
506fail_mount: 487fail_mount:
507 gfs2_glock_dq_uninit(mount_gh); 488 gfs2_glock_dq_uninit(mount_gh);
508fail: 489fail:
509 while (sdp->sd_glockd_num--)
510 kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
511
512 return error; 490 return error;
513} 491}
514 492
@@ -620,7 +598,7 @@ static int map_journal_extents(struct gfs2_sbd *sdp)
620 598
621 prev_db = 0; 599 prev_db = 0;
622 600
623 for (lb = 0; lb < ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; lb++) { 601 for (lb = 0; lb < ip->i_disksize >> sdp->sd_sb.sb_bsize_shift; lb++) {
624 bh.b_state = 0; 602 bh.b_state = 0;
625 bh.b_blocknr = 0; 603 bh.b_blocknr = 0;
626 bh.b_size = 1 << ip->i_inode.i_blkbits; 604 bh.b_size = 1 << ip->i_inode.i_blkbits;
@@ -661,6 +639,72 @@ static void gfs2_lm_others_may_mount(struct gfs2_sbd *sdp)
661 sdp->sd_lockstruct.ls_lockspace); 639 sdp->sd_lockstruct.ls_lockspace);
662} 640}
663 641
642/**
643 * gfs2_jindex_hold - Grab a lock on the jindex
644 * @sdp: The GFS2 superblock
645 * @ji_gh: the holder for the jindex glock
646 *
647 * Returns: errno
648 */
649
650static int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
651{
652 struct gfs2_inode *dip = GFS2_I(sdp->sd_jindex);
653 struct qstr name;
654 char buf[20];
655 struct gfs2_jdesc *jd;
656 int error;
657
658 name.name = buf;
659
660 mutex_lock(&sdp->sd_jindex_mutex);
661
662 for (;;) {
663 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
664 if (error)
665 break;
666
667 name.len = sprintf(buf, "journal%u", sdp->sd_journals);
668 name.hash = gfs2_disk_hash(name.name, name.len);
669
670 error = gfs2_dir_check(sdp->sd_jindex, &name, NULL);
671 if (error == -ENOENT) {
672 error = 0;
673 break;
674 }
675
676 gfs2_glock_dq_uninit(ji_gh);
677
678 if (error)
679 break;
680
681 error = -ENOMEM;
682 jd = kzalloc(sizeof(struct gfs2_jdesc), GFP_KERNEL);
683 if (!jd)
684 break;
685
686 INIT_LIST_HEAD(&jd->extent_list);
687 jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
688 if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
689 if (!jd->jd_inode)
690 error = -ENOENT;
691 else
692 error = PTR_ERR(jd->jd_inode);
693 kfree(jd);
694 break;
695 }
696
697 spin_lock(&sdp->sd_jindex_spin);
698 jd->jd_jid = sdp->sd_journals++;
699 list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
700 spin_unlock(&sdp->sd_jindex_spin);
701 }
702
703 mutex_unlock(&sdp->sd_jindex_mutex);
704
705 return error;
706}
707
664static int init_journal(struct gfs2_sbd *sdp, int undo) 708static int init_journal(struct gfs2_sbd *sdp, int undo)
665{ 709{
666 struct inode *master = sdp->sd_master_dir->d_inode; 710 struct inode *master = sdp->sd_master_dir->d_inode;
@@ -681,7 +725,6 @@ static int init_journal(struct gfs2_sbd *sdp, int undo)
681 return PTR_ERR(sdp->sd_jindex); 725 return PTR_ERR(sdp->sd_jindex);
682 } 726 }
683 ip = GFS2_I(sdp->sd_jindex); 727 ip = GFS2_I(sdp->sd_jindex);
684 set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
685 728
686 /* Load in the journal index special file */ 729 /* Load in the journal index special file */
687 730
@@ -832,7 +875,6 @@ static int init_inodes(struct gfs2_sbd *sdp, int undo)
832 goto fail_statfs; 875 goto fail_statfs;
833 } 876 }
834 ip = GFS2_I(sdp->sd_rindex); 877 ip = GFS2_I(sdp->sd_rindex);
835 set_bit(GLF_STICKY, &ip->i_gl->gl_flags);
836 sdp->sd_rindex_uptodate = 0; 878 sdp->sd_rindex_uptodate = 0;
837 879
838 /* Read in the quota inode */ 880 /* Read in the quota inode */
@@ -973,9 +1015,6 @@ static int init_threads(struct gfs2_sbd *sdp, int undo)
973 } 1015 }
974 sdp->sd_logd_process = p; 1016 sdp->sd_logd_process = p;
975 1017
976 sdp->sd_statfs_sync_time = jiffies;
977 sdp->sd_quota_sync_time = jiffies;
978
979 p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad"); 1018 p = kthread_run(gfs2_quotad, sdp, "gfs2_quotad");
980 error = IS_ERR(p); 1019 error = IS_ERR(p);
981 if (error) { 1020 if (error) {
@@ -1224,17 +1263,21 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags,
1224static void gfs2_kill_sb(struct super_block *sb) 1263static void gfs2_kill_sb(struct super_block *sb)
1225{ 1264{
1226 struct gfs2_sbd *sdp = sb->s_fs_info; 1265 struct gfs2_sbd *sdp = sb->s_fs_info;
1227 if (sdp) { 1266
1228 gfs2_meta_syncfs(sdp); 1267 if (sdp == NULL) {
1229 dput(sdp->sd_root_dir); 1268 kill_block_super(sb);
1230 dput(sdp->sd_master_dir); 1269 return;
1231 sdp->sd_root_dir = NULL;
1232 sdp->sd_master_dir = NULL;
1233 } 1270 }
1271
1272 gfs2_meta_syncfs(sdp);
1273 dput(sdp->sd_root_dir);
1274 dput(sdp->sd_master_dir);
1275 sdp->sd_root_dir = NULL;
1276 sdp->sd_master_dir = NULL;
1234 shrink_dcache_sb(sb); 1277 shrink_dcache_sb(sb);
1235 kill_block_super(sb); 1278 kill_block_super(sb);
1236 if (sdp) 1279 gfs2_delete_debugfs_file(sdp);
1237 gfs2_delete_debugfs_file(sdp); 1280 kfree(sdp);
1238} 1281}
1239 1282
1240struct file_system_type gfs2_fs_type = { 1283struct file_system_type gfs2_fs_type = {
diff --git a/fs/gfs2/ops_fstype.h b/fs/gfs2/ops_fstype.h
deleted file mode 100644
index da8490511836..000000000000
--- a/fs/gfs2/ops_fstype.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __OPS_FSTYPE_DOT_H__
11#define __OPS_FSTYPE_DOT_H__
12
13#include <linux/fs.h>
14
15extern struct file_system_type gfs2_fs_type;
16extern struct file_system_type gfs2meta_fs_type;
17extern const struct export_operations gfs2_export_ops;
18
19#endif /* __OPS_FSTYPE_DOT_H__ */
diff --git a/fs/gfs2/ops_inode.c b/fs/gfs2/ops_inode.c
index d232991b9046..49877546beb9 100644
--- a/fs/gfs2/ops_inode.c
+++ b/fs/gfs2/ops_inode.c
@@ -19,6 +19,7 @@
19#include <linux/gfs2_ondisk.h> 19#include <linux/gfs2_ondisk.h>
20#include <linux/crc32.h> 20#include <linux/crc32.h>
21#include <linux/lm_interface.h> 21#include <linux/lm_interface.h>
22#include <linux/fiemap.h>
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23 24
24#include "gfs2.h" 25#include "gfs2.h"
@@ -31,12 +32,11 @@
31#include "glock.h" 32#include "glock.h"
32#include "inode.h" 33#include "inode.h"
33#include "meta_io.h" 34#include "meta_io.h"
34#include "ops_dentry.h"
35#include "ops_inode.h"
36#include "quota.h" 35#include "quota.h"
37#include "rgrp.h" 36#include "rgrp.h"
38#include "trans.h" 37#include "trans.h"
39#include "util.h" 38#include "util.h"
39#include "super.h"
40 40
41/** 41/**
42 * gfs2_create - Create a file 42 * gfs2_create - Create a file
@@ -185,7 +185,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
185 if (!dip->i_inode.i_nlink) 185 if (!dip->i_inode.i_nlink)
186 goto out_gunlock; 186 goto out_gunlock;
187 error = -EFBIG; 187 error = -EFBIG;
188 if (dip->i_di.di_entries == (u32)-1) 188 if (dip->i_entries == (u32)-1)
189 goto out_gunlock; 189 goto out_gunlock;
190 error = -EPERM; 190 error = -EPERM;
191 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 191 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
@@ -371,7 +371,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
371 371
372 ip = ghs[1].gh_gl->gl_object; 372 ip = ghs[1].gh_gl->gl_object;
373 373
374 ip->i_di.di_size = size; 374 ip->i_disksize = size;
375 375
376 error = gfs2_meta_inode_buffer(ip, &dibh); 376 error = gfs2_meta_inode_buffer(ip, &dibh);
377 377
@@ -425,9 +425,9 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
425 ip = ghs[1].gh_gl->gl_object; 425 ip = ghs[1].gh_gl->gl_object;
426 426
427 ip->i_inode.i_nlink = 2; 427 ip->i_inode.i_nlink = 2;
428 ip->i_di.di_size = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode); 428 ip->i_disksize = sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode);
429 ip->i_di.di_flags |= GFS2_DIF_JDATA; 429 ip->i_diskflags |= GFS2_DIF_JDATA;
430 ip->i_di.di_entries = 2; 430 ip->i_entries = 2;
431 431
432 error = gfs2_meta_inode_buffer(ip, &dibh); 432 error = gfs2_meta_inode_buffer(ip, &dibh);
433 433
@@ -517,13 +517,13 @@ static int gfs2_rmdir(struct inode *dir, struct dentry *dentry)
517 if (error) 517 if (error)
518 goto out_gunlock; 518 goto out_gunlock;
519 519
520 if (ip->i_di.di_entries < 2) { 520 if (ip->i_entries < 2) {
521 if (gfs2_consist_inode(ip)) 521 if (gfs2_consist_inode(ip))
522 gfs2_dinode_print(ip); 522 gfs2_dinode_print(ip);
523 error = -EIO; 523 error = -EIO;
524 goto out_gunlock; 524 goto out_gunlock;
525 } 525 }
526 if (ip->i_di.di_entries > 2) { 526 if (ip->i_entries > 2) {
527 error = -ENOTEMPTY; 527 error = -ENOTEMPTY;
528 goto out_gunlock; 528 goto out_gunlock;
529 } 529 }
@@ -726,13 +726,13 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
726 goto out_gunlock; 726 goto out_gunlock;
727 727
728 if (S_ISDIR(nip->i_inode.i_mode)) { 728 if (S_ISDIR(nip->i_inode.i_mode)) {
729 if (nip->i_di.di_entries < 2) { 729 if (nip->i_entries < 2) {
730 if (gfs2_consist_inode(nip)) 730 if (gfs2_consist_inode(nip))
731 gfs2_dinode_print(nip); 731 gfs2_dinode_print(nip);
732 error = -EIO; 732 error = -EIO;
733 goto out_gunlock; 733 goto out_gunlock;
734 } 734 }
735 if (nip->i_di.di_entries > 2) { 735 if (nip->i_entries > 2) {
736 error = -ENOTEMPTY; 736 error = -ENOTEMPTY;
737 goto out_gunlock; 737 goto out_gunlock;
738 } 738 }
@@ -758,7 +758,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
758 error = -EINVAL; 758 error = -EINVAL;
759 goto out_gunlock; 759 goto out_gunlock;
760 } 760 }
761 if (ndip->i_di.di_entries == (u32)-1) { 761 if (ndip->i_entries == (u32)-1) {
762 error = -EFBIG; 762 error = -EFBIG;
763 goto out_gunlock; 763 goto out_gunlock;
764 } 764 }
@@ -990,7 +990,7 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
990 struct gfs2_sbd *sdp = GFS2_SB(inode); 990 struct gfs2_sbd *sdp = GFS2_SB(inode);
991 int error; 991 int error;
992 992
993 if (attr->ia_size != ip->i_di.di_size) { 993 if (attr->ia_size != ip->i_disksize) {
994 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); 994 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks);
995 if (error) 995 if (error)
996 return error; 996 return error;
@@ -1001,8 +1001,8 @@ static int setattr_size(struct inode *inode, struct iattr *attr)
1001 } 1001 }
1002 1002
1003 error = gfs2_truncatei(ip, attr->ia_size); 1003 error = gfs2_truncatei(ip, attr->ia_size);
1004 if (error && (inode->i_size != ip->i_di.di_size)) 1004 if (error && (inode->i_size != ip->i_disksize))
1005 i_size_write(inode, ip->i_di.di_size); 1005 i_size_write(inode, ip->i_disksize);
1006 1006
1007 return error; 1007 return error;
1008} 1008}
@@ -1212,6 +1212,48 @@ static int gfs2_removexattr(struct dentry *dentry, const char *name)
1212 return gfs2_ea_remove(GFS2_I(dentry->d_inode), &er); 1212 return gfs2_ea_remove(GFS2_I(dentry->d_inode), &er);
1213} 1213}
1214 1214
1215static int gfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
1216 u64 start, u64 len)
1217{
1218 struct gfs2_inode *ip = GFS2_I(inode);
1219 struct gfs2_holder gh;
1220 int ret;
1221
1222 ret = fiemap_check_flags(fieinfo, FIEMAP_FLAG_SYNC);
1223 if (ret)
1224 return ret;
1225
1226 mutex_lock(&inode->i_mutex);
1227
1228 ret = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, 0, &gh);
1229 if (ret)
1230 goto out;
1231
1232 if (gfs2_is_stuffed(ip)) {
1233 u64 phys = ip->i_no_addr << inode->i_blkbits;
1234 u64 size = i_size_read(inode);
1235 u32 flags = FIEMAP_EXTENT_LAST|FIEMAP_EXTENT_NOT_ALIGNED|
1236 FIEMAP_EXTENT_DATA_INLINE;
1237 phys += sizeof(struct gfs2_dinode);
1238 phys += start;
1239 if (start + len > size)
1240 len = size - start;
1241 if (start < size)
1242 ret = fiemap_fill_next_extent(fieinfo, start, phys,
1243 len, flags);
1244 if (ret == 1)
1245 ret = 0;
1246 } else {
1247 ret = __generic_block_fiemap(inode, fieinfo, start, len,
1248 gfs2_block_map);
1249 }
1250
1251 gfs2_glock_dq_uninit(&gh);
1252out:
1253 mutex_unlock(&inode->i_mutex);
1254 return ret;
1255}
1256
1215const struct inode_operations gfs2_file_iops = { 1257const struct inode_operations gfs2_file_iops = {
1216 .permission = gfs2_permission, 1258 .permission = gfs2_permission,
1217 .setattr = gfs2_setattr, 1259 .setattr = gfs2_setattr,
@@ -1220,6 +1262,7 @@ const struct inode_operations gfs2_file_iops = {
1220 .getxattr = gfs2_getxattr, 1262 .getxattr = gfs2_getxattr,
1221 .listxattr = gfs2_listxattr, 1263 .listxattr = gfs2_listxattr,
1222 .removexattr = gfs2_removexattr, 1264 .removexattr = gfs2_removexattr,
1265 .fiemap = gfs2_fiemap,
1223}; 1266};
1224 1267
1225const struct inode_operations gfs2_dir_iops = { 1268const struct inode_operations gfs2_dir_iops = {
@@ -1239,6 +1282,7 @@ const struct inode_operations gfs2_dir_iops = {
1239 .getxattr = gfs2_getxattr, 1282 .getxattr = gfs2_getxattr,
1240 .listxattr = gfs2_listxattr, 1283 .listxattr = gfs2_listxattr,
1241 .removexattr = gfs2_removexattr, 1284 .removexattr = gfs2_removexattr,
1285 .fiemap = gfs2_fiemap,
1242}; 1286};
1243 1287
1244const struct inode_operations gfs2_symlink_iops = { 1288const struct inode_operations gfs2_symlink_iops = {
@@ -1251,5 +1295,6 @@ const struct inode_operations gfs2_symlink_iops = {
1251 .getxattr = gfs2_getxattr, 1295 .getxattr = gfs2_getxattr,
1252 .listxattr = gfs2_listxattr, 1296 .listxattr = gfs2_listxattr,
1253 .removexattr = gfs2_removexattr, 1297 .removexattr = gfs2_removexattr,
1298 .fiemap = gfs2_fiemap,
1254}; 1299};
1255 1300
diff --git a/fs/gfs2/ops_inode.h b/fs/gfs2/ops_inode.h
deleted file mode 100644
index 14b4b797622a..000000000000
--- a/fs/gfs2/ops_inode.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __OPS_INODE_DOT_H__
11#define __OPS_INODE_DOT_H__
12
13#include <linux/fs.h>
14
15extern const struct inode_operations gfs2_file_iops;
16extern const struct inode_operations gfs2_dir_iops;
17extern const struct inode_operations gfs2_symlink_iops;
18extern const struct file_operations gfs2_file_fops;
19extern const struct file_operations gfs2_dir_fops;
20extern const struct file_operations gfs2_file_fops_nolock;
21extern const struct file_operations gfs2_dir_fops_nolock;
22
23extern void gfs2_set_inode_flags(struct inode *inode);
24
25#endif /* __OPS_INODE_DOT_H__ */
diff --git a/fs/gfs2/ops_super.c b/fs/gfs2/ops_super.c
index d5355d9b5926..777783deddcb 100644
--- a/fs/gfs2/ops_super.c
+++ b/fs/gfs2/ops_super.c
@@ -28,7 +28,6 @@
28#include "inode.h" 28#include "inode.h"
29#include "log.h" 29#include "log.h"
30#include "mount.h" 30#include "mount.h"
31#include "ops_super.h"
32#include "quota.h" 31#include "quota.h"
33#include "recovery.h" 32#include "recovery.h"
34#include "rgrp.h" 33#include "rgrp.h"
@@ -143,8 +142,6 @@ static void gfs2_put_super(struct super_block *sb)
143 kthread_stop(sdp->sd_quotad_process); 142 kthread_stop(sdp->sd_quotad_process);
144 kthread_stop(sdp->sd_logd_process); 143 kthread_stop(sdp->sd_logd_process);
145 kthread_stop(sdp->sd_recoverd_process); 144 kthread_stop(sdp->sd_recoverd_process);
146 while (sdp->sd_glockd_num--)
147 kthread_stop(sdp->sd_glockd_process[sdp->sd_glockd_num]);
148 145
149 if (!(sb->s_flags & MS_RDONLY)) { 146 if (!(sb->s_flags & MS_RDONLY)) {
150 error = gfs2_make_fs_ro(sdp); 147 error = gfs2_make_fs_ro(sdp);
@@ -185,7 +182,6 @@ static void gfs2_put_super(struct super_block *sb)
185 182
186 /* At this point, we're through participating in the lockspace */ 183 /* At this point, we're through participating in the lockspace */
187 gfs2_sys_fs_del(sdp); 184 gfs2_sys_fs_del(sdp);
188 kfree(sdp);
189} 185}
190 186
191/** 187/**
@@ -260,6 +256,137 @@ static void gfs2_unlockfs(struct super_block *sb)
260} 256}
261 257
262/** 258/**
259 * statfs_fill - fill in the sg for a given RG
260 * @rgd: the RG
261 * @sc: the sc structure
262 *
263 * Returns: 0 on success, -ESTALE if the LVB is invalid
264 */
265
266static int statfs_slow_fill(struct gfs2_rgrpd *rgd,
267 struct gfs2_statfs_change_host *sc)
268{
269 gfs2_rgrp_verify(rgd);
270 sc->sc_total += rgd->rd_data;
271 sc->sc_free += rgd->rd_free;
272 sc->sc_dinodes += rgd->rd_dinodes;
273 return 0;
274}
275
276/**
277 * gfs2_statfs_slow - Stat a filesystem using asynchronous locking
278 * @sdp: the filesystem
279 * @sc: the sc info that will be returned
280 *
281 * Any error (other than a signal) will cause this routine to fall back
282 * to the synchronous version.
283 *
284 * FIXME: This really shouldn't busy wait like this.
285 *
286 * Returns: errno
287 */
288
289static int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
290{
291 struct gfs2_holder ri_gh;
292 struct gfs2_rgrpd *rgd_next;
293 struct gfs2_holder *gha, *gh;
294 unsigned int slots = 64;
295 unsigned int x;
296 int done;
297 int error = 0, err;
298
299 memset(sc, 0, sizeof(struct gfs2_statfs_change_host));
300 gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL);
301 if (!gha)
302 return -ENOMEM;
303
304 error = gfs2_rindex_hold(sdp, &ri_gh);
305 if (error)
306 goto out;
307
308 rgd_next = gfs2_rgrpd_get_first(sdp);
309
310 for (;;) {
311 done = 1;
312
313 for (x = 0; x < slots; x++) {
314 gh = gha + x;
315
316 if (gh->gh_gl && gfs2_glock_poll(gh)) {
317 err = gfs2_glock_wait(gh);
318 if (err) {
319 gfs2_holder_uninit(gh);
320 error = err;
321 } else {
322 if (!error)
323 error = statfs_slow_fill(
324 gh->gh_gl->gl_object, sc);
325 gfs2_glock_dq_uninit(gh);
326 }
327 }
328
329 if (gh->gh_gl)
330 done = 0;
331 else if (rgd_next && !error) {
332 error = gfs2_glock_nq_init(rgd_next->rd_gl,
333 LM_ST_SHARED,
334 GL_ASYNC,
335 gh);
336 rgd_next = gfs2_rgrpd_get_next(rgd_next);
337 done = 0;
338 }
339
340 if (signal_pending(current))
341 error = -ERESTARTSYS;
342 }
343
344 if (done)
345 break;
346
347 yield();
348 }
349
350 gfs2_glock_dq_uninit(&ri_gh);
351
352out:
353 kfree(gha);
354 return error;
355}
356
357/**
358 * gfs2_statfs_i - Do a statfs
359 * @sdp: the filesystem
360 * @sg: the sg structure
361 *
362 * Returns: errno
363 */
364
365static int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
366{
367 struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
368 struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
369
370 spin_lock(&sdp->sd_statfs_spin);
371
372 *sc = *m_sc;
373 sc->sc_total += l_sc->sc_total;
374 sc->sc_free += l_sc->sc_free;
375 sc->sc_dinodes += l_sc->sc_dinodes;
376
377 spin_unlock(&sdp->sd_statfs_spin);
378
379 if (sc->sc_free < 0)
380 sc->sc_free = 0;
381 if (sc->sc_free > sc->sc_total)
382 sc->sc_free = sc->sc_total;
383 if (sc->sc_dinodes < 0)
384 sc->sc_dinodes = 0;
385
386 return 0;
387}
388
389/**
263 * gfs2_statfs - Gather and return stats about the filesystem 390 * gfs2_statfs - Gather and return stats about the filesystem
264 * @sb: The superblock 391 * @sb: The superblock
265 * @statfsbuf: The buffer 392 * @statfsbuf: The buffer
@@ -370,7 +497,6 @@ static void gfs2_clear_inode(struct inode *inode)
370 */ 497 */
371 if (test_bit(GIF_USER, &ip->i_flags)) { 498 if (test_bit(GIF_USER, &ip->i_flags)) {
372 ip->i_gl->gl_object = NULL; 499 ip->i_gl->gl_object = NULL;
373 gfs2_glock_schedule_for_reclaim(ip->i_gl);
374 gfs2_glock_put(ip->i_gl); 500 gfs2_glock_put(ip->i_gl);
375 ip->i_gl = NULL; 501 ip->i_gl = NULL;
376 if (ip->i_iopen_gh.gh_gl) { 502 if (ip->i_iopen_gh.gh_gl) {
@@ -423,8 +549,6 @@ static int gfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
423 seq_printf(s, ",debug"); 549 seq_printf(s, ",debug");
424 if (args->ar_upgrade) 550 if (args->ar_upgrade)
425 seq_printf(s, ",upgrade"); 551 seq_printf(s, ",upgrade");
426 if (args->ar_num_glockd != GFS2_GLOCKD_DEFAULT)
427 seq_printf(s, ",num_glockd=%u", args->ar_num_glockd);
428 if (args->ar_posix_acl) 552 if (args->ar_posix_acl)
429 seq_printf(s, ",acl"); 553 seq_printf(s, ",acl");
430 if (args->ar_quota != GFS2_QUOTA_DEFAULT) { 554 if (args->ar_quota != GFS2_QUOTA_DEFAULT) {
@@ -494,16 +618,16 @@ static void gfs2_delete_inode(struct inode *inode)
494 gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh); 618 gfs2_holder_reinit(LM_ST_EXCLUSIVE, LM_FLAG_TRY_1CB | GL_NOCACHE, &ip->i_iopen_gh);
495 error = gfs2_glock_nq(&ip->i_iopen_gh); 619 error = gfs2_glock_nq(&ip->i_iopen_gh);
496 if (error) 620 if (error)
497 goto out_uninit; 621 goto out_truncate;
498 622
499 if (S_ISDIR(inode->i_mode) && 623 if (S_ISDIR(inode->i_mode) &&
500 (ip->i_di.di_flags & GFS2_DIF_EXHASH)) { 624 (ip->i_diskflags & GFS2_DIF_EXHASH)) {
501 error = gfs2_dir_exhash_dealloc(ip); 625 error = gfs2_dir_exhash_dealloc(ip);
502 if (error) 626 if (error)
503 goto out_unlock; 627 goto out_unlock;
504 } 628 }
505 629
506 if (ip->i_di.di_eattr) { 630 if (ip->i_eattr) {
507 error = gfs2_ea_dealloc(ip); 631 error = gfs2_ea_dealloc(ip);
508 if (error) 632 if (error)
509 goto out_unlock; 633 goto out_unlock;
@@ -519,6 +643,7 @@ static void gfs2_delete_inode(struct inode *inode)
519 if (error) 643 if (error)
520 goto out_unlock; 644 goto out_unlock;
521 645
646out_truncate:
522 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks); 647 error = gfs2_trans_begin(sdp, 0, sdp->sd_jdesc->jd_blocks);
523 if (error) 648 if (error)
524 goto out_unlock; 649 goto out_unlock;
@@ -527,8 +652,8 @@ static void gfs2_delete_inode(struct inode *inode)
527 gfs2_trans_end(sdp); 652 gfs2_trans_end(sdp);
528 653
529out_unlock: 654out_unlock:
530 gfs2_glock_dq(&ip->i_iopen_gh); 655 if (test_bit(HIF_HOLDER, &ip->i_iopen_gh.gh_iflags))
531out_uninit: 656 gfs2_glock_dq(&ip->i_iopen_gh);
532 gfs2_holder_uninit(&ip->i_iopen_gh); 657 gfs2_holder_uninit(&ip->i_iopen_gh);
533 gfs2_glock_dq_uninit(&gh); 658 gfs2_glock_dq_uninit(&gh);
534 if (error && error != GLR_TRYFAILED) 659 if (error && error != GLR_TRYFAILED)
diff --git a/fs/gfs2/ops_super.h b/fs/gfs2/ops_super.h
deleted file mode 100644
index 442a274c6272..000000000000
--- a/fs/gfs2/ops_super.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
3 * Copyright (C) 2004-2006 Red Hat, Inc. All rights reserved.
4 *
5 * This copyrighted material is made available to anyone wishing to use,
6 * modify, copy, or redistribute it subject to the terms and conditions
7 * of the GNU General Public License version 2.
8 */
9
10#ifndef __OPS_SUPER_DOT_H__
11#define __OPS_SUPER_DOT_H__
12
13#include <linux/fs.h>
14
15extern const struct super_operations gfs2_super_ops;
16
17#endif /* __OPS_SUPER_DOT_H__ */
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c
index 3e073f5144fa..b08d09696b3e 100644
--- a/fs/gfs2/quota.c
+++ b/fs/gfs2/quota.c
@@ -46,6 +46,8 @@
46#include <linux/bio.h> 46#include <linux/bio.h>
47#include <linux/gfs2_ondisk.h> 47#include <linux/gfs2_ondisk.h>
48#include <linux/lm_interface.h> 48#include <linux/lm_interface.h>
49#include <linux/kthread.h>
50#include <linux/freezer.h>
49 51
50#include "gfs2.h" 52#include "gfs2.h"
51#include "incore.h" 53#include "incore.h"
@@ -94,7 +96,7 @@ static int qd_alloc(struct gfs2_sbd *sdp, int user, u32 id,
94 struct gfs2_quota_data *qd; 96 struct gfs2_quota_data *qd;
95 int error; 97 int error;
96 98
97 qd = kzalloc(sizeof(struct gfs2_quota_data), GFP_NOFS); 99 qd = kmem_cache_zalloc(gfs2_quotad_cachep, GFP_NOFS);
98 if (!qd) 100 if (!qd)
99 return -ENOMEM; 101 return -ENOMEM;
100 102
@@ -119,7 +121,7 @@ static int qd_alloc(struct gfs2_sbd *sdp, int user, u32 id,
119 return 0; 121 return 0;
120 122
121fail: 123fail:
122 kfree(qd); 124 kmem_cache_free(gfs2_quotad_cachep, qd);
123 return error; 125 return error;
124} 126}
125 127
@@ -158,7 +160,7 @@ static int qd_get(struct gfs2_sbd *sdp, int user, u32 id, int create,
158 if (qd || !create) { 160 if (qd || !create) {
159 if (new_qd) { 161 if (new_qd) {
160 gfs2_lvb_unhold(new_qd->qd_gl); 162 gfs2_lvb_unhold(new_qd->qd_gl);
161 kfree(new_qd); 163 kmem_cache_free(gfs2_quotad_cachep, new_qd);
162 } 164 }
163 *qdp = qd; 165 *qdp = qd;
164 return 0; 166 return 0;
@@ -1013,7 +1015,7 @@ void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
1013 1015
1014 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), change)) 1016 if (gfs2_assert_warn(GFS2_SB(&ip->i_inode), change))
1015 return; 1017 return;
1016 if (ip->i_di.di_flags & GFS2_DIF_SYSTEM) 1018 if (ip->i_diskflags & GFS2_DIF_SYSTEM)
1017 return; 1019 return;
1018 1020
1019 for (x = 0; x < al->al_qd_num; x++) { 1021 for (x = 0; x < al->al_qd_num; x++) {
@@ -1100,15 +1102,15 @@ static void gfs2_quota_change_in(struct gfs2_quota_change_host *qc, const void *
1100int gfs2_quota_init(struct gfs2_sbd *sdp) 1102int gfs2_quota_init(struct gfs2_sbd *sdp)
1101{ 1103{
1102 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode); 1104 struct gfs2_inode *ip = GFS2_I(sdp->sd_qc_inode);
1103 unsigned int blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 1105 unsigned int blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift;
1104 unsigned int x, slot = 0; 1106 unsigned int x, slot = 0;
1105 unsigned int found = 0; 1107 unsigned int found = 0;
1106 u64 dblock; 1108 u64 dblock;
1107 u32 extlen = 0; 1109 u32 extlen = 0;
1108 int error; 1110 int error;
1109 1111
1110 if (!ip->i_di.di_size || ip->i_di.di_size > (64 << 20) || 1112 if (!ip->i_disksize || ip->i_disksize > (64 << 20) ||
1111 ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1)) { 1113 ip->i_disksize & (sdp->sd_sb.sb_bsize - 1)) {
1112 gfs2_consist_inode(ip); 1114 gfs2_consist_inode(ip);
1113 return -EIO; 1115 return -EIO;
1114 } 1116 }
@@ -1195,7 +1197,7 @@ fail:
1195 return error; 1197 return error;
1196} 1198}
1197 1199
1198void gfs2_quota_scan(struct gfs2_sbd *sdp) 1200static void gfs2_quota_scan(struct gfs2_sbd *sdp)
1199{ 1201{
1200 struct gfs2_quota_data *qd, *safe; 1202 struct gfs2_quota_data *qd, *safe;
1201 LIST_HEAD(dead); 1203 LIST_HEAD(dead);
@@ -1222,7 +1224,7 @@ void gfs2_quota_scan(struct gfs2_sbd *sdp)
1222 gfs2_assert_warn(sdp, !qd->qd_bh_count); 1224 gfs2_assert_warn(sdp, !qd->qd_bh_count);
1223 1225
1224 gfs2_lvb_unhold(qd->qd_gl); 1226 gfs2_lvb_unhold(qd->qd_gl);
1225 kfree(qd); 1227 kmem_cache_free(gfs2_quotad_cachep, qd);
1226 } 1228 }
1227} 1229}
1228 1230
@@ -1257,7 +1259,7 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
1257 gfs2_assert_warn(sdp, !qd->qd_bh_count); 1259 gfs2_assert_warn(sdp, !qd->qd_bh_count);
1258 1260
1259 gfs2_lvb_unhold(qd->qd_gl); 1261 gfs2_lvb_unhold(qd->qd_gl);
1260 kfree(qd); 1262 kmem_cache_free(gfs2_quotad_cachep, qd);
1261 1263
1262 spin_lock(&sdp->sd_quota_spin); 1264 spin_lock(&sdp->sd_quota_spin);
1263 } 1265 }
@@ -1272,3 +1274,94 @@ void gfs2_quota_cleanup(struct gfs2_sbd *sdp)
1272 } 1274 }
1273} 1275}
1274 1276
1277static void quotad_error(struct gfs2_sbd *sdp, const char *msg, int error)
1278{
1279 if (error == 0 || error == -EROFS)
1280 return;
1281 if (!test_bit(SDF_SHUTDOWN, &sdp->sd_flags))
1282 fs_err(sdp, "gfs2_quotad: %s error %d\n", msg, error);
1283}
1284
1285static void quotad_check_timeo(struct gfs2_sbd *sdp, const char *msg,
1286 int (*fxn)(struct gfs2_sbd *sdp),
1287 unsigned long t, unsigned long *timeo,
1288 unsigned int *new_timeo)
1289{
1290 if (t >= *timeo) {
1291 int error = fxn(sdp);
1292 quotad_error(sdp, msg, error);
1293 *timeo = gfs2_tune_get_i(&sdp->sd_tune, new_timeo) * HZ;
1294 } else {
1295 *timeo -= t;
1296 }
1297}
1298
1299static void quotad_check_trunc_list(struct gfs2_sbd *sdp)
1300{
1301 struct gfs2_inode *ip;
1302
1303 while(1) {
1304 ip = NULL;
1305 spin_lock(&sdp->sd_trunc_lock);
1306 if (!list_empty(&sdp->sd_trunc_list)) {
1307 ip = list_entry(sdp->sd_trunc_list.next,
1308 struct gfs2_inode, i_trunc_list);
1309 list_del_init(&ip->i_trunc_list);
1310 }
1311 spin_unlock(&sdp->sd_trunc_lock);
1312 if (ip == NULL)
1313 return;
1314 gfs2_glock_finish_truncate(ip);
1315 }
1316}
1317
1318/**
1319 * gfs2_quotad - Write cached quota changes into the quota file
1320 * @sdp: Pointer to GFS2 superblock
1321 *
1322 */
1323
1324int gfs2_quotad(void *data)
1325{
1326 struct gfs2_sbd *sdp = data;
1327 struct gfs2_tune *tune = &sdp->sd_tune;
1328 unsigned long statfs_timeo = 0;
1329 unsigned long quotad_timeo = 0;
1330 unsigned long t = 0;
1331 DEFINE_WAIT(wait);
1332 int empty;
1333
1334 while (!kthread_should_stop()) {
1335
1336 /* Update the master statfs file */
1337 quotad_check_timeo(sdp, "statfs", gfs2_statfs_sync, t,
1338 &statfs_timeo, &tune->gt_statfs_quantum);
1339
1340 /* Update quota file */
1341 quotad_check_timeo(sdp, "sync", gfs2_quota_sync, t,
1342 &quotad_timeo, &tune->gt_quota_quantum);
1343
1344 /* FIXME: This should be turned into a shrinker */
1345 gfs2_quota_scan(sdp);
1346
1347 /* Check for & recover partially truncated inodes */
1348 quotad_check_trunc_list(sdp);
1349
1350 if (freezing(current))
1351 refrigerator();
1352 t = min(quotad_timeo, statfs_timeo);
1353
1354 prepare_to_wait(&sdp->sd_quota_wait, &wait, TASK_UNINTERRUPTIBLE);
1355 spin_lock(&sdp->sd_trunc_lock);
1356 empty = list_empty(&sdp->sd_trunc_list);
1357 spin_unlock(&sdp->sd_trunc_lock);
1358 if (empty)
1359 t -= schedule_timeout(t);
1360 else
1361 t = 0;
1362 finish_wait(&sdp->sd_quota_wait, &wait);
1363 }
1364
1365 return 0;
1366}
1367
diff --git a/fs/gfs2/quota.h b/fs/gfs2/quota.h
index 3b7f4b0e5dfe..cec9032be97d 100644
--- a/fs/gfs2/quota.h
+++ b/fs/gfs2/quota.h
@@ -15,22 +15,22 @@ struct gfs2_sbd;
15 15
16#define NO_QUOTA_CHANGE ((u32)-1) 16#define NO_QUOTA_CHANGE ((u32)-1)
17 17
18int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid); 18extern int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid);
19void gfs2_quota_unhold(struct gfs2_inode *ip); 19extern void gfs2_quota_unhold(struct gfs2_inode *ip);
20 20
21int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid); 21extern int gfs2_quota_lock(struct gfs2_inode *ip, u32 uid, u32 gid);
22void gfs2_quota_unlock(struct gfs2_inode *ip); 22extern void gfs2_quota_unlock(struct gfs2_inode *ip);
23 23
24int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid); 24extern int gfs2_quota_check(struct gfs2_inode *ip, u32 uid, u32 gid);
25void gfs2_quota_change(struct gfs2_inode *ip, s64 change, 25extern void gfs2_quota_change(struct gfs2_inode *ip, s64 change,
26 u32 uid, u32 gid); 26 u32 uid, u32 gid);
27 27
28int gfs2_quota_sync(struct gfs2_sbd *sdp); 28extern int gfs2_quota_sync(struct gfs2_sbd *sdp);
29int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id); 29extern int gfs2_quota_refresh(struct gfs2_sbd *sdp, int user, u32 id);
30 30
31int gfs2_quota_init(struct gfs2_sbd *sdp); 31extern int gfs2_quota_init(struct gfs2_sbd *sdp);
32void gfs2_quota_scan(struct gfs2_sbd *sdp); 32extern void gfs2_quota_cleanup(struct gfs2_sbd *sdp);
33void gfs2_quota_cleanup(struct gfs2_sbd *sdp); 33extern int gfs2_quotad(void *data);
34 34
35static inline int gfs2_quota_lock_check(struct gfs2_inode *ip) 35static inline int gfs2_quota_lock_check(struct gfs2_inode *ip)
36{ 36{
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c
index d5e91f4f6a0b..efd09c3d2b26 100644
--- a/fs/gfs2/recovery.c
+++ b/fs/gfs2/recovery.c
@@ -14,6 +14,8 @@
14#include <linux/gfs2_ondisk.h> 14#include <linux/gfs2_ondisk.h>
15#include <linux/crc32.h> 15#include <linux/crc32.h>
16#include <linux/lm_interface.h> 16#include <linux/lm_interface.h>
17#include <linux/kthread.h>
18#include <linux/freezer.h>
17 19
18#include "gfs2.h" 20#include "gfs2.h"
19#include "incore.h" 21#include "incore.h"
@@ -583,13 +585,35 @@ fail:
583 return error; 585 return error;
584} 586}
585 587
588static struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
589{
590 struct gfs2_jdesc *jd;
591 int found = 0;
592
593 spin_lock(&sdp->sd_jindex_spin);
594
595 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
596 if (jd->jd_dirty) {
597 jd->jd_dirty = 0;
598 found = 1;
599 break;
600 }
601 }
602 spin_unlock(&sdp->sd_jindex_spin);
603
604 if (!found)
605 jd = NULL;
606
607 return jd;
608}
609
586/** 610/**
587 * gfs2_check_journals - Recover any dirty journals 611 * gfs2_check_journals - Recover any dirty journals
588 * @sdp: the filesystem 612 * @sdp: the filesystem
589 * 613 *
590 */ 614 */
591 615
592void gfs2_check_journals(struct gfs2_sbd *sdp) 616static void gfs2_check_journals(struct gfs2_sbd *sdp)
593{ 617{
594 struct gfs2_jdesc *jd; 618 struct gfs2_jdesc *jd;
595 619
@@ -603,3 +627,25 @@ void gfs2_check_journals(struct gfs2_sbd *sdp)
603 } 627 }
604} 628}
605 629
630/**
631 * gfs2_recoverd - Recover dead machine's journals
632 * @sdp: Pointer to GFS2 superblock
633 *
634 */
635
636int gfs2_recoverd(void *data)
637{
638 struct gfs2_sbd *sdp = data;
639 unsigned long t;
640
641 while (!kthread_should_stop()) {
642 gfs2_check_journals(sdp);
643 t = gfs2_tune_get(sdp, gt_recoverd_secs) * HZ;
644 if (freezing(current))
645 refrigerator();
646 schedule_timeout_interruptible(t);
647 }
648
649 return 0;
650}
651
diff --git a/fs/gfs2/recovery.h b/fs/gfs2/recovery.h
index f7235e61c723..a8218ea15b57 100644
--- a/fs/gfs2/recovery.h
+++ b/fs/gfs2/recovery.h
@@ -18,17 +18,17 @@ static inline void gfs2_replay_incr_blk(struct gfs2_sbd *sdp, unsigned int *blk)
18 *blk = 0; 18 *blk = 0;
19} 19}
20 20
21int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk, 21extern int gfs2_replay_read_block(struct gfs2_jdesc *jd, unsigned int blk,
22 struct buffer_head **bh); 22 struct buffer_head **bh);
23 23
24int gfs2_revoke_add(struct gfs2_sbd *sdp, u64 blkno, unsigned int where); 24extern int gfs2_revoke_add(struct gfs2_sbd *sdp, u64 blkno, unsigned int where);
25int gfs2_revoke_check(struct gfs2_sbd *sdp, u64 blkno, unsigned int where); 25extern int gfs2_revoke_check(struct gfs2_sbd *sdp, u64 blkno, unsigned int where);
26void gfs2_revoke_clean(struct gfs2_sbd *sdp); 26extern void gfs2_revoke_clean(struct gfs2_sbd *sdp);
27 27
28int gfs2_find_jhead(struct gfs2_jdesc *jd, 28extern int gfs2_find_jhead(struct gfs2_jdesc *jd,
29 struct gfs2_log_header_host *head); 29 struct gfs2_log_header_host *head);
30int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd); 30extern int gfs2_recover_journal(struct gfs2_jdesc *gfs2_jd);
31void gfs2_check_journals(struct gfs2_sbd *sdp); 31extern int gfs2_recoverd(void *data);
32 32
33#endif /* __RECOVERY_DOT_H__ */ 33#endif /* __RECOVERY_DOT_H__ */
34 34
diff --git a/fs/gfs2/rgrp.c b/fs/gfs2/rgrp.c
index 2d90fb253505..8b01c635d925 100644
--- a/fs/gfs2/rgrp.c
+++ b/fs/gfs2/rgrp.c
@@ -269,16 +269,14 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
269 bi->bi_len, x); 269 bi->bi_len, x);
270 } 270 }
271 271
272 if (count[0] != rgd->rd_rg.rg_free) { 272 if (count[0] != rgd->rd_free) {
273 if (gfs2_consist_rgrpd(rgd)) 273 if (gfs2_consist_rgrpd(rgd))
274 fs_err(sdp, "free data mismatch: %u != %u\n", 274 fs_err(sdp, "free data mismatch: %u != %u\n",
275 count[0], rgd->rd_rg.rg_free); 275 count[0], rgd->rd_free);
276 return; 276 return;
277 } 277 }
278 278
279 tmp = rgd->rd_data - 279 tmp = rgd->rd_data - rgd->rd_free - rgd->rd_dinodes;
280 rgd->rd_rg.rg_free -
281 rgd->rd_rg.rg_dinodes;
282 if (count[1] + count[2] != tmp) { 280 if (count[1] + count[2] != tmp) {
283 if (gfs2_consist_rgrpd(rgd)) 281 if (gfs2_consist_rgrpd(rgd))
284 fs_err(sdp, "used data mismatch: %u != %u\n", 282 fs_err(sdp, "used data mismatch: %u != %u\n",
@@ -286,10 +284,10 @@ void gfs2_rgrp_verify(struct gfs2_rgrpd *rgd)
286 return; 284 return;
287 } 285 }
288 286
289 if (count[3] != rgd->rd_rg.rg_dinodes) { 287 if (count[3] != rgd->rd_dinodes) {
290 if (gfs2_consist_rgrpd(rgd)) 288 if (gfs2_consist_rgrpd(rgd))
291 fs_err(sdp, "used metadata mismatch: %u != %u\n", 289 fs_err(sdp, "used metadata mismatch: %u != %u\n",
292 count[3], rgd->rd_rg.rg_dinodes); 290 count[3], rgd->rd_dinodes);
293 return; 291 return;
294 } 292 }
295 293
@@ -501,7 +499,7 @@ u64 gfs2_ri_total(struct gfs2_sbd *sdp)
501 for (rgrps = 0;; rgrps++) { 499 for (rgrps = 0;; rgrps++) {
502 loff_t pos = rgrps * sizeof(struct gfs2_rindex); 500 loff_t pos = rgrps * sizeof(struct gfs2_rindex);
503 501
504 if (pos + sizeof(struct gfs2_rindex) >= ip->i_di.di_size) 502 if (pos + sizeof(struct gfs2_rindex) >= ip->i_disksize)
505 break; 503 break;
506 error = gfs2_internal_read(ip, &ra_state, buf, &pos, 504 error = gfs2_internal_read(ip, &ra_state, buf, &pos,
507 sizeof(struct gfs2_rindex)); 505 sizeof(struct gfs2_rindex));
@@ -590,7 +588,7 @@ static int gfs2_ri_update(struct gfs2_inode *ip)
590 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode); 588 struct gfs2_sbd *sdp = GFS2_SB(&ip->i_inode);
591 struct inode *inode = &ip->i_inode; 589 struct inode *inode = &ip->i_inode;
592 struct file_ra_state ra_state; 590 struct file_ra_state ra_state;
593 u64 rgrp_count = ip->i_di.di_size; 591 u64 rgrp_count = ip->i_disksize;
594 int error; 592 int error;
595 593
596 if (do_div(rgrp_count, sizeof(struct gfs2_rindex))) { 594 if (do_div(rgrp_count, sizeof(struct gfs2_rindex))) {
@@ -634,7 +632,7 @@ static int gfs2_ri_update_special(struct gfs2_inode *ip)
634 for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) { 632 for (sdp->sd_rgrps = 0;; sdp->sd_rgrps++) {
635 /* Ignore partials */ 633 /* Ignore partials */
636 if ((sdp->sd_rgrps + 1) * sizeof(struct gfs2_rindex) > 634 if ((sdp->sd_rgrps + 1) * sizeof(struct gfs2_rindex) >
637 ip->i_di.di_size) 635 ip->i_disksize)
638 break; 636 break;
639 error = read_rindex_entry(ip, &ra_state); 637 error = read_rindex_entry(ip, &ra_state);
640 if (error) { 638 if (error) {
@@ -692,7 +690,6 @@ int gfs2_rindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ri_gh)
692static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf) 690static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf)
693{ 691{
694 const struct gfs2_rgrp *str = buf; 692 const struct gfs2_rgrp *str = buf;
695 struct gfs2_rgrp_host *rg = &rgd->rd_rg;
696 u32 rg_flags; 693 u32 rg_flags;
697 694
698 rg_flags = be32_to_cpu(str->rg_flags); 695 rg_flags = be32_to_cpu(str->rg_flags);
@@ -700,24 +697,23 @@ static void gfs2_rgrp_in(struct gfs2_rgrpd *rgd, const void *buf)
700 rgd->rd_flags |= GFS2_RDF_NOALLOC; 697 rgd->rd_flags |= GFS2_RDF_NOALLOC;
701 else 698 else
702 rgd->rd_flags &= ~GFS2_RDF_NOALLOC; 699 rgd->rd_flags &= ~GFS2_RDF_NOALLOC;
703 rg->rg_free = be32_to_cpu(str->rg_free); 700 rgd->rd_free = be32_to_cpu(str->rg_free);
704 rg->rg_dinodes = be32_to_cpu(str->rg_dinodes); 701 rgd->rd_dinodes = be32_to_cpu(str->rg_dinodes);
705 rg->rg_igeneration = be64_to_cpu(str->rg_igeneration); 702 rgd->rd_igeneration = be64_to_cpu(str->rg_igeneration);
706} 703}
707 704
708static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf) 705static void gfs2_rgrp_out(struct gfs2_rgrpd *rgd, void *buf)
709{ 706{
710 struct gfs2_rgrp *str = buf; 707 struct gfs2_rgrp *str = buf;
711 struct gfs2_rgrp_host *rg = &rgd->rd_rg;
712 u32 rg_flags = 0; 708 u32 rg_flags = 0;
713 709
714 if (rgd->rd_flags & GFS2_RDF_NOALLOC) 710 if (rgd->rd_flags & GFS2_RDF_NOALLOC)
715 rg_flags |= GFS2_RGF_NOALLOC; 711 rg_flags |= GFS2_RGF_NOALLOC;
716 str->rg_flags = cpu_to_be32(rg_flags); 712 str->rg_flags = cpu_to_be32(rg_flags);
717 str->rg_free = cpu_to_be32(rg->rg_free); 713 str->rg_free = cpu_to_be32(rgd->rd_free);
718 str->rg_dinodes = cpu_to_be32(rg->rg_dinodes); 714 str->rg_dinodes = cpu_to_be32(rgd->rd_dinodes);
719 str->__pad = cpu_to_be32(0); 715 str->__pad = cpu_to_be32(0);
720 str->rg_igeneration = cpu_to_be64(rg->rg_igeneration); 716 str->rg_igeneration = cpu_to_be64(rgd->rd_igeneration);
721 memset(&str->rg_reserved, 0, sizeof(str->rg_reserved)); 717 memset(&str->rg_reserved, 0, sizeof(str->rg_reserved));
722} 718}
723 719
@@ -776,7 +772,7 @@ int gfs2_rgrp_bh_get(struct gfs2_rgrpd *rgd)
776 } 772 }
777 773
778 spin_lock(&sdp->sd_rindex_spin); 774 spin_lock(&sdp->sd_rindex_spin);
779 rgd->rd_free_clone = rgd->rd_rg.rg_free; 775 rgd->rd_free_clone = rgd->rd_free;
780 rgd->rd_bh_count++; 776 rgd->rd_bh_count++;
781 spin_unlock(&sdp->sd_rindex_spin); 777 spin_unlock(&sdp->sd_rindex_spin);
782 778
@@ -850,7 +846,7 @@ void gfs2_rgrp_repolish_clones(struct gfs2_rgrpd *rgd)
850 } 846 }
851 847
852 spin_lock(&sdp->sd_rindex_spin); 848 spin_lock(&sdp->sd_rindex_spin);
853 rgd->rd_free_clone = rgd->rd_rg.rg_free; 849 rgd->rd_free_clone = rgd->rd_free;
854 spin_unlock(&sdp->sd_rindex_spin); 850 spin_unlock(&sdp->sd_rindex_spin);
855} 851}
856 852
@@ -1403,8 +1399,8 @@ u64 gfs2_alloc_block(struct gfs2_inode *ip, unsigned int *n)
1403 block = rgd->rd_data0 + blk; 1399 block = rgd->rd_data0 + blk;
1404 ip->i_goal = block; 1400 ip->i_goal = block;
1405 1401
1406 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free >= *n); 1402 gfs2_assert_withdraw(sdp, rgd->rd_free >= *n);
1407 rgd->rd_rg.rg_free -= *n; 1403 rgd->rd_free -= *n;
1408 1404
1409 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); 1405 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1410 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); 1406 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
@@ -1445,10 +1441,10 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation)
1445 1441
1446 block = rgd->rd_data0 + blk; 1442 block = rgd->rd_data0 + blk;
1447 1443
1448 gfs2_assert_withdraw(sdp, rgd->rd_rg.rg_free); 1444 gfs2_assert_withdraw(sdp, rgd->rd_free);
1449 rgd->rd_rg.rg_free--; 1445 rgd->rd_free--;
1450 rgd->rd_rg.rg_dinodes++; 1446 rgd->rd_dinodes++;
1451 *generation = rgd->rd_rg.rg_igeneration++; 1447 *generation = rgd->rd_igeneration++;
1452 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); 1448 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1453 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); 1449 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
1454 1450
@@ -1481,7 +1477,7 @@ void gfs2_free_data(struct gfs2_inode *ip, u64 bstart, u32 blen)
1481 if (!rgd) 1477 if (!rgd)
1482 return; 1478 return;
1483 1479
1484 rgd->rd_rg.rg_free += blen; 1480 rgd->rd_free += blen;
1485 1481
1486 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); 1482 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1487 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); 1483 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
@@ -1509,7 +1505,7 @@ void gfs2_free_meta(struct gfs2_inode *ip, u64 bstart, u32 blen)
1509 if (!rgd) 1505 if (!rgd)
1510 return; 1506 return;
1511 1507
1512 rgd->rd_rg.rg_free += blen; 1508 rgd->rd_free += blen;
1513 1509
1514 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); 1510 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1515 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); 1511 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
@@ -1546,10 +1542,10 @@ static void gfs2_free_uninit_di(struct gfs2_rgrpd *rgd, u64 blkno)
1546 return; 1542 return;
1547 gfs2_assert_withdraw(sdp, rgd == tmp_rgd); 1543 gfs2_assert_withdraw(sdp, rgd == tmp_rgd);
1548 1544
1549 if (!rgd->rd_rg.rg_dinodes) 1545 if (!rgd->rd_dinodes)
1550 gfs2_consist_rgrpd(rgd); 1546 gfs2_consist_rgrpd(rgd);
1551 rgd->rd_rg.rg_dinodes--; 1547 rgd->rd_dinodes--;
1552 rgd->rd_rg.rg_free++; 1548 rgd->rd_free++;
1553 1549
1554 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1); 1550 gfs2_trans_add_bh(rgd->rd_gl, rgd->rd_bits[0].bi_bh, 1);
1555 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data); 1551 gfs2_rgrp_out(rgd, rgd->rd_bits[0].bi_bh->b_data);
diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c
index c3ba3d9d0aac..141b781f2fcc 100644
--- a/fs/gfs2/super.c
+++ b/fs/gfs2/super.c
@@ -34,76 +34,6 @@
34#include "util.h" 34#include "util.h"
35 35
36/** 36/**
37 * gfs2_jindex_hold - Grab a lock on the jindex
38 * @sdp: The GFS2 superblock
39 * @ji_gh: the holder for the jindex glock
40 *
41 * This is very similar to the gfs2_rindex_hold() function, except that
42 * in general we hold the jindex lock for longer periods of time and
43 * we grab it far less frequently (in general) then the rgrp lock.
44 *
45 * Returns: errno
46 */
47
48int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh)
49{
50 struct gfs2_inode *dip = GFS2_I(sdp->sd_jindex);
51 struct qstr name;
52 char buf[20];
53 struct gfs2_jdesc *jd;
54 int error;
55
56 name.name = buf;
57
58 mutex_lock(&sdp->sd_jindex_mutex);
59
60 for (;;) {
61 error = gfs2_glock_nq_init(dip->i_gl, LM_ST_SHARED, 0, ji_gh);
62 if (error)
63 break;
64
65 name.len = sprintf(buf, "journal%u", sdp->sd_journals);
66 name.hash = gfs2_disk_hash(name.name, name.len);
67
68 error = gfs2_dir_check(sdp->sd_jindex, &name, NULL);
69 if (error == -ENOENT) {
70 error = 0;
71 break;
72 }
73
74 gfs2_glock_dq_uninit(ji_gh);
75
76 if (error)
77 break;
78
79 error = -ENOMEM;
80 jd = kzalloc(sizeof(struct gfs2_jdesc), GFP_KERNEL);
81 if (!jd)
82 break;
83
84 INIT_LIST_HEAD(&jd->extent_list);
85 jd->jd_inode = gfs2_lookupi(sdp->sd_jindex, &name, 1);
86 if (!jd->jd_inode || IS_ERR(jd->jd_inode)) {
87 if (!jd->jd_inode)
88 error = -ENOENT;
89 else
90 error = PTR_ERR(jd->jd_inode);
91 kfree(jd);
92 break;
93 }
94
95 spin_lock(&sdp->sd_jindex_spin);
96 jd->jd_jid = sdp->sd_journals++;
97 list_add_tail(&jd->jd_list, &sdp->sd_jindex_list);
98 spin_unlock(&sdp->sd_jindex_spin);
99 }
100
101 mutex_unlock(&sdp->sd_jindex_mutex);
102
103 return error;
104}
105
106/**
107 * gfs2_jindex_free - Clear all the journal index information 37 * gfs2_jindex_free - Clear all the journal index information
108 * @sdp: The GFS2 superblock 38 * @sdp: The GFS2 superblock
109 * 39 *
@@ -166,39 +96,6 @@ struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid)
166 return jd; 96 return jd;
167} 97}
168 98
169void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid)
170{
171 struct gfs2_jdesc *jd;
172
173 spin_lock(&sdp->sd_jindex_spin);
174 jd = jdesc_find_i(&sdp->sd_jindex_list, jid);
175 if (jd)
176 jd->jd_dirty = 1;
177 spin_unlock(&sdp->sd_jindex_spin);
178}
179
180struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp)
181{
182 struct gfs2_jdesc *jd;
183 int found = 0;
184
185 spin_lock(&sdp->sd_jindex_spin);
186
187 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
188 if (jd->jd_dirty) {
189 jd->jd_dirty = 0;
190 found = 1;
191 break;
192 }
193 }
194 spin_unlock(&sdp->sd_jindex_spin);
195
196 if (!found)
197 jd = NULL;
198
199 return jd;
200}
201
202int gfs2_jdesc_check(struct gfs2_jdesc *jd) 99int gfs2_jdesc_check(struct gfs2_jdesc *jd)
203{ 100{
204 struct gfs2_inode *ip = GFS2_I(jd->jd_inode); 101 struct gfs2_inode *ip = GFS2_I(jd->jd_inode);
@@ -206,14 +103,14 @@ int gfs2_jdesc_check(struct gfs2_jdesc *jd)
206 int ar; 103 int ar;
207 int error; 104 int error;
208 105
209 if (ip->i_di.di_size < (8 << 20) || ip->i_di.di_size > (1 << 30) || 106 if (ip->i_disksize < (8 << 20) || ip->i_disksize > (1 << 30) ||
210 (ip->i_di.di_size & (sdp->sd_sb.sb_bsize - 1))) { 107 (ip->i_disksize & (sdp->sd_sb.sb_bsize - 1))) {
211 gfs2_consist_inode(ip); 108 gfs2_consist_inode(ip);
212 return -EIO; 109 return -EIO;
213 } 110 }
214 jd->jd_blocks = ip->i_di.di_size >> sdp->sd_sb.sb_bsize_shift; 111 jd->jd_blocks = ip->i_disksize >> sdp->sd_sb.sb_bsize_shift;
215 112
216 error = gfs2_write_alloc_required(ip, 0, ip->i_di.di_size, &ar); 113 error = gfs2_write_alloc_required(ip, 0, ip->i_disksize, &ar);
217 if (!error && ar) { 114 if (!error && ar) {
218 gfs2_consist_inode(ip); 115 gfs2_consist_inode(ip);
219 error = -EIO; 116 error = -EIO;
@@ -423,137 +320,6 @@ out:
423 return error; 320 return error;
424} 321}
425 322
426/**
427 * gfs2_statfs_i - Do a statfs
428 * @sdp: the filesystem
429 * @sg: the sg structure
430 *
431 * Returns: errno
432 */
433
434int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
435{
436 struct gfs2_statfs_change_host *m_sc = &sdp->sd_statfs_master;
437 struct gfs2_statfs_change_host *l_sc = &sdp->sd_statfs_local;
438
439 spin_lock(&sdp->sd_statfs_spin);
440
441 *sc = *m_sc;
442 sc->sc_total += l_sc->sc_total;
443 sc->sc_free += l_sc->sc_free;
444 sc->sc_dinodes += l_sc->sc_dinodes;
445
446 spin_unlock(&sdp->sd_statfs_spin);
447
448 if (sc->sc_free < 0)
449 sc->sc_free = 0;
450 if (sc->sc_free > sc->sc_total)
451 sc->sc_free = sc->sc_total;
452 if (sc->sc_dinodes < 0)
453 sc->sc_dinodes = 0;
454
455 return 0;
456}
457
458/**
459 * statfs_fill - fill in the sg for a given RG
460 * @rgd: the RG
461 * @sc: the sc structure
462 *
463 * Returns: 0 on success, -ESTALE if the LVB is invalid
464 */
465
466static int statfs_slow_fill(struct gfs2_rgrpd *rgd,
467 struct gfs2_statfs_change_host *sc)
468{
469 gfs2_rgrp_verify(rgd);
470 sc->sc_total += rgd->rd_data;
471 sc->sc_free += rgd->rd_rg.rg_free;
472 sc->sc_dinodes += rgd->rd_rg.rg_dinodes;
473 return 0;
474}
475
476/**
477 * gfs2_statfs_slow - Stat a filesystem using asynchronous locking
478 * @sdp: the filesystem
479 * @sc: the sc info that will be returned
480 *
481 * Any error (other than a signal) will cause this routine to fall back
482 * to the synchronous version.
483 *
484 * FIXME: This really shouldn't busy wait like this.
485 *
486 * Returns: errno
487 */
488
489int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc)
490{
491 struct gfs2_holder ri_gh;
492 struct gfs2_rgrpd *rgd_next;
493 struct gfs2_holder *gha, *gh;
494 unsigned int slots = 64;
495 unsigned int x;
496 int done;
497 int error = 0, err;
498
499 memset(sc, 0, sizeof(struct gfs2_statfs_change_host));
500 gha = kcalloc(slots, sizeof(struct gfs2_holder), GFP_KERNEL);
501 if (!gha)
502 return -ENOMEM;
503
504 error = gfs2_rindex_hold(sdp, &ri_gh);
505 if (error)
506 goto out;
507
508 rgd_next = gfs2_rgrpd_get_first(sdp);
509
510 for (;;) {
511 done = 1;
512
513 for (x = 0; x < slots; x++) {
514 gh = gha + x;
515
516 if (gh->gh_gl && gfs2_glock_poll(gh)) {
517 err = gfs2_glock_wait(gh);
518 if (err) {
519 gfs2_holder_uninit(gh);
520 error = err;
521 } else {
522 if (!error)
523 error = statfs_slow_fill(
524 gh->gh_gl->gl_object, sc);
525 gfs2_glock_dq_uninit(gh);
526 }
527 }
528
529 if (gh->gh_gl)
530 done = 0;
531 else if (rgd_next && !error) {
532 error = gfs2_glock_nq_init(rgd_next->rd_gl,
533 LM_ST_SHARED,
534 GL_ASYNC,
535 gh);
536 rgd_next = gfs2_rgrpd_get_next(rgd_next);
537 done = 0;
538 }
539
540 if (signal_pending(current))
541 error = -ERESTARTSYS;
542 }
543
544 if (done)
545 break;
546
547 yield();
548 }
549
550 gfs2_glock_dq_uninit(&ri_gh);
551
552out:
553 kfree(gha);
554 return error;
555}
556
557struct lfcc { 323struct lfcc {
558 struct list_head list; 324 struct list_head list;
559 struct gfs2_holder gh; 325 struct gfs2_holder gh;
@@ -580,10 +346,6 @@ static int gfs2_lock_fs_check_clean(struct gfs2_sbd *sdp,
580 struct gfs2_log_header_host lh; 346 struct gfs2_log_header_host lh;
581 int error; 347 int error;
582 348
583 error = gfs2_jindex_hold(sdp, &ji_gh);
584 if (error)
585 return error;
586
587 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) { 349 list_for_each_entry(jd, &sdp->sd_jindex_list, jd_list) {
588 lfcc = kmalloc(sizeof(struct lfcc), GFP_KERNEL); 350 lfcc = kmalloc(sizeof(struct lfcc), GFP_KERNEL);
589 if (!lfcc) { 351 if (!lfcc) {
diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h
index 50a4c9b1215e..f6b8b00ad881 100644
--- a/fs/gfs2/super.h
+++ b/fs/gfs2/super.h
@@ -10,6 +10,8 @@
10#ifndef __SUPER_DOT_H__ 10#ifndef __SUPER_DOT_H__
11#define __SUPER_DOT_H__ 11#define __SUPER_DOT_H__
12 12
13#include <linux/fs.h>
14#include <linux/dcache.h>
13#include "incore.h" 15#include "incore.h"
14 16
15void gfs2_lm_unmount(struct gfs2_sbd *sdp); 17void gfs2_lm_unmount(struct gfs2_sbd *sdp);
@@ -23,12 +25,9 @@ static inline unsigned int gfs2_jindex_size(struct gfs2_sbd *sdp)
23 return x; 25 return x;
24} 26}
25 27
26int gfs2_jindex_hold(struct gfs2_sbd *sdp, struct gfs2_holder *ji_gh);
27void gfs2_jindex_free(struct gfs2_sbd *sdp); 28void gfs2_jindex_free(struct gfs2_sbd *sdp);
28 29
29struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid); 30struct gfs2_jdesc *gfs2_jdesc_find(struct gfs2_sbd *sdp, unsigned int jid);
30void gfs2_jdesc_make_dirty(struct gfs2_sbd *sdp, unsigned int jid);
31struct gfs2_jdesc *gfs2_jdesc_find_dirty(struct gfs2_sbd *sdp);
32int gfs2_jdesc_check(struct gfs2_jdesc *jd); 31int gfs2_jdesc_check(struct gfs2_jdesc *jd);
33 32
34int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename, 33int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp, char *filename,
@@ -40,11 +39,15 @@ int gfs2_statfs_init(struct gfs2_sbd *sdp);
40void gfs2_statfs_change(struct gfs2_sbd *sdp, 39void gfs2_statfs_change(struct gfs2_sbd *sdp,
41 s64 total, s64 free, s64 dinodes); 40 s64 total, s64 free, s64 dinodes);
42int gfs2_statfs_sync(struct gfs2_sbd *sdp); 41int gfs2_statfs_sync(struct gfs2_sbd *sdp);
43int gfs2_statfs_i(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc);
44int gfs2_statfs_slow(struct gfs2_sbd *sdp, struct gfs2_statfs_change_host *sc);
45 42
46int gfs2_freeze_fs(struct gfs2_sbd *sdp); 43int gfs2_freeze_fs(struct gfs2_sbd *sdp);
47void gfs2_unfreeze_fs(struct gfs2_sbd *sdp); 44void gfs2_unfreeze_fs(struct gfs2_sbd *sdp);
48 45
46extern struct file_system_type gfs2_fs_type;
47extern struct file_system_type gfs2meta_fs_type;
48extern const struct export_operations gfs2_export_ops;
49extern const struct super_operations gfs2_super_ops;
50extern struct dentry_operations gfs2_dops;
51
49#endif /* __SUPER_DOT_H__ */ 52#endif /* __SUPER_DOT_H__ */
50 53
diff --git a/fs/gfs2/sys.c b/fs/gfs2/sys.c
index 7e1879f1a02c..26c1fa777a95 100644
--- a/fs/gfs2/sys.c
+++ b/fs/gfs2/sys.c
@@ -26,9 +26,6 @@
26#include "quota.h" 26#include "quota.h"
27#include "util.h" 27#include "util.h"
28 28
29char *gfs2_sys_margs;
30spinlock_t gfs2_sys_margs_lock;
31
32static ssize_t id_show(struct gfs2_sbd *sdp, char *buf) 29static ssize_t id_show(struct gfs2_sbd *sdp, char *buf)
33{ 30{
34 return snprintf(buf, PAGE_SIZE, "%u:%u\n", 31 return snprintf(buf, PAGE_SIZE, "%u:%u\n",
@@ -263,7 +260,6 @@ ARGS_ATTR(localcaching, "%d\n");
263ARGS_ATTR(localflocks, "%d\n"); 260ARGS_ATTR(localflocks, "%d\n");
264ARGS_ATTR(debug, "%d\n"); 261ARGS_ATTR(debug, "%d\n");
265ARGS_ATTR(upgrade, "%d\n"); 262ARGS_ATTR(upgrade, "%d\n");
266ARGS_ATTR(num_glockd, "%u\n");
267ARGS_ATTR(posix_acl, "%d\n"); 263ARGS_ATTR(posix_acl, "%d\n");
268ARGS_ATTR(quota, "%u\n"); 264ARGS_ATTR(quota, "%u\n");
269ARGS_ATTR(suiddir, "%d\n"); 265ARGS_ATTR(suiddir, "%d\n");
@@ -279,7 +275,6 @@ static struct attribute *args_attrs[] = {
279 &args_attr_localflocks.attr, 275 &args_attr_localflocks.attr,
280 &args_attr_debug.attr, 276 &args_attr_debug.attr,
281 &args_attr_upgrade.attr, 277 &args_attr_upgrade.attr,
282 &args_attr_num_glockd.attr,
283 &args_attr_posix_acl.attr, 278 &args_attr_posix_acl.attr,
284 &args_attr_quota.attr, 279 &args_attr_quota.attr,
285 &args_attr_suiddir.attr, 280 &args_attr_suiddir.attr,
@@ -288,30 +283,6 @@ static struct attribute *args_attrs[] = {
288}; 283};
289 284
290/* 285/*
291 * display counters from superblock
292 */
293
294struct counters_attr {
295 struct attribute attr;
296 ssize_t (*show)(struct gfs2_sbd *, char *);
297};
298
299#define COUNTERS_ATTR(name, fmt) \
300static ssize_t name##_show(struct gfs2_sbd *sdp, char *buf) \
301{ \
302 return snprintf(buf, PAGE_SIZE, fmt, \
303 (unsigned int)atomic_read(&sdp->sd_##name)); \
304} \
305static struct counters_attr counters_attr_##name = __ATTR_RO(name)
306
307COUNTERS_ATTR(reclaimed, "%u\n");
308
309static struct attribute *counters_attrs[] = {
310 &counters_attr_reclaimed.attr,
311 NULL,
312};
313
314/*
315 * get and set struct gfs2_tune fields 286 * get and set struct gfs2_tune fields
316 */ 287 */
317 288
@@ -393,7 +364,6 @@ static ssize_t name##_store(struct gfs2_sbd *sdp, const char *buf, size_t len)\
393} \ 364} \
394TUNE_ATTR_2(name, name##_store) 365TUNE_ATTR_2(name, name##_store)
395 366
396TUNE_ATTR(demote_secs, 0);
397TUNE_ATTR(incore_log_blocks, 0); 367TUNE_ATTR(incore_log_blocks, 0);
398TUNE_ATTR(log_flush_secs, 0); 368TUNE_ATTR(log_flush_secs, 0);
399TUNE_ATTR(quota_warn_period, 0); 369TUNE_ATTR(quota_warn_period, 0);
@@ -408,11 +378,9 @@ TUNE_ATTR(stall_secs, 1);
408TUNE_ATTR(statfs_quantum, 1); 378TUNE_ATTR(statfs_quantum, 1);
409TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process); 379TUNE_ATTR_DAEMON(recoverd_secs, recoverd_process);
410TUNE_ATTR_DAEMON(logd_secs, logd_process); 380TUNE_ATTR_DAEMON(logd_secs, logd_process);
411TUNE_ATTR_DAEMON(quotad_secs, quotad_process);
412TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store); 381TUNE_ATTR_3(quota_scale, quota_scale_show, quota_scale_store);
413 382
414static struct attribute *tune_attrs[] = { 383static struct attribute *tune_attrs[] = {
415 &tune_attr_demote_secs.attr,
416 &tune_attr_incore_log_blocks.attr, 384 &tune_attr_incore_log_blocks.attr,
417 &tune_attr_log_flush_secs.attr, 385 &tune_attr_log_flush_secs.attr,
418 &tune_attr_quota_warn_period.attr, 386 &tune_attr_quota_warn_period.attr,
@@ -426,7 +394,6 @@ static struct attribute *tune_attrs[] = {
426 &tune_attr_statfs_quantum.attr, 394 &tune_attr_statfs_quantum.attr,
427 &tune_attr_recoverd_secs.attr, 395 &tune_attr_recoverd_secs.attr,
428 &tune_attr_logd_secs.attr, 396 &tune_attr_logd_secs.attr,
429 &tune_attr_quotad_secs.attr,
430 &tune_attr_quota_scale.attr, 397 &tune_attr_quota_scale.attr,
431 &tune_attr_new_files_jdata.attr, 398 &tune_attr_new_files_jdata.attr,
432 NULL, 399 NULL,
@@ -437,11 +404,6 @@ static struct attribute_group lockstruct_group = {
437 .attrs = lockstruct_attrs, 404 .attrs = lockstruct_attrs,
438}; 405};
439 406
440static struct attribute_group counters_group = {
441 .name = "counters",
442 .attrs = counters_attrs,
443};
444
445static struct attribute_group args_group = { 407static struct attribute_group args_group = {
446 .name = "args", 408 .name = "args",
447 .attrs = args_attrs, 409 .attrs = args_attrs,
@@ -466,13 +428,9 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
466 if (error) 428 if (error)
467 goto fail_reg; 429 goto fail_reg;
468 430
469 error = sysfs_create_group(&sdp->sd_kobj, &counters_group);
470 if (error)
471 goto fail_lockstruct;
472
473 error = sysfs_create_group(&sdp->sd_kobj, &args_group); 431 error = sysfs_create_group(&sdp->sd_kobj, &args_group);
474 if (error) 432 if (error)
475 goto fail_counters; 433 goto fail_lockstruct;
476 434
477 error = sysfs_create_group(&sdp->sd_kobj, &tune_group); 435 error = sysfs_create_group(&sdp->sd_kobj, &tune_group);
478 if (error) 436 if (error)
@@ -483,8 +441,6 @@ int gfs2_sys_fs_add(struct gfs2_sbd *sdp)
483 441
484fail_args: 442fail_args:
485 sysfs_remove_group(&sdp->sd_kobj, &args_group); 443 sysfs_remove_group(&sdp->sd_kobj, &args_group);
486fail_counters:
487 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
488fail_lockstruct: 444fail_lockstruct:
489 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 445 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
490fail_reg: 446fail_reg:
@@ -498,16 +454,27 @@ void gfs2_sys_fs_del(struct gfs2_sbd *sdp)
498{ 454{
499 sysfs_remove_group(&sdp->sd_kobj, &tune_group); 455 sysfs_remove_group(&sdp->sd_kobj, &tune_group);
500 sysfs_remove_group(&sdp->sd_kobj, &args_group); 456 sysfs_remove_group(&sdp->sd_kobj, &args_group);
501 sysfs_remove_group(&sdp->sd_kobj, &counters_group);
502 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group); 457 sysfs_remove_group(&sdp->sd_kobj, &lockstruct_group);
503 kobject_put(&sdp->sd_kobj); 458 kobject_put(&sdp->sd_kobj);
504} 459}
505 460
461static int gfs2_uevent(struct kset *kset, struct kobject *kobj,
462 struct kobj_uevent_env *env)
463{
464 struct gfs2_sbd *sdp = container_of(kobj, struct gfs2_sbd, sd_kobj);
465 add_uevent_var(env, "LOCKTABLE=%s", sdp->sd_table_name);
466 add_uevent_var(env, "LOCKPROTO=%s", sdp->sd_proto_name);
467 return 0;
468}
469
470static struct kset_uevent_ops gfs2_uevent_ops = {
471 .uevent = gfs2_uevent,
472};
473
474
506int gfs2_sys_init(void) 475int gfs2_sys_init(void)
507{ 476{
508 gfs2_sys_margs = NULL; 477 gfs2_kset = kset_create_and_add("gfs2", &gfs2_uevent_ops, fs_kobj);
509 spin_lock_init(&gfs2_sys_margs_lock);
510 gfs2_kset = kset_create_and_add("gfs2", NULL, fs_kobj);
511 if (!gfs2_kset) 478 if (!gfs2_kset)
512 return -ENOMEM; 479 return -ENOMEM;
513 return 0; 480 return 0;
@@ -515,7 +482,6 @@ int gfs2_sys_init(void)
515 482
516void gfs2_sys_uninit(void) 483void gfs2_sys_uninit(void)
517{ 484{
518 kfree(gfs2_sys_margs);
519 kset_unregister(gfs2_kset); 485 kset_unregister(gfs2_kset);
520} 486}
521 487
diff --git a/fs/gfs2/sys.h b/fs/gfs2/sys.h
index 1ca8cdac5304..e94560e836d7 100644
--- a/fs/gfs2/sys.h
+++ b/fs/gfs2/sys.h
@@ -13,10 +13,6 @@
13#include <linux/spinlock.h> 13#include <linux/spinlock.h>
14struct gfs2_sbd; 14struct gfs2_sbd;
15 15
16/* Allow args to be passed to GFS2 when using an initial ram disk */
17extern char *gfs2_sys_margs;
18extern spinlock_t gfs2_sys_margs_lock;
19
20int gfs2_sys_fs_add(struct gfs2_sbd *sdp); 16int gfs2_sys_fs_add(struct gfs2_sbd *sdp);
21void gfs2_sys_fs_del(struct gfs2_sbd *sdp); 17void gfs2_sys_fs_del(struct gfs2_sbd *sdp);
22 18
diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c
index d31e355c61fb..374f50e95496 100644
--- a/fs/gfs2/util.c
+++ b/fs/gfs2/util.c
@@ -25,6 +25,7 @@ struct kmem_cache *gfs2_glock_cachep __read_mostly;
25struct kmem_cache *gfs2_inode_cachep __read_mostly; 25struct kmem_cache *gfs2_inode_cachep __read_mostly;
26struct kmem_cache *gfs2_bufdata_cachep __read_mostly; 26struct kmem_cache *gfs2_bufdata_cachep __read_mostly;
27struct kmem_cache *gfs2_rgrpd_cachep __read_mostly; 27struct kmem_cache *gfs2_rgrpd_cachep __read_mostly;
28struct kmem_cache *gfs2_quotad_cachep __read_mostly;
28 29
29void gfs2_assert_i(struct gfs2_sbd *sdp) 30void gfs2_assert_i(struct gfs2_sbd *sdp)
30{ 31{
diff --git a/fs/gfs2/util.h b/fs/gfs2/util.h
index 7f48576289c9..33e96b0ce9ab 100644
--- a/fs/gfs2/util.h
+++ b/fs/gfs2/util.h
@@ -148,6 +148,7 @@ extern struct kmem_cache *gfs2_glock_cachep;
148extern struct kmem_cache *gfs2_inode_cachep; 148extern struct kmem_cache *gfs2_inode_cachep;
149extern struct kmem_cache *gfs2_bufdata_cachep; 149extern struct kmem_cache *gfs2_bufdata_cachep;
150extern struct kmem_cache *gfs2_rgrpd_cachep; 150extern struct kmem_cache *gfs2_rgrpd_cachep;
151extern struct kmem_cache *gfs2_quotad_cachep;
151 152
152static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt, 153static inline unsigned int gfs2_tune_get_i(struct gfs2_tune *gt,
153 unsigned int *p) 154 unsigned int *p)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 7d479ce3aceb..0ab0c6f5f438 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -506,7 +506,6 @@ static struct inode *hugetlbfs_get_inode(struct super_block *sb, uid_t uid,
506 inode->i_mode = mode; 506 inode->i_mode = mode;
507 inode->i_uid = uid; 507 inode->i_uid = uid;
508 inode->i_gid = gid; 508 inode->i_gid = gid;
509 inode->i_blocks = 0;
510 inode->i_mapping->a_ops = &hugetlbfs_aops; 509 inode->i_mapping->a_ops = &hugetlbfs_aops;
511 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info; 510 inode->i_mapping->backing_dev_info =&hugetlbfs_backing_dev_info;
512 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 511 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
diff --git a/fs/inode.c b/fs/inode.c
index 7de1cda92489..bd48e5e6d3e8 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -131,6 +131,8 @@ struct inode *inode_init_always(struct super_block *sb, struct inode *inode)
131 inode->i_op = &empty_iops; 131 inode->i_op = &empty_iops;
132 inode->i_fop = &empty_fops; 132 inode->i_fop = &empty_fops;
133 inode->i_nlink = 1; 133 inode->i_nlink = 1;
134 inode->i_uid = 0;
135 inode->i_gid = 0;
134 atomic_set(&inode->i_writecount, 0); 136 atomic_set(&inode->i_writecount, 0);
135 inode->i_size = 0; 137 inode->i_size = 0;
136 inode->i_blocks = 0; 138 inode->i_blocks = 0;
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 43e8b2c0664b..cc3f1aa1cf7b 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -231,7 +231,8 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
231#define blk_to_logical(inode, blk) (blk << (inode)->i_blkbits) 231#define blk_to_logical(inode, blk) (blk << (inode)->i_blkbits)
232#define logical_to_blk(inode, offset) (offset >> (inode)->i_blkbits); 232#define logical_to_blk(inode, offset) (offset >> (inode)->i_blkbits);
233 233
234/* 234/**
235 * __generic_block_fiemap - FIEMAP for block based inodes (no locking)
235 * @inode - the inode to map 236 * @inode - the inode to map
236 * @arg - the pointer to userspace where we copy everything to 237 * @arg - the pointer to userspace where we copy everything to
237 * @get_block - the fs's get_block function 238 * @get_block - the fs's get_block function
@@ -242,11 +243,15 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg)
242 * 243 *
243 * If it is possible to have data blocks beyond a hole past @inode->i_size, then 244 * If it is possible to have data blocks beyond a hole past @inode->i_size, then
244 * please do not use this function, it will stop at the first unmapped block 245 * please do not use this function, it will stop at the first unmapped block
245 * beyond i_size 246 * beyond i_size.
247 *
248 * If you use this function directly, you need to do your own locking. Use
249 * generic_block_fiemap if you want the locking done for you.
246 */ 250 */
247int generic_block_fiemap(struct inode *inode, 251
248 struct fiemap_extent_info *fieinfo, u64 start, 252int __generic_block_fiemap(struct inode *inode,
249 u64 len, get_block_t *get_block) 253 struct fiemap_extent_info *fieinfo, u64 start,
254 u64 len, get_block_t *get_block)
250{ 255{
251 struct buffer_head tmp; 256 struct buffer_head tmp;
252 unsigned int start_blk; 257 unsigned int start_blk;
@@ -260,9 +265,6 @@ int generic_block_fiemap(struct inode *inode,
260 265
261 start_blk = logical_to_blk(inode, start); 266 start_blk = logical_to_blk(inode, start);
262 267
263 /* guard against change */
264 mutex_lock(&inode->i_mutex);
265
266 length = (long long)min_t(u64, len, i_size_read(inode)); 268 length = (long long)min_t(u64, len, i_size_read(inode));
267 map_len = length; 269 map_len = length;
268 270
@@ -334,14 +336,36 @@ int generic_block_fiemap(struct inode *inode,
334 cond_resched(); 336 cond_resched();
335 } while (1); 337 } while (1);
336 338
337 mutex_unlock(&inode->i_mutex);
338
339 /* if ret is 1 then we just hit the end of the extent array */ 339 /* if ret is 1 then we just hit the end of the extent array */
340 if (ret == 1) 340 if (ret == 1)
341 ret = 0; 341 ret = 0;
342 342
343 return ret; 343 return ret;
344} 344}
345EXPORT_SYMBOL(__generic_block_fiemap);
346
347/**
348 * generic_block_fiemap - FIEMAP for block based inodes
349 * @inode: The inode to map
350 * @fieinfo: The mapping information
351 * @start: The initial block to map
352 * @len: The length of the extect to attempt to map
353 * @get_block: The block mapping function for the fs
354 *
355 * Calls __generic_block_fiemap to map the inode, after taking
356 * the inode's mutex lock.
357 */
358
359int generic_block_fiemap(struct inode *inode,
360 struct fiemap_extent_info *fieinfo, u64 start,
361 u64 len, get_block_t *get_block)
362{
363 int ret;
364 mutex_lock(&inode->i_mutex);
365 ret = __generic_block_fiemap(inode, fieinfo, start, len, get_block);
366 mutex_unlock(&inode->i_mutex);
367 return ret;
368}
345EXPORT_SYMBOL(generic_block_fiemap); 369EXPORT_SYMBOL(generic_block_fiemap);
346 370
347#endif /* CONFIG_BLOCK */ 371#endif /* CONFIG_BLOCK */
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 3f8af0f1505b..6147ec3643a0 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -855,10 +855,6 @@ root_found:
855 } 855 }
856 sbi->s_joliet_level = joliet_level; 856 sbi->s_joliet_level = joliet_level;
857 857
858 /* check the root inode */
859 if (!inode->i_op)
860 goto out_bad_root;
861
862 /* Make sure the root inode is a directory */ 858 /* Make sure the root inode is a directory */
863 if (!S_ISDIR(inode->i_mode)) { 859 if (!S_ISDIR(inode->i_mode)) {
864 printk(KERN_WARNING 860 printk(KERN_WARNING
@@ -886,8 +882,6 @@ root_found:
886 /* 882 /*
887 * Display error messages and free resources. 883 * Display error messages and free resources.
888 */ 884 */
889out_bad_root:
890 printk(KERN_WARNING "%s: root inode not initialized\n", __func__);
891out_iput: 885out_iput:
892 iput(inode); 886 iput(inode);
893 goto out_no_inode; 887 goto out_no_inode;
diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
index ebc667bc54a8..c8a1bace685a 100644
--- a/fs/jbd2/commit.c
+++ b/fs/jbd2/commit.c
@@ -509,6 +509,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
509 if (is_journal_aborted(journal)) { 509 if (is_journal_aborted(journal)) {
510 clear_buffer_jbddirty(jh2bh(jh)); 510 clear_buffer_jbddirty(jh2bh(jh));
511 JBUFFER_TRACE(jh, "journal is aborting: refile"); 511 JBUFFER_TRACE(jh, "journal is aborting: refile");
512 jbd2_buffer_abort_trigger(jh,
513 jh->b_frozen_data ?
514 jh->b_frozen_triggers :
515 jh->b_triggers);
512 jbd2_journal_refile_buffer(journal, jh); 516 jbd2_journal_refile_buffer(journal, jh);
513 /* If that was the last one, we need to clean up 517 /* If that was the last one, we need to clean up
514 * any descriptor buffers which may have been 518 * any descriptor buffers which may have been
@@ -844,6 +848,9 @@ restart_loop:
844 * data. 848 * data.
845 * 849 *
846 * Otherwise, we can just throw away the frozen data now. 850 * Otherwise, we can just throw away the frozen data now.
851 *
852 * We also know that the frozen data has already fired
853 * its triggers if they exist, so we can clear that too.
847 */ 854 */
848 if (jh->b_committed_data) { 855 if (jh->b_committed_data) {
849 jbd2_free(jh->b_committed_data, bh->b_size); 856 jbd2_free(jh->b_committed_data, bh->b_size);
@@ -851,10 +858,12 @@ restart_loop:
851 if (jh->b_frozen_data) { 858 if (jh->b_frozen_data) {
852 jh->b_committed_data = jh->b_frozen_data; 859 jh->b_committed_data = jh->b_frozen_data;
853 jh->b_frozen_data = NULL; 860 jh->b_frozen_data = NULL;
861 jh->b_frozen_triggers = NULL;
854 } 862 }
855 } else if (jh->b_frozen_data) { 863 } else if (jh->b_frozen_data) {
856 jbd2_free(jh->b_frozen_data, bh->b_size); 864 jbd2_free(jh->b_frozen_data, bh->b_size);
857 jh->b_frozen_data = NULL; 865 jh->b_frozen_data = NULL;
866 jh->b_frozen_triggers = NULL;
858 } 867 }
859 868
860 spin_lock(&journal->j_list_lock); 869 spin_lock(&journal->j_list_lock);
diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index e70d657a19f8..f6bff9d6f8df 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -50,6 +50,7 @@ EXPORT_SYMBOL(jbd2_journal_unlock_updates);
50EXPORT_SYMBOL(jbd2_journal_get_write_access); 50EXPORT_SYMBOL(jbd2_journal_get_write_access);
51EXPORT_SYMBOL(jbd2_journal_get_create_access); 51EXPORT_SYMBOL(jbd2_journal_get_create_access);
52EXPORT_SYMBOL(jbd2_journal_get_undo_access); 52EXPORT_SYMBOL(jbd2_journal_get_undo_access);
53EXPORT_SYMBOL(jbd2_journal_set_triggers);
53EXPORT_SYMBOL(jbd2_journal_dirty_metadata); 54EXPORT_SYMBOL(jbd2_journal_dirty_metadata);
54EXPORT_SYMBOL(jbd2_journal_release_buffer); 55EXPORT_SYMBOL(jbd2_journal_release_buffer);
55EXPORT_SYMBOL(jbd2_journal_forget); 56EXPORT_SYMBOL(jbd2_journal_forget);
@@ -290,6 +291,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
290 struct page *new_page; 291 struct page *new_page;
291 unsigned int new_offset; 292 unsigned int new_offset;
292 struct buffer_head *bh_in = jh2bh(jh_in); 293 struct buffer_head *bh_in = jh2bh(jh_in);
294 struct jbd2_buffer_trigger_type *triggers;
293 295
294 /* 296 /*
295 * The buffer really shouldn't be locked: only the current committing 297 * The buffer really shouldn't be locked: only the current committing
@@ -314,13 +316,23 @@ repeat:
314 done_copy_out = 1; 316 done_copy_out = 1;
315 new_page = virt_to_page(jh_in->b_frozen_data); 317 new_page = virt_to_page(jh_in->b_frozen_data);
316 new_offset = offset_in_page(jh_in->b_frozen_data); 318 new_offset = offset_in_page(jh_in->b_frozen_data);
319 triggers = jh_in->b_frozen_triggers;
317 } else { 320 } else {
318 new_page = jh2bh(jh_in)->b_page; 321 new_page = jh2bh(jh_in)->b_page;
319 new_offset = offset_in_page(jh2bh(jh_in)->b_data); 322 new_offset = offset_in_page(jh2bh(jh_in)->b_data);
323 triggers = jh_in->b_triggers;
320 } 324 }
321 325
322 mapped_data = kmap_atomic(new_page, KM_USER0); 326 mapped_data = kmap_atomic(new_page, KM_USER0);
323 /* 327 /*
328 * Fire any commit trigger. Do this before checking for escaping,
329 * as the trigger may modify the magic offset. If a copy-out
330 * happens afterwards, it will have the correct data in the buffer.
331 */
332 jbd2_buffer_commit_trigger(jh_in, mapped_data + new_offset,
333 triggers);
334
335 /*
324 * Check for escaping 336 * Check for escaping
325 */ 337 */
326 if (*((__be32 *)(mapped_data + new_offset)) == 338 if (*((__be32 *)(mapped_data + new_offset)) ==
@@ -352,6 +364,13 @@ repeat:
352 new_page = virt_to_page(tmp); 364 new_page = virt_to_page(tmp);
353 new_offset = offset_in_page(tmp); 365 new_offset = offset_in_page(tmp);
354 done_copy_out = 1; 366 done_copy_out = 1;
367
368 /*
369 * This isn't strictly necessary, as we're using frozen
370 * data for the escaping, but it keeps consistency with
371 * b_frozen_data usage.
372 */
373 jh_in->b_frozen_triggers = jh_in->b_triggers;
355 } 374 }
356 375
357 /* 376 /*
diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c
index 39b7805a599a..4f925a4f3d05 100644
--- a/fs/jbd2/transaction.c
+++ b/fs/jbd2/transaction.c
@@ -741,6 +741,12 @@ done:
741 source = kmap_atomic(page, KM_USER0); 741 source = kmap_atomic(page, KM_USER0);
742 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size); 742 memcpy(jh->b_frozen_data, source+offset, jh2bh(jh)->b_size);
743 kunmap_atomic(source, KM_USER0); 743 kunmap_atomic(source, KM_USER0);
744
745 /*
746 * Now that the frozen data is saved off, we need to store
747 * any matching triggers.
748 */
749 jh->b_frozen_triggers = jh->b_triggers;
744 } 750 }
745 jbd_unlock_bh_state(bh); 751 jbd_unlock_bh_state(bh);
746 752
@@ -944,6 +950,47 @@ out:
944} 950}
945 951
946/** 952/**
953 * void jbd2_journal_set_triggers() - Add triggers for commit writeout
954 * @bh: buffer to trigger on
955 * @type: struct jbd2_buffer_trigger_type containing the trigger(s).
956 *
957 * Set any triggers on this journal_head. This is always safe, because
958 * triggers for a committing buffer will be saved off, and triggers for
959 * a running transaction will match the buffer in that transaction.
960 *
961 * Call with NULL to clear the triggers.
962 */
963void jbd2_journal_set_triggers(struct buffer_head *bh,
964 struct jbd2_buffer_trigger_type *type)
965{
966 struct journal_head *jh = bh2jh(bh);
967
968 jh->b_triggers = type;
969}
970
971void jbd2_buffer_commit_trigger(struct journal_head *jh, void *mapped_data,
972 struct jbd2_buffer_trigger_type *triggers)
973{
974 struct buffer_head *bh = jh2bh(jh);
975
976 if (!triggers || !triggers->t_commit)
977 return;
978
979 triggers->t_commit(triggers, bh, mapped_data, bh->b_size);
980}
981
982void jbd2_buffer_abort_trigger(struct journal_head *jh,
983 struct jbd2_buffer_trigger_type *triggers)
984{
985 if (!triggers || !triggers->t_abort)
986 return;
987
988 triggers->t_abort(triggers, jh2bh(jh));
989}
990
991
992
993/**
947 * int jbd2_journal_dirty_metadata() - mark a buffer as containing dirty metadata 994 * int jbd2_journal_dirty_metadata() - mark a buffer as containing dirty metadata
948 * @handle: transaction to add buffer to. 995 * @handle: transaction to add buffer to.
949 * @bh: buffer to mark 996 * @bh: buffer to mark
diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index d6363d8309d0..0f94381ca6d0 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -58,9 +58,9 @@
58 58
59/* 59/*
60 * __mark_inode_dirty expects inodes to be hashed. Since we don't want 60 * __mark_inode_dirty expects inodes to be hashed. Since we don't want
61 * special inodes in the fileset inode space, we hash them to a dummy head 61 * special inodes in the fileset inode space, we make them appear hashed,
62 * but do not put on any lists.
62 */ 63 */
63static HLIST_HEAD(aggregate_hash);
64 64
65/* 65/*
66 * imap locks 66 * imap locks
@@ -496,7 +496,11 @@ struct inode *diReadSpecial(struct super_block *sb, ino_t inum, int secondary)
496 /* release the page */ 496 /* release the page */
497 release_metapage(mp); 497 release_metapage(mp);
498 498
499 hlist_add_head(&ip->i_hash, &aggregate_hash); 499 /*
500 * that will look hashed, but won't be on any list; hlist_del()
501 * will work fine and require no locking.
502 */
503 ip->i_hash.pprev = &ip->i_hash.next;
500 504
501 return (ip); 505 return (ip);
502} 506}
diff --git a/fs/libfs.c b/fs/libfs.c
index bdaec17fa388..49b44099dabb 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -231,7 +231,6 @@ int get_sb_pseudo(struct file_system_type *fs_type, char *name,
231 */ 231 */
232 root->i_ino = 1; 232 root->i_ino = 1;
233 root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR; 233 root->i_mode = S_IFDIR | S_IRUSR | S_IWUSR;
234 root->i_uid = root->i_gid = 0;
235 root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME; 234 root->i_atime = root->i_mtime = root->i_ctime = CURRENT_TIME;
236 dentry = d_alloc(NULL, &d_name); 235 dentry = d_alloc(NULL, &d_name);
237 if (!dentry) { 236 if (!dentry) {
@@ -436,8 +435,6 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files
436 */ 435 */
437 inode->i_ino = 1; 436 inode->i_ino = 1;
438 inode->i_mode = S_IFDIR | 0755; 437 inode->i_mode = S_IFDIR | 0755;
439 inode->i_uid = inode->i_gid = 0;
440 inode->i_blocks = 0;
441 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 438 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
442 inode->i_op = &simple_dir_inode_operations; 439 inode->i_op = &simple_dir_inode_operations;
443 inode->i_fop = &simple_dir_operations; 440 inode->i_fop = &simple_dir_operations;
@@ -464,8 +461,6 @@ int simple_fill_super(struct super_block *s, int magic, struct tree_descr *files
464 if (!inode) 461 if (!inode)
465 goto out; 462 goto out;
466 inode->i_mode = S_IFREG | files->mode; 463 inode->i_mode = S_IFREG | files->mode;
467 inode->i_uid = inode->i_gid = 0;
468 inode->i_blocks = 0;
469 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 464 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
470 inode->i_fop = files->ops; 465 inode->i_fop = files->ops;
471 inode->i_ino = i; 466 inode->i_ino = i;
diff --git a/fs/namei.c b/fs/namei.c
index df2d3df4f049..f05bed242422 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -257,7 +257,7 @@ int inode_permission(struct inode *inode, int mask)
257 return -EACCES; 257 return -EACCES;
258 } 258 }
259 259
260 if (inode->i_op && inode->i_op->permission) 260 if (inode->i_op->permission)
261 retval = inode->i_op->permission(inode, mask); 261 retval = inode->i_op->permission(inode, mask);
262 else 262 else
263 retval = generic_permission(inode, mask, NULL); 263 retval = generic_permission(inode, mask, NULL);
@@ -432,7 +432,7 @@ static int exec_permission_lite(struct inode *inode)
432{ 432{
433 umode_t mode = inode->i_mode; 433 umode_t mode = inode->i_mode;
434 434
435 if (inode->i_op && inode->i_op->permission) 435 if (inode->i_op->permission)
436 return -EAGAIN; 436 return -EAGAIN;
437 437
438 if (current_fsuid() == inode->i_uid) 438 if (current_fsuid() == inode->i_uid)
@@ -908,9 +908,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
908 inode = next.dentry->d_inode; 908 inode = next.dentry->d_inode;
909 if (!inode) 909 if (!inode)
910 goto out_dput; 910 goto out_dput;
911 err = -ENOTDIR;
912 if (!inode->i_op)
913 goto out_dput;
914 911
915 if (inode->i_op->follow_link) { 912 if (inode->i_op->follow_link) {
916 err = do_follow_link(&next, nd); 913 err = do_follow_link(&next, nd);
@@ -920,9 +917,6 @@ static int __link_path_walk(const char *name, struct nameidata *nd)
920 inode = nd->path.dentry->d_inode; 917 inode = nd->path.dentry->d_inode;
921 if (!inode) 918 if (!inode)
922 break; 919 break;
923 err = -ENOTDIR;
924 if (!inode->i_op)
925 break;
926 } else 920 } else
927 path_to_nameidata(&next, nd); 921 path_to_nameidata(&next, nd);
928 err = -ENOTDIR; 922 err = -ENOTDIR;
@@ -961,7 +955,7 @@ last_component:
961 break; 955 break;
962 inode = next.dentry->d_inode; 956 inode = next.dentry->d_inode;
963 if ((lookup_flags & LOOKUP_FOLLOW) 957 if ((lookup_flags & LOOKUP_FOLLOW)
964 && inode && inode->i_op && inode->i_op->follow_link) { 958 && inode && inode->i_op->follow_link) {
965 err = do_follow_link(&next, nd); 959 err = do_follow_link(&next, nd);
966 if (err) 960 if (err)
967 goto return_err; 961 goto return_err;
@@ -973,7 +967,7 @@ last_component:
973 break; 967 break;
974 if (lookup_flags & LOOKUP_DIRECTORY) { 968 if (lookup_flags & LOOKUP_DIRECTORY) {
975 err = -ENOTDIR; 969 err = -ENOTDIR;
976 if (!inode->i_op || !inode->i_op->lookup) 970 if (!inode->i_op->lookup)
977 break; 971 break;
978 } 972 }
979 goto return_base; 973 goto return_base;
@@ -1469,7 +1463,7 @@ int vfs_create(struct inode *dir, struct dentry *dentry, int mode,
1469 if (error) 1463 if (error)
1470 return error; 1464 return error;
1471 1465
1472 if (!dir->i_op || !dir->i_op->create) 1466 if (!dir->i_op->create)
1473 return -EACCES; /* shouldn't it be ENOSYS? */ 1467 return -EACCES; /* shouldn't it be ENOSYS? */
1474 mode &= S_IALLUGO; 1468 mode &= S_IALLUGO;
1475 mode |= S_IFREG; 1469 mode |= S_IFREG;
@@ -1752,7 +1746,7 @@ do_last:
1752 error = -ENOENT; 1746 error = -ENOENT;
1753 if (!path.dentry->d_inode) 1747 if (!path.dentry->d_inode)
1754 goto exit_dput; 1748 goto exit_dput;
1755 if (path.dentry->d_inode->i_op && path.dentry->d_inode->i_op->follow_link) 1749 if (path.dentry->d_inode->i_op->follow_link)
1756 goto do_link; 1750 goto do_link;
1757 1751
1758 path_to_nameidata(&path, &nd); 1752 path_to_nameidata(&path, &nd);
@@ -1933,7 +1927,7 @@ int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
1933 if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD)) 1927 if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
1934 return -EPERM; 1928 return -EPERM;
1935 1929
1936 if (!dir->i_op || !dir->i_op->mknod) 1930 if (!dir->i_op->mknod)
1937 return -EPERM; 1931 return -EPERM;
1938 1932
1939 error = devcgroup_inode_mknod(mode, dev); 1933 error = devcgroup_inode_mknod(mode, dev);
@@ -2035,7 +2029,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2035 if (error) 2029 if (error)
2036 return error; 2030 return error;
2037 2031
2038 if (!dir->i_op || !dir->i_op->mkdir) 2032 if (!dir->i_op->mkdir)
2039 return -EPERM; 2033 return -EPERM;
2040 2034
2041 mode &= (S_IRWXUGO|S_ISVTX); 2035 mode &= (S_IRWXUGO|S_ISVTX);
@@ -2126,7 +2120,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
2126 if (error) 2120 if (error)
2127 return error; 2121 return error;
2128 2122
2129 if (!dir->i_op || !dir->i_op->rmdir) 2123 if (!dir->i_op->rmdir)
2130 return -EPERM; 2124 return -EPERM;
2131 2125
2132 DQUOT_INIT(dir); 2126 DQUOT_INIT(dir);
@@ -2213,7 +2207,7 @@ int vfs_unlink(struct inode *dir, struct dentry *dentry)
2213 if (error) 2207 if (error)
2214 return error; 2208 return error;
2215 2209
2216 if (!dir->i_op || !dir->i_op->unlink) 2210 if (!dir->i_op->unlink)
2217 return -EPERM; 2211 return -EPERM;
2218 2212
2219 DQUOT_INIT(dir); 2213 DQUOT_INIT(dir);
@@ -2320,7 +2314,7 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2320 if (error) 2314 if (error)
2321 return error; 2315 return error;
2322 2316
2323 if (!dir->i_op || !dir->i_op->symlink) 2317 if (!dir->i_op->symlink)
2324 return -EPERM; 2318 return -EPERM;
2325 2319
2326 error = security_inode_symlink(dir, dentry, oldname); 2320 error = security_inode_symlink(dir, dentry, oldname);
@@ -2401,7 +2395,7 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2401 */ 2395 */
2402 if (IS_APPEND(inode) || IS_IMMUTABLE(inode)) 2396 if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
2403 return -EPERM; 2397 return -EPERM;
2404 if (!dir->i_op || !dir->i_op->link) 2398 if (!dir->i_op->link)
2405 return -EPERM; 2399 return -EPERM;
2406 if (S_ISDIR(inode->i_mode)) 2400 if (S_ISDIR(inode->i_mode))
2407 return -EPERM; 2401 return -EPERM;
@@ -2608,7 +2602,7 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2608 if (error) 2602 if (error)
2609 return error; 2603 return error;
2610 2604
2611 if (!old_dir->i_op || !old_dir->i_op->rename) 2605 if (!old_dir->i_op->rename)
2612 return -EPERM; 2606 return -EPERM;
2613 2607
2614 DQUOT_INIT(old_dir); 2608 DQUOT_INIT(old_dir);
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index d1c5f787b365..44aa92aba891 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -744,45 +744,16 @@ nfsd_close(struct file *filp)
744 fput(filp); 744 fput(filp);
745} 745}
746 746
747/*
748 * Sync a file
749 * As this calls fsync (not fdatasync) there is no need for a write_inode
750 * after it.
751 */
752static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
753 const struct file_operations *fop)
754{
755 struct inode *inode = dp->d_inode;
756 int (*fsync) (struct file *, struct dentry *, int);
757 int err;
758
759 err = filemap_fdatawrite(inode->i_mapping);
760 if (err == 0 && fop && (fsync = fop->fsync))
761 err = fsync(filp, dp, 0);
762 if (err == 0)
763 err = filemap_fdatawait(inode->i_mapping);
764
765 return err;
766}
767
768
769static int 747static int
770nfsd_sync(struct file *filp) 748nfsd_sync(struct file *filp)
771{ 749{
772 int err; 750 return vfs_fsync(filp, filp->f_path.dentry, 0);
773 struct inode *inode = filp->f_path.dentry->d_inode;
774 dprintk("nfsd: sync file %s\n", filp->f_path.dentry->d_name.name);
775 mutex_lock(&inode->i_mutex);
776 err=nfsd_dosync(filp, filp->f_path.dentry, filp->f_op);
777 mutex_unlock(&inode->i_mutex);
778
779 return err;
780} 751}
781 752
782int 753int
783nfsd_sync_dir(struct dentry *dp) 754nfsd_sync_dir(struct dentry *dentry)
784{ 755{
785 return nfsd_dosync(NULL, dp, dp->d_inode->i_fop); 756 return vfs_fsync(NULL, dentry, 0);
786} 757}
787 758
788/* 759/*
@@ -1211,7 +1182,7 @@ nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1211 dirp = dentry->d_inode; 1182 dirp = dentry->d_inode;
1212 1183
1213 err = nfserr_notdir; 1184 err = nfserr_notdir;
1214 if(!dirp->i_op || !dirp->i_op->lookup) 1185 if (!dirp->i_op->lookup)
1215 goto out; 1186 goto out;
1216 /* 1187 /*
1217 * Check whether the response file handle has been verified yet. 1188 * Check whether the response file handle has been verified yet.
@@ -1347,7 +1318,7 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1347 /* Get all the sanity checks out of the way before 1318 /* Get all the sanity checks out of the way before
1348 * we lock the parent. */ 1319 * we lock the parent. */
1349 err = nfserr_notdir; 1320 err = nfserr_notdir;
1350 if(!dirp->i_op || !dirp->i_op->lookup) 1321 if (!dirp->i_op->lookup)
1351 goto out; 1322 goto out;
1352 fh_lock_nested(fhp, I_MUTEX_PARENT); 1323 fh_lock_nested(fhp, I_MUTEX_PARENT);
1353 1324
@@ -1482,7 +1453,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
1482 inode = dentry->d_inode; 1453 inode = dentry->d_inode;
1483 1454
1484 err = nfserr_inval; 1455 err = nfserr_inval;
1485 if (!inode->i_op || !inode->i_op->readlink) 1456 if (!inode->i_op->readlink)
1486 goto out; 1457 goto out;
1487 1458
1488 touch_atime(fhp->fh_export->ex_path.mnt, dentry); 1459 touch_atime(fhp->fh_export->ex_path.mnt, dentry);
@@ -2162,7 +2133,7 @@ nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
2162 size_t size; 2133 size_t size;
2163 int error; 2134 int error;
2164 2135
2165 if (!IS_POSIXACL(inode) || !inode->i_op || 2136 if (!IS_POSIXACL(inode) ||
2166 !inode->i_op->setxattr || !inode->i_op->removexattr) 2137 !inode->i_op->setxattr || !inode->i_op->removexattr)
2167 return -EOPNOTSUPP; 2138 return -EOPNOTSUPP;
2168 switch(type) { 2139 switch(type) {
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 400f8064a548..81b8644b0136 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -704,7 +704,7 @@ fput_and_out:
704 return ret; 704 return ret;
705} 705}
706 706
707asmlinkage long sys_inotify_rm_watch(int fd, u32 wd) 707asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd)
708{ 708{
709 struct file *filp; 709 struct file *filp;
710 struct inotify_device *dev; 710 struct inotify_device *dev;
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index e9da092e2772..86bef156cf0a 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1406,9 +1406,6 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1406 ni->allocated_size = sle64_to_cpu( 1406 ni->allocated_size = sle64_to_cpu(
1407 a->data.non_resident.allocated_size); 1407 a->data.non_resident.allocated_size);
1408 } 1408 }
1409 /* Setup the operations for this attribute inode. */
1410 vi->i_op = NULL;
1411 vi->i_fop = NULL;
1412 if (NInoMstProtected(ni)) 1409 if (NInoMstProtected(ni))
1413 vi->i_mapping->a_ops = &ntfs_mst_aops; 1410 vi->i_mapping->a_ops = &ntfs_mst_aops;
1414 else 1411 else
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile
index 589dcdfdfe3c..01596079dd63 100644
--- a/fs/ocfs2/Makefile
+++ b/fs/ocfs2/Makefile
@@ -12,6 +12,7 @@ obj-$(CONFIG_OCFS2_FS_USERSPACE_CLUSTER) += ocfs2_stack_user.o
12ocfs2-objs := \ 12ocfs2-objs := \
13 alloc.o \ 13 alloc.o \
14 aops.o \ 14 aops.o \
15 blockcheck.o \
15 buffer_head_io.o \ 16 buffer_head_io.o \
16 dcache.o \ 17 dcache.o \
17 dir.o \ 18 dir.o \
@@ -35,8 +36,14 @@ ocfs2-objs := \
35 sysfile.o \ 36 sysfile.o \
36 uptodate.o \ 37 uptodate.o \
37 ver.o \ 38 ver.o \
39 quota_local.o \
40 quota_global.o \
38 xattr.o 41 xattr.o
39 42
43ifeq ($(CONFIG_OCFS2_FS_POSIX_ACL),y)
44ocfs2-objs += acl.o
45endif
46
40ocfs2_stackglue-objs := stackglue.o 47ocfs2_stackglue-objs := stackglue.o
41ocfs2_stack_o2cb-objs := stack_o2cb.o 48ocfs2_stack_o2cb-objs := stack_o2cb.o
42ocfs2_stack_user-objs := stack_user.o 49ocfs2_stack_user-objs := stack_user.o
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c
new file mode 100644
index 000000000000..12dfb44c22e5
--- /dev/null
+++ b/fs/ocfs2/acl.c
@@ -0,0 +1,479 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * acl.c
5 *
6 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
7 *
8 * CREDITS:
9 * Lots of code in this file is copy from linux/fs/ext3/acl.c.
10 * Copyright (C) 2001-2003 Andreas Gruenbacher, <agruen@suse.de>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public
14 * License version 2 as published by the Free Software Foundation.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 */
21
22#include <linux/init.h>
23#include <linux/module.h>
24#include <linux/string.h>
25
26#define MLOG_MASK_PREFIX ML_INODE
27#include <cluster/masklog.h>
28
29#include "ocfs2.h"
30#include "alloc.h"
31#include "dlmglue.h"
32#include "file.h"
33#include "ocfs2_fs.h"
34
35#include "xattr.h"
36#include "acl.h"
37
38/*
39 * Convert from xattr value to acl struct.
40 */
41static struct posix_acl *ocfs2_acl_from_xattr(const void *value, size_t size)
42{
43 int n, count;
44 struct posix_acl *acl;
45
46 if (!value)
47 return NULL;
48 if (size < sizeof(struct posix_acl_entry))
49 return ERR_PTR(-EINVAL);
50
51 count = size / sizeof(struct posix_acl_entry);
52 if (count < 0)
53 return ERR_PTR(-EINVAL);
54 if (count == 0)
55 return NULL;
56
57 acl = posix_acl_alloc(count, GFP_NOFS);
58 if (!acl)
59 return ERR_PTR(-ENOMEM);
60 for (n = 0; n < count; n++) {
61 struct ocfs2_acl_entry *entry =
62 (struct ocfs2_acl_entry *)value;
63
64 acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
65 acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
66 acl->a_entries[n].e_id = le32_to_cpu(entry->e_id);
67 value += sizeof(struct posix_acl_entry);
68
69 }
70 return acl;
71}
72
73/*
74 * Convert acl struct to xattr value.
75 */
76static void *ocfs2_acl_to_xattr(const struct posix_acl *acl, size_t *size)
77{
78 struct ocfs2_acl_entry *entry = NULL;
79 char *ocfs2_acl;
80 size_t n;
81
82 *size = acl->a_count * sizeof(struct posix_acl_entry);
83
84 ocfs2_acl = kmalloc(*size, GFP_NOFS);
85 if (!ocfs2_acl)
86 return ERR_PTR(-ENOMEM);
87
88 entry = (struct ocfs2_acl_entry *)ocfs2_acl;
89 for (n = 0; n < acl->a_count; n++, entry++) {
90 entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
91 entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
92 entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
93 }
94 return ocfs2_acl;
95}
96
97static struct posix_acl *ocfs2_get_acl_nolock(struct inode *inode,
98 int type,
99 struct buffer_head *di_bh)
100{
101 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
102 int name_index;
103 char *value = NULL;
104 struct posix_acl *acl;
105 int retval;
106
107 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
108 return NULL;
109
110 switch (type) {
111 case ACL_TYPE_ACCESS:
112 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
113 break;
114 case ACL_TYPE_DEFAULT:
115 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT;
116 break;
117 default:
118 return ERR_PTR(-EINVAL);
119 }
120
121 retval = ocfs2_xattr_get_nolock(inode, di_bh, name_index, "", NULL, 0);
122 if (retval > 0) {
123 value = kmalloc(retval, GFP_NOFS);
124 if (!value)
125 return ERR_PTR(-ENOMEM);
126 retval = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
127 "", value, retval);
128 }
129
130 if (retval > 0)
131 acl = ocfs2_acl_from_xattr(value, retval);
132 else if (retval == -ENODATA || retval == 0)
133 acl = NULL;
134 else
135 acl = ERR_PTR(retval);
136
137 kfree(value);
138
139 return acl;
140}
141
142
143/*
144 * Get posix acl.
145 */
146static struct posix_acl *ocfs2_get_acl(struct inode *inode, int type)
147{
148 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
149 struct buffer_head *di_bh = NULL;
150 struct posix_acl *acl;
151 int ret;
152
153 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
154 return NULL;
155
156 ret = ocfs2_inode_lock(inode, &di_bh, 0);
157 if (ret < 0) {
158 mlog_errno(ret);
159 acl = ERR_PTR(ret);
160 return acl;
161 }
162
163 acl = ocfs2_get_acl_nolock(inode, type, di_bh);
164
165 ocfs2_inode_unlock(inode, 0);
166
167 brelse(di_bh);
168
169 return acl;
170}
171
172/*
173 * Set the access or default ACL of an inode.
174 */
175static int ocfs2_set_acl(handle_t *handle,
176 struct inode *inode,
177 struct buffer_head *di_bh,
178 int type,
179 struct posix_acl *acl,
180 struct ocfs2_alloc_context *meta_ac,
181 struct ocfs2_alloc_context *data_ac)
182{
183 int name_index;
184 void *value = NULL;
185 size_t size = 0;
186 int ret;
187
188 if (S_ISLNK(inode->i_mode))
189 return -EOPNOTSUPP;
190
191 switch (type) {
192 case ACL_TYPE_ACCESS:
193 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS;
194 if (acl) {
195 mode_t mode = inode->i_mode;
196 ret = posix_acl_equiv_mode(acl, &mode);
197 if (ret < 0)
198 return ret;
199 else {
200 inode->i_mode = mode;
201 if (ret == 0)
202 acl = NULL;
203 }
204 }
205 break;
206 case ACL_TYPE_DEFAULT:
207 name_index = OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT;
208 if (!S_ISDIR(inode->i_mode))
209 return acl ? -EACCES : 0;
210 break;
211 default:
212 return -EINVAL;
213 }
214
215 if (acl) {
216 value = ocfs2_acl_to_xattr(acl, &size);
217 if (IS_ERR(value))
218 return (int)PTR_ERR(value);
219 }
220
221 if (handle)
222 ret = ocfs2_xattr_set_handle(handle, inode, di_bh, name_index,
223 "", value, size, 0,
224 meta_ac, data_ac);
225 else
226 ret = ocfs2_xattr_set(inode, name_index, "", value, size, 0);
227
228 kfree(value);
229
230 return ret;
231}
232
233int ocfs2_check_acl(struct inode *inode, int mask)
234{
235 struct posix_acl *acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
236
237 if (IS_ERR(acl))
238 return PTR_ERR(acl);
239 if (acl) {
240 int ret = posix_acl_permission(inode, acl, mask);
241 posix_acl_release(acl);
242 return ret;
243 }
244
245 return -EAGAIN;
246}
247
248int ocfs2_acl_chmod(struct inode *inode)
249{
250 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
251 struct posix_acl *acl, *clone;
252 int ret;
253
254 if (S_ISLNK(inode->i_mode))
255 return -EOPNOTSUPP;
256
257 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
258 return 0;
259
260 acl = ocfs2_get_acl(inode, ACL_TYPE_ACCESS);
261 if (IS_ERR(acl) || !acl)
262 return PTR_ERR(acl);
263 clone = posix_acl_clone(acl, GFP_KERNEL);
264 posix_acl_release(acl);
265 if (!clone)
266 return -ENOMEM;
267 ret = posix_acl_chmod_masq(clone, inode->i_mode);
268 if (!ret)
269 ret = ocfs2_set_acl(NULL, inode, NULL, ACL_TYPE_ACCESS,
270 clone, NULL, NULL);
271 posix_acl_release(clone);
272 return ret;
273}
274
275/*
276 * Initialize the ACLs of a new inode. If parent directory has default ACL,
277 * then clone to new inode. Called from ocfs2_mknod.
278 */
279int ocfs2_init_acl(handle_t *handle,
280 struct inode *inode,
281 struct inode *dir,
282 struct buffer_head *di_bh,
283 struct buffer_head *dir_bh,
284 struct ocfs2_alloc_context *meta_ac,
285 struct ocfs2_alloc_context *data_ac)
286{
287 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
288 struct posix_acl *acl = NULL;
289 int ret = 0;
290
291 if (!S_ISLNK(inode->i_mode)) {
292 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) {
293 acl = ocfs2_get_acl_nolock(dir, ACL_TYPE_DEFAULT,
294 dir_bh);
295 if (IS_ERR(acl))
296 return PTR_ERR(acl);
297 }
298 if (!acl)
299 inode->i_mode &= ~current->fs->umask;
300 }
301 if ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) && acl) {
302 struct posix_acl *clone;
303 mode_t mode;
304
305 if (S_ISDIR(inode->i_mode)) {
306 ret = ocfs2_set_acl(handle, inode, di_bh,
307 ACL_TYPE_DEFAULT, acl,
308 meta_ac, data_ac);
309 if (ret)
310 goto cleanup;
311 }
312 clone = posix_acl_clone(acl, GFP_NOFS);
313 ret = -ENOMEM;
314 if (!clone)
315 goto cleanup;
316
317 mode = inode->i_mode;
318 ret = posix_acl_create_masq(clone, &mode);
319 if (ret >= 0) {
320 inode->i_mode = mode;
321 if (ret > 0) {
322 ret = ocfs2_set_acl(handle, inode,
323 di_bh, ACL_TYPE_ACCESS,
324 clone, meta_ac, data_ac);
325 }
326 }
327 posix_acl_release(clone);
328 }
329cleanup:
330 posix_acl_release(acl);
331 return ret;
332}
333
334static size_t ocfs2_xattr_list_acl_access(struct inode *inode,
335 char *list,
336 size_t list_len,
337 const char *name,
338 size_t name_len)
339{
340 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
341 const size_t size = sizeof(POSIX_ACL_XATTR_ACCESS);
342
343 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
344 return 0;
345
346 if (list && size <= list_len)
347 memcpy(list, POSIX_ACL_XATTR_ACCESS, size);
348 return size;
349}
350
351static size_t ocfs2_xattr_list_acl_default(struct inode *inode,
352 char *list,
353 size_t list_len,
354 const char *name,
355 size_t name_len)
356{
357 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
358 const size_t size = sizeof(POSIX_ACL_XATTR_DEFAULT);
359
360 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
361 return 0;
362
363 if (list && size <= list_len)
364 memcpy(list, POSIX_ACL_XATTR_DEFAULT, size);
365 return size;
366}
367
368static int ocfs2_xattr_get_acl(struct inode *inode,
369 int type,
370 void *buffer,
371 size_t size)
372{
373 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
374 struct posix_acl *acl;
375 int ret;
376
377 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
378 return -EOPNOTSUPP;
379
380 acl = ocfs2_get_acl(inode, type);
381 if (IS_ERR(acl))
382 return PTR_ERR(acl);
383 if (acl == NULL)
384 return -ENODATA;
385 ret = posix_acl_to_xattr(acl, buffer, size);
386 posix_acl_release(acl);
387
388 return ret;
389}
390
391static int ocfs2_xattr_get_acl_access(struct inode *inode,
392 const char *name,
393 void *buffer,
394 size_t size)
395{
396 if (strcmp(name, "") != 0)
397 return -EINVAL;
398 return ocfs2_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
399}
400
401static int ocfs2_xattr_get_acl_default(struct inode *inode,
402 const char *name,
403 void *buffer,
404 size_t size)
405{
406 if (strcmp(name, "") != 0)
407 return -EINVAL;
408 return ocfs2_xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
409}
410
411static int ocfs2_xattr_set_acl(struct inode *inode,
412 int type,
413 const void *value,
414 size_t size)
415{
416 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
417 struct posix_acl *acl;
418 int ret = 0;
419
420 if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
421 return -EOPNOTSUPP;
422
423 if (!is_owner_or_cap(inode))
424 return -EPERM;
425
426 if (value) {
427 acl = posix_acl_from_xattr(value, size);
428 if (IS_ERR(acl))
429 return PTR_ERR(acl);
430 else if (acl) {
431 ret = posix_acl_valid(acl);
432 if (ret)
433 goto cleanup;
434 }
435 } else
436 acl = NULL;
437
438 ret = ocfs2_set_acl(NULL, inode, NULL, type, acl, NULL, NULL);
439
440cleanup:
441 posix_acl_release(acl);
442 return ret;
443}
444
445static int ocfs2_xattr_set_acl_access(struct inode *inode,
446 const char *name,
447 const void *value,
448 size_t size,
449 int flags)
450{
451 if (strcmp(name, "") != 0)
452 return -EINVAL;
453 return ocfs2_xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
454}
455
456static int ocfs2_xattr_set_acl_default(struct inode *inode,
457 const char *name,
458 const void *value,
459 size_t size,
460 int flags)
461{
462 if (strcmp(name, "") != 0)
463 return -EINVAL;
464 return ocfs2_xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
465}
466
467struct xattr_handler ocfs2_xattr_acl_access_handler = {
468 .prefix = POSIX_ACL_XATTR_ACCESS,
469 .list = ocfs2_xattr_list_acl_access,
470 .get = ocfs2_xattr_get_acl_access,
471 .set = ocfs2_xattr_set_acl_access,
472};
473
474struct xattr_handler ocfs2_xattr_acl_default_handler = {
475 .prefix = POSIX_ACL_XATTR_DEFAULT,
476 .list = ocfs2_xattr_list_acl_default,
477 .get = ocfs2_xattr_get_acl_default,
478 .set = ocfs2_xattr_set_acl_default,
479};
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h
new file mode 100644
index 000000000000..8f6389ed4da5
--- /dev/null
+++ b/fs/ocfs2/acl.h
@@ -0,0 +1,58 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * acl.h
5 *
6 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License version 2 as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 */
17
18#ifndef OCFS2_ACL_H
19#define OCFS2_ACL_H
20
21#include <linux/posix_acl_xattr.h>
22
23struct ocfs2_acl_entry {
24 __le16 e_tag;
25 __le16 e_perm;
26 __le32 e_id;
27};
28
29#ifdef CONFIG_OCFS2_FS_POSIX_ACL
30
31extern int ocfs2_check_acl(struct inode *, int);
32extern int ocfs2_acl_chmod(struct inode *);
33extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *,
34 struct buffer_head *, struct buffer_head *,
35 struct ocfs2_alloc_context *,
36 struct ocfs2_alloc_context *);
37
38#else /* CONFIG_OCFS2_FS_POSIX_ACL*/
39
40#define ocfs2_check_acl NULL
41static inline int ocfs2_acl_chmod(struct inode *inode)
42{
43 return 0;
44}
45static inline int ocfs2_init_acl(handle_t *handle,
46 struct inode *inode,
47 struct inode *dir,
48 struct buffer_head *di_bh,
49 struct buffer_head *dir_bh,
50 struct ocfs2_alloc_context *meta_ac,
51 struct ocfs2_alloc_context *data_ac)
52{
53 return 0;
54}
55
56#endif /* CONFIG_OCFS2_FS_POSIX_ACL*/
57
58#endif /* OCFS2_ACL_H */
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c
index 0cc2deb9394c..54ff4c77aaa3 100644
--- a/fs/ocfs2/alloc.c
+++ b/fs/ocfs2/alloc.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/swap.h> 30#include <linux/swap.h>
31#include <linux/quotaops.h>
31 32
32#define MLOG_MASK_PREFIX ML_DISK_ALLOC 33#define MLOG_MASK_PREFIX ML_DISK_ALLOC
33#include <cluster/masklog.h> 34#include <cluster/masklog.h>
@@ -36,6 +37,7 @@
36 37
37#include "alloc.h" 38#include "alloc.h"
38#include "aops.h" 39#include "aops.h"
40#include "blockcheck.h"
39#include "dlmglue.h" 41#include "dlmglue.h"
40#include "extent_map.h" 42#include "extent_map.h"
41#include "inode.h" 43#include "inode.h"
@@ -46,6 +48,7 @@
46#include "file.h" 48#include "file.h"
47#include "super.h" 49#include "super.h"
48#include "uptodate.h" 50#include "uptodate.h"
51#include "xattr.h"
49 52
50#include "buffer_head_io.h" 53#include "buffer_head_io.h"
51 54
@@ -187,20 +190,12 @@ static int ocfs2_dinode_insert_check(struct inode *inode,
187static int ocfs2_dinode_sanity_check(struct inode *inode, 190static int ocfs2_dinode_sanity_check(struct inode *inode,
188 struct ocfs2_extent_tree *et) 191 struct ocfs2_extent_tree *et)
189{ 192{
190 int ret = 0; 193 struct ocfs2_dinode *di = et->et_object;
191 struct ocfs2_dinode *di;
192 194
193 BUG_ON(et->et_ops != &ocfs2_dinode_et_ops); 195 BUG_ON(et->et_ops != &ocfs2_dinode_et_ops);
196 BUG_ON(!OCFS2_IS_VALID_DINODE(di));
194 197
195 di = et->et_object; 198 return 0;
196 if (!OCFS2_IS_VALID_DINODE(di)) {
197 ret = -EIO;
198 ocfs2_error(inode->i_sb,
199 "Inode %llu has invalid path root",
200 (unsigned long long)OCFS2_I(inode)->ip_blkno);
201 }
202
203 return ret;
204} 199}
205 200
206static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et) 201static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et)
@@ -213,36 +208,33 @@ static void ocfs2_dinode_fill_root_el(struct ocfs2_extent_tree *et)
213 208
214static void ocfs2_xattr_value_fill_root_el(struct ocfs2_extent_tree *et) 209static void ocfs2_xattr_value_fill_root_el(struct ocfs2_extent_tree *et)
215{ 210{
216 struct ocfs2_xattr_value_root *xv = et->et_object; 211 struct ocfs2_xattr_value_buf *vb = et->et_object;
217 212
218 et->et_root_el = &xv->xr_list; 213 et->et_root_el = &vb->vb_xv->xr_list;
219} 214}
220 215
221static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et, 216static void ocfs2_xattr_value_set_last_eb_blk(struct ocfs2_extent_tree *et,
222 u64 blkno) 217 u64 blkno)
223{ 218{
224 struct ocfs2_xattr_value_root *xv = 219 struct ocfs2_xattr_value_buf *vb = et->et_object;
225 (struct ocfs2_xattr_value_root *)et->et_object;
226 220
227 xv->xr_last_eb_blk = cpu_to_le64(blkno); 221 vb->vb_xv->xr_last_eb_blk = cpu_to_le64(blkno);
228} 222}
229 223
230static u64 ocfs2_xattr_value_get_last_eb_blk(struct ocfs2_extent_tree *et) 224static u64 ocfs2_xattr_value_get_last_eb_blk(struct ocfs2_extent_tree *et)
231{ 225{
232 struct ocfs2_xattr_value_root *xv = 226 struct ocfs2_xattr_value_buf *vb = et->et_object;
233 (struct ocfs2_xattr_value_root *) et->et_object;
234 227
235 return le64_to_cpu(xv->xr_last_eb_blk); 228 return le64_to_cpu(vb->vb_xv->xr_last_eb_blk);
236} 229}
237 230
238static void ocfs2_xattr_value_update_clusters(struct inode *inode, 231static void ocfs2_xattr_value_update_clusters(struct inode *inode,
239 struct ocfs2_extent_tree *et, 232 struct ocfs2_extent_tree *et,
240 u32 clusters) 233 u32 clusters)
241{ 234{
242 struct ocfs2_xattr_value_root *xv = 235 struct ocfs2_xattr_value_buf *vb = et->et_object;
243 (struct ocfs2_xattr_value_root *)et->et_object;
244 236
245 le32_add_cpu(&xv->xr_clusters, clusters); 237 le32_add_cpu(&vb->vb_xv->xr_clusters, clusters);
246} 238}
247 239
248static struct ocfs2_extent_tree_operations ocfs2_xattr_value_et_ops = { 240static struct ocfs2_extent_tree_operations ocfs2_xattr_value_et_ops = {
@@ -304,11 +296,13 @@ static struct ocfs2_extent_tree_operations ocfs2_xattr_tree_et_ops = {
304static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et, 296static void __ocfs2_init_extent_tree(struct ocfs2_extent_tree *et,
305 struct inode *inode, 297 struct inode *inode,
306 struct buffer_head *bh, 298 struct buffer_head *bh,
299 ocfs2_journal_access_func access,
307 void *obj, 300 void *obj,
308 struct ocfs2_extent_tree_operations *ops) 301 struct ocfs2_extent_tree_operations *ops)
309{ 302{
310 et->et_ops = ops; 303 et->et_ops = ops;
311 et->et_root_bh = bh; 304 et->et_root_bh = bh;
305 et->et_root_journal_access = access;
312 if (!obj) 306 if (!obj)
313 obj = (void *)bh->b_data; 307 obj = (void *)bh->b_data;
314 et->et_object = obj; 308 et->et_object = obj;
@@ -324,23 +318,23 @@ void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
324 struct inode *inode, 318 struct inode *inode,
325 struct buffer_head *bh) 319 struct buffer_head *bh)
326{ 320{
327 __ocfs2_init_extent_tree(et, inode, bh, NULL, &ocfs2_dinode_et_ops); 321 __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_di,
322 NULL, &ocfs2_dinode_et_ops);
328} 323}
329 324
330void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, 325void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
331 struct inode *inode, 326 struct inode *inode,
332 struct buffer_head *bh) 327 struct buffer_head *bh)
333{ 328{
334 __ocfs2_init_extent_tree(et, inode, bh, NULL, 329 __ocfs2_init_extent_tree(et, inode, bh, ocfs2_journal_access_xb,
335 &ocfs2_xattr_tree_et_ops); 330 NULL, &ocfs2_xattr_tree_et_ops);
336} 331}
337 332
338void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, 333void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
339 struct inode *inode, 334 struct inode *inode,
340 struct buffer_head *bh, 335 struct ocfs2_xattr_value_buf *vb)
341 struct ocfs2_xattr_value_root *xv)
342{ 336{
343 __ocfs2_init_extent_tree(et, inode, bh, xv, 337 __ocfs2_init_extent_tree(et, inode, vb->vb_bh, vb->vb_access, vb,
344 &ocfs2_xattr_value_et_ops); 338 &ocfs2_xattr_value_et_ops);
345} 339}
346 340
@@ -362,6 +356,15 @@ static inline void ocfs2_et_update_clusters(struct inode *inode,
362 et->et_ops->eo_update_clusters(inode, et, clusters); 356 et->et_ops->eo_update_clusters(inode, et, clusters);
363} 357}
364 358
359static inline int ocfs2_et_root_journal_access(handle_t *handle,
360 struct inode *inode,
361 struct ocfs2_extent_tree *et,
362 int type)
363{
364 return et->et_root_journal_access(handle, inode, et->et_root_bh,
365 type);
366}
367
365static inline int ocfs2_et_insert_check(struct inode *inode, 368static inline int ocfs2_et_insert_check(struct inode *inode,
366 struct ocfs2_extent_tree *et, 369 struct ocfs2_extent_tree *et,
367 struct ocfs2_extent_rec *rec) 370 struct ocfs2_extent_rec *rec)
@@ -402,12 +405,14 @@ struct ocfs2_path_item {
402#define OCFS2_MAX_PATH_DEPTH 5 405#define OCFS2_MAX_PATH_DEPTH 5
403 406
404struct ocfs2_path { 407struct ocfs2_path {
405 int p_tree_depth; 408 int p_tree_depth;
406 struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH]; 409 ocfs2_journal_access_func p_root_access;
410 struct ocfs2_path_item p_node[OCFS2_MAX_PATH_DEPTH];
407}; 411};
408 412
409#define path_root_bh(_path) ((_path)->p_node[0].bh) 413#define path_root_bh(_path) ((_path)->p_node[0].bh)
410#define path_root_el(_path) ((_path)->p_node[0].el) 414#define path_root_el(_path) ((_path)->p_node[0].el)
415#define path_root_access(_path)((_path)->p_root_access)
411#define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh) 416#define path_leaf_bh(_path) ((_path)->p_node[(_path)->p_tree_depth].bh)
412#define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el) 417#define path_leaf_el(_path) ((_path)->p_node[(_path)->p_tree_depth].el)
413#define path_num_items(_path) ((_path)->p_tree_depth + 1) 418#define path_num_items(_path) ((_path)->p_tree_depth + 1)
@@ -440,6 +445,8 @@ static void ocfs2_reinit_path(struct ocfs2_path *path, int keep_root)
440 */ 445 */
441 if (keep_root) 446 if (keep_root)
442 depth = le16_to_cpu(path_root_el(path)->l_tree_depth); 447 depth = le16_to_cpu(path_root_el(path)->l_tree_depth);
448 else
449 path_root_access(path) = NULL;
443 450
444 path->p_tree_depth = depth; 451 path->p_tree_depth = depth;
445} 452}
@@ -465,6 +472,7 @@ static void ocfs2_cp_path(struct ocfs2_path *dest, struct ocfs2_path *src)
465 472
466 BUG_ON(path_root_bh(dest) != path_root_bh(src)); 473 BUG_ON(path_root_bh(dest) != path_root_bh(src));
467 BUG_ON(path_root_el(dest) != path_root_el(src)); 474 BUG_ON(path_root_el(dest) != path_root_el(src));
475 BUG_ON(path_root_access(dest) != path_root_access(src));
468 476
469 ocfs2_reinit_path(dest, 1); 477 ocfs2_reinit_path(dest, 1);
470 478
@@ -486,6 +494,7 @@ static void ocfs2_mv_path(struct ocfs2_path *dest, struct ocfs2_path *src)
486 int i; 494 int i;
487 495
488 BUG_ON(path_root_bh(dest) != path_root_bh(src)); 496 BUG_ON(path_root_bh(dest) != path_root_bh(src));
497 BUG_ON(path_root_access(dest) != path_root_access(src));
489 498
490 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) { 499 for(i = 1; i < OCFS2_MAX_PATH_DEPTH; i++) {
491 brelse(dest->p_node[i].bh); 500 brelse(dest->p_node[i].bh);
@@ -521,7 +530,8 @@ static inline void ocfs2_path_insert_eb(struct ocfs2_path *path, int index,
521} 530}
522 531
523static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh, 532static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh,
524 struct ocfs2_extent_list *root_el) 533 struct ocfs2_extent_list *root_el,
534 ocfs2_journal_access_func access)
525{ 535{
526 struct ocfs2_path *path; 536 struct ocfs2_path *path;
527 537
@@ -533,11 +543,48 @@ static struct ocfs2_path *ocfs2_new_path(struct buffer_head *root_bh,
533 get_bh(root_bh); 543 get_bh(root_bh);
534 path_root_bh(path) = root_bh; 544 path_root_bh(path) = root_bh;
535 path_root_el(path) = root_el; 545 path_root_el(path) = root_el;
546 path_root_access(path) = access;
536 } 547 }
537 548
538 return path; 549 return path;
539} 550}
540 551
552static struct ocfs2_path *ocfs2_new_path_from_path(struct ocfs2_path *path)
553{
554 return ocfs2_new_path(path_root_bh(path), path_root_el(path),
555 path_root_access(path));
556}
557
558static struct ocfs2_path *ocfs2_new_path_from_et(struct ocfs2_extent_tree *et)
559{
560 return ocfs2_new_path(et->et_root_bh, et->et_root_el,
561 et->et_root_journal_access);
562}
563
564/*
565 * Journal the buffer at depth idx. All idx>0 are extent_blocks,
566 * otherwise it's the root_access function.
567 *
568 * I don't like the way this function's name looks next to
569 * ocfs2_journal_access_path(), but I don't have a better one.
570 */
571static int ocfs2_path_bh_journal_access(handle_t *handle,
572 struct inode *inode,
573 struct ocfs2_path *path,
574 int idx)
575{
576 ocfs2_journal_access_func access = path_root_access(path);
577
578 if (!access)
579 access = ocfs2_journal_access;
580
581 if (idx)
582 access = ocfs2_journal_access_eb;
583
584 return access(handle, inode, path->p_node[idx].bh,
585 OCFS2_JOURNAL_ACCESS_WRITE);
586}
587
541/* 588/*
542 * Convenience function to journal all components in a path. 589 * Convenience function to journal all components in a path.
543 */ 590 */
@@ -550,8 +597,7 @@ static int ocfs2_journal_access_path(struct inode *inode, handle_t *handle,
550 goto out; 597 goto out;
551 598
552 for(i = 0; i < path_num_items(path); i++) { 599 for(i = 0; i < path_num_items(path); i++) {
553 ret = ocfs2_journal_access(handle, inode, path->p_node[i].bh, 600 ret = ocfs2_path_bh_journal_access(handle, inode, path, i);
554 OCFS2_JOURNAL_ACCESS_WRITE);
555 if (ret < 0) { 601 if (ret < 0) {
556 mlog_errno(ret); 602 mlog_errno(ret);
557 goto out; 603 goto out;
@@ -686,6 +732,80 @@ struct ocfs2_merge_ctxt {
686 int c_split_covers_rec; 732 int c_split_covers_rec;
687}; 733};
688 734
735static int ocfs2_validate_extent_block(struct super_block *sb,
736 struct buffer_head *bh)
737{
738 int rc;
739 struct ocfs2_extent_block *eb =
740 (struct ocfs2_extent_block *)bh->b_data;
741
742 mlog(0, "Validating extent block %llu\n",
743 (unsigned long long)bh->b_blocknr);
744
745 BUG_ON(!buffer_uptodate(bh));
746
747 /*
748 * If the ecc fails, we return the error but otherwise
749 * leave the filesystem running. We know any error is
750 * local to this block.
751 */
752 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &eb->h_check);
753 if (rc) {
754 mlog(ML_ERROR, "Checksum failed for extent block %llu\n",
755 (unsigned long long)bh->b_blocknr);
756 return rc;
757 }
758
759 /*
760 * Errors after here are fatal.
761 */
762
763 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
764 ocfs2_error(sb,
765 "Extent block #%llu has bad signature %.*s",
766 (unsigned long long)bh->b_blocknr, 7,
767 eb->h_signature);
768 return -EINVAL;
769 }
770
771 if (le64_to_cpu(eb->h_blkno) != bh->b_blocknr) {
772 ocfs2_error(sb,
773 "Extent block #%llu has an invalid h_blkno "
774 "of %llu",
775 (unsigned long long)bh->b_blocknr,
776 (unsigned long long)le64_to_cpu(eb->h_blkno));
777 return -EINVAL;
778 }
779
780 if (le32_to_cpu(eb->h_fs_generation) != OCFS2_SB(sb)->fs_generation) {
781 ocfs2_error(sb,
782 "Extent block #%llu has an invalid "
783 "h_fs_generation of #%u",
784 (unsigned long long)bh->b_blocknr,
785 le32_to_cpu(eb->h_fs_generation));
786 return -EINVAL;
787 }
788
789 return 0;
790}
791
792int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,
793 struct buffer_head **bh)
794{
795 int rc;
796 struct buffer_head *tmp = *bh;
797
798 rc = ocfs2_read_block(inode, eb_blkno, &tmp,
799 ocfs2_validate_extent_block);
800
801 /* If ocfs2_read_block() got us a new bh, pass it up. */
802 if (!rc && !*bh)
803 *bh = tmp;
804
805 return rc;
806}
807
808
689/* 809/*
690 * How many free extents have we got before we need more meta data? 810 * How many free extents have we got before we need more meta data?
691 */ 811 */
@@ -705,8 +825,7 @@ int ocfs2_num_free_extents(struct ocfs2_super *osb,
705 last_eb_blk = ocfs2_et_get_last_eb_blk(et); 825 last_eb_blk = ocfs2_et_get_last_eb_blk(et);
706 826
707 if (last_eb_blk) { 827 if (last_eb_blk) {
708 retval = ocfs2_read_block(inode, last_eb_blk, 828 retval = ocfs2_read_extent_block(inode, last_eb_blk, &eb_bh);
709 &eb_bh);
710 if (retval < 0) { 829 if (retval < 0) {
711 mlog_errno(retval); 830 mlog_errno(retval);
712 goto bail; 831 goto bail;
@@ -768,8 +887,8 @@ static int ocfs2_create_new_meta_bhs(struct ocfs2_super *osb,
768 } 887 }
769 ocfs2_set_new_buffer_uptodate(inode, bhs[i]); 888 ocfs2_set_new_buffer_uptodate(inode, bhs[i]);
770 889
771 status = ocfs2_journal_access(handle, inode, bhs[i], 890 status = ocfs2_journal_access_eb(handle, inode, bhs[i],
772 OCFS2_JOURNAL_ACCESS_CREATE); 891 OCFS2_JOURNAL_ACCESS_CREATE);
773 if (status < 0) { 892 if (status < 0) {
774 mlog_errno(status); 893 mlog_errno(status);
775 goto bail; 894 goto bail;
@@ -908,15 +1027,12 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
908 for(i = 0; i < new_blocks; i++) { 1027 for(i = 0; i < new_blocks; i++) {
909 bh = new_eb_bhs[i]; 1028 bh = new_eb_bhs[i];
910 eb = (struct ocfs2_extent_block *) bh->b_data; 1029 eb = (struct ocfs2_extent_block *) bh->b_data;
911 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { 1030 /* ocfs2_create_new_meta_bhs() should create it right! */
912 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb); 1031 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb));
913 status = -EIO;
914 goto bail;
915 }
916 eb_el = &eb->h_list; 1032 eb_el = &eb->h_list;
917 1033
918 status = ocfs2_journal_access(handle, inode, bh, 1034 status = ocfs2_journal_access_eb(handle, inode, bh,
919 OCFS2_JOURNAL_ACCESS_CREATE); 1035 OCFS2_JOURNAL_ACCESS_CREATE);
920 if (status < 0) { 1036 if (status < 0) {
921 mlog_errno(status); 1037 mlog_errno(status);
922 goto bail; 1038 goto bail;
@@ -955,21 +1071,21 @@ static int ocfs2_add_branch(struct ocfs2_super *osb,
955 * journal_dirty erroring as it won't unless we've aborted the 1071 * journal_dirty erroring as it won't unless we've aborted the
956 * handle (in which case we would never be here) so reserving 1072 * handle (in which case we would never be here) so reserving
957 * the write with journal_access is all we need to do. */ 1073 * the write with journal_access is all we need to do. */
958 status = ocfs2_journal_access(handle, inode, *last_eb_bh, 1074 status = ocfs2_journal_access_eb(handle, inode, *last_eb_bh,
959 OCFS2_JOURNAL_ACCESS_WRITE); 1075 OCFS2_JOURNAL_ACCESS_WRITE);
960 if (status < 0) { 1076 if (status < 0) {
961 mlog_errno(status); 1077 mlog_errno(status);
962 goto bail; 1078 goto bail;
963 } 1079 }
964 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 1080 status = ocfs2_et_root_journal_access(handle, inode, et,
965 OCFS2_JOURNAL_ACCESS_WRITE); 1081 OCFS2_JOURNAL_ACCESS_WRITE);
966 if (status < 0) { 1082 if (status < 0) {
967 mlog_errno(status); 1083 mlog_errno(status);
968 goto bail; 1084 goto bail;
969 } 1085 }
970 if (eb_bh) { 1086 if (eb_bh) {
971 status = ocfs2_journal_access(handle, inode, eb_bh, 1087 status = ocfs2_journal_access_eb(handle, inode, eb_bh,
972 OCFS2_JOURNAL_ACCESS_WRITE); 1088 OCFS2_JOURNAL_ACCESS_WRITE);
973 if (status < 0) { 1089 if (status < 0) {
974 mlog_errno(status); 1090 mlog_errno(status);
975 goto bail; 1091 goto bail;
@@ -1052,17 +1168,14 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1052 } 1168 }
1053 1169
1054 eb = (struct ocfs2_extent_block *) new_eb_bh->b_data; 1170 eb = (struct ocfs2_extent_block *) new_eb_bh->b_data;
1055 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { 1171 /* ocfs2_create_new_meta_bhs() should create it right! */
1056 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb); 1172 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb));
1057 status = -EIO;
1058 goto bail;
1059 }
1060 1173
1061 eb_el = &eb->h_list; 1174 eb_el = &eb->h_list;
1062 root_el = et->et_root_el; 1175 root_el = et->et_root_el;
1063 1176
1064 status = ocfs2_journal_access(handle, inode, new_eb_bh, 1177 status = ocfs2_journal_access_eb(handle, inode, new_eb_bh,
1065 OCFS2_JOURNAL_ACCESS_CREATE); 1178 OCFS2_JOURNAL_ACCESS_CREATE);
1066 if (status < 0) { 1179 if (status < 0) {
1067 mlog_errno(status); 1180 mlog_errno(status);
1068 goto bail; 1181 goto bail;
@@ -1080,8 +1193,8 @@ static int ocfs2_shift_tree_depth(struct ocfs2_super *osb,
1080 goto bail; 1193 goto bail;
1081 } 1194 }
1082 1195
1083 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 1196 status = ocfs2_et_root_journal_access(handle, inode, et,
1084 OCFS2_JOURNAL_ACCESS_WRITE); 1197 OCFS2_JOURNAL_ACCESS_WRITE);
1085 if (status < 0) { 1198 if (status < 0) {
1086 mlog_errno(status); 1199 mlog_errno(status);
1087 goto bail; 1200 goto bail;
@@ -1176,18 +1289,13 @@ static int ocfs2_find_branch_target(struct ocfs2_super *osb,
1176 brelse(bh); 1289 brelse(bh);
1177 bh = NULL; 1290 bh = NULL;
1178 1291
1179 status = ocfs2_read_block(inode, blkno, &bh); 1292 status = ocfs2_read_extent_block(inode, blkno, &bh);
1180 if (status < 0) { 1293 if (status < 0) {
1181 mlog_errno(status); 1294 mlog_errno(status);
1182 goto bail; 1295 goto bail;
1183 } 1296 }
1184 1297
1185 eb = (struct ocfs2_extent_block *) bh->b_data; 1298 eb = (struct ocfs2_extent_block *) bh->b_data;
1186 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
1187 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
1188 status = -EIO;
1189 goto bail;
1190 }
1191 el = &eb->h_list; 1299 el = &eb->h_list;
1192 1300
1193 if (le16_to_cpu(el->l_next_free_rec) < 1301 if (le16_to_cpu(el->l_next_free_rec) <
@@ -1540,7 +1648,7 @@ static int __ocfs2_find_path(struct inode *inode,
1540 1648
1541 brelse(bh); 1649 brelse(bh);
1542 bh = NULL; 1650 bh = NULL;
1543 ret = ocfs2_read_block(inode, blkno, &bh); 1651 ret = ocfs2_read_extent_block(inode, blkno, &bh);
1544 if (ret) { 1652 if (ret) {
1545 mlog_errno(ret); 1653 mlog_errno(ret);
1546 goto out; 1654 goto out;
@@ -1548,11 +1656,6 @@ static int __ocfs2_find_path(struct inode *inode,
1548 1656
1549 eb = (struct ocfs2_extent_block *) bh->b_data; 1657 eb = (struct ocfs2_extent_block *) bh->b_data;
1550 el = &eb->h_list; 1658 el = &eb->h_list;
1551 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
1552 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
1553 ret = -EIO;
1554 goto out;
1555 }
1556 1659
1557 if (le16_to_cpu(el->l_next_free_rec) > 1660 if (le16_to_cpu(el->l_next_free_rec) >
1558 le16_to_cpu(el->l_count)) { 1661 le16_to_cpu(el->l_count)) {
@@ -1860,25 +1963,23 @@ static int ocfs2_rotate_subtree_right(struct inode *inode,
1860 root_bh = left_path->p_node[subtree_index].bh; 1963 root_bh = left_path->p_node[subtree_index].bh;
1861 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 1964 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
1862 1965
1863 ret = ocfs2_journal_access(handle, inode, root_bh, 1966 ret = ocfs2_path_bh_journal_access(handle, inode, right_path,
1864 OCFS2_JOURNAL_ACCESS_WRITE); 1967 subtree_index);
1865 if (ret) { 1968 if (ret) {
1866 mlog_errno(ret); 1969 mlog_errno(ret);
1867 goto out; 1970 goto out;
1868 } 1971 }
1869 1972
1870 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { 1973 for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
1871 ret = ocfs2_journal_access(handle, inode, 1974 ret = ocfs2_path_bh_journal_access(handle, inode,
1872 right_path->p_node[i].bh, 1975 right_path, i);
1873 OCFS2_JOURNAL_ACCESS_WRITE);
1874 if (ret) { 1976 if (ret) {
1875 mlog_errno(ret); 1977 mlog_errno(ret);
1876 goto out; 1978 goto out;
1877 } 1979 }
1878 1980
1879 ret = ocfs2_journal_access(handle, inode, 1981 ret = ocfs2_path_bh_journal_access(handle, inode,
1880 left_path->p_node[i].bh, 1982 left_path, i);
1881 OCFS2_JOURNAL_ACCESS_WRITE);
1882 if (ret) { 1983 if (ret) {
1883 mlog_errno(ret); 1984 mlog_errno(ret);
1884 goto out; 1985 goto out;
@@ -2102,8 +2203,7 @@ static int ocfs2_rotate_tree_right(struct inode *inode,
2102 2203
2103 *ret_left_path = NULL; 2204 *ret_left_path = NULL;
2104 2205
2105 left_path = ocfs2_new_path(path_root_bh(right_path), 2206 left_path = ocfs2_new_path_from_path(right_path);
2106 path_root_el(right_path));
2107 if (!left_path) { 2207 if (!left_path) {
2108 ret = -ENOMEM; 2208 ret = -ENOMEM;
2109 mlog_errno(ret); 2209 mlog_errno(ret);
@@ -2398,9 +2498,9 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2398 return -EAGAIN; 2498 return -EAGAIN;
2399 2499
2400 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) { 2500 if (le16_to_cpu(right_leaf_el->l_next_free_rec) > 1) {
2401 ret = ocfs2_journal_access(handle, inode, 2501 ret = ocfs2_journal_access_eb(handle, inode,
2402 path_leaf_bh(right_path), 2502 path_leaf_bh(right_path),
2403 OCFS2_JOURNAL_ACCESS_WRITE); 2503 OCFS2_JOURNAL_ACCESS_WRITE);
2404 if (ret) { 2504 if (ret) {
2405 mlog_errno(ret); 2505 mlog_errno(ret);
2406 goto out; 2506 goto out;
@@ -2417,8 +2517,8 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2417 * We have to update i_last_eb_blk during the meta 2517 * We have to update i_last_eb_blk during the meta
2418 * data delete. 2518 * data delete.
2419 */ 2519 */
2420 ret = ocfs2_journal_access(handle, inode, et_root_bh, 2520 ret = ocfs2_et_root_journal_access(handle, inode, et,
2421 OCFS2_JOURNAL_ACCESS_WRITE); 2521 OCFS2_JOURNAL_ACCESS_WRITE);
2422 if (ret) { 2522 if (ret) {
2423 mlog_errno(ret); 2523 mlog_errno(ret);
2424 goto out; 2524 goto out;
@@ -2433,25 +2533,23 @@ static int ocfs2_rotate_subtree_left(struct inode *inode, handle_t *handle,
2433 */ 2533 */
2434 BUG_ON(right_has_empty && !del_right_subtree); 2534 BUG_ON(right_has_empty && !del_right_subtree);
2435 2535
2436 ret = ocfs2_journal_access(handle, inode, root_bh, 2536 ret = ocfs2_path_bh_journal_access(handle, inode, right_path,
2437 OCFS2_JOURNAL_ACCESS_WRITE); 2537 subtree_index);
2438 if (ret) { 2538 if (ret) {
2439 mlog_errno(ret); 2539 mlog_errno(ret);
2440 goto out; 2540 goto out;
2441 } 2541 }
2442 2542
2443 for(i = subtree_index + 1; i < path_num_items(right_path); i++) { 2543 for(i = subtree_index + 1; i < path_num_items(right_path); i++) {
2444 ret = ocfs2_journal_access(handle, inode, 2544 ret = ocfs2_path_bh_journal_access(handle, inode,
2445 right_path->p_node[i].bh, 2545 right_path, i);
2446 OCFS2_JOURNAL_ACCESS_WRITE);
2447 if (ret) { 2546 if (ret) {
2448 mlog_errno(ret); 2547 mlog_errno(ret);
2449 goto out; 2548 goto out;
2450 } 2549 }
2451 2550
2452 ret = ocfs2_journal_access(handle, inode, 2551 ret = ocfs2_path_bh_journal_access(handle, inode,
2453 left_path->p_node[i].bh, 2552 left_path, i);
2454 OCFS2_JOURNAL_ACCESS_WRITE);
2455 if (ret) { 2553 if (ret) {
2456 mlog_errno(ret); 2554 mlog_errno(ret);
2457 goto out; 2555 goto out;
@@ -2596,16 +2694,17 @@ out:
2596 2694
2597static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode, 2695static int ocfs2_rotate_rightmost_leaf_left(struct inode *inode,
2598 handle_t *handle, 2696 handle_t *handle,
2599 struct buffer_head *bh, 2697 struct ocfs2_path *path)
2600 struct ocfs2_extent_list *el)
2601{ 2698{
2602 int ret; 2699 int ret;
2700 struct buffer_head *bh = path_leaf_bh(path);
2701 struct ocfs2_extent_list *el = path_leaf_el(path);
2603 2702
2604 if (!ocfs2_is_empty_extent(&el->l_recs[0])) 2703 if (!ocfs2_is_empty_extent(&el->l_recs[0]))
2605 return 0; 2704 return 0;
2606 2705
2607 ret = ocfs2_journal_access(handle, inode, bh, 2706 ret = ocfs2_path_bh_journal_access(handle, inode, path,
2608 OCFS2_JOURNAL_ACCESS_WRITE); 2707 path_num_items(path) - 1);
2609 if (ret) { 2708 if (ret) {
2610 mlog_errno(ret); 2709 mlog_errno(ret);
2611 goto out; 2710 goto out;
@@ -2644,8 +2743,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2644 goto out; 2743 goto out;
2645 } 2744 }
2646 2745
2647 left_path = ocfs2_new_path(path_root_bh(path), 2746 left_path = ocfs2_new_path_from_path(path);
2648 path_root_el(path));
2649 if (!left_path) { 2747 if (!left_path) {
2650 ret = -ENOMEM; 2748 ret = -ENOMEM;
2651 mlog_errno(ret); 2749 mlog_errno(ret);
@@ -2654,8 +2752,7 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2654 2752
2655 ocfs2_cp_path(left_path, path); 2753 ocfs2_cp_path(left_path, path);
2656 2754
2657 right_path = ocfs2_new_path(path_root_bh(path), 2755 right_path = ocfs2_new_path_from_path(path);
2658 path_root_el(path));
2659 if (!right_path) { 2756 if (!right_path) {
2660 ret = -ENOMEM; 2757 ret = -ENOMEM;
2661 mlog_errno(ret); 2758 mlog_errno(ret);
@@ -2689,9 +2786,8 @@ static int __ocfs2_rotate_tree_left(struct inode *inode,
2689 * Caller might still want to make changes to the 2786 * Caller might still want to make changes to the
2690 * tree root, so re-add it to the journal here. 2787 * tree root, so re-add it to the journal here.
2691 */ 2788 */
2692 ret = ocfs2_journal_access(handle, inode, 2789 ret = ocfs2_path_bh_journal_access(handle, inode,
2693 path_root_bh(left_path), 2790 left_path, 0);
2694 OCFS2_JOURNAL_ACCESS_WRITE);
2695 if (ret) { 2791 if (ret) {
2696 mlog_errno(ret); 2792 mlog_errno(ret);
2697 goto out; 2793 goto out;
@@ -2785,8 +2881,7 @@ static int ocfs2_remove_rightmost_path(struct inode *inode, handle_t *handle,
2785 * We have a path to the left of this one - it needs 2881 * We have a path to the left of this one - it needs
2786 * an update too. 2882 * an update too.
2787 */ 2883 */
2788 left_path = ocfs2_new_path(path_root_bh(path), 2884 left_path = ocfs2_new_path_from_path(path);
2789 path_root_el(path));
2790 if (!left_path) { 2885 if (!left_path) {
2791 ret = -ENOMEM; 2886 ret = -ENOMEM;
2792 mlog_errno(ret); 2887 mlog_errno(ret);
@@ -2875,8 +2970,7 @@ rightmost_no_delete:
2875 * it up front. 2970 * it up front.
2876 */ 2971 */
2877 ret = ocfs2_rotate_rightmost_leaf_left(inode, handle, 2972 ret = ocfs2_rotate_rightmost_leaf_left(inode, handle,
2878 path_leaf_bh(path), 2973 path);
2879 path_leaf_el(path));
2880 if (ret) 2974 if (ret)
2881 mlog_errno(ret); 2975 mlog_errno(ret);
2882 goto out; 2976 goto out;
@@ -3027,8 +3121,7 @@ static int ocfs2_get_right_path(struct inode *inode,
3027 /* This function shouldn't be called for the rightmost leaf. */ 3121 /* This function shouldn't be called for the rightmost leaf. */
3028 BUG_ON(right_cpos == 0); 3122 BUG_ON(right_cpos == 0);
3029 3123
3030 right_path = ocfs2_new_path(path_root_bh(left_path), 3124 right_path = ocfs2_new_path_from_path(left_path);
3031 path_root_el(left_path));
3032 if (!right_path) { 3125 if (!right_path) {
3033 ret = -ENOMEM; 3126 ret = -ENOMEM;
3034 mlog_errno(ret); 3127 mlog_errno(ret);
@@ -3111,8 +3204,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3111 root_bh = left_path->p_node[subtree_index].bh; 3204 root_bh = left_path->p_node[subtree_index].bh;
3112 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3205 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3113 3206
3114 ret = ocfs2_journal_access(handle, inode, root_bh, 3207 ret = ocfs2_path_bh_journal_access(handle, inode, right_path,
3115 OCFS2_JOURNAL_ACCESS_WRITE); 3208 subtree_index);
3116 if (ret) { 3209 if (ret) {
3117 mlog_errno(ret); 3210 mlog_errno(ret);
3118 goto out; 3211 goto out;
@@ -3120,17 +3213,15 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3120 3213
3121 for (i = subtree_index + 1; 3214 for (i = subtree_index + 1;
3122 i < path_num_items(right_path); i++) { 3215 i < path_num_items(right_path); i++) {
3123 ret = ocfs2_journal_access(handle, inode, 3216 ret = ocfs2_path_bh_journal_access(handle, inode,
3124 right_path->p_node[i].bh, 3217 right_path, i);
3125 OCFS2_JOURNAL_ACCESS_WRITE);
3126 if (ret) { 3218 if (ret) {
3127 mlog_errno(ret); 3219 mlog_errno(ret);
3128 goto out; 3220 goto out;
3129 } 3221 }
3130 3222
3131 ret = ocfs2_journal_access(handle, inode, 3223 ret = ocfs2_path_bh_journal_access(handle, inode,
3132 left_path->p_node[i].bh, 3224 left_path, i);
3133 OCFS2_JOURNAL_ACCESS_WRITE);
3134 if (ret) { 3225 if (ret) {
3135 mlog_errno(ret); 3226 mlog_errno(ret);
3136 goto out; 3227 goto out;
@@ -3142,8 +3233,8 @@ static int ocfs2_merge_rec_right(struct inode *inode,
3142 right_rec = &el->l_recs[index + 1]; 3233 right_rec = &el->l_recs[index + 1];
3143 } 3234 }
3144 3235
3145 ret = ocfs2_journal_access(handle, inode, bh, 3236 ret = ocfs2_path_bh_journal_access(handle, inode, left_path,
3146 OCFS2_JOURNAL_ACCESS_WRITE); 3237 path_num_items(left_path) - 1);
3147 if (ret) { 3238 if (ret) {
3148 mlog_errno(ret); 3239 mlog_errno(ret);
3149 goto out; 3240 goto out;
@@ -3199,8 +3290,7 @@ static int ocfs2_get_left_path(struct inode *inode,
3199 /* This function shouldn't be called for the leftmost leaf. */ 3290 /* This function shouldn't be called for the leftmost leaf. */
3200 BUG_ON(left_cpos == 0); 3291 BUG_ON(left_cpos == 0);
3201 3292
3202 left_path = ocfs2_new_path(path_root_bh(right_path), 3293 left_path = ocfs2_new_path_from_path(right_path);
3203 path_root_el(right_path));
3204 if (!left_path) { 3294 if (!left_path) {
3205 ret = -ENOMEM; 3295 ret = -ENOMEM;
3206 mlog_errno(ret); 3296 mlog_errno(ret);
@@ -3283,8 +3373,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3283 root_bh = left_path->p_node[subtree_index].bh; 3373 root_bh = left_path->p_node[subtree_index].bh;
3284 BUG_ON(root_bh != right_path->p_node[subtree_index].bh); 3374 BUG_ON(root_bh != right_path->p_node[subtree_index].bh);
3285 3375
3286 ret = ocfs2_journal_access(handle, inode, root_bh, 3376 ret = ocfs2_path_bh_journal_access(handle, inode, right_path,
3287 OCFS2_JOURNAL_ACCESS_WRITE); 3377 subtree_index);
3288 if (ret) { 3378 if (ret) {
3289 mlog_errno(ret); 3379 mlog_errno(ret);
3290 goto out; 3380 goto out;
@@ -3292,17 +3382,15 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3292 3382
3293 for (i = subtree_index + 1; 3383 for (i = subtree_index + 1;
3294 i < path_num_items(right_path); i++) { 3384 i < path_num_items(right_path); i++) {
3295 ret = ocfs2_journal_access(handle, inode, 3385 ret = ocfs2_path_bh_journal_access(handle, inode,
3296 right_path->p_node[i].bh, 3386 right_path, i);
3297 OCFS2_JOURNAL_ACCESS_WRITE);
3298 if (ret) { 3387 if (ret) {
3299 mlog_errno(ret); 3388 mlog_errno(ret);
3300 goto out; 3389 goto out;
3301 } 3390 }
3302 3391
3303 ret = ocfs2_journal_access(handle, inode, 3392 ret = ocfs2_path_bh_journal_access(handle, inode,
3304 left_path->p_node[i].bh, 3393 left_path, i);
3305 OCFS2_JOURNAL_ACCESS_WRITE);
3306 if (ret) { 3394 if (ret) {
3307 mlog_errno(ret); 3395 mlog_errno(ret);
3308 goto out; 3396 goto out;
@@ -3314,8 +3402,8 @@ static int ocfs2_merge_rec_left(struct inode *inode,
3314 has_empty_extent = 1; 3402 has_empty_extent = 1;
3315 } 3403 }
3316 3404
3317 ret = ocfs2_journal_access(handle, inode, bh, 3405 ret = ocfs2_path_bh_journal_access(handle, inode, right_path,
3318 OCFS2_JOURNAL_ACCESS_WRITE); 3406 path_num_items(right_path) - 1);
3319 if (ret) { 3407 if (ret) {
3320 mlog_errno(ret); 3408 mlog_errno(ret);
3321 goto out; 3409 goto out;
@@ -3732,8 +3820,7 @@ static int ocfs2_append_rec_to_path(struct inode *inode, handle_t *handle,
3732 * leftmost leaf. 3820 * leftmost leaf.
3733 */ 3821 */
3734 if (left_cpos) { 3822 if (left_cpos) {
3735 left_path = ocfs2_new_path(path_root_bh(right_path), 3823 left_path = ocfs2_new_path_from_path(right_path);
3736 path_root_el(right_path));
3737 if (!left_path) { 3824 if (!left_path) {
3738 ret = -ENOMEM; 3825 ret = -ENOMEM;
3739 mlog_errno(ret); 3826 mlog_errno(ret);
@@ -3958,8 +4045,8 @@ static int ocfs2_do_insert_extent(struct inode *inode,
3958 4045
3959 el = et->et_root_el; 4046 el = et->et_root_el;
3960 4047
3961 ret = ocfs2_journal_access(handle, inode, et->et_root_bh, 4048 ret = ocfs2_et_root_journal_access(handle, inode, et,
3962 OCFS2_JOURNAL_ACCESS_WRITE); 4049 OCFS2_JOURNAL_ACCESS_WRITE);
3963 if (ret) { 4050 if (ret) {
3964 mlog_errno(ret); 4051 mlog_errno(ret);
3965 goto out; 4052 goto out;
@@ -3970,7 +4057,7 @@ static int ocfs2_do_insert_extent(struct inode *inode,
3970 goto out_update_clusters; 4057 goto out_update_clusters;
3971 } 4058 }
3972 4059
3973 right_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4060 right_path = ocfs2_new_path_from_et(et);
3974 if (!right_path) { 4061 if (!right_path) {
3975 ret = -ENOMEM; 4062 ret = -ENOMEM;
3976 mlog_errno(ret); 4063 mlog_errno(ret);
@@ -4020,8 +4107,8 @@ static int ocfs2_do_insert_extent(struct inode *inode,
4020 * ocfs2_rotate_tree_right() might have extended the 4107 * ocfs2_rotate_tree_right() might have extended the
4021 * transaction without re-journaling our tree root. 4108 * transaction without re-journaling our tree root.
4022 */ 4109 */
4023 ret = ocfs2_journal_access(handle, inode, et->et_root_bh, 4110 ret = ocfs2_et_root_journal_access(handle, inode, et,
4024 OCFS2_JOURNAL_ACCESS_WRITE); 4111 OCFS2_JOURNAL_ACCESS_WRITE);
4025 if (ret) { 4112 if (ret) {
4026 mlog_errno(ret); 4113 mlog_errno(ret);
4027 goto out; 4114 goto out;
@@ -4082,8 +4169,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4082 goto out; 4169 goto out;
4083 4170
4084 if (left_cpos != 0) { 4171 if (left_cpos != 0) {
4085 left_path = ocfs2_new_path(path_root_bh(path), 4172 left_path = ocfs2_new_path_from_path(path);
4086 path_root_el(path));
4087 if (!left_path) 4173 if (!left_path)
4088 goto out; 4174 goto out;
4089 4175
@@ -4097,8 +4183,15 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4097 le16_to_cpu(new_el->l_count)) { 4183 le16_to_cpu(new_el->l_count)) {
4098 bh = path_leaf_bh(left_path); 4184 bh = path_leaf_bh(left_path);
4099 eb = (struct ocfs2_extent_block *)bh->b_data; 4185 eb = (struct ocfs2_extent_block *)bh->b_data;
4100 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, 4186 ocfs2_error(inode->i_sb,
4101 eb); 4187 "Extent block #%llu has an "
4188 "invalid l_next_free_rec of "
4189 "%d. It should have "
4190 "matched the l_count of %d",
4191 (unsigned long long)le64_to_cpu(eb->h_blkno),
4192 le16_to_cpu(new_el->l_next_free_rec),
4193 le16_to_cpu(new_el->l_count));
4194 status = -EINVAL;
4102 goto out; 4195 goto out;
4103 } 4196 }
4104 rec = &new_el->l_recs[ 4197 rec = &new_el->l_recs[
@@ -4132,8 +4225,7 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4132 if (right_cpos == 0) 4225 if (right_cpos == 0)
4133 goto out; 4226 goto out;
4134 4227
4135 right_path = ocfs2_new_path(path_root_bh(path), 4228 right_path = ocfs2_new_path_from_path(path);
4136 path_root_el(path));
4137 if (!right_path) 4229 if (!right_path)
4138 goto out; 4230 goto out;
4139 4231
@@ -4147,8 +4239,12 @@ ocfs2_figure_merge_contig_type(struct inode *inode, struct ocfs2_path *path,
4147 if (le16_to_cpu(new_el->l_next_free_rec) <= 1) { 4239 if (le16_to_cpu(new_el->l_next_free_rec) <= 1) {
4148 bh = path_leaf_bh(right_path); 4240 bh = path_leaf_bh(right_path);
4149 eb = (struct ocfs2_extent_block *)bh->b_data; 4241 eb = (struct ocfs2_extent_block *)bh->b_data;
4150 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, 4242 ocfs2_error(inode->i_sb,
4151 eb); 4243 "Extent block #%llu has an "
4244 "invalid l_next_free_rec of %d",
4245 (unsigned long long)le64_to_cpu(eb->h_blkno),
4246 le16_to_cpu(new_el->l_next_free_rec));
4247 status = -EINVAL;
4152 goto out; 4248 goto out;
4153 } 4249 }
4154 rec = &new_el->l_recs[1]; 4250 rec = &new_el->l_recs[1];
@@ -4294,7 +4390,9 @@ static int ocfs2_figure_insert_type(struct inode *inode,
4294 * ocfs2_figure_insert_type() and ocfs2_add_branch() 4390 * ocfs2_figure_insert_type() and ocfs2_add_branch()
4295 * may want it later. 4391 * may want it later.
4296 */ 4392 */
4297 ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), &bh); 4393 ret = ocfs2_read_extent_block(inode,
4394 ocfs2_et_get_last_eb_blk(et),
4395 &bh);
4298 if (ret) { 4396 if (ret) {
4299 mlog_exit(ret); 4397 mlog_exit(ret);
4300 goto out; 4398 goto out;
@@ -4320,7 +4418,7 @@ static int ocfs2_figure_insert_type(struct inode *inode,
4320 return 0; 4418 return 0;
4321 } 4419 }
4322 4420
4323 path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4421 path = ocfs2_new_path_from_et(et);
4324 if (!path) { 4422 if (!path) {
4325 ret = -ENOMEM; 4423 ret = -ENOMEM;
4326 mlog_errno(ret); 4424 mlog_errno(ret);
@@ -4531,9 +4629,9 @@ int ocfs2_add_clusters_in_btree(struct ocfs2_super *osb,
4531 4629
4532 BUG_ON(num_bits > clusters_to_add); 4630 BUG_ON(num_bits > clusters_to_add);
4533 4631
4534 /* reserve our write early -- insert_extent may update the inode */ 4632 /* reserve our write early -- insert_extent may update the tree root */
4535 status = ocfs2_journal_access(handle, inode, et->et_root_bh, 4633 status = ocfs2_et_root_journal_access(handle, inode, et,
4536 OCFS2_JOURNAL_ACCESS_WRITE); 4634 OCFS2_JOURNAL_ACCESS_WRITE);
4537 if (status < 0) { 4635 if (status < 0) {
4538 mlog_errno(status); 4636 mlog_errno(status);
4539 goto leave; 4637 goto leave;
@@ -4760,20 +4858,15 @@ static int __ocfs2_mark_extent_written(struct inode *inode,
4760 if (path->p_tree_depth) { 4858 if (path->p_tree_depth) {
4761 struct ocfs2_extent_block *eb; 4859 struct ocfs2_extent_block *eb;
4762 4860
4763 ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), 4861 ret = ocfs2_read_extent_block(inode,
4764 &last_eb_bh); 4862 ocfs2_et_get_last_eb_blk(et),
4863 &last_eb_bh);
4765 if (ret) { 4864 if (ret) {
4766 mlog_exit(ret); 4865 mlog_exit(ret);
4767 goto out; 4866 goto out;
4768 } 4867 }
4769 4868
4770 eb = (struct ocfs2_extent_block *) last_eb_bh->b_data; 4869 eb = (struct ocfs2_extent_block *) last_eb_bh->b_data;
4771 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
4772 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
4773 ret = -EROFS;
4774 goto out;
4775 }
4776
4777 rightmost_el = &eb->h_list; 4870 rightmost_el = &eb->h_list;
4778 } else 4871 } else
4779 rightmost_el = path_root_el(path); 4872 rightmost_el = path_root_el(path);
@@ -4854,7 +4947,7 @@ int ocfs2_mark_extent_written(struct inode *inode,
4854 if (et->et_ops == &ocfs2_dinode_et_ops) 4947 if (et->et_ops == &ocfs2_dinode_et_ops)
4855 ocfs2_extent_map_trunc(inode, 0); 4948 ocfs2_extent_map_trunc(inode, 0);
4856 4949
4857 left_path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 4950 left_path = ocfs2_new_path_from_et(et);
4858 if (!left_path) { 4951 if (!left_path) {
4859 ret = -ENOMEM; 4952 ret = -ENOMEM;
4860 mlog_errno(ret); 4953 mlog_errno(ret);
@@ -4918,8 +5011,9 @@ static int ocfs2_split_tree(struct inode *inode, struct ocfs2_extent_tree *et,
4918 5011
4919 depth = path->p_tree_depth; 5012 depth = path->p_tree_depth;
4920 if (depth > 0) { 5013 if (depth > 0) {
4921 ret = ocfs2_read_block(inode, ocfs2_et_get_last_eb_blk(et), 5014 ret = ocfs2_read_extent_block(inode,
4922 &last_eb_bh); 5015 ocfs2_et_get_last_eb_blk(et),
5016 &last_eb_bh);
4923 if (ret < 0) { 5017 if (ret < 0) {
4924 mlog_errno(ret); 5018 mlog_errno(ret);
4925 goto out; 5019 goto out;
@@ -5025,8 +5119,7 @@ static int ocfs2_truncate_rec(struct inode *inode, handle_t *handle,
5025 } 5119 }
5026 5120
5027 if (left_cpos && le16_to_cpu(el->l_next_free_rec) > 1) { 5121 if (left_cpos && le16_to_cpu(el->l_next_free_rec) > 1) {
5028 left_path = ocfs2_new_path(path_root_bh(path), 5122 left_path = ocfs2_new_path_from_path(path);
5029 path_root_el(path));
5030 if (!left_path) { 5123 if (!left_path) {
5031 ret = -ENOMEM; 5124 ret = -ENOMEM;
5032 mlog_errno(ret); 5125 mlog_errno(ret);
@@ -5135,7 +5228,7 @@ int ocfs2_remove_extent(struct inode *inode,
5135 5228
5136 ocfs2_extent_map_trunc(inode, 0); 5229 ocfs2_extent_map_trunc(inode, 0);
5137 5230
5138 path = ocfs2_new_path(et->et_root_bh, et->et_root_el); 5231 path = ocfs2_new_path_from_et(et);
5139 if (!path) { 5232 if (!path) {
5140 ret = -ENOMEM; 5233 ret = -ENOMEM;
5141 mlog_errno(ret); 5234 mlog_errno(ret);
@@ -5255,6 +5348,78 @@ out:
5255 return ret; 5348 return ret;
5256} 5349}
5257 5350
5351int ocfs2_remove_btree_range(struct inode *inode,
5352 struct ocfs2_extent_tree *et,
5353 u32 cpos, u32 phys_cpos, u32 len,
5354 struct ocfs2_cached_dealloc_ctxt *dealloc)
5355{
5356 int ret;
5357 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
5358 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
5359 struct inode *tl_inode = osb->osb_tl_inode;
5360 handle_t *handle;
5361 struct ocfs2_alloc_context *meta_ac = NULL;
5362
5363 ret = ocfs2_lock_allocators(inode, et, 0, 1, NULL, &meta_ac);
5364 if (ret) {
5365 mlog_errno(ret);
5366 return ret;
5367 }
5368
5369 mutex_lock(&tl_inode->i_mutex);
5370
5371 if (ocfs2_truncate_log_needs_flush(osb)) {
5372 ret = __ocfs2_flush_truncate_log(osb);
5373 if (ret < 0) {
5374 mlog_errno(ret);
5375 goto out;
5376 }
5377 }
5378
5379 handle = ocfs2_start_trans(osb, ocfs2_remove_extent_credits(osb->sb));
5380 if (IS_ERR(handle)) {
5381 ret = PTR_ERR(handle);
5382 mlog_errno(ret);
5383 goto out;
5384 }
5385
5386 ret = ocfs2_et_root_journal_access(handle, inode, et,
5387 OCFS2_JOURNAL_ACCESS_WRITE);
5388 if (ret) {
5389 mlog_errno(ret);
5390 goto out;
5391 }
5392
5393 ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac,
5394 dealloc);
5395 if (ret) {
5396 mlog_errno(ret);
5397 goto out_commit;
5398 }
5399
5400 ocfs2_et_update_clusters(inode, et, -len);
5401
5402 ret = ocfs2_journal_dirty(handle, et->et_root_bh);
5403 if (ret) {
5404 mlog_errno(ret);
5405 goto out_commit;
5406 }
5407
5408 ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len);
5409 if (ret)
5410 mlog_errno(ret);
5411
5412out_commit:
5413 ocfs2_commit_trans(osb, handle);
5414out:
5415 mutex_unlock(&tl_inode->i_mutex);
5416
5417 if (meta_ac)
5418 ocfs2_free_alloc_context(meta_ac);
5419
5420 return ret;
5421}
5422
5258int ocfs2_truncate_log_needs_flush(struct ocfs2_super *osb) 5423int ocfs2_truncate_log_needs_flush(struct ocfs2_super *osb)
5259{ 5424{
5260 struct buffer_head *tl_bh = osb->osb_tl_bh; 5425 struct buffer_head *tl_bh = osb->osb_tl_bh;
@@ -5308,13 +5473,13 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5308 start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk); 5473 start_cluster = ocfs2_blocks_to_clusters(osb->sb, start_blk);
5309 5474
5310 di = (struct ocfs2_dinode *) tl_bh->b_data; 5475 di = (struct ocfs2_dinode *) tl_bh->b_data;
5311 tl = &di->id2.i_dealloc;
5312 if (!OCFS2_IS_VALID_DINODE(di)) {
5313 OCFS2_RO_ON_INVALID_DINODE(osb->sb, di);
5314 status = -EIO;
5315 goto bail;
5316 }
5317 5476
5477 /* tl_bh is loaded from ocfs2_truncate_log_init(). It's validated
5478 * by the underlying call to ocfs2_read_inode_block(), so any
5479 * corruption is a code bug */
5480 BUG_ON(!OCFS2_IS_VALID_DINODE(di));
5481
5482 tl = &di->id2.i_dealloc;
5318 tl_count = le16_to_cpu(tl->tl_count); 5483 tl_count = le16_to_cpu(tl->tl_count);
5319 mlog_bug_on_msg(tl_count > ocfs2_truncate_recs_per_inode(osb->sb) || 5484 mlog_bug_on_msg(tl_count > ocfs2_truncate_recs_per_inode(osb->sb) ||
5320 tl_count == 0, 5485 tl_count == 0,
@@ -5332,8 +5497,8 @@ int ocfs2_truncate_log_append(struct ocfs2_super *osb,
5332 goto bail; 5497 goto bail;
5333 } 5498 }
5334 5499
5335 status = ocfs2_journal_access(handle, tl_inode, tl_bh, 5500 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh,
5336 OCFS2_JOURNAL_ACCESS_WRITE); 5501 OCFS2_JOURNAL_ACCESS_WRITE);
5337 if (status < 0) { 5502 if (status < 0) {
5338 mlog_errno(status); 5503 mlog_errno(status);
5339 goto bail; 5504 goto bail;
@@ -5394,8 +5559,8 @@ static int ocfs2_replay_truncate_records(struct ocfs2_super *osb,
5394 while (i >= 0) { 5559 while (i >= 0) {
5395 /* Caller has given us at least enough credits to 5560 /* Caller has given us at least enough credits to
5396 * update the truncate log dinode */ 5561 * update the truncate log dinode */
5397 status = ocfs2_journal_access(handle, tl_inode, tl_bh, 5562 status = ocfs2_journal_access_di(handle, tl_inode, tl_bh,
5398 OCFS2_JOURNAL_ACCESS_WRITE); 5563 OCFS2_JOURNAL_ACCESS_WRITE);
5399 if (status < 0) { 5564 if (status < 0) {
5400 mlog_errno(status); 5565 mlog_errno(status);
5401 goto bail; 5566 goto bail;
@@ -5464,13 +5629,13 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb)
5464 BUG_ON(mutex_trylock(&tl_inode->i_mutex)); 5629 BUG_ON(mutex_trylock(&tl_inode->i_mutex));
5465 5630
5466 di = (struct ocfs2_dinode *) tl_bh->b_data; 5631 di = (struct ocfs2_dinode *) tl_bh->b_data;
5467 tl = &di->id2.i_dealloc;
5468 if (!OCFS2_IS_VALID_DINODE(di)) {
5469 OCFS2_RO_ON_INVALID_DINODE(osb->sb, di);
5470 status = -EIO;
5471 goto out;
5472 }
5473 5632
5633 /* tl_bh is loaded from ocfs2_truncate_log_init(). It's validated
5634 * by the underlying call to ocfs2_read_inode_block(), so any
5635 * corruption is a code bug */
5636 BUG_ON(!OCFS2_IS_VALID_DINODE(di));
5637
5638 tl = &di->id2.i_dealloc;
5474 num_to_flush = le16_to_cpu(tl->tl_used); 5639 num_to_flush = le16_to_cpu(tl->tl_used);
5475 mlog(0, "Flush %u records from truncate log #%llu\n", 5640 mlog(0, "Flush %u records from truncate log #%llu\n",
5476 num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno); 5641 num_to_flush, (unsigned long long)OCFS2_I(tl_inode)->ip_blkno);
@@ -5586,7 +5751,7 @@ static int ocfs2_get_truncate_log_info(struct ocfs2_super *osb,
5586 goto bail; 5751 goto bail;
5587 } 5752 }
5588 5753
5589 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh); 5754 status = ocfs2_read_inode_block(inode, &bh);
5590 if (status < 0) { 5755 if (status < 0) {
5591 iput(inode); 5756 iput(inode);
5592 mlog_errno(status); 5757 mlog_errno(status);
@@ -5625,13 +5790,13 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
5625 } 5790 }
5626 5791
5627 di = (struct ocfs2_dinode *) tl_bh->b_data; 5792 di = (struct ocfs2_dinode *) tl_bh->b_data;
5628 tl = &di->id2.i_dealloc;
5629 if (!OCFS2_IS_VALID_DINODE(di)) {
5630 OCFS2_RO_ON_INVALID_DINODE(tl_inode->i_sb, di);
5631 status = -EIO;
5632 goto bail;
5633 }
5634 5793
5794 /* tl_bh is loaded from ocfs2_get_truncate_log_info(). It's
5795 * validated by the underlying call to ocfs2_read_inode_block(),
5796 * so any corruption is a code bug */
5797 BUG_ON(!OCFS2_IS_VALID_DINODE(di));
5798
5799 tl = &di->id2.i_dealloc;
5635 if (le16_to_cpu(tl->tl_used)) { 5800 if (le16_to_cpu(tl->tl_used)) {
5636 mlog(0, "We'll have %u logs to recover\n", 5801 mlog(0, "We'll have %u logs to recover\n",
5637 le16_to_cpu(tl->tl_used)); 5802 le16_to_cpu(tl->tl_used));
@@ -5651,6 +5816,7 @@ int ocfs2_begin_truncate_log_recovery(struct ocfs2_super *osb,
5651 * tl_used. */ 5816 * tl_used. */
5652 tl->tl_used = 0; 5817 tl->tl_used = 0;
5653 5818
5819 ocfs2_compute_meta_ecc(osb->sb, tl_bh->b_data, &di->i_check);
5654 status = ocfs2_write_block(osb, tl_bh, tl_inode); 5820 status = ocfs2_write_block(osb, tl_bh, tl_inode);
5655 if (status < 0) { 5821 if (status < 0) {
5656 mlog_errno(status); 5822 mlog_errno(status);
@@ -5800,7 +5966,10 @@ int ocfs2_truncate_log_init(struct ocfs2_super *osb)
5800 */ 5966 */
5801 5967
5802/* 5968/*
5803 * Describes a single block free from a suballocator 5969 * Describe a single bit freed from a suballocator. For the block
5970 * suballocators, it represents one block. For the global cluster
5971 * allocator, it represents some clusters and free_bit indicates
5972 * clusters number.
5804 */ 5973 */
5805struct ocfs2_cached_block_free { 5974struct ocfs2_cached_block_free {
5806 struct ocfs2_cached_block_free *free_next; 5975 struct ocfs2_cached_block_free *free_next;
@@ -5815,10 +5984,10 @@ struct ocfs2_per_slot_free_list {
5815 struct ocfs2_cached_block_free *f_first; 5984 struct ocfs2_cached_block_free *f_first;
5816}; 5985};
5817 5986
5818static int ocfs2_free_cached_items(struct ocfs2_super *osb, 5987static int ocfs2_free_cached_blocks(struct ocfs2_super *osb,
5819 int sysfile_type, 5988 int sysfile_type,
5820 int slot, 5989 int slot,
5821 struct ocfs2_cached_block_free *head) 5990 struct ocfs2_cached_block_free *head)
5822{ 5991{
5823 int ret; 5992 int ret;
5824 u64 bg_blkno; 5993 u64 bg_blkno;
@@ -5893,6 +6062,82 @@ out:
5893 return ret; 6062 return ret;
5894} 6063}
5895 6064
6065int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
6066 u64 blkno, unsigned int bit)
6067{
6068 int ret = 0;
6069 struct ocfs2_cached_block_free *item;
6070
6071 item = kmalloc(sizeof(*item), GFP_NOFS);
6072 if (item == NULL) {
6073 ret = -ENOMEM;
6074 mlog_errno(ret);
6075 return ret;
6076 }
6077
6078 mlog(0, "Insert clusters: (bit %u, blk %llu)\n",
6079 bit, (unsigned long long)blkno);
6080
6081 item->free_blk = blkno;
6082 item->free_bit = bit;
6083 item->free_next = ctxt->c_global_allocator;
6084
6085 ctxt->c_global_allocator = item;
6086 return ret;
6087}
6088
6089static int ocfs2_free_cached_clusters(struct ocfs2_super *osb,
6090 struct ocfs2_cached_block_free *head)
6091{
6092 struct ocfs2_cached_block_free *tmp;
6093 struct inode *tl_inode = osb->osb_tl_inode;
6094 handle_t *handle;
6095 int ret = 0;
6096
6097 mutex_lock(&tl_inode->i_mutex);
6098
6099 while (head) {
6100 if (ocfs2_truncate_log_needs_flush(osb)) {
6101 ret = __ocfs2_flush_truncate_log(osb);
6102 if (ret < 0) {
6103 mlog_errno(ret);
6104 break;
6105 }
6106 }
6107
6108 handle = ocfs2_start_trans(osb, OCFS2_TRUNCATE_LOG_UPDATE);
6109 if (IS_ERR(handle)) {
6110 ret = PTR_ERR(handle);
6111 mlog_errno(ret);
6112 break;
6113 }
6114
6115 ret = ocfs2_truncate_log_append(osb, handle, head->free_blk,
6116 head->free_bit);
6117
6118 ocfs2_commit_trans(osb, handle);
6119 tmp = head;
6120 head = head->free_next;
6121 kfree(tmp);
6122
6123 if (ret < 0) {
6124 mlog_errno(ret);
6125 break;
6126 }
6127 }
6128
6129 mutex_unlock(&tl_inode->i_mutex);
6130
6131 while (head) {
6132 /* Premature exit may have left some dangling items. */
6133 tmp = head;
6134 head = head->free_next;
6135 kfree(tmp);
6136 }
6137
6138 return ret;
6139}
6140
5896int ocfs2_run_deallocs(struct ocfs2_super *osb, 6141int ocfs2_run_deallocs(struct ocfs2_super *osb,
5897 struct ocfs2_cached_dealloc_ctxt *ctxt) 6142 struct ocfs2_cached_dealloc_ctxt *ctxt)
5898{ 6143{
@@ -5908,8 +6153,10 @@ int ocfs2_run_deallocs(struct ocfs2_super *osb,
5908 if (fl->f_first) { 6153 if (fl->f_first) {
5909 mlog(0, "Free items: (type %u, slot %d)\n", 6154 mlog(0, "Free items: (type %u, slot %d)\n",
5910 fl->f_inode_type, fl->f_slot); 6155 fl->f_inode_type, fl->f_slot);
5911 ret2 = ocfs2_free_cached_items(osb, fl->f_inode_type, 6156 ret2 = ocfs2_free_cached_blocks(osb,
5912 fl->f_slot, fl->f_first); 6157 fl->f_inode_type,
6158 fl->f_slot,
6159 fl->f_first);
5913 if (ret2) 6160 if (ret2)
5914 mlog_errno(ret2); 6161 mlog_errno(ret2);
5915 if (!ret) 6162 if (!ret)
@@ -5920,6 +6167,17 @@ int ocfs2_run_deallocs(struct ocfs2_super *osb,
5920 kfree(fl); 6167 kfree(fl);
5921 } 6168 }
5922 6169
6170 if (ctxt->c_global_allocator) {
6171 ret2 = ocfs2_free_cached_clusters(osb,
6172 ctxt->c_global_allocator);
6173 if (ret2)
6174 mlog_errno(ret2);
6175 if (!ret)
6176 ret = ret2;
6177
6178 ctxt->c_global_allocator = NULL;
6179 }
6180
5923 return ret; 6181 return ret;
5924} 6182}
5925 6183
@@ -6075,11 +6333,10 @@ static int ocfs2_find_new_last_ext_blk(struct inode *inode,
6075 6333
6076 eb = (struct ocfs2_extent_block *) bh->b_data; 6334 eb = (struct ocfs2_extent_block *) bh->b_data;
6077 el = &eb->h_list; 6335 el = &eb->h_list;
6078 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { 6336
6079 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb); 6337 /* ocfs2_find_leaf() gets the eb from ocfs2_read_extent_block().
6080 ret = -EROFS; 6338 * Any corruption is a code bug. */
6081 goto out; 6339 BUG_ON(!OCFS2_IS_VALID_EXTENT_BLOCK(eb));
6082 }
6083 6340
6084 *new_last_eb = bh; 6341 *new_last_eb = bh;
6085 get_bh(*new_last_eb); 6342 get_bh(*new_last_eb);
@@ -6326,8 +6583,8 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
6326 } 6583 }
6327 6584
6328 if (last_eb_bh) { 6585 if (last_eb_bh) {
6329 status = ocfs2_journal_access(handle, inode, last_eb_bh, 6586 status = ocfs2_journal_access_eb(handle, inode, last_eb_bh,
6330 OCFS2_JOURNAL_ACCESS_WRITE); 6587 OCFS2_JOURNAL_ACCESS_WRITE);
6331 if (status < 0) { 6588 if (status < 0) {
6332 mlog_errno(status); 6589 mlog_errno(status);
6333 goto bail; 6590 goto bail;
@@ -6350,6 +6607,8 @@ static int ocfs2_do_truncate(struct ocfs2_super *osb,
6350 goto bail; 6607 goto bail;
6351 } 6608 }
6352 6609
6610 vfs_dq_free_space_nodirty(inode,
6611 ocfs2_clusters_to_bytes(osb->sb, clusters_to_del));
6353 spin_lock(&OCFS2_I(inode)->ip_lock); 6612 spin_lock(&OCFS2_I(inode)->ip_lock);
6354 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters) - 6613 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters) -
6355 clusters_to_del; 6614 clusters_to_del;
@@ -6436,11 +6695,6 @@ static void ocfs2_map_and_dirty_page(struct inode *inode, handle_t *handle,
6436 mlog_errno(ret); 6695 mlog_errno(ret);
6437 else if (ocfs2_should_order_data(inode)) { 6696 else if (ocfs2_should_order_data(inode)) {
6438 ret = ocfs2_jbd2_file_inode(handle, inode); 6697 ret = ocfs2_jbd2_file_inode(handle, inode);
6439#ifdef CONFIG_OCFS2_COMPAT_JBD
6440 ret = walk_page_buffers(handle, page_buffers(page),
6441 from, to, &partial,
6442 ocfs2_journal_dirty_data);
6443#endif
6444 if (ret < 0) 6698 if (ret < 0)
6445 mlog_errno(ret); 6699 mlog_errno(ret);
6446 } 6700 }
@@ -6663,6 +6917,7 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
6663 struct page **pages = NULL; 6917 struct page **pages = NULL;
6664 loff_t end = osb->s_clustersize; 6918 loff_t end = osb->s_clustersize;
6665 struct ocfs2_extent_tree et; 6919 struct ocfs2_extent_tree et;
6920 int did_quota = 0;
6666 6921
6667 has_data = i_size_read(inode) ? 1 : 0; 6922 has_data = i_size_read(inode) ? 1 : 0;
6668 6923
@@ -6682,15 +6937,16 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
6682 } 6937 }
6683 } 6938 }
6684 6939
6685 handle = ocfs2_start_trans(osb, OCFS2_INLINE_TO_EXTENTS_CREDITS); 6940 handle = ocfs2_start_trans(osb,
6941 ocfs2_inline_to_extents_credits(osb->sb));
6686 if (IS_ERR(handle)) { 6942 if (IS_ERR(handle)) {
6687 ret = PTR_ERR(handle); 6943 ret = PTR_ERR(handle);
6688 mlog_errno(ret); 6944 mlog_errno(ret);
6689 goto out_unlock; 6945 goto out_unlock;
6690 } 6946 }
6691 6947
6692 ret = ocfs2_journal_access(handle, inode, di_bh, 6948 ret = ocfs2_journal_access_di(handle, inode, di_bh,
6693 OCFS2_JOURNAL_ACCESS_WRITE); 6949 OCFS2_JOURNAL_ACCESS_WRITE);
6694 if (ret) { 6950 if (ret) {
6695 mlog_errno(ret); 6951 mlog_errno(ret);
6696 goto out_commit; 6952 goto out_commit;
@@ -6701,6 +6957,13 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
6701 unsigned int page_end; 6957 unsigned int page_end;
6702 u64 phys; 6958 u64 phys;
6703 6959
6960 if (vfs_dq_alloc_space_nodirty(inode,
6961 ocfs2_clusters_to_bytes(osb->sb, 1))) {
6962 ret = -EDQUOT;
6963 goto out_commit;
6964 }
6965 did_quota = 1;
6966
6704 ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, 6967 ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off,
6705 &num); 6968 &num);
6706 if (ret) { 6969 if (ret) {
@@ -6774,6 +7037,10 @@ int ocfs2_convert_inline_data_to_extents(struct inode *inode,
6774 } 7037 }
6775 7038
6776out_commit: 7039out_commit:
7040 if (ret < 0 && did_quota)
7041 vfs_dq_free_space_nodirty(inode,
7042 ocfs2_clusters_to_bytes(osb->sb, 1));
7043
6777 ocfs2_commit_trans(osb, handle); 7044 ocfs2_commit_trans(osb, handle);
6778 7045
6779out_unlock: 7046out_unlock:
@@ -6813,7 +7080,8 @@ int ocfs2_commit_truncate(struct ocfs2_super *osb,
6813 new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb, 7080 new_highest_cpos = ocfs2_clusters_for_bytes(osb->sb,
6814 i_size_read(inode)); 7081 i_size_read(inode));
6815 7082
6816 path = ocfs2_new_path(fe_bh, &di->id2.i_list); 7083 path = ocfs2_new_path(fe_bh, &di->id2.i_list,
7084 ocfs2_journal_access_di);
6817 if (!path) { 7085 if (!path) {
6818 status = -ENOMEM; 7086 status = -ENOMEM;
6819 mlog_errno(status); 7087 mlog_errno(status);
@@ -6984,20 +7252,14 @@ int ocfs2_prepare_truncate(struct ocfs2_super *osb,
6984 ocfs2_init_dealloc_ctxt(&(*tc)->tc_dealloc); 7252 ocfs2_init_dealloc_ctxt(&(*tc)->tc_dealloc);
6985 7253
6986 if (fe->id2.i_list.l_tree_depth) { 7254 if (fe->id2.i_list.l_tree_depth) {
6987 status = ocfs2_read_block(inode, le64_to_cpu(fe->i_last_eb_blk), 7255 status = ocfs2_read_extent_block(inode,
6988 &last_eb_bh); 7256 le64_to_cpu(fe->i_last_eb_blk),
7257 &last_eb_bh);
6989 if (status < 0) { 7258 if (status < 0) {
6990 mlog_errno(status); 7259 mlog_errno(status);
6991 goto bail; 7260 goto bail;
6992 } 7261 }
6993 eb = (struct ocfs2_extent_block *) last_eb_bh->b_data; 7262 eb = (struct ocfs2_extent_block *) last_eb_bh->b_data;
6994 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
6995 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
6996
6997 brelse(last_eb_bh);
6998 status = -EIO;
6999 goto bail;
7000 }
7001 } 7263 }
7002 7264
7003 (*tc)->tc_last_eb_bh = last_eb_bh; 7265 (*tc)->tc_last_eb_bh = last_eb_bh;
@@ -7052,8 +7314,8 @@ int ocfs2_truncate_inline(struct inode *inode, struct buffer_head *di_bh,
7052 goto out; 7314 goto out;
7053 } 7315 }
7054 7316
7055 ret = ocfs2_journal_access(handle, inode, di_bh, 7317 ret = ocfs2_journal_access_di(handle, inode, di_bh,
7056 OCFS2_JOURNAL_ACCESS_WRITE); 7318 OCFS2_JOURNAL_ACCESS_WRITE);
7057 if (ret) { 7319 if (ret) {
7058 mlog_errno(ret); 7320 mlog_errno(ret);
7059 goto out_commit; 7321 goto out_commit;
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h
index 70257c84cfbe..cceff5c37f47 100644
--- a/fs/ocfs2/alloc.h
+++ b/fs/ocfs2/alloc.h
@@ -45,7 +45,9 @@
45 * 45 *
46 * ocfs2_extent_tree contains info for the root of the b-tree, it must have a 46 * ocfs2_extent_tree contains info for the root of the b-tree, it must have a
47 * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree 47 * root ocfs2_extent_list and a root_bh so that they can be used in the b-tree
48 * functions. 48 * functions. With metadata ecc, we now call different journal_access
49 * functions for each type of metadata, so it must have the
50 * root_journal_access function.
49 * ocfs2_extent_tree_operations abstract the normal operations we do for 51 * ocfs2_extent_tree_operations abstract the normal operations we do for
50 * the root of extent b-tree. 52 * the root of extent b-tree.
51 */ 53 */
@@ -54,6 +56,7 @@ struct ocfs2_extent_tree {
54 struct ocfs2_extent_tree_operations *et_ops; 56 struct ocfs2_extent_tree_operations *et_ops;
55 struct buffer_head *et_root_bh; 57 struct buffer_head *et_root_bh;
56 struct ocfs2_extent_list *et_root_el; 58 struct ocfs2_extent_list *et_root_el;
59 ocfs2_journal_access_func et_root_journal_access;
57 void *et_object; 60 void *et_object;
58 unsigned int et_max_leaf_clusters; 61 unsigned int et_max_leaf_clusters;
59}; 62};
@@ -68,10 +71,18 @@ void ocfs2_init_dinode_extent_tree(struct ocfs2_extent_tree *et,
68void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et, 71void ocfs2_init_xattr_tree_extent_tree(struct ocfs2_extent_tree *et,
69 struct inode *inode, 72 struct inode *inode,
70 struct buffer_head *bh); 73 struct buffer_head *bh);
74struct ocfs2_xattr_value_buf;
71void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et, 75void ocfs2_init_xattr_value_extent_tree(struct ocfs2_extent_tree *et,
72 struct inode *inode, 76 struct inode *inode,
73 struct buffer_head *bh, 77 struct ocfs2_xattr_value_buf *vb);
74 struct ocfs2_xattr_value_root *xv); 78
79/*
80 * Read an extent block into *bh. If *bh is NULL, a bh will be
81 * allocated. This is a cached read. The extent block will be validated
82 * with ocfs2_validate_extent_block().
83 */
84int ocfs2_read_extent_block(struct inode *inode, u64 eb_blkno,
85 struct buffer_head **bh);
75 86
76struct ocfs2_alloc_context; 87struct ocfs2_alloc_context;
77int ocfs2_insert_extent(struct ocfs2_super *osb, 88int ocfs2_insert_extent(struct ocfs2_super *osb,
@@ -110,6 +121,11 @@ int ocfs2_remove_extent(struct inode *inode,
110 u32 cpos, u32 len, handle_t *handle, 121 u32 cpos, u32 len, handle_t *handle,
111 struct ocfs2_alloc_context *meta_ac, 122 struct ocfs2_alloc_context *meta_ac,
112 struct ocfs2_cached_dealloc_ctxt *dealloc); 123 struct ocfs2_cached_dealloc_ctxt *dealloc);
124int ocfs2_remove_btree_range(struct inode *inode,
125 struct ocfs2_extent_tree *et,
126 u32 cpos, u32 phys_cpos, u32 len,
127 struct ocfs2_cached_dealloc_ctxt *dealloc);
128
113int ocfs2_num_free_extents(struct ocfs2_super *osb, 129int ocfs2_num_free_extents(struct ocfs2_super *osb,
114 struct inode *inode, 130 struct inode *inode,
115 struct ocfs2_extent_tree *et); 131 struct ocfs2_extent_tree *et);
@@ -167,10 +183,18 @@ int __ocfs2_flush_truncate_log(struct ocfs2_super *osb);
167 */ 183 */
168struct ocfs2_cached_dealloc_ctxt { 184struct ocfs2_cached_dealloc_ctxt {
169 struct ocfs2_per_slot_free_list *c_first_suballocator; 185 struct ocfs2_per_slot_free_list *c_first_suballocator;
186 struct ocfs2_cached_block_free *c_global_allocator;
170}; 187};
171static inline void ocfs2_init_dealloc_ctxt(struct ocfs2_cached_dealloc_ctxt *c) 188static inline void ocfs2_init_dealloc_ctxt(struct ocfs2_cached_dealloc_ctxt *c)
172{ 189{
173 c->c_first_suballocator = NULL; 190 c->c_first_suballocator = NULL;
191 c->c_global_allocator = NULL;
192}
193int ocfs2_cache_cluster_dealloc(struct ocfs2_cached_dealloc_ctxt *ctxt,
194 u64 blkno, unsigned int bit);
195static inline int ocfs2_dealloc_has_cluster(struct ocfs2_cached_dealloc_ctxt *c)
196{
197 return c->c_global_allocator != NULL;
174} 198}
175int ocfs2_run_deallocs(struct ocfs2_super *osb, 199int ocfs2_run_deallocs(struct ocfs2_super *osb,
176 struct ocfs2_cached_dealloc_ctxt *ctxt); 200 struct ocfs2_cached_dealloc_ctxt *ctxt);
diff --git a/fs/ocfs2/aops.c b/fs/ocfs2/aops.c
index c22543b33420..a067a6cffb01 100644
--- a/fs/ocfs2/aops.c
+++ b/fs/ocfs2/aops.c
@@ -27,6 +27,7 @@
27#include <linux/swap.h> 27#include <linux/swap.h>
28#include <linux/pipe_fs_i.h> 28#include <linux/pipe_fs_i.h>
29#include <linux/mpage.h> 29#include <linux/mpage.h>
30#include <linux/quotaops.h>
30 31
31#define MLOG_MASK_PREFIX ML_FILE_IO 32#define MLOG_MASK_PREFIX ML_FILE_IO
32#include <cluster/masklog.h> 33#include <cluster/masklog.h>
@@ -68,20 +69,13 @@ static int ocfs2_symlink_get_block(struct inode *inode, sector_t iblock,
68 goto bail; 69 goto bail;
69 } 70 }
70 71
71 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh); 72 status = ocfs2_read_inode_block(inode, &bh);
72 if (status < 0) { 73 if (status < 0) {
73 mlog_errno(status); 74 mlog_errno(status);
74 goto bail; 75 goto bail;
75 } 76 }
76 fe = (struct ocfs2_dinode *) bh->b_data; 77 fe = (struct ocfs2_dinode *) bh->b_data;
77 78
78 if (!OCFS2_IS_VALID_DINODE(fe)) {
79 mlog(ML_ERROR, "Invalid dinode #%llu: signature = %.*s\n",
80 (unsigned long long)le64_to_cpu(fe->i_blkno), 7,
81 fe->i_signature);
82 goto bail;
83 }
84
85 if ((u64)iblock >= ocfs2_clusters_to_blocks(inode->i_sb, 79 if ((u64)iblock >= ocfs2_clusters_to_blocks(inode->i_sb,
86 le32_to_cpu(fe->i_clusters))) { 80 le32_to_cpu(fe->i_clusters))) {
87 mlog(ML_ERROR, "block offset is outside the allocated size: " 81 mlog(ML_ERROR, "block offset is outside the allocated size: "
@@ -262,7 +256,7 @@ static int ocfs2_readpage_inline(struct inode *inode, struct page *page)
262 BUG_ON(!PageLocked(page)); 256 BUG_ON(!PageLocked(page));
263 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL)); 257 BUG_ON(!(OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL));
264 258
265 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh); 259 ret = ocfs2_read_inode_block(inode, &di_bh);
266 if (ret) { 260 if (ret) {
267 mlog_errno(ret); 261 mlog_errno(ret);
268 goto out; 262 goto out;
@@ -481,12 +475,6 @@ handle_t *ocfs2_start_walk_page_trans(struct inode *inode,
481 475
482 if (ocfs2_should_order_data(inode)) { 476 if (ocfs2_should_order_data(inode)) {
483 ret = ocfs2_jbd2_file_inode(handle, inode); 477 ret = ocfs2_jbd2_file_inode(handle, inode);
484#ifdef CONFIG_OCFS2_COMPAT_JBD
485 ret = walk_page_buffers(handle,
486 page_buffers(page),
487 from, to, NULL,
488 ocfs2_journal_dirty_data);
489#endif
490 if (ret < 0) 478 if (ret < 0)
491 mlog_errno(ret); 479 mlog_errno(ret);
492 } 480 }
@@ -1072,15 +1060,8 @@ static void ocfs2_write_failure(struct inode *inode,
1072 tmppage = wc->w_pages[i]; 1060 tmppage = wc->w_pages[i];
1073 1061
1074 if (page_has_buffers(tmppage)) { 1062 if (page_has_buffers(tmppage)) {
1075 if (ocfs2_should_order_data(inode)) { 1063 if (ocfs2_should_order_data(inode))
1076 ocfs2_jbd2_file_inode(wc->w_handle, inode); 1064 ocfs2_jbd2_file_inode(wc->w_handle, inode);
1077#ifdef CONFIG_OCFS2_COMPAT_JBD
1078 walk_page_buffers(wc->w_handle,
1079 page_buffers(tmppage),
1080 from, to, NULL,
1081 ocfs2_journal_dirty_data);
1082#endif
1083 }
1084 1065
1085 block_commit_write(tmppage, from, to); 1066 block_commit_write(tmppage, from, to);
1086 } 1067 }
@@ -1531,8 +1512,8 @@ static int ocfs2_write_begin_inline(struct address_space *mapping,
1531 goto out; 1512 goto out;
1532 } 1513 }
1533 1514
1534 ret = ocfs2_journal_access(handle, inode, wc->w_di_bh, 1515 ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh,
1535 OCFS2_JOURNAL_ACCESS_WRITE); 1516 OCFS2_JOURNAL_ACCESS_WRITE);
1536 if (ret) { 1517 if (ret) {
1537 ocfs2_commit_trans(osb, handle); 1518 ocfs2_commit_trans(osb, handle);
1538 1519
@@ -1750,15 +1731,20 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
1750 1731
1751 wc->w_handle = handle; 1732 wc->w_handle = handle;
1752 1733
1734 if (clusters_to_alloc && vfs_dq_alloc_space_nodirty(inode,
1735 ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc))) {
1736 ret = -EDQUOT;
1737 goto out_commit;
1738 }
1753 /* 1739 /*
1754 * We don't want this to fail in ocfs2_write_end(), so do it 1740 * We don't want this to fail in ocfs2_write_end(), so do it
1755 * here. 1741 * here.
1756 */ 1742 */
1757 ret = ocfs2_journal_access(handle, inode, wc->w_di_bh, 1743 ret = ocfs2_journal_access_di(handle, inode, wc->w_di_bh,
1758 OCFS2_JOURNAL_ACCESS_WRITE); 1744 OCFS2_JOURNAL_ACCESS_WRITE);
1759 if (ret) { 1745 if (ret) {
1760 mlog_errno(ret); 1746 mlog_errno(ret);
1761 goto out_commit; 1747 goto out_quota;
1762 } 1748 }
1763 1749
1764 /* 1750 /*
@@ -1771,14 +1757,14 @@ int ocfs2_write_begin_nolock(struct address_space *mapping,
1771 mmap_page); 1757 mmap_page);
1772 if (ret) { 1758 if (ret) {
1773 mlog_errno(ret); 1759 mlog_errno(ret);
1774 goto out_commit; 1760 goto out_quota;
1775 } 1761 }
1776 1762
1777 ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos, 1763 ret = ocfs2_write_cluster_by_desc(mapping, data_ac, meta_ac, wc, pos,
1778 len); 1764 len);
1779 if (ret) { 1765 if (ret) {
1780 mlog_errno(ret); 1766 mlog_errno(ret);
1781 goto out_commit; 1767 goto out_quota;
1782 } 1768 }
1783 1769
1784 if (data_ac) 1770 if (data_ac)
@@ -1790,6 +1776,10 @@ success:
1790 *pagep = wc->w_target_page; 1776 *pagep = wc->w_target_page;
1791 *fsdata = wc; 1777 *fsdata = wc;
1792 return 0; 1778 return 0;
1779out_quota:
1780 if (clusters_to_alloc)
1781 vfs_dq_free_space(inode,
1782 ocfs2_clusters_to_bytes(osb->sb, clusters_to_alloc));
1793out_commit: 1783out_commit:
1794 ocfs2_commit_trans(osb, handle); 1784 ocfs2_commit_trans(osb, handle);
1795 1785
@@ -1919,15 +1909,8 @@ int ocfs2_write_end_nolock(struct address_space *mapping,
1919 } 1909 }
1920 1910
1921 if (page_has_buffers(tmppage)) { 1911 if (page_has_buffers(tmppage)) {
1922 if (ocfs2_should_order_data(inode)) { 1912 if (ocfs2_should_order_data(inode))
1923 ocfs2_jbd2_file_inode(wc->w_handle, inode); 1913 ocfs2_jbd2_file_inode(wc->w_handle, inode);
1924#ifdef CONFIG_OCFS2_COMPAT_JBD
1925 walk_page_buffers(wc->w_handle,
1926 page_buffers(tmppage),
1927 from, to, NULL,
1928 ocfs2_journal_dirty_data);
1929#endif
1930 }
1931 block_commit_write(tmppage, from, to); 1914 block_commit_write(tmppage, from, to);
1932 } 1915 }
1933 } 1916 }
diff --git a/fs/ocfs2/blockcheck.c b/fs/ocfs2/blockcheck.c
new file mode 100644
index 000000000000..2a947c44e594
--- /dev/null
+++ b/fs/ocfs2/blockcheck.c
@@ -0,0 +1,477 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * blockcheck.c
5 *
6 * Checksum and ECC codes for the OCFS2 userspace library.
7 *
8 * Copyright (C) 2006, 2008 Oracle. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License, version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#include <linux/kernel.h>
21#include <linux/types.h>
22#include <linux/crc32.h>
23#include <linux/buffer_head.h>
24#include <linux/bitops.h>
25#include <asm/byteorder.h>
26
27#include <cluster/masklog.h>
28
29#include "ocfs2.h"
30
31#include "blockcheck.h"
32
33
34/*
35 * We use the following conventions:
36 *
37 * d = # data bits
38 * p = # parity bits
39 * c = # total code bits (d + p)
40 */
41
42
43/*
44 * Calculate the bit offset in the hamming code buffer based on the bit's
45 * offset in the data buffer. Since the hamming code reserves all
46 * power-of-two bits for parity, the data bit number and the code bit
47 * number are offest by all the parity bits beforehand.
48 *
49 * Recall that bit numbers in hamming code are 1-based. This function
50 * takes the 0-based data bit from the caller.
51 *
52 * An example. Take bit 1 of the data buffer. 1 is a power of two (2^0),
53 * so it's a parity bit. 2 is a power of two (2^1), so it's a parity bit.
54 * 3 is not a power of two. So bit 1 of the data buffer ends up as bit 3
55 * in the code buffer.
56 *
57 * The caller can pass in *p if it wants to keep track of the most recent
58 * number of parity bits added. This allows the function to start the
59 * calculation at the last place.
60 */
61static unsigned int calc_code_bit(unsigned int i, unsigned int *p_cache)
62{
63 unsigned int b, p = 0;
64
65 /*
66 * Data bits are 0-based, but we're talking code bits, which
67 * are 1-based.
68 */
69 b = i + 1;
70
71 /* Use the cache if it is there */
72 if (p_cache)
73 p = *p_cache;
74 b += p;
75
76 /*
77 * For every power of two below our bit number, bump our bit.
78 *
79 * We compare with (b + 1) because we have to compare with what b
80 * would be _if_ it were bumped up by the parity bit. Capice?
81 *
82 * p is set above.
83 */
84 for (; (1 << p) < (b + 1); p++)
85 b++;
86
87 if (p_cache)
88 *p_cache = p;
89
90 return b;
91}
92
93/*
94 * This is the low level encoder function. It can be called across
95 * multiple hunks just like the crc32 code. 'd' is the number of bits
96 * _in_this_hunk_. nr is the bit offset of this hunk. So, if you had
97 * two 512B buffers, you would do it like so:
98 *
99 * parity = ocfs2_hamming_encode(0, buf1, 512 * 8, 0);
100 * parity = ocfs2_hamming_encode(parity, buf2, 512 * 8, 512 * 8);
101 *
102 * If you just have one buffer, use ocfs2_hamming_encode_block().
103 */
104u32 ocfs2_hamming_encode(u32 parity, void *data, unsigned int d, unsigned int nr)
105{
106 unsigned int i, b, p = 0;
107
108 BUG_ON(!d);
109
110 /*
111 * b is the hamming code bit number. Hamming code specifies a
112 * 1-based array, but C uses 0-based. So 'i' is for C, and 'b' is
113 * for the algorithm.
114 *
115 * The i++ in the for loop is so that the start offset passed
116 * to ocfs2_find_next_bit_set() is one greater than the previously
117 * found bit.
118 */
119 for (i = 0; (i = ocfs2_find_next_bit(data, d, i)) < d; i++)
120 {
121 /*
122 * i is the offset in this hunk, nr + i is the total bit
123 * offset.
124 */
125 b = calc_code_bit(nr + i, &p);
126
127 /*
128 * Data bits in the resultant code are checked by
129 * parity bits that are part of the bit number
130 * representation. Huh?
131 *
132 * <wikipedia href="http://en.wikipedia.org/wiki/Hamming_code">
133 * In other words, the parity bit at position 2^k
134 * checks bits in positions having bit k set in
135 * their binary representation. Conversely, for
136 * instance, bit 13, i.e. 1101(2), is checked by
137 * bits 1000(2) = 8, 0100(2)=4 and 0001(2) = 1.
138 * </wikipedia>
139 *
140 * Note that 'k' is the _code_ bit number. 'b' in
141 * our loop.
142 */
143 parity ^= b;
144 }
145
146 /* While the data buffer was treated as little endian, the
147 * return value is in host endian. */
148 return parity;
149}
150
151u32 ocfs2_hamming_encode_block(void *data, unsigned int blocksize)
152{
153 return ocfs2_hamming_encode(0, data, blocksize * 8, 0);
154}
155
156/*
157 * Like ocfs2_hamming_encode(), this can handle hunks. nr is the bit
158 * offset of the current hunk. If bit to be fixed is not part of the
159 * current hunk, this does nothing.
160 *
161 * If you only have one hunk, use ocfs2_hamming_fix_block().
162 */
163void ocfs2_hamming_fix(void *data, unsigned int d, unsigned int nr,
164 unsigned int fix)
165{
166 unsigned int i, b;
167
168 BUG_ON(!d);
169
170 /*
171 * If the bit to fix has an hweight of 1, it's a parity bit. One
172 * busted parity bit is its own error. Nothing to do here.
173 */
174 if (hweight32(fix) == 1)
175 return;
176
177 /*
178 * nr + d is the bit right past the data hunk we're looking at.
179 * If fix after that, nothing to do
180 */
181 if (fix >= calc_code_bit(nr + d, NULL))
182 return;
183
184 /*
185 * nr is the offset in the data hunk we're starting at. Let's
186 * start b at the offset in the code buffer. See hamming_encode()
187 * for a more detailed description of 'b'.
188 */
189 b = calc_code_bit(nr, NULL);
190 /* If the fix is before this hunk, nothing to do */
191 if (fix < b)
192 return;
193
194 for (i = 0; i < d; i++, b++)
195 {
196 /* Skip past parity bits */
197 while (hweight32(b) == 1)
198 b++;
199
200 /*
201 * i is the offset in this data hunk.
202 * nr + i is the offset in the total data buffer.
203 * b is the offset in the total code buffer.
204 *
205 * Thus, when b == fix, bit i in the current hunk needs
206 * fixing.
207 */
208 if (b == fix)
209 {
210 if (ocfs2_test_bit(i, data))
211 ocfs2_clear_bit(i, data);
212 else
213 ocfs2_set_bit(i, data);
214 break;
215 }
216 }
217}
218
219void ocfs2_hamming_fix_block(void *data, unsigned int blocksize,
220 unsigned int fix)
221{
222 ocfs2_hamming_fix(data, blocksize * 8, 0, fix);
223}
224
225/*
226 * This function generates check information for a block.
227 * data is the block to be checked. bc is a pointer to the
228 * ocfs2_block_check structure describing the crc32 and the ecc.
229 *
230 * bc should be a pointer inside data, as the function will
231 * take care of zeroing it before calculating the check information. If
232 * bc does not point inside data, the caller must make sure any inline
233 * ocfs2_block_check structures are zeroed.
234 *
235 * The data buffer must be in on-disk endian (little endian for ocfs2).
236 * bc will be filled with little-endian values and will be ready to go to
237 * disk.
238 */
239void ocfs2_block_check_compute(void *data, size_t blocksize,
240 struct ocfs2_block_check *bc)
241{
242 u32 crc;
243 u32 ecc;
244
245 memset(bc, 0, sizeof(struct ocfs2_block_check));
246
247 crc = crc32_le(~0, data, blocksize);
248 ecc = ocfs2_hamming_encode_block(data, blocksize);
249
250 /*
251 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no
252 * larger than 16 bits.
253 */
254 BUG_ON(ecc > USHORT_MAX);
255
256 bc->bc_crc32e = cpu_to_le32(crc);
257 bc->bc_ecc = cpu_to_le16((u16)ecc);
258}
259
260/*
261 * This function validates existing check information. Like _compute,
262 * the function will take care of zeroing bc before calculating check codes.
263 * If bc is not a pointer inside data, the caller must have zeroed any
264 * inline ocfs2_block_check structures.
265 *
266 * Again, the data passed in should be the on-disk endian.
267 */
268int ocfs2_block_check_validate(void *data, size_t blocksize,
269 struct ocfs2_block_check *bc)
270{
271 int rc = 0;
272 struct ocfs2_block_check check;
273 u32 crc, ecc;
274
275 check.bc_crc32e = le32_to_cpu(bc->bc_crc32e);
276 check.bc_ecc = le16_to_cpu(bc->bc_ecc);
277
278 memset(bc, 0, sizeof(struct ocfs2_block_check));
279
280 /* Fast path - if the crc32 validates, we're good to go */
281 crc = crc32_le(~0, data, blocksize);
282 if (crc == check.bc_crc32e)
283 goto out;
284
285 mlog(ML_ERROR,
286 "CRC32 failed: stored: %u, computed %u. Applying ECC.\n",
287 (unsigned int)check.bc_crc32e, (unsigned int)crc);
288
289 /* Ok, try ECC fixups */
290 ecc = ocfs2_hamming_encode_block(data, blocksize);
291 ocfs2_hamming_fix_block(data, blocksize, ecc ^ check.bc_ecc);
292
293 /* And check the crc32 again */
294 crc = crc32_le(~0, data, blocksize);
295 if (crc == check.bc_crc32e)
296 goto out;
297
298 mlog(ML_ERROR, "Fixed CRC32 failed: stored: %u, computed %u\n",
299 (unsigned int)check.bc_crc32e, (unsigned int)crc);
300
301 rc = -EIO;
302
303out:
304 bc->bc_crc32e = cpu_to_le32(check.bc_crc32e);
305 bc->bc_ecc = cpu_to_le16(check.bc_ecc);
306
307 return rc;
308}
309
310/*
311 * This function generates check information for a list of buffer_heads.
312 * bhs is the blocks to be checked. bc is a pointer to the
313 * ocfs2_block_check structure describing the crc32 and the ecc.
314 *
315 * bc should be a pointer inside data, as the function will
316 * take care of zeroing it before calculating the check information. If
317 * bc does not point inside data, the caller must make sure any inline
318 * ocfs2_block_check structures are zeroed.
319 *
320 * The data buffer must be in on-disk endian (little endian for ocfs2).
321 * bc will be filled with little-endian values and will be ready to go to
322 * disk.
323 */
324void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr,
325 struct ocfs2_block_check *bc)
326{
327 int i;
328 u32 crc, ecc;
329
330 BUG_ON(nr < 0);
331
332 if (!nr)
333 return;
334
335 memset(bc, 0, sizeof(struct ocfs2_block_check));
336
337 for (i = 0, crc = ~0, ecc = 0; i < nr; i++) {
338 crc = crc32_le(crc, bhs[i]->b_data, bhs[i]->b_size);
339 /*
340 * The number of bits in a buffer is obviously b_size*8.
341 * The offset of this buffer is b_size*i, so the bit offset
342 * of this buffer is b_size*8*i.
343 */
344 ecc = (u16)ocfs2_hamming_encode(ecc, bhs[i]->b_data,
345 bhs[i]->b_size * 8,
346 bhs[i]->b_size * 8 * i);
347 }
348
349 /*
350 * No ecc'd ocfs2 structure is larger than 4K, so ecc will be no
351 * larger than 16 bits.
352 */
353 BUG_ON(ecc > USHORT_MAX);
354
355 bc->bc_crc32e = cpu_to_le32(crc);
356 bc->bc_ecc = cpu_to_le16((u16)ecc);
357}
358
359/*
360 * This function validates existing check information on a list of
361 * buffer_heads. Like _compute_bhs, the function will take care of
362 * zeroing bc before calculating check codes. If bc is not a pointer
363 * inside data, the caller must have zeroed any inline
364 * ocfs2_block_check structures.
365 *
366 * Again, the data passed in should be the on-disk endian.
367 */
368int ocfs2_block_check_validate_bhs(struct buffer_head **bhs, int nr,
369 struct ocfs2_block_check *bc)
370{
371 int i, rc = 0;
372 struct ocfs2_block_check check;
373 u32 crc, ecc, fix;
374
375 BUG_ON(nr < 0);
376
377 if (!nr)
378 return 0;
379
380 check.bc_crc32e = le32_to_cpu(bc->bc_crc32e);
381 check.bc_ecc = le16_to_cpu(bc->bc_ecc);
382
383 memset(bc, 0, sizeof(struct ocfs2_block_check));
384
385 /* Fast path - if the crc32 validates, we're good to go */
386 for (i = 0, crc = ~0; i < nr; i++)
387 crc = crc32_le(crc, bhs[i]->b_data, bhs[i]->b_size);
388 if (crc == check.bc_crc32e)
389 goto out;
390
391 mlog(ML_ERROR,
392 "CRC32 failed: stored: %u, computed %u. Applying ECC.\n",
393 (unsigned int)check.bc_crc32e, (unsigned int)crc);
394
395 /* Ok, try ECC fixups */
396 for (i = 0, ecc = 0; i < nr; i++) {
397 /*
398 * The number of bits in a buffer is obviously b_size*8.
399 * The offset of this buffer is b_size*i, so the bit offset
400 * of this buffer is b_size*8*i.
401 */
402 ecc = (u16)ocfs2_hamming_encode(ecc, bhs[i]->b_data,
403 bhs[i]->b_size * 8,
404 bhs[i]->b_size * 8 * i);
405 }
406 fix = ecc ^ check.bc_ecc;
407 for (i = 0; i < nr; i++) {
408 /*
409 * Try the fix against each buffer. It will only affect
410 * one of them.
411 */
412 ocfs2_hamming_fix(bhs[i]->b_data, bhs[i]->b_size * 8,
413 bhs[i]->b_size * 8 * i, fix);
414 }
415
416 /* And check the crc32 again */
417 for (i = 0, crc = ~0; i < nr; i++)
418 crc = crc32_le(crc, bhs[i]->b_data, bhs[i]->b_size);
419 if (crc == check.bc_crc32e)
420 goto out;
421
422 mlog(ML_ERROR, "Fixed CRC32 failed: stored: %u, computed %u\n",
423 (unsigned int)check.bc_crc32e, (unsigned int)crc);
424
425 rc = -EIO;
426
427out:
428 bc->bc_crc32e = cpu_to_le32(check.bc_crc32e);
429 bc->bc_ecc = cpu_to_le16(check.bc_ecc);
430
431 return rc;
432}
433
434/*
435 * These are the main API. They check the superblock flag before
436 * calling the underlying operations.
437 *
438 * They expect the buffer(s) to be in disk format.
439 */
440void ocfs2_compute_meta_ecc(struct super_block *sb, void *data,
441 struct ocfs2_block_check *bc)
442{
443 if (ocfs2_meta_ecc(OCFS2_SB(sb)))
444 ocfs2_block_check_compute(data, sb->s_blocksize, bc);
445}
446
447int ocfs2_validate_meta_ecc(struct super_block *sb, void *data,
448 struct ocfs2_block_check *bc)
449{
450 int rc = 0;
451
452 if (ocfs2_meta_ecc(OCFS2_SB(sb)))
453 rc = ocfs2_block_check_validate(data, sb->s_blocksize, bc);
454
455 return rc;
456}
457
458void ocfs2_compute_meta_ecc_bhs(struct super_block *sb,
459 struct buffer_head **bhs, int nr,
460 struct ocfs2_block_check *bc)
461{
462 if (ocfs2_meta_ecc(OCFS2_SB(sb)))
463 ocfs2_block_check_compute_bhs(bhs, nr, bc);
464}
465
466int ocfs2_validate_meta_ecc_bhs(struct super_block *sb,
467 struct buffer_head **bhs, int nr,
468 struct ocfs2_block_check *bc)
469{
470 int rc = 0;
471
472 if (ocfs2_meta_ecc(OCFS2_SB(sb)))
473 rc = ocfs2_block_check_validate_bhs(bhs, nr, bc);
474
475 return rc;
476}
477
diff --git a/fs/ocfs2/blockcheck.h b/fs/ocfs2/blockcheck.h
new file mode 100644
index 000000000000..70ec3feda32f
--- /dev/null
+++ b/fs/ocfs2/blockcheck.h
@@ -0,0 +1,82 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * blockcheck.h
5 *
6 * Checksum and ECC codes for the OCFS2 userspace library.
7 *
8 * Copyright (C) 2004, 2008 Oracle. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License, version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#ifndef OCFS2_BLOCKCHECK_H
21#define OCFS2_BLOCKCHECK_H
22
23
24/* High level block API */
25void ocfs2_compute_meta_ecc(struct super_block *sb, void *data,
26 struct ocfs2_block_check *bc);
27int ocfs2_validate_meta_ecc(struct super_block *sb, void *data,
28 struct ocfs2_block_check *bc);
29void ocfs2_compute_meta_ecc_bhs(struct super_block *sb,
30 struct buffer_head **bhs, int nr,
31 struct ocfs2_block_check *bc);
32int ocfs2_validate_meta_ecc_bhs(struct super_block *sb,
33 struct buffer_head **bhs, int nr,
34 struct ocfs2_block_check *bc);
35
36/* Lower level API */
37void ocfs2_block_check_compute(void *data, size_t blocksize,
38 struct ocfs2_block_check *bc);
39int ocfs2_block_check_validate(void *data, size_t blocksize,
40 struct ocfs2_block_check *bc);
41void ocfs2_block_check_compute_bhs(struct buffer_head **bhs, int nr,
42 struct ocfs2_block_check *bc);
43int ocfs2_block_check_validate_bhs(struct buffer_head **bhs, int nr,
44 struct ocfs2_block_check *bc);
45
46/*
47 * Hamming code functions
48 */
49
50/*
51 * Encoding hamming code parity bits for a buffer.
52 *
53 * This is the low level encoder function. It can be called across
54 * multiple hunks just like the crc32 code. 'd' is the number of bits
55 * _in_this_hunk_. nr is the bit offset of this hunk. So, if you had
56 * two 512B buffers, you would do it like so:
57 *
58 * parity = ocfs2_hamming_encode(0, buf1, 512 * 8, 0);
59 * parity = ocfs2_hamming_encode(parity, buf2, 512 * 8, 512 * 8);
60 *
61 * If you just have one buffer, use ocfs2_hamming_encode_block().
62 */
63u32 ocfs2_hamming_encode(u32 parity, void *data, unsigned int d,
64 unsigned int nr);
65/*
66 * Fix a buffer with a bit error. The 'fix' is the original parity
67 * xor'd with the parity calculated now.
68 *
69 * Like ocfs2_hamming_encode(), this can handle hunks. nr is the bit
70 * offset of the current hunk. If bit to be fixed is not part of the
71 * current hunk, this does nothing.
72 *
73 * If you only have one buffer, use ocfs2_hamming_fix_block().
74 */
75void ocfs2_hamming_fix(void *data, unsigned int d, unsigned int nr,
76 unsigned int fix);
77
78/* Convenience wrappers for a single buffer of data */
79extern u32 ocfs2_hamming_encode_block(void *data, unsigned int blocksize);
80extern void ocfs2_hamming_fix_block(void *data, unsigned int blocksize,
81 unsigned int fix);
82#endif
diff --git a/fs/ocfs2/buffer_head_io.c b/fs/ocfs2/buffer_head_io.c
index 3a178ec48d7c..15c8e6deee2e 100644
--- a/fs/ocfs2/buffer_head_io.c
+++ b/fs/ocfs2/buffer_head_io.c
@@ -39,6 +39,18 @@
39 39
40#include "buffer_head_io.h" 40#include "buffer_head_io.h"
41 41
42/*
43 * Bits on bh->b_state used by ocfs2.
44 *
45 * These MUST be after the JBD2 bits. Hence, we use BH_JBDPrivateStart.
46 */
47enum ocfs2_state_bits {
48 BH_NeedsValidate = BH_JBDPrivateStart,
49};
50
51/* Expand the magic b_state functions */
52BUFFER_FNS(NeedsValidate, needs_validate);
53
42int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh, 54int ocfs2_write_block(struct ocfs2_super *osb, struct buffer_head *bh,
43 struct inode *inode) 55 struct inode *inode)
44{ 56{
@@ -166,7 +178,9 @@ bail:
166} 178}
167 179
168int ocfs2_read_blocks(struct inode *inode, u64 block, int nr, 180int ocfs2_read_blocks(struct inode *inode, u64 block, int nr,
169 struct buffer_head *bhs[], int flags) 181 struct buffer_head *bhs[], int flags,
182 int (*validate)(struct super_block *sb,
183 struct buffer_head *bh))
170{ 184{
171 int status = 0; 185 int status = 0;
172 int i, ignore_cache = 0; 186 int i, ignore_cache = 0;
@@ -298,6 +312,8 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr,
298 312
299 clear_buffer_uptodate(bh); 313 clear_buffer_uptodate(bh);
300 get_bh(bh); /* for end_buffer_read_sync() */ 314 get_bh(bh); /* for end_buffer_read_sync() */
315 if (validate)
316 set_buffer_needs_validate(bh);
301 bh->b_end_io = end_buffer_read_sync; 317 bh->b_end_io = end_buffer_read_sync;
302 submit_bh(READ, bh); 318 submit_bh(READ, bh);
303 continue; 319 continue;
@@ -328,6 +344,20 @@ int ocfs2_read_blocks(struct inode *inode, u64 block, int nr,
328 bhs[i] = NULL; 344 bhs[i] = NULL;
329 continue; 345 continue;
330 } 346 }
347
348 if (buffer_needs_validate(bh)) {
349 /* We never set NeedsValidate if the
350 * buffer was held by the journal, so
351 * that better not have changed */
352 BUG_ON(buffer_jbd(bh));
353 clear_buffer_needs_validate(bh);
354 status = validate(inode->i_sb, bh);
355 if (status) {
356 put_bh(bh);
357 bhs[i] = NULL;
358 continue;
359 }
360 }
331 } 361 }
332 362
333 /* Always set the buffer in the cache, even if it was 363 /* Always set the buffer in the cache, even if it was
diff --git a/fs/ocfs2/buffer_head_io.h b/fs/ocfs2/buffer_head_io.h
index 75e1dcb1ade7..c75d682dadd8 100644
--- a/fs/ocfs2/buffer_head_io.h
+++ b/fs/ocfs2/buffer_head_io.h
@@ -31,21 +31,24 @@
31void ocfs2_end_buffer_io_sync(struct buffer_head *bh, 31void ocfs2_end_buffer_io_sync(struct buffer_head *bh,
32 int uptodate); 32 int uptodate);
33 33
34static inline int ocfs2_read_block(struct inode *inode,
35 u64 off,
36 struct buffer_head **bh);
37
38int ocfs2_write_block(struct ocfs2_super *osb, 34int ocfs2_write_block(struct ocfs2_super *osb,
39 struct buffer_head *bh, 35 struct buffer_head *bh,
40 struct inode *inode); 36 struct inode *inode);
41int ocfs2_read_blocks(struct inode *inode,
42 u64 block,
43 int nr,
44 struct buffer_head *bhs[],
45 int flags);
46int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block, 37int ocfs2_read_blocks_sync(struct ocfs2_super *osb, u64 block,
47 unsigned int nr, struct buffer_head *bhs[]); 38 unsigned int nr, struct buffer_head *bhs[]);
48 39
40/*
41 * If not NULL, validate() will be called on a buffer that is freshly
42 * read from disk. It will not be called if the buffer was in cache.
43 * Note that if validate() is being used for this buffer, it needs to
44 * be set even for a READAHEAD call, as it marks the buffer for later
45 * validation.
46 */
47int ocfs2_read_blocks(struct inode *inode, u64 block, int nr,
48 struct buffer_head *bhs[], int flags,
49 int (*validate)(struct super_block *sb,
50 struct buffer_head *bh));
51
49int ocfs2_write_super_or_backup(struct ocfs2_super *osb, 52int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
50 struct buffer_head *bh); 53 struct buffer_head *bh);
51 54
@@ -53,7 +56,9 @@ int ocfs2_write_super_or_backup(struct ocfs2_super *osb,
53#define OCFS2_BH_READAHEAD 8 56#define OCFS2_BH_READAHEAD 8
54 57
55static inline int ocfs2_read_block(struct inode *inode, u64 off, 58static inline int ocfs2_read_block(struct inode *inode, u64 off,
56 struct buffer_head **bh) 59 struct buffer_head **bh,
60 int (*validate)(struct super_block *sb,
61 struct buffer_head *bh))
57{ 62{
58 int status = 0; 63 int status = 0;
59 64
@@ -63,7 +68,7 @@ static inline int ocfs2_read_block(struct inode *inode, u64 off,
63 goto bail; 68 goto bail;
64 } 69 }
65 70
66 status = ocfs2_read_blocks(inode, off, 1, bh, 0); 71 status = ocfs2_read_blocks(inode, off, 1, bh, 0, validate);
67 72
68bail: 73bail:
69 return status; 74 return status;
diff --git a/fs/ocfs2/cluster/masklog.c b/fs/ocfs2/cluster/masklog.c
index d8a0cb92cef6..96df5416993e 100644
--- a/fs/ocfs2/cluster/masklog.c
+++ b/fs/ocfs2/cluster/masklog.c
@@ -110,6 +110,7 @@ static struct mlog_attribute mlog_attrs[MLOG_MAX_BITS] = {
110 define_mask(QUORUM), 110 define_mask(QUORUM),
111 define_mask(EXPORT), 111 define_mask(EXPORT),
112 define_mask(XATTR), 112 define_mask(XATTR),
113 define_mask(QUOTA),
113 define_mask(ERROR), 114 define_mask(ERROR),
114 define_mask(NOTICE), 115 define_mask(NOTICE),
115 define_mask(KTHREAD), 116 define_mask(KTHREAD),
diff --git a/fs/ocfs2/cluster/masklog.h b/fs/ocfs2/cluster/masklog.h
index 57670c680471..7e72a81bc2d4 100644
--- a/fs/ocfs2/cluster/masklog.h
+++ b/fs/ocfs2/cluster/masklog.h
@@ -113,6 +113,7 @@
113#define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */ 113#define ML_QUORUM 0x0000000008000000ULL /* net connection quorum */
114#define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */ 114#define ML_EXPORT 0x0000000010000000ULL /* ocfs2 export operations */
115#define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */ 115#define ML_XATTR 0x0000000020000000ULL /* ocfs2 extended attributes */
116#define ML_QUOTA 0x0000000040000000ULL /* ocfs2 quota operations */
116/* bits that are infrequently given and frequently matched in the high word */ 117/* bits that are infrequently given and frequently matched in the high word */
117#define ML_ERROR 0x0000000100000000ULL /* sent to KERN_ERR */ 118#define ML_ERROR 0x0000000100000000ULL /* sent to KERN_ERR */
118#define ML_NOTICE 0x0000000200000000ULL /* setn to KERN_NOTICE */ 119#define ML_NOTICE 0x0000000200000000ULL /* setn to KERN_NOTICE */
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c
index 026e6eb85187..f2c4098cf337 100644
--- a/fs/ocfs2/dir.c
+++ b/fs/ocfs2/dir.c
@@ -40,6 +40,7 @@
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/highmem.h> 42#include <linux/highmem.h>
43#include <linux/quotaops.h>
43 44
44#define MLOG_MASK_PREFIX ML_NAMEI 45#define MLOG_MASK_PREFIX ML_NAMEI
45#include <cluster/masklog.h> 46#include <cluster/masklog.h>
@@ -47,6 +48,7 @@
47#include "ocfs2.h" 48#include "ocfs2.h"
48 49
49#include "alloc.h" 50#include "alloc.h"
51#include "blockcheck.h"
50#include "dir.h" 52#include "dir.h"
51#include "dlmglue.h" 53#include "dlmglue.h"
52#include "extent_map.h" 54#include "extent_map.h"
@@ -82,47 +84,72 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
82 struct ocfs2_alloc_context *meta_ac, 84 struct ocfs2_alloc_context *meta_ac,
83 struct buffer_head **new_bh); 85 struct buffer_head **new_bh);
84 86
85static struct buffer_head *ocfs2_bread(struct inode *inode, 87/*
86 int block, int *err, int reada) 88 * These are distinct checks because future versions of the file system will
89 * want to have a trailing dirent structure independent of indexing.
90 */
91static int ocfs2_dir_has_trailer(struct inode *dir)
87{ 92{
88 struct buffer_head *bh = NULL; 93 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
89 int tmperr; 94 return 0;
90 u64 p_blkno;
91 int readflags = 0;
92 95
93 if (reada) 96 return ocfs2_meta_ecc(OCFS2_SB(dir->i_sb));
94 readflags |= OCFS2_BH_READAHEAD; 97}
95 98
96 if (((u64)block << inode->i_sb->s_blocksize_bits) >= 99static int ocfs2_supports_dir_trailer(struct ocfs2_super *osb)
97 i_size_read(inode)) { 100{
98 BUG_ON(!reada); 101 return ocfs2_meta_ecc(osb);
99 return NULL; 102}
100 }
101 103
102 down_read(&OCFS2_I(inode)->ip_alloc_sem); 104static inline unsigned int ocfs2_dir_trailer_blk_off(struct super_block *sb)
103 tmperr = ocfs2_extent_map_get_blocks(inode, block, &p_blkno, NULL, 105{
104 NULL); 106 return sb->s_blocksize - sizeof(struct ocfs2_dir_block_trailer);
105 up_read(&OCFS2_I(inode)->ip_alloc_sem); 107}
106 if (tmperr < 0) {
107 mlog_errno(tmperr);
108 goto fail;
109 }
110 108
111 tmperr = ocfs2_read_blocks(inode, p_blkno, 1, &bh, readflags); 109#define ocfs2_trailer_from_bh(_bh, _sb) ((struct ocfs2_dir_block_trailer *) ((_bh)->b_data + ocfs2_dir_trailer_blk_off((_sb))))
112 if (tmperr < 0)
113 goto fail;
114 110
115 tmperr = 0; 111/* XXX ocfs2_block_dqtrailer() is similar but not quite - can we make
112 * them more consistent? */
113struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize,
114 void *data)
115{
116 char *p = data;
116 117
117 *err = 0; 118 p += blocksize - sizeof(struct ocfs2_dir_block_trailer);
118 return bh; 119 return (struct ocfs2_dir_block_trailer *)p;
120}
119 121
120fail: 122/*
121 brelse(bh); 123 * XXX: This is executed once on every dirent. We should consider optimizing
122 bh = NULL; 124 * it.
125 */
126static int ocfs2_skip_dir_trailer(struct inode *dir,
127 struct ocfs2_dir_entry *de,
128 unsigned long offset,
129 unsigned long blklen)
130{
131 unsigned long toff = blklen - sizeof(struct ocfs2_dir_block_trailer);
123 132
124 *err = -EIO; 133 if (!ocfs2_dir_has_trailer(dir))
125 return NULL; 134 return 0;
135
136 if (offset != toff)
137 return 0;
138
139 return 1;
140}
141
142static void ocfs2_init_dir_trailer(struct inode *inode,
143 struct buffer_head *bh)
144{
145 struct ocfs2_dir_block_trailer *trailer;
146
147 trailer = ocfs2_trailer_from_bh(bh, inode->i_sb);
148 strcpy(trailer->db_signature, OCFS2_DIR_TRAILER_SIGNATURE);
149 trailer->db_compat_rec_len =
150 cpu_to_le16(sizeof(struct ocfs2_dir_block_trailer));
151 trailer->db_parent_dinode = cpu_to_le64(OCFS2_I(inode)->ip_blkno);
152 trailer->db_blkno = cpu_to_le64(bh->b_blocknr);
126} 153}
127 154
128/* 155/*
@@ -231,7 +258,7 @@ static struct buffer_head *ocfs2_find_entry_id(const char *name,
231 struct ocfs2_dinode *di; 258 struct ocfs2_dinode *di;
232 struct ocfs2_inline_data *data; 259 struct ocfs2_inline_data *data;
233 260
234 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh); 261 ret = ocfs2_read_inode_block(dir, &di_bh);
235 if (ret) { 262 if (ret) {
236 mlog_errno(ret); 263 mlog_errno(ret);
237 goto out; 264 goto out;
@@ -250,6 +277,108 @@ out:
250 return NULL; 277 return NULL;
251} 278}
252 279
280static int ocfs2_validate_dir_block(struct super_block *sb,
281 struct buffer_head *bh)
282{
283 int rc;
284 struct ocfs2_dir_block_trailer *trailer =
285 ocfs2_trailer_from_bh(bh, sb);
286
287
288 /*
289 * We don't validate dirents here, that's handled
290 * in-place when the code walks them.
291 */
292 mlog(0, "Validating dirblock %llu\n",
293 (unsigned long long)bh->b_blocknr);
294
295 BUG_ON(!buffer_uptodate(bh));
296
297 /*
298 * If the ecc fails, we return the error but otherwise
299 * leave the filesystem running. We know any error is
300 * local to this block.
301 *
302 * Note that we are safe to call this even if the directory
303 * doesn't have a trailer. Filesystems without metaecc will do
304 * nothing, and filesystems with it will have one.
305 */
306 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &trailer->db_check);
307 if (rc)
308 mlog(ML_ERROR, "Checksum failed for dinode %llu\n",
309 (unsigned long long)bh->b_blocknr);
310
311 return rc;
312}
313
314/*
315 * This function forces all errors to -EIO for consistency with its
316 * predecessor, ocfs2_bread(). We haven't audited what returning the
317 * real error codes would do to callers. We log the real codes with
318 * mlog_errno() before we squash them.
319 */
320static int ocfs2_read_dir_block(struct inode *inode, u64 v_block,
321 struct buffer_head **bh, int flags)
322{
323 int rc = 0;
324 struct buffer_head *tmp = *bh;
325 struct ocfs2_dir_block_trailer *trailer;
326
327 rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, flags,
328 ocfs2_validate_dir_block);
329 if (rc) {
330 mlog_errno(rc);
331 goto out;
332 }
333
334 /*
335 * We check the trailer here rather than in
336 * ocfs2_validate_dir_block() because that function doesn't have
337 * the inode to test.
338 */
339 if (!(flags & OCFS2_BH_READAHEAD) &&
340 ocfs2_dir_has_trailer(inode)) {
341 trailer = ocfs2_trailer_from_bh(tmp, inode->i_sb);
342 if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) {
343 rc = -EINVAL;
344 ocfs2_error(inode->i_sb,
345 "Invalid dirblock #%llu: "
346 "signature = %.*s\n",
347 (unsigned long long)tmp->b_blocknr, 7,
348 trailer->db_signature);
349 goto out;
350 }
351 if (le64_to_cpu(trailer->db_blkno) != tmp->b_blocknr) {
352 rc = -EINVAL;
353 ocfs2_error(inode->i_sb,
354 "Directory block #%llu has an invalid "
355 "db_blkno of %llu",
356 (unsigned long long)tmp->b_blocknr,
357 (unsigned long long)le64_to_cpu(trailer->db_blkno));
358 goto out;
359 }
360 if (le64_to_cpu(trailer->db_parent_dinode) !=
361 OCFS2_I(inode)->ip_blkno) {
362 rc = -EINVAL;
363 ocfs2_error(inode->i_sb,
364 "Directory block #%llu on dinode "
365 "#%llu has an invalid parent_dinode "
366 "of %llu",
367 (unsigned long long)tmp->b_blocknr,
368 (unsigned long long)OCFS2_I(inode)->ip_blkno,
369 (unsigned long long)le64_to_cpu(trailer->db_blkno));
370 goto out;
371 }
372 }
373
374 /* If ocfs2_read_virt_blocks() got us a new bh, pass it up. */
375 if (!*bh)
376 *bh = tmp;
377
378out:
379 return rc ? -EIO : 0;
380}
381
253static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen, 382static struct buffer_head *ocfs2_find_entry_el(const char *name, int namelen,
254 struct inode *dir, 383 struct inode *dir,
255 struct ocfs2_dir_entry **res_dir) 384 struct ocfs2_dir_entry **res_dir)
@@ -296,15 +425,17 @@ restart:
296 } 425 }
297 num++; 426 num++;
298 427
299 bh = ocfs2_bread(dir, b++, &err, 1); 428 bh = NULL;
429 err = ocfs2_read_dir_block(dir, b++, &bh,
430 OCFS2_BH_READAHEAD);
300 bh_use[ra_max] = bh; 431 bh_use[ra_max] = bh;
301 } 432 }
302 } 433 }
303 if ((bh = bh_use[ra_ptr++]) == NULL) 434 if ((bh = bh_use[ra_ptr++]) == NULL)
304 goto next; 435 goto next;
305 if (ocfs2_read_block(dir, block, &bh)) { 436 if (ocfs2_read_dir_block(dir, block, &bh, 0)) {
306 /* read error, skip block & hope for the best. 437 /* read error, skip block & hope for the best.
307 * ocfs2_read_block() has released the bh. */ 438 * ocfs2_read_dir_block() has released the bh. */
308 ocfs2_error(dir->i_sb, "reading directory %llu, " 439 ocfs2_error(dir->i_sb, "reading directory %llu, "
309 "offset %lu\n", 440 "offset %lu\n",
310 (unsigned long long)OCFS2_I(dir)->ip_blkno, 441 (unsigned long long)OCFS2_I(dir)->ip_blkno,
@@ -381,14 +512,18 @@ int ocfs2_update_entry(struct inode *dir, handle_t *handle,
381 struct inode *new_entry_inode) 512 struct inode *new_entry_inode)
382{ 513{
383 int ret; 514 int ret;
515 ocfs2_journal_access_func access = ocfs2_journal_access_db;
384 516
385 /* 517 /*
386 * The same code works fine for both inline-data and extent 518 * The same code works fine for both inline-data and extent
387 * based directories, so no need to split this up. 519 * based directories, so no need to split this up. The only
520 * difference is the journal_access function.
388 */ 521 */
389 522
390 ret = ocfs2_journal_access(handle, dir, de_bh, 523 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
391 OCFS2_JOURNAL_ACCESS_WRITE); 524 access = ocfs2_journal_access_di;
525
526 ret = access(handle, dir, de_bh, OCFS2_JOURNAL_ACCESS_WRITE);
392 if (ret) { 527 if (ret) {
393 mlog_errno(ret); 528 mlog_errno(ret);
394 goto out; 529 goto out;
@@ -410,9 +545,13 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
410{ 545{
411 struct ocfs2_dir_entry *de, *pde; 546 struct ocfs2_dir_entry *de, *pde;
412 int i, status = -ENOENT; 547 int i, status = -ENOENT;
548 ocfs2_journal_access_func access = ocfs2_journal_access_db;
413 549
414 mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh); 550 mlog_entry("(0x%p, 0x%p, 0x%p, 0x%p)\n", handle, dir, de_del, bh);
415 551
552 if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
553 access = ocfs2_journal_access_di;
554
416 i = 0; 555 i = 0;
417 pde = NULL; 556 pde = NULL;
418 de = (struct ocfs2_dir_entry *) first_de; 557 de = (struct ocfs2_dir_entry *) first_de;
@@ -423,8 +562,8 @@ static int __ocfs2_delete_entry(handle_t *handle, struct inode *dir,
423 goto bail; 562 goto bail;
424 } 563 }
425 if (de == de_del) { 564 if (de == de_del) {
426 status = ocfs2_journal_access(handle, dir, bh, 565 status = access(handle, dir, bh,
427 OCFS2_JOURNAL_ACCESS_WRITE); 566 OCFS2_JOURNAL_ACCESS_WRITE);
428 if (status < 0) { 567 if (status < 0) {
429 status = -EIO; 568 status = -EIO;
430 mlog_errno(status); 569 mlog_errno(status);
@@ -458,7 +597,7 @@ static inline int ocfs2_delete_entry_id(handle_t *handle,
458 struct ocfs2_dinode *di; 597 struct ocfs2_dinode *di;
459 struct ocfs2_inline_data *data; 598 struct ocfs2_inline_data *data;
460 599
461 ret = ocfs2_read_block(dir, OCFS2_I(dir)->ip_blkno, &di_bh); 600 ret = ocfs2_read_inode_block(dir, &di_bh);
462 if (ret) { 601 if (ret) {
463 mlog_errno(ret); 602 mlog_errno(ret);
464 goto out; 603 goto out;
@@ -576,6 +715,16 @@ int __ocfs2_add_entry(handle_t *handle,
576 goto bail; 715 goto bail;
577 } 716 }
578 717
718 /* We're guaranteed that we should have space, so we
719 * can't possibly have hit the trailer...right? */
720 mlog_bug_on_msg(ocfs2_skip_dir_trailer(dir, de, offset, size),
721 "Hit dir trailer trying to insert %.*s "
722 "(namelen %d) into directory %llu. "
723 "offset is %lu, trailer offset is %d\n",
724 namelen, name, namelen,
725 (unsigned long long)parent_fe_bh->b_blocknr,
726 offset, ocfs2_dir_trailer_blk_off(dir->i_sb));
727
579 if (ocfs2_dirent_would_fit(de, rec_len)) { 728 if (ocfs2_dirent_would_fit(de, rec_len)) {
580 dir->i_mtime = dir->i_ctime = CURRENT_TIME; 729 dir->i_mtime = dir->i_ctime = CURRENT_TIME;
581 retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh); 730 retval = ocfs2_mark_inode_dirty(handle, dir, parent_fe_bh);
@@ -584,8 +733,14 @@ int __ocfs2_add_entry(handle_t *handle,
584 goto bail; 733 goto bail;
585 } 734 }
586 735
587 status = ocfs2_journal_access(handle, dir, insert_bh, 736 if (insert_bh == parent_fe_bh)
588 OCFS2_JOURNAL_ACCESS_WRITE); 737 status = ocfs2_journal_access_di(handle, dir,
738 insert_bh,
739 OCFS2_JOURNAL_ACCESS_WRITE);
740 else
741 status = ocfs2_journal_access_db(handle, dir,
742 insert_bh,
743 OCFS2_JOURNAL_ACCESS_WRITE);
589 /* By now the buffer is marked for journaling */ 744 /* By now the buffer is marked for journaling */
590 offset += le16_to_cpu(de->rec_len); 745 offset += le16_to_cpu(de->rec_len);
591 if (le64_to_cpu(de->inode)) { 746 if (le64_to_cpu(de->inode)) {
@@ -611,6 +766,7 @@ int __ocfs2_add_entry(handle_t *handle,
611 retval = 0; 766 retval = 0;
612 goto bail; 767 goto bail;
613 } 768 }
769
614 offset += le16_to_cpu(de->rec_len); 770 offset += le16_to_cpu(de->rec_len);
615 de = (struct ocfs2_dir_entry *) ((char *) de + le16_to_cpu(de->rec_len)); 771 de = (struct ocfs2_dir_entry *) ((char *) de + le16_to_cpu(de->rec_len));
616 } 772 }
@@ -636,7 +792,7 @@ static int ocfs2_dir_foreach_blk_id(struct inode *inode,
636 struct ocfs2_inline_data *data; 792 struct ocfs2_inline_data *data;
637 struct ocfs2_dir_entry *de; 793 struct ocfs2_dir_entry *de;
638 794
639 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh); 795 ret = ocfs2_read_inode_block(inode, &di_bh);
640 if (ret) { 796 if (ret) {
641 mlog(ML_ERROR, "Unable to read inode block for dir %llu\n", 797 mlog(ML_ERROR, "Unable to read inode block for dir %llu\n",
642 (unsigned long long)OCFS2_I(inode)->ip_blkno); 798 (unsigned long long)OCFS2_I(inode)->ip_blkno);
@@ -724,7 +880,6 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
724 int i, stored; 880 int i, stored;
725 struct buffer_head * bh, * tmp; 881 struct buffer_head * bh, * tmp;
726 struct ocfs2_dir_entry * de; 882 struct ocfs2_dir_entry * de;
727 int err;
728 struct super_block * sb = inode->i_sb; 883 struct super_block * sb = inode->i_sb;
729 unsigned int ra_sectors = 16; 884 unsigned int ra_sectors = 16;
730 885
@@ -735,12 +890,8 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
735 890
736 while (!error && !stored && *f_pos < i_size_read(inode)) { 891 while (!error && !stored && *f_pos < i_size_read(inode)) {
737 blk = (*f_pos) >> sb->s_blocksize_bits; 892 blk = (*f_pos) >> sb->s_blocksize_bits;
738 bh = ocfs2_bread(inode, blk, &err, 0); 893 if (ocfs2_read_dir_block(inode, blk, &bh, 0)) {
739 if (!bh) { 894 /* Skip the corrupt dirblock and keep trying */
740 mlog(ML_ERROR,
741 "directory #%llu contains a hole at offset %lld\n",
742 (unsigned long long)OCFS2_I(inode)->ip_blkno,
743 *f_pos);
744 *f_pos += sb->s_blocksize - offset; 895 *f_pos += sb->s_blocksize - offset;
745 continue; 896 continue;
746 } 897 }
@@ -754,8 +905,10 @@ static int ocfs2_dir_foreach_blk_el(struct inode *inode,
754 || (((last_ra_blk - blk) << 9) <= (ra_sectors / 2))) { 905 || (((last_ra_blk - blk) << 9) <= (ra_sectors / 2))) {
755 for (i = ra_sectors >> (sb->s_blocksize_bits - 9); 906 for (i = ra_sectors >> (sb->s_blocksize_bits - 9);
756 i > 0; i--) { 907 i > 0; i--) {
757 tmp = ocfs2_bread(inode, ++blk, &err, 1); 908 tmp = NULL;
758 brelse(tmp); 909 if (!ocfs2_read_dir_block(inode, ++blk, &tmp,
910 OCFS2_BH_READAHEAD))
911 brelse(tmp);
759 } 912 }
760 last_ra_blk = blk; 913 last_ra_blk = blk;
761 ra_sectors = 8; 914 ra_sectors = 8;
@@ -828,6 +981,7 @@ revalidate:
828 } 981 }
829 offset = 0; 982 offset = 0;
830 brelse(bh); 983 brelse(bh);
984 bh = NULL;
831 } 985 }
832 986
833 stored = 0; 987 stored = 0;
@@ -1050,9 +1204,15 @@ int ocfs2_empty_dir(struct inode *inode)
1050 return !priv.seen_other; 1204 return !priv.seen_other;
1051} 1205}
1052 1206
1053static void ocfs2_fill_initial_dirents(struct inode *inode, 1207/*
1054 struct inode *parent, 1208 * Fills "." and ".." dirents in a new directory block. Returns dirent for
1055 char *start, unsigned int size) 1209 * "..", which might be used during creation of a directory with a trailing
1210 * header. It is otherwise safe to ignore the return code.
1211 */
1212static struct ocfs2_dir_entry *ocfs2_fill_initial_dirents(struct inode *inode,
1213 struct inode *parent,
1214 char *start,
1215 unsigned int size)
1056{ 1216{
1057 struct ocfs2_dir_entry *de = (struct ocfs2_dir_entry *)start; 1217 struct ocfs2_dir_entry *de = (struct ocfs2_dir_entry *)start;
1058 1218
@@ -1069,6 +1229,8 @@ static void ocfs2_fill_initial_dirents(struct inode *inode,
1069 de->name_len = 2; 1229 de->name_len = 2;
1070 strcpy(de->name, ".."); 1230 strcpy(de->name, "..");
1071 ocfs2_set_de_type(de, S_IFDIR); 1231 ocfs2_set_de_type(de, S_IFDIR);
1232
1233 return de;
1072} 1234}
1073 1235
1074/* 1236/*
@@ -1086,8 +1248,8 @@ static int ocfs2_fill_new_dir_id(struct ocfs2_super *osb,
1086 struct ocfs2_inline_data *data = &di->id2.i_data; 1248 struct ocfs2_inline_data *data = &di->id2.i_data;
1087 unsigned int size = le16_to_cpu(data->id_count); 1249 unsigned int size = le16_to_cpu(data->id_count);
1088 1250
1089 ret = ocfs2_journal_access(handle, inode, di_bh, 1251 ret = ocfs2_journal_access_di(handle, inode, di_bh,
1090 OCFS2_JOURNAL_ACCESS_WRITE); 1252 OCFS2_JOURNAL_ACCESS_WRITE);
1091 if (ret) { 1253 if (ret) {
1092 mlog_errno(ret); 1254 mlog_errno(ret);
1093 goto out; 1255 goto out;
@@ -1121,10 +1283,15 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
1121 struct ocfs2_alloc_context *data_ac) 1283 struct ocfs2_alloc_context *data_ac)
1122{ 1284{
1123 int status; 1285 int status;
1286 unsigned int size = osb->sb->s_blocksize;
1124 struct buffer_head *new_bh = NULL; 1287 struct buffer_head *new_bh = NULL;
1288 struct ocfs2_dir_entry *de;
1125 1289
1126 mlog_entry_void(); 1290 mlog_entry_void();
1127 1291
1292 if (ocfs2_supports_dir_trailer(osb))
1293 size = ocfs2_dir_trailer_blk_off(parent->i_sb);
1294
1128 status = ocfs2_do_extend_dir(osb->sb, handle, inode, fe_bh, 1295 status = ocfs2_do_extend_dir(osb->sb, handle, inode, fe_bh,
1129 data_ac, NULL, &new_bh); 1296 data_ac, NULL, &new_bh);
1130 if (status < 0) { 1297 if (status < 0) {
@@ -1134,16 +1301,17 @@ static int ocfs2_fill_new_dir_el(struct ocfs2_super *osb,
1134 1301
1135 ocfs2_set_new_buffer_uptodate(inode, new_bh); 1302 ocfs2_set_new_buffer_uptodate(inode, new_bh);
1136 1303
1137 status = ocfs2_journal_access(handle, inode, new_bh, 1304 status = ocfs2_journal_access_db(handle, inode, new_bh,
1138 OCFS2_JOURNAL_ACCESS_CREATE); 1305 OCFS2_JOURNAL_ACCESS_CREATE);
1139 if (status < 0) { 1306 if (status < 0) {
1140 mlog_errno(status); 1307 mlog_errno(status);
1141 goto bail; 1308 goto bail;
1142 } 1309 }
1143 memset(new_bh->b_data, 0, osb->sb->s_blocksize); 1310 memset(new_bh->b_data, 0, osb->sb->s_blocksize);
1144 1311
1145 ocfs2_fill_initial_dirents(inode, parent, new_bh->b_data, 1312 de = ocfs2_fill_initial_dirents(inode, parent, new_bh->b_data, size);
1146 osb->sb->s_blocksize); 1313 if (ocfs2_supports_dir_trailer(osb))
1314 ocfs2_init_dir_trailer(inode, new_bh);
1147 1315
1148 status = ocfs2_journal_dirty(handle, new_bh); 1316 status = ocfs2_journal_dirty(handle, new_bh);
1149 if (status < 0) { 1317 if (status < 0) {
@@ -1184,13 +1352,27 @@ int ocfs2_fill_new_dir(struct ocfs2_super *osb,
1184 data_ac); 1352 data_ac);
1185} 1353}
1186 1354
1355/*
1356 * Expand rec_len of the rightmost dirent in a directory block so that it
1357 * contains the end of our valid space for dirents. We do this during
1358 * expansion from an inline directory to one with extents. The first dir block
1359 * in that case is taken from the inline data portion of the inode block.
1360 *
1361 * We add the dir trailer if this filesystem wants it.
1362 */
1187static void ocfs2_expand_last_dirent(char *start, unsigned int old_size, 1363static void ocfs2_expand_last_dirent(char *start, unsigned int old_size,
1188 unsigned int new_size) 1364 struct super_block *sb)
1189{ 1365{
1190 struct ocfs2_dir_entry *de; 1366 struct ocfs2_dir_entry *de;
1191 struct ocfs2_dir_entry *prev_de; 1367 struct ocfs2_dir_entry *prev_de;
1192 char *de_buf, *limit; 1368 char *de_buf, *limit;
1193 unsigned int bytes = new_size - old_size; 1369 unsigned int new_size = sb->s_blocksize;
1370 unsigned int bytes;
1371
1372 if (ocfs2_supports_dir_trailer(OCFS2_SB(sb)))
1373 new_size = ocfs2_dir_trailer_blk_off(sb);
1374
1375 bytes = new_size - old_size;
1194 1376
1195 limit = start + old_size; 1377 limit = start + old_size;
1196 de_buf = start; 1378 de_buf = start;
@@ -1216,9 +1398,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1216 unsigned int blocks_wanted, 1398 unsigned int blocks_wanted,
1217 struct buffer_head **first_block_bh) 1399 struct buffer_head **first_block_bh)
1218{ 1400{
1219 int ret, credits = OCFS2_INLINE_TO_EXTENTS_CREDITS;
1220 u32 alloc, bit_off, len; 1401 u32 alloc, bit_off, len;
1221 struct super_block *sb = dir->i_sb; 1402 struct super_block *sb = dir->i_sb;
1403 int ret, credits = ocfs2_inline_to_extents_credits(sb);
1222 u64 blkno, bytes = blocks_wanted << sb->s_blocksize_bits; 1404 u64 blkno, bytes = blocks_wanted << sb->s_blocksize_bits;
1223 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); 1405 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
1224 struct ocfs2_inode_info *oi = OCFS2_I(dir); 1406 struct ocfs2_inode_info *oi = OCFS2_I(dir);
@@ -1227,6 +1409,7 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1227 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 1409 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1228 handle_t *handle; 1410 handle_t *handle;
1229 struct ocfs2_extent_tree et; 1411 struct ocfs2_extent_tree et;
1412 int did_quota = 0;
1230 1413
1231 ocfs2_init_dinode_extent_tree(&et, dir, di_bh); 1414 ocfs2_init_dinode_extent_tree(&et, dir, di_bh);
1232 1415
@@ -1264,6 +1447,12 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1264 goto out_sem; 1447 goto out_sem;
1265 } 1448 }
1266 1449
1450 if (vfs_dq_alloc_space_nodirty(dir,
1451 ocfs2_clusters_to_bytes(osb->sb, alloc))) {
1452 ret = -EDQUOT;
1453 goto out_commit;
1454 }
1455 did_quota = 1;
1267 /* 1456 /*
1268 * Try to claim as many clusters as the bitmap can give though 1457 * Try to claim as many clusters as the bitmap can give though
1269 * if we only get one now, that's enough to continue. The rest 1458 * if we only get one now, that's enough to continue. The rest
@@ -1290,8 +1479,8 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1290 1479
1291 ocfs2_set_new_buffer_uptodate(dir, dirdata_bh); 1480 ocfs2_set_new_buffer_uptodate(dir, dirdata_bh);
1292 1481
1293 ret = ocfs2_journal_access(handle, dir, dirdata_bh, 1482 ret = ocfs2_journal_access_db(handle, dir, dirdata_bh,
1294 OCFS2_JOURNAL_ACCESS_CREATE); 1483 OCFS2_JOURNAL_ACCESS_CREATE);
1295 if (ret) { 1484 if (ret) {
1296 mlog_errno(ret); 1485 mlog_errno(ret);
1297 goto out_commit; 1486 goto out_commit;
@@ -1300,8 +1489,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1300 memcpy(dirdata_bh->b_data, di->id2.i_data.id_data, i_size_read(dir)); 1489 memcpy(dirdata_bh->b_data, di->id2.i_data.id_data, i_size_read(dir));
1301 memset(dirdata_bh->b_data + i_size_read(dir), 0, 1490 memset(dirdata_bh->b_data + i_size_read(dir), 0,
1302 sb->s_blocksize - i_size_read(dir)); 1491 sb->s_blocksize - i_size_read(dir));
1303 ocfs2_expand_last_dirent(dirdata_bh->b_data, i_size_read(dir), 1492 ocfs2_expand_last_dirent(dirdata_bh->b_data, i_size_read(dir), sb);
1304 sb->s_blocksize); 1493 if (ocfs2_supports_dir_trailer(osb))
1494 ocfs2_init_dir_trailer(dir, dirdata_bh);
1305 1495
1306 ret = ocfs2_journal_dirty(handle, dirdata_bh); 1496 ret = ocfs2_journal_dirty(handle, dirdata_bh);
1307 if (ret) { 1497 if (ret) {
@@ -1317,8 +1507,8 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1317 * We let the later dirent insert modify c/mtime - to the user 1507 * We let the later dirent insert modify c/mtime - to the user
1318 * the data hasn't changed. 1508 * the data hasn't changed.
1319 */ 1509 */
1320 ret = ocfs2_journal_access(handle, dir, di_bh, 1510 ret = ocfs2_journal_access_di(handle, dir, di_bh,
1321 OCFS2_JOURNAL_ACCESS_CREATE); 1511 OCFS2_JOURNAL_ACCESS_CREATE);
1322 if (ret) { 1512 if (ret) {
1323 mlog_errno(ret); 1513 mlog_errno(ret);
1324 goto out_commit; 1514 goto out_commit;
@@ -1386,6 +1576,9 @@ static int ocfs2_expand_inline_dir(struct inode *dir, struct buffer_head *di_bh,
1386 dirdata_bh = NULL; 1576 dirdata_bh = NULL;
1387 1577
1388out_commit: 1578out_commit:
1579 if (ret < 0 && did_quota)
1580 vfs_dq_free_space_nodirty(dir,
1581 ocfs2_clusters_to_bytes(osb->sb, 2));
1389 ocfs2_commit_trans(osb, handle); 1582 ocfs2_commit_trans(osb, handle);
1390 1583
1391out_sem: 1584out_sem:
@@ -1410,7 +1603,7 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
1410 struct buffer_head **new_bh) 1603 struct buffer_head **new_bh)
1411{ 1604{
1412 int status; 1605 int status;
1413 int extend; 1606 int extend, did_quota = 0;
1414 u64 p_blkno, v_blkno; 1607 u64 p_blkno, v_blkno;
1415 1608
1416 spin_lock(&OCFS2_I(dir)->ip_lock); 1609 spin_lock(&OCFS2_I(dir)->ip_lock);
@@ -1420,6 +1613,13 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
1420 if (extend) { 1613 if (extend) {
1421 u32 offset = OCFS2_I(dir)->ip_clusters; 1614 u32 offset = OCFS2_I(dir)->ip_clusters;
1422 1615
1616 if (vfs_dq_alloc_space_nodirty(dir,
1617 ocfs2_clusters_to_bytes(sb, 1))) {
1618 status = -EDQUOT;
1619 goto bail;
1620 }
1621 did_quota = 1;
1622
1423 status = ocfs2_add_inode_data(OCFS2_SB(sb), dir, &offset, 1623 status = ocfs2_add_inode_data(OCFS2_SB(sb), dir, &offset,
1424 1, 0, parent_fe_bh, handle, 1624 1, 0, parent_fe_bh, handle,
1425 data_ac, meta_ac, NULL); 1625 data_ac, meta_ac, NULL);
@@ -1445,6 +1645,8 @@ static int ocfs2_do_extend_dir(struct super_block *sb,
1445 } 1645 }
1446 status = 0; 1646 status = 0;
1447bail: 1647bail:
1648 if (did_quota && status < 0)
1649 vfs_dq_free_space_nodirty(dir, ocfs2_clusters_to_bytes(sb, 1));
1448 mlog_exit(status); 1650 mlog_exit(status);
1449 return status; 1651 return status;
1450} 1652}
@@ -1569,16 +1771,22 @@ do_extend:
1569 1771
1570 ocfs2_set_new_buffer_uptodate(dir, new_bh); 1772 ocfs2_set_new_buffer_uptodate(dir, new_bh);
1571 1773
1572 status = ocfs2_journal_access(handle, dir, new_bh, 1774 status = ocfs2_journal_access_db(handle, dir, new_bh,
1573 OCFS2_JOURNAL_ACCESS_CREATE); 1775 OCFS2_JOURNAL_ACCESS_CREATE);
1574 if (status < 0) { 1776 if (status < 0) {
1575 mlog_errno(status); 1777 mlog_errno(status);
1576 goto bail; 1778 goto bail;
1577 } 1779 }
1578 memset(new_bh->b_data, 0, sb->s_blocksize); 1780 memset(new_bh->b_data, 0, sb->s_blocksize);
1781
1579 de = (struct ocfs2_dir_entry *) new_bh->b_data; 1782 de = (struct ocfs2_dir_entry *) new_bh->b_data;
1580 de->inode = 0; 1783 de->inode = 0;
1581 de->rec_len = cpu_to_le16(sb->s_blocksize); 1784 if (ocfs2_dir_has_trailer(dir)) {
1785 de->rec_len = cpu_to_le16(ocfs2_dir_trailer_blk_off(sb));
1786 ocfs2_init_dir_trailer(dir, new_bh);
1787 } else {
1788 de->rec_len = cpu_to_le16(sb->s_blocksize);
1789 }
1582 status = ocfs2_journal_dirty(handle, new_bh); 1790 status = ocfs2_journal_dirty(handle, new_bh);
1583 if (status < 0) { 1791 if (status < 0) {
1584 mlog_errno(status); 1792 mlog_errno(status);
@@ -1620,11 +1828,21 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
1620 unsigned int *blocks_wanted) 1828 unsigned int *blocks_wanted)
1621{ 1829{
1622 int ret; 1830 int ret;
1831 struct super_block *sb = dir->i_sb;
1623 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 1832 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1624 struct ocfs2_dir_entry *de, *last_de = NULL; 1833 struct ocfs2_dir_entry *de, *last_de = NULL;
1625 char *de_buf, *limit; 1834 char *de_buf, *limit;
1626 unsigned long offset = 0; 1835 unsigned long offset = 0;
1627 unsigned int rec_len, new_rec_len; 1836 unsigned int rec_len, new_rec_len, free_space = dir->i_sb->s_blocksize;
1837
1838 /*
1839 * This calculates how many free bytes we'd have in block zero, should
1840 * this function force expansion to an extent tree.
1841 */
1842 if (ocfs2_supports_dir_trailer(OCFS2_SB(sb)))
1843 free_space = ocfs2_dir_trailer_blk_off(sb) - i_size_read(dir);
1844 else
1845 free_space = dir->i_sb->s_blocksize - i_size_read(dir);
1628 1846
1629 de_buf = di->id2.i_data.id_data; 1847 de_buf = di->id2.i_data.id_data;
1630 limit = de_buf + i_size_read(dir); 1848 limit = de_buf + i_size_read(dir);
@@ -1641,6 +1859,11 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
1641 ret = -EEXIST; 1859 ret = -EEXIST;
1642 goto out; 1860 goto out;
1643 } 1861 }
1862 /*
1863 * No need to check for a trailing dirent record here as
1864 * they're not used for inline dirs.
1865 */
1866
1644 if (ocfs2_dirent_would_fit(de, rec_len)) { 1867 if (ocfs2_dirent_would_fit(de, rec_len)) {
1645 /* Ok, we found a spot. Return this bh and let 1868 /* Ok, we found a spot. Return this bh and let
1646 * the caller actually fill it in. */ 1869 * the caller actually fill it in. */
@@ -1661,7 +1884,7 @@ static int ocfs2_find_dir_space_id(struct inode *dir, struct buffer_head *di_bh,
1661 * dirent can be found. 1884 * dirent can be found.
1662 */ 1885 */
1663 *blocks_wanted = 1; 1886 *blocks_wanted = 1;
1664 new_rec_len = le16_to_cpu(last_de->rec_len) + (dir->i_sb->s_blocksize - i_size_read(dir)); 1887 new_rec_len = le16_to_cpu(last_de->rec_len) + free_space;
1665 if (new_rec_len < (rec_len + OCFS2_DIR_REC_LEN(last_de->name_len))) 1888 if (new_rec_len < (rec_len + OCFS2_DIR_REC_LEN(last_de->name_len)))
1666 *blocks_wanted = 2; 1889 *blocks_wanted = 2;
1667 1890
@@ -1679,9 +1902,10 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
1679 struct ocfs2_dir_entry *de; 1902 struct ocfs2_dir_entry *de;
1680 struct super_block *sb = dir->i_sb; 1903 struct super_block *sb = dir->i_sb;
1681 int status; 1904 int status;
1905 int blocksize = dir->i_sb->s_blocksize;
1682 1906
1683 bh = ocfs2_bread(dir, 0, &status, 0); 1907 status = ocfs2_read_dir_block(dir, 0, &bh, 0);
1684 if (!bh) { 1908 if (status) {
1685 mlog_errno(status); 1909 mlog_errno(status);
1686 goto bail; 1910 goto bail;
1687 } 1911 }
@@ -1702,11 +1926,10 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
1702 status = -ENOSPC; 1926 status = -ENOSPC;
1703 goto bail; 1927 goto bail;
1704 } 1928 }
1705 bh = ocfs2_bread(dir, 1929 status = ocfs2_read_dir_block(dir,
1706 offset >> sb->s_blocksize_bits, 1930 offset >> sb->s_blocksize_bits,
1707 &status, 1931 &bh, 0);
1708 0); 1932 if (status) {
1709 if (!bh) {
1710 mlog_errno(status); 1933 mlog_errno(status);
1711 goto bail; 1934 goto bail;
1712 } 1935 }
@@ -1721,6 +1944,11 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
1721 status = -EEXIST; 1944 status = -EEXIST;
1722 goto bail; 1945 goto bail;
1723 } 1946 }
1947
1948 if (ocfs2_skip_dir_trailer(dir, de, offset % blocksize,
1949 blocksize))
1950 goto next;
1951
1724 if (ocfs2_dirent_would_fit(de, rec_len)) { 1952 if (ocfs2_dirent_would_fit(de, rec_len)) {
1725 /* Ok, we found a spot. Return this bh and let 1953 /* Ok, we found a spot. Return this bh and let
1726 * the caller actually fill it in. */ 1954 * the caller actually fill it in. */
@@ -1729,6 +1957,7 @@ static int ocfs2_find_dir_space_el(struct inode *dir, const char *name,
1729 status = 0; 1957 status = 0;
1730 goto bail; 1958 goto bail;
1731 } 1959 }
1960next:
1732 offset += le16_to_cpu(de->rec_len); 1961 offset += le16_to_cpu(de->rec_len);
1733 de = (struct ocfs2_dir_entry *)((char *) de + le16_to_cpu(de->rec_len)); 1962 de = (struct ocfs2_dir_entry *)((char *) de + le16_to_cpu(de->rec_len));
1734 } 1963 }
diff --git a/fs/ocfs2/dir.h b/fs/ocfs2/dir.h
index ce48b9080d87..c511e2e18e9f 100644
--- a/fs/ocfs2/dir.h
+++ b/fs/ocfs2/dir.h
@@ -83,4 +83,6 @@ int ocfs2_fill_new_dir(struct ocfs2_super *osb,
83 struct buffer_head *fe_bh, 83 struct buffer_head *fe_bh,
84 struct ocfs2_alloc_context *data_ac); 84 struct ocfs2_alloc_context *data_ac);
85 85
86struct ocfs2_dir_block_trailer *ocfs2_dir_trailer_from_size(int blocksize,
87 void *data);
86#endif /* OCFS2_DIR_H */ 88#endif /* OCFS2_DIR_H */
diff --git a/fs/ocfs2/dlm/dlmast.c b/fs/ocfs2/dlm/dlmast.c
index 644bee55d8ba..d07ddbe4b283 100644
--- a/fs/ocfs2/dlm/dlmast.c
+++ b/fs/ocfs2/dlm/dlmast.c
@@ -275,6 +275,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
275 struct list_head *iter, *head=NULL; 275 struct list_head *iter, *head=NULL;
276 u64 cookie; 276 u64 cookie;
277 u32 flags; 277 u32 flags;
278 u8 node;
278 279
279 if (!dlm_grab(dlm)) { 280 if (!dlm_grab(dlm)) {
280 dlm_error(DLM_REJECTED); 281 dlm_error(DLM_REJECTED);
@@ -286,18 +287,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
286 287
287 name = past->name; 288 name = past->name;
288 locklen = past->namelen; 289 locklen = past->namelen;
289 cookie = be64_to_cpu(past->cookie); 290 cookie = past->cookie;
290 flags = be32_to_cpu(past->flags); 291 flags = be32_to_cpu(past->flags);
292 node = past->node_idx;
291 293
292 if (locklen > DLM_LOCKID_NAME_MAX) { 294 if (locklen > DLM_LOCKID_NAME_MAX) {
293 ret = DLM_IVBUFLEN; 295 ret = DLM_IVBUFLEN;
294 mlog(ML_ERROR, "Invalid name length in proxy ast handler!\n"); 296 mlog(ML_ERROR, "Invalid name length (%d) in proxy ast "
297 "handler!\n", locklen);
295 goto leave; 298 goto leave;
296 } 299 }
297 300
298 if ((flags & (LKM_PUT_LVB|LKM_GET_LVB)) == 301 if ((flags & (LKM_PUT_LVB|LKM_GET_LVB)) ==
299 (LKM_PUT_LVB|LKM_GET_LVB)) { 302 (LKM_PUT_LVB|LKM_GET_LVB)) {
300 mlog(ML_ERROR, "both PUT and GET lvb specified\n"); 303 mlog(ML_ERROR, "Both PUT and GET lvb specified, (0x%x)\n",
304 flags);
301 ret = DLM_BADARGS; 305 ret = DLM_BADARGS;
302 goto leave; 306 goto leave;
303 } 307 }
@@ -310,22 +314,21 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
310 if (past->type != DLM_AST && 314 if (past->type != DLM_AST &&
311 past->type != DLM_BAST) { 315 past->type != DLM_BAST) {
312 mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu" 316 mlog(ML_ERROR, "Unknown ast type! %d, cookie=%u:%llu"
313 "name=%.*s\n", past->type, 317 "name=%.*s, node=%u\n", past->type,
314 dlm_get_lock_cookie_node(cookie), 318 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
315 dlm_get_lock_cookie_seq(cookie), 319 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
316 locklen, name); 320 locklen, name, node);
317 ret = DLM_IVLOCKID; 321 ret = DLM_IVLOCKID;
318 goto leave; 322 goto leave;
319 } 323 }
320 324
321 res = dlm_lookup_lockres(dlm, name, locklen); 325 res = dlm_lookup_lockres(dlm, name, locklen);
322 if (!res) { 326 if (!res) {
323 mlog(0, "got %sast for unknown lockres! " 327 mlog(0, "Got %sast for unknown lockres! cookie=%u:%llu, "
324 "cookie=%u:%llu, name=%.*s, namelen=%u\n", 328 "name=%.*s, node=%u\n", (past->type == DLM_AST ? "" : "b"),
325 past->type == DLM_AST ? "" : "b", 329 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
326 dlm_get_lock_cookie_node(cookie), 330 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
327 dlm_get_lock_cookie_seq(cookie), 331 locklen, name, node);
328 locklen, name, locklen);
329 ret = DLM_IVLOCKID; 332 ret = DLM_IVLOCKID;
330 goto leave; 333 goto leave;
331 } 334 }
@@ -337,12 +340,12 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
337 340
338 spin_lock(&res->spinlock); 341 spin_lock(&res->spinlock);
339 if (res->state & DLM_LOCK_RES_RECOVERING) { 342 if (res->state & DLM_LOCK_RES_RECOVERING) {
340 mlog(0, "responding with DLM_RECOVERING!\n"); 343 mlog(0, "Responding with DLM_RECOVERING!\n");
341 ret = DLM_RECOVERING; 344 ret = DLM_RECOVERING;
342 goto unlock_out; 345 goto unlock_out;
343 } 346 }
344 if (res->state & DLM_LOCK_RES_MIGRATING) { 347 if (res->state & DLM_LOCK_RES_MIGRATING) {
345 mlog(0, "responding with DLM_MIGRATING!\n"); 348 mlog(0, "Responding with DLM_MIGRATING!\n");
346 ret = DLM_MIGRATING; 349 ret = DLM_MIGRATING;
347 goto unlock_out; 350 goto unlock_out;
348 } 351 }
@@ -351,7 +354,7 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
351 lock = NULL; 354 lock = NULL;
352 list_for_each(iter, head) { 355 list_for_each(iter, head) {
353 lock = list_entry (iter, struct dlm_lock, list); 356 lock = list_entry (iter, struct dlm_lock, list);
354 if (be64_to_cpu(lock->ml.cookie) == cookie) 357 if (lock->ml.cookie == cookie)
355 goto do_ast; 358 goto do_ast;
356 } 359 }
357 360
@@ -363,15 +366,15 @@ int dlm_proxy_ast_handler(struct o2net_msg *msg, u32 len, void *data,
363 366
364 list_for_each(iter, head) { 367 list_for_each(iter, head) {
365 lock = list_entry (iter, struct dlm_lock, list); 368 lock = list_entry (iter, struct dlm_lock, list);
366 if (be64_to_cpu(lock->ml.cookie) == cookie) 369 if (lock->ml.cookie == cookie)
367 goto do_ast; 370 goto do_ast;
368 } 371 }
369 372
370 mlog(0, "got %sast for unknown lock! cookie=%u:%llu, " 373 mlog(0, "Got %sast for unknown lock! cookie=%u:%llu, name=%.*s, "
371 "name=%.*s, namelen=%u\n", past->type == DLM_AST ? "" : "b", 374 "node=%u\n", past->type == DLM_AST ? "" : "b",
372 dlm_get_lock_cookie_node(cookie), 375 dlm_get_lock_cookie_node(be64_to_cpu(cookie)),
373 dlm_get_lock_cookie_seq(cookie), 376 dlm_get_lock_cookie_seq(be64_to_cpu(cookie)),
374 locklen, name, locklen); 377 locklen, name, node);
375 378
376 ret = DLM_NORMAL; 379 ret = DLM_NORMAL;
377unlock_out: 380unlock_out:
@@ -383,8 +386,8 @@ do_ast:
383 if (past->type == DLM_AST) { 386 if (past->type == DLM_AST) {
384 /* do not alter lock refcount. switching lists. */ 387 /* do not alter lock refcount. switching lists. */
385 list_move_tail(&lock->list, &res->granted); 388 list_move_tail(&lock->list, &res->granted);
386 mlog(0, "ast: adding to granted list... type=%d, " 389 mlog(0, "ast: Adding to granted list... type=%d, "
387 "convert_type=%d\n", lock->ml.type, lock->ml.convert_type); 390 "convert_type=%d\n", lock->ml.type, lock->ml.convert_type);
388 if (lock->ml.convert_type != LKM_IVMODE) { 391 if (lock->ml.convert_type != LKM_IVMODE) {
389 lock->ml.type = lock->ml.convert_type; 392 lock->ml.type = lock->ml.convert_type;
390 lock->ml.convert_type = LKM_IVMODE; 393 lock->ml.convert_type = LKM_IVMODE;
@@ -408,7 +411,6 @@ do_ast:
408 dlm_do_local_bast(dlm, res, lock, past->blocked_type); 411 dlm_do_local_bast(dlm, res, lock, past->blocked_type);
409 412
410leave: 413leave:
411
412 if (res) 414 if (res)
413 dlm_lockres_put(res); 415 dlm_lockres_put(res);
414 416
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h
index d5a86fb81a49..bb53714813ab 100644
--- a/fs/ocfs2/dlm/dlmcommon.h
+++ b/fs/ocfs2/dlm/dlmcommon.h
@@ -140,6 +140,7 @@ struct dlm_ctxt
140 unsigned int purge_count; 140 unsigned int purge_count;
141 spinlock_t spinlock; 141 spinlock_t spinlock;
142 spinlock_t ast_lock; 142 spinlock_t ast_lock;
143 spinlock_t track_lock;
143 char *name; 144 char *name;
144 u8 node_num; 145 u8 node_num;
145 u32 key; 146 u32 key;
@@ -316,6 +317,8 @@ struct dlm_lock_resource
316 * put on a list for the dlm thread to run. */ 317 * put on a list for the dlm thread to run. */
317 unsigned long last_used; 318 unsigned long last_used;
318 319
320 struct dlm_ctxt *dlm;
321
319 unsigned migration_pending:1; 322 unsigned migration_pending:1;
320 atomic_t asts_reserved; 323 atomic_t asts_reserved;
321 spinlock_t spinlock; 324 spinlock_t spinlock;
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c
index 1b81dcba175d..b32f60a5acfb 100644
--- a/fs/ocfs2/dlm/dlmdebug.c
+++ b/fs/ocfs2/dlm/dlmdebug.c
@@ -630,43 +630,38 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos)
630{ 630{
631 struct debug_lockres *dl = m->private; 631 struct debug_lockres *dl = m->private;
632 struct dlm_ctxt *dlm = dl->dl_ctxt; 632 struct dlm_ctxt *dlm = dl->dl_ctxt;
633 struct dlm_lock_resource *oldres = dl->dl_res;
633 struct dlm_lock_resource *res = NULL; 634 struct dlm_lock_resource *res = NULL;
635 struct list_head *track_list;
634 636
635 spin_lock(&dlm->spinlock); 637 spin_lock(&dlm->track_lock);
638 if (oldres)
639 track_list = &oldres->tracking;
640 else
641 track_list = &dlm->tracking_list;
636 642
637 if (dl->dl_res) { 643 list_for_each_entry(res, track_list, tracking) {
638 list_for_each_entry(res, &dl->dl_res->tracking, tracking) { 644 if (&res->tracking == &dlm->tracking_list)
639 if (dl->dl_res) { 645 res = NULL;
640 dlm_lockres_put(dl->dl_res); 646 else
641 dl->dl_res = NULL;
642 }
643 if (&res->tracking == &dlm->tracking_list) {
644 mlog(0, "End of list found, %p\n", res);
645 dl = NULL;
646 break;
647 }
648 dlm_lockres_get(res); 647 dlm_lockres_get(res);
649 dl->dl_res = res; 648 break;
650 break;
651 }
652 } else {
653 if (!list_empty(&dlm->tracking_list)) {
654 list_for_each_entry(res, &dlm->tracking_list, tracking)
655 break;
656 dlm_lockres_get(res);
657 dl->dl_res = res;
658 } else
659 dl = NULL;
660 } 649 }
650 spin_unlock(&dlm->track_lock);
661 651
662 if (dl) { 652 if (oldres)
663 spin_lock(&dl->dl_res->spinlock); 653 dlm_lockres_put(oldres);
664 dump_lockres(dl->dl_res, dl->dl_buf, dl->dl_len - 1);
665 spin_unlock(&dl->dl_res->spinlock);
666 }
667 654
668 spin_unlock(&dlm->spinlock); 655 dl->dl_res = res;
656
657 if (res) {
658 spin_lock(&res->spinlock);
659 dump_lockres(res, dl->dl_buf, dl->dl_len - 1);
660 spin_unlock(&res->spinlock);
661 } else
662 dl = NULL;
669 663
664 /* passed to seq_show */
670 return dl; 665 return dl;
671} 666}
672 667
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 63f8125824e8..d8d578f45613 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -1550,6 +1550,7 @@ static struct dlm_ctxt *dlm_alloc_ctxt(const char *domain,
1550 spin_lock_init(&dlm->spinlock); 1550 spin_lock_init(&dlm->spinlock);
1551 spin_lock_init(&dlm->master_lock); 1551 spin_lock_init(&dlm->master_lock);
1552 spin_lock_init(&dlm->ast_lock); 1552 spin_lock_init(&dlm->ast_lock);
1553 spin_lock_init(&dlm->track_lock);
1553 INIT_LIST_HEAD(&dlm->list); 1554 INIT_LIST_HEAD(&dlm->list);
1554 INIT_LIST_HEAD(&dlm->dirty_list); 1555 INIT_LIST_HEAD(&dlm->dirty_list);
1555 INIT_LIST_HEAD(&dlm->reco.resources); 1556 INIT_LIST_HEAD(&dlm->reco.resources);
diff --git a/fs/ocfs2/dlm/dlmfs.c b/fs/ocfs2/dlm/dlmfs.c
index 6f7a77d54020..1c9efb406a96 100644
--- a/fs/ocfs2/dlm/dlmfs.c
+++ b/fs/ocfs2/dlm/dlmfs.c
@@ -341,7 +341,6 @@ static struct inode *dlmfs_get_root_inode(struct super_block *sb)
341 inode->i_mode = mode; 341 inode->i_mode = mode;
342 inode->i_uid = current_fsuid(); 342 inode->i_uid = current_fsuid();
343 inode->i_gid = current_fsgid(); 343 inode->i_gid = current_fsgid();
344 inode->i_blocks = 0;
345 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; 344 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
346 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 345 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
347 inc_nlink(inode); 346 inc_nlink(inode);
@@ -367,7 +366,6 @@ static struct inode *dlmfs_get_inode(struct inode *parent,
367 inode->i_mode = mode; 366 inode->i_mode = mode;
368 inode->i_uid = current_fsuid(); 367 inode->i_uid = current_fsuid();
369 inode->i_gid = current_fsgid(); 368 inode->i_gid = current_fsgid();
370 inode->i_blocks = 0;
371 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info; 369 inode->i_mapping->backing_dev_info = &dlmfs_backing_dev_info;
372 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 370 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
373 371
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 44f87caf3683..54e182a27caf 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -505,8 +505,10 @@ void dlm_change_lockres_owner(struct dlm_ctxt *dlm,
505static void dlm_lockres_release(struct kref *kref) 505static void dlm_lockres_release(struct kref *kref)
506{ 506{
507 struct dlm_lock_resource *res; 507 struct dlm_lock_resource *res;
508 struct dlm_ctxt *dlm;
508 509
509 res = container_of(kref, struct dlm_lock_resource, refs); 510 res = container_of(kref, struct dlm_lock_resource, refs);
511 dlm = res->dlm;
510 512
511 /* This should not happen -- all lockres' have a name 513 /* This should not happen -- all lockres' have a name
512 * associated with them at init time. */ 514 * associated with them at init time. */
@@ -515,6 +517,7 @@ static void dlm_lockres_release(struct kref *kref)
515 mlog(0, "destroying lockres %.*s\n", res->lockname.len, 517 mlog(0, "destroying lockres %.*s\n", res->lockname.len,
516 res->lockname.name); 518 res->lockname.name);
517 519
520 spin_lock(&dlm->track_lock);
518 if (!list_empty(&res->tracking)) 521 if (!list_empty(&res->tracking))
519 list_del_init(&res->tracking); 522 list_del_init(&res->tracking);
520 else { 523 else {
@@ -522,6 +525,9 @@ static void dlm_lockres_release(struct kref *kref)
522 res->lockname.len, res->lockname.name); 525 res->lockname.len, res->lockname.name);
523 dlm_print_one_lock_resource(res); 526 dlm_print_one_lock_resource(res);
524 } 527 }
528 spin_unlock(&dlm->track_lock);
529
530 dlm_put(dlm);
525 531
526 if (!hlist_unhashed(&res->hash_node) || 532 if (!hlist_unhashed(&res->hash_node) ||
527 !list_empty(&res->granted) || 533 !list_empty(&res->granted) ||
@@ -595,6 +601,10 @@ static void dlm_init_lockres(struct dlm_ctxt *dlm,
595 res->migration_pending = 0; 601 res->migration_pending = 0;
596 res->inflight_locks = 0; 602 res->inflight_locks = 0;
597 603
604 /* put in dlm_lockres_release */
605 dlm_grab(dlm);
606 res->dlm = dlm;
607
598 kref_init(&res->refs); 608 kref_init(&res->refs);
599 609
600 /* just for consistency */ 610 /* just for consistency */
@@ -722,14 +732,21 @@ lookup:
722 if (tmpres) { 732 if (tmpres) {
723 int dropping_ref = 0; 733 int dropping_ref = 0;
724 734
735 spin_unlock(&dlm->spinlock);
736
725 spin_lock(&tmpres->spinlock); 737 spin_lock(&tmpres->spinlock);
738 /* We wait for the other thread that is mastering the resource */
739 if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
740 __dlm_wait_on_lockres(tmpres);
741 BUG_ON(tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN);
742 }
743
726 if (tmpres->owner == dlm->node_num) { 744 if (tmpres->owner == dlm->node_num) {
727 BUG_ON(tmpres->state & DLM_LOCK_RES_DROPPING_REF); 745 BUG_ON(tmpres->state & DLM_LOCK_RES_DROPPING_REF);
728 dlm_lockres_grab_inflight_ref(dlm, tmpres); 746 dlm_lockres_grab_inflight_ref(dlm, tmpres);
729 } else if (tmpres->state & DLM_LOCK_RES_DROPPING_REF) 747 } else if (tmpres->state & DLM_LOCK_RES_DROPPING_REF)
730 dropping_ref = 1; 748 dropping_ref = 1;
731 spin_unlock(&tmpres->spinlock); 749 spin_unlock(&tmpres->spinlock);
732 spin_unlock(&dlm->spinlock);
733 750
734 /* wait until done messaging the master, drop our ref to allow 751 /* wait until done messaging the master, drop our ref to allow
735 * the lockres to be purged, start over. */ 752 * the lockres to be purged, start over. */
@@ -2949,7 +2966,7 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm,
2949 struct dlm_node_iter *iter) 2966 struct dlm_node_iter *iter)
2950{ 2967{
2951 struct dlm_migrate_request migrate; 2968 struct dlm_migrate_request migrate;
2952 int ret, status = 0; 2969 int ret, skip, status = 0;
2953 int nodenum; 2970 int nodenum;
2954 2971
2955 memset(&migrate, 0, sizeof(migrate)); 2972 memset(&migrate, 0, sizeof(migrate));
@@ -2966,12 +2983,27 @@ static int dlm_do_migrate_request(struct dlm_ctxt *dlm,
2966 nodenum == new_master) 2983 nodenum == new_master)
2967 continue; 2984 continue;
2968 2985
2986 /* We could race exit domain. If exited, skip. */
2987 spin_lock(&dlm->spinlock);
2988 skip = (!test_bit(nodenum, dlm->domain_map));
2989 spin_unlock(&dlm->spinlock);
2990 if (skip) {
2991 clear_bit(nodenum, iter->node_map);
2992 continue;
2993 }
2994
2969 ret = o2net_send_message(DLM_MIGRATE_REQUEST_MSG, dlm->key, 2995 ret = o2net_send_message(DLM_MIGRATE_REQUEST_MSG, dlm->key,
2970 &migrate, sizeof(migrate), nodenum, 2996 &migrate, sizeof(migrate), nodenum,
2971 &status); 2997 &status);
2972 if (ret < 0) 2998 if (ret < 0) {
2973 mlog_errno(ret); 2999 mlog(0, "migrate_request returned %d!\n", ret);
2974 else if (status < 0) { 3000 if (!dlm_is_host_down(ret)) {
3001 mlog(ML_ERROR, "unhandled error=%d!\n", ret);
3002 BUG();
3003 }
3004 clear_bit(nodenum, iter->node_map);
3005 ret = 0;
3006 } else if (status < 0) {
2975 mlog(0, "migrate request (node %u) returned %d!\n", 3007 mlog(0, "migrate request (node %u) returned %d!\n",
2976 nodenum, status); 3008 nodenum, status);
2977 ret = status; 3009 ret = status;
diff --git a/fs/ocfs2/dlm/dlmthread.c b/fs/ocfs2/dlm/dlmthread.c
index 4060bb328bc8..d1295203029f 100644
--- a/fs/ocfs2/dlm/dlmthread.c
+++ b/fs/ocfs2/dlm/dlmthread.c
@@ -181,7 +181,8 @@ static int dlm_purge_lockres(struct dlm_ctxt *dlm,
181 181
182 spin_lock(&res->spinlock); 182 spin_lock(&res->spinlock);
183 /* This ensures that clear refmap is sent after the set */ 183 /* This ensures that clear refmap is sent after the set */
184 __dlm_wait_on_lockres_flags(res, DLM_LOCK_RES_SETREF_INPROG); 184 __dlm_wait_on_lockres_flags(res, (DLM_LOCK_RES_SETREF_INPROG |
185 DLM_LOCK_RES_MIGRATING));
185 spin_unlock(&res->spinlock); 186 spin_unlock(&res->spinlock);
186 187
187 /* clear our bit from the master's refmap, ignore errors */ 188 /* clear our bit from the master's refmap, ignore errors */
diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c
index 6e6cc0a2e5f7..f731ab491795 100644
--- a/fs/ocfs2/dlmglue.c
+++ b/fs/ocfs2/dlmglue.c
@@ -32,6 +32,7 @@
32#include <linux/debugfs.h> 32#include <linux/debugfs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34#include <linux/time.h> 34#include <linux/time.h>
35#include <linux/quotaops.h>
35 36
36#define MLOG_MASK_PREFIX ML_DLM_GLUE 37#define MLOG_MASK_PREFIX ML_DLM_GLUE
37#include <cluster/masklog.h> 38#include <cluster/masklog.h>
@@ -51,6 +52,7 @@
51#include "slot_map.h" 52#include "slot_map.h"
52#include "super.h" 53#include "super.h"
53#include "uptodate.h" 54#include "uptodate.h"
55#include "quota.h"
54 56
55#include "buffer_head_io.h" 57#include "buffer_head_io.h"
56 58
@@ -68,6 +70,7 @@ struct ocfs2_mask_waiter {
68static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres); 70static struct ocfs2_super *ocfs2_get_dentry_osb(struct ocfs2_lock_res *lockres);
69static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres); 71static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres);
70static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres); 72static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres);
73static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres);
71 74
72/* 75/*
73 * Return value from ->downconvert_worker functions. 76 * Return value from ->downconvert_worker functions.
@@ -102,6 +105,7 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
102static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb, 105static void ocfs2_dentry_post_unlock(struct ocfs2_super *osb,
103 struct ocfs2_lock_res *lockres); 106 struct ocfs2_lock_res *lockres);
104 107
108static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres);
105 109
106#define mlog_meta_lvb(__level, __lockres) ocfs2_dump_meta_lvb_info(__level, __PRETTY_FUNCTION__, __LINE__, __lockres) 110#define mlog_meta_lvb(__level, __lockres) ocfs2_dump_meta_lvb_info(__level, __PRETTY_FUNCTION__, __LINE__, __lockres)
107 111
@@ -111,8 +115,7 @@ static void ocfs2_dump_meta_lvb_info(u64 level,
111 unsigned int line, 115 unsigned int line,
112 struct ocfs2_lock_res *lockres) 116 struct ocfs2_lock_res *lockres)
113{ 117{
114 struct ocfs2_meta_lvb *lvb = 118 struct ocfs2_meta_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
115 (struct ocfs2_meta_lvb *)ocfs2_dlm_lvb(&lockres->l_lksb);
116 119
117 mlog(level, "LVB information for %s (called from %s:%u):\n", 120 mlog(level, "LVB information for %s (called from %s:%u):\n",
118 lockres->l_name, function, line); 121 lockres->l_name, function, line);
@@ -258,6 +261,12 @@ static struct ocfs2_lock_res_ops ocfs2_flock_lops = {
258 .flags = 0, 261 .flags = 0,
259}; 262};
260 263
264static struct ocfs2_lock_res_ops ocfs2_qinfo_lops = {
265 .set_lvb = ocfs2_set_qinfo_lvb,
266 .get_osb = ocfs2_get_qinfo_osb,
267 .flags = LOCK_TYPE_REQUIRES_REFRESH | LOCK_TYPE_USES_LVB,
268};
269
261static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres) 270static inline int ocfs2_is_inode_lock(struct ocfs2_lock_res *lockres)
262{ 271{
263 return lockres->l_type == OCFS2_LOCK_TYPE_META || 272 return lockres->l_type == OCFS2_LOCK_TYPE_META ||
@@ -279,6 +288,13 @@ static inline struct ocfs2_dentry_lock *ocfs2_lock_res_dl(struct ocfs2_lock_res
279 return (struct ocfs2_dentry_lock *)lockres->l_priv; 288 return (struct ocfs2_dentry_lock *)lockres->l_priv;
280} 289}
281 290
291static inline struct ocfs2_mem_dqinfo *ocfs2_lock_res_qinfo(struct ocfs2_lock_res *lockres)
292{
293 BUG_ON(lockres->l_type != OCFS2_LOCK_TYPE_QINFO);
294
295 return (struct ocfs2_mem_dqinfo *)lockres->l_priv;
296}
297
282static inline struct ocfs2_super *ocfs2_get_lockres_osb(struct ocfs2_lock_res *lockres) 298static inline struct ocfs2_super *ocfs2_get_lockres_osb(struct ocfs2_lock_res *lockres)
283{ 299{
284 if (lockres->l_ops->get_osb) 300 if (lockres->l_ops->get_osb)
@@ -507,6 +523,13 @@ static struct ocfs2_super *ocfs2_get_inode_osb(struct ocfs2_lock_res *lockres)
507 return OCFS2_SB(inode->i_sb); 523 return OCFS2_SB(inode->i_sb);
508} 524}
509 525
526static struct ocfs2_super *ocfs2_get_qinfo_osb(struct ocfs2_lock_res *lockres)
527{
528 struct ocfs2_mem_dqinfo *info = lockres->l_priv;
529
530 return OCFS2_SB(info->dqi_gi.dqi_sb);
531}
532
510static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres) 533static struct ocfs2_super *ocfs2_get_file_osb(struct ocfs2_lock_res *lockres)
511{ 534{
512 struct ocfs2_file_private *fp = lockres->l_priv; 535 struct ocfs2_file_private *fp = lockres->l_priv;
@@ -609,6 +632,17 @@ void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
609 lockres->l_flags |= OCFS2_LOCK_NOCACHE; 632 lockres->l_flags |= OCFS2_LOCK_NOCACHE;
610} 633}
611 634
635void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres,
636 struct ocfs2_mem_dqinfo *info)
637{
638 ocfs2_lock_res_init_once(lockres);
639 ocfs2_build_lock_name(OCFS2_LOCK_TYPE_QINFO, info->dqi_gi.dqi_type,
640 0, lockres->l_name);
641 ocfs2_lock_res_init_common(OCFS2_SB(info->dqi_gi.dqi_sb), lockres,
642 OCFS2_LOCK_TYPE_QINFO, &ocfs2_qinfo_lops,
643 info);
644}
645
612void ocfs2_lock_res_free(struct ocfs2_lock_res *res) 646void ocfs2_lock_res_free(struct ocfs2_lock_res *res)
613{ 647{
614 mlog_entry_void(); 648 mlog_entry_void();
@@ -1829,7 +1863,7 @@ static void __ocfs2_stuff_meta_lvb(struct inode *inode)
1829 1863
1830 mlog_entry_void(); 1864 mlog_entry_void();
1831 1865
1832 lvb = (struct ocfs2_meta_lvb *)ocfs2_dlm_lvb(&lockres->l_lksb); 1866 lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
1833 1867
1834 /* 1868 /*
1835 * Invalidate the LVB of a deleted inode - this way other 1869 * Invalidate the LVB of a deleted inode - this way other
@@ -1881,7 +1915,7 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
1881 1915
1882 mlog_meta_lvb(0, lockres); 1916 mlog_meta_lvb(0, lockres);
1883 1917
1884 lvb = (struct ocfs2_meta_lvb *)ocfs2_dlm_lvb(&lockres->l_lksb); 1918 lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
1885 1919
1886 /* We're safe here without the lockres lock... */ 1920 /* We're safe here without the lockres lock... */
1887 spin_lock(&oi->ip_lock); 1921 spin_lock(&oi->ip_lock);
@@ -1916,8 +1950,7 @@ static void ocfs2_refresh_inode_from_lvb(struct inode *inode)
1916static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode, 1950static inline int ocfs2_meta_lvb_is_trustable(struct inode *inode,
1917 struct ocfs2_lock_res *lockres) 1951 struct ocfs2_lock_res *lockres)
1918{ 1952{
1919 struct ocfs2_meta_lvb *lvb = 1953 struct ocfs2_meta_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
1920 (struct ocfs2_meta_lvb *)ocfs2_dlm_lvb(&lockres->l_lksb);
1921 1954
1922 if (lvb->lvb_version == OCFS2_LVB_VERSION 1955 if (lvb->lvb_version == OCFS2_LVB_VERSION
1923 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation) 1956 && be32_to_cpu(lvb->lvb_igeneration) == inode->i_generation)
@@ -2024,7 +2057,7 @@ static int ocfs2_inode_lock_update(struct inode *inode,
2024 } else { 2057 } else {
2025 /* Boo, we have to go to disk. */ 2058 /* Boo, we have to go to disk. */
2026 /* read bh, cast, ocfs2_refresh_inode */ 2059 /* read bh, cast, ocfs2_refresh_inode */
2027 status = ocfs2_read_block(inode, oi->ip_blkno, bh); 2060 status = ocfs2_read_inode_block(inode, bh);
2028 if (status < 0) { 2061 if (status < 0) {
2029 mlog_errno(status); 2062 mlog_errno(status);
2030 goto bail_refresh; 2063 goto bail_refresh;
@@ -2032,18 +2065,14 @@ static int ocfs2_inode_lock_update(struct inode *inode,
2032 fe = (struct ocfs2_dinode *) (*bh)->b_data; 2065 fe = (struct ocfs2_dinode *) (*bh)->b_data;
2033 2066
2034 /* This is a good chance to make sure we're not 2067 /* This is a good chance to make sure we're not
2035 * locking an invalid object. 2068 * locking an invalid object. ocfs2_read_inode_block()
2069 * already checked that the inode block is sane.
2036 * 2070 *
2037 * We bug on a stale inode here because we checked 2071 * We bug on a stale inode here because we checked
2038 * above whether it was wiped from disk. The wiping 2072 * above whether it was wiped from disk. The wiping
2039 * node provides a guarantee that we receive that 2073 * node provides a guarantee that we receive that
2040 * message and can mark the inode before dropping any 2074 * message and can mark the inode before dropping any
2041 * locks associated with it. */ 2075 * locks associated with it. */
2042 if (!OCFS2_IS_VALID_DINODE(fe)) {
2043 OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
2044 status = -EIO;
2045 goto bail_refresh;
2046 }
2047 mlog_bug_on_msg(inode->i_generation != 2076 mlog_bug_on_msg(inode->i_generation !=
2048 le32_to_cpu(fe->i_generation), 2077 le32_to_cpu(fe->i_generation),
2049 "Invalid dinode %llu disk generation: %u " 2078 "Invalid dinode %llu disk generation: %u "
@@ -2085,7 +2114,7 @@ static int ocfs2_assign_bh(struct inode *inode,
2085 return 0; 2114 return 0;
2086 } 2115 }
2087 2116
2088 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, ret_bh); 2117 status = ocfs2_read_inode_block(inode, ret_bh);
2089 if (status < 0) 2118 if (status < 0)
2090 mlog_errno(status); 2119 mlog_errno(status);
2091 2120
@@ -3449,6 +3478,117 @@ static int ocfs2_dentry_convert_worker(struct ocfs2_lock_res *lockres,
3449 return UNBLOCK_CONTINUE_POST; 3478 return UNBLOCK_CONTINUE_POST;
3450} 3479}
3451 3480
3481static void ocfs2_set_qinfo_lvb(struct ocfs2_lock_res *lockres)
3482{
3483 struct ocfs2_qinfo_lvb *lvb;
3484 struct ocfs2_mem_dqinfo *oinfo = ocfs2_lock_res_qinfo(lockres);
3485 struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb,
3486 oinfo->dqi_gi.dqi_type);
3487
3488 mlog_entry_void();
3489
3490 lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
3491 lvb->lvb_version = OCFS2_QINFO_LVB_VERSION;
3492 lvb->lvb_bgrace = cpu_to_be32(info->dqi_bgrace);
3493 lvb->lvb_igrace = cpu_to_be32(info->dqi_igrace);
3494 lvb->lvb_syncms = cpu_to_be32(oinfo->dqi_syncms);
3495 lvb->lvb_blocks = cpu_to_be32(oinfo->dqi_gi.dqi_blocks);
3496 lvb->lvb_free_blk = cpu_to_be32(oinfo->dqi_gi.dqi_free_blk);
3497 lvb->lvb_free_entry = cpu_to_be32(oinfo->dqi_gi.dqi_free_entry);
3498
3499 mlog_exit_void();
3500}
3501
3502void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex)
3503{
3504 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
3505 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
3506 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
3507
3508 mlog_entry_void();
3509 if (!ocfs2_is_hard_readonly(osb) && !ocfs2_mount_local(osb))
3510 ocfs2_cluster_unlock(osb, lockres, level);
3511 mlog_exit_void();
3512}
3513
3514static int ocfs2_refresh_qinfo(struct ocfs2_mem_dqinfo *oinfo)
3515{
3516 struct mem_dqinfo *info = sb_dqinfo(oinfo->dqi_gi.dqi_sb,
3517 oinfo->dqi_gi.dqi_type);
3518 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
3519 struct ocfs2_qinfo_lvb *lvb = ocfs2_dlm_lvb(&lockres->l_lksb);
3520 struct buffer_head *bh = NULL;
3521 struct ocfs2_global_disk_dqinfo *gdinfo;
3522 int status = 0;
3523
3524 if (lvb->lvb_version == OCFS2_QINFO_LVB_VERSION) {
3525 info->dqi_bgrace = be32_to_cpu(lvb->lvb_bgrace);
3526 info->dqi_igrace = be32_to_cpu(lvb->lvb_igrace);
3527 oinfo->dqi_syncms = be32_to_cpu(lvb->lvb_syncms);
3528 oinfo->dqi_gi.dqi_blocks = be32_to_cpu(lvb->lvb_blocks);
3529 oinfo->dqi_gi.dqi_free_blk = be32_to_cpu(lvb->lvb_free_blk);
3530 oinfo->dqi_gi.dqi_free_entry =
3531 be32_to_cpu(lvb->lvb_free_entry);
3532 } else {
3533 status = ocfs2_read_quota_block(oinfo->dqi_gqinode, 0, &bh);
3534 if (status) {
3535 mlog_errno(status);
3536 goto bail;
3537 }
3538 gdinfo = (struct ocfs2_global_disk_dqinfo *)
3539 (bh->b_data + OCFS2_GLOBAL_INFO_OFF);
3540 info->dqi_bgrace = le32_to_cpu(gdinfo->dqi_bgrace);
3541 info->dqi_igrace = le32_to_cpu(gdinfo->dqi_igrace);
3542 oinfo->dqi_syncms = le32_to_cpu(gdinfo->dqi_syncms);
3543 oinfo->dqi_gi.dqi_blocks = le32_to_cpu(gdinfo->dqi_blocks);
3544 oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(gdinfo->dqi_free_blk);
3545 oinfo->dqi_gi.dqi_free_entry =
3546 le32_to_cpu(gdinfo->dqi_free_entry);
3547 brelse(bh);
3548 ocfs2_track_lock_refresh(lockres);
3549 }
3550
3551bail:
3552 return status;
3553}
3554
3555/* Lock quota info, this function expects at least shared lock on the quota file
3556 * so that we can safely refresh quota info from disk. */
3557int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex)
3558{
3559 struct ocfs2_lock_res *lockres = &oinfo->dqi_gqlock;
3560 struct ocfs2_super *osb = OCFS2_SB(oinfo->dqi_gi.dqi_sb);
3561 int level = ex ? DLM_LOCK_EX : DLM_LOCK_PR;
3562 int status = 0;
3563
3564 mlog_entry_void();
3565
3566 /* On RO devices, locking really isn't needed... */
3567 if (ocfs2_is_hard_readonly(osb)) {
3568 if (ex)
3569 status = -EROFS;
3570 goto bail;
3571 }
3572 if (ocfs2_mount_local(osb))
3573 goto bail;
3574
3575 status = ocfs2_cluster_lock(osb, lockres, level, 0, 0);
3576 if (status < 0) {
3577 mlog_errno(status);
3578 goto bail;
3579 }
3580 if (!ocfs2_should_refresh_lock_res(lockres))
3581 goto bail;
3582 /* OK, we have the lock but we need to refresh the quota info */
3583 status = ocfs2_refresh_qinfo(oinfo);
3584 if (status)
3585 ocfs2_qinfo_unlock(oinfo, ex);
3586 ocfs2_complete_lock_res_refresh(lockres, status);
3587bail:
3588 mlog_exit(status);
3589 return status;
3590}
3591
3452/* 3592/*
3453 * This is the filesystem locking protocol. It provides the lock handling 3593 * This is the filesystem locking protocol. It provides the lock handling
3454 * hooks for the underlying DLM. It has a maximum version number. 3594 * hooks for the underlying DLM. It has a maximum version number.
diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h
index 2bb01f09c1b1..3f8d9986b8e0 100644
--- a/fs/ocfs2/dlmglue.h
+++ b/fs/ocfs2/dlmglue.h
@@ -49,6 +49,19 @@ struct ocfs2_meta_lvb {
49 __be32 lvb_reserved2; 49 __be32 lvb_reserved2;
50}; 50};
51 51
52#define OCFS2_QINFO_LVB_VERSION 1
53
54struct ocfs2_qinfo_lvb {
55 __u8 lvb_version;
56 __u8 lvb_reserved[3];
57 __be32 lvb_bgrace;
58 __be32 lvb_igrace;
59 __be32 lvb_syncms;
60 __be32 lvb_blocks;
61 __be32 lvb_free_blk;
62 __be32 lvb_free_entry;
63};
64
52/* ocfs2_inode_lock_full() 'arg_flags' flags */ 65/* ocfs2_inode_lock_full() 'arg_flags' flags */
53/* don't wait on recovery. */ 66/* don't wait on recovery. */
54#define OCFS2_META_LOCK_RECOVERY (0x01) 67#define OCFS2_META_LOCK_RECOVERY (0x01)
@@ -69,6 +82,9 @@ void ocfs2_dentry_lock_res_init(struct ocfs2_dentry_lock *dl,
69struct ocfs2_file_private; 82struct ocfs2_file_private;
70void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres, 83void ocfs2_file_lock_res_init(struct ocfs2_lock_res *lockres,
71 struct ocfs2_file_private *fp); 84 struct ocfs2_file_private *fp);
85struct ocfs2_mem_dqinfo;
86void ocfs2_qinfo_lock_res_init(struct ocfs2_lock_res *lockres,
87 struct ocfs2_mem_dqinfo *info);
72void ocfs2_lock_res_free(struct ocfs2_lock_res *res); 88void ocfs2_lock_res_free(struct ocfs2_lock_res *res);
73int ocfs2_create_new_inode_locks(struct inode *inode); 89int ocfs2_create_new_inode_locks(struct inode *inode);
74int ocfs2_drop_inode_locks(struct inode *inode); 90int ocfs2_drop_inode_locks(struct inode *inode);
@@ -103,6 +119,9 @@ int ocfs2_dentry_lock(struct dentry *dentry, int ex);
103void ocfs2_dentry_unlock(struct dentry *dentry, int ex); 119void ocfs2_dentry_unlock(struct dentry *dentry, int ex);
104int ocfs2_file_lock(struct file *file, int ex, int trylock); 120int ocfs2_file_lock(struct file *file, int ex, int trylock);
105void ocfs2_file_unlock(struct file *file); 121void ocfs2_file_unlock(struct file *file);
122int ocfs2_qinfo_lock(struct ocfs2_mem_dqinfo *oinfo, int ex);
123void ocfs2_qinfo_unlock(struct ocfs2_mem_dqinfo *oinfo, int ex);
124
106 125
107void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres); 126void ocfs2_mark_lockres_freeing(struct ocfs2_lock_res *lockres);
108void ocfs2_simple_drop_lockres(struct ocfs2_super *osb, 127void ocfs2_simple_drop_lockres(struct ocfs2_super *osb,
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c
index 2baedac58234..f2bb1a04d253 100644
--- a/fs/ocfs2/extent_map.c
+++ b/fs/ocfs2/extent_map.c
@@ -293,7 +293,7 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,
293 struct ocfs2_extent_block *eb; 293 struct ocfs2_extent_block *eb;
294 struct ocfs2_extent_list *el; 294 struct ocfs2_extent_list *el;
295 295
296 ret = ocfs2_read_block(inode, last_eb_blk, &eb_bh); 296 ret = ocfs2_read_extent_block(inode, last_eb_blk, &eb_bh);
297 if (ret) { 297 if (ret) {
298 mlog_errno(ret); 298 mlog_errno(ret);
299 goto out; 299 goto out;
@@ -302,12 +302,6 @@ static int ocfs2_last_eb_is_empty(struct inode *inode,
302 eb = (struct ocfs2_extent_block *) eb_bh->b_data; 302 eb = (struct ocfs2_extent_block *) eb_bh->b_data;
303 el = &eb->h_list; 303 el = &eb->h_list;
304 304
305 if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) {
306 ret = -EROFS;
307 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, eb);
308 goto out;
309 }
310
311 if (el->l_tree_depth) { 305 if (el->l_tree_depth) {
312 ocfs2_error(inode->i_sb, 306 ocfs2_error(inode->i_sb,
313 "Inode %lu has non zero tree depth in " 307 "Inode %lu has non zero tree depth in "
@@ -381,23 +375,16 @@ static int ocfs2_figure_hole_clusters(struct inode *inode,
381 if (le64_to_cpu(eb->h_next_leaf_blk) == 0ULL) 375 if (le64_to_cpu(eb->h_next_leaf_blk) == 0ULL)
382 goto no_more_extents; 376 goto no_more_extents;
383 377
384 ret = ocfs2_read_block(inode, 378 ret = ocfs2_read_extent_block(inode,
385 le64_to_cpu(eb->h_next_leaf_blk), 379 le64_to_cpu(eb->h_next_leaf_blk),
386 &next_eb_bh); 380 &next_eb_bh);
387 if (ret) { 381 if (ret) {
388 mlog_errno(ret); 382 mlog_errno(ret);
389 goto out; 383 goto out;
390 } 384 }
391 next_eb = (struct ocfs2_extent_block *)next_eb_bh->b_data;
392
393 if (!OCFS2_IS_VALID_EXTENT_BLOCK(next_eb)) {
394 ret = -EROFS;
395 OCFS2_RO_ON_INVALID_EXTENT_BLOCK(inode->i_sb, next_eb);
396 goto out;
397 }
398 385
386 next_eb = (struct ocfs2_extent_block *)next_eb_bh->b_data;
399 el = &next_eb->h_list; 387 el = &next_eb->h_list;
400
401 i = ocfs2_search_for_hole_index(el, v_cluster); 388 i = ocfs2_search_for_hole_index(el, v_cluster);
402 } 389 }
403 390
@@ -630,7 +617,7 @@ int ocfs2_get_clusters(struct inode *inode, u32 v_cluster,
630 if (ret == 0) 617 if (ret == 0)
631 goto out; 618 goto out;
632 619
633 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &di_bh); 620 ret = ocfs2_read_inode_block(inode, &di_bh);
634 if (ret) { 621 if (ret) {
635 mlog_errno(ret); 622 mlog_errno(ret);
636 goto out; 623 goto out;
@@ -819,3 +806,74 @@ out:
819 806
820 return ret; 807 return ret;
821} 808}
809
810int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
811 struct buffer_head *bhs[], int flags,
812 int (*validate)(struct super_block *sb,
813 struct buffer_head *bh))
814{
815 int rc = 0;
816 u64 p_block, p_count;
817 int i, count, done = 0;
818
819 mlog_entry("(inode = %p, v_block = %llu, nr = %d, bhs = %p, "
820 "flags = %x, validate = %p)\n",
821 inode, (unsigned long long)v_block, nr, bhs, flags,
822 validate);
823
824 if (((v_block + nr - 1) << inode->i_sb->s_blocksize_bits) >=
825 i_size_read(inode)) {
826 BUG_ON(!(flags & OCFS2_BH_READAHEAD));
827 goto out;
828 }
829
830 while (done < nr) {
831 down_read(&OCFS2_I(inode)->ip_alloc_sem);
832 rc = ocfs2_extent_map_get_blocks(inode, v_block + done,
833 &p_block, &p_count, NULL);
834 up_read(&OCFS2_I(inode)->ip_alloc_sem);
835 if (rc) {
836 mlog_errno(rc);
837 break;
838 }
839
840 if (!p_block) {
841 rc = -EIO;
842 mlog(ML_ERROR,
843 "Inode #%llu contains a hole at offset %llu\n",
844 (unsigned long long)OCFS2_I(inode)->ip_blkno,
845 (unsigned long long)(v_block + done) <<
846 inode->i_sb->s_blocksize_bits);
847 break;
848 }
849
850 count = nr - done;
851 if (p_count < count)
852 count = p_count;
853
854 /*
855 * If the caller passed us bhs, they should have come
856 * from a previous readahead call to this function. Thus,
857 * they should have the right b_blocknr.
858 */
859 for (i = 0; i < count; i++) {
860 if (!bhs[done + i])
861 continue;
862 BUG_ON(bhs[done + i]->b_blocknr != (p_block + i));
863 }
864
865 rc = ocfs2_read_blocks(inode, p_block, count, bhs + done,
866 flags, validate);
867 if (rc) {
868 mlog_errno(rc);
869 break;
870 }
871 done += count;
872 }
873
874out:
875 mlog_exit(rc);
876 return rc;
877}
878
879
diff --git a/fs/ocfs2/extent_map.h b/fs/ocfs2/extent_map.h
index 1c4aa8b06f34..b7dd9731b462 100644
--- a/fs/ocfs2/extent_map.h
+++ b/fs/ocfs2/extent_map.h
@@ -57,4 +57,28 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
57 u32 *p_cluster, u32 *num_clusters, 57 u32 *p_cluster, u32 *num_clusters,
58 struct ocfs2_extent_list *el); 58 struct ocfs2_extent_list *el);
59 59
60int ocfs2_read_virt_blocks(struct inode *inode, u64 v_block, int nr,
61 struct buffer_head *bhs[], int flags,
62 int (*validate)(struct super_block *sb,
63 struct buffer_head *bh));
64static inline int ocfs2_read_virt_block(struct inode *inode, u64 v_block,
65 struct buffer_head **bh,
66 int (*validate)(struct super_block *sb,
67 struct buffer_head *bh))
68{
69 int status = 0;
70
71 if (bh == NULL) {
72 printk("ocfs2: bh == NULL\n");
73 status = -EINVAL;
74 goto bail;
75 }
76
77 status = ocfs2_read_virt_blocks(inode, v_block, 1, bh, 0, validate);
78
79bail:
80 return status;
81}
82
83
60#endif /* _EXTENT_MAP_H */ 84#endif /* _EXTENT_MAP_H */
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index e2570a3bc2b2..e8f795f978aa 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -35,6 +35,7 @@
35#include <linux/mount.h> 35#include <linux/mount.h>
36#include <linux/writeback.h> 36#include <linux/writeback.h>
37#include <linux/falloc.h> 37#include <linux/falloc.h>
38#include <linux/quotaops.h>
38 39
39#define MLOG_MASK_PREFIX ML_INODE 40#define MLOG_MASK_PREFIX ML_INODE
40#include <cluster/masklog.h> 41#include <cluster/masklog.h>
@@ -56,6 +57,8 @@
56#include "suballoc.h" 57#include "suballoc.h"
57#include "super.h" 58#include "super.h"
58#include "xattr.h" 59#include "xattr.h"
60#include "acl.h"
61#include "quota.h"
59 62
60#include "buffer_head_io.h" 63#include "buffer_head_io.h"
61 64
@@ -253,8 +256,8 @@ int ocfs2_update_inode_atime(struct inode *inode,
253 goto out; 256 goto out;
254 } 257 }
255 258
256 ret = ocfs2_journal_access(handle, inode, bh, 259 ret = ocfs2_journal_access_di(handle, inode, bh,
257 OCFS2_JOURNAL_ACCESS_WRITE); 260 OCFS2_JOURNAL_ACCESS_WRITE);
258 if (ret) { 261 if (ret) {
259 mlog_errno(ret); 262 mlog_errno(ret);
260 goto out_commit; 263 goto out_commit;
@@ -303,9 +306,9 @@ bail:
303 return status; 306 return status;
304} 307}
305 308
306static int ocfs2_simple_size_update(struct inode *inode, 309int ocfs2_simple_size_update(struct inode *inode,
307 struct buffer_head *di_bh, 310 struct buffer_head *di_bh,
308 u64 new_i_size) 311 u64 new_i_size)
309{ 312{
310 int ret; 313 int ret;
311 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 314 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
@@ -350,8 +353,8 @@ static int ocfs2_orphan_for_truncate(struct ocfs2_super *osb,
350 goto out; 353 goto out;
351 } 354 }
352 355
353 status = ocfs2_journal_access(handle, inode, fe_bh, 356 status = ocfs2_journal_access_di(handle, inode, fe_bh,
354 OCFS2_JOURNAL_ACCESS_WRITE); 357 OCFS2_JOURNAL_ACCESS_WRITE);
355 if (status < 0) { 358 if (status < 0) {
356 mlog_errno(status); 359 mlog_errno(status);
357 goto out_commit; 360 goto out_commit;
@@ -401,12 +404,9 @@ static int ocfs2_truncate_file(struct inode *inode,
401 (unsigned long long)OCFS2_I(inode)->ip_blkno, 404 (unsigned long long)OCFS2_I(inode)->ip_blkno,
402 (unsigned long long)new_i_size); 405 (unsigned long long)new_i_size);
403 406
407 /* We trust di_bh because it comes from ocfs2_inode_lock(), which
408 * already validated it */
404 fe = (struct ocfs2_dinode *) di_bh->b_data; 409 fe = (struct ocfs2_dinode *) di_bh->b_data;
405 if (!OCFS2_IS_VALID_DINODE(fe)) {
406 OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
407 status = -EIO;
408 goto bail;
409 }
410 410
411 mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode), 411 mlog_bug_on_msg(le64_to_cpu(fe->i_size) != i_size_read(inode),
412 "Inode %llu, inode i_size = %lld != di " 412 "Inode %llu, inode i_size = %lld != di "
@@ -536,6 +536,7 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
536 enum ocfs2_alloc_restarted why; 536 enum ocfs2_alloc_restarted why;
537 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 537 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
538 struct ocfs2_extent_tree et; 538 struct ocfs2_extent_tree et;
539 int did_quota = 0;
539 540
540 mlog_entry("(clusters_to_add = %u)\n", clusters_to_add); 541 mlog_entry("(clusters_to_add = %u)\n", clusters_to_add);
541 542
@@ -545,18 +546,12 @@ static int __ocfs2_extend_allocation(struct inode *inode, u32 logical_start,
545 */ 546 */
546 BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb)); 547 BUG_ON(mark_unwritten && !ocfs2_sparse_alloc(osb));
547 548
548 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, &bh); 549 status = ocfs2_read_inode_block(inode, &bh);
549 if (status < 0) { 550 if (status < 0) {
550 mlog_errno(status); 551 mlog_errno(status);
551 goto leave; 552 goto leave;
552 } 553 }
553
554 fe = (struct ocfs2_dinode *) bh->b_data; 554 fe = (struct ocfs2_dinode *) bh->b_data;
555 if (!OCFS2_IS_VALID_DINODE(fe)) {
556 OCFS2_RO_ON_INVALID_DINODE(inode->i_sb, fe);
557 status = -EIO;
558 goto leave;
559 }
560 555
561restart_all: 556restart_all:
562 BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters); 557 BUG_ON(le32_to_cpu(fe->i_clusters) != OCFS2_I(inode)->ip_clusters);
@@ -585,11 +580,18 @@ restart_all:
585 } 580 }
586 581
587restarted_transaction: 582restarted_transaction:
583 if (vfs_dq_alloc_space_nodirty(inode, ocfs2_clusters_to_bytes(osb->sb,
584 clusters_to_add))) {
585 status = -EDQUOT;
586 goto leave;
587 }
588 did_quota = 1;
589
588 /* reserve a write to the file entry early on - that we if we 590 /* reserve a write to the file entry early on - that we if we
589 * run out of credits in the allocation path, we can still 591 * run out of credits in the allocation path, we can still
590 * update i_size. */ 592 * update i_size. */
591 status = ocfs2_journal_access(handle, inode, bh, 593 status = ocfs2_journal_access_di(handle, inode, bh,
592 OCFS2_JOURNAL_ACCESS_WRITE); 594 OCFS2_JOURNAL_ACCESS_WRITE);
593 if (status < 0) { 595 if (status < 0) {
594 mlog_errno(status); 596 mlog_errno(status);
595 goto leave; 597 goto leave;
@@ -622,6 +624,10 @@ restarted_transaction:
622 spin_lock(&OCFS2_I(inode)->ip_lock); 624 spin_lock(&OCFS2_I(inode)->ip_lock);
623 clusters_to_add -= (OCFS2_I(inode)->ip_clusters - prev_clusters); 625 clusters_to_add -= (OCFS2_I(inode)->ip_clusters - prev_clusters);
624 spin_unlock(&OCFS2_I(inode)->ip_lock); 626 spin_unlock(&OCFS2_I(inode)->ip_lock);
627 /* Release unused quota reservation */
628 vfs_dq_free_space(inode,
629 ocfs2_clusters_to_bytes(osb->sb, clusters_to_add));
630 did_quota = 0;
625 631
626 if (why != RESTART_NONE && clusters_to_add) { 632 if (why != RESTART_NONE && clusters_to_add) {
627 if (why == RESTART_META) { 633 if (why == RESTART_META) {
@@ -654,6 +660,9 @@ restarted_transaction:
654 OCFS2_I(inode)->ip_clusters, (long long)i_size_read(inode)); 660 OCFS2_I(inode)->ip_clusters, (long long)i_size_read(inode));
655 661
656leave: 662leave:
663 if (status < 0 && did_quota)
664 vfs_dq_free_space(inode,
665 ocfs2_clusters_to_bytes(osb->sb, clusters_to_add));
657 if (handle) { 666 if (handle) {
658 ocfs2_commit_trans(osb, handle); 667 ocfs2_commit_trans(osb, handle);
659 handle = NULL; 668 handle = NULL;
@@ -885,6 +894,9 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
885 struct ocfs2_super *osb = OCFS2_SB(sb); 894 struct ocfs2_super *osb = OCFS2_SB(sb);
886 struct buffer_head *bh = NULL; 895 struct buffer_head *bh = NULL;
887 handle_t *handle = NULL; 896 handle_t *handle = NULL;
897 int locked[MAXQUOTAS] = {0, 0};
898 int credits, qtype;
899 struct ocfs2_mem_dqinfo *oinfo;
888 900
889 mlog_entry("(0x%p, '%.*s')\n", dentry, 901 mlog_entry("(0x%p, '%.*s')\n", dentry,
890 dentry->d_name.len, dentry->d_name.name); 902 dentry->d_name.len, dentry->d_name.name);
@@ -955,11 +967,47 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
955 } 967 }
956 } 968 }
957 969
958 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); 970 if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
959 if (IS_ERR(handle)) { 971 (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
960 status = PTR_ERR(handle); 972 credits = OCFS2_INODE_UPDATE_CREDITS;
961 mlog_errno(status); 973 if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid
962 goto bail_unlock; 974 && OCFS2_HAS_RO_COMPAT_FEATURE(sb,
975 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
976 oinfo = sb_dqinfo(sb, USRQUOTA)->dqi_priv;
977 status = ocfs2_lock_global_qf(oinfo, 1);
978 if (status < 0)
979 goto bail_unlock;
980 credits += ocfs2_calc_qinit_credits(sb, USRQUOTA) +
981 ocfs2_calc_qdel_credits(sb, USRQUOTA);
982 locked[USRQUOTA] = 1;
983 }
984 if (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid
985 && OCFS2_HAS_RO_COMPAT_FEATURE(sb,
986 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
987 oinfo = sb_dqinfo(sb, GRPQUOTA)->dqi_priv;
988 status = ocfs2_lock_global_qf(oinfo, 1);
989 if (status < 0)
990 goto bail_unlock;
991 credits += ocfs2_calc_qinit_credits(sb, GRPQUOTA) +
992 ocfs2_calc_qdel_credits(sb, GRPQUOTA);
993 locked[GRPQUOTA] = 1;
994 }
995 handle = ocfs2_start_trans(osb, credits);
996 if (IS_ERR(handle)) {
997 status = PTR_ERR(handle);
998 mlog_errno(status);
999 goto bail_unlock;
1000 }
1001 status = vfs_dq_transfer(inode, attr) ? -EDQUOT : 0;
1002 if (status < 0)
1003 goto bail_commit;
1004 } else {
1005 handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
1006 if (IS_ERR(handle)) {
1007 status = PTR_ERR(handle);
1008 mlog_errno(status);
1009 goto bail_unlock;
1010 }
963 } 1011 }
964 1012
965 /* 1013 /*
@@ -982,6 +1030,12 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
982bail_commit: 1030bail_commit:
983 ocfs2_commit_trans(osb, handle); 1031 ocfs2_commit_trans(osb, handle);
984bail_unlock: 1032bail_unlock:
1033 for (qtype = 0; qtype < MAXQUOTAS; qtype++) {
1034 if (!locked[qtype])
1035 continue;
1036 oinfo = sb_dqinfo(sb, qtype)->dqi_priv;
1037 ocfs2_unlock_global_qf(oinfo, 1);
1038 }
985 ocfs2_inode_unlock(inode, 1); 1039 ocfs2_inode_unlock(inode, 1);
986bail_unlock_rw: 1040bail_unlock_rw:
987 if (size_change) 1041 if (size_change)
@@ -989,6 +1043,12 @@ bail_unlock_rw:
989bail: 1043bail:
990 brelse(bh); 1044 brelse(bh);
991 1045
1046 if (!status && attr->ia_valid & ATTR_MODE) {
1047 status = ocfs2_acl_chmod(inode);
1048 if (status < 0)
1049 mlog_errno(status);
1050 }
1051
992 mlog_exit(status); 1052 mlog_exit(status);
993 return status; 1053 return status;
994} 1054}
@@ -1035,7 +1095,7 @@ int ocfs2_permission(struct inode *inode, int mask)
1035 goto out; 1095 goto out;
1036 } 1096 }
1037 1097
1038 ret = generic_permission(inode, mask, NULL); 1098 ret = generic_permission(inode, mask, ocfs2_check_acl);
1039 1099
1040 ocfs2_inode_unlock(inode, 0); 1100 ocfs2_inode_unlock(inode, 0);
1041out: 1101out:
@@ -1061,8 +1121,8 @@ static int __ocfs2_write_remove_suid(struct inode *inode,
1061 goto out; 1121 goto out;
1062 } 1122 }
1063 1123
1064 ret = ocfs2_journal_access(handle, inode, bh, 1124 ret = ocfs2_journal_access_di(handle, inode, bh,
1065 OCFS2_JOURNAL_ACCESS_WRITE); 1125 OCFS2_JOURNAL_ACCESS_WRITE);
1066 if (ret < 0) { 1126 if (ret < 0) {
1067 mlog_errno(ret); 1127 mlog_errno(ret);
1068 goto out_trans; 1128 goto out_trans;
@@ -1128,9 +1188,8 @@ static int ocfs2_write_remove_suid(struct inode *inode)
1128{ 1188{
1129 int ret; 1189 int ret;
1130 struct buffer_head *bh = NULL; 1190 struct buffer_head *bh = NULL;
1131 struct ocfs2_inode_info *oi = OCFS2_I(inode);
1132 1191
1133 ret = ocfs2_read_block(inode, oi->ip_blkno, &bh); 1192 ret = ocfs2_read_inode_block(inode, &bh);
1134 if (ret < 0) { 1193 if (ret < 0) {
1135 mlog_errno(ret); 1194 mlog_errno(ret);
1136 goto out; 1195 goto out;
@@ -1156,8 +1215,7 @@ static int ocfs2_allocate_unwritten_extents(struct inode *inode,
1156 struct buffer_head *di_bh = NULL; 1215 struct buffer_head *di_bh = NULL;
1157 1216
1158 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { 1217 if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) {
1159 ret = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, 1218 ret = ocfs2_read_inode_block(inode, &di_bh);
1160 &di_bh);
1161 if (ret) { 1219 if (ret) {
1162 mlog_errno(ret); 1220 mlog_errno(ret);
1163 goto out; 1221 goto out;
@@ -1226,83 +1284,6 @@ out:
1226 return ret; 1284 return ret;
1227} 1285}
1228 1286
1229static int __ocfs2_remove_inode_range(struct inode *inode,
1230 struct buffer_head *di_bh,
1231 u32 cpos, u32 phys_cpos, u32 len,
1232 struct ocfs2_cached_dealloc_ctxt *dealloc)
1233{
1234 int ret;
1235 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
1236 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1237 struct inode *tl_inode = osb->osb_tl_inode;
1238 handle_t *handle;
1239 struct ocfs2_alloc_context *meta_ac = NULL;
1240 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1241 struct ocfs2_extent_tree et;
1242
1243 ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
1244
1245 ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac);
1246 if (ret) {
1247 mlog_errno(ret);
1248 return ret;
1249 }
1250
1251 mutex_lock(&tl_inode->i_mutex);
1252
1253 if (ocfs2_truncate_log_needs_flush(osb)) {
1254 ret = __ocfs2_flush_truncate_log(osb);
1255 if (ret < 0) {
1256 mlog_errno(ret);
1257 goto out;
1258 }
1259 }
1260
1261 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS);
1262 if (IS_ERR(handle)) {
1263 ret = PTR_ERR(handle);
1264 mlog_errno(ret);
1265 goto out;
1266 }
1267
1268 ret = ocfs2_journal_access(handle, inode, di_bh,
1269 OCFS2_JOURNAL_ACCESS_WRITE);
1270 if (ret) {
1271 mlog_errno(ret);
1272 goto out;
1273 }
1274
1275 ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, meta_ac,
1276 dealloc);
1277 if (ret) {
1278 mlog_errno(ret);
1279 goto out_commit;
1280 }
1281
1282 OCFS2_I(inode)->ip_clusters -= len;
1283 di->i_clusters = cpu_to_le32(OCFS2_I(inode)->ip_clusters);
1284
1285 ret = ocfs2_journal_dirty(handle, di_bh);
1286 if (ret) {
1287 mlog_errno(ret);
1288 goto out_commit;
1289 }
1290
1291 ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len);
1292 if (ret)
1293 mlog_errno(ret);
1294
1295out_commit:
1296 ocfs2_commit_trans(osb, handle);
1297out:
1298 mutex_unlock(&tl_inode->i_mutex);
1299
1300 if (meta_ac)
1301 ocfs2_free_alloc_context(meta_ac);
1302
1303 return ret;
1304}
1305
1306/* 1287/*
1307 * Truncate a byte range, avoiding pages within partial clusters. This 1288 * Truncate a byte range, avoiding pages within partial clusters. This
1308 * preserves those pages for the zeroing code to write to. 1289 * preserves those pages for the zeroing code to write to.
@@ -1402,7 +1383,9 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1402 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 1383 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1403 struct ocfs2_cached_dealloc_ctxt dealloc; 1384 struct ocfs2_cached_dealloc_ctxt dealloc;
1404 struct address_space *mapping = inode->i_mapping; 1385 struct address_space *mapping = inode->i_mapping;
1386 struct ocfs2_extent_tree et;
1405 1387
1388 ocfs2_init_dinode_extent_tree(&et, inode, di_bh);
1406 ocfs2_init_dealloc_ctxt(&dealloc); 1389 ocfs2_init_dealloc_ctxt(&dealloc);
1407 1390
1408 if (byte_len == 0) 1391 if (byte_len == 0)
@@ -1458,9 +1441,9 @@ static int ocfs2_remove_inode_range(struct inode *inode,
1458 1441
1459 /* Only do work for non-holes */ 1442 /* Only do work for non-holes */
1460 if (phys_cpos != 0) { 1443 if (phys_cpos != 0) {
1461 ret = __ocfs2_remove_inode_range(inode, di_bh, cpos, 1444 ret = ocfs2_remove_btree_range(inode, &et, cpos,
1462 phys_cpos, alloc_size, 1445 phys_cpos, alloc_size,
1463 &dealloc); 1446 &dealloc);
1464 if (ret) { 1447 if (ret) {
1465 mlog_errno(ret); 1448 mlog_errno(ret);
1466 goto out; 1449 goto out;
diff --git a/fs/ocfs2/file.h b/fs/ocfs2/file.h
index e92382cbca5f..172f9fbc9fc7 100644
--- a/fs/ocfs2/file.h
+++ b/fs/ocfs2/file.h
@@ -51,6 +51,9 @@ int ocfs2_add_inode_data(struct ocfs2_super *osb,
51 struct ocfs2_alloc_context *data_ac, 51 struct ocfs2_alloc_context *data_ac,
52 struct ocfs2_alloc_context *meta_ac, 52 struct ocfs2_alloc_context *meta_ac,
53 enum ocfs2_alloc_restarted *reason_ret); 53 enum ocfs2_alloc_restarted *reason_ret);
54int ocfs2_simple_size_update(struct inode *inode,
55 struct buffer_head *di_bh,
56 u64 new_i_size);
54int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size, 57int ocfs2_extend_no_holes(struct inode *inode, u64 new_i_size,
55 u64 zero_to); 58 u64 zero_to);
56int ocfs2_setattr(struct dentry *dentry, struct iattr *attr); 59int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
index 7aa00d511874..229e707bc050 100644
--- a/fs/ocfs2/inode.c
+++ b/fs/ocfs2/inode.c
@@ -28,6 +28,7 @@
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/highmem.h> 29#include <linux/highmem.h>
30#include <linux/pagemap.h> 30#include <linux/pagemap.h>
31#include <linux/quotaops.h>
31 32
32#include <asm/byteorder.h> 33#include <asm/byteorder.h>
33 34
@@ -37,6 +38,7 @@
37#include "ocfs2.h" 38#include "ocfs2.h"
38 39
39#include "alloc.h" 40#include "alloc.h"
41#include "blockcheck.h"
40#include "dlmglue.h" 42#include "dlmglue.h"
41#include "extent_map.h" 43#include "extent_map.h"
42#include "file.h" 44#include "file.h"
@@ -214,12 +216,11 @@ static int ocfs2_init_locked_inode(struct inode *inode, void *opaque)
214 return 0; 216 return 0;
215} 217}
216 218
217int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, 219void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
218 int create_ino) 220 int create_ino)
219{ 221{
220 struct super_block *sb; 222 struct super_block *sb;
221 struct ocfs2_super *osb; 223 struct ocfs2_super *osb;
222 int status = -EINVAL;
223 int use_plocks = 1; 224 int use_plocks = 1;
224 225
225 mlog_entry("(0x%p, size:%llu)\n", inode, 226 mlog_entry("(0x%p, size:%llu)\n", inode,
@@ -232,25 +233,17 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
232 ocfs2_mount_local(osb) || !ocfs2_stack_supports_plocks()) 233 ocfs2_mount_local(osb) || !ocfs2_stack_supports_plocks())
233 use_plocks = 0; 234 use_plocks = 0;
234 235
235 /* this means that read_inode cannot create a superblock inode 236 /*
236 * today. change if needed. */ 237 * These have all been checked by ocfs2_read_inode_block() or set
237 if (!OCFS2_IS_VALID_DINODE(fe) || 238 * by ocfs2_mknod_locked(), so a failure is a code bug.
238 !(fe->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { 239 */
239 mlog(0, "Invalid dinode: i_ino=%lu, i_blkno=%llu, " 240 BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); /* This means that read_inode
240 "signature = %.*s, flags = 0x%x\n", 241 cannot create a superblock
241 inode->i_ino, 242 inode today. change if
242 (unsigned long long)le64_to_cpu(fe->i_blkno), 7, 243 that is needed. */
243 fe->i_signature, le32_to_cpu(fe->i_flags)); 244 BUG_ON(!(fe->i_flags & cpu_to_le32(OCFS2_VALID_FL)));
244 goto bail; 245 BUG_ON(le32_to_cpu(fe->i_fs_generation) != osb->fs_generation);
245 }
246 246
247 if (le32_to_cpu(fe->i_fs_generation) != osb->fs_generation) {
248 mlog(ML_ERROR, "file entry generation does not match "
249 "superblock! osb->fs_generation=%x, "
250 "fe->i_fs_generation=%x\n",
251 osb->fs_generation, le32_to_cpu(fe->i_fs_generation));
252 goto bail;
253 }
254 247
255 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters); 248 OCFS2_I(inode)->ip_clusters = le32_to_cpu(fe->i_clusters);
256 OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr); 249 OCFS2_I(inode)->ip_attr = le32_to_cpu(fe->i_attr);
@@ -284,14 +277,18 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
284 277
285 inode->i_nlink = le16_to_cpu(fe->i_links_count); 278 inode->i_nlink = le16_to_cpu(fe->i_links_count);
286 279
287 if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) 280 if (fe->i_flags & cpu_to_le32(OCFS2_SYSTEM_FL)) {
288 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE; 281 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_SYSTEM_FILE;
282 inode->i_flags |= S_NOQUOTA;
283 }
289 284
290 if (fe->i_flags & cpu_to_le32(OCFS2_LOCAL_ALLOC_FL)) { 285 if (fe->i_flags & cpu_to_le32(OCFS2_LOCAL_ALLOC_FL)) {
291 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; 286 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP;
292 mlog(0, "local alloc inode: i_ino=%lu\n", inode->i_ino); 287 mlog(0, "local alloc inode: i_ino=%lu\n", inode->i_ino);
293 } else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) { 288 } else if (fe->i_flags & cpu_to_le32(OCFS2_BITMAP_FL)) {
294 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP; 289 OCFS2_I(inode)->ip_flags |= OCFS2_INODE_BITMAP;
290 } else if (fe->i_flags & cpu_to_le32(OCFS2_QUOTA_FL)) {
291 inode->i_flags |= S_NOQUOTA;
295 } else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) { 292 } else if (fe->i_flags & cpu_to_le32(OCFS2_SUPER_BLOCK_FL)) {
296 mlog(0, "superblock inode: i_ino=%lu\n", inode->i_ino); 293 mlog(0, "superblock inode: i_ino=%lu\n", inode->i_ino);
297 /* we can't actually hit this as read_inode can't 294 /* we can't actually hit this as read_inode can't
@@ -354,10 +351,7 @@ int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
354 351
355 ocfs2_set_inode_flags(inode); 352 ocfs2_set_inode_flags(inode);
356 353
357 status = 0; 354 mlog_exit_void();
358bail:
359 mlog_exit(status);
360 return status;
361} 355}
362 356
363static int ocfs2_read_locked_inode(struct inode *inode, 357static int ocfs2_read_locked_inode(struct inode *inode,
@@ -460,11 +454,14 @@ static int ocfs2_read_locked_inode(struct inode *inode,
460 } 454 }
461 } 455 }
462 456
463 if (can_lock) 457 if (can_lock) {
464 status = ocfs2_read_blocks(inode, args->fi_blkno, 1, &bh, 458 status = ocfs2_read_inode_block_full(inode, &bh,
465 OCFS2_BH_IGNORE_CACHE); 459 OCFS2_BH_IGNORE_CACHE);
466 else 460 } else {
467 status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh); 461 status = ocfs2_read_blocks_sync(osb, args->fi_blkno, 1, &bh);
462 if (!status)
463 status = ocfs2_validate_inode_block(osb->sb, bh);
464 }
468 if (status < 0) { 465 if (status < 0) {
469 mlog_errno(status); 466 mlog_errno(status);
470 goto bail; 467 goto bail;
@@ -472,12 +469,6 @@ static int ocfs2_read_locked_inode(struct inode *inode,
472 469
473 status = -EINVAL; 470 status = -EINVAL;
474 fe = (struct ocfs2_dinode *) bh->b_data; 471 fe = (struct ocfs2_dinode *) bh->b_data;
475 if (!OCFS2_IS_VALID_DINODE(fe)) {
476 mlog(0, "Invalid dinode #%llu: signature = %.*s\n",
477 (unsigned long long)args->fi_blkno, 7,
478 fe->i_signature);
479 goto bail;
480 }
481 472
482 /* 473 /*
483 * This is a code bug. Right now the caller needs to 474 * This is a code bug. Right now the caller needs to
@@ -491,10 +482,9 @@ static int ocfs2_read_locked_inode(struct inode *inode,
491 482
492 if (S_ISCHR(le16_to_cpu(fe->i_mode)) || 483 if (S_ISCHR(le16_to_cpu(fe->i_mode)) ||
493 S_ISBLK(le16_to_cpu(fe->i_mode))) 484 S_ISBLK(le16_to_cpu(fe->i_mode)))
494 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev)); 485 inode->i_rdev = huge_decode_dev(le64_to_cpu(fe->id1.dev1.i_rdev));
495 486
496 if (ocfs2_populate_inode(inode, fe, 0) < 0) 487 ocfs2_populate_inode(inode, fe, 0);
497 goto bail;
498 488
499 BUG_ON(args->fi_blkno != le64_to_cpu(fe->i_blkno)); 489 BUG_ON(args->fi_blkno != le64_to_cpu(fe->i_blkno));
500 490
@@ -547,8 +537,8 @@ static int ocfs2_truncate_for_delete(struct ocfs2_super *osb,
547 goto out; 537 goto out;
548 } 538 }
549 539
550 status = ocfs2_journal_access(handle, inode, fe_bh, 540 status = ocfs2_journal_access_di(handle, inode, fe_bh,
551 OCFS2_JOURNAL_ACCESS_WRITE); 541 OCFS2_JOURNAL_ACCESS_WRITE);
552 if (status < 0) { 542 if (status < 0) {
553 mlog_errno(status); 543 mlog_errno(status);
554 goto out; 544 goto out;
@@ -615,7 +605,8 @@ static int ocfs2_remove_inode(struct inode *inode,
615 goto bail; 605 goto bail;
616 } 606 }
617 607
618 handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS); 608 handle = ocfs2_start_trans(osb, OCFS2_DELETE_INODE_CREDITS +
609 ocfs2_quota_trans_credits(inode->i_sb));
619 if (IS_ERR(handle)) { 610 if (IS_ERR(handle)) {
620 status = PTR_ERR(handle); 611 status = PTR_ERR(handle);
621 mlog_errno(status); 612 mlog_errno(status);
@@ -630,8 +621,8 @@ static int ocfs2_remove_inode(struct inode *inode,
630 } 621 }
631 622
632 /* set the inodes dtime */ 623 /* set the inodes dtime */
633 status = ocfs2_journal_access(handle, inode, di_bh, 624 status = ocfs2_journal_access_di(handle, inode, di_bh,
634 OCFS2_JOURNAL_ACCESS_WRITE); 625 OCFS2_JOURNAL_ACCESS_WRITE);
635 if (status < 0) { 626 if (status < 0) {
636 mlog_errno(status); 627 mlog_errno(status);
637 goto bail_commit; 628 goto bail_commit;
@@ -647,6 +638,7 @@ static int ocfs2_remove_inode(struct inode *inode,
647 } 638 }
648 639
649 ocfs2_remove_from_cache(inode, di_bh); 640 ocfs2_remove_from_cache(inode, di_bh);
641 vfs_dq_free_inode(inode);
650 642
651 status = ocfs2_free_dinode(handle, inode_alloc_inode, 643 status = ocfs2_free_dinode(handle, inode_alloc_inode,
652 inode_alloc_bh, di); 644 inode_alloc_bh, di);
@@ -929,7 +921,10 @@ void ocfs2_delete_inode(struct inode *inode)
929 921
930 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); 922 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
931 923
932 if (is_bad_inode(inode)) { 924 /* When we fail in read_inode() we mark inode as bad. The second test
925 * catches the case when inode allocation fails before allocating
926 * a block for inode. */
927 if (is_bad_inode(inode) || !OCFS2_I(inode)->ip_blkno) {
933 mlog(0, "Skipping delete of bad inode\n"); 928 mlog(0, "Skipping delete of bad inode\n");
934 goto bail; 929 goto bail;
935 } 930 }
@@ -1195,8 +1190,8 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
1195 mlog_entry("(inode %llu)\n", 1190 mlog_entry("(inode %llu)\n",
1196 (unsigned long long)OCFS2_I(inode)->ip_blkno); 1191 (unsigned long long)OCFS2_I(inode)->ip_blkno);
1197 1192
1198 status = ocfs2_journal_access(handle, inode, bh, 1193 status = ocfs2_journal_access_di(handle, inode, bh,
1199 OCFS2_JOURNAL_ACCESS_WRITE); 1194 OCFS2_JOURNAL_ACCESS_WRITE);
1200 if (status < 0) { 1195 if (status < 0) {
1201 mlog_errno(status); 1196 mlog_errno(status);
1202 goto leave; 1197 goto leave;
@@ -1264,3 +1259,89 @@ void ocfs2_refresh_inode(struct inode *inode,
1264 1259
1265 spin_unlock(&OCFS2_I(inode)->ip_lock); 1260 spin_unlock(&OCFS2_I(inode)->ip_lock);
1266} 1261}
1262
1263int ocfs2_validate_inode_block(struct super_block *sb,
1264 struct buffer_head *bh)
1265{
1266 int rc;
1267 struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
1268
1269 mlog(0, "Validating dinode %llu\n",
1270 (unsigned long long)bh->b_blocknr);
1271
1272 BUG_ON(!buffer_uptodate(bh));
1273
1274 /*
1275 * If the ecc fails, we return the error but otherwise
1276 * leave the filesystem running. We know any error is
1277 * local to this block.
1278 */
1279 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &di->i_check);
1280 if (rc) {
1281 mlog(ML_ERROR, "Checksum failed for dinode %llu\n",
1282 (unsigned long long)bh->b_blocknr);
1283 goto bail;
1284 }
1285
1286 /*
1287 * Errors after here are fatal.
1288 */
1289
1290 rc = -EINVAL;
1291
1292 if (!OCFS2_IS_VALID_DINODE(di)) {
1293 ocfs2_error(sb, "Invalid dinode #%llu: signature = %.*s\n",
1294 (unsigned long long)bh->b_blocknr, 7,
1295 di->i_signature);
1296 goto bail;
1297 }
1298
1299 if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) {
1300 ocfs2_error(sb, "Invalid dinode #%llu: i_blkno is %llu\n",
1301 (unsigned long long)bh->b_blocknr,
1302 (unsigned long long)le64_to_cpu(di->i_blkno));
1303 goto bail;
1304 }
1305
1306 if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) {
1307 ocfs2_error(sb,
1308 "Invalid dinode #%llu: OCFS2_VALID_FL not set\n",
1309 (unsigned long long)bh->b_blocknr);
1310 goto bail;
1311 }
1312
1313 if (le32_to_cpu(di->i_fs_generation) !=
1314 OCFS2_SB(sb)->fs_generation) {
1315 ocfs2_error(sb,
1316 "Invalid dinode #%llu: fs_generation is %u\n",
1317 (unsigned long long)bh->b_blocknr,
1318 le32_to_cpu(di->i_fs_generation));
1319 goto bail;
1320 }
1321
1322 rc = 0;
1323
1324bail:
1325 return rc;
1326}
1327
1328int ocfs2_read_inode_block_full(struct inode *inode, struct buffer_head **bh,
1329 int flags)
1330{
1331 int rc;
1332 struct buffer_head *tmp = *bh;
1333
1334 rc = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, &tmp,
1335 flags, ocfs2_validate_inode_block);
1336
1337 /* If ocfs2_read_blocks() got us a new bh, pass it up. */
1338 if (!rc && !*bh)
1339 *bh = tmp;
1340
1341 return rc;
1342}
1343
1344int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh)
1345{
1346 return ocfs2_read_inode_block_full(inode, bh, 0);
1347}
diff --git a/fs/ocfs2/inode.h b/fs/ocfs2/inode.h
index 2f37af9bcc4a..eb3c302b38d3 100644
--- a/fs/ocfs2/inode.h
+++ b/fs/ocfs2/inode.h
@@ -128,8 +128,8 @@ struct inode *ocfs2_iget(struct ocfs2_super *osb, u64 feoff, unsigned flags,
128 int sysfile_type); 128 int sysfile_type);
129int ocfs2_inode_init_private(struct inode *inode); 129int ocfs2_inode_init_private(struct inode *inode);
130int ocfs2_inode_revalidate(struct dentry *dentry); 130int ocfs2_inode_revalidate(struct dentry *dentry);
131int ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe, 131void ocfs2_populate_inode(struct inode *inode, struct ocfs2_dinode *fe,
132 int create_ino); 132 int create_ino);
133void ocfs2_read_inode(struct inode *inode); 133void ocfs2_read_inode(struct inode *inode);
134void ocfs2_read_inode2(struct inode *inode, void *opaque); 134void ocfs2_read_inode2(struct inode *inode, void *opaque);
135ssize_t ocfs2_rw_direct(int rw, struct file *filp, char *buf, 135ssize_t ocfs2_rw_direct(int rw, struct file *filp, char *buf,
@@ -142,6 +142,8 @@ int ocfs2_mark_inode_dirty(handle_t *handle,
142 struct buffer_head *bh); 142 struct buffer_head *bh);
143int ocfs2_aio_read(struct file *file, struct kiocb *req, struct iocb *iocb); 143int ocfs2_aio_read(struct file *file, struct kiocb *req, struct iocb *iocb);
144int ocfs2_aio_write(struct file *file, struct kiocb *req, struct iocb *iocb); 144int ocfs2_aio_write(struct file *file, struct kiocb *req, struct iocb *iocb);
145struct buffer_head *ocfs2_bread(struct inode *inode,
146 int block, int *err, int reada);
145 147
146void ocfs2_set_inode_flags(struct inode *inode); 148void ocfs2_set_inode_flags(struct inode *inode);
147void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi); 149void ocfs2_get_inode_flags(struct ocfs2_inode_info *oi);
@@ -153,4 +155,16 @@ static inline blkcnt_t ocfs2_inode_sector_count(struct inode *inode)
153 return (blkcnt_t)(OCFS2_I(inode)->ip_clusters << c_to_s_bits); 155 return (blkcnt_t)(OCFS2_I(inode)->ip_clusters << c_to_s_bits);
154} 156}
155 157
158/* Validate that a bh contains a valid inode */
159int ocfs2_validate_inode_block(struct super_block *sb,
160 struct buffer_head *bh);
161/*
162 * Read an inode block into *bh. If *bh is NULL, a bh will be allocated.
163 * This is a cached read. The inode will be validated with
164 * ocfs2_validate_inode_block().
165 */
166int ocfs2_read_inode_block(struct inode *inode, struct buffer_head **bh);
167/* The same, but can be passed OCFS2_BH_* flags */
168int ocfs2_read_inode_block_full(struct inode *inode, struct buffer_head **bh,
169 int flags);
156#endif /* OCFS2_INODE_H */ 170#endif /* OCFS2_INODE_H */
diff --git a/fs/ocfs2/journal.c b/fs/ocfs2/journal.c
index 99fe9d584f3c..57d7d25a2b9a 100644
--- a/fs/ocfs2/journal.c
+++ b/fs/ocfs2/journal.c
@@ -35,6 +35,7 @@
35#include "ocfs2.h" 35#include "ocfs2.h"
36 36
37#include "alloc.h" 37#include "alloc.h"
38#include "blockcheck.h"
38#include "dir.h" 39#include "dir.h"
39#include "dlmglue.h" 40#include "dlmglue.h"
40#include "extent_map.h" 41#include "extent_map.h"
@@ -45,6 +46,7 @@
45#include "slot_map.h" 46#include "slot_map.h"
46#include "super.h" 47#include "super.h"
47#include "sysfile.h" 48#include "sysfile.h"
49#include "quota.h"
48 50
49#include "buffer_head_io.h" 51#include "buffer_head_io.h"
50 52
@@ -52,10 +54,10 @@ DEFINE_SPINLOCK(trans_inc_lock);
52 54
53static int ocfs2_force_read_journal(struct inode *inode); 55static int ocfs2_force_read_journal(struct inode *inode);
54static int ocfs2_recover_node(struct ocfs2_super *osb, 56static int ocfs2_recover_node(struct ocfs2_super *osb,
55 int node_num); 57 int node_num, int slot_num);
56static int __ocfs2_recovery_thread(void *arg); 58static int __ocfs2_recovery_thread(void *arg);
57static int ocfs2_commit_cache(struct ocfs2_super *osb); 59static int ocfs2_commit_cache(struct ocfs2_super *osb);
58static int ocfs2_wait_on_mount(struct ocfs2_super *osb); 60static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota);
59static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb, 61static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
60 int dirty, int replayed); 62 int dirty, int replayed);
61static int ocfs2_trylock_journal(struct ocfs2_super *osb, 63static int ocfs2_trylock_journal(struct ocfs2_super *osb,
@@ -64,6 +66,17 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
64 int slot); 66 int slot);
65static int ocfs2_commit_thread(void *arg); 67static int ocfs2_commit_thread(void *arg);
66 68
69static inline int ocfs2_wait_on_mount(struct ocfs2_super *osb)
70{
71 return __ocfs2_wait_on_mount(osb, 0);
72}
73
74static inline int ocfs2_wait_on_quotas(struct ocfs2_super *osb)
75{
76 return __ocfs2_wait_on_mount(osb, 1);
77}
78
79
67 80
68/* 81/*
69 * The recovery_list is a simple linked list of node numbers to recover. 82 * The recovery_list is a simple linked list of node numbers to recover.
@@ -256,11 +269,9 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
256 BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE); 269 BUG_ON(osb->journal->j_state == OCFS2_JOURNAL_FREE);
257 BUG_ON(max_buffs <= 0); 270 BUG_ON(max_buffs <= 0);
258 271
259 /* JBD might support this, but our journalling code doesn't yet. */ 272 /* Nested transaction? Just return the handle... */
260 if (journal_current_handle()) { 273 if (journal_current_handle())
261 mlog(ML_ERROR, "Recursive transaction attempted!\n"); 274 return jbd2_journal_start(journal, max_buffs);
262 BUG();
263 }
264 275
265 down_read(&osb->journal->j_trans_barrier); 276 down_read(&osb->journal->j_trans_barrier);
266 277
@@ -285,16 +296,18 @@ handle_t *ocfs2_start_trans(struct ocfs2_super *osb, int max_buffs)
285int ocfs2_commit_trans(struct ocfs2_super *osb, 296int ocfs2_commit_trans(struct ocfs2_super *osb,
286 handle_t *handle) 297 handle_t *handle)
287{ 298{
288 int ret; 299 int ret, nested;
289 struct ocfs2_journal *journal = osb->journal; 300 struct ocfs2_journal *journal = osb->journal;
290 301
291 BUG_ON(!handle); 302 BUG_ON(!handle);
292 303
304 nested = handle->h_ref > 1;
293 ret = jbd2_journal_stop(handle); 305 ret = jbd2_journal_stop(handle);
294 if (ret < 0) 306 if (ret < 0)
295 mlog_errno(ret); 307 mlog_errno(ret);
296 308
297 up_read(&journal->j_trans_barrier); 309 if (!nested)
310 up_read(&journal->j_trans_barrier);
298 311
299 return ret; 312 return ret;
300} 313}
@@ -357,10 +370,137 @@ bail:
357 return status; 370 return status;
358} 371}
359 372
360int ocfs2_journal_access(handle_t *handle, 373struct ocfs2_triggers {
361 struct inode *inode, 374 struct jbd2_buffer_trigger_type ot_triggers;
362 struct buffer_head *bh, 375 int ot_offset;
363 int type) 376};
377
378static inline struct ocfs2_triggers *to_ocfs2_trigger(struct jbd2_buffer_trigger_type *triggers)
379{
380 return container_of(triggers, struct ocfs2_triggers, ot_triggers);
381}
382
383static void ocfs2_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
384 struct buffer_head *bh,
385 void *data, size_t size)
386{
387 struct ocfs2_triggers *ot = to_ocfs2_trigger(triggers);
388
389 /*
390 * We aren't guaranteed to have the superblock here, so we
391 * must unconditionally compute the ecc data.
392 * __ocfs2_journal_access() will only set the triggers if
393 * metaecc is enabled.
394 */
395 ocfs2_block_check_compute(data, size, data + ot->ot_offset);
396}
397
398/*
399 * Quota blocks have their own trigger because the struct ocfs2_block_check
400 * offset depends on the blocksize.
401 */
402static void ocfs2_dq_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
403 struct buffer_head *bh,
404 void *data, size_t size)
405{
406 struct ocfs2_disk_dqtrailer *dqt =
407 ocfs2_block_dqtrailer(size, data);
408
409 /*
410 * We aren't guaranteed to have the superblock here, so we
411 * must unconditionally compute the ecc data.
412 * __ocfs2_journal_access() will only set the triggers if
413 * metaecc is enabled.
414 */
415 ocfs2_block_check_compute(data, size, &dqt->dq_check);
416}
417
418/*
419 * Directory blocks also have their own trigger because the
420 * struct ocfs2_block_check offset depends on the blocksize.
421 */
422static void ocfs2_db_commit_trigger(struct jbd2_buffer_trigger_type *triggers,
423 struct buffer_head *bh,
424 void *data, size_t size)
425{
426 struct ocfs2_dir_block_trailer *trailer =
427 ocfs2_dir_trailer_from_size(size, data);
428
429 /*
430 * We aren't guaranteed to have the superblock here, so we
431 * must unconditionally compute the ecc data.
432 * __ocfs2_journal_access() will only set the triggers if
433 * metaecc is enabled.
434 */
435 ocfs2_block_check_compute(data, size, &trailer->db_check);
436}
437
438static void ocfs2_abort_trigger(struct jbd2_buffer_trigger_type *triggers,
439 struct buffer_head *bh)
440{
441 mlog(ML_ERROR,
442 "ocfs2_abort_trigger called by JBD2. bh = 0x%lx, "
443 "bh->b_blocknr = %llu\n",
444 (unsigned long)bh,
445 (unsigned long long)bh->b_blocknr);
446
447 /* We aren't guaranteed to have the superblock here - but if we
448 * don't, it'll just crash. */
449 ocfs2_error(bh->b_assoc_map->host->i_sb,
450 "JBD2 has aborted our journal, ocfs2 cannot continue\n");
451}
452
453static struct ocfs2_triggers di_triggers = {
454 .ot_triggers = {
455 .t_commit = ocfs2_commit_trigger,
456 .t_abort = ocfs2_abort_trigger,
457 },
458 .ot_offset = offsetof(struct ocfs2_dinode, i_check),
459};
460
461static struct ocfs2_triggers eb_triggers = {
462 .ot_triggers = {
463 .t_commit = ocfs2_commit_trigger,
464 .t_abort = ocfs2_abort_trigger,
465 },
466 .ot_offset = offsetof(struct ocfs2_extent_block, h_check),
467};
468
469static struct ocfs2_triggers gd_triggers = {
470 .ot_triggers = {
471 .t_commit = ocfs2_commit_trigger,
472 .t_abort = ocfs2_abort_trigger,
473 },
474 .ot_offset = offsetof(struct ocfs2_group_desc, bg_check),
475};
476
477static struct ocfs2_triggers db_triggers = {
478 .ot_triggers = {
479 .t_commit = ocfs2_db_commit_trigger,
480 .t_abort = ocfs2_abort_trigger,
481 },
482};
483
484static struct ocfs2_triggers xb_triggers = {
485 .ot_triggers = {
486 .t_commit = ocfs2_commit_trigger,
487 .t_abort = ocfs2_abort_trigger,
488 },
489 .ot_offset = offsetof(struct ocfs2_xattr_block, xb_check),
490};
491
492static struct ocfs2_triggers dq_triggers = {
493 .ot_triggers = {
494 .t_commit = ocfs2_dq_commit_trigger,
495 .t_abort = ocfs2_abort_trigger,
496 },
497};
498
499static int __ocfs2_journal_access(handle_t *handle,
500 struct inode *inode,
501 struct buffer_head *bh,
502 struct ocfs2_triggers *triggers,
503 int type)
364{ 504{
365 int status; 505 int status;
366 506
@@ -406,6 +546,8 @@ int ocfs2_journal_access(handle_t *handle,
406 status = -EINVAL; 546 status = -EINVAL;
407 mlog(ML_ERROR, "Uknown access type!\n"); 547 mlog(ML_ERROR, "Uknown access type!\n");
408 } 548 }
549 if (!status && ocfs2_meta_ecc(OCFS2_SB(inode->i_sb)) && triggers)
550 jbd2_journal_set_triggers(bh, &triggers->ot_triggers);
409 mutex_unlock(&OCFS2_I(inode)->ip_io_mutex); 551 mutex_unlock(&OCFS2_I(inode)->ip_io_mutex);
410 552
411 if (status < 0) 553 if (status < 0)
@@ -416,6 +558,54 @@ int ocfs2_journal_access(handle_t *handle,
416 return status; 558 return status;
417} 559}
418 560
561int ocfs2_journal_access_di(handle_t *handle, struct inode *inode,
562 struct buffer_head *bh, int type)
563{
564 return __ocfs2_journal_access(handle, inode, bh, &di_triggers,
565 type);
566}
567
568int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode,
569 struct buffer_head *bh, int type)
570{
571 return __ocfs2_journal_access(handle, inode, bh, &eb_triggers,
572 type);
573}
574
575int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode,
576 struct buffer_head *bh, int type)
577{
578 return __ocfs2_journal_access(handle, inode, bh, &gd_triggers,
579 type);
580}
581
582int ocfs2_journal_access_db(handle_t *handle, struct inode *inode,
583 struct buffer_head *bh, int type)
584{
585 return __ocfs2_journal_access(handle, inode, bh, &db_triggers,
586 type);
587}
588
589int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode,
590 struct buffer_head *bh, int type)
591{
592 return __ocfs2_journal_access(handle, inode, bh, &xb_triggers,
593 type);
594}
595
596int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode,
597 struct buffer_head *bh, int type)
598{
599 return __ocfs2_journal_access(handle, inode, bh, &dq_triggers,
600 type);
601}
602
603int ocfs2_journal_access(handle_t *handle, struct inode *inode,
604 struct buffer_head *bh, int type)
605{
606 return __ocfs2_journal_access(handle, inode, bh, NULL, type);
607}
608
419int ocfs2_journal_dirty(handle_t *handle, 609int ocfs2_journal_dirty(handle_t *handle,
420 struct buffer_head *bh) 610 struct buffer_head *bh)
421{ 611{
@@ -434,20 +624,6 @@ int ocfs2_journal_dirty(handle_t *handle,
434 return status; 624 return status;
435} 625}
436 626
437#ifdef CONFIG_OCFS2_COMPAT_JBD
438int ocfs2_journal_dirty_data(handle_t *handle,
439 struct buffer_head *bh)
440{
441 int err = journal_dirty_data(handle, bh);
442 if (err)
443 mlog_errno(err);
444 /* TODO: When we can handle it, abort the handle and go RO on
445 * error here. */
446
447 return err;
448}
449#endif
450
451#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE) 627#define OCFS2_DEFAULT_COMMIT_INTERVAL (HZ * JBD2_DEFAULT_MAX_COMMIT_AGE)
452 628
453void ocfs2_set_journal_params(struct ocfs2_super *osb) 629void ocfs2_set_journal_params(struct ocfs2_super *osb)
@@ -587,17 +763,11 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
587 mlog_entry_void(); 763 mlog_entry_void();
588 764
589 fe = (struct ocfs2_dinode *)bh->b_data; 765 fe = (struct ocfs2_dinode *)bh->b_data;
590 if (!OCFS2_IS_VALID_DINODE(fe)) { 766
591 /* This is called from startup/shutdown which will 767 /* The journal bh on the osb always comes from ocfs2_journal_init()
592 * handle the errors in a specific manner, so no need 768 * and was validated there inside ocfs2_inode_lock_full(). It's a
593 * to call ocfs2_error() here. */ 769 * code bug if we mess it up. */
594 mlog(ML_ERROR, "Journal dinode %llu has invalid " 770 BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
595 "signature: %.*s",
596 (unsigned long long)le64_to_cpu(fe->i_blkno), 7,
597 fe->i_signature);
598 status = -EIO;
599 goto out;
600 }
601 771
602 flags = le32_to_cpu(fe->id1.journal1.ij_flags); 772 flags = le32_to_cpu(fe->id1.journal1.ij_flags);
603 if (dirty) 773 if (dirty)
@@ -609,11 +779,11 @@ static int ocfs2_journal_toggle_dirty(struct ocfs2_super *osb,
609 if (replayed) 779 if (replayed)
610 ocfs2_bump_recovery_generation(fe); 780 ocfs2_bump_recovery_generation(fe);
611 781
782 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check);
612 status = ocfs2_write_block(osb, bh, journal->j_inode); 783 status = ocfs2_write_block(osb, bh, journal->j_inode);
613 if (status < 0) 784 if (status < 0)
614 mlog_errno(status); 785 mlog_errno(status);
615 786
616out:
617 mlog_exit(status); 787 mlog_exit(status);
618 return status; 788 return status;
619} 789}
@@ -878,6 +1048,7 @@ struct ocfs2_la_recovery_item {
878 int lri_slot; 1048 int lri_slot;
879 struct ocfs2_dinode *lri_la_dinode; 1049 struct ocfs2_dinode *lri_la_dinode;
880 struct ocfs2_dinode *lri_tl_dinode; 1050 struct ocfs2_dinode *lri_tl_dinode;
1051 struct ocfs2_quota_recovery *lri_qrec;
881}; 1052};
882 1053
883/* Does the second half of the recovery process. By this point, the 1054/* Does the second half of the recovery process. By this point, the
@@ -898,6 +1069,7 @@ void ocfs2_complete_recovery(struct work_struct *work)
898 struct ocfs2_super *osb = journal->j_osb; 1069 struct ocfs2_super *osb = journal->j_osb;
899 struct ocfs2_dinode *la_dinode, *tl_dinode; 1070 struct ocfs2_dinode *la_dinode, *tl_dinode;
900 struct ocfs2_la_recovery_item *item, *n; 1071 struct ocfs2_la_recovery_item *item, *n;
1072 struct ocfs2_quota_recovery *qrec;
901 LIST_HEAD(tmp_la_list); 1073 LIST_HEAD(tmp_la_list);
902 1074
903 mlog_entry_void(); 1075 mlog_entry_void();
@@ -913,6 +1085,8 @@ void ocfs2_complete_recovery(struct work_struct *work)
913 1085
914 mlog(0, "Complete recovery for slot %d\n", item->lri_slot); 1086 mlog(0, "Complete recovery for slot %d\n", item->lri_slot);
915 1087
1088 ocfs2_wait_on_quotas(osb);
1089
916 la_dinode = item->lri_la_dinode; 1090 la_dinode = item->lri_la_dinode;
917 if (la_dinode) { 1091 if (la_dinode) {
918 mlog(0, "Clean up local alloc %llu\n", 1092 mlog(0, "Clean up local alloc %llu\n",
@@ -943,6 +1117,16 @@ void ocfs2_complete_recovery(struct work_struct *work)
943 if (ret < 0) 1117 if (ret < 0)
944 mlog_errno(ret); 1118 mlog_errno(ret);
945 1119
1120 qrec = item->lri_qrec;
1121 if (qrec) {
1122 mlog(0, "Recovering quota files");
1123 ret = ocfs2_finish_quota_recovery(osb, qrec,
1124 item->lri_slot);
1125 if (ret < 0)
1126 mlog_errno(ret);
1127 /* Recovery info is already freed now */
1128 }
1129
946 kfree(item); 1130 kfree(item);
947 } 1131 }
948 1132
@@ -956,7 +1140,8 @@ void ocfs2_complete_recovery(struct work_struct *work)
956static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal, 1140static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal,
957 int slot_num, 1141 int slot_num,
958 struct ocfs2_dinode *la_dinode, 1142 struct ocfs2_dinode *la_dinode,
959 struct ocfs2_dinode *tl_dinode) 1143 struct ocfs2_dinode *tl_dinode,
1144 struct ocfs2_quota_recovery *qrec)
960{ 1145{
961 struct ocfs2_la_recovery_item *item; 1146 struct ocfs2_la_recovery_item *item;
962 1147
@@ -971,6 +1156,9 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal,
971 if (tl_dinode) 1156 if (tl_dinode)
972 kfree(tl_dinode); 1157 kfree(tl_dinode);
973 1158
1159 if (qrec)
1160 ocfs2_free_quota_recovery(qrec);
1161
974 mlog_errno(-ENOMEM); 1162 mlog_errno(-ENOMEM);
975 return; 1163 return;
976 } 1164 }
@@ -979,6 +1167,7 @@ static void ocfs2_queue_recovery_completion(struct ocfs2_journal *journal,
979 item->lri_la_dinode = la_dinode; 1167 item->lri_la_dinode = la_dinode;
980 item->lri_slot = slot_num; 1168 item->lri_slot = slot_num;
981 item->lri_tl_dinode = tl_dinode; 1169 item->lri_tl_dinode = tl_dinode;
1170 item->lri_qrec = qrec;
982 1171
983 spin_lock(&journal->j_lock); 1172 spin_lock(&journal->j_lock);
984 list_add_tail(&item->lri_list, &journal->j_la_cleanups); 1173 list_add_tail(&item->lri_list, &journal->j_la_cleanups);
@@ -998,6 +1187,7 @@ void ocfs2_complete_mount_recovery(struct ocfs2_super *osb)
998 ocfs2_queue_recovery_completion(journal, 1187 ocfs2_queue_recovery_completion(journal,
999 osb->slot_num, 1188 osb->slot_num,
1000 osb->local_alloc_copy, 1189 osb->local_alloc_copy,
1190 NULL,
1001 NULL); 1191 NULL);
1002 ocfs2_schedule_truncate_log_flush(osb, 0); 1192 ocfs2_schedule_truncate_log_flush(osb, 0);
1003 1193
@@ -1006,11 +1196,26 @@ void ocfs2_complete_mount_recovery(struct ocfs2_super *osb)
1006 } 1196 }
1007} 1197}
1008 1198
1199void ocfs2_complete_quota_recovery(struct ocfs2_super *osb)
1200{
1201 if (osb->quota_rec) {
1202 ocfs2_queue_recovery_completion(osb->journal,
1203 osb->slot_num,
1204 NULL,
1205 NULL,
1206 osb->quota_rec);
1207 osb->quota_rec = NULL;
1208 }
1209}
1210
1009static int __ocfs2_recovery_thread(void *arg) 1211static int __ocfs2_recovery_thread(void *arg)
1010{ 1212{
1011 int status, node_num; 1213 int status, node_num, slot_num;
1012 struct ocfs2_super *osb = arg; 1214 struct ocfs2_super *osb = arg;
1013 struct ocfs2_recovery_map *rm = osb->recovery_map; 1215 struct ocfs2_recovery_map *rm = osb->recovery_map;
1216 int *rm_quota = NULL;
1217 int rm_quota_used = 0, i;
1218 struct ocfs2_quota_recovery *qrec;
1014 1219
1015 mlog_entry_void(); 1220 mlog_entry_void();
1016 1221
@@ -1019,6 +1224,11 @@ static int __ocfs2_recovery_thread(void *arg)
1019 goto bail; 1224 goto bail;
1020 } 1225 }
1021 1226
1227 rm_quota = kzalloc(osb->max_slots * sizeof(int), GFP_NOFS);
1228 if (!rm_quota) {
1229 status = -ENOMEM;
1230 goto bail;
1231 }
1022restart: 1232restart:
1023 status = ocfs2_super_lock(osb, 1); 1233 status = ocfs2_super_lock(osb, 1);
1024 if (status < 0) { 1234 if (status < 0) {
@@ -1032,8 +1242,28 @@ restart:
1032 * clear it until ocfs2_recover_node() has succeeded. */ 1242 * clear it until ocfs2_recover_node() has succeeded. */
1033 node_num = rm->rm_entries[0]; 1243 node_num = rm->rm_entries[0];
1034 spin_unlock(&osb->osb_lock); 1244 spin_unlock(&osb->osb_lock);
1035 1245 mlog(0, "checking node %d\n", node_num);
1036 status = ocfs2_recover_node(osb, node_num); 1246 slot_num = ocfs2_node_num_to_slot(osb, node_num);
1247 if (slot_num == -ENOENT) {
1248 status = 0;
1249 mlog(0, "no slot for this node, so no recovery"
1250 "required.\n");
1251 goto skip_recovery;
1252 }
1253 mlog(0, "node %d was using slot %d\n", node_num, slot_num);
1254
1255 /* It is a bit subtle with quota recovery. We cannot do it
1256 * immediately because we have to obtain cluster locks from
1257 * quota files and we also don't want to just skip it because
1258 * then quota usage would be out of sync until some node takes
1259 * the slot. So we remember which nodes need quota recovery
1260 * and when everything else is done, we recover quotas. */
1261 for (i = 0; i < rm_quota_used && rm_quota[i] != slot_num; i++);
1262 if (i == rm_quota_used)
1263 rm_quota[rm_quota_used++] = slot_num;
1264
1265 status = ocfs2_recover_node(osb, node_num, slot_num);
1266skip_recovery:
1037 if (!status) { 1267 if (!status) {
1038 ocfs2_recovery_map_clear(osb, node_num); 1268 ocfs2_recovery_map_clear(osb, node_num);
1039 } else { 1269 } else {
@@ -1055,13 +1285,27 @@ restart:
1055 if (status < 0) 1285 if (status < 0)
1056 mlog_errno(status); 1286 mlog_errno(status);
1057 1287
1288 /* Now it is right time to recover quotas... We have to do this under
1289 * superblock lock so that noone can start using the slot (and crash)
1290 * before we recover it */
1291 for (i = 0; i < rm_quota_used; i++) {
1292 qrec = ocfs2_begin_quota_recovery(osb, rm_quota[i]);
1293 if (IS_ERR(qrec)) {
1294 status = PTR_ERR(qrec);
1295 mlog_errno(status);
1296 continue;
1297 }
1298 ocfs2_queue_recovery_completion(osb->journal, rm_quota[i],
1299 NULL, NULL, qrec);
1300 }
1301
1058 ocfs2_super_unlock(osb, 1); 1302 ocfs2_super_unlock(osb, 1);
1059 1303
1060 /* We always run recovery on our own orphan dir - the dead 1304 /* We always run recovery on our own orphan dir - the dead
1061 * node(s) may have disallowd a previos inode delete. Re-processing 1305 * node(s) may have disallowd a previos inode delete. Re-processing
1062 * is therefore required. */ 1306 * is therefore required. */
1063 ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL, 1307 ocfs2_queue_recovery_completion(osb->journal, osb->slot_num, NULL,
1064 NULL); 1308 NULL, NULL);
1065 1309
1066bail: 1310bail:
1067 mutex_lock(&osb->recovery_lock); 1311 mutex_lock(&osb->recovery_lock);
@@ -1076,6 +1320,9 @@ bail:
1076 1320
1077 mutex_unlock(&osb->recovery_lock); 1321 mutex_unlock(&osb->recovery_lock);
1078 1322
1323 if (rm_quota)
1324 kfree(rm_quota);
1325
1079 mlog_exit(status); 1326 mlog_exit(status);
1080 /* no one is callint kthread_stop() for us so the kthread() api 1327 /* no one is callint kthread_stop() for us so the kthread() api
1081 * requires that we call do_exit(). And it isn't exported, but 1328 * requires that we call do_exit(). And it isn't exported, but
@@ -1135,8 +1382,7 @@ static int ocfs2_read_journal_inode(struct ocfs2_super *osb,
1135 } 1382 }
1136 SET_INODE_JOURNAL(inode); 1383 SET_INODE_JOURNAL(inode);
1137 1384
1138 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, bh, 1385 status = ocfs2_read_inode_block_full(inode, bh, OCFS2_BH_IGNORE_CACHE);
1139 OCFS2_BH_IGNORE_CACHE);
1140 if (status < 0) { 1386 if (status < 0) {
1141 mlog_errno(status); 1387 mlog_errno(status);
1142 goto bail; 1388 goto bail;
@@ -1268,6 +1514,7 @@ static int ocfs2_replay_journal(struct ocfs2_super *osb,
1268 osb->slot_recovery_generations[slot_num] = 1514 osb->slot_recovery_generations[slot_num] =
1269 ocfs2_get_recovery_generation(fe); 1515 ocfs2_get_recovery_generation(fe);
1270 1516
1517 ocfs2_compute_meta_ecc(osb->sb, bh->b_data, &fe->i_check);
1271 status = ocfs2_write_block(osb, bh, inode); 1518 status = ocfs2_write_block(osb, bh, inode);
1272 if (status < 0) 1519 if (status < 0)
1273 mlog_errno(status); 1520 mlog_errno(status);
@@ -1304,31 +1551,19 @@ done:
1304 * far less concerning. 1551 * far less concerning.
1305 */ 1552 */
1306static int ocfs2_recover_node(struct ocfs2_super *osb, 1553static int ocfs2_recover_node(struct ocfs2_super *osb,
1307 int node_num) 1554 int node_num, int slot_num)
1308{ 1555{
1309 int status = 0; 1556 int status = 0;
1310 int slot_num;
1311 struct ocfs2_dinode *la_copy = NULL; 1557 struct ocfs2_dinode *la_copy = NULL;
1312 struct ocfs2_dinode *tl_copy = NULL; 1558 struct ocfs2_dinode *tl_copy = NULL;
1313 1559
1314 mlog_entry("(node_num=%d, osb->node_num = %d)\n", 1560 mlog_entry("(node_num=%d, slot_num=%d, osb->node_num = %d)\n",
1315 node_num, osb->node_num); 1561 node_num, slot_num, osb->node_num);
1316
1317 mlog(0, "checking node %d\n", node_num);
1318 1562
1319 /* Should not ever be called to recover ourselves -- in that 1563 /* Should not ever be called to recover ourselves -- in that
1320 * case we should've called ocfs2_journal_load instead. */ 1564 * case we should've called ocfs2_journal_load instead. */
1321 BUG_ON(osb->node_num == node_num); 1565 BUG_ON(osb->node_num == node_num);
1322 1566
1323 slot_num = ocfs2_node_num_to_slot(osb, node_num);
1324 if (slot_num == -ENOENT) {
1325 status = 0;
1326 mlog(0, "no slot for this node, so no recovery required.\n");
1327 goto done;
1328 }
1329
1330 mlog(0, "node %d was using slot %d\n", node_num, slot_num);
1331
1332 status = ocfs2_replay_journal(osb, node_num, slot_num); 1567 status = ocfs2_replay_journal(osb, node_num, slot_num);
1333 if (status < 0) { 1568 if (status < 0) {
1334 if (status == -EBUSY) { 1569 if (status == -EBUSY) {
@@ -1364,7 +1599,7 @@ static int ocfs2_recover_node(struct ocfs2_super *osb,
1364 1599
1365 /* This will kfree the memory pointed to by la_copy and tl_copy */ 1600 /* This will kfree the memory pointed to by la_copy and tl_copy */
1366 ocfs2_queue_recovery_completion(osb->journal, slot_num, la_copy, 1601 ocfs2_queue_recovery_completion(osb->journal, slot_num, la_copy,
1367 tl_copy); 1602 tl_copy, NULL);
1368 1603
1369 status = 0; 1604 status = 0;
1370done: 1605done:
@@ -1659,13 +1894,14 @@ static int ocfs2_recover_orphans(struct ocfs2_super *osb,
1659 return ret; 1894 return ret;
1660} 1895}
1661 1896
1662static int ocfs2_wait_on_mount(struct ocfs2_super *osb) 1897static int __ocfs2_wait_on_mount(struct ocfs2_super *osb, int quota)
1663{ 1898{
1664 /* This check is good because ocfs2 will wait on our recovery 1899 /* This check is good because ocfs2 will wait on our recovery
1665 * thread before changing it to something other than MOUNTED 1900 * thread before changing it to something other than MOUNTED
1666 * or DISABLED. */ 1901 * or DISABLED. */
1667 wait_event(osb->osb_mount_event, 1902 wait_event(osb->osb_mount_event,
1668 atomic_read(&osb->vol_state) == VOLUME_MOUNTED || 1903 (!quota && atomic_read(&osb->vol_state) == VOLUME_MOUNTED) ||
1904 atomic_read(&osb->vol_state) == VOLUME_MOUNTED_QUOTAS ||
1669 atomic_read(&osb->vol_state) == VOLUME_DISABLED); 1905 atomic_read(&osb->vol_state) == VOLUME_DISABLED);
1670 1906
1671 /* If there's an error on mount, then we may never get to the 1907 /* If there's an error on mount, then we may never get to the
diff --git a/fs/ocfs2/journal.h b/fs/ocfs2/journal.h
index d4d14e9a3cea..3c3532e1307c 100644
--- a/fs/ocfs2/journal.h
+++ b/fs/ocfs2/journal.h
@@ -27,12 +27,7 @@
27#define OCFS2_JOURNAL_H 27#define OCFS2_JOURNAL_H
28 28
29#include <linux/fs.h> 29#include <linux/fs.h>
30#ifndef CONFIG_OCFS2_COMPAT_JBD 30#include <linux/jbd2.h>
31# include <linux/jbd2.h>
32#else
33# include <linux/jbd.h>
34# include "ocfs2_jbd_compat.h"
35#endif
36 31
37enum ocfs2_journal_state { 32enum ocfs2_journal_state {
38 OCFS2_JOURNAL_FREE = 0, 33 OCFS2_JOURNAL_FREE = 0,
@@ -173,6 +168,7 @@ void ocfs2_recovery_thread(struct ocfs2_super *osb,
173 int node_num); 168 int node_num);
174int ocfs2_mark_dead_nodes(struct ocfs2_super *osb); 169int ocfs2_mark_dead_nodes(struct ocfs2_super *osb);
175void ocfs2_complete_mount_recovery(struct ocfs2_super *osb); 170void ocfs2_complete_mount_recovery(struct ocfs2_super *osb);
171void ocfs2_complete_quota_recovery(struct ocfs2_super *osb);
176 172
177static inline void ocfs2_start_checkpoint(struct ocfs2_super *osb) 173static inline void ocfs2_start_checkpoint(struct ocfs2_super *osb)
178{ 174{
@@ -216,9 +212,12 @@ static inline void ocfs2_checkpoint_inode(struct inode *inode)
216 * ocfs2_extend_trans - Extend a handle by nblocks credits. This may 212 * ocfs2_extend_trans - Extend a handle by nblocks credits. This may
217 * commit the handle to disk in the process, but will 213 * commit the handle to disk in the process, but will
218 * not release any locks taken during the transaction. 214 * not release any locks taken during the transaction.
219 * ocfs2_journal_access - Notify the handle that we want to journal this 215 * ocfs2_journal_access* - Notify the handle that we want to journal this
220 * buffer. Will have to call ocfs2_journal_dirty once 216 * buffer. Will have to call ocfs2_journal_dirty once
221 * we've actually dirtied it. Type is one of . or . 217 * we've actually dirtied it. Type is one of . or .
218 * Always call the specific flavor of
219 * ocfs2_journal_access_*() unless you intend to
220 * manage the checksum by hand.
222 * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data. 221 * ocfs2_journal_dirty - Mark a journalled buffer as having dirty data.
223 * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before 222 * ocfs2_jbd2_file_inode - Mark an inode so that its data goes out before
224 * the current handle commits. 223 * the current handle commits.
@@ -248,10 +247,29 @@ int ocfs2_extend_trans(handle_t *handle, int nblocks);
248#define OCFS2_JOURNAL_ACCESS_WRITE 1 247#define OCFS2_JOURNAL_ACCESS_WRITE 1
249#define OCFS2_JOURNAL_ACCESS_UNDO 2 248#define OCFS2_JOURNAL_ACCESS_UNDO 2
250 249
251int ocfs2_journal_access(handle_t *handle, 250
252 struct inode *inode, 251/* ocfs2_inode */
253 struct buffer_head *bh, 252int ocfs2_journal_access_di(handle_t *handle, struct inode *inode,
254 int type); 253 struct buffer_head *bh, int type);
254/* ocfs2_extent_block */
255int ocfs2_journal_access_eb(handle_t *handle, struct inode *inode,
256 struct buffer_head *bh, int type);
257/* ocfs2_group_desc */
258int ocfs2_journal_access_gd(handle_t *handle, struct inode *inode,
259 struct buffer_head *bh, int type);
260/* ocfs2_xattr_block */
261int ocfs2_journal_access_xb(handle_t *handle, struct inode *inode,
262 struct buffer_head *bh, int type);
263/* quota blocks */
264int ocfs2_journal_access_dq(handle_t *handle, struct inode *inode,
265 struct buffer_head *bh, int type);
266/* dirblock */
267int ocfs2_journal_access_db(handle_t *handle, struct inode *inode,
268 struct buffer_head *bh, int type);
269/* Anything that has no ecc */
270int ocfs2_journal_access(handle_t *handle, struct inode *inode,
271 struct buffer_head *bh, int type);
272
255/* 273/*
256 * A word about the journal_access/journal_dirty "dance". It is 274 * A word about the journal_access/journal_dirty "dance". It is
257 * entirely legal to journal_access a buffer more than once (as long 275 * entirely legal to journal_access a buffer more than once (as long
@@ -273,10 +291,6 @@ int ocfs2_journal_access(handle_t *handle,
273 */ 291 */
274int ocfs2_journal_dirty(handle_t *handle, 292int ocfs2_journal_dirty(handle_t *handle,
275 struct buffer_head *bh); 293 struct buffer_head *bh);
276#ifdef CONFIG_OCFS2_COMPAT_JBD
277int ocfs2_journal_dirty_data(handle_t *handle,
278 struct buffer_head *bh);
279#endif
280 294
281/* 295/*
282 * Credit Macros: 296 * Credit Macros:
@@ -293,6 +307,37 @@ int ocfs2_journal_dirty_data(handle_t *handle,
293/* extended attribute block update */ 307/* extended attribute block update */
294#define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1 308#define OCFS2_XATTR_BLOCK_UPDATE_CREDITS 1
295 309
310/* global quotafile inode update, data block */
311#define OCFS2_QINFO_WRITE_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1)
312
313/*
314 * The two writes below can accidentally see global info dirty due
315 * to set_info() quotactl so make them prepared for the writes.
316 */
317/* quota data block, global info */
318/* Write to local quota file */
319#define OCFS2_QWRITE_CREDITS (OCFS2_QINFO_WRITE_CREDITS + 1)
320
321/* global quota data block, local quota data block, global quota inode,
322 * global quota info */
323#define OCFS2_QSYNC_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 3)
324
325static inline int ocfs2_quota_trans_credits(struct super_block *sb)
326{
327 int credits = 0;
328
329 if (OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA))
330 credits += OCFS2_QWRITE_CREDITS;
331 if (OCFS2_HAS_RO_COMPAT_FEATURE(sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA))
332 credits += OCFS2_QWRITE_CREDITS;
333 return credits;
334}
335
336/* Number of credits needed for removing quota structure from file */
337int ocfs2_calc_qdel_credits(struct super_block *sb, int type);
338/* Number of credits needed for initialization of new quota structure */
339int ocfs2_calc_qinit_credits(struct super_block *sb, int type);
340
296/* group extend. inode update and last group update. */ 341/* group extend. inode update and last group update. */
297#define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1) 342#define OCFS2_GROUP_EXTEND_CREDITS (OCFS2_INODE_UPDATE_CREDITS + 1)
298 343
@@ -303,8 +348,11 @@ int ocfs2_journal_dirty_data(handle_t *handle,
303 * prev. group desc. if we relink. */ 348 * prev. group desc. if we relink. */
304#define OCFS2_SUBALLOC_ALLOC (3) 349#define OCFS2_SUBALLOC_ALLOC (3)
305 350
306#define OCFS2_INLINE_TO_EXTENTS_CREDITS (OCFS2_SUBALLOC_ALLOC \ 351static inline int ocfs2_inline_to_extents_credits(struct super_block *sb)
307 + OCFS2_INODE_UPDATE_CREDITS) 352{
353 return OCFS2_SUBALLOC_ALLOC + OCFS2_INODE_UPDATE_CREDITS +
354 ocfs2_quota_trans_credits(sb);
355}
308 356
309/* dinode + group descriptor update. We don't relink on free yet. */ 357/* dinode + group descriptor update. We don't relink on free yet. */
310#define OCFS2_SUBALLOC_FREE (2) 358#define OCFS2_SUBALLOC_FREE (2)
@@ -313,16 +361,23 @@ int ocfs2_journal_dirty_data(handle_t *handle,
313#define OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC (OCFS2_SUBALLOC_FREE \ 361#define OCFS2_TRUNCATE_LOG_FLUSH_ONE_REC (OCFS2_SUBALLOC_FREE \
314 + OCFS2_TRUNCATE_LOG_UPDATE) 362 + OCFS2_TRUNCATE_LOG_UPDATE)
315 363
316#define OCFS2_REMOVE_EXTENT_CREDITS (OCFS2_TRUNCATE_LOG_UPDATE + OCFS2_INODE_UPDATE_CREDITS) 364static inline int ocfs2_remove_extent_credits(struct super_block *sb)
365{
366 return OCFS2_TRUNCATE_LOG_UPDATE + OCFS2_INODE_UPDATE_CREDITS +
367 ocfs2_quota_trans_credits(sb);
368}
317 369
318/* data block for new dir/symlink, 2 for bitmap updates (bitmap fe + 370/* data block for new dir/symlink, 2 for bitmap updates (bitmap fe +
319 * bitmap block for the new bit) */ 371 * bitmap block for the new bit) */
320#define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2) 372#define OCFS2_DIR_LINK_ADDITIONAL_CREDITS (1 + 2)
321 373
322/* parent fe, parent block, new file entry, inode alloc fe, inode alloc 374/* parent fe, parent block, new file entry, inode alloc fe, inode alloc
323 * group descriptor + mkdir/symlink blocks */ 375 * group descriptor + mkdir/symlink blocks + quota update */
324#define OCFS2_MKNOD_CREDITS (3 + OCFS2_SUBALLOC_ALLOC \ 376static inline int ocfs2_mknod_credits(struct super_block *sb)
325 + OCFS2_DIR_LINK_ADDITIONAL_CREDITS) 377{
378 return 3 + OCFS2_SUBALLOC_ALLOC + OCFS2_DIR_LINK_ADDITIONAL_CREDITS +
379 ocfs2_quota_trans_credits(sb);
380}
326 381
327/* local alloc metadata change + main bitmap updates */ 382/* local alloc metadata change + main bitmap updates */
328#define OCFS2_WINDOW_MOVE_CREDITS (OCFS2_INODE_UPDATE_CREDITS \ 383#define OCFS2_WINDOW_MOVE_CREDITS (OCFS2_INODE_UPDATE_CREDITS \
@@ -332,13 +387,21 @@ int ocfs2_journal_dirty_data(handle_t *handle,
332 * for the dinode, one for the new block. */ 387 * for the dinode, one for the new block. */
333#define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2) 388#define OCFS2_SIMPLE_DIR_EXTEND_CREDITS (2)
334 389
335/* file update (nlink, etc) + directory mtime/ctime + dir entry block */ 390/* file update (nlink, etc) + directory mtime/ctime + dir entry block + quota
336#define OCFS2_LINK_CREDITS (2*OCFS2_INODE_UPDATE_CREDITS + 1) 391 * update on dir */
392static inline int ocfs2_link_credits(struct super_block *sb)
393{
394 return 2*OCFS2_INODE_UPDATE_CREDITS + 1 +
395 ocfs2_quota_trans_credits(sb);
396}
337 397
338/* inode + dir inode (if we unlink a dir), + dir entry block + orphan 398/* inode + dir inode (if we unlink a dir), + dir entry block + orphan
339 * dir inode link */ 399 * dir inode link */
340#define OCFS2_UNLINK_CREDITS (2 * OCFS2_INODE_UPDATE_CREDITS + 1 \ 400static inline int ocfs2_unlink_credits(struct super_block *sb)
341 + OCFS2_LINK_CREDITS) 401{
402 /* The quota update from ocfs2_link_credits is unused here... */
403 return 2 * OCFS2_INODE_UPDATE_CREDITS + 1 + ocfs2_link_credits(sb);
404}
342 405
343/* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry + 406/* dinode + orphan dir dinode + inode alloc dinode + orphan dir entry +
344 * inode alloc group descriptor */ 407 * inode alloc group descriptor */
@@ -347,8 +410,10 @@ int ocfs2_journal_dirty_data(handle_t *handle,
347/* dinode update, old dir dinode update, new dir dinode update, old 410/* dinode update, old dir dinode update, new dir dinode update, old
348 * dir dir entry, new dir dir entry, dir entry update for renaming 411 * dir dir entry, new dir dir entry, dir entry update for renaming
349 * directory + target unlink */ 412 * directory + target unlink */
350#define OCFS2_RENAME_CREDITS (3 * OCFS2_INODE_UPDATE_CREDITS + 3 \ 413static inline int ocfs2_rename_credits(struct super_block *sb)
351 + OCFS2_UNLINK_CREDITS) 414{
415 return 3 * OCFS2_INODE_UPDATE_CREDITS + 3 + ocfs2_unlink_credits(sb);
416}
352 417
353/* global bitmap dinode, group desc., relinked group, 418/* global bitmap dinode, group desc., relinked group,
354 * suballocator dinode, group desc., relinked group, 419 * suballocator dinode, group desc., relinked group,
@@ -386,18 +451,19 @@ static inline int ocfs2_calc_extend_credits(struct super_block *sb,
386 * credit for the dinode there. */ 451 * credit for the dinode there. */
387 extent_blocks = 1 + 1 + le16_to_cpu(root_el->l_tree_depth); 452 extent_blocks = 1 + 1 + le16_to_cpu(root_el->l_tree_depth);
388 453
389 return bitmap_blocks + sysfile_bitmap_blocks + extent_blocks; 454 return bitmap_blocks + sysfile_bitmap_blocks + extent_blocks +
455 ocfs2_quota_trans_credits(sb);
390} 456}
391 457
392static inline int ocfs2_calc_symlink_credits(struct super_block *sb) 458static inline int ocfs2_calc_symlink_credits(struct super_block *sb)
393{ 459{
394 int blocks = OCFS2_MKNOD_CREDITS; 460 int blocks = ocfs2_mknod_credits(sb);
395 461
396 /* links can be longer than one block so we may update many 462 /* links can be longer than one block so we may update many
397 * within our single allocated extent. */ 463 * within our single allocated extent. */
398 blocks += ocfs2_clusters_to_blocks(sb, 1); 464 blocks += ocfs2_clusters_to_blocks(sb, 1);
399 465
400 return blocks; 466 return blocks + ocfs2_quota_trans_credits(sb);
401} 467}
402 468
403static inline int ocfs2_calc_group_alloc_credits(struct super_block *sb, 469static inline int ocfs2_calc_group_alloc_credits(struct super_block *sb,
@@ -434,6 +500,8 @@ static inline int ocfs2_calc_tree_trunc_credits(struct super_block *sb,
434 /* update to the truncate log. */ 500 /* update to the truncate log. */
435 credits += OCFS2_TRUNCATE_LOG_UPDATE; 501 credits += OCFS2_TRUNCATE_LOG_UPDATE;
436 502
503 credits += ocfs2_quota_trans_credits(sb);
504
437 return credits; 505 return credits;
438} 506}
439 507
diff --git a/fs/ocfs2/localalloc.c b/fs/ocfs2/localalloc.c
index 687b28713c32..ec70cdbe77fc 100644
--- a/fs/ocfs2/localalloc.c
+++ b/fs/ocfs2/localalloc.c
@@ -36,6 +36,7 @@
36#include "ocfs2.h" 36#include "ocfs2.h"
37 37
38#include "alloc.h" 38#include "alloc.h"
39#include "blockcheck.h"
39#include "dlmglue.h" 40#include "dlmglue.h"
40#include "inode.h" 41#include "inode.h"
41#include "journal.h" 42#include "journal.h"
@@ -248,8 +249,8 @@ int ocfs2_load_local_alloc(struct ocfs2_super *osb)
248 goto bail; 249 goto bail;
249 } 250 }
250 251
251 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, 252 status = ocfs2_read_inode_block_full(inode, &alloc_bh,
252 &alloc_bh, OCFS2_BH_IGNORE_CACHE); 253 OCFS2_BH_IGNORE_CACHE);
253 if (status < 0) { 254 if (status < 0) {
254 mlog_errno(status); 255 mlog_errno(status);
255 goto bail; 256 goto bail;
@@ -382,8 +383,8 @@ void ocfs2_shutdown_local_alloc(struct ocfs2_super *osb)
382 } 383 }
383 memcpy(alloc_copy, alloc, bh->b_size); 384 memcpy(alloc_copy, alloc, bh->b_size);
384 385
385 status = ocfs2_journal_access(handle, local_alloc_inode, bh, 386 status = ocfs2_journal_access_di(handle, local_alloc_inode, bh,
386 OCFS2_JOURNAL_ACCESS_WRITE); 387 OCFS2_JOURNAL_ACCESS_WRITE);
387 if (status < 0) { 388 if (status < 0) {
388 mlog_errno(status); 389 mlog_errno(status);
389 goto out_commit; 390 goto out_commit;
@@ -459,8 +460,8 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
459 460
460 mutex_lock(&inode->i_mutex); 461 mutex_lock(&inode->i_mutex);
461 462
462 status = ocfs2_read_blocks(inode, OCFS2_I(inode)->ip_blkno, 1, 463 status = ocfs2_read_inode_block_full(inode, &alloc_bh,
463 &alloc_bh, OCFS2_BH_IGNORE_CACHE); 464 OCFS2_BH_IGNORE_CACHE);
464 if (status < 0) { 465 if (status < 0) {
465 mlog_errno(status); 466 mlog_errno(status);
466 goto bail; 467 goto bail;
@@ -476,6 +477,7 @@ int ocfs2_begin_local_alloc_recovery(struct ocfs2_super *osb,
476 alloc = (struct ocfs2_dinode *) alloc_bh->b_data; 477 alloc = (struct ocfs2_dinode *) alloc_bh->b_data;
477 ocfs2_clear_local_alloc(alloc); 478 ocfs2_clear_local_alloc(alloc);
478 479
480 ocfs2_compute_meta_ecc(osb->sb, alloc_bh->b_data, &alloc->i_check);
479 status = ocfs2_write_block(osb, alloc_bh, inode); 481 status = ocfs2_write_block(osb, alloc_bh, inode);
480 if (status < 0) 482 if (status < 0)
481 mlog_errno(status); 483 mlog_errno(status);
@@ -762,9 +764,9 @@ int ocfs2_claim_local_alloc_bits(struct ocfs2_super *osb,
762 * delete bits from it! */ 764 * delete bits from it! */
763 *num_bits = bits_wanted; 765 *num_bits = bits_wanted;
764 766
765 status = ocfs2_journal_access(handle, local_alloc_inode, 767 status = ocfs2_journal_access_di(handle, local_alloc_inode,
766 osb->local_alloc_bh, 768 osb->local_alloc_bh,
767 OCFS2_JOURNAL_ACCESS_WRITE); 769 OCFS2_JOURNAL_ACCESS_WRITE);
768 if (status < 0) { 770 if (status < 0) {
769 mlog_errno(status); 771 mlog_errno(status);
770 goto bail; 772 goto bail;
@@ -1240,9 +1242,9 @@ static int ocfs2_local_alloc_slide_window(struct ocfs2_super *osb,
1240 } 1242 }
1241 memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size); 1243 memcpy(alloc_copy, alloc, osb->local_alloc_bh->b_size);
1242 1244
1243 status = ocfs2_journal_access(handle, local_alloc_inode, 1245 status = ocfs2_journal_access_di(handle, local_alloc_inode,
1244 osb->local_alloc_bh, 1246 osb->local_alloc_bh,
1245 OCFS2_JOURNAL_ACCESS_WRITE); 1247 OCFS2_JOURNAL_ACCESS_WRITE);
1246 if (status < 0) { 1248 if (status < 0) {
1247 mlog_errno(status); 1249 mlog_errno(status);
1248 goto bail; 1250 goto bail;
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index 2545e7402efe..084aba86c3b2 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -40,6 +40,7 @@
40#include <linux/types.h> 40#include <linux/types.h>
41#include <linux/slab.h> 41#include <linux/slab.h>
42#include <linux/highmem.h> 42#include <linux/highmem.h>
43#include <linux/quotaops.h>
43 44
44#define MLOG_MASK_PREFIX ML_NAMEI 45#define MLOG_MASK_PREFIX ML_NAMEI
45#include <cluster/masklog.h> 46#include <cluster/masklog.h>
@@ -61,17 +62,18 @@
61#include "sysfile.h" 62#include "sysfile.h"
62#include "uptodate.h" 63#include "uptodate.h"
63#include "xattr.h" 64#include "xattr.h"
65#include "acl.h"
64 66
65#include "buffer_head_io.h" 67#include "buffer_head_io.h"
66 68
67static int ocfs2_mknod_locked(struct ocfs2_super *osb, 69static int ocfs2_mknod_locked(struct ocfs2_super *osb,
68 struct inode *dir, 70 struct inode *dir,
69 struct dentry *dentry, int mode, 71 struct inode *inode,
72 struct dentry *dentry,
70 dev_t dev, 73 dev_t dev,
71 struct buffer_head **new_fe_bh, 74 struct buffer_head **new_fe_bh,
72 struct buffer_head *parent_fe_bh, 75 struct buffer_head *parent_fe_bh,
73 handle_t *handle, 76 handle_t *handle,
74 struct inode **ret_inode,
75 struct ocfs2_alloc_context *inode_ac); 77 struct ocfs2_alloc_context *inode_ac);
76 78
77static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb, 79static int ocfs2_prepare_orphan_dir(struct ocfs2_super *osb,
@@ -186,6 +188,35 @@ bail:
186 return ret; 188 return ret;
187} 189}
188 190
191static struct inode *ocfs2_get_init_inode(struct inode *dir, int mode)
192{
193 struct inode *inode;
194
195 inode = new_inode(dir->i_sb);
196 if (!inode) {
197 mlog(ML_ERROR, "new_inode failed!\n");
198 return NULL;
199 }
200
201 /* populate as many fields early on as possible - many of
202 * these are used by the support functions here and in
203 * callers. */
204 if (S_ISDIR(mode))
205 inode->i_nlink = 2;
206 else
207 inode->i_nlink = 1;
208 inode->i_uid = current_fsuid();
209 if (dir->i_mode & S_ISGID) {
210 inode->i_gid = dir->i_gid;
211 if (S_ISDIR(mode))
212 mode |= S_ISGID;
213 } else
214 inode->i_gid = current_fsgid();
215 inode->i_mode = mode;
216 vfs_dq_init(inode);
217 return inode;
218}
219
189static int ocfs2_mknod(struct inode *dir, 220static int ocfs2_mknod(struct inode *dir,
190 struct dentry *dentry, 221 struct dentry *dentry,
191 int mode, 222 int mode,
@@ -201,6 +232,13 @@ static int ocfs2_mknod(struct inode *dir,
201 struct inode *inode = NULL; 232 struct inode *inode = NULL;
202 struct ocfs2_alloc_context *inode_ac = NULL; 233 struct ocfs2_alloc_context *inode_ac = NULL;
203 struct ocfs2_alloc_context *data_ac = NULL; 234 struct ocfs2_alloc_context *data_ac = NULL;
235 struct ocfs2_alloc_context *xattr_ac = NULL;
236 int want_clusters = 0;
237 int xattr_credits = 0;
238 struct ocfs2_security_xattr_info si = {
239 .enable = 1,
240 };
241 int did_quota_inode = 0;
204 242
205 mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode, 243 mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode,
206 (unsigned long)dev, dentry->d_name.len, 244 (unsigned long)dev, dentry->d_name.len,
@@ -250,17 +288,46 @@ static int ocfs2_mknod(struct inode *dir,
250 goto leave; 288 goto leave;
251 } 289 }
252 290
253 /* Reserve a cluster if creating an extent based directory. */ 291 inode = ocfs2_get_init_inode(dir, mode);
254 if (S_ISDIR(mode) && !ocfs2_supports_inline_data(osb)) { 292 if (!inode) {
255 status = ocfs2_reserve_clusters(osb, 1, &data_ac); 293 status = -ENOMEM;
256 if (status < 0) { 294 mlog_errno(status);
257 if (status != -ENOSPC) 295 goto leave;
258 mlog_errno(status); 296 }
297
298 /* get security xattr */
299 status = ocfs2_init_security_get(inode, dir, &si);
300 if (status) {
301 if (status == -EOPNOTSUPP)
302 si.enable = 0;
303 else {
304 mlog_errno(status);
259 goto leave; 305 goto leave;
260 } 306 }
261 } 307 }
262 308
263 handle = ocfs2_start_trans(osb, OCFS2_MKNOD_CREDITS); 309 /* calculate meta data/clusters for setting security and acl xattr */
310 status = ocfs2_calc_xattr_init(dir, parent_fe_bh, mode,
311 &si, &want_clusters,
312 &xattr_credits, &xattr_ac);
313 if (status < 0) {
314 mlog_errno(status);
315 goto leave;
316 }
317
318 /* Reserve a cluster if creating an extent based directory. */
319 if (S_ISDIR(mode) && !ocfs2_supports_inline_data(osb))
320 want_clusters += 1;
321
322 status = ocfs2_reserve_clusters(osb, want_clusters, &data_ac);
323 if (status < 0) {
324 if (status != -ENOSPC)
325 mlog_errno(status);
326 goto leave;
327 }
328
329 handle = ocfs2_start_trans(osb, ocfs2_mknod_credits(osb->sb) +
330 xattr_credits);
264 if (IS_ERR(handle)) { 331 if (IS_ERR(handle)) {
265 status = PTR_ERR(handle); 332 status = PTR_ERR(handle);
266 handle = NULL; 333 handle = NULL;
@@ -268,10 +335,19 @@ static int ocfs2_mknod(struct inode *dir,
268 goto leave; 335 goto leave;
269 } 336 }
270 337
338 /* We don't use standard VFS wrapper because we don't want vfs_dq_init
339 * to be called. */
340 if (sb_any_quota_active(osb->sb) &&
341 osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
342 status = -EDQUOT;
343 goto leave;
344 }
345 did_quota_inode = 1;
346
271 /* do the real work now. */ 347 /* do the real work now. */
272 status = ocfs2_mknod_locked(osb, dir, dentry, mode, dev, 348 status = ocfs2_mknod_locked(osb, dir, inode, dentry, dev,
273 &new_fe_bh, parent_fe_bh, handle, 349 &new_fe_bh, parent_fe_bh, handle,
274 &inode, inode_ac); 350 inode_ac);
275 if (status < 0) { 351 if (status < 0) {
276 mlog_errno(status); 352 mlog_errno(status);
277 goto leave; 353 goto leave;
@@ -285,8 +361,8 @@ static int ocfs2_mknod(struct inode *dir,
285 goto leave; 361 goto leave;
286 } 362 }
287 363
288 status = ocfs2_journal_access(handle, dir, parent_fe_bh, 364 status = ocfs2_journal_access_di(handle, dir, parent_fe_bh,
289 OCFS2_JOURNAL_ACCESS_WRITE); 365 OCFS2_JOURNAL_ACCESS_WRITE);
290 if (status < 0) { 366 if (status < 0) {
291 mlog_errno(status); 367 mlog_errno(status);
292 goto leave; 368 goto leave;
@@ -300,6 +376,22 @@ static int ocfs2_mknod(struct inode *dir,
300 inc_nlink(dir); 376 inc_nlink(dir);
301 } 377 }
302 378
379 status = ocfs2_init_acl(handle, inode, dir, new_fe_bh, parent_fe_bh,
380 xattr_ac, data_ac);
381 if (status < 0) {
382 mlog_errno(status);
383 goto leave;
384 }
385
386 if (si.enable) {
387 status = ocfs2_init_security_set(handle, inode, new_fe_bh, &si,
388 xattr_ac, data_ac);
389 if (status < 0) {
390 mlog_errno(status);
391 goto leave;
392 }
393 }
394
303 status = ocfs2_add_entry(handle, dentry, inode, 395 status = ocfs2_add_entry(handle, dentry, inode,
304 OCFS2_I(inode)->ip_blkno, parent_fe_bh, 396 OCFS2_I(inode)->ip_blkno, parent_fe_bh,
305 de_bh); 397 de_bh);
@@ -320,6 +412,8 @@ static int ocfs2_mknod(struct inode *dir,
320 d_instantiate(dentry, inode); 412 d_instantiate(dentry, inode);
321 status = 0; 413 status = 0;
322leave: 414leave:
415 if (status < 0 && did_quota_inode)
416 vfs_dq_free_inode(inode);
323 if (handle) 417 if (handle)
324 ocfs2_commit_trans(osb, handle); 418 ocfs2_commit_trans(osb, handle);
325 419
@@ -331,9 +425,13 @@ leave:
331 brelse(new_fe_bh); 425 brelse(new_fe_bh);
332 brelse(de_bh); 426 brelse(de_bh);
333 brelse(parent_fe_bh); 427 brelse(parent_fe_bh);
428 kfree(si.name);
429 kfree(si.value);
334 430
335 if ((status < 0) && inode) 431 if ((status < 0) && inode) {
432 clear_nlink(inode);
336 iput(inode); 433 iput(inode);
434 }
337 435
338 if (inode_ac) 436 if (inode_ac)
339 ocfs2_free_alloc_context(inode_ac); 437 ocfs2_free_alloc_context(inode_ac);
@@ -341,6 +439,9 @@ leave:
341 if (data_ac) 439 if (data_ac)
342 ocfs2_free_alloc_context(data_ac); 440 ocfs2_free_alloc_context(data_ac);
343 441
442 if (xattr_ac)
443 ocfs2_free_alloc_context(xattr_ac);
444
344 mlog_exit(status); 445 mlog_exit(status);
345 446
346 return status; 447 return status;
@@ -348,12 +449,12 @@ leave:
348 449
349static int ocfs2_mknod_locked(struct ocfs2_super *osb, 450static int ocfs2_mknod_locked(struct ocfs2_super *osb,
350 struct inode *dir, 451 struct inode *dir,
351 struct dentry *dentry, int mode, 452 struct inode *inode,
453 struct dentry *dentry,
352 dev_t dev, 454 dev_t dev,
353 struct buffer_head **new_fe_bh, 455 struct buffer_head **new_fe_bh,
354 struct buffer_head *parent_fe_bh, 456 struct buffer_head *parent_fe_bh,
355 handle_t *handle, 457 handle_t *handle,
356 struct inode **ret_inode,
357 struct ocfs2_alloc_context *inode_ac) 458 struct ocfs2_alloc_context *inode_ac)
358{ 459{
359 int status = 0; 460 int status = 0;
@@ -361,14 +462,12 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
361 struct ocfs2_extent_list *fel; 462 struct ocfs2_extent_list *fel;
362 u64 fe_blkno = 0; 463 u64 fe_blkno = 0;
363 u16 suballoc_bit; 464 u16 suballoc_bit;
364 struct inode *inode = NULL;
365 465
366 mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry, mode, 466 mlog_entry("(0x%p, 0x%p, %d, %lu, '%.*s')\n", dir, dentry,
367 (unsigned long)dev, dentry->d_name.len, 467 inode->i_mode, (unsigned long)dev, dentry->d_name.len,
368 dentry->d_name.name); 468 dentry->d_name.name);
369 469
370 *new_fe_bh = NULL; 470 *new_fe_bh = NULL;
371 *ret_inode = NULL;
372 471
373 status = ocfs2_claim_new_inode(osb, handle, inode_ac, &suballoc_bit, 472 status = ocfs2_claim_new_inode(osb, handle, inode_ac, &suballoc_bit,
374 &fe_blkno); 473 &fe_blkno);
@@ -377,23 +476,11 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
377 goto leave; 476 goto leave;
378 } 477 }
379 478
380 inode = new_inode(dir->i_sb);
381 if (!inode) {
382 status = -ENOMEM;
383 mlog(ML_ERROR, "new_inode failed!\n");
384 goto leave;
385 }
386
387 /* populate as many fields early on as possible - many of 479 /* populate as many fields early on as possible - many of
388 * these are used by the support functions here and in 480 * these are used by the support functions here and in
389 * callers. */ 481 * callers. */
390 inode->i_ino = ino_from_blkno(osb->sb, fe_blkno); 482 inode->i_ino = ino_from_blkno(osb->sb, fe_blkno);
391 OCFS2_I(inode)->ip_blkno = fe_blkno; 483 OCFS2_I(inode)->ip_blkno = fe_blkno;
392 if (S_ISDIR(mode))
393 inode->i_nlink = 2;
394 else
395 inode->i_nlink = 1;
396 inode->i_mode = mode;
397 spin_lock(&osb->osb_lock); 484 spin_lock(&osb->osb_lock);
398 inode->i_generation = osb->s_next_generation++; 485 inode->i_generation = osb->s_next_generation++;
399 spin_unlock(&osb->osb_lock); 486 spin_unlock(&osb->osb_lock);
@@ -406,8 +493,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
406 } 493 }
407 ocfs2_set_new_buffer_uptodate(inode, *new_fe_bh); 494 ocfs2_set_new_buffer_uptodate(inode, *new_fe_bh);
408 495
409 status = ocfs2_journal_access(handle, inode, *new_fe_bh, 496 status = ocfs2_journal_access_di(handle, inode, *new_fe_bh,
410 OCFS2_JOURNAL_ACCESS_CREATE); 497 OCFS2_JOURNAL_ACCESS_CREATE);
411 if (status < 0) { 498 if (status < 0) {
412 mlog_errno(status); 499 mlog_errno(status);
413 goto leave; 500 goto leave;
@@ -421,17 +508,11 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
421 fe->i_blkno = cpu_to_le64(fe_blkno); 508 fe->i_blkno = cpu_to_le64(fe_blkno);
422 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit); 509 fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
423 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot); 510 fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
424 fe->i_uid = cpu_to_le32(current_fsuid()); 511 fe->i_uid = cpu_to_le32(inode->i_uid);
425 if (dir->i_mode & S_ISGID) { 512 fe->i_gid = cpu_to_le32(inode->i_gid);
426 fe->i_gid = cpu_to_le32(dir->i_gid); 513 fe->i_mode = cpu_to_le16(inode->i_mode);
427 if (S_ISDIR(mode)) 514 if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode))
428 mode |= S_ISGID;
429 } else
430 fe->i_gid = cpu_to_le32(current_fsgid());
431 fe->i_mode = cpu_to_le16(mode);
432 if (S_ISCHR(mode) || S_ISBLK(mode))
433 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev)); 515 fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
434
435 fe->i_links_count = cpu_to_le16(inode->i_nlink); 516 fe->i_links_count = cpu_to_le16(inode->i_nlink);
436 517
437 fe->i_last_eb_blk = 0; 518 fe->i_last_eb_blk = 0;
@@ -446,7 +527,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
446 /* 527 /*
447 * If supported, directories start with inline data. 528 * If supported, directories start with inline data.
448 */ 529 */
449 if (S_ISDIR(mode) && ocfs2_supports_inline_data(osb)) { 530 if (S_ISDIR(inode->i_mode) && ocfs2_supports_inline_data(osb)) {
450 u16 feat = le16_to_cpu(fe->i_dyn_features); 531 u16 feat = le16_to_cpu(fe->i_dyn_features);
451 532
452 fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL); 533 fe->i_dyn_features = cpu_to_le16(feat | OCFS2_INLINE_DATA_FL);
@@ -465,15 +546,7 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
465 goto leave; 546 goto leave;
466 } 547 }
467 548
468 if (ocfs2_populate_inode(inode, fe, 1) < 0) { 549 ocfs2_populate_inode(inode, fe, 1);
469 mlog(ML_ERROR, "populate inode failed! bh->b_blocknr=%llu, "
470 "i_blkno=%llu, i_ino=%lu\n",
471 (unsigned long long)(*new_fe_bh)->b_blocknr,
472 (unsigned long long)le64_to_cpu(fe->i_blkno),
473 inode->i_ino);
474 BUG();
475 }
476
477 ocfs2_inode_set_new(osb, inode); 550 ocfs2_inode_set_new(osb, inode);
478 if (!ocfs2_mount_local(osb)) { 551 if (!ocfs2_mount_local(osb)) {
479 status = ocfs2_create_new_inode_locks(inode); 552 status = ocfs2_create_new_inode_locks(inode);
@@ -484,17 +557,12 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
484 status = 0; /* error in ocfs2_create_new_inode_locks is not 557 status = 0; /* error in ocfs2_create_new_inode_locks is not
485 * critical */ 558 * critical */
486 559
487 *ret_inode = inode;
488leave: 560leave:
489 if (status < 0) { 561 if (status < 0) {
490 if (*new_fe_bh) { 562 if (*new_fe_bh) {
491 brelse(*new_fe_bh); 563 brelse(*new_fe_bh);
492 *new_fe_bh = NULL; 564 *new_fe_bh = NULL;
493 } 565 }
494 if (inode) {
495 clear_nlink(inode);
496 iput(inode);
497 }
498 } 566 }
499 567
500 mlog_exit(status); 568 mlog_exit(status);
@@ -588,7 +656,7 @@ static int ocfs2_link(struct dentry *old_dentry,
588 goto out_unlock_inode; 656 goto out_unlock_inode;
589 } 657 }
590 658
591 handle = ocfs2_start_trans(osb, OCFS2_LINK_CREDITS); 659 handle = ocfs2_start_trans(osb, ocfs2_link_credits(osb->sb));
592 if (IS_ERR(handle)) { 660 if (IS_ERR(handle)) {
593 err = PTR_ERR(handle); 661 err = PTR_ERR(handle);
594 handle = NULL; 662 handle = NULL;
@@ -596,8 +664,8 @@ static int ocfs2_link(struct dentry *old_dentry,
596 goto out_unlock_inode; 664 goto out_unlock_inode;
597 } 665 }
598 666
599 err = ocfs2_journal_access(handle, inode, fe_bh, 667 err = ocfs2_journal_access_di(handle, inode, fe_bh,
600 OCFS2_JOURNAL_ACCESS_WRITE); 668 OCFS2_JOURNAL_ACCESS_WRITE);
601 if (err < 0) { 669 if (err < 0) {
602 mlog_errno(err); 670 mlog_errno(err);
603 goto out_commit; 671 goto out_commit;
@@ -775,7 +843,7 @@ static int ocfs2_unlink(struct inode *dir,
775 } 843 }
776 } 844 }
777 845
778 handle = ocfs2_start_trans(osb, OCFS2_UNLINK_CREDITS); 846 handle = ocfs2_start_trans(osb, ocfs2_unlink_credits(osb->sb));
779 if (IS_ERR(handle)) { 847 if (IS_ERR(handle)) {
780 status = PTR_ERR(handle); 848 status = PTR_ERR(handle);
781 handle = NULL; 849 handle = NULL;
@@ -783,8 +851,8 @@ static int ocfs2_unlink(struct inode *dir,
783 goto leave; 851 goto leave;
784 } 852 }
785 853
786 status = ocfs2_journal_access(handle, inode, fe_bh, 854 status = ocfs2_journal_access_di(handle, inode, fe_bh,
787 OCFS2_JOURNAL_ACCESS_WRITE); 855 OCFS2_JOURNAL_ACCESS_WRITE);
788 if (status < 0) { 856 if (status < 0) {
789 mlog_errno(status); 857 mlog_errno(status);
790 goto leave; 858 goto leave;
@@ -1181,7 +1249,7 @@ static int ocfs2_rename(struct inode *old_dir,
1181 } 1249 }
1182 } 1250 }
1183 1251
1184 handle = ocfs2_start_trans(osb, OCFS2_RENAME_CREDITS); 1252 handle = ocfs2_start_trans(osb, ocfs2_rename_credits(osb->sb));
1185 if (IS_ERR(handle)) { 1253 if (IS_ERR(handle)) {
1186 status = PTR_ERR(handle); 1254 status = PTR_ERR(handle);
1187 handle = NULL; 1255 handle = NULL;
@@ -1197,8 +1265,8 @@ static int ocfs2_rename(struct inode *old_dir,
1197 goto bail; 1265 goto bail;
1198 } 1266 }
1199 } 1267 }
1200 status = ocfs2_journal_access(handle, new_inode, newfe_bh, 1268 status = ocfs2_journal_access_di(handle, new_inode, newfe_bh,
1201 OCFS2_JOURNAL_ACCESS_WRITE); 1269 OCFS2_JOURNAL_ACCESS_WRITE);
1202 if (status < 0) { 1270 if (status < 0) {
1203 mlog_errno(status); 1271 mlog_errno(status);
1204 goto bail; 1272 goto bail;
@@ -1244,8 +1312,8 @@ static int ocfs2_rename(struct inode *old_dir,
1244 old_inode->i_ctime = CURRENT_TIME; 1312 old_inode->i_ctime = CURRENT_TIME;
1245 mark_inode_dirty(old_inode); 1313 mark_inode_dirty(old_inode);
1246 1314
1247 status = ocfs2_journal_access(handle, old_inode, old_inode_bh, 1315 status = ocfs2_journal_access_di(handle, old_inode, old_inode_bh,
1248 OCFS2_JOURNAL_ACCESS_WRITE); 1316 OCFS2_JOURNAL_ACCESS_WRITE);
1249 if (status >= 0) { 1317 if (status >= 0) {
1250 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data; 1318 old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
1251 1319
@@ -1321,9 +1389,9 @@ static int ocfs2_rename(struct inode *old_dir,
1321 (int)old_dir_nlink, old_dir->i_nlink); 1389 (int)old_dir_nlink, old_dir->i_nlink);
1322 } else { 1390 } else {
1323 struct ocfs2_dinode *fe; 1391 struct ocfs2_dinode *fe;
1324 status = ocfs2_journal_access(handle, old_dir, 1392 status = ocfs2_journal_access_di(handle, old_dir,
1325 old_dir_bh, 1393 old_dir_bh,
1326 OCFS2_JOURNAL_ACCESS_WRITE); 1394 OCFS2_JOURNAL_ACCESS_WRITE);
1327 fe = (struct ocfs2_dinode *) old_dir_bh->b_data; 1395 fe = (struct ocfs2_dinode *) old_dir_bh->b_data;
1328 fe->i_links_count = cpu_to_le16(old_dir->i_nlink); 1396 fe->i_links_count = cpu_to_le16(old_dir->i_nlink);
1329 status = ocfs2_journal_dirty(handle, old_dir_bh); 1397 status = ocfs2_journal_dirty(handle, old_dir_bh);
@@ -1496,6 +1564,13 @@ static int ocfs2_symlink(struct inode *dir,
1496 handle_t *handle = NULL; 1564 handle_t *handle = NULL;
1497 struct ocfs2_alloc_context *inode_ac = NULL; 1565 struct ocfs2_alloc_context *inode_ac = NULL;
1498 struct ocfs2_alloc_context *data_ac = NULL; 1566 struct ocfs2_alloc_context *data_ac = NULL;
1567 struct ocfs2_alloc_context *xattr_ac = NULL;
1568 int want_clusters = 0;
1569 int xattr_credits = 0;
1570 struct ocfs2_security_xattr_info si = {
1571 .enable = 1,
1572 };
1573 int did_quota = 0, did_quota_inode = 0;
1499 1574
1500 mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir, 1575 mlog_entry("(0x%p, 0x%p, symname='%s' actual='%.*s')\n", dir,
1501 dentry, symname, dentry->d_name.len, dentry->d_name.name); 1576 dentry, symname, dentry->d_name.len, dentry->d_name.name);
@@ -1542,17 +1617,46 @@ static int ocfs2_symlink(struct inode *dir,
1542 goto bail; 1617 goto bail;
1543 } 1618 }
1544 1619
1545 /* don't reserve bitmap space for fast symlinks. */ 1620 inode = ocfs2_get_init_inode(dir, S_IFLNK | S_IRWXUGO);
1546 if (l > ocfs2_fast_symlink_chars(sb)) { 1621 if (!inode) {
1547 status = ocfs2_reserve_clusters(osb, 1, &data_ac); 1622 status = -ENOMEM;
1623 mlog_errno(status);
1624 goto bail;
1625 }
1626
1627 /* get security xattr */
1628 status = ocfs2_init_security_get(inode, dir, &si);
1629 if (status) {
1630 if (status == -EOPNOTSUPP)
1631 si.enable = 0;
1632 else {
1633 mlog_errno(status);
1634 goto bail;
1635 }
1636 }
1637
1638 /* calculate meta data/clusters for setting security xattr */
1639 if (si.enable) {
1640 status = ocfs2_calc_security_init(dir, &si, &want_clusters,
1641 &xattr_credits, &xattr_ac);
1548 if (status < 0) { 1642 if (status < 0) {
1549 if (status != -ENOSPC) 1643 mlog_errno(status);
1550 mlog_errno(status);
1551 goto bail; 1644 goto bail;
1552 } 1645 }
1553 } 1646 }
1554 1647
1555 handle = ocfs2_start_trans(osb, credits); 1648 /* don't reserve bitmap space for fast symlinks. */
1649 if (l > ocfs2_fast_symlink_chars(sb))
1650 want_clusters += 1;
1651
1652 status = ocfs2_reserve_clusters(osb, want_clusters, &data_ac);
1653 if (status < 0) {
1654 if (status != -ENOSPC)
1655 mlog_errno(status);
1656 goto bail;
1657 }
1658
1659 handle = ocfs2_start_trans(osb, credits + xattr_credits);
1556 if (IS_ERR(handle)) { 1660 if (IS_ERR(handle)) {
1557 status = PTR_ERR(handle); 1661 status = PTR_ERR(handle);
1558 handle = NULL; 1662 handle = NULL;
@@ -1560,10 +1664,18 @@ static int ocfs2_symlink(struct inode *dir,
1560 goto bail; 1664 goto bail;
1561 } 1665 }
1562 1666
1563 status = ocfs2_mknod_locked(osb, dir, dentry, 1667 /* We don't use standard VFS wrapper because we don't want vfs_dq_init
1564 S_IFLNK | S_IRWXUGO, 0, 1668 * to be called. */
1565 &new_fe_bh, parent_fe_bh, handle, 1669 if (sb_any_quota_active(osb->sb) &&
1566 &inode, inode_ac); 1670 osb->sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) {
1671 status = -EDQUOT;
1672 goto bail;
1673 }
1674 did_quota_inode = 1;
1675
1676 status = ocfs2_mknod_locked(osb, dir, inode, dentry,
1677 0, &new_fe_bh, parent_fe_bh, handle,
1678 inode_ac);
1567 if (status < 0) { 1679 if (status < 0) {
1568 mlog_errno(status); 1680 mlog_errno(status);
1569 goto bail; 1681 goto bail;
@@ -1576,6 +1688,12 @@ static int ocfs2_symlink(struct inode *dir,
1576 u32 offset = 0; 1688 u32 offset = 0;
1577 1689
1578 inode->i_op = &ocfs2_symlink_inode_operations; 1690 inode->i_op = &ocfs2_symlink_inode_operations;
1691 if (vfs_dq_alloc_space_nodirty(inode,
1692 ocfs2_clusters_to_bytes(osb->sb, 1))) {
1693 status = -EDQUOT;
1694 goto bail;
1695 }
1696 did_quota = 1;
1579 status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0, 1697 status = ocfs2_add_inode_data(osb, inode, &offset, 1, 0,
1580 new_fe_bh, 1698 new_fe_bh,
1581 handle, data_ac, NULL, 1699 handle, data_ac, NULL,
@@ -1614,6 +1732,15 @@ static int ocfs2_symlink(struct inode *dir,
1614 } 1732 }
1615 } 1733 }
1616 1734
1735 if (si.enable) {
1736 status = ocfs2_init_security_set(handle, inode, new_fe_bh, &si,
1737 xattr_ac, data_ac);
1738 if (status < 0) {
1739 mlog_errno(status);
1740 goto bail;
1741 }
1742 }
1743
1617 status = ocfs2_add_entry(handle, dentry, inode, 1744 status = ocfs2_add_entry(handle, dentry, inode,
1618 le64_to_cpu(fe->i_blkno), parent_fe_bh, 1745 le64_to_cpu(fe->i_blkno), parent_fe_bh,
1619 de_bh); 1746 de_bh);
@@ -1632,6 +1759,11 @@ static int ocfs2_symlink(struct inode *dir,
1632 dentry->d_op = &ocfs2_dentry_ops; 1759 dentry->d_op = &ocfs2_dentry_ops;
1633 d_instantiate(dentry, inode); 1760 d_instantiate(dentry, inode);
1634bail: 1761bail:
1762 if (status < 0 && did_quota)
1763 vfs_dq_free_space_nodirty(inode,
1764 ocfs2_clusters_to_bytes(osb->sb, 1));
1765 if (status < 0 && did_quota_inode)
1766 vfs_dq_free_inode(inode);
1635 if (handle) 1767 if (handle)
1636 ocfs2_commit_trans(osb, handle); 1768 ocfs2_commit_trans(osb, handle);
1637 1769
@@ -1640,12 +1772,18 @@ bail:
1640 brelse(new_fe_bh); 1772 brelse(new_fe_bh);
1641 brelse(parent_fe_bh); 1773 brelse(parent_fe_bh);
1642 brelse(de_bh); 1774 brelse(de_bh);
1775 kfree(si.name);
1776 kfree(si.value);
1643 if (inode_ac) 1777 if (inode_ac)
1644 ocfs2_free_alloc_context(inode_ac); 1778 ocfs2_free_alloc_context(inode_ac);
1645 if (data_ac) 1779 if (data_ac)
1646 ocfs2_free_alloc_context(data_ac); 1780 ocfs2_free_alloc_context(data_ac);
1647 if ((status < 0) && inode) 1781 if (xattr_ac)
1782 ocfs2_free_alloc_context(xattr_ac);
1783 if ((status < 0) && inode) {
1784 clear_nlink(inode);
1648 iput(inode); 1785 iput(inode);
1786 }
1649 1787
1650 mlog_exit(status); 1788 mlog_exit(status);
1651 1789
@@ -1754,16 +1892,14 @@ static int ocfs2_orphan_add(struct ocfs2_super *osb,
1754 1892
1755 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino); 1893 mlog_entry("(inode->i_ino = %lu)\n", inode->i_ino);
1756 1894
1757 status = ocfs2_read_block(orphan_dir_inode, 1895 status = ocfs2_read_inode_block(orphan_dir_inode, &orphan_dir_bh);
1758 OCFS2_I(orphan_dir_inode)->ip_blkno,
1759 &orphan_dir_bh);
1760 if (status < 0) { 1896 if (status < 0) {
1761 mlog_errno(status); 1897 mlog_errno(status);
1762 goto leave; 1898 goto leave;
1763 } 1899 }
1764 1900
1765 status = ocfs2_journal_access(handle, orphan_dir_inode, orphan_dir_bh, 1901 status = ocfs2_journal_access_di(handle, orphan_dir_inode, orphan_dir_bh,
1766 OCFS2_JOURNAL_ACCESS_WRITE); 1902 OCFS2_JOURNAL_ACCESS_WRITE);
1767 if (status < 0) { 1903 if (status < 0) {
1768 mlog_errno(status); 1904 mlog_errno(status);
1769 goto leave; 1905 goto leave;
@@ -1850,8 +1986,8 @@ int ocfs2_orphan_del(struct ocfs2_super *osb,
1850 goto leave; 1986 goto leave;
1851 } 1987 }
1852 1988
1853 status = ocfs2_journal_access(handle,orphan_dir_inode, orphan_dir_bh, 1989 status = ocfs2_journal_access_di(handle,orphan_dir_inode, orphan_dir_bh,
1854 OCFS2_JOURNAL_ACCESS_WRITE); 1990 OCFS2_JOURNAL_ACCESS_WRITE);
1855 if (status < 0) { 1991 if (status < 0) {
1856 mlog_errno(status); 1992 mlog_errno(status);
1857 goto leave; 1993 goto leave;
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h
index 3fed9e3d8992..ad5c24a29edd 100644
--- a/fs/ocfs2/ocfs2.h
+++ b/fs/ocfs2/ocfs2.h
@@ -161,6 +161,7 @@ enum ocfs2_vol_state
161{ 161{
162 VOLUME_INIT = 0, 162 VOLUME_INIT = 0,
163 VOLUME_MOUNTED, 163 VOLUME_MOUNTED,
164 VOLUME_MOUNTED_QUOTAS,
164 VOLUME_DISMOUNTED, 165 VOLUME_DISMOUNTED,
165 VOLUME_DISABLED 166 VOLUME_DISABLED
166}; 167};
@@ -195,6 +196,9 @@ enum ocfs2_mount_options
195 OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */ 196 OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */
196 OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */ 197 OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */
197 OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */ 198 OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */
199 OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* POSIX access control lists */
200 OCFS2_MOUNT_USRQUOTA = 1 << 9, /* We support user quotas */
201 OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */
198}; 202};
199 203
200#define OCFS2_OSB_SOFT_RO 0x0001 204#define OCFS2_OSB_SOFT_RO 0x0001
@@ -205,6 +209,7 @@ enum ocfs2_mount_options
205struct ocfs2_journal; 209struct ocfs2_journal;
206struct ocfs2_slot_info; 210struct ocfs2_slot_info;
207struct ocfs2_recovery_map; 211struct ocfs2_recovery_map;
212struct ocfs2_quota_recovery;
208struct ocfs2_super 213struct ocfs2_super
209{ 214{
210 struct task_struct *commit_task; 215 struct task_struct *commit_task;
@@ -286,10 +291,11 @@ struct ocfs2_super
286 char *local_alloc_debug_buf; 291 char *local_alloc_debug_buf;
287#endif 292#endif
288 293
289 /* Next two fields are for local node slot recovery during 294 /* Next three fields are for local node slot recovery during
290 * mount. */ 295 * mount. */
291 int dirty; 296 int dirty;
292 struct ocfs2_dinode *local_alloc_copy; 297 struct ocfs2_dinode *local_alloc_copy;
298 struct ocfs2_quota_recovery *quota_rec;
293 299
294 struct ocfs2_alloc_stats alloc_stats; 300 struct ocfs2_alloc_stats alloc_stats;
295 char dev_str[20]; /* "major,minor" of the device */ 301 char dev_str[20]; /* "major,minor" of the device */
@@ -333,6 +339,10 @@ struct ocfs2_super
333 339
334#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info) 340#define OCFS2_SB(sb) ((struct ocfs2_super *)(sb)->s_fs_info)
335 341
342/* Useful typedef for passing around journal access functions */
343typedef int (*ocfs2_journal_access_func)(handle_t *handle, struct inode *inode,
344 struct buffer_head *bh, int type);
345
336static inline int ocfs2_should_order_data(struct inode *inode) 346static inline int ocfs2_should_order_data(struct inode *inode)
337{ 347{
338 if (!S_ISREG(inode->i_mode)) 348 if (!S_ISREG(inode->i_mode))
@@ -376,6 +386,13 @@ static inline int ocfs2_supports_xattr(struct ocfs2_super *osb)
376 return 0; 386 return 0;
377} 387}
378 388
389static inline int ocfs2_meta_ecc(struct ocfs2_super *osb)
390{
391 if (osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_META_ECC)
392 return 1;
393 return 0;
394}
395
379/* set / clear functions because cluster events can make these happen 396/* set / clear functions because cluster events can make these happen
380 * in parallel so we want the transitions to be atomic. this also 397 * in parallel so we want the transitions to be atomic. this also
381 * means that any future flags osb_flags must be protected by spinlock 398 * means that any future flags osb_flags must be protected by spinlock
@@ -443,39 +460,19 @@ static inline int ocfs2_uses_extended_slot_map(struct ocfs2_super *osb)
443#define OCFS2_IS_VALID_DINODE(ptr) \ 460#define OCFS2_IS_VALID_DINODE(ptr) \
444 (!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE)) 461 (!strcmp((ptr)->i_signature, OCFS2_INODE_SIGNATURE))
445 462
446#define OCFS2_RO_ON_INVALID_DINODE(__sb, __di) do { \
447 typeof(__di) ____di = (__di); \
448 ocfs2_error((__sb), \
449 "Dinode # %llu has bad signature %.*s", \
450 (unsigned long long)le64_to_cpu((____di)->i_blkno), 7, \
451 (____di)->i_signature); \
452} while (0)
453
454#define OCFS2_IS_VALID_EXTENT_BLOCK(ptr) \ 463#define OCFS2_IS_VALID_EXTENT_BLOCK(ptr) \
455 (!strcmp((ptr)->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE)) 464 (!strcmp((ptr)->h_signature, OCFS2_EXTENT_BLOCK_SIGNATURE))
456 465
457#define OCFS2_RO_ON_INVALID_EXTENT_BLOCK(__sb, __eb) do { \
458 typeof(__eb) ____eb = (__eb); \
459 ocfs2_error((__sb), \
460 "Extent Block # %llu has bad signature %.*s", \
461 (unsigned long long)le64_to_cpu((____eb)->h_blkno), 7, \
462 (____eb)->h_signature); \
463} while (0)
464
465#define OCFS2_IS_VALID_GROUP_DESC(ptr) \ 466#define OCFS2_IS_VALID_GROUP_DESC(ptr) \
466 (!strcmp((ptr)->bg_signature, OCFS2_GROUP_DESC_SIGNATURE)) 467 (!strcmp((ptr)->bg_signature, OCFS2_GROUP_DESC_SIGNATURE))
467 468
468#define OCFS2_RO_ON_INVALID_GROUP_DESC(__sb, __gd) do { \
469 typeof(__gd) ____gd = (__gd); \
470 ocfs2_error((__sb), \
471 "Group Descriptor # %llu has bad signature %.*s", \
472 (unsigned long long)le64_to_cpu((____gd)->bg_blkno), 7, \
473 (____gd)->bg_signature); \
474} while (0)
475 469
476#define OCFS2_IS_VALID_XATTR_BLOCK(ptr) \ 470#define OCFS2_IS_VALID_XATTR_BLOCK(ptr) \
477 (!strcmp((ptr)->xb_signature, OCFS2_XATTR_BLOCK_SIGNATURE)) 471 (!strcmp((ptr)->xb_signature, OCFS2_XATTR_BLOCK_SIGNATURE))
478 472
473#define OCFS2_IS_VALID_DIR_TRAILER(ptr) \
474 (!strcmp((ptr)->db_signature, OCFS2_DIR_TRAILER_SIGNATURE))
475
479static inline unsigned long ino_from_blkno(struct super_block *sb, 476static inline unsigned long ino_from_blkno(struct super_block *sb,
480 u64 blkno) 477 u64 blkno)
481{ 478{
@@ -632,5 +629,6 @@ static inline s16 ocfs2_get_inode_steal_slot(struct ocfs2_super *osb)
632#define ocfs2_clear_bit ext2_clear_bit 629#define ocfs2_clear_bit ext2_clear_bit
633#define ocfs2_test_bit ext2_test_bit 630#define ocfs2_test_bit ext2_test_bit
634#define ocfs2_find_next_zero_bit ext2_find_next_zero_bit 631#define ocfs2_find_next_zero_bit ext2_find_next_zero_bit
632#define ocfs2_find_next_bit ext2_find_next_bit
635#endif /* OCFS2_H */ 633#endif /* OCFS2_H */
636 634
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h
index 5e0c0d0aef7d..c7ae45aaa36c 100644
--- a/fs/ocfs2/ocfs2_fs.h
+++ b/fs/ocfs2/ocfs2_fs.h
@@ -65,6 +65,7 @@
65#define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01" 65#define OCFS2_EXTENT_BLOCK_SIGNATURE "EXBLK01"
66#define OCFS2_GROUP_DESC_SIGNATURE "GROUP01" 66#define OCFS2_GROUP_DESC_SIGNATURE "GROUP01"
67#define OCFS2_XATTR_BLOCK_SIGNATURE "XATTR01" 67#define OCFS2_XATTR_BLOCK_SIGNATURE "XATTR01"
68#define OCFS2_DIR_TRAILER_SIGNATURE "DIRTRL1"
68 69
69/* Compatibility flags */ 70/* Compatibility flags */
70#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \ 71#define OCFS2_HAS_COMPAT_FEATURE(sb,mask) \
@@ -93,8 +94,11 @@
93 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \ 94 | OCFS2_FEATURE_INCOMPAT_INLINE_DATA \
94 | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \ 95 | OCFS2_FEATURE_INCOMPAT_EXTENDED_SLOT_MAP \
95 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \ 96 | OCFS2_FEATURE_INCOMPAT_USERSPACE_STACK \
96 | OCFS2_FEATURE_INCOMPAT_XATTR) 97 | OCFS2_FEATURE_INCOMPAT_XATTR \
97#define OCFS2_FEATURE_RO_COMPAT_SUPP OCFS2_FEATURE_RO_COMPAT_UNWRITTEN 98 | OCFS2_FEATURE_INCOMPAT_META_ECC)
99#define OCFS2_FEATURE_RO_COMPAT_SUPP (OCFS2_FEATURE_RO_COMPAT_UNWRITTEN \
100 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA \
101 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
98 102
99/* 103/*
100 * Heartbeat-only devices are missing journals and other files. The 104 * Heartbeat-only devices are missing journals and other files. The
@@ -147,6 +151,9 @@
147/* Support for extended attributes */ 151/* Support for extended attributes */
148#define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200 152#define OCFS2_FEATURE_INCOMPAT_XATTR 0x0200
149 153
154/* Metadata checksum and error correction */
155#define OCFS2_FEATURE_INCOMPAT_META_ECC 0x0800
156
150/* 157/*
151 * backup superblock flag is used to indicate that this volume 158 * backup superblock flag is used to indicate that this volume
152 * has backup superblocks. 159 * has backup superblocks.
@@ -163,6 +170,12 @@
163 */ 170 */
164#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN 0x0001 171#define OCFS2_FEATURE_RO_COMPAT_UNWRITTEN 0x0001
165 172
173/*
174 * Maintain quota information for this filesystem
175 */
176#define OCFS2_FEATURE_RO_COMPAT_USRQUOTA 0x0002
177#define OCFS2_FEATURE_RO_COMPAT_GRPQUOTA 0x0004
178
166/* The byte offset of the first backup block will be 1G. 179/* The byte offset of the first backup block will be 1G.
167 * The following will be 4G, 16G, 64G, 256G and 1T. 180 * The following will be 4G, 16G, 64G, 256G and 1T.
168 */ 181 */
@@ -192,6 +205,7 @@
192#define OCFS2_HEARTBEAT_FL (0x00000200) /* Heartbeat area */ 205#define OCFS2_HEARTBEAT_FL (0x00000200) /* Heartbeat area */
193#define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */ 206#define OCFS2_CHAIN_FL (0x00000400) /* Chain allocator */
194#define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */ 207#define OCFS2_DEALLOC_FL (0x00000800) /* Truncate log */
208#define OCFS2_QUOTA_FL (0x00001000) /* Quota file */
195 209
196/* 210/*
197 * Flags on ocfs2_dinode.i_dyn_features 211 * Flags on ocfs2_dinode.i_dyn_features
@@ -329,13 +343,17 @@ enum {
329#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE 343#define OCFS2_FIRST_ONLINE_SYSTEM_INODE SLOT_MAP_SYSTEM_INODE
330 HEARTBEAT_SYSTEM_INODE, 344 HEARTBEAT_SYSTEM_INODE,
331 GLOBAL_BITMAP_SYSTEM_INODE, 345 GLOBAL_BITMAP_SYSTEM_INODE,
332#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GLOBAL_BITMAP_SYSTEM_INODE 346 USER_QUOTA_SYSTEM_INODE,
347 GROUP_QUOTA_SYSTEM_INODE,
348#define OCFS2_LAST_GLOBAL_SYSTEM_INODE GROUP_QUOTA_SYSTEM_INODE
333 ORPHAN_DIR_SYSTEM_INODE, 349 ORPHAN_DIR_SYSTEM_INODE,
334 EXTENT_ALLOC_SYSTEM_INODE, 350 EXTENT_ALLOC_SYSTEM_INODE,
335 INODE_ALLOC_SYSTEM_INODE, 351 INODE_ALLOC_SYSTEM_INODE,
336 JOURNAL_SYSTEM_INODE, 352 JOURNAL_SYSTEM_INODE,
337 LOCAL_ALLOC_SYSTEM_INODE, 353 LOCAL_ALLOC_SYSTEM_INODE,
338 TRUNCATE_LOG_SYSTEM_INODE, 354 TRUNCATE_LOG_SYSTEM_INODE,
355 LOCAL_USER_QUOTA_SYSTEM_INODE,
356 LOCAL_GROUP_QUOTA_SYSTEM_INODE,
339 NUM_SYSTEM_INODES 357 NUM_SYSTEM_INODES
340}; 358};
341 359
@@ -349,6 +367,8 @@ static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
349 [SLOT_MAP_SYSTEM_INODE] = { "slot_map", 0, S_IFREG | 0644 }, 367 [SLOT_MAP_SYSTEM_INODE] = { "slot_map", 0, S_IFREG | 0644 },
350 [HEARTBEAT_SYSTEM_INODE] = { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 }, 368 [HEARTBEAT_SYSTEM_INODE] = { "heartbeat", OCFS2_HEARTBEAT_FL, S_IFREG | 0644 },
351 [GLOBAL_BITMAP_SYSTEM_INODE] = { "global_bitmap", 0, S_IFREG | 0644 }, 369 [GLOBAL_BITMAP_SYSTEM_INODE] = { "global_bitmap", 0, S_IFREG | 0644 },
370 [USER_QUOTA_SYSTEM_INODE] = { "aquota.user", OCFS2_QUOTA_FL, S_IFREG | 0644 },
371 [GROUP_QUOTA_SYSTEM_INODE] = { "aquota.group", OCFS2_QUOTA_FL, S_IFREG | 0644 },
352 372
353 /* Slot-specific system inodes (one copy per slot) */ 373 /* Slot-specific system inodes (one copy per slot) */
354 [ORPHAN_DIR_SYSTEM_INODE] = { "orphan_dir:%04d", 0, S_IFDIR | 0755 }, 374 [ORPHAN_DIR_SYSTEM_INODE] = { "orphan_dir:%04d", 0, S_IFDIR | 0755 },
@@ -356,7 +376,9 @@ static struct ocfs2_system_inode_info ocfs2_system_inodes[NUM_SYSTEM_INODES] = {
356 [INODE_ALLOC_SYSTEM_INODE] = { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 }, 376 [INODE_ALLOC_SYSTEM_INODE] = { "inode_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_CHAIN_FL, S_IFREG | 0644 },
357 [JOURNAL_SYSTEM_INODE] = { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 }, 377 [JOURNAL_SYSTEM_INODE] = { "journal:%04d", OCFS2_JOURNAL_FL, S_IFREG | 0644 },
358 [LOCAL_ALLOC_SYSTEM_INODE] = { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 }, 378 [LOCAL_ALLOC_SYSTEM_INODE] = { "local_alloc:%04d", OCFS2_BITMAP_FL | OCFS2_LOCAL_ALLOC_FL, S_IFREG | 0644 },
359 [TRUNCATE_LOG_SYSTEM_INODE] = { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 } 379 [TRUNCATE_LOG_SYSTEM_INODE] = { "truncate_log:%04d", OCFS2_DEALLOC_FL, S_IFREG | 0644 },
380 [LOCAL_USER_QUOTA_SYSTEM_INODE] = { "aquota.user:%04d", OCFS2_QUOTA_FL, S_IFREG | 0644 },
381 [LOCAL_GROUP_QUOTA_SYSTEM_INODE] = { "aquota.group:%04d", OCFS2_QUOTA_FL, S_IFREG | 0644 },
360}; 382};
361 383
362/* Parameter passed from mount.ocfs2 to module */ 384/* Parameter passed from mount.ocfs2 to module */
@@ -410,6 +432,22 @@ static unsigned char ocfs2_type_by_mode[S_IFMT >> S_SHIFT] = {
410#define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super)) 432#define OCFS2_RAW_SB(dinode) (&((dinode)->id2.i_super))
411 433
412/* 434/*
435 * Block checking structure. This is used in metadata to validate the
436 * contents. If OCFS2_FEATURE_INCOMPAT_META_ECC is not set, it is all
437 * zeros.
438 */
439struct ocfs2_block_check {
440/*00*/ __le32 bc_crc32e; /* 802.3 Ethernet II CRC32 */
441 __le16 bc_ecc; /* Single-error-correction parity vector.
442 This is a simple Hamming code dependant
443 on the blocksize. OCFS2's maximum
444 blocksize, 4K, requires 16 parity bits,
445 so we fit in __le16. */
446 __le16 bc_reserved1;
447/*08*/
448};
449
450/*
413 * On disk extent record for OCFS2 451 * On disk extent record for OCFS2
414 * It describes a range of clusters on disk. 452 * It describes a range of clusters on disk.
415 * 453 *
@@ -496,7 +534,7 @@ struct ocfs2_truncate_log {
496struct ocfs2_extent_block 534struct ocfs2_extent_block
497{ 535{
498/*00*/ __u8 h_signature[8]; /* Signature for verification */ 536/*00*/ __u8 h_signature[8]; /* Signature for verification */
499 __le64 h_reserved1; 537 struct ocfs2_block_check h_check; /* Error checking */
500/*10*/ __le16 h_suballoc_slot; /* Slot suballocator this 538/*10*/ __le16 h_suballoc_slot; /* Slot suballocator this
501 extent_header belongs to */ 539 extent_header belongs to */
502 __le16 h_suballoc_bit; /* Bit offset in suballocator 540 __le16 h_suballoc_bit; /* Bit offset in suballocator
@@ -666,7 +704,8 @@ struct ocfs2_dinode {
666 was set in i_flags */ 704 was set in i_flags */
667 __le16 i_dyn_features; 705 __le16 i_dyn_features;
668 __le64 i_xattr_loc; 706 __le64 i_xattr_loc;
669/*80*/ __le64 i_reserved2[7]; 707/*80*/ struct ocfs2_block_check i_check; /* Error checking */
708/*88*/ __le64 i_reserved2[6];
670/*B8*/ union { 709/*B8*/ union {
671 __le64 i_pad1; /* Generic way to refer to this 710 __le64 i_pad1; /* Generic way to refer to this
672 64bit union */ 711 64bit union */
@@ -715,6 +754,34 @@ struct ocfs2_dir_entry {
715} __attribute__ ((packed)); 754} __attribute__ ((packed));
716 755
717/* 756/*
757 * Per-block record for the unindexed directory btree. This is carefully
758 * crafted so that the rec_len and name_len records of an ocfs2_dir_entry are
759 * mirrored. That way, the directory manipulation code needs a minimal amount
760 * of update.
761 *
762 * NOTE: Keep this structure aligned to a multiple of 4 bytes.
763 */
764struct ocfs2_dir_block_trailer {
765/*00*/ __le64 db_compat_inode; /* Always zero. Was inode */
766
767 __le16 db_compat_rec_len; /* Backwards compatible with
768 * ocfs2_dir_entry. */
769 __u8 db_compat_name_len; /* Always zero. Was name_len */
770 __u8 db_reserved0;
771 __le16 db_reserved1;
772 __le16 db_free_rec_len; /* Size of largest empty hole
773 * in this block. (unused) */
774/*10*/ __u8 db_signature[8]; /* Signature for verification */
775 __le64 db_reserved2;
776 __le64 db_free_next; /* Next block in list (unused) */
777/*20*/ __le64 db_blkno; /* Offset on disk, in blocks */
778 __le64 db_parent_dinode; /* dinode which owns me, in
779 blocks */
780/*30*/ struct ocfs2_block_check db_check; /* Error checking */
781/*40*/
782};
783
784/*
718 * On disk allocator group structure for OCFS2 785 * On disk allocator group structure for OCFS2
719 */ 786 */
720struct ocfs2_group_desc 787struct ocfs2_group_desc
@@ -733,7 +800,8 @@ struct ocfs2_group_desc
733/*20*/ __le64 bg_parent_dinode; /* dinode which owns me, in 800/*20*/ __le64 bg_parent_dinode; /* dinode which owns me, in
734 blocks */ 801 blocks */
735 __le64 bg_blkno; /* Offset on disk, in blocks */ 802 __le64 bg_blkno; /* Offset on disk, in blocks */
736/*30*/ __le64 bg_reserved2[2]; 803/*30*/ struct ocfs2_block_check bg_check; /* Error checking */
804 __le64 bg_reserved2;
737/*40*/ __u8 bg_bitmap[0]; 805/*40*/ __u8 bg_bitmap[0];
738}; 806};
739 807
@@ -776,7 +844,12 @@ struct ocfs2_xattr_header {
776 in this extent record, 844 in this extent record,
777 only valid in the first 845 only valid in the first
778 bucket. */ 846 bucket. */
779 __le64 xh_csum; 847 struct ocfs2_block_check xh_check; /* Error checking
848 (Note, this is only
849 used for xattr
850 buckets. A block uses
851 xb_check and sets
852 this field to zero.) */
780 struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */ 853 struct ocfs2_xattr_entry xh_entries[0]; /* xattr entry list. */
781}; 854};
782 855
@@ -827,7 +900,7 @@ struct ocfs2_xattr_block {
827 block group */ 900 block group */
828 __le32 xb_fs_generation; /* Must match super block */ 901 __le32 xb_fs_generation; /* Must match super block */
829/*10*/ __le64 xb_blkno; /* Offset on disk, in blocks */ 902/*10*/ __le64 xb_blkno; /* Offset on disk, in blocks */
830 __le64 xb_csum; 903 struct ocfs2_block_check xb_check; /* Error checking */
831/*20*/ __le16 xb_flags; /* Indicates whether this block contains 904/*20*/ __le16 xb_flags; /* Indicates whether this block contains
832 real xattr or a xattr tree. */ 905 real xattr or a xattr tree. */
833 __le16 xb_reserved0; 906 __le16 xb_reserved0;
@@ -868,6 +941,128 @@ static inline int ocfs2_xattr_get_type(struct ocfs2_xattr_entry *xe)
868 return xe->xe_type & OCFS2_XATTR_TYPE_MASK; 941 return xe->xe_type & OCFS2_XATTR_TYPE_MASK;
869} 942}
870 943
944/*
945 * On disk structures for global quota file
946 */
947
948/* Magic numbers and known versions for global quota files */
949#define OCFS2_GLOBAL_QMAGICS {\
950 0x0cf52470, /* USRQUOTA */ \
951 0x0cf52471 /* GRPQUOTA */ \
952}
953
954#define OCFS2_GLOBAL_QVERSIONS {\
955 0, \
956 0, \
957}
958
959
960/* Each block of each quota file has a certain fixed number of bytes reserved
961 * for OCFS2 internal use at its end. OCFS2 can use it for things like
962 * checksums, etc. */
963#define OCFS2_QBLK_RESERVED_SPACE 8
964
965/* Generic header of all quota files */
966struct ocfs2_disk_dqheader {
967 __le32 dqh_magic; /* Magic number identifying file */
968 __le32 dqh_version; /* Quota format version */
969};
970
971#define OCFS2_GLOBAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
972
973/* Information header of global quota file (immediately follows the generic
974 * header) */
975struct ocfs2_global_disk_dqinfo {
976/*00*/ __le32 dqi_bgrace; /* Grace time for space softlimit excess */
977 __le32 dqi_igrace; /* Grace time for inode softlimit excess */
978 __le32 dqi_syncms; /* Time after which we sync local changes to
979 * global quota file */
980 __le32 dqi_blocks; /* Number of blocks in quota file */
981/*10*/ __le32 dqi_free_blk; /* First free block in quota file */
982 __le32 dqi_free_entry; /* First block with free dquot entry in quota
983 * file */
984};
985
986/* Structure with global user / group information. We reserve some space
987 * for future use. */
988struct ocfs2_global_disk_dqblk {
989/*00*/ __le32 dqb_id; /* ID the structure belongs to */
990 __le32 dqb_use_count; /* Number of nodes having reference to this structure */
991 __le64 dqb_ihardlimit; /* absolute limit on allocated inodes */
992/*10*/ __le64 dqb_isoftlimit; /* preferred inode limit */
993 __le64 dqb_curinodes; /* current # allocated inodes */
994/*20*/ __le64 dqb_bhardlimit; /* absolute limit on disk space */
995 __le64 dqb_bsoftlimit; /* preferred limit on disk space */
996/*30*/ __le64 dqb_curspace; /* current space occupied */
997 __le64 dqb_btime; /* time limit for excessive disk use */
998/*40*/ __le64 dqb_itime; /* time limit for excessive inode use */
999 __le64 dqb_pad1;
1000/*50*/ __le64 dqb_pad2;
1001};
1002
1003/*
1004 * On-disk structures for local quota file
1005 */
1006
1007/* Magic numbers and known versions for local quota files */
1008#define OCFS2_LOCAL_QMAGICS {\
1009 0x0cf524c0, /* USRQUOTA */ \
1010 0x0cf524c1 /* GRPQUOTA */ \
1011}
1012
1013#define OCFS2_LOCAL_QVERSIONS {\
1014 0, \
1015 0, \
1016}
1017
1018/* Quota flags in dqinfo header */
1019#define OLQF_CLEAN 0x0001 /* Quota file is empty (this should be after\
1020 * quota has been cleanly turned off) */
1021
1022#define OCFS2_LOCAL_INFO_OFF (sizeof(struct ocfs2_disk_dqheader))
1023
1024/* Information header of local quota file (immediately follows the generic
1025 * header) */
1026struct ocfs2_local_disk_dqinfo {
1027 __le32 dqi_flags; /* Flags for quota file */
1028 __le32 dqi_chunks; /* Number of chunks of quota structures
1029 * with a bitmap */
1030 __le32 dqi_blocks; /* Number of blocks allocated for quota file */
1031};
1032
1033/* Header of one chunk of a quota file */
1034struct ocfs2_local_disk_chunk {
1035 __le32 dqc_free; /* Number of free entries in the bitmap */
1036 u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding
1037 * chunk of quota file */
1038};
1039
1040/* One entry in local quota file */
1041struct ocfs2_local_disk_dqblk {
1042/*00*/ __le64 dqb_id; /* id this quota applies to */
1043 __le64 dqb_spacemod; /* Change in the amount of used space */
1044/*10*/ __le64 dqb_inodemod; /* Change in the amount of used inodes */
1045};
1046
1047
1048/*
1049 * The quota trailer lives at the end of each quota block.
1050 */
1051
1052struct ocfs2_disk_dqtrailer {
1053/*00*/ struct ocfs2_block_check dq_check; /* Error checking */
1054/*08*/ /* Cannot be larger than OCFS2_QBLK_RESERVED_SPACE */
1055};
1056
1057static inline struct ocfs2_disk_dqtrailer *ocfs2_block_dqtrailer(int blocksize,
1058 void *buf)
1059{
1060 char *ptr = buf;
1061 ptr += blocksize - OCFS2_QBLK_RESERVED_SPACE;
1062
1063 return (struct ocfs2_disk_dqtrailer *)ptr;
1064}
1065
871#ifdef __KERNEL__ 1066#ifdef __KERNEL__
872static inline int ocfs2_fast_symlink_chars(struct super_block *sb) 1067static inline int ocfs2_fast_symlink_chars(struct super_block *sb)
873{ 1068{
diff --git a/fs/ocfs2/ocfs2_jbd_compat.h b/fs/ocfs2/ocfs2_jbd_compat.h
deleted file mode 100644
index b91c78f8f558..000000000000
--- a/fs/ocfs2/ocfs2_jbd_compat.h
+++ /dev/null
@@ -1,82 +0,0 @@
1/* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
3 *
4 * ocfs2_jbd_compat.h
5 *
6 * Compatibility defines for JBD.
7 *
8 * Copyright (C) 2008 Oracle. All rights reserved.
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License version 2 as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#ifndef OCFS2_JBD_COMPAT_H
21#define OCFS2_JBD_COMPAT_H
22
23#ifndef CONFIG_OCFS2_COMPAT_JBD
24# error Should not have been included
25#endif
26
27struct jbd2_inode {
28 unsigned int dummy;
29};
30
31#define JBD2_BARRIER JFS_BARRIER
32#define JBD2_DEFAULT_MAX_COMMIT_AGE JBD_DEFAULT_MAX_COMMIT_AGE
33
34#define jbd2_journal_ack_err journal_ack_err
35#define jbd2_journal_clear_err journal_clear_err
36#define jbd2_journal_destroy journal_destroy
37#define jbd2_journal_dirty_metadata journal_dirty_metadata
38#define jbd2_journal_errno journal_errno
39#define jbd2_journal_extend journal_extend
40#define jbd2_journal_flush journal_flush
41#define jbd2_journal_force_commit journal_force_commit
42#define jbd2_journal_get_write_access journal_get_write_access
43#define jbd2_journal_get_undo_access journal_get_undo_access
44#define jbd2_journal_init_inode journal_init_inode
45#define jbd2_journal_invalidatepage journal_invalidatepage
46#define jbd2_journal_load journal_load
47#define jbd2_journal_lock_updates journal_lock_updates
48#define jbd2_journal_restart journal_restart
49#define jbd2_journal_start journal_start
50#define jbd2_journal_start_commit journal_start_commit
51#define jbd2_journal_stop journal_stop
52#define jbd2_journal_try_to_free_buffers journal_try_to_free_buffers
53#define jbd2_journal_unlock_updates journal_unlock_updates
54#define jbd2_journal_wipe journal_wipe
55#define jbd2_log_wait_commit log_wait_commit
56
57static inline int jbd2_journal_file_inode(handle_t *handle,
58 struct jbd2_inode *inode)
59{
60 return 0;
61}
62
63static inline int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
64 loff_t new_size)
65{
66 return 0;
67}
68
69static inline void jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode,
70 struct inode *inode)
71{
72 return;
73}
74
75static inline void jbd2_journal_release_jbd_inode(journal_t *journal,
76 struct jbd2_inode *jinode)
77{
78 return;
79}
80
81
82#endif /* OCFS2_JBD_COMPAT_H */
diff --git a/fs/ocfs2/ocfs2_lockid.h b/fs/ocfs2/ocfs2_lockid.h
index 82c200f7a8f1..eb6f50c9ceca 100644
--- a/fs/ocfs2/ocfs2_lockid.h
+++ b/fs/ocfs2/ocfs2_lockid.h
@@ -46,6 +46,7 @@ enum ocfs2_lock_type {
46 OCFS2_LOCK_TYPE_DENTRY, 46 OCFS2_LOCK_TYPE_DENTRY,
47 OCFS2_LOCK_TYPE_OPEN, 47 OCFS2_LOCK_TYPE_OPEN,
48 OCFS2_LOCK_TYPE_FLOCK, 48 OCFS2_LOCK_TYPE_FLOCK,
49 OCFS2_LOCK_TYPE_QINFO,
49 OCFS2_NUM_LOCK_TYPES 50 OCFS2_NUM_LOCK_TYPES
50}; 51};
51 52
@@ -77,6 +78,9 @@ static inline char ocfs2_lock_type_char(enum ocfs2_lock_type type)
77 case OCFS2_LOCK_TYPE_FLOCK: 78 case OCFS2_LOCK_TYPE_FLOCK:
78 c = 'F'; 79 c = 'F';
79 break; 80 break;
81 case OCFS2_LOCK_TYPE_QINFO:
82 c = 'Q';
83 break;
80 default: 84 default:
81 c = '\0'; 85 c = '\0';
82 } 86 }
@@ -95,6 +99,7 @@ static char *ocfs2_lock_type_strings[] = {
95 [OCFS2_LOCK_TYPE_DENTRY] = "Dentry", 99 [OCFS2_LOCK_TYPE_DENTRY] = "Dentry",
96 [OCFS2_LOCK_TYPE_OPEN] = "Open", 100 [OCFS2_LOCK_TYPE_OPEN] = "Open",
97 [OCFS2_LOCK_TYPE_FLOCK] = "Flock", 101 [OCFS2_LOCK_TYPE_FLOCK] = "Flock",
102 [OCFS2_LOCK_TYPE_QINFO] = "Quota",
98}; 103};
99 104
100static inline const char *ocfs2_lock_type_string(enum ocfs2_lock_type type) 105static inline const char *ocfs2_lock_type_string(enum ocfs2_lock_type type)
diff --git a/fs/ocfs2/quota.h b/fs/ocfs2/quota.h
new file mode 100644
index 000000000000..7365e2e08706
--- /dev/null
+++ b/fs/ocfs2/quota.h
@@ -0,0 +1,119 @@
1/*
2 * quota.h for OCFS2
3 *
4 * On disk quota structures for local and global quota file, in-memory
5 * structures.
6 *
7 */
8
9#ifndef _OCFS2_QUOTA_H
10#define _OCFS2_QUOTA_H
11
12#include <linux/types.h>
13#include <linux/slab.h>
14#include <linux/quota.h>
15#include <linux/list.h>
16#include <linux/dqblk_qtree.h>
17
18#include "ocfs2.h"
19
20/* Common stuff */
21/* id number of quota format */
22#define QFMT_OCFS2 3
23
24/*
25 * In-memory structures
26 */
27struct ocfs2_dquot {
28 struct dquot dq_dquot; /* Generic VFS dquot */
29 loff_t dq_local_off; /* Offset in the local quota file */
30 struct ocfs2_quota_chunk *dq_chunk; /* Chunk dquot is in */
31 unsigned int dq_use_count; /* Number of nodes having reference to this entry in global quota file */
32 s64 dq_origspace; /* Last globally synced space usage */
33 s64 dq_originodes; /* Last globally synced inode usage */
34};
35
36/* Description of one chunk to recover in memory */
37struct ocfs2_recovery_chunk {
38 struct list_head rc_list; /* List of chunks */
39 int rc_chunk; /* Chunk number */
40 unsigned long *rc_bitmap; /* Bitmap of entries to recover */
41};
42
43struct ocfs2_quota_recovery {
44 struct list_head r_list[MAXQUOTAS]; /* List of chunks to recover */
45};
46
47/* In-memory structure with quota header information */
48struct ocfs2_mem_dqinfo {
49 unsigned int dqi_type; /* Quota type this structure describes */
50 unsigned int dqi_chunks; /* Number of chunks in local quota file */
51 unsigned int dqi_blocks; /* Number of blocks allocated for local quota file */
52 unsigned int dqi_syncms; /* How often should we sync with other nodes */
53 unsigned int dqi_syncjiff; /* Precomputed dqi_syncms in jiffies */
54 struct list_head dqi_chunk; /* List of chunks */
55 struct inode *dqi_gqinode; /* Global quota file inode */
56 struct ocfs2_lock_res dqi_gqlock; /* Lock protecting quota information structure */
57 struct buffer_head *dqi_gqi_bh; /* Buffer head with global quota file inode - set only if inode lock is obtained */
58 int dqi_gqi_count; /* Number of holders of dqi_gqi_bh */
59 struct buffer_head *dqi_lqi_bh; /* Buffer head with local quota file inode */
60 struct buffer_head *dqi_ibh; /* Buffer with information header */
61 struct qtree_mem_dqinfo dqi_gi; /* Info about global file */
62 struct delayed_work dqi_sync_work; /* Work for syncing dquots */
63 struct ocfs2_quota_recovery *dqi_rec; /* Pointer to recovery
64 * information, in case we
65 * enable quotas on file
66 * needing it */
67};
68
69static inline struct ocfs2_dquot *OCFS2_DQUOT(struct dquot *dquot)
70{
71 return container_of(dquot, struct ocfs2_dquot, dq_dquot);
72}
73
74struct ocfs2_quota_chunk {
75 struct list_head qc_chunk; /* List of quotafile chunks */
76 int qc_num; /* Number of quota chunk */
77 struct buffer_head *qc_headerbh; /* Buffer head with chunk header */
78};
79
80extern struct kmem_cache *ocfs2_dquot_cachep;
81extern struct kmem_cache *ocfs2_qf_chunk_cachep;
82
83extern struct qtree_fmt_operations ocfs2_global_ops;
84
85struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
86 struct ocfs2_super *osb, int slot_num);
87int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
88 struct ocfs2_quota_recovery *rec,
89 int slot_num);
90void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec);
91ssize_t ocfs2_quota_read(struct super_block *sb, int type, char *data,
92 size_t len, loff_t off);
93ssize_t ocfs2_quota_write(struct super_block *sb, int type,
94 const char *data, size_t len, loff_t off);
95int ocfs2_global_read_info(struct super_block *sb, int type);
96int ocfs2_global_write_info(struct super_block *sb, int type);
97int ocfs2_global_read_dquot(struct dquot *dquot);
98int __ocfs2_sync_dquot(struct dquot *dquot, int freeing);
99static inline int ocfs2_sync_dquot(struct dquot *dquot)
100{
101 return __ocfs2_sync_dquot(dquot, 0);
102}
103static inline int ocfs2_global_release_dquot(struct dquot *dquot)
104{
105 return __ocfs2_sync_dquot(dquot, 1);
106}
107
108int ocfs2_lock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex);
109void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex);
110int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
111 struct buffer_head **bh);
112
113extern struct dquot_operations ocfs2_quota_operations;
114extern struct quota_format_type ocfs2_quota_format;
115
116int ocfs2_quota_setup(void);
117void ocfs2_quota_shutdown(void);
118
119#endif /* _OCFS2_QUOTA_H */
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c
new file mode 100644
index 000000000000..6aff8f2d3e49
--- /dev/null
+++ b/fs/ocfs2/quota_global.c
@@ -0,0 +1,1025 @@
1/*
2 * Implementation of operations over global quota file
3 */
4#include <linux/spinlock.h>
5#include <linux/fs.h>
6#include <linux/quota.h>
7#include <linux/quotaops.h>
8#include <linux/dqblk_qtree.h>
9#include <linux/jiffies.h>
10#include <linux/writeback.h>
11#include <linux/workqueue.h>
12
13#define MLOG_MASK_PREFIX ML_QUOTA
14#include <cluster/masklog.h>
15
16#include "ocfs2_fs.h"
17#include "ocfs2.h"
18#include "alloc.h"
19#include "blockcheck.h"
20#include "inode.h"
21#include "journal.h"
22#include "file.h"
23#include "sysfile.h"
24#include "dlmglue.h"
25#include "uptodate.h"
26#include "quota.h"
27
28static struct workqueue_struct *ocfs2_quota_wq = NULL;
29
30static void qsync_work_fn(struct work_struct *work);
31
32static void ocfs2_global_disk2memdqb(struct dquot *dquot, void *dp)
33{
34 struct ocfs2_global_disk_dqblk *d = dp;
35 struct mem_dqblk *m = &dquot->dq_dqb;
36
37 /* Update from disk only entries not set by the admin */
38 if (!test_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags)) {
39 m->dqb_ihardlimit = le64_to_cpu(d->dqb_ihardlimit);
40 m->dqb_isoftlimit = le64_to_cpu(d->dqb_isoftlimit);
41 }
42 if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags))
43 m->dqb_curinodes = le64_to_cpu(d->dqb_curinodes);
44 if (!test_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags)) {
45 m->dqb_bhardlimit = le64_to_cpu(d->dqb_bhardlimit);
46 m->dqb_bsoftlimit = le64_to_cpu(d->dqb_bsoftlimit);
47 }
48 if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags))
49 m->dqb_curspace = le64_to_cpu(d->dqb_curspace);
50 if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags))
51 m->dqb_btime = le64_to_cpu(d->dqb_btime);
52 if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags))
53 m->dqb_itime = le64_to_cpu(d->dqb_itime);
54 OCFS2_DQUOT(dquot)->dq_use_count = le32_to_cpu(d->dqb_use_count);
55}
56
57static void ocfs2_global_mem2diskdqb(void *dp, struct dquot *dquot)
58{
59 struct ocfs2_global_disk_dqblk *d = dp;
60 struct mem_dqblk *m = &dquot->dq_dqb;
61
62 d->dqb_id = cpu_to_le32(dquot->dq_id);
63 d->dqb_use_count = cpu_to_le32(OCFS2_DQUOT(dquot)->dq_use_count);
64 d->dqb_ihardlimit = cpu_to_le64(m->dqb_ihardlimit);
65 d->dqb_isoftlimit = cpu_to_le64(m->dqb_isoftlimit);
66 d->dqb_curinodes = cpu_to_le64(m->dqb_curinodes);
67 d->dqb_bhardlimit = cpu_to_le64(m->dqb_bhardlimit);
68 d->dqb_bsoftlimit = cpu_to_le64(m->dqb_bsoftlimit);
69 d->dqb_curspace = cpu_to_le64(m->dqb_curspace);
70 d->dqb_btime = cpu_to_le64(m->dqb_btime);
71 d->dqb_itime = cpu_to_le64(m->dqb_itime);
72}
73
74static int ocfs2_global_is_id(void *dp, struct dquot *dquot)
75{
76 struct ocfs2_global_disk_dqblk *d = dp;
77 struct ocfs2_mem_dqinfo *oinfo =
78 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
79
80 if (qtree_entry_unused(&oinfo->dqi_gi, dp))
81 return 0;
82 return le32_to_cpu(d->dqb_id) == dquot->dq_id;
83}
84
85struct qtree_fmt_operations ocfs2_global_ops = {
86 .mem2disk_dqblk = ocfs2_global_mem2diskdqb,
87 .disk2mem_dqblk = ocfs2_global_disk2memdqb,
88 .is_id = ocfs2_global_is_id,
89};
90
91static int ocfs2_validate_quota_block(struct super_block *sb,
92 struct buffer_head *bh)
93{
94 struct ocfs2_disk_dqtrailer *dqt =
95 ocfs2_block_dqtrailer(sb->s_blocksize, bh->b_data);
96
97 mlog(0, "Validating quota block %llu\n",
98 (unsigned long long)bh->b_blocknr);
99
100 BUG_ON(!buffer_uptodate(bh));
101
102 /*
103 * If the ecc fails, we return the error but otherwise
104 * leave the filesystem running. We know any error is
105 * local to this block.
106 */
107 return ocfs2_validate_meta_ecc(sb, bh->b_data, &dqt->dq_check);
108}
109
110int ocfs2_read_quota_block(struct inode *inode, u64 v_block,
111 struct buffer_head **bh)
112{
113 int rc = 0;
114 struct buffer_head *tmp = *bh;
115
116 rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, 0,
117 ocfs2_validate_quota_block);
118 if (rc)
119 mlog_errno(rc);
120
121 /* If ocfs2_read_virt_blocks() got us a new bh, pass it up. */
122 if (!rc && !*bh)
123 *bh = tmp;
124
125 return rc;
126}
127
128static int ocfs2_get_quota_block(struct inode *inode, int block,
129 struct buffer_head **bh)
130{
131 u64 pblock, pcount;
132 int err;
133
134 down_read(&OCFS2_I(inode)->ip_alloc_sem);
135 err = ocfs2_extent_map_get_blocks(inode, block, &pblock, &pcount, NULL);
136 up_read(&OCFS2_I(inode)->ip_alloc_sem);
137 if (err) {
138 mlog_errno(err);
139 return err;
140 }
141 *bh = sb_getblk(inode->i_sb, pblock);
142 if (!*bh) {
143 err = -EIO;
144 mlog_errno(err);
145 }
146 return err;;
147}
148
149/* Read data from global quotafile - avoid pagecache and such because we cannot
150 * afford acquiring the locks... We use quota cluster lock to serialize
151 * operations. Caller is responsible for acquiring it. */
152ssize_t ocfs2_quota_read(struct super_block *sb, int type, char *data,
153 size_t len, loff_t off)
154{
155 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
156 struct inode *gqinode = oinfo->dqi_gqinode;
157 loff_t i_size = i_size_read(gqinode);
158 int offset = off & (sb->s_blocksize - 1);
159 sector_t blk = off >> sb->s_blocksize_bits;
160 int err = 0;
161 struct buffer_head *bh;
162 size_t toread, tocopy;
163
164 if (off > i_size)
165 return 0;
166 if (off + len > i_size)
167 len = i_size - off;
168 toread = len;
169 while (toread > 0) {
170 tocopy = min_t(size_t, (sb->s_blocksize - offset), toread);
171 bh = NULL;
172 err = ocfs2_read_quota_block(gqinode, blk, &bh);
173 if (err) {
174 mlog_errno(err);
175 return err;
176 }
177 memcpy(data, bh->b_data + offset, tocopy);
178 brelse(bh);
179 offset = 0;
180 toread -= tocopy;
181 data += tocopy;
182 blk++;
183 }
184 return len;
185}
186
187/* Write to quotafile (we know the transaction is already started and has
188 * enough credits) */
189ssize_t ocfs2_quota_write(struct super_block *sb, int type,
190 const char *data, size_t len, loff_t off)
191{
192 struct mem_dqinfo *info = sb_dqinfo(sb, type);
193 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
194 struct inode *gqinode = oinfo->dqi_gqinode;
195 int offset = off & (sb->s_blocksize - 1);
196 sector_t blk = off >> sb->s_blocksize_bits;
197 int err = 0, new = 0, ja_type;
198 struct buffer_head *bh = NULL;
199 handle_t *handle = journal_current_handle();
200
201 if (!handle) {
202 mlog(ML_ERROR, "Quota write (off=%llu, len=%llu) cancelled "
203 "because transaction was not started.\n",
204 (unsigned long long)off, (unsigned long long)len);
205 return -EIO;
206 }
207 if (len > sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset) {
208 WARN_ON(1);
209 len = sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE - offset;
210 }
211
212 mutex_lock_nested(&gqinode->i_mutex, I_MUTEX_QUOTA);
213 if (gqinode->i_size < off + len) {
214 down_write(&OCFS2_I(gqinode)->ip_alloc_sem);
215 err = ocfs2_extend_no_holes(gqinode, off + len, off);
216 up_write(&OCFS2_I(gqinode)->ip_alloc_sem);
217 if (err < 0)
218 goto out;
219 err = ocfs2_simple_size_update(gqinode,
220 oinfo->dqi_gqi_bh,
221 off + len);
222 if (err < 0)
223 goto out;
224 new = 1;
225 }
226 /* Not rewriting whole block? */
227 if ((offset || len < sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) &&
228 !new) {
229 err = ocfs2_read_quota_block(gqinode, blk, &bh);
230 ja_type = OCFS2_JOURNAL_ACCESS_WRITE;
231 } else {
232 err = ocfs2_get_quota_block(gqinode, blk, &bh);
233 ja_type = OCFS2_JOURNAL_ACCESS_CREATE;
234 }
235 if (err) {
236 mlog_errno(err);
237 return err;
238 }
239 lock_buffer(bh);
240 if (new)
241 memset(bh->b_data, 0, sb->s_blocksize);
242 memcpy(bh->b_data + offset, data, len);
243 flush_dcache_page(bh->b_page);
244 set_buffer_uptodate(bh);
245 unlock_buffer(bh);
246 ocfs2_set_buffer_uptodate(gqinode, bh);
247 err = ocfs2_journal_access_dq(handle, gqinode, bh, ja_type);
248 if (err < 0) {
249 brelse(bh);
250 goto out;
251 }
252 err = ocfs2_journal_dirty(handle, bh);
253 brelse(bh);
254 if (err < 0)
255 goto out;
256out:
257 if (err) {
258 mutex_unlock(&gqinode->i_mutex);
259 mlog_errno(err);
260 return err;
261 }
262 gqinode->i_version++;
263 ocfs2_mark_inode_dirty(handle, gqinode, oinfo->dqi_gqi_bh);
264 mutex_unlock(&gqinode->i_mutex);
265 return len;
266}
267
268int ocfs2_lock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex)
269{
270 int status;
271 struct buffer_head *bh = NULL;
272
273 status = ocfs2_inode_lock(oinfo->dqi_gqinode, &bh, ex);
274 if (status < 0)
275 return status;
276 spin_lock(&dq_data_lock);
277 if (!oinfo->dqi_gqi_count++)
278 oinfo->dqi_gqi_bh = bh;
279 else
280 WARN_ON(bh != oinfo->dqi_gqi_bh);
281 spin_unlock(&dq_data_lock);
282 return 0;
283}
284
285void ocfs2_unlock_global_qf(struct ocfs2_mem_dqinfo *oinfo, int ex)
286{
287 ocfs2_inode_unlock(oinfo->dqi_gqinode, ex);
288 brelse(oinfo->dqi_gqi_bh);
289 spin_lock(&dq_data_lock);
290 if (!--oinfo->dqi_gqi_count)
291 oinfo->dqi_gqi_bh = NULL;
292 spin_unlock(&dq_data_lock);
293}
294
295/* Read information header from global quota file */
296int ocfs2_global_read_info(struct super_block *sb, int type)
297{
298 struct inode *gqinode = NULL;
299 unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
300 GROUP_QUOTA_SYSTEM_INODE };
301 struct ocfs2_global_disk_dqinfo dinfo;
302 struct mem_dqinfo *info = sb_dqinfo(sb, type);
303 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
304 int status;
305
306 mlog_entry_void();
307
308 /* Read global header */
309 gqinode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type],
310 OCFS2_INVALID_SLOT);
311 if (!gqinode) {
312 mlog(ML_ERROR, "failed to get global quota inode (type=%d)\n",
313 type);
314 status = -EINVAL;
315 goto out_err;
316 }
317 oinfo->dqi_gi.dqi_sb = sb;
318 oinfo->dqi_gi.dqi_type = type;
319 ocfs2_qinfo_lock_res_init(&oinfo->dqi_gqlock, oinfo);
320 oinfo->dqi_gi.dqi_entry_size = sizeof(struct ocfs2_global_disk_dqblk);
321 oinfo->dqi_gi.dqi_ops = &ocfs2_global_ops;
322 oinfo->dqi_gqi_bh = NULL;
323 oinfo->dqi_gqi_count = 0;
324 oinfo->dqi_gqinode = gqinode;
325 status = ocfs2_lock_global_qf(oinfo, 0);
326 if (status < 0) {
327 mlog_errno(status);
328 goto out_err;
329 }
330 status = sb->s_op->quota_read(sb, type, (char *)&dinfo,
331 sizeof(struct ocfs2_global_disk_dqinfo),
332 OCFS2_GLOBAL_INFO_OFF);
333 ocfs2_unlock_global_qf(oinfo, 0);
334 if (status != sizeof(struct ocfs2_global_disk_dqinfo)) {
335 mlog(ML_ERROR, "Cannot read global quota info (%d).\n",
336 status);
337 if (status >= 0)
338 status = -EIO;
339 mlog_errno(status);
340 goto out_err;
341 }
342 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
343 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
344 oinfo->dqi_syncms = le32_to_cpu(dinfo.dqi_syncms);
345 oinfo->dqi_syncjiff = msecs_to_jiffies(oinfo->dqi_syncms);
346 oinfo->dqi_gi.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks);
347 oinfo->dqi_gi.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk);
348 oinfo->dqi_gi.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry);
349 oinfo->dqi_gi.dqi_blocksize_bits = sb->s_blocksize_bits;
350 oinfo->dqi_gi.dqi_usable_bs = sb->s_blocksize -
351 OCFS2_QBLK_RESERVED_SPACE;
352 oinfo->dqi_gi.dqi_qtree_depth = qtree_depth(&oinfo->dqi_gi);
353 INIT_DELAYED_WORK(&oinfo->dqi_sync_work, qsync_work_fn);
354 queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
355 oinfo->dqi_syncjiff);
356
357out_err:
358 mlog_exit(status);
359 return status;
360}
361
362/* Write information to global quota file. Expects exlusive lock on quota
363 * file inode and quota info */
364static int __ocfs2_global_write_info(struct super_block *sb, int type)
365{
366 struct mem_dqinfo *info = sb_dqinfo(sb, type);
367 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
368 struct ocfs2_global_disk_dqinfo dinfo;
369 ssize_t size;
370
371 spin_lock(&dq_data_lock);
372 info->dqi_flags &= ~DQF_INFO_DIRTY;
373 dinfo.dqi_bgrace = cpu_to_le32(info->dqi_bgrace);
374 dinfo.dqi_igrace = cpu_to_le32(info->dqi_igrace);
375 spin_unlock(&dq_data_lock);
376 dinfo.dqi_syncms = cpu_to_le32(oinfo->dqi_syncms);
377 dinfo.dqi_blocks = cpu_to_le32(oinfo->dqi_gi.dqi_blocks);
378 dinfo.dqi_free_blk = cpu_to_le32(oinfo->dqi_gi.dqi_free_blk);
379 dinfo.dqi_free_entry = cpu_to_le32(oinfo->dqi_gi.dqi_free_entry);
380 size = sb->s_op->quota_write(sb, type, (char *)&dinfo,
381 sizeof(struct ocfs2_global_disk_dqinfo),
382 OCFS2_GLOBAL_INFO_OFF);
383 if (size != sizeof(struct ocfs2_global_disk_dqinfo)) {
384 mlog(ML_ERROR, "Cannot write global quota info structure\n");
385 if (size >= 0)
386 size = -EIO;
387 return size;
388 }
389 return 0;
390}
391
392int ocfs2_global_write_info(struct super_block *sb, int type)
393{
394 int err;
395 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
396
397 err = ocfs2_qinfo_lock(info, 1);
398 if (err < 0)
399 return err;
400 err = __ocfs2_global_write_info(sb, type);
401 ocfs2_qinfo_unlock(info, 1);
402 return err;
403}
404
405/* Read in information from global quota file and acquire a reference to it.
406 * dquot_acquire() has already started the transaction and locked quota file */
407int ocfs2_global_read_dquot(struct dquot *dquot)
408{
409 int err, err2, ex = 0;
410 struct ocfs2_mem_dqinfo *info =
411 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
412
413 err = ocfs2_qinfo_lock(info, 0);
414 if (err < 0)
415 goto out;
416 err = qtree_read_dquot(&info->dqi_gi, dquot);
417 if (err < 0)
418 goto out_qlock;
419 OCFS2_DQUOT(dquot)->dq_use_count++;
420 OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
421 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
422 if (!dquot->dq_off) { /* No real quota entry? */
423 /* Upgrade to exclusive lock for allocation */
424 err = ocfs2_qinfo_lock(info, 1);
425 if (err < 0)
426 goto out_qlock;
427 ex = 1;
428 }
429 err = qtree_write_dquot(&info->dqi_gi, dquot);
430 if (ex && info_dirty(sb_dqinfo(dquot->dq_sb, dquot->dq_type))) {
431 err2 = __ocfs2_global_write_info(dquot->dq_sb, dquot->dq_type);
432 if (!err)
433 err = err2;
434 }
435out_qlock:
436 if (ex)
437 ocfs2_qinfo_unlock(info, 1);
438 ocfs2_qinfo_unlock(info, 0);
439out:
440 if (err < 0)
441 mlog_errno(err);
442 return err;
443}
444
445/* Sync local information about quota modifications with global quota file.
446 * Caller must have started the transaction and obtained exclusive lock for
447 * global quota file inode */
448int __ocfs2_sync_dquot(struct dquot *dquot, int freeing)
449{
450 int err, err2;
451 struct super_block *sb = dquot->dq_sb;
452 int type = dquot->dq_type;
453 struct ocfs2_mem_dqinfo *info = sb_dqinfo(sb, type)->dqi_priv;
454 struct ocfs2_global_disk_dqblk dqblk;
455 s64 spacechange, inodechange;
456 time_t olditime, oldbtime;
457
458 err = sb->s_op->quota_read(sb, type, (char *)&dqblk,
459 sizeof(struct ocfs2_global_disk_dqblk),
460 dquot->dq_off);
461 if (err != sizeof(struct ocfs2_global_disk_dqblk)) {
462 if (err >= 0) {
463 mlog(ML_ERROR, "Short read from global quota file "
464 "(%u read)\n", err);
465 err = -EIO;
466 }
467 goto out;
468 }
469
470 /* Update space and inode usage. Get also other information from
471 * global quota file so that we don't overwrite any changes there.
472 * We are */
473 spin_lock(&dq_data_lock);
474 spacechange = dquot->dq_dqb.dqb_curspace -
475 OCFS2_DQUOT(dquot)->dq_origspace;
476 inodechange = dquot->dq_dqb.dqb_curinodes -
477 OCFS2_DQUOT(dquot)->dq_originodes;
478 olditime = dquot->dq_dqb.dqb_itime;
479 oldbtime = dquot->dq_dqb.dqb_btime;
480 ocfs2_global_disk2memdqb(dquot, &dqblk);
481 mlog(0, "Syncing global dquot %u space %lld+%lld, inodes %lld+%lld\n",
482 dquot->dq_id, dquot->dq_dqb.dqb_curspace, (long long)spacechange,
483 dquot->dq_dqb.dqb_curinodes, (long long)inodechange);
484 if (!test_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags))
485 dquot->dq_dqb.dqb_curspace += spacechange;
486 if (!test_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags))
487 dquot->dq_dqb.dqb_curinodes += inodechange;
488 /* Set properly space grace time... */
489 if (dquot->dq_dqb.dqb_bsoftlimit &&
490 dquot->dq_dqb.dqb_curspace > dquot->dq_dqb.dqb_bsoftlimit) {
491 if (!test_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags) &&
492 oldbtime > 0) {
493 if (dquot->dq_dqb.dqb_btime > 0)
494 dquot->dq_dqb.dqb_btime =
495 min(dquot->dq_dqb.dqb_btime, oldbtime);
496 else
497 dquot->dq_dqb.dqb_btime = oldbtime;
498 }
499 } else {
500 dquot->dq_dqb.dqb_btime = 0;
501 clear_bit(DQ_BLKS_B, &dquot->dq_flags);
502 }
503 /* Set properly inode grace time... */
504 if (dquot->dq_dqb.dqb_isoftlimit &&
505 dquot->dq_dqb.dqb_curinodes > dquot->dq_dqb.dqb_isoftlimit) {
506 if (!test_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags) &&
507 olditime > 0) {
508 if (dquot->dq_dqb.dqb_itime > 0)
509 dquot->dq_dqb.dqb_itime =
510 min(dquot->dq_dqb.dqb_itime, olditime);
511 else
512 dquot->dq_dqb.dqb_itime = olditime;
513 }
514 } else {
515 dquot->dq_dqb.dqb_itime = 0;
516 clear_bit(DQ_INODES_B, &dquot->dq_flags);
517 }
518 /* All information is properly updated, clear the flags */
519 __clear_bit(DQ_LASTSET_B + QIF_SPACE_B, &dquot->dq_flags);
520 __clear_bit(DQ_LASTSET_B + QIF_INODES_B, &dquot->dq_flags);
521 __clear_bit(DQ_LASTSET_B + QIF_BLIMITS_B, &dquot->dq_flags);
522 __clear_bit(DQ_LASTSET_B + QIF_ILIMITS_B, &dquot->dq_flags);
523 __clear_bit(DQ_LASTSET_B + QIF_BTIME_B, &dquot->dq_flags);
524 __clear_bit(DQ_LASTSET_B + QIF_ITIME_B, &dquot->dq_flags);
525 OCFS2_DQUOT(dquot)->dq_origspace = dquot->dq_dqb.dqb_curspace;
526 OCFS2_DQUOT(dquot)->dq_originodes = dquot->dq_dqb.dqb_curinodes;
527 spin_unlock(&dq_data_lock);
528 err = ocfs2_qinfo_lock(info, freeing);
529 if (err < 0) {
530 mlog(ML_ERROR, "Failed to lock quota info, loosing quota write"
531 " (type=%d, id=%u)\n", dquot->dq_type,
532 (unsigned)dquot->dq_id);
533 goto out;
534 }
535 if (freeing)
536 OCFS2_DQUOT(dquot)->dq_use_count--;
537 err = qtree_write_dquot(&info->dqi_gi, dquot);
538 if (err < 0)
539 goto out_qlock;
540 if (freeing && !OCFS2_DQUOT(dquot)->dq_use_count) {
541 err = qtree_release_dquot(&info->dqi_gi, dquot);
542 if (info_dirty(sb_dqinfo(sb, type))) {
543 err2 = __ocfs2_global_write_info(sb, type);
544 if (!err)
545 err = err2;
546 }
547 }
548out_qlock:
549 ocfs2_qinfo_unlock(info, freeing);
550out:
551 if (err < 0)
552 mlog_errno(err);
553 return err;
554}
555
556/*
557 * Functions for periodic syncing of dquots with global file
558 */
559static int ocfs2_sync_dquot_helper(struct dquot *dquot, unsigned long type)
560{
561 handle_t *handle;
562 struct super_block *sb = dquot->dq_sb;
563 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
564 struct ocfs2_super *osb = OCFS2_SB(sb);
565 int status = 0;
566
567 mlog_entry("id=%u qtype=%u type=%lu device=%s\n", dquot->dq_id,
568 dquot->dq_type, type, sb->s_id);
569 if (type != dquot->dq_type)
570 goto out;
571 status = ocfs2_lock_global_qf(oinfo, 1);
572 if (status < 0)
573 goto out;
574
575 handle = ocfs2_start_trans(osb, OCFS2_QSYNC_CREDITS);
576 if (IS_ERR(handle)) {
577 status = PTR_ERR(handle);
578 mlog_errno(status);
579 goto out_ilock;
580 }
581 mutex_lock(&sb_dqopt(sb)->dqio_mutex);
582 status = ocfs2_sync_dquot(dquot);
583 mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
584 if (status < 0)
585 mlog_errno(status);
586 /* We have to write local structure as well... */
587 dquot_mark_dquot_dirty(dquot);
588 status = dquot_commit(dquot);
589 if (status < 0)
590 mlog_errno(status);
591 ocfs2_commit_trans(osb, handle);
592out_ilock:
593 ocfs2_unlock_global_qf(oinfo, 1);
594out:
595 mlog_exit(status);
596 return status;
597}
598
599static void qsync_work_fn(struct work_struct *work)
600{
601 struct ocfs2_mem_dqinfo *oinfo = container_of(work,
602 struct ocfs2_mem_dqinfo,
603 dqi_sync_work.work);
604 struct super_block *sb = oinfo->dqi_gqinode->i_sb;
605
606 dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type);
607 queue_delayed_work(ocfs2_quota_wq, &oinfo->dqi_sync_work,
608 oinfo->dqi_syncjiff);
609}
610
611/*
612 * Wrappers for generic quota functions
613 */
614
615static int ocfs2_write_dquot(struct dquot *dquot)
616{
617 handle_t *handle;
618 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
619 int status = 0;
620
621 mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
622
623 handle = ocfs2_start_trans(osb, OCFS2_QWRITE_CREDITS);
624 if (IS_ERR(handle)) {
625 status = PTR_ERR(handle);
626 mlog_errno(status);
627 goto out;
628 }
629 status = dquot_commit(dquot);
630 ocfs2_commit_trans(osb, handle);
631out:
632 mlog_exit(status);
633 return status;
634}
635
636int ocfs2_calc_qdel_credits(struct super_block *sb, int type)
637{
638 struct ocfs2_mem_dqinfo *oinfo;
639 int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
640 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA };
641
642 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type]))
643 return 0;
644
645 oinfo = sb_dqinfo(sb, type)->dqi_priv;
646 /* We modify tree, leaf block, global info, local chunk header,
647 * global and local inode */
648 return oinfo->dqi_gi.dqi_qtree_depth + 2 + 1 +
649 2 * OCFS2_INODE_UPDATE_CREDITS;
650}
651
652static int ocfs2_release_dquot(struct dquot *dquot)
653{
654 handle_t *handle;
655 struct ocfs2_mem_dqinfo *oinfo =
656 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
657 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
658 int status = 0;
659
660 mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
661
662 status = ocfs2_lock_global_qf(oinfo, 1);
663 if (status < 0)
664 goto out;
665 handle = ocfs2_start_trans(osb,
666 ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_type));
667 if (IS_ERR(handle)) {
668 status = PTR_ERR(handle);
669 mlog_errno(status);
670 goto out_ilock;
671 }
672 status = dquot_release(dquot);
673 ocfs2_commit_trans(osb, handle);
674out_ilock:
675 ocfs2_unlock_global_qf(oinfo, 1);
676out:
677 mlog_exit(status);
678 return status;
679}
680
681int ocfs2_calc_qinit_credits(struct super_block *sb, int type)
682{
683 struct ocfs2_mem_dqinfo *oinfo;
684 int features[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
685 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA };
686 struct ocfs2_dinode *lfe, *gfe;
687
688 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, features[type]))
689 return 0;
690
691 oinfo = sb_dqinfo(sb, type)->dqi_priv;
692 gfe = (struct ocfs2_dinode *)oinfo->dqi_gqi_bh->b_data;
693 lfe = (struct ocfs2_dinode *)oinfo->dqi_lqi_bh->b_data;
694 /* We can extend local file + global file. In local file we
695 * can modify info, chunk header block and dquot block. In
696 * global file we can modify info, tree and leaf block */
697 return ocfs2_calc_extend_credits(sb, &lfe->id2.i_list, 0) +
698 ocfs2_calc_extend_credits(sb, &gfe->id2.i_list, 0) +
699 3 + oinfo->dqi_gi.dqi_qtree_depth + 2;
700}
701
702static int ocfs2_acquire_dquot(struct dquot *dquot)
703{
704 handle_t *handle;
705 struct ocfs2_mem_dqinfo *oinfo =
706 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
707 struct ocfs2_super *osb = OCFS2_SB(dquot->dq_sb);
708 int status = 0;
709
710 mlog_entry("id=%u, type=%d", dquot->dq_id, dquot->dq_type);
711 /* We need an exclusive lock, because we're going to update use count
712 * and instantiate possibly new dquot structure */
713 status = ocfs2_lock_global_qf(oinfo, 1);
714 if (status < 0)
715 goto out;
716 handle = ocfs2_start_trans(osb,
717 ocfs2_calc_qinit_credits(dquot->dq_sb, dquot->dq_type));
718 if (IS_ERR(handle)) {
719 status = PTR_ERR(handle);
720 mlog_errno(status);
721 goto out_ilock;
722 }
723 status = dquot_acquire(dquot);
724 ocfs2_commit_trans(osb, handle);
725out_ilock:
726 ocfs2_unlock_global_qf(oinfo, 1);
727out:
728 mlog_exit(status);
729 return status;
730}
731
732static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
733{
734 unsigned long mask = (1 << (DQ_LASTSET_B + QIF_ILIMITS_B)) |
735 (1 << (DQ_LASTSET_B + QIF_BLIMITS_B)) |
736 (1 << (DQ_LASTSET_B + QIF_INODES_B)) |
737 (1 << (DQ_LASTSET_B + QIF_SPACE_B)) |
738 (1 << (DQ_LASTSET_B + QIF_BTIME_B)) |
739 (1 << (DQ_LASTSET_B + QIF_ITIME_B));
740 int sync = 0;
741 int status;
742 struct super_block *sb = dquot->dq_sb;
743 int type = dquot->dq_type;
744 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
745 handle_t *handle;
746 struct ocfs2_super *osb = OCFS2_SB(sb);
747
748 mlog_entry("id=%u, type=%d", dquot->dq_id, type);
749 dquot_mark_dquot_dirty(dquot);
750
751 /* In case user set some limits, sync dquot immediately to global
752 * quota file so that information propagates quicker */
753 spin_lock(&dq_data_lock);
754 if (dquot->dq_flags & mask)
755 sync = 1;
756 spin_unlock(&dq_data_lock);
757 if (!sync) {
758 status = ocfs2_write_dquot(dquot);
759 goto out;
760 }
761 status = ocfs2_lock_global_qf(oinfo, 1);
762 if (status < 0)
763 goto out;
764 handle = ocfs2_start_trans(osb, OCFS2_QSYNC_CREDITS);
765 if (IS_ERR(handle)) {
766 status = PTR_ERR(handle);
767 mlog_errno(status);
768 goto out_ilock;
769 }
770 status = ocfs2_sync_dquot(dquot);
771 if (status < 0) {
772 mlog_errno(status);
773 goto out_trans;
774 }
775 /* Now write updated local dquot structure */
776 status = dquot_commit(dquot);
777out_trans:
778 ocfs2_commit_trans(osb, handle);
779out_ilock:
780 ocfs2_unlock_global_qf(oinfo, 1);
781out:
782 mlog_exit(status);
783 return status;
784}
785
786/* This should happen only after set_dqinfo(). */
787static int ocfs2_write_info(struct super_block *sb, int type)
788{
789 handle_t *handle;
790 int status = 0;
791 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
792
793 mlog_entry_void();
794
795 status = ocfs2_lock_global_qf(oinfo, 1);
796 if (status < 0)
797 goto out;
798 handle = ocfs2_start_trans(OCFS2_SB(sb), OCFS2_QINFO_WRITE_CREDITS);
799 if (IS_ERR(handle)) {
800 status = PTR_ERR(handle);
801 mlog_errno(status);
802 goto out_ilock;
803 }
804 status = dquot_commit_info(sb, type);
805 ocfs2_commit_trans(OCFS2_SB(sb), handle);
806out_ilock:
807 ocfs2_unlock_global_qf(oinfo, 1);
808out:
809 mlog_exit(status);
810 return status;
811}
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)
979{
980 struct ocfs2_dquot *dquot =
981 kmem_cache_zalloc(ocfs2_dquot_cachep, GFP_NOFS);
982
983 if (!dquot)
984 return NULL;
985 return &dquot->dq_dquot;
986}
987
988static void ocfs2_destroy_dquot(struct dquot *dquot)
989{
990 kmem_cache_free(ocfs2_dquot_cachep, dquot);
991}
992
993struct dquot_operations ocfs2_quota_operations = {
994 .initialize = ocfs2_dquot_initialize,
995 .drop = ocfs2_dquot_drop,
996 .alloc_space = dquot_alloc_space,
997 .alloc_inode = dquot_alloc_inode,
998 .free_space = dquot_free_space,
999 .free_inode = dquot_free_inode,
1000 .transfer = dquot_transfer,
1001 .write_dquot = ocfs2_write_dquot,
1002 .acquire_dquot = ocfs2_acquire_dquot,
1003 .release_dquot = ocfs2_release_dquot,
1004 .mark_dirty = ocfs2_mark_dquot_dirty,
1005 .write_info = ocfs2_write_info,
1006 .alloc_dquot = ocfs2_alloc_dquot,
1007 .destroy_dquot = ocfs2_destroy_dquot,
1008};
1009
1010int ocfs2_quota_setup(void)
1011{
1012 ocfs2_quota_wq = create_workqueue("o2quot");
1013 if (!ocfs2_quota_wq)
1014 return -ENOMEM;
1015 return 0;
1016}
1017
1018void ocfs2_quota_shutdown(void)
1019{
1020 if (ocfs2_quota_wq) {
1021 flush_workqueue(ocfs2_quota_wq);
1022 destroy_workqueue(ocfs2_quota_wq);
1023 ocfs2_quota_wq = NULL;
1024 }
1025}
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
new file mode 100644
index 000000000000..07deec5e9721
--- /dev/null
+++ b/fs/ocfs2/quota_local.c
@@ -0,0 +1,1253 @@
1/*
2 * Implementation of operations over local quota file
3 */
4
5#include <linux/fs.h>
6#include <linux/quota.h>
7#include <linux/quotaops.h>
8#include <linux/module.h>
9
10#define MLOG_MASK_PREFIX ML_QUOTA
11#include <cluster/masklog.h>
12
13#include "ocfs2_fs.h"
14#include "ocfs2.h"
15#include "inode.h"
16#include "alloc.h"
17#include "file.h"
18#include "buffer_head_io.h"
19#include "journal.h"
20#include "sysfile.h"
21#include "dlmglue.h"
22#include "quota.h"
23
24/* Number of local quota structures per block */
25static inline unsigned int ol_quota_entries_per_block(struct super_block *sb)
26{
27 return ((sb->s_blocksize - OCFS2_QBLK_RESERVED_SPACE) /
28 sizeof(struct ocfs2_local_disk_dqblk));
29}
30
31/* Number of blocks with entries in one chunk */
32static inline unsigned int ol_chunk_blocks(struct super_block *sb)
33{
34 return ((sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) -
35 OCFS2_QBLK_RESERVED_SPACE) << 3) /
36 ol_quota_entries_per_block(sb);
37}
38
39/* Number of entries in a chunk bitmap */
40static unsigned int ol_chunk_entries(struct super_block *sb)
41{
42 return ol_chunk_blocks(sb) * ol_quota_entries_per_block(sb);
43}
44
45/* Offset of the chunk in quota file */
46static unsigned int ol_quota_chunk_block(struct super_block *sb, int c)
47{
48 /* 1 block for local quota file info, 1 block per chunk for chunk info */
49 return 1 + (ol_chunk_blocks(sb) + 1) * c;
50}
51
52static unsigned int ol_dqblk_block(struct super_block *sb, int c, int off)
53{
54 int epb = ol_quota_entries_per_block(sb);
55
56 return ol_quota_chunk_block(sb, c) + 1 + off / epb;
57}
58
59static unsigned int ol_dqblk_block_off(struct super_block *sb, int c, int off)
60{
61 int epb = ol_quota_entries_per_block(sb);
62
63 return (off % epb) * sizeof(struct ocfs2_local_disk_dqblk);
64}
65
66/* Offset of the dquot structure in the quota file */
67static loff_t ol_dqblk_off(struct super_block *sb, int c, int off)
68{
69 return (ol_dqblk_block(sb, c, off) << sb->s_blocksize_bits) +
70 ol_dqblk_block_off(sb, c, off);
71}
72
73/* Compute block number from given offset */
74static inline unsigned int ol_dqblk_file_block(struct super_block *sb, loff_t off)
75{
76 return off >> sb->s_blocksize_bits;
77}
78
79static inline unsigned int ol_dqblk_block_offset(struct super_block *sb, loff_t off)
80{
81 return off & ((1 << sb->s_blocksize_bits) - 1);
82}
83
84/* Compute offset in the chunk of a structure with the given offset */
85static int ol_dqblk_chunk_off(struct super_block *sb, int c, loff_t off)
86{
87 int epb = ol_quota_entries_per_block(sb);
88
89 return ((off >> sb->s_blocksize_bits) -
90 ol_quota_chunk_block(sb, c) - 1) * epb
91 + ((unsigned int)(off & ((1 << sb->s_blocksize_bits) - 1))) /
92 sizeof(struct ocfs2_local_disk_dqblk);
93}
94
95/* Write bufferhead into the fs */
96static int ocfs2_modify_bh(struct inode *inode, struct buffer_head *bh,
97 void (*modify)(struct buffer_head *, void *), void *private)
98{
99 struct super_block *sb = inode->i_sb;
100 handle_t *handle;
101 int status;
102
103 handle = ocfs2_start_trans(OCFS2_SB(sb), 1);
104 if (IS_ERR(handle)) {
105 status = PTR_ERR(handle);
106 mlog_errno(status);
107 return status;
108 }
109 status = ocfs2_journal_access_dq(handle, inode, bh,
110 OCFS2_JOURNAL_ACCESS_WRITE);
111 if (status < 0) {
112 mlog_errno(status);
113 ocfs2_commit_trans(OCFS2_SB(sb), handle);
114 return status;
115 }
116 lock_buffer(bh);
117 modify(bh, private);
118 unlock_buffer(bh);
119 status = ocfs2_journal_dirty(handle, bh);
120 if (status < 0) {
121 mlog_errno(status);
122 ocfs2_commit_trans(OCFS2_SB(sb), handle);
123 return status;
124 }
125 status = ocfs2_commit_trans(OCFS2_SB(sb), handle);
126 if (status < 0) {
127 mlog_errno(status);
128 return status;
129 }
130 return 0;
131}
132
133/* Check whether we understand format of quota files */
134static int ocfs2_local_check_quota_file(struct super_block *sb, int type)
135{
136 unsigned int lmagics[MAXQUOTAS] = OCFS2_LOCAL_QMAGICS;
137 unsigned int lversions[MAXQUOTAS] = OCFS2_LOCAL_QVERSIONS;
138 unsigned int gmagics[MAXQUOTAS] = OCFS2_GLOBAL_QMAGICS;
139 unsigned int gversions[MAXQUOTAS] = OCFS2_GLOBAL_QVERSIONS;
140 unsigned int ino[MAXQUOTAS] = { USER_QUOTA_SYSTEM_INODE,
141 GROUP_QUOTA_SYSTEM_INODE };
142 struct buffer_head *bh = NULL;
143 struct inode *linode = sb_dqopt(sb)->files[type];
144 struct inode *ginode = NULL;
145 struct ocfs2_disk_dqheader *dqhead;
146 int status, ret = 0;
147
148 /* First check whether we understand local quota file */
149 status = ocfs2_read_quota_block(linode, 0, &bh);
150 if (status) {
151 mlog_errno(status);
152 mlog(ML_ERROR, "failed to read quota file header (type=%d)\n",
153 type);
154 goto out_err;
155 }
156 dqhead = (struct ocfs2_disk_dqheader *)(bh->b_data);
157 if (le32_to_cpu(dqhead->dqh_magic) != lmagics[type]) {
158 mlog(ML_ERROR, "quota file magic does not match (%u != %u),"
159 " type=%d\n", le32_to_cpu(dqhead->dqh_magic),
160 lmagics[type], type);
161 goto out_err;
162 }
163 if (le32_to_cpu(dqhead->dqh_version) != lversions[type]) {
164 mlog(ML_ERROR, "quota file version does not match (%u != %u),"
165 " type=%d\n", le32_to_cpu(dqhead->dqh_version),
166 lversions[type], type);
167 goto out_err;
168 }
169 brelse(bh);
170 bh = NULL;
171
172 /* Next check whether we understand global quota file */
173 ginode = ocfs2_get_system_file_inode(OCFS2_SB(sb), ino[type],
174 OCFS2_INVALID_SLOT);
175 if (!ginode) {
176 mlog(ML_ERROR, "cannot get global quota file inode "
177 "(type=%d)\n", type);
178 goto out_err;
179 }
180 /* Since the header is read only, we don't care about locking */
181 status = ocfs2_read_quota_block(ginode, 0, &bh);
182 if (status) {
183 mlog_errno(status);
184 mlog(ML_ERROR, "failed to read global quota file header "
185 "(type=%d)\n", type);
186 goto out_err;
187 }
188 dqhead = (struct ocfs2_disk_dqheader *)(bh->b_data);
189 if (le32_to_cpu(dqhead->dqh_magic) != gmagics[type]) {
190 mlog(ML_ERROR, "global quota file magic does not match "
191 "(%u != %u), type=%d\n",
192 le32_to_cpu(dqhead->dqh_magic), gmagics[type], type);
193 goto out_err;
194 }
195 if (le32_to_cpu(dqhead->dqh_version) != gversions[type]) {
196 mlog(ML_ERROR, "global quota file version does not match "
197 "(%u != %u), type=%d\n",
198 le32_to_cpu(dqhead->dqh_version), gversions[type],
199 type);
200 goto out_err;
201 }
202
203 ret = 1;
204out_err:
205 brelse(bh);
206 iput(ginode);
207 return ret;
208}
209
210/* Release given list of quota file chunks */
211static void ocfs2_release_local_quota_bitmaps(struct list_head *head)
212{
213 struct ocfs2_quota_chunk *pos, *next;
214
215 list_for_each_entry_safe(pos, next, head, qc_chunk) {
216 list_del(&pos->qc_chunk);
217 brelse(pos->qc_headerbh);
218 kmem_cache_free(ocfs2_qf_chunk_cachep, pos);
219 }
220}
221
222/* Load quota bitmaps into memory */
223static int ocfs2_load_local_quota_bitmaps(struct inode *inode,
224 struct ocfs2_local_disk_dqinfo *ldinfo,
225 struct list_head *head)
226{
227 struct ocfs2_quota_chunk *newchunk;
228 int i, status;
229
230 INIT_LIST_HEAD(head);
231 for (i = 0; i < le32_to_cpu(ldinfo->dqi_chunks); i++) {
232 newchunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
233 if (!newchunk) {
234 ocfs2_release_local_quota_bitmaps(head);
235 return -ENOMEM;
236 }
237 newchunk->qc_num = i;
238 newchunk->qc_headerbh = NULL;
239 status = ocfs2_read_quota_block(inode,
240 ol_quota_chunk_block(inode->i_sb, i),
241 &newchunk->qc_headerbh);
242 if (status) {
243 mlog_errno(status);
244 kmem_cache_free(ocfs2_qf_chunk_cachep, newchunk);
245 ocfs2_release_local_quota_bitmaps(head);
246 return status;
247 }
248 list_add_tail(&newchunk->qc_chunk, head);
249 }
250 return 0;
251}
252
253static void olq_update_info(struct buffer_head *bh, void *private)
254{
255 struct mem_dqinfo *info = private;
256 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
257 struct ocfs2_local_disk_dqinfo *ldinfo;
258
259 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
260 OCFS2_LOCAL_INFO_OFF);
261 spin_lock(&dq_data_lock);
262 ldinfo->dqi_flags = cpu_to_le32(info->dqi_flags & DQF_MASK);
263 ldinfo->dqi_chunks = cpu_to_le32(oinfo->dqi_chunks);
264 ldinfo->dqi_blocks = cpu_to_le32(oinfo->dqi_blocks);
265 spin_unlock(&dq_data_lock);
266}
267
268static int ocfs2_add_recovery_chunk(struct super_block *sb,
269 struct ocfs2_local_disk_chunk *dchunk,
270 int chunk,
271 struct list_head *head)
272{
273 struct ocfs2_recovery_chunk *rc;
274
275 rc = kmalloc(sizeof(struct ocfs2_recovery_chunk), GFP_NOFS);
276 if (!rc)
277 return -ENOMEM;
278 rc->rc_chunk = chunk;
279 rc->rc_bitmap = kmalloc(sb->s_blocksize, GFP_NOFS);
280 if (!rc->rc_bitmap) {
281 kfree(rc);
282 return -ENOMEM;
283 }
284 memcpy(rc->rc_bitmap, dchunk->dqc_bitmap,
285 (ol_chunk_entries(sb) + 7) >> 3);
286 list_add_tail(&rc->rc_list, head);
287 return 0;
288}
289
290static void free_recovery_list(struct list_head *head)
291{
292 struct ocfs2_recovery_chunk *next;
293 struct ocfs2_recovery_chunk *rchunk;
294
295 list_for_each_entry_safe(rchunk, next, head, rc_list) {
296 list_del(&rchunk->rc_list);
297 kfree(rchunk->rc_bitmap);
298 kfree(rchunk);
299 }
300}
301
302void ocfs2_free_quota_recovery(struct ocfs2_quota_recovery *rec)
303{
304 int type;
305
306 for (type = 0; type < MAXQUOTAS; type++)
307 free_recovery_list(&(rec->r_list[type]));
308 kfree(rec);
309}
310
311/* Load entries in our quota file we have to recover*/
312static int ocfs2_recovery_load_quota(struct inode *lqinode,
313 struct ocfs2_local_disk_dqinfo *ldinfo,
314 int type,
315 struct list_head *head)
316{
317 struct super_block *sb = lqinode->i_sb;
318 struct buffer_head *hbh;
319 struct ocfs2_local_disk_chunk *dchunk;
320 int i, chunks = le32_to_cpu(ldinfo->dqi_chunks);
321 int status = 0;
322
323 for (i = 0; i < chunks; i++) {
324 hbh = NULL;
325 status = ocfs2_read_quota_block(lqinode,
326 ol_quota_chunk_block(sb, i),
327 &hbh);
328 if (status) {
329 mlog_errno(status);
330 break;
331 }
332 dchunk = (struct ocfs2_local_disk_chunk *)hbh->b_data;
333 if (le32_to_cpu(dchunk->dqc_free) < ol_chunk_entries(sb))
334 status = ocfs2_add_recovery_chunk(sb, dchunk, i, head);
335 brelse(hbh);
336 if (status < 0)
337 break;
338 }
339 if (status < 0)
340 free_recovery_list(head);
341 return status;
342}
343
344static struct ocfs2_quota_recovery *ocfs2_alloc_quota_recovery(void)
345{
346 int type;
347 struct ocfs2_quota_recovery *rec;
348
349 rec = kmalloc(sizeof(struct ocfs2_quota_recovery), GFP_NOFS);
350 if (!rec)
351 return NULL;
352 for (type = 0; type < MAXQUOTAS; type++)
353 INIT_LIST_HEAD(&(rec->r_list[type]));
354 return rec;
355}
356
357/* Load information we need for quota recovery into memory */
358struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
359 struct ocfs2_super *osb,
360 int slot_num)
361{
362 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
363 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
364 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
365 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
366 struct super_block *sb = osb->sb;
367 struct ocfs2_local_disk_dqinfo *ldinfo;
368 struct inode *lqinode;
369 struct buffer_head *bh;
370 int type;
371 int status = 0;
372 struct ocfs2_quota_recovery *rec;
373
374 mlog(ML_NOTICE, "Beginning quota recovery in slot %u\n", slot_num);
375 rec = ocfs2_alloc_quota_recovery();
376 if (!rec)
377 return ERR_PTR(-ENOMEM);
378 /* First init... */
379
380 for (type = 0; type < MAXQUOTAS; type++) {
381 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
382 continue;
383 /* At this point, journal of the slot is already replayed so
384 * we can trust metadata and data of the quota file */
385 lqinode = ocfs2_get_system_file_inode(osb, ino[type], slot_num);
386 if (!lqinode) {
387 status = -ENOENT;
388 goto out;
389 }
390 status = ocfs2_inode_lock_full(lqinode, NULL, 1,
391 OCFS2_META_LOCK_RECOVERY);
392 if (status < 0) {
393 mlog_errno(status);
394 goto out_put;
395 }
396 /* Now read local header */
397 bh = NULL;
398 status = ocfs2_read_quota_block(lqinode, 0, &bh);
399 if (status) {
400 mlog_errno(status);
401 mlog(ML_ERROR, "failed to read quota file info header "
402 "(slot=%d type=%d)\n", slot_num, type);
403 goto out_lock;
404 }
405 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
406 OCFS2_LOCAL_INFO_OFF);
407 status = ocfs2_recovery_load_quota(lqinode, ldinfo, type,
408 &rec->r_list[type]);
409 brelse(bh);
410out_lock:
411 ocfs2_inode_unlock(lqinode, 1);
412out_put:
413 iput(lqinode);
414 if (status < 0)
415 break;
416 }
417out:
418 if (status < 0) {
419 ocfs2_free_quota_recovery(rec);
420 rec = ERR_PTR(status);
421 }
422 return rec;
423}
424
425/* Sync changes in local quota file into global quota file and
426 * reinitialize local quota file.
427 * The function expects local quota file to be already locked and
428 * dqonoff_mutex locked. */
429static int ocfs2_recover_local_quota_file(struct inode *lqinode,
430 int type,
431 struct ocfs2_quota_recovery *rec)
432{
433 struct super_block *sb = lqinode->i_sb;
434 struct ocfs2_mem_dqinfo *oinfo = sb_dqinfo(sb, type)->dqi_priv;
435 struct ocfs2_local_disk_chunk *dchunk;
436 struct ocfs2_local_disk_dqblk *dqblk;
437 struct dquot *dquot;
438 handle_t *handle;
439 struct buffer_head *hbh = NULL, *qbh = NULL;
440 int status = 0;
441 int bit, chunk;
442 struct ocfs2_recovery_chunk *rchunk, *next;
443 qsize_t spacechange, inodechange;
444
445 mlog_entry("ino=%lu type=%u", (unsigned long)lqinode->i_ino, type);
446
447 status = ocfs2_lock_global_qf(oinfo, 1);
448 if (status < 0)
449 goto out;
450
451 list_for_each_entry_safe(rchunk, next, &(rec->r_list[type]), rc_list) {
452 chunk = rchunk->rc_chunk;
453 hbh = NULL;
454 status = ocfs2_read_quota_block(lqinode,
455 ol_quota_chunk_block(sb, chunk),
456 &hbh);
457 if (status) {
458 mlog_errno(status);
459 break;
460 }
461 dchunk = (struct ocfs2_local_disk_chunk *)hbh->b_data;
462 for_each_bit(bit, rchunk->rc_bitmap, ol_chunk_entries(sb)) {
463 qbh = NULL;
464 status = ocfs2_read_quota_block(lqinode,
465 ol_dqblk_block(sb, chunk, bit),
466 &qbh);
467 if (status) {
468 mlog_errno(status);
469 break;
470 }
471 dqblk = (struct ocfs2_local_disk_dqblk *)(qbh->b_data +
472 ol_dqblk_block_off(sb, chunk, bit));
473 dquot = dqget(sb, le64_to_cpu(dqblk->dqb_id), type);
474 if (!dquot) {
475 status = -EIO;
476 mlog(ML_ERROR, "Failed to get quota structure "
477 "for id %u, type %d. Cannot finish quota "
478 "file recovery.\n",
479 (unsigned)le64_to_cpu(dqblk->dqb_id),
480 type);
481 goto out_put_bh;
482 }
483 handle = ocfs2_start_trans(OCFS2_SB(sb),
484 OCFS2_QSYNC_CREDITS);
485 if (IS_ERR(handle)) {
486 status = PTR_ERR(handle);
487 mlog_errno(status);
488 goto out_put_dquot;
489 }
490 mutex_lock(&sb_dqopt(sb)->dqio_mutex);
491 spin_lock(&dq_data_lock);
492 /* Add usage from quota entry into quota changes
493 * of our node. Auxiliary variables are important
494 * due to signedness */
495 spacechange = le64_to_cpu(dqblk->dqb_spacemod);
496 inodechange = le64_to_cpu(dqblk->dqb_inodemod);
497 dquot->dq_dqb.dqb_curspace += spacechange;
498 dquot->dq_dqb.dqb_curinodes += inodechange;
499 spin_unlock(&dq_data_lock);
500 /* We want to drop reference held by the crashed
501 * node. Since we have our own reference we know
502 * global structure actually won't be freed. */
503 status = ocfs2_global_release_dquot(dquot);
504 if (status < 0) {
505 mlog_errno(status);
506 goto out_commit;
507 }
508 /* Release local quota file entry */
509 status = ocfs2_journal_access_dq(handle, lqinode,
510 qbh, OCFS2_JOURNAL_ACCESS_WRITE);
511 if (status < 0) {
512 mlog_errno(status);
513 goto out_commit;
514 }
515 lock_buffer(qbh);
516 WARN_ON(!ocfs2_test_bit(bit, dchunk->dqc_bitmap));
517 ocfs2_clear_bit(bit, dchunk->dqc_bitmap);
518 le32_add_cpu(&dchunk->dqc_free, 1);
519 unlock_buffer(qbh);
520 status = ocfs2_journal_dirty(handle, qbh);
521 if (status < 0)
522 mlog_errno(status);
523out_commit:
524 mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
525 ocfs2_commit_trans(OCFS2_SB(sb), handle);
526out_put_dquot:
527 dqput(dquot);
528out_put_bh:
529 brelse(qbh);
530 if (status < 0)
531 break;
532 }
533 brelse(hbh);
534 list_del(&rchunk->rc_list);
535 kfree(rchunk->rc_bitmap);
536 kfree(rchunk);
537 if (status < 0)
538 break;
539 }
540 ocfs2_unlock_global_qf(oinfo, 1);
541out:
542 if (status < 0)
543 free_recovery_list(&(rec->r_list[type]));
544 mlog_exit(status);
545 return status;
546}
547
548/* Recover local quota files for given node different from us */
549int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
550 struct ocfs2_quota_recovery *rec,
551 int slot_num)
552{
553 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
554 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
555 struct super_block *sb = osb->sb;
556 struct ocfs2_local_disk_dqinfo *ldinfo;
557 struct buffer_head *bh;
558 handle_t *handle;
559 int type;
560 int status = 0;
561 struct inode *lqinode;
562 unsigned int flags;
563
564 mlog(ML_NOTICE, "Finishing quota recovery in slot %u\n", slot_num);
565 mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
566 for (type = 0; type < MAXQUOTAS; type++) {
567 if (list_empty(&(rec->r_list[type])))
568 continue;
569 mlog(0, "Recovering quota in slot %d\n", slot_num);
570 lqinode = ocfs2_get_system_file_inode(osb, ino[type], slot_num);
571 if (!lqinode) {
572 status = -ENOENT;
573 goto out;
574 }
575 status = ocfs2_inode_lock_full(lqinode, NULL, 1,
576 OCFS2_META_LOCK_NOQUEUE);
577 /* Someone else is holding the lock? Then he must be
578 * doing the recovery. Just skip the file... */
579 if (status == -EAGAIN) {
580 mlog(ML_NOTICE, "skipping quota recovery for slot %d "
581 "because quota file is locked.\n", slot_num);
582 status = 0;
583 goto out_put;
584 } else if (status < 0) {
585 mlog_errno(status);
586 goto out_put;
587 }
588 /* Now read local header */
589 bh = NULL;
590 status = ocfs2_read_quota_block(lqinode, 0, &bh);
591 if (status) {
592 mlog_errno(status);
593 mlog(ML_ERROR, "failed to read quota file info header "
594 "(slot=%d type=%d)\n", slot_num, type);
595 goto out_lock;
596 }
597 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
598 OCFS2_LOCAL_INFO_OFF);
599 /* Is recovery still needed? */
600 flags = le32_to_cpu(ldinfo->dqi_flags);
601 if (!(flags & OLQF_CLEAN))
602 status = ocfs2_recover_local_quota_file(lqinode,
603 type,
604 rec);
605 /* We don't want to mark file as clean when it is actually
606 * active */
607 if (slot_num == osb->slot_num)
608 goto out_bh;
609 /* Mark quota file as clean if we are recovering quota file of
610 * some other node. */
611 handle = ocfs2_start_trans(osb, 1);
612 if (IS_ERR(handle)) {
613 status = PTR_ERR(handle);
614 mlog_errno(status);
615 goto out_bh;
616 }
617 status = ocfs2_journal_access_dq(handle, lqinode, bh,
618 OCFS2_JOURNAL_ACCESS_WRITE);
619 if (status < 0) {
620 mlog_errno(status);
621 goto out_trans;
622 }
623 lock_buffer(bh);
624 ldinfo->dqi_flags = cpu_to_le32(flags | OLQF_CLEAN);
625 unlock_buffer(bh);
626 status = ocfs2_journal_dirty(handle, bh);
627 if (status < 0)
628 mlog_errno(status);
629out_trans:
630 ocfs2_commit_trans(osb, handle);
631out_bh:
632 brelse(bh);
633out_lock:
634 ocfs2_inode_unlock(lqinode, 1);
635out_put:
636 iput(lqinode);
637 if (status < 0)
638 break;
639 }
640out:
641 mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
642 kfree(rec);
643 return status;
644}
645
646/* Read information header from quota file */
647static int ocfs2_local_read_info(struct super_block *sb, int type)
648{
649 struct ocfs2_local_disk_dqinfo *ldinfo;
650 struct mem_dqinfo *info = sb_dqinfo(sb, type);
651 struct ocfs2_mem_dqinfo *oinfo;
652 struct inode *lqinode = sb_dqopt(sb)->files[type];
653 int status;
654 struct buffer_head *bh = NULL;
655 struct ocfs2_quota_recovery *rec;
656 int locked = 0;
657
658 info->dqi_maxblimit = 0x7fffffffffffffffLL;
659 info->dqi_maxilimit = 0x7fffffffffffffffLL;
660 oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS);
661 if (!oinfo) {
662 mlog(ML_ERROR, "failed to allocate memory for ocfs2 quota"
663 " info.");
664 goto out_err;
665 }
666 info->dqi_priv = oinfo;
667 oinfo->dqi_type = type;
668 INIT_LIST_HEAD(&oinfo->dqi_chunk);
669 oinfo->dqi_rec = NULL;
670 oinfo->dqi_lqi_bh = NULL;
671 oinfo->dqi_ibh = NULL;
672
673 status = ocfs2_global_read_info(sb, type);
674 if (status < 0)
675 goto out_err;
676
677 status = ocfs2_inode_lock(lqinode, &oinfo->dqi_lqi_bh, 1);
678 if (status < 0) {
679 mlog_errno(status);
680 goto out_err;
681 }
682 locked = 1;
683
684 /* Now read local header */
685 status = ocfs2_read_quota_block(lqinode, 0, &bh);
686 if (status) {
687 mlog_errno(status);
688 mlog(ML_ERROR, "failed to read quota file info header "
689 "(type=%d)\n", type);
690 goto out_err;
691 }
692 ldinfo = (struct ocfs2_local_disk_dqinfo *)(bh->b_data +
693 OCFS2_LOCAL_INFO_OFF);
694 info->dqi_flags = le32_to_cpu(ldinfo->dqi_flags);
695 oinfo->dqi_chunks = le32_to_cpu(ldinfo->dqi_chunks);
696 oinfo->dqi_blocks = le32_to_cpu(ldinfo->dqi_blocks);
697 oinfo->dqi_ibh = bh;
698
699 /* We crashed when using local quota file? */
700 if (!(info->dqi_flags & OLQF_CLEAN)) {
701 rec = OCFS2_SB(sb)->quota_rec;
702 if (!rec) {
703 rec = ocfs2_alloc_quota_recovery();
704 if (!rec) {
705 status = -ENOMEM;
706 mlog_errno(status);
707 goto out_err;
708 }
709 OCFS2_SB(sb)->quota_rec = rec;
710 }
711
712 status = ocfs2_recovery_load_quota(lqinode, ldinfo, type,
713 &rec->r_list[type]);
714 if (status < 0) {
715 mlog_errno(status);
716 goto out_err;
717 }
718 }
719
720 status = ocfs2_load_local_quota_bitmaps(lqinode,
721 ldinfo,
722 &oinfo->dqi_chunk);
723 if (status < 0) {
724 mlog_errno(status);
725 goto out_err;
726 }
727
728 /* Now mark quota file as used */
729 info->dqi_flags &= ~OLQF_CLEAN;
730 status = ocfs2_modify_bh(lqinode, bh, olq_update_info, info);
731 if (status < 0) {
732 mlog_errno(status);
733 goto out_err;
734 }
735
736 return 0;
737out_err:
738 if (oinfo) {
739 iput(oinfo->dqi_gqinode);
740 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock);
741 ocfs2_lock_res_free(&oinfo->dqi_gqlock);
742 brelse(oinfo->dqi_lqi_bh);
743 if (locked)
744 ocfs2_inode_unlock(lqinode, 1);
745 ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
746 kfree(oinfo);
747 }
748 brelse(bh);
749 return -1;
750}
751
752/* Write local info to quota file */
753static int ocfs2_local_write_info(struct super_block *sb, int type)
754{
755 struct mem_dqinfo *info = sb_dqinfo(sb, type);
756 struct buffer_head *bh = ((struct ocfs2_mem_dqinfo *)info->dqi_priv)
757 ->dqi_ibh;
758 int status;
759
760 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type], bh, olq_update_info,
761 info);
762 if (status < 0) {
763 mlog_errno(status);
764 return -1;
765 }
766
767 return 0;
768}
769
770/* Release info from memory */
771static int ocfs2_local_free_info(struct super_block *sb, int type)
772{
773 struct mem_dqinfo *info = sb_dqinfo(sb, type);
774 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
775 struct ocfs2_quota_chunk *chunk;
776 struct ocfs2_local_disk_chunk *dchunk;
777 int mark_clean = 1, len;
778 int status;
779
780 /* At this point we know there are no more dquots and thus
781 * even if there's some sync in the pdflush queue, it won't
782 * find any dquots and return without doing anything */
783 cancel_delayed_work_sync(&oinfo->dqi_sync_work);
784 iput(oinfo->dqi_gqinode);
785 ocfs2_simple_drop_lockres(OCFS2_SB(sb), &oinfo->dqi_gqlock);
786 ocfs2_lock_res_free(&oinfo->dqi_gqlock);
787 list_for_each_entry(chunk, &oinfo->dqi_chunk, qc_chunk) {
788 dchunk = (struct ocfs2_local_disk_chunk *)
789 (chunk->qc_headerbh->b_data);
790 if (chunk->qc_num < oinfo->dqi_chunks - 1) {
791 len = ol_chunk_entries(sb);
792 } else {
793 len = (oinfo->dqi_blocks -
794 ol_quota_chunk_block(sb, chunk->qc_num) - 1)
795 * ol_quota_entries_per_block(sb);
796 }
797 /* Not all entries free? Bug! */
798 if (le32_to_cpu(dchunk->dqc_free) != len) {
799 mlog(ML_ERROR, "releasing quota file with used "
800 "entries (type=%d)\n", type);
801 mark_clean = 0;
802 }
803 }
804 ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
805
806 /* dqonoff_mutex protects us against racing with recovery thread... */
807 if (oinfo->dqi_rec) {
808 ocfs2_free_quota_recovery(oinfo->dqi_rec);
809 mark_clean = 0;
810 }
811
812 if (!mark_clean)
813 goto out;
814
815 /* Mark local file as clean */
816 info->dqi_flags |= OLQF_CLEAN;
817 status = ocfs2_modify_bh(sb_dqopt(sb)->files[type],
818 oinfo->dqi_ibh,
819 olq_update_info,
820 info);
821 if (status < 0) {
822 mlog_errno(status);
823 goto out;
824 }
825
826out:
827 ocfs2_inode_unlock(sb_dqopt(sb)->files[type], 1);
828 brelse(oinfo->dqi_ibh);
829 brelse(oinfo->dqi_lqi_bh);
830 kfree(oinfo);
831 return 0;
832}
833
834static void olq_set_dquot(struct buffer_head *bh, void *private)
835{
836 struct ocfs2_dquot *od = private;
837 struct ocfs2_local_disk_dqblk *dqblk;
838 struct super_block *sb = od->dq_dquot.dq_sb;
839
840 dqblk = (struct ocfs2_local_disk_dqblk *)(bh->b_data
841 + ol_dqblk_block_offset(sb, od->dq_local_off));
842
843 dqblk->dqb_id = cpu_to_le64(od->dq_dquot.dq_id);
844 spin_lock(&dq_data_lock);
845 dqblk->dqb_spacemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curspace -
846 od->dq_origspace);
847 dqblk->dqb_inodemod = cpu_to_le64(od->dq_dquot.dq_dqb.dqb_curinodes -
848 od->dq_originodes);
849 spin_unlock(&dq_data_lock);
850 mlog(0, "Writing local dquot %u space %lld inodes %lld\n",
851 od->dq_dquot.dq_id, (long long)le64_to_cpu(dqblk->dqb_spacemod),
852 (long long)le64_to_cpu(dqblk->dqb_inodemod));
853}
854
855/* Write dquot to local quota file */
856static int ocfs2_local_write_dquot(struct dquot *dquot)
857{
858 struct super_block *sb = dquot->dq_sb;
859 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
860 struct buffer_head *bh = NULL;
861 int status;
862
863 status = ocfs2_read_quota_block(sb_dqopt(sb)->files[dquot->dq_type],
864 ol_dqblk_file_block(sb, od->dq_local_off),
865 &bh);
866 if (status) {
867 mlog_errno(status);
868 goto out;
869 }
870 status = ocfs2_modify_bh(sb_dqopt(sb)->files[dquot->dq_type], bh,
871 olq_set_dquot, od);
872 if (status < 0) {
873 mlog_errno(status);
874 goto out;
875 }
876out:
877 brelse(bh);
878 return status;
879}
880
881/* Find free entry in local quota file */
882static struct ocfs2_quota_chunk *ocfs2_find_free_entry(struct super_block *sb,
883 int type,
884 int *offset)
885{
886 struct mem_dqinfo *info = sb_dqinfo(sb, type);
887 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
888 struct ocfs2_quota_chunk *chunk;
889 struct ocfs2_local_disk_chunk *dchunk;
890 int found = 0, len;
891
892 list_for_each_entry(chunk, &oinfo->dqi_chunk, qc_chunk) {
893 dchunk = (struct ocfs2_local_disk_chunk *)
894 chunk->qc_headerbh->b_data;
895 if (le32_to_cpu(dchunk->dqc_free) > 0) {
896 found = 1;
897 break;
898 }
899 }
900 if (!found)
901 return NULL;
902
903 if (chunk->qc_num < oinfo->dqi_chunks - 1) {
904 len = ol_chunk_entries(sb);
905 } else {
906 len = (oinfo->dqi_blocks -
907 ol_quota_chunk_block(sb, chunk->qc_num) - 1)
908 * ol_quota_entries_per_block(sb);
909 }
910
911 found = ocfs2_find_next_zero_bit(dchunk->dqc_bitmap, len, 0);
912 /* We failed? */
913 if (found == len) {
914 mlog(ML_ERROR, "Did not find empty entry in chunk %d with %u"
915 " entries free (type=%d)\n", chunk->qc_num,
916 le32_to_cpu(dchunk->dqc_free), type);
917 return ERR_PTR(-EIO);
918 }
919 *offset = found;
920 return chunk;
921}
922
923/* Add new chunk to the local quota file */
924static struct ocfs2_quota_chunk *ocfs2_local_quota_add_chunk(
925 struct super_block *sb,
926 int type,
927 int *offset)
928{
929 struct mem_dqinfo *info = sb_dqinfo(sb, type);
930 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
931 struct inode *lqinode = sb_dqopt(sb)->files[type];
932 struct ocfs2_quota_chunk *chunk = NULL;
933 struct ocfs2_local_disk_chunk *dchunk;
934 int status;
935 handle_t *handle;
936 struct buffer_head *bh = NULL;
937 u64 p_blkno;
938
939 /* We are protected by dqio_sem so no locking needed */
940 status = ocfs2_extend_no_holes(lqinode,
941 lqinode->i_size + 2 * sb->s_blocksize,
942 lqinode->i_size);
943 if (status < 0) {
944 mlog_errno(status);
945 goto out;
946 }
947 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh,
948 lqinode->i_size + 2 * sb->s_blocksize);
949 if (status < 0) {
950 mlog_errno(status);
951 goto out;
952 }
953
954 chunk = kmem_cache_alloc(ocfs2_qf_chunk_cachep, GFP_NOFS);
955 if (!chunk) {
956 status = -ENOMEM;
957 mlog_errno(status);
958 goto out;
959 }
960
961 down_read(&OCFS2_I(lqinode)->ip_alloc_sem);
962 status = ocfs2_extent_map_get_blocks(lqinode, oinfo->dqi_blocks,
963 &p_blkno, NULL, NULL);
964 up_read(&OCFS2_I(lqinode)->ip_alloc_sem);
965 if (status < 0) {
966 mlog_errno(status);
967 goto out;
968 }
969 bh = sb_getblk(sb, p_blkno);
970 if (!bh) {
971 status = -ENOMEM;
972 mlog_errno(status);
973 goto out;
974 }
975 dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data;
976
977 handle = ocfs2_start_trans(OCFS2_SB(sb), 2);
978 if (IS_ERR(handle)) {
979 status = PTR_ERR(handle);
980 mlog_errno(status);
981 goto out;
982 }
983
984 status = ocfs2_journal_access_dq(handle, lqinode, bh,
985 OCFS2_JOURNAL_ACCESS_WRITE);
986 if (status < 0) {
987 mlog_errno(status);
988 goto out_trans;
989 }
990 lock_buffer(bh);
991 dchunk->dqc_free = cpu_to_le32(ol_quota_entries_per_block(sb));
992 memset(dchunk->dqc_bitmap, 0,
993 sb->s_blocksize - sizeof(struct ocfs2_local_disk_chunk) -
994 OCFS2_QBLK_RESERVED_SPACE);
995 set_buffer_uptodate(bh);
996 unlock_buffer(bh);
997 status = ocfs2_journal_dirty(handle, bh);
998 if (status < 0) {
999 mlog_errno(status);
1000 goto out_trans;
1001 }
1002
1003 oinfo->dqi_blocks += 2;
1004 oinfo->dqi_chunks++;
1005 status = ocfs2_local_write_info(sb, type);
1006 if (status < 0) {
1007 mlog_errno(status);
1008 goto out_trans;
1009 }
1010 status = ocfs2_commit_trans(OCFS2_SB(sb), handle);
1011 if (status < 0) {
1012 mlog_errno(status);
1013 goto out;
1014 }
1015
1016 list_add_tail(&chunk->qc_chunk, &oinfo->dqi_chunk);
1017 chunk->qc_num = list_entry(chunk->qc_chunk.prev,
1018 struct ocfs2_quota_chunk,
1019 qc_chunk)->qc_num + 1;
1020 chunk->qc_headerbh = bh;
1021 *offset = 0;
1022 return chunk;
1023out_trans:
1024 ocfs2_commit_trans(OCFS2_SB(sb), handle);
1025out:
1026 brelse(bh);
1027 kmem_cache_free(ocfs2_qf_chunk_cachep, chunk);
1028 return ERR_PTR(status);
1029}
1030
1031/* Find free entry in local quota file */
1032static struct ocfs2_quota_chunk *ocfs2_extend_local_quota_file(
1033 struct super_block *sb,
1034 int type,
1035 int *offset)
1036{
1037 struct mem_dqinfo *info = sb_dqinfo(sb, type);
1038 struct ocfs2_mem_dqinfo *oinfo = info->dqi_priv;
1039 struct ocfs2_quota_chunk *chunk;
1040 struct inode *lqinode = sb_dqopt(sb)->files[type];
1041 struct ocfs2_local_disk_chunk *dchunk;
1042 int epb = ol_quota_entries_per_block(sb);
1043 unsigned int chunk_blocks;
1044 int status;
1045 handle_t *handle;
1046
1047 if (list_empty(&oinfo->dqi_chunk))
1048 return ocfs2_local_quota_add_chunk(sb, type, offset);
1049 /* Is the last chunk full? */
1050 chunk = list_entry(oinfo->dqi_chunk.prev,
1051 struct ocfs2_quota_chunk, qc_chunk);
1052 chunk_blocks = oinfo->dqi_blocks -
1053 ol_quota_chunk_block(sb, chunk->qc_num) - 1;
1054 if (ol_chunk_blocks(sb) == chunk_blocks)
1055 return ocfs2_local_quota_add_chunk(sb, type, offset);
1056
1057 /* We are protected by dqio_sem so no locking needed */
1058 status = ocfs2_extend_no_holes(lqinode,
1059 lqinode->i_size + sb->s_blocksize,
1060 lqinode->i_size);
1061 if (status < 0) {
1062 mlog_errno(status);
1063 goto out;
1064 }
1065 status = ocfs2_simple_size_update(lqinode, oinfo->dqi_lqi_bh,
1066 lqinode->i_size + sb->s_blocksize);
1067 if (status < 0) {
1068 mlog_errno(status);
1069 goto out;
1070 }
1071 handle = ocfs2_start_trans(OCFS2_SB(sb), 2);
1072 if (IS_ERR(handle)) {
1073 status = PTR_ERR(handle);
1074 mlog_errno(status);
1075 goto out;
1076 }
1077 status = ocfs2_journal_access_dq(handle, lqinode, chunk->qc_headerbh,
1078 OCFS2_JOURNAL_ACCESS_WRITE);
1079 if (status < 0) {
1080 mlog_errno(status);
1081 goto out_trans;
1082 }
1083
1084 dchunk = (struct ocfs2_local_disk_chunk *)chunk->qc_headerbh->b_data;
1085 lock_buffer(chunk->qc_headerbh);
1086 le32_add_cpu(&dchunk->dqc_free, ol_quota_entries_per_block(sb));
1087 unlock_buffer(chunk->qc_headerbh);
1088 status = ocfs2_journal_dirty(handle, chunk->qc_headerbh);
1089 if (status < 0) {
1090 mlog_errno(status);
1091 goto out_trans;
1092 }
1093 oinfo->dqi_blocks++;
1094 status = ocfs2_local_write_info(sb, type);
1095 if (status < 0) {
1096 mlog_errno(status);
1097 goto out_trans;
1098 }
1099
1100 status = ocfs2_commit_trans(OCFS2_SB(sb), handle);
1101 if (status < 0) {
1102 mlog_errno(status);
1103 goto out;
1104 }
1105 *offset = chunk_blocks * epb;
1106 return chunk;
1107out_trans:
1108 ocfs2_commit_trans(OCFS2_SB(sb), handle);
1109out:
1110 return ERR_PTR(status);
1111}
1112
1113static void olq_alloc_dquot(struct buffer_head *bh, void *private)
1114{
1115 int *offset = private;
1116 struct ocfs2_local_disk_chunk *dchunk;
1117
1118 dchunk = (struct ocfs2_local_disk_chunk *)bh->b_data;
1119 ocfs2_set_bit(*offset, dchunk->dqc_bitmap);
1120 le32_add_cpu(&dchunk->dqc_free, -1);
1121}
1122
1123/* Create dquot in the local file for given id */
1124static int ocfs2_create_local_dquot(struct dquot *dquot)
1125{
1126 struct super_block *sb = dquot->dq_sb;
1127 int type = dquot->dq_type;
1128 struct inode *lqinode = sb_dqopt(sb)->files[type];
1129 struct ocfs2_quota_chunk *chunk;
1130 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
1131 int offset;
1132 int status;
1133
1134 chunk = ocfs2_find_free_entry(sb, type, &offset);
1135 if (!chunk) {
1136 chunk = ocfs2_extend_local_quota_file(sb, type, &offset);
1137 if (IS_ERR(chunk))
1138 return PTR_ERR(chunk);
1139 } else if (IS_ERR(chunk)) {
1140 return PTR_ERR(chunk);
1141 }
1142 od->dq_local_off = ol_dqblk_off(sb, chunk->qc_num, offset);
1143 od->dq_chunk = chunk;
1144
1145 /* Initialize dquot structure on disk */
1146 status = ocfs2_local_write_dquot(dquot);
1147 if (status < 0) {
1148 mlog_errno(status);
1149 goto out;
1150 }
1151
1152 /* Mark structure as allocated */
1153 status = ocfs2_modify_bh(lqinode, chunk->qc_headerbh, olq_alloc_dquot,
1154 &offset);
1155 if (status < 0) {
1156 mlog_errno(status);
1157 goto out;
1158 }
1159out:
1160 return status;
1161}
1162
1163/* Create entry in local file for dquot, load data from the global file */
1164static int ocfs2_local_read_dquot(struct dquot *dquot)
1165{
1166 int status;
1167
1168 mlog_entry("id=%u, type=%d\n", dquot->dq_id, dquot->dq_type);
1169
1170 status = ocfs2_global_read_dquot(dquot);
1171 if (status < 0) {
1172 mlog_errno(status);
1173 goto out_err;
1174 }
1175
1176 /* Now create entry in the local quota file */
1177 status = ocfs2_create_local_dquot(dquot);
1178 if (status < 0) {
1179 mlog_errno(status);
1180 goto out_err;
1181 }
1182 mlog_exit(0);
1183 return 0;
1184out_err:
1185 mlog_exit(status);
1186 return status;
1187}
1188
1189/* Release dquot structure from local quota file. ocfs2_release_dquot() has
1190 * already started a transaction and obtained exclusive lock for global
1191 * quota file. */
1192static int ocfs2_local_release_dquot(struct dquot *dquot)
1193{
1194 int status;
1195 int type = dquot->dq_type;
1196 struct ocfs2_dquot *od = OCFS2_DQUOT(dquot);
1197 struct super_block *sb = dquot->dq_sb;
1198 struct ocfs2_local_disk_chunk *dchunk;
1199 int offset;
1200 handle_t *handle = journal_current_handle();
1201
1202 BUG_ON(!handle);
1203 /* First write all local changes to global file */
1204 status = ocfs2_global_release_dquot(dquot);
1205 if (status < 0) {
1206 mlog_errno(status);
1207 goto out;
1208 }
1209
1210 status = ocfs2_journal_access_dq(handle, sb_dqopt(sb)->files[type],
1211 od->dq_chunk->qc_headerbh, OCFS2_JOURNAL_ACCESS_WRITE);
1212 if (status < 0) {
1213 mlog_errno(status);
1214 goto out;
1215 }
1216 offset = ol_dqblk_chunk_off(sb, od->dq_chunk->qc_num,
1217 od->dq_local_off);
1218 dchunk = (struct ocfs2_local_disk_chunk *)
1219 (od->dq_chunk->qc_headerbh->b_data);
1220 /* Mark structure as freed */
1221 lock_buffer(od->dq_chunk->qc_headerbh);
1222 ocfs2_clear_bit(offset, dchunk->dqc_bitmap);
1223 le32_add_cpu(&dchunk->dqc_free, 1);
1224 unlock_buffer(od->dq_chunk->qc_headerbh);
1225 status = ocfs2_journal_dirty(handle, od->dq_chunk->qc_headerbh);
1226 if (status < 0) {
1227 mlog_errno(status);
1228 goto out;
1229 }
1230 status = 0;
1231out:
1232 /* Clear the read bit so that next time someone uses this
1233 * dquot he reads fresh info from disk and allocates local
1234 * dquot structure */
1235 clear_bit(DQ_READ_B, &dquot->dq_flags);
1236 return status;
1237}
1238
1239static struct quota_format_ops ocfs2_format_ops = {
1240 .check_quota_file = ocfs2_local_check_quota_file,
1241 .read_file_info = ocfs2_local_read_info,
1242 .write_file_info = ocfs2_global_write_info,
1243 .free_file_info = ocfs2_local_free_info,
1244 .read_dqblk = ocfs2_local_read_dquot,
1245 .commit_dqblk = ocfs2_local_write_dquot,
1246 .release_dqblk = ocfs2_local_release_dquot,
1247};
1248
1249struct quota_format_type ocfs2_quota_format = {
1250 .qf_fmt_id = QFMT_OCFS2,
1251 .qf_ops = &ocfs2_format_ops,
1252 .qf_owner = THIS_MODULE
1253};
diff --git a/fs/ocfs2/resize.c b/fs/ocfs2/resize.c
index ffd48db229a7..424adaa5f900 100644
--- a/fs/ocfs2/resize.c
+++ b/fs/ocfs2/resize.c
@@ -106,8 +106,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n", 106 mlog_entry("(new_clusters=%d, first_new_cluster = %u)\n",
107 new_clusters, first_new_cluster); 107 new_clusters, first_new_cluster);
108 108
109 ret = ocfs2_journal_access(handle, bm_inode, group_bh, 109 ret = ocfs2_journal_access_gd(handle, bm_inode, group_bh,
110 OCFS2_JOURNAL_ACCESS_WRITE); 110 OCFS2_JOURNAL_ACCESS_WRITE);
111 if (ret < 0) { 111 if (ret < 0) {
112 mlog_errno(ret); 112 mlog_errno(ret);
113 goto out; 113 goto out;
@@ -141,8 +141,8 @@ static int ocfs2_update_last_group_and_inode(handle_t *handle,
141 } 141 }
142 142
143 /* update the inode accordingly. */ 143 /* update the inode accordingly. */
144 ret = ocfs2_journal_access(handle, bm_inode, bm_bh, 144 ret = ocfs2_journal_access_di(handle, bm_inode, bm_bh,
145 OCFS2_JOURNAL_ACCESS_WRITE); 145 OCFS2_JOURNAL_ACCESS_WRITE);
146 if (ret < 0) { 146 if (ret < 0) {
147 mlog_errno(ret); 147 mlog_errno(ret);
148 goto out_rollback; 148 goto out_rollback;
@@ -314,6 +314,10 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters)
314 314
315 fe = (struct ocfs2_dinode *)main_bm_bh->b_data; 315 fe = (struct ocfs2_dinode *)main_bm_bh->b_data;
316 316
317 /* main_bm_bh is validated by inode read inside ocfs2_inode_lock(),
318 * so any corruption is a code bug. */
319 BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
320
317 if (le16_to_cpu(fe->id2.i_chain.cl_cpg) != 321 if (le16_to_cpu(fe->id2.i_chain.cl_cpg) !=
318 ocfs2_group_bitmap_size(osb->sb) * 8) { 322 ocfs2_group_bitmap_size(osb->sb) * 8) {
319 mlog(ML_ERROR, "The disk is too old and small. " 323 mlog(ML_ERROR, "The disk is too old and small. "
@@ -322,30 +326,18 @@ int ocfs2_group_extend(struct inode * inode, int new_clusters)
322 goto out_unlock; 326 goto out_unlock;
323 } 327 }
324 328
325 if (!OCFS2_IS_VALID_DINODE(fe)) {
326 OCFS2_RO_ON_INVALID_DINODE(main_bm_inode->i_sb, fe);
327 ret = -EIO;
328 goto out_unlock;
329 }
330
331 first_new_cluster = le32_to_cpu(fe->i_clusters); 329 first_new_cluster = le32_to_cpu(fe->i_clusters);
332 lgd_blkno = ocfs2_which_cluster_group(main_bm_inode, 330 lgd_blkno = ocfs2_which_cluster_group(main_bm_inode,
333 first_new_cluster - 1); 331 first_new_cluster - 1);
334 332
335 ret = ocfs2_read_block(main_bm_inode, lgd_blkno, &group_bh); 333 ret = ocfs2_read_group_descriptor(main_bm_inode, fe, lgd_blkno,
334 &group_bh);
336 if (ret < 0) { 335 if (ret < 0) {
337 mlog_errno(ret); 336 mlog_errno(ret);
338 goto out_unlock; 337 goto out_unlock;
339 } 338 }
340
341 group = (struct ocfs2_group_desc *)group_bh->b_data; 339 group = (struct ocfs2_group_desc *)group_bh->b_data;
342 340
343 ret = ocfs2_check_group_descriptor(inode->i_sb, fe, group);
344 if (ret) {
345 mlog_errno(ret);
346 goto out_unlock;
347 }
348
349 cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc); 341 cl_bpc = le16_to_cpu(fe->id2.i_chain.cl_bpc);
350 if (le16_to_cpu(group->bg_bits) / cl_bpc + new_clusters > 342 if (le16_to_cpu(group->bg_bits) / cl_bpc + new_clusters >
351 le16_to_cpu(fe->id2.i_chain.cl_cpg)) { 343 le16_to_cpu(fe->id2.i_chain.cl_cpg)) {
@@ -398,41 +390,16 @@ static int ocfs2_check_new_group(struct inode *inode,
398 struct buffer_head *group_bh) 390 struct buffer_head *group_bh)
399{ 391{
400 int ret; 392 int ret;
401 struct ocfs2_group_desc *gd; 393 struct ocfs2_group_desc *gd =
394 (struct ocfs2_group_desc *)group_bh->b_data;
402 u16 cl_bpc = le16_to_cpu(di->id2.i_chain.cl_bpc); 395 u16 cl_bpc = le16_to_cpu(di->id2.i_chain.cl_bpc);
403 unsigned int max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) *
404 le16_to_cpu(di->id2.i_chain.cl_bpc);
405
406 396
407 gd = (struct ocfs2_group_desc *)group_bh->b_data; 397 ret = ocfs2_check_group_descriptor(inode->i_sb, di, group_bh);
398 if (ret)
399 goto out;
408 400
409 ret = -EIO; 401 ret = -EINVAL;
410 if (!OCFS2_IS_VALID_GROUP_DESC(gd)) 402 if (le16_to_cpu(gd->bg_chain) != input->chain)
411 mlog(ML_ERROR, "Group descriptor # %llu isn't valid.\n",
412 (unsigned long long)le64_to_cpu(gd->bg_blkno));
413 else if (di->i_blkno != gd->bg_parent_dinode)
414 mlog(ML_ERROR, "Group descriptor # %llu has bad parent "
415 "pointer (%llu, expected %llu)\n",
416 (unsigned long long)le64_to_cpu(gd->bg_blkno),
417 (unsigned long long)le64_to_cpu(gd->bg_parent_dinode),
418 (unsigned long long)le64_to_cpu(di->i_blkno));
419 else if (le16_to_cpu(gd->bg_bits) > max_bits)
420 mlog(ML_ERROR, "Group descriptor # %llu has bit count of %u\n",
421 (unsigned long long)le64_to_cpu(gd->bg_blkno),
422 le16_to_cpu(gd->bg_bits));
423 else if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits))
424 mlog(ML_ERROR, "Group descriptor # %llu has bit count %u but "
425 "claims that %u are free\n",
426 (unsigned long long)le64_to_cpu(gd->bg_blkno),
427 le16_to_cpu(gd->bg_bits),
428 le16_to_cpu(gd->bg_free_bits_count));
429 else if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size)))
430 mlog(ML_ERROR, "Group descriptor # %llu has bit count %u but "
431 "max bitmap bits of %u\n",
432 (unsigned long long)le64_to_cpu(gd->bg_blkno),
433 le16_to_cpu(gd->bg_bits),
434 8 * le16_to_cpu(gd->bg_size));
435 else if (le16_to_cpu(gd->bg_chain) != input->chain)
436 mlog(ML_ERROR, "Group descriptor # %llu has bad chain %u " 403 mlog(ML_ERROR, "Group descriptor # %llu has bad chain %u "
437 "while input has %u set.\n", 404 "while input has %u set.\n",
438 (unsigned long long)le64_to_cpu(gd->bg_blkno), 405 (unsigned long long)le64_to_cpu(gd->bg_blkno),
@@ -451,6 +418,7 @@ static int ocfs2_check_new_group(struct inode *inode,
451 else 418 else
452 ret = 0; 419 ret = 0;
453 420
421out:
454 return ret; 422 return ret;
455} 423}
456 424
@@ -568,8 +536,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
568 cl = &fe->id2.i_chain; 536 cl = &fe->id2.i_chain;
569 cr = &cl->cl_recs[input->chain]; 537 cr = &cl->cl_recs[input->chain];
570 538
571 ret = ocfs2_journal_access(handle, main_bm_inode, group_bh, 539 ret = ocfs2_journal_access_gd(handle, main_bm_inode, group_bh,
572 OCFS2_JOURNAL_ACCESS_WRITE); 540 OCFS2_JOURNAL_ACCESS_WRITE);
573 if (ret < 0) { 541 if (ret < 0) {
574 mlog_errno(ret); 542 mlog_errno(ret);
575 goto out_commit; 543 goto out_commit;
@@ -584,8 +552,8 @@ int ocfs2_group_add(struct inode *inode, struct ocfs2_new_group_input *input)
584 goto out_commit; 552 goto out_commit;
585 } 553 }
586 554
587 ret = ocfs2_journal_access(handle, main_bm_inode, main_bm_bh, 555 ret = ocfs2_journal_access_di(handle, main_bm_inode, main_bm_bh,
588 OCFS2_JOURNAL_ACCESS_WRITE); 556 OCFS2_JOURNAL_ACCESS_WRITE);
589 if (ret < 0) { 557 if (ret < 0) {
590 mlog_errno(ret); 558 mlog_errno(ret);
591 goto out_commit; 559 goto out_commit;
diff --git a/fs/ocfs2/slot_map.c b/fs/ocfs2/slot_map.c
index bdda2d8f8508..40661e7824e9 100644
--- a/fs/ocfs2/slot_map.c
+++ b/fs/ocfs2/slot_map.c
@@ -151,7 +151,7 @@ int ocfs2_refresh_slot_info(struct ocfs2_super *osb)
151 * this is not true, the read of -1 (UINT64_MAX) will fail. 151 * this is not true, the read of -1 (UINT64_MAX) will fail.
152 */ 152 */
153 ret = ocfs2_read_blocks(si->si_inode, -1, si->si_blocks, si->si_bh, 153 ret = ocfs2_read_blocks(si->si_inode, -1, si->si_blocks, si->si_bh,
154 OCFS2_BH_IGNORE_CACHE); 154 OCFS2_BH_IGNORE_CACHE, NULL);
155 if (ret == 0) { 155 if (ret == 0) {
156 spin_lock(&osb->osb_lock); 156 spin_lock(&osb->osb_lock);
157 ocfs2_update_slot_info(si); 157 ocfs2_update_slot_info(si);
@@ -405,7 +405,7 @@ static int ocfs2_map_slot_buffers(struct ocfs2_super *osb,
405 405
406 bh = NULL; /* Acquire a fresh bh */ 406 bh = NULL; /* Acquire a fresh bh */
407 status = ocfs2_read_blocks(si->si_inode, blkno, 1, &bh, 407 status = ocfs2_read_blocks(si->si_inode, blkno, 1, &bh,
408 OCFS2_BH_IGNORE_CACHE); 408 OCFS2_BH_IGNORE_CACHE, NULL);
409 if (status < 0) { 409 if (status < 0) {
410 mlog_errno(status); 410 mlog_errno(status);
411 goto bail; 411 goto bail;
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c
index c5ff18b46b57..a69628603e18 100644
--- a/fs/ocfs2/suballoc.c
+++ b/fs/ocfs2/suballoc.c
@@ -35,6 +35,7 @@
35#include "ocfs2.h" 35#include "ocfs2.h"
36 36
37#include "alloc.h" 37#include "alloc.h"
38#include "blockcheck.h"
38#include "dlmglue.h" 39#include "dlmglue.h"
39#include "inode.h" 40#include "inode.h"
40#include "journal.h" 41#include "journal.h"
@@ -145,62 +146,183 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl)
145 return (u32)le16_to_cpu(cl->cl_cpg) * (u32)le16_to_cpu(cl->cl_bpc); 146 return (u32)le16_to_cpu(cl->cl_cpg) * (u32)le16_to_cpu(cl->cl_bpc);
146} 147}
147 148
148/* somewhat more expensive than our other checks, so use sparingly. */ 149#define do_error(fmt, ...) \
149int ocfs2_check_group_descriptor(struct super_block *sb, 150 do{ \
150 struct ocfs2_dinode *di, 151 if (clean_error) \
151 struct ocfs2_group_desc *gd) 152 mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \
153 else \
154 ocfs2_error(sb, fmt, ##__VA_ARGS__); \
155 } while (0)
156
157static int ocfs2_validate_gd_self(struct super_block *sb,
158 struct buffer_head *bh,
159 int clean_error)
152{ 160{
153 unsigned int max_bits; 161 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
154 162
155 if (!OCFS2_IS_VALID_GROUP_DESC(gd)) { 163 if (!OCFS2_IS_VALID_GROUP_DESC(gd)) {
156 OCFS2_RO_ON_INVALID_GROUP_DESC(sb, gd); 164 do_error("Group descriptor #%llu has bad signature %.*s",
157 return -EIO; 165 (unsigned long long)bh->b_blocknr, 7,
166 gd->bg_signature);
167 return -EINVAL;
158 } 168 }
159 169
170 if (le64_to_cpu(gd->bg_blkno) != bh->b_blocknr) {
171 do_error("Group descriptor #%llu has an invalid bg_blkno "
172 "of %llu",
173 (unsigned long long)bh->b_blocknr,
174 (unsigned long long)le64_to_cpu(gd->bg_blkno));
175 return -EINVAL;
176 }
177
178 if (le32_to_cpu(gd->bg_generation) != OCFS2_SB(sb)->fs_generation) {
179 do_error("Group descriptor #%llu has an invalid "
180 "fs_generation of #%u",
181 (unsigned long long)bh->b_blocknr,
182 le32_to_cpu(gd->bg_generation));
183 return -EINVAL;
184 }
185
186 if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) {
187 do_error("Group descriptor #%llu has bit count %u but "
188 "claims that %u are free",
189 (unsigned long long)bh->b_blocknr,
190 le16_to_cpu(gd->bg_bits),
191 le16_to_cpu(gd->bg_free_bits_count));
192 return -EINVAL;
193 }
194
195 if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) {
196 do_error("Group descriptor #%llu has bit count %u but "
197 "max bitmap bits of %u",
198 (unsigned long long)bh->b_blocknr,
199 le16_to_cpu(gd->bg_bits),
200 8 * le16_to_cpu(gd->bg_size));
201 return -EINVAL;
202 }
203
204 return 0;
205}
206
207static int ocfs2_validate_gd_parent(struct super_block *sb,
208 struct ocfs2_dinode *di,
209 struct buffer_head *bh,
210 int clean_error)
211{
212 unsigned int max_bits;
213 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
214
160 if (di->i_blkno != gd->bg_parent_dinode) { 215 if (di->i_blkno != gd->bg_parent_dinode) {
161 ocfs2_error(sb, "Group descriptor # %llu has bad parent " 216 do_error("Group descriptor #%llu has bad parent "
162 "pointer (%llu, expected %llu)", 217 "pointer (%llu, expected %llu)",
163 (unsigned long long)le64_to_cpu(gd->bg_blkno), 218 (unsigned long long)bh->b_blocknr,
164 (unsigned long long)le64_to_cpu(gd->bg_parent_dinode), 219 (unsigned long long)le64_to_cpu(gd->bg_parent_dinode),
165 (unsigned long long)le64_to_cpu(di->i_blkno)); 220 (unsigned long long)le64_to_cpu(di->i_blkno));
166 return -EIO; 221 return -EINVAL;
167 } 222 }
168 223
169 max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); 224 max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc);
170 if (le16_to_cpu(gd->bg_bits) > max_bits) { 225 if (le16_to_cpu(gd->bg_bits) > max_bits) {
171 ocfs2_error(sb, "Group descriptor # %llu has bit count of %u", 226 do_error("Group descriptor #%llu has bit count of %u",
172 (unsigned long long)le64_to_cpu(gd->bg_blkno), 227 (unsigned long long)bh->b_blocknr,
173 le16_to_cpu(gd->bg_bits)); 228 le16_to_cpu(gd->bg_bits));
174 return -EIO; 229 return -EINVAL;
175 } 230 }
176 231
177 if (le16_to_cpu(gd->bg_chain) >= 232 if (le16_to_cpu(gd->bg_chain) >=
178 le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) { 233 le16_to_cpu(di->id2.i_chain.cl_next_free_rec)) {
179 ocfs2_error(sb, "Group descriptor # %llu has bad chain %u", 234 do_error("Group descriptor #%llu has bad chain %u",
180 (unsigned long long)le64_to_cpu(gd->bg_blkno), 235 (unsigned long long)bh->b_blocknr,
181 le16_to_cpu(gd->bg_chain)); 236 le16_to_cpu(gd->bg_chain));
182 return -EIO; 237 return -EINVAL;
183 } 238 }
184 239
185 if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) { 240 return 0;
186 ocfs2_error(sb, "Group descriptor # %llu has bit count %u but " 241}
187 "claims that %u are free",
188 (unsigned long long)le64_to_cpu(gd->bg_blkno),
189 le16_to_cpu(gd->bg_bits),
190 le16_to_cpu(gd->bg_free_bits_count));
191 return -EIO;
192 }
193 242
194 if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) { 243#undef do_error
195 ocfs2_error(sb, "Group descriptor # %llu has bit count %u but " 244
196 "max bitmap bits of %u", 245/*
197 (unsigned long long)le64_to_cpu(gd->bg_blkno), 246 * This version only prints errors. It does not fail the filesystem, and
198 le16_to_cpu(gd->bg_bits), 247 * exists only for resize.
199 8 * le16_to_cpu(gd->bg_size)); 248 */
200 return -EIO; 249int ocfs2_check_group_descriptor(struct super_block *sb,
250 struct ocfs2_dinode *di,
251 struct buffer_head *bh)
252{
253 int rc;
254 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
255
256 BUG_ON(!buffer_uptodate(bh));
257
258 /*
259 * If the ecc fails, we return the error but otherwise
260 * leave the filesystem running. We know any error is
261 * local to this block.
262 */
263 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &gd->bg_check);
264 if (rc) {
265 mlog(ML_ERROR,
266 "Checksum failed for group descriptor %llu\n",
267 (unsigned long long)bh->b_blocknr);
268 } else
269 rc = ocfs2_validate_gd_self(sb, bh, 1);
270 if (!rc)
271 rc = ocfs2_validate_gd_parent(sb, di, bh, 1);
272
273 return rc;
274}
275
276static int ocfs2_validate_group_descriptor(struct super_block *sb,
277 struct buffer_head *bh)
278{
279 int rc;
280 struct ocfs2_group_desc *gd = (struct ocfs2_group_desc *)bh->b_data;
281
282 mlog(0, "Validating group descriptor %llu\n",
283 (unsigned long long)bh->b_blocknr);
284
285 BUG_ON(!buffer_uptodate(bh));
286
287 /*
288 * If the ecc fails, we return the error but otherwise
289 * leave the filesystem running. We know any error is
290 * local to this block.
291 */
292 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &gd->bg_check);
293 if (rc)
294 return rc;
295
296 /*
297 * Errors after here are fatal.
298 */
299
300 return ocfs2_validate_gd_self(sb, bh, 0);
301}
302
303int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di,
304 u64 gd_blkno, struct buffer_head **bh)
305{
306 int rc;
307 struct buffer_head *tmp = *bh;
308
309 rc = ocfs2_read_block(inode, gd_blkno, &tmp,
310 ocfs2_validate_group_descriptor);
311 if (rc)
312 goto out;
313
314 rc = ocfs2_validate_gd_parent(inode->i_sb, di, tmp, 0);
315 if (rc) {
316 brelse(tmp);
317 goto out;
201 } 318 }
202 319
203 return 0; 320 /* If ocfs2_read_block() got us a new bh, pass it up. */
321 if (!*bh)
322 *bh = tmp;
323
324out:
325 return rc;
204} 326}
205 327
206static int ocfs2_block_group_fill(handle_t *handle, 328static int ocfs2_block_group_fill(handle_t *handle,
@@ -225,10 +347,10 @@ static int ocfs2_block_group_fill(handle_t *handle,
225 goto bail; 347 goto bail;
226 } 348 }
227 349
228 status = ocfs2_journal_access(handle, 350 status = ocfs2_journal_access_gd(handle,
229 alloc_inode, 351 alloc_inode,
230 bg_bh, 352 bg_bh,
231 OCFS2_JOURNAL_ACCESS_CREATE); 353 OCFS2_JOURNAL_ACCESS_CREATE);
232 if (status < 0) { 354 if (status < 0) {
233 mlog_errno(status); 355 mlog_errno(status);
234 goto bail; 356 goto bail;
@@ -358,8 +480,8 @@ static int ocfs2_block_group_alloc(struct ocfs2_super *osb,
358 480
359 bg = (struct ocfs2_group_desc *) bg_bh->b_data; 481 bg = (struct ocfs2_group_desc *) bg_bh->b_data;
360 482
361 status = ocfs2_journal_access(handle, alloc_inode, 483 status = ocfs2_journal_access_di(handle, alloc_inode,
362 bh, OCFS2_JOURNAL_ACCESS_WRITE); 484 bh, OCFS2_JOURNAL_ACCESS_WRITE);
363 if (status < 0) { 485 if (status < 0) {
364 mlog_errno(status); 486 mlog_errno(status);
365 goto bail; 487 goto bail;
@@ -441,11 +563,11 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb,
441 ac->ac_alloc_slot = slot; 563 ac->ac_alloc_slot = slot;
442 564
443 fe = (struct ocfs2_dinode *) bh->b_data; 565 fe = (struct ocfs2_dinode *) bh->b_data;
444 if (!OCFS2_IS_VALID_DINODE(fe)) { 566
445 OCFS2_RO_ON_INVALID_DINODE(alloc_inode->i_sb, fe); 567 /* The bh was validated by the inode read inside
446 status = -EIO; 568 * ocfs2_inode_lock(). Any corruption is a code bug. */
447 goto bail; 569 BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
448 } 570
449 if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) { 571 if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) {
450 ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator %llu", 572 ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator %llu",
451 (unsigned long long)le64_to_cpu(fe->i_blkno)); 573 (unsigned long long)le64_to_cpu(fe->i_blkno));
@@ -790,10 +912,9 @@ static int ocfs2_block_group_find_clear_bits(struct ocfs2_super *osb,
790 int offset, start, found, status = 0; 912 int offset, start, found, status = 0;
791 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; 913 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
792 914
793 if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { 915 /* Callers got this descriptor from
794 OCFS2_RO_ON_INVALID_GROUP_DESC(osb->sb, bg); 916 * ocfs2_read_group_descriptor(). Any corruption is a code bug. */
795 return -EIO; 917 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg));
796 }
797 918
798 found = start = best_offset = best_size = 0; 919 found = start = best_offset = best_size = 0;
799 bitmap = bg->bg_bitmap; 920 bitmap = bg->bg_bitmap;
@@ -858,11 +979,9 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
858 979
859 mlog_entry_void(); 980 mlog_entry_void();
860 981
861 if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { 982 /* All callers get the descriptor via
862 OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); 983 * ocfs2_read_group_descriptor(). Any corruption is a code bug. */
863 status = -EIO; 984 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg));
864 goto bail;
865 }
866 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits); 985 BUG_ON(le16_to_cpu(bg->bg_free_bits_count) < num_bits);
867 986
868 mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off, 987 mlog(0, "block_group_set_bits: off = %u, num = %u\n", bit_off,
@@ -871,10 +990,10 @@ static inline int ocfs2_block_group_set_bits(handle_t *handle,
871 if (ocfs2_is_cluster_bitmap(alloc_inode)) 990 if (ocfs2_is_cluster_bitmap(alloc_inode))
872 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 991 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
873 992
874 status = ocfs2_journal_access(handle, 993 status = ocfs2_journal_access_gd(handle,
875 alloc_inode, 994 alloc_inode,
876 group_bh, 995 group_bh,
877 journal_type); 996 journal_type);
878 if (status < 0) { 997 if (status < 0) {
879 mlog_errno(status); 998 mlog_errno(status);
880 goto bail; 999 goto bail;
@@ -931,21 +1050,10 @@ static int ocfs2_relink_block_group(handle_t *handle,
931 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data; 1050 struct ocfs2_group_desc *bg = (struct ocfs2_group_desc *) bg_bh->b_data;
932 struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data; 1051 struct ocfs2_group_desc *prev_bg = (struct ocfs2_group_desc *) prev_bg_bh->b_data;
933 1052
934 if (!OCFS2_IS_VALID_DINODE(fe)) { 1053 /* The caller got these descriptors from
935 OCFS2_RO_ON_INVALID_DINODE(alloc_inode->i_sb, fe); 1054 * ocfs2_read_group_descriptor(). Any corruption is a code bug. */
936 status = -EIO; 1055 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg));
937 goto out; 1056 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(prev_bg));
938 }
939 if (!OCFS2_IS_VALID_GROUP_DESC(bg)) {
940 OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg);
941 status = -EIO;
942 goto out;
943 }
944 if (!OCFS2_IS_VALID_GROUP_DESC(prev_bg)) {
945 OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, prev_bg);
946 status = -EIO;
947 goto out;
948 }
949 1057
950 mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n", 1058 mlog(0, "Suballoc %llu, chain %u, move group %llu to top, prev = %llu\n",
951 (unsigned long long)le64_to_cpu(fe->i_blkno), chain, 1059 (unsigned long long)le64_to_cpu(fe->i_blkno), chain,
@@ -956,8 +1064,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
956 bg_ptr = le64_to_cpu(bg->bg_next_group); 1064 bg_ptr = le64_to_cpu(bg->bg_next_group);
957 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group); 1065 prev_bg_ptr = le64_to_cpu(prev_bg->bg_next_group);
958 1066
959 status = ocfs2_journal_access(handle, alloc_inode, prev_bg_bh, 1067 status = ocfs2_journal_access_gd(handle, alloc_inode, prev_bg_bh,
960 OCFS2_JOURNAL_ACCESS_WRITE); 1068 OCFS2_JOURNAL_ACCESS_WRITE);
961 if (status < 0) { 1069 if (status < 0) {
962 mlog_errno(status); 1070 mlog_errno(status);
963 goto out_rollback; 1071 goto out_rollback;
@@ -971,8 +1079,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
971 goto out_rollback; 1079 goto out_rollback;
972 } 1080 }
973 1081
974 status = ocfs2_journal_access(handle, alloc_inode, bg_bh, 1082 status = ocfs2_journal_access_gd(handle, alloc_inode, bg_bh,
975 OCFS2_JOURNAL_ACCESS_WRITE); 1083 OCFS2_JOURNAL_ACCESS_WRITE);
976 if (status < 0) { 1084 if (status < 0) {
977 mlog_errno(status); 1085 mlog_errno(status);
978 goto out_rollback; 1086 goto out_rollback;
@@ -986,8 +1094,8 @@ static int ocfs2_relink_block_group(handle_t *handle,
986 goto out_rollback; 1094 goto out_rollback;
987 } 1095 }
988 1096
989 status = ocfs2_journal_access(handle, alloc_inode, fe_bh, 1097 status = ocfs2_journal_access_di(handle, alloc_inode, fe_bh,
990 OCFS2_JOURNAL_ACCESS_WRITE); 1098 OCFS2_JOURNAL_ACCESS_WRITE);
991 if (status < 0) { 1099 if (status < 0) {
992 mlog_errno(status); 1100 mlog_errno(status);
993 goto out_rollback; 1101 goto out_rollback;
@@ -1008,7 +1116,7 @@ out_rollback:
1008 bg->bg_next_group = cpu_to_le64(bg_ptr); 1116 bg->bg_next_group = cpu_to_le64(bg_ptr);
1009 prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr); 1117 prev_bg->bg_next_group = cpu_to_le64(prev_bg_ptr);
1010 } 1118 }
1011out: 1119
1012 mlog_exit(status); 1120 mlog_exit(status);
1013 return status; 1121 return status;
1014} 1122}
@@ -1138,8 +1246,8 @@ static int ocfs2_alloc_dinode_update_counts(struct inode *inode,
1138 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data; 1246 struct ocfs2_dinode *di = (struct ocfs2_dinode *) di_bh->b_data;
1139 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain; 1247 struct ocfs2_chain_list *cl = (struct ocfs2_chain_list *) &di->id2.i_chain;
1140 1248
1141 ret = ocfs2_journal_access(handle, inode, di_bh, 1249 ret = ocfs2_journal_access_di(handle, inode, di_bh,
1142 OCFS2_JOURNAL_ACCESS_WRITE); 1250 OCFS2_JOURNAL_ACCESS_WRITE);
1143 if (ret < 0) { 1251 if (ret < 0) {
1144 mlog_errno(ret); 1252 mlog_errno(ret);
1145 goto out; 1253 goto out;
@@ -1170,21 +1278,17 @@ static int ocfs2_search_one_group(struct ocfs2_alloc_context *ac,
1170 u16 found; 1278 u16 found;
1171 struct buffer_head *group_bh = NULL; 1279 struct buffer_head *group_bh = NULL;
1172 struct ocfs2_group_desc *gd; 1280 struct ocfs2_group_desc *gd;
1281 struct ocfs2_dinode *di = (struct ocfs2_dinode *)ac->ac_bh->b_data;
1173 struct inode *alloc_inode = ac->ac_inode; 1282 struct inode *alloc_inode = ac->ac_inode;
1174 1283
1175 ret = ocfs2_read_block(alloc_inode, gd_blkno, &group_bh); 1284 ret = ocfs2_read_group_descriptor(alloc_inode, di, gd_blkno,
1285 &group_bh);
1176 if (ret < 0) { 1286 if (ret < 0) {
1177 mlog_errno(ret); 1287 mlog_errno(ret);
1178 return ret; 1288 return ret;
1179 } 1289 }
1180 1290
1181 gd = (struct ocfs2_group_desc *) group_bh->b_data; 1291 gd = (struct ocfs2_group_desc *) group_bh->b_data;
1182 if (!OCFS2_IS_VALID_GROUP_DESC(gd)) {
1183 OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, gd);
1184 ret = -EIO;
1185 goto out;
1186 }
1187
1188 ret = ac->ac_group_search(alloc_inode, group_bh, bits_wanted, min_bits, 1292 ret = ac->ac_group_search(alloc_inode, group_bh, bits_wanted, min_bits,
1189 ac->ac_max_block, bit_off, &found); 1293 ac->ac_max_block, bit_off, &found);
1190 if (ret < 0) { 1294 if (ret < 0) {
@@ -1241,19 +1345,14 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1241 bits_wanted, chain, 1345 bits_wanted, chain,
1242 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno); 1346 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno);
1243 1347
1244 status = ocfs2_read_block(alloc_inode, 1348 status = ocfs2_read_group_descriptor(alloc_inode, fe,
1245 le64_to_cpu(cl->cl_recs[chain].c_blkno), 1349 le64_to_cpu(cl->cl_recs[chain].c_blkno),
1246 &group_bh); 1350 &group_bh);
1247 if (status < 0) { 1351 if (status < 0) {
1248 mlog_errno(status); 1352 mlog_errno(status);
1249 goto bail; 1353 goto bail;
1250 } 1354 }
1251 bg = (struct ocfs2_group_desc *) group_bh->b_data; 1355 bg = (struct ocfs2_group_desc *) group_bh->b_data;
1252 status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, bg);
1253 if (status) {
1254 mlog_errno(status);
1255 goto bail;
1256 }
1257 1356
1258 status = -ENOSPC; 1357 status = -ENOSPC;
1259 /* for now, the chain search is a bit simplistic. We just use 1358 /* for now, the chain search is a bit simplistic. We just use
@@ -1271,18 +1370,13 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1271 next_group = le64_to_cpu(bg->bg_next_group); 1370 next_group = le64_to_cpu(bg->bg_next_group);
1272 prev_group_bh = group_bh; 1371 prev_group_bh = group_bh;
1273 group_bh = NULL; 1372 group_bh = NULL;
1274 status = ocfs2_read_block(alloc_inode, 1373 status = ocfs2_read_group_descriptor(alloc_inode, fe,
1275 next_group, &group_bh); 1374 next_group, &group_bh);
1276 if (status < 0) { 1375 if (status < 0) {
1277 mlog_errno(status); 1376 mlog_errno(status);
1278 goto bail; 1377 goto bail;
1279 } 1378 }
1280 bg = (struct ocfs2_group_desc *) group_bh->b_data; 1379 bg = (struct ocfs2_group_desc *) group_bh->b_data;
1281 status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, bg);
1282 if (status) {
1283 mlog_errno(status);
1284 goto bail;
1285 }
1286 } 1380 }
1287 if (status < 0) { 1381 if (status < 0) {
1288 if (status != -ENOSPC) 1382 if (status != -ENOSPC)
@@ -1324,10 +1418,10 @@ static int ocfs2_search_chain(struct ocfs2_alloc_context *ac,
1324 1418
1325 /* Ok, claim our bits now: set the info on dinode, chainlist 1419 /* Ok, claim our bits now: set the info on dinode, chainlist
1326 * and then the group */ 1420 * and then the group */
1327 status = ocfs2_journal_access(handle, 1421 status = ocfs2_journal_access_di(handle,
1328 alloc_inode, 1422 alloc_inode,
1329 ac->ac_bh, 1423 ac->ac_bh,
1330 OCFS2_JOURNAL_ACCESS_WRITE); 1424 OCFS2_JOURNAL_ACCESS_WRITE);
1331 if (status < 0) { 1425 if (status < 0) {
1332 mlog_errno(status); 1426 mlog_errno(status);
1333 goto bail; 1427 goto bail;
@@ -1392,11 +1486,11 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_super *osb,
1392 BUG_ON(!ac->ac_bh); 1486 BUG_ON(!ac->ac_bh);
1393 1487
1394 fe = (struct ocfs2_dinode *) ac->ac_bh->b_data; 1488 fe = (struct ocfs2_dinode *) ac->ac_bh->b_data;
1395 if (!OCFS2_IS_VALID_DINODE(fe)) { 1489
1396 OCFS2_RO_ON_INVALID_DINODE(osb->sb, fe); 1490 /* The bh was validated by the inode read during
1397 status = -EIO; 1491 * ocfs2_reserve_suballoc_bits(). Any corruption is a code bug. */
1398 goto bail; 1492 BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
1399 } 1493
1400 if (le32_to_cpu(fe->id1.bitmap1.i_used) >= 1494 if (le32_to_cpu(fe->id1.bitmap1.i_used) >=
1401 le32_to_cpu(fe->id1.bitmap1.i_total)) { 1495 le32_to_cpu(fe->id1.bitmap1.i_total)) {
1402 ocfs2_error(osb->sb, "Chain allocator dinode %llu has %u used " 1496 ocfs2_error(osb->sb, "Chain allocator dinode %llu has %u used "
@@ -1725,19 +1819,17 @@ static inline int ocfs2_block_group_clear_bits(handle_t *handle,
1725 1819
1726 mlog_entry_void(); 1820 mlog_entry_void();
1727 1821
1728 if (!OCFS2_IS_VALID_GROUP_DESC(bg)) { 1822 /* The caller got this descriptor from
1729 OCFS2_RO_ON_INVALID_GROUP_DESC(alloc_inode->i_sb, bg); 1823 * ocfs2_read_group_descriptor(). Any corruption is a code bug. */
1730 status = -EIO; 1824 BUG_ON(!OCFS2_IS_VALID_GROUP_DESC(bg));
1731 goto bail;
1732 }
1733 1825
1734 mlog(0, "off = %u, num = %u\n", bit_off, num_bits); 1826 mlog(0, "off = %u, num = %u\n", bit_off, num_bits);
1735 1827
1736 if (ocfs2_is_cluster_bitmap(alloc_inode)) 1828 if (ocfs2_is_cluster_bitmap(alloc_inode))
1737 journal_type = OCFS2_JOURNAL_ACCESS_UNDO; 1829 journal_type = OCFS2_JOURNAL_ACCESS_UNDO;
1738 1830
1739 status = ocfs2_journal_access(handle, alloc_inode, group_bh, 1831 status = ocfs2_journal_access_gd(handle, alloc_inode, group_bh,
1740 journal_type); 1832 journal_type);
1741 if (status < 0) { 1833 if (status < 0) {
1742 mlog_errno(status); 1834 mlog_errno(status);
1743 goto bail; 1835 goto bail;
@@ -1782,29 +1874,26 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1782 1874
1783 mlog_entry_void(); 1875 mlog_entry_void();
1784 1876
1785 if (!OCFS2_IS_VALID_DINODE(fe)) { 1877 /* The alloc_bh comes from ocfs2_free_dinode() or
1786 OCFS2_RO_ON_INVALID_DINODE(alloc_inode->i_sb, fe); 1878 * ocfs2_free_clusters(). The callers have all locked the
1787 status = -EIO; 1879 * allocator and gotten alloc_bh from the lock call. This
1788 goto bail; 1880 * validates the dinode buffer. Any corruption that has happended
1789 } 1881 * is a code bug. */
1882 BUG_ON(!OCFS2_IS_VALID_DINODE(fe));
1790 BUG_ON((count + start_bit) > ocfs2_bits_per_group(cl)); 1883 BUG_ON((count + start_bit) > ocfs2_bits_per_group(cl));
1791 1884
1792 mlog(0, "%llu: freeing %u bits from group %llu, starting at %u\n", 1885 mlog(0, "%llu: freeing %u bits from group %llu, starting at %u\n",
1793 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count, 1886 (unsigned long long)OCFS2_I(alloc_inode)->ip_blkno, count,
1794 (unsigned long long)bg_blkno, start_bit); 1887 (unsigned long long)bg_blkno, start_bit);
1795 1888
1796 status = ocfs2_read_block(alloc_inode, bg_blkno, &group_bh); 1889 status = ocfs2_read_group_descriptor(alloc_inode, fe, bg_blkno,
1890 &group_bh);
1797 if (status < 0) { 1891 if (status < 0) {
1798 mlog_errno(status); 1892 mlog_errno(status);
1799 goto bail; 1893 goto bail;
1800 } 1894 }
1801
1802 group = (struct ocfs2_group_desc *) group_bh->b_data; 1895 group = (struct ocfs2_group_desc *) group_bh->b_data;
1803 status = ocfs2_check_group_descriptor(alloc_inode->i_sb, fe, group); 1896
1804 if (status) {
1805 mlog_errno(status);
1806 goto bail;
1807 }
1808 BUG_ON((count + start_bit) > le16_to_cpu(group->bg_bits)); 1897 BUG_ON((count + start_bit) > le16_to_cpu(group->bg_bits));
1809 1898
1810 status = ocfs2_block_group_clear_bits(handle, alloc_inode, 1899 status = ocfs2_block_group_clear_bits(handle, alloc_inode,
@@ -1815,8 +1904,8 @@ int ocfs2_free_suballoc_bits(handle_t *handle,
1815 goto bail; 1904 goto bail;
1816 } 1905 }
1817 1906
1818 status = ocfs2_journal_access(handle, alloc_inode, alloc_bh, 1907 status = ocfs2_journal_access_di(handle, alloc_inode, alloc_bh,
1819 OCFS2_JOURNAL_ACCESS_WRITE); 1908 OCFS2_JOURNAL_ACCESS_WRITE);
1820 if (status < 0) { 1909 if (status < 0) {
1821 mlog_errno(status); 1910 mlog_errno(status);
1822 goto bail; 1911 goto bail;
diff --git a/fs/ocfs2/suballoc.h b/fs/ocfs2/suballoc.h
index 4df159d8f450..e3c13c77f9e8 100644
--- a/fs/ocfs2/suballoc.h
+++ b/fs/ocfs2/suballoc.h
@@ -164,10 +164,24 @@ void ocfs2_free_ac_resource(struct ocfs2_alloc_context *ac);
164 * and return that block offset. */ 164 * and return that block offset. */
165u64 ocfs2_which_cluster_group(struct inode *inode, u32 cluster); 165u64 ocfs2_which_cluster_group(struct inode *inode, u32 cluster);
166 166
167/* somewhat more expensive than our other checks, so use sparingly. */ 167/*
168 * By default, ocfs2_read_group_descriptor() calls ocfs2_error() when it
169 * finds a problem. A caller that wants to check a group descriptor
170 * without going readonly should read the block with ocfs2_read_block[s]()
171 * and then checking it with this function. This is only resize, really.
172 * Everyone else should be using ocfs2_read_group_descriptor().
173 */
168int ocfs2_check_group_descriptor(struct super_block *sb, 174int ocfs2_check_group_descriptor(struct super_block *sb,
169 struct ocfs2_dinode *di, 175 struct ocfs2_dinode *di,
170 struct ocfs2_group_desc *gd); 176 struct buffer_head *bh);
177/*
178 * Read a group descriptor block into *bh. If *bh is NULL, a bh will be
179 * allocated. This is a cached read. The descriptor will be validated with
180 * ocfs2_validate_group_descriptor().
181 */
182int ocfs2_read_group_descriptor(struct inode *inode, struct ocfs2_dinode *di,
183 u64 gd_blkno, struct buffer_head **bh);
184
171int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_extent_tree *et, 185int ocfs2_lock_allocators(struct inode *inode, struct ocfs2_extent_tree *et,
172 u32 clusters_to_add, u32 extents_to_split, 186 u32 clusters_to_add, u32 extents_to_split,
173 struct ocfs2_alloc_context **data_ac, 187 struct ocfs2_alloc_context **data_ac,
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c
index 304b63ac78cf..43ed11345b59 100644
--- a/fs/ocfs2/super.c
+++ b/fs/ocfs2/super.c
@@ -41,6 +41,7 @@
41#include <linux/debugfs.h> 41#include <linux/debugfs.h>
42#include <linux/mount.h> 42#include <linux/mount.h>
43#include <linux/seq_file.h> 43#include <linux/seq_file.h>
44#include <linux/quotaops.h>
44 45
45#define MLOG_MASK_PREFIX ML_SUPER 46#define MLOG_MASK_PREFIX ML_SUPER
46#include <cluster/masklog.h> 47#include <cluster/masklog.h>
@@ -51,6 +52,7 @@
51#include "ocfs1_fs_compat.h" 52#include "ocfs1_fs_compat.h"
52 53
53#include "alloc.h" 54#include "alloc.h"
55#include "blockcheck.h"
54#include "dlmglue.h" 56#include "dlmglue.h"
55#include "export.h" 57#include "export.h"
56#include "extent_map.h" 58#include "extent_map.h"
@@ -65,10 +67,13 @@
65#include "uptodate.h" 67#include "uptodate.h"
66#include "ver.h" 68#include "ver.h"
67#include "xattr.h" 69#include "xattr.h"
70#include "quota.h"
68 71
69#include "buffer_head_io.h" 72#include "buffer_head_io.h"
70 73
71static struct kmem_cache *ocfs2_inode_cachep = NULL; 74static struct kmem_cache *ocfs2_inode_cachep = NULL;
75struct kmem_cache *ocfs2_dquot_cachep;
76struct kmem_cache *ocfs2_qf_chunk_cachep;
72 77
73/* OCFS2 needs to schedule several differnt types of work which 78/* OCFS2 needs to schedule several differnt types of work which
74 * require cluster locking, disk I/O, recovery waits, etc. Since these 79 * require cluster locking, disk I/O, recovery waits, etc. Since these
@@ -124,6 +129,9 @@ static int ocfs2_get_sector(struct super_block *sb,
124static void ocfs2_write_super(struct super_block *sb); 129static void ocfs2_write_super(struct super_block *sb);
125static struct inode *ocfs2_alloc_inode(struct super_block *sb); 130static struct inode *ocfs2_alloc_inode(struct super_block *sb);
126static void ocfs2_destroy_inode(struct inode *inode); 131static void ocfs2_destroy_inode(struct inode *inode);
132static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend);
133static int ocfs2_enable_quotas(struct ocfs2_super *osb);
134static void ocfs2_disable_quotas(struct ocfs2_super *osb);
127 135
128static const struct super_operations ocfs2_sops = { 136static const struct super_operations ocfs2_sops = {
129 .statfs = ocfs2_statfs, 137 .statfs = ocfs2_statfs,
@@ -137,6 +145,8 @@ static const struct super_operations ocfs2_sops = {
137 .put_super = ocfs2_put_super, 145 .put_super = ocfs2_put_super,
138 .remount_fs = ocfs2_remount, 146 .remount_fs = ocfs2_remount,
139 .show_options = ocfs2_show_options, 147 .show_options = ocfs2_show_options,
148 .quota_read = ocfs2_quota_read,
149 .quota_write = ocfs2_quota_write,
140}; 150};
141 151
142enum { 152enum {
@@ -158,6 +168,10 @@ enum {
158 Opt_user_xattr, 168 Opt_user_xattr,
159 Opt_nouser_xattr, 169 Opt_nouser_xattr,
160 Opt_inode64, 170 Opt_inode64,
171 Opt_acl,
172 Opt_noacl,
173 Opt_usrquota,
174 Opt_grpquota,
161 Opt_err, 175 Opt_err,
162}; 176};
163 177
@@ -180,6 +194,10 @@ static const match_table_t tokens = {
180 {Opt_user_xattr, "user_xattr"}, 194 {Opt_user_xattr, "user_xattr"},
181 {Opt_nouser_xattr, "nouser_xattr"}, 195 {Opt_nouser_xattr, "nouser_xattr"},
182 {Opt_inode64, "inode64"}, 196 {Opt_inode64, "inode64"},
197 {Opt_acl, "acl"},
198 {Opt_noacl, "noacl"},
199 {Opt_usrquota, "usrquota"},
200 {Opt_grpquota, "grpquota"},
183 {Opt_err, NULL} 201 {Opt_err, NULL}
184}; 202};
185 203
@@ -221,6 +239,19 @@ static int ocfs2_sync_fs(struct super_block *sb, int wait)
221 return 0; 239 return 0;
222} 240}
223 241
242static int ocfs2_need_system_inode(struct ocfs2_super *osb, int ino)
243{
244 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_USRQUOTA)
245 && (ino == USER_QUOTA_SYSTEM_INODE
246 || ino == LOCAL_USER_QUOTA_SYSTEM_INODE))
247 return 0;
248 if (!OCFS2_HAS_RO_COMPAT_FEATURE(osb->sb, OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)
249 && (ino == GROUP_QUOTA_SYSTEM_INODE
250 || ino == LOCAL_GROUP_QUOTA_SYSTEM_INODE))
251 return 0;
252 return 1;
253}
254
224static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb) 255static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
225{ 256{
226 struct inode *new = NULL; 257 struct inode *new = NULL;
@@ -247,6 +278,8 @@ static int ocfs2_init_global_system_inodes(struct ocfs2_super *osb)
247 278
248 for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE; 279 for (i = OCFS2_FIRST_ONLINE_SYSTEM_INODE;
249 i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) { 280 i <= OCFS2_LAST_GLOBAL_SYSTEM_INODE; i++) {
281 if (!ocfs2_need_system_inode(osb, i))
282 continue;
250 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); 283 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
251 if (!new) { 284 if (!new) {
252 ocfs2_release_system_inodes(osb); 285 ocfs2_release_system_inodes(osb);
@@ -277,6 +310,8 @@ static int ocfs2_init_local_system_inodes(struct ocfs2_super *osb)
277 for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1; 310 for (i = OCFS2_LAST_GLOBAL_SYSTEM_INODE + 1;
278 i < NUM_SYSTEM_INODES; 311 i < NUM_SYSTEM_INODES;
279 i++) { 312 i++) {
313 if (!ocfs2_need_system_inode(osb, i))
314 continue;
280 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num); 315 new = ocfs2_get_system_file_inode(osb, i, osb->slot_num);
281 if (!new) { 316 if (!new) {
282 ocfs2_release_system_inodes(osb); 317 ocfs2_release_system_inodes(osb);
@@ -426,6 +461,12 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
426 461
427 /* We're going to/from readonly mode. */ 462 /* We're going to/from readonly mode. */
428 if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) { 463 if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY)) {
464 /* Disable quota accounting before remounting RO */
465 if (*flags & MS_RDONLY) {
466 ret = ocfs2_susp_quotas(osb, 0);
467 if (ret < 0)
468 goto out;
469 }
429 /* Lock here so the check of HARD_RO and the potential 470 /* Lock here so the check of HARD_RO and the potential
430 * setting of SOFT_RO is atomic. */ 471 * setting of SOFT_RO is atomic. */
431 spin_lock(&osb->osb_lock); 472 spin_lock(&osb->osb_lock);
@@ -461,11 +502,28 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
461 } 502 }
462unlock_osb: 503unlock_osb:
463 spin_unlock(&osb->osb_lock); 504 spin_unlock(&osb->osb_lock);
505 /* Enable quota accounting after remounting RW */
506 if (!ret && !(*flags & MS_RDONLY)) {
507 if (sb_any_quota_suspended(sb))
508 ret = ocfs2_susp_quotas(osb, 1);
509 else
510 ret = ocfs2_enable_quotas(osb);
511 if (ret < 0) {
512 /* Return back changes... */
513 spin_lock(&osb->osb_lock);
514 sb->s_flags |= MS_RDONLY;
515 osb->osb_flags |= OCFS2_OSB_SOFT_RO;
516 spin_unlock(&osb->osb_lock);
517 goto out;
518 }
519 }
464 } 520 }
465 521
466 if (!ret) { 522 if (!ret) {
467 /* Only save off the new mount options in case of a successful 523 /* Only save off the new mount options in case of a successful
468 * remount. */ 524 * remount. */
525 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
526 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
469 osb->s_mount_opt = parsed_options.mount_opt; 527 osb->s_mount_opt = parsed_options.mount_opt;
470 osb->s_atime_quantum = parsed_options.atime_quantum; 528 osb->s_atime_quantum = parsed_options.atime_quantum;
471 osb->preferred_slot = parsed_options.slot; 529 osb->preferred_slot = parsed_options.slot;
@@ -619,6 +677,131 @@ static int ocfs2_verify_userspace_stack(struct ocfs2_super *osb,
619 return 0; 677 return 0;
620} 678}
621 679
680static int ocfs2_susp_quotas(struct ocfs2_super *osb, int unsuspend)
681{
682 int type;
683 struct super_block *sb = osb->sb;
684 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
685 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
686 int status = 0;
687
688 for (type = 0; type < MAXQUOTAS; type++) {
689 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
690 continue;
691 if (unsuspend)
692 status = vfs_quota_enable(
693 sb_dqopt(sb)->files[type],
694 type, QFMT_OCFS2,
695 DQUOT_SUSPENDED);
696 else
697 status = vfs_quota_disable(sb, type,
698 DQUOT_SUSPENDED);
699 if (status < 0)
700 break;
701 }
702 if (status < 0)
703 mlog(ML_ERROR, "Failed to suspend/unsuspend quotas on "
704 "remount (error = %d).\n", status);
705 return status;
706}
707
708static int ocfs2_enable_quotas(struct ocfs2_super *osb)
709{
710 struct inode *inode[MAXQUOTAS] = { NULL, NULL };
711 struct super_block *sb = osb->sb;
712 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
713 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
714 unsigned int ino[MAXQUOTAS] = { LOCAL_USER_QUOTA_SYSTEM_INODE,
715 LOCAL_GROUP_QUOTA_SYSTEM_INODE };
716 int status;
717 int type;
718
719 sb_dqopt(sb)->flags |= DQUOT_QUOTA_SYS_FILE | DQUOT_NEGATIVE_USAGE;
720 for (type = 0; type < MAXQUOTAS; type++) {
721 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
722 continue;
723 inode[type] = ocfs2_get_system_file_inode(osb, ino[type],
724 osb->slot_num);
725 if (!inode[type]) {
726 status = -ENOENT;
727 goto out_quota_off;
728 }
729 status = vfs_quota_enable(inode[type], type, QFMT_OCFS2,
730 DQUOT_USAGE_ENABLED);
731 if (status < 0)
732 goto out_quota_off;
733 }
734
735 for (type = 0; type < MAXQUOTAS; type++)
736 iput(inode[type]);
737 return 0;
738out_quota_off:
739 ocfs2_disable_quotas(osb);
740 for (type = 0; type < MAXQUOTAS; type++)
741 iput(inode[type]);
742 mlog_errno(status);
743 return status;
744}
745
746static void ocfs2_disable_quotas(struct ocfs2_super *osb)
747{
748 int type;
749 struct inode *inode;
750 struct super_block *sb = osb->sb;
751
752 /* We mostly ignore errors in this function because there's not much
753 * we can do when we see them */
754 for (type = 0; type < MAXQUOTAS; type++) {
755 if (!sb_has_quota_loaded(sb, type))
756 continue;
757 inode = igrab(sb->s_dquot.files[type]);
758 /* Turn off quotas. This will remove all dquot structures from
759 * memory and so they will be automatically synced to global
760 * quota files */
761 vfs_quota_disable(sb, type, DQUOT_USAGE_ENABLED |
762 DQUOT_LIMITS_ENABLED);
763 if (!inode)
764 continue;
765 iput(inode);
766 }
767}
768
769/* Handle quota on quotactl */
770static int ocfs2_quota_on(struct super_block *sb, int type, int format_id,
771 char *path, int remount)
772{
773 unsigned int feature[MAXQUOTAS] = { OCFS2_FEATURE_RO_COMPAT_USRQUOTA,
774 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA};
775
776 if (!OCFS2_HAS_RO_COMPAT_FEATURE(sb, feature[type]))
777 return -EINVAL;
778
779 if (remount)
780 return 0; /* Just ignore it has been handled in
781 * ocfs2_remount() */
782 return vfs_quota_enable(sb_dqopt(sb)->files[type], type,
783 format_id, DQUOT_LIMITS_ENABLED);
784}
785
786/* Handle quota off quotactl */
787static int ocfs2_quota_off(struct super_block *sb, int type, int remount)
788{
789 if (remount)
790 return 0; /* Ignore now and handle later in
791 * ocfs2_remount() */
792 return vfs_quota_disable(sb, type, DQUOT_LIMITS_ENABLED);
793}
794
795static struct quotactl_ops ocfs2_quotactl_ops = {
796 .quota_on = ocfs2_quota_on,
797 .quota_off = ocfs2_quota_off,
798 .quota_sync = vfs_quota_sync,
799 .get_info = vfs_get_dqinfo,
800 .set_info = vfs_set_dqinfo,
801 .get_dqblk = vfs_get_dqblk,
802 .set_dqblk = vfs_set_dqblk,
803};
804
622static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) 805static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
623{ 806{
624 struct dentry *root; 807 struct dentry *root;
@@ -651,12 +834,32 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
651 } 834 }
652 brelse(bh); 835 brelse(bh);
653 bh = NULL; 836 bh = NULL;
837
838 if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR))
839 parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
840
654 osb->s_mount_opt = parsed_options.mount_opt; 841 osb->s_mount_opt = parsed_options.mount_opt;
655 osb->s_atime_quantum = parsed_options.atime_quantum; 842 osb->s_atime_quantum = parsed_options.atime_quantum;
656 osb->preferred_slot = parsed_options.slot; 843 osb->preferred_slot = parsed_options.slot;
657 osb->osb_commit_interval = parsed_options.commit_interval; 844 osb->osb_commit_interval = parsed_options.commit_interval;
658 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); 845 osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt);
659 osb->local_alloc_bits = osb->local_alloc_default_bits; 846 osb->local_alloc_bits = osb->local_alloc_default_bits;
847 if (osb->s_mount_opt & OCFS2_MOUNT_USRQUOTA &&
848 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
849 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
850 status = -EINVAL;
851 mlog(ML_ERROR, "User quotas were requested, but this "
852 "filesystem does not have the feature enabled.\n");
853 goto read_super_error;
854 }
855 if (osb->s_mount_opt & OCFS2_MOUNT_GRPQUOTA &&
856 !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
857 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
858 status = -EINVAL;
859 mlog(ML_ERROR, "Group quotas were requested, but this "
860 "filesystem does not have the feature enabled.\n");
861 goto read_super_error;
862 }
660 863
661 status = ocfs2_verify_userspace_stack(osb, &parsed_options); 864 status = ocfs2_verify_userspace_stack(osb, &parsed_options);
662 if (status) 865 if (status)
@@ -664,6 +867,9 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
664 867
665 sb->s_magic = OCFS2_SUPER_MAGIC; 868 sb->s_magic = OCFS2_SUPER_MAGIC;
666 869
870 sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
871 ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
872
667 /* Hard readonly mode only if: bdev_read_only, MS_RDONLY, 873 /* Hard readonly mode only if: bdev_read_only, MS_RDONLY,
668 * heartbeat=none */ 874 * heartbeat=none */
669 if (bdev_read_only(sb->s_bdev)) { 875 if (bdev_read_only(sb->s_bdev)) {
@@ -758,6 +964,28 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent)
758 atomic_set(&osb->vol_state, VOLUME_MOUNTED); 964 atomic_set(&osb->vol_state, VOLUME_MOUNTED);
759 wake_up(&osb->osb_mount_event); 965 wake_up(&osb->osb_mount_event);
760 966
967 /* Now we can initialize quotas because we can afford to wait
968 * for cluster locks recovery now. That also means that truncation
969 * log recovery can happen but that waits for proper quota setup */
970 if (!(sb->s_flags & MS_RDONLY)) {
971 status = ocfs2_enable_quotas(osb);
972 if (status < 0) {
973 /* We have to err-out specially here because
974 * s_root is already set */
975 mlog_errno(status);
976 atomic_set(&osb->vol_state, VOLUME_DISABLED);
977 wake_up(&osb->osb_mount_event);
978 mlog_exit(status);
979 return status;
980 }
981 }
982
983 ocfs2_complete_quota_recovery(osb);
984
985 /* Now we wake up again for processes waiting for quotas */
986 atomic_set(&osb->vol_state, VOLUME_MOUNTED_QUOTAS);
987 wake_up(&osb->osb_mount_event);
988
761 mlog_exit(status); 989 mlog_exit(status);
762 return status; 990 return status;
763 991
@@ -945,6 +1173,41 @@ static int ocfs2_parse_options(struct super_block *sb,
945 case Opt_inode64: 1173 case Opt_inode64:
946 mopt->mount_opt |= OCFS2_MOUNT_INODE64; 1174 mopt->mount_opt |= OCFS2_MOUNT_INODE64;
947 break; 1175 break;
1176 case Opt_usrquota:
1177 /* We check only on remount, otherwise features
1178 * aren't yet initialized. */
1179 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1180 OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
1181 mlog(ML_ERROR, "User quota requested but "
1182 "filesystem feature is not set\n");
1183 status = 0;
1184 goto bail;
1185 }
1186 mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA;
1187 break;
1188 case Opt_grpquota:
1189 if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb,
1190 OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
1191 mlog(ML_ERROR, "Group quota requested but "
1192 "filesystem feature is not set\n");
1193 status = 0;
1194 goto bail;
1195 }
1196 mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA;
1197 break;
1198#ifdef CONFIG_OCFS2_FS_POSIX_ACL
1199 case Opt_acl:
1200 mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL;
1201 break;
1202 case Opt_noacl:
1203 mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL;
1204 break;
1205#else
1206 case Opt_acl:
1207 case Opt_noacl:
1208 printk(KERN_INFO "ocfs2 (no)acl options not supported\n");
1209 break;
1210#endif
948 default: 1211 default:
949 mlog(ML_ERROR, 1212 mlog(ML_ERROR,
950 "Unrecognized mount option \"%s\" " 1213 "Unrecognized mount option \"%s\" "
@@ -1008,6 +1271,10 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1008 if (osb->osb_cluster_stack[0]) 1271 if (osb->osb_cluster_stack[0])
1009 seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN, 1272 seq_printf(s, ",cluster_stack=%.*s", OCFS2_STACK_LABEL_LEN,
1010 osb->osb_cluster_stack); 1273 osb->osb_cluster_stack);
1274 if (opts & OCFS2_MOUNT_USRQUOTA)
1275 seq_printf(s, ",usrquota");
1276 if (opts & OCFS2_MOUNT_GRPQUOTA)
1277 seq_printf(s, ",grpquota");
1011 1278
1012 if (opts & OCFS2_MOUNT_NOUSERXATTR) 1279 if (opts & OCFS2_MOUNT_NOUSERXATTR)
1013 seq_printf(s, ",nouser_xattr"); 1280 seq_printf(s, ",nouser_xattr");
@@ -1017,6 +1284,13 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt)
1017 if (opts & OCFS2_MOUNT_INODE64) 1284 if (opts & OCFS2_MOUNT_INODE64)
1018 seq_printf(s, ",inode64"); 1285 seq_printf(s, ",inode64");
1019 1286
1287#ifdef CONFIG_OCFS2_FS_POSIX_ACL
1288 if (opts & OCFS2_MOUNT_POSIX_ACL)
1289 seq_printf(s, ",acl");
1290 else
1291 seq_printf(s, ",noacl");
1292#endif
1293
1020 return 0; 1294 return 0;
1021} 1295}
1022 1296
@@ -1052,10 +1326,16 @@ static int __init ocfs2_init(void)
1052 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n"); 1326 mlog(ML_ERROR, "Unable to create ocfs2 debugfs root.\n");
1053 } 1327 }
1054 1328
1329 status = ocfs2_quota_setup();
1330 if (status)
1331 goto leave;
1332
1055 ocfs2_set_locking_protocol(); 1333 ocfs2_set_locking_protocol();
1056 1334
1335 status = register_quota_format(&ocfs2_quota_format);
1057leave: 1336leave:
1058 if (status < 0) { 1337 if (status < 0) {
1338 ocfs2_quota_shutdown();
1059 ocfs2_free_mem_caches(); 1339 ocfs2_free_mem_caches();
1060 exit_ocfs2_uptodate_cache(); 1340 exit_ocfs2_uptodate_cache();
1061 } 1341 }
@@ -1072,11 +1352,15 @@ static void __exit ocfs2_exit(void)
1072{ 1352{
1073 mlog_entry_void(); 1353 mlog_entry_void();
1074 1354
1355 ocfs2_quota_shutdown();
1356
1075 if (ocfs2_wq) { 1357 if (ocfs2_wq) {
1076 flush_workqueue(ocfs2_wq); 1358 flush_workqueue(ocfs2_wq);
1077 destroy_workqueue(ocfs2_wq); 1359 destroy_workqueue(ocfs2_wq);
1078 } 1360 }
1079 1361
1362 unregister_quota_format(&ocfs2_quota_format);
1363
1080 debugfs_remove(ocfs2_debugfs_root); 1364 debugfs_remove(ocfs2_debugfs_root);
1081 1365
1082 ocfs2_free_mem_caches(); 1366 ocfs2_free_mem_caches();
@@ -1192,8 +1476,27 @@ static int ocfs2_initialize_mem_caches(void)
1192 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT| 1476 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1193 SLAB_MEM_SPREAD), 1477 SLAB_MEM_SPREAD),
1194 ocfs2_inode_init_once); 1478 ocfs2_inode_init_once);
1195 if (!ocfs2_inode_cachep) 1479 ocfs2_dquot_cachep = kmem_cache_create("ocfs2_dquot_cache",
1480 sizeof(struct ocfs2_dquot),
1481 0,
1482 (SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT|
1483 SLAB_MEM_SPREAD),
1484 NULL);
1485 ocfs2_qf_chunk_cachep = kmem_cache_create("ocfs2_qf_chunk_cache",
1486 sizeof(struct ocfs2_quota_chunk),
1487 0,
1488 (SLAB_RECLAIM_ACCOUNT|SLAB_MEM_SPREAD),
1489 NULL);
1490 if (!ocfs2_inode_cachep || !ocfs2_dquot_cachep ||
1491 !ocfs2_qf_chunk_cachep) {
1492 if (ocfs2_inode_cachep)
1493 kmem_cache_destroy(ocfs2_inode_cachep);
1494 if (ocfs2_dquot_cachep)
1495 kmem_cache_destroy(ocfs2_dquot_cachep);
1496 if (ocfs2_qf_chunk_cachep)
1497 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1196 return -ENOMEM; 1498 return -ENOMEM;
1499 }
1197 1500
1198 return 0; 1501 return 0;
1199} 1502}
@@ -1202,8 +1505,15 @@ static void ocfs2_free_mem_caches(void)
1202{ 1505{
1203 if (ocfs2_inode_cachep) 1506 if (ocfs2_inode_cachep)
1204 kmem_cache_destroy(ocfs2_inode_cachep); 1507 kmem_cache_destroy(ocfs2_inode_cachep);
1205
1206 ocfs2_inode_cachep = NULL; 1508 ocfs2_inode_cachep = NULL;
1509
1510 if (ocfs2_dquot_cachep)
1511 kmem_cache_destroy(ocfs2_dquot_cachep);
1512 ocfs2_dquot_cachep = NULL;
1513
1514 if (ocfs2_qf_chunk_cachep)
1515 kmem_cache_destroy(ocfs2_qf_chunk_cachep);
1516 ocfs2_qf_chunk_cachep = NULL;
1207} 1517}
1208 1518
1209static int ocfs2_get_sector(struct super_block *sb, 1519static int ocfs2_get_sector(struct super_block *sb,
@@ -1303,6 +1613,8 @@ static void ocfs2_dismount_volume(struct super_block *sb, int mnt_err)
1303 osb = OCFS2_SB(sb); 1613 osb = OCFS2_SB(sb);
1304 BUG_ON(!osb); 1614 BUG_ON(!osb);
1305 1615
1616 ocfs2_disable_quotas(osb);
1617
1306 ocfs2_shutdown_local_alloc(osb); 1618 ocfs2_shutdown_local_alloc(osb);
1307 1619
1308 ocfs2_truncate_log_shutdown(osb); 1620 ocfs2_truncate_log_shutdown(osb);
@@ -1413,6 +1725,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
1413 sb->s_fs_info = osb; 1725 sb->s_fs_info = osb;
1414 sb->s_op = &ocfs2_sops; 1726 sb->s_op = &ocfs2_sops;
1415 sb->s_export_op = &ocfs2_export_ops; 1727 sb->s_export_op = &ocfs2_export_ops;
1728 sb->s_qcop = &ocfs2_quotactl_ops;
1729 sb->dq_op = &ocfs2_quota_operations;
1416 sb->s_xattr = ocfs2_xattr_handlers; 1730 sb->s_xattr = ocfs2_xattr_handlers;
1417 sb->s_time_gran = 1; 1731 sb->s_time_gran = 1;
1418 sb->s_flags |= MS_NOATIME; 1732 sb->s_flags |= MS_NOATIME;
@@ -1676,6 +1990,15 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
1676 1990
1677 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE, 1991 if (memcmp(di->i_signature, OCFS2_SUPER_BLOCK_SIGNATURE,
1678 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) { 1992 strlen(OCFS2_SUPER_BLOCK_SIGNATURE)) == 0) {
1993 /* We have to do a raw check of the feature here */
1994 if (le32_to_cpu(di->id2.i_super.s_feature_incompat) &
1995 OCFS2_FEATURE_INCOMPAT_META_ECC) {
1996 status = ocfs2_block_check_validate(bh->b_data,
1997 bh->b_size,
1998 &di->i_check);
1999 if (status)
2000 goto out;
2001 }
1679 status = -EINVAL; 2002 status = -EINVAL;
1680 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) { 2003 if ((1 << le32_to_cpu(di->id2.i_super.s_blocksize_bits)) != blksz) {
1681 mlog(ML_ERROR, "found superblock with incorrect block " 2004 mlog(ML_ERROR, "found superblock with incorrect block "
@@ -1717,6 +2040,7 @@ static int ocfs2_verify_volume(struct ocfs2_dinode *di,
1717 } 2040 }
1718 } 2041 }
1719 2042
2043out:
1720 mlog_exit(status); 2044 mlog_exit(status);
1721 return status; 2045 return status;
1722} 2046}
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c
index cbd03dfdc7b9..ed0a0cfd68d2 100644
--- a/fs/ocfs2/symlink.c
+++ b/fs/ocfs2/symlink.c
@@ -84,7 +84,7 @@ static char *ocfs2_fast_symlink_getlink(struct inode *inode,
84 84
85 mlog_entry_void(); 85 mlog_entry_void();
86 86
87 status = ocfs2_read_block(inode, OCFS2_I(inode)->ip_blkno, bh); 87 status = ocfs2_read_inode_block(inode, bh);
88 if (status < 0) { 88 if (status < 0) {
89 mlog_errno(status); 89 mlog_errno(status);
90 link = ERR_PTR(status); 90 link = ERR_PTR(status);
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index 74d7367ade13..e1d638af6ac3 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -35,12 +35,14 @@
35#include <linux/init.h> 35#include <linux/init.h>
36#include <linux/module.h> 36#include <linux/module.h>
37#include <linux/string.h> 37#include <linux/string.h>
38#include <linux/security.h>
38 39
39#define MLOG_MASK_PREFIX ML_XATTR 40#define MLOG_MASK_PREFIX ML_XATTR
40#include <cluster/masklog.h> 41#include <cluster/masklog.h>
41 42
42#include "ocfs2.h" 43#include "ocfs2.h"
43#include "alloc.h" 44#include "alloc.h"
45#include "blockcheck.h"
44#include "dlmglue.h" 46#include "dlmglue.h"
45#include "file.h" 47#include "file.h"
46#include "symlink.h" 48#include "symlink.h"
@@ -61,12 +63,32 @@ struct ocfs2_xattr_def_value_root {
61}; 63};
62 64
63struct ocfs2_xattr_bucket { 65struct ocfs2_xattr_bucket {
64 struct buffer_head *bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET]; 66 /* The inode these xattrs are associated with */
65 struct ocfs2_xattr_header *xh; 67 struct inode *bu_inode;
68
69 /* The actual buffers that make up the bucket */
70 struct buffer_head *bu_bhs[OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET];
71
72 /* How many blocks make up one bucket for this filesystem */
73 int bu_blocks;
74};
75
76struct ocfs2_xattr_set_ctxt {
77 handle_t *handle;
78 struct ocfs2_alloc_context *meta_ac;
79 struct ocfs2_alloc_context *data_ac;
80 struct ocfs2_cached_dealloc_ctxt dealloc;
66}; 81};
67 82
68#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root)) 83#define OCFS2_XATTR_ROOT_SIZE (sizeof(struct ocfs2_xattr_def_value_root))
69#define OCFS2_XATTR_INLINE_SIZE 80 84#define OCFS2_XATTR_INLINE_SIZE 80
85#define OCFS2_XATTR_FREE_IN_IBODY (OCFS2_MIN_XATTR_INLINE_SIZE \
86 - sizeof(struct ocfs2_xattr_header) \
87 - sizeof(__u32))
88#define OCFS2_XATTR_FREE_IN_BLOCK(ptr) ((ptr)->i_sb->s_blocksize \
89 - sizeof(struct ocfs2_xattr_block) \
90 - sizeof(struct ocfs2_xattr_header) \
91 - sizeof(__u32))
70 92
71static struct ocfs2_xattr_def_value_root def_xv = { 93static struct ocfs2_xattr_def_value_root def_xv = {
72 .xv.xr_list.l_count = cpu_to_le16(1), 94 .xv.xr_list.l_count = cpu_to_le16(1),
@@ -74,13 +96,25 @@ static struct ocfs2_xattr_def_value_root def_xv = {
74 96
75struct xattr_handler *ocfs2_xattr_handlers[] = { 97struct xattr_handler *ocfs2_xattr_handlers[] = {
76 &ocfs2_xattr_user_handler, 98 &ocfs2_xattr_user_handler,
99#ifdef CONFIG_OCFS2_FS_POSIX_ACL
100 &ocfs2_xattr_acl_access_handler,
101 &ocfs2_xattr_acl_default_handler,
102#endif
77 &ocfs2_xattr_trusted_handler, 103 &ocfs2_xattr_trusted_handler,
104 &ocfs2_xattr_security_handler,
78 NULL 105 NULL
79}; 106};
80 107
81static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { 108static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = {
82 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, 109 [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler,
110#ifdef CONFIG_OCFS2_FS_POSIX_ACL
111 [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS]
112 = &ocfs2_xattr_acl_access_handler,
113 [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT]
114 = &ocfs2_xattr_acl_default_handler,
115#endif
83 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler, 116 [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler,
117 [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler,
84}; 118};
85 119
86struct ocfs2_xattr_info { 120struct ocfs2_xattr_info {
@@ -98,7 +132,7 @@ struct ocfs2_xattr_search {
98 */ 132 */
99 struct buffer_head *xattr_bh; 133 struct buffer_head *xattr_bh;
100 struct ocfs2_xattr_header *header; 134 struct ocfs2_xattr_header *header;
101 struct ocfs2_xattr_bucket bucket; 135 struct ocfs2_xattr_bucket *bucket;
102 void *base; 136 void *base;
103 void *end; 137 void *end;
104 struct ocfs2_xattr_entry *here; 138 struct ocfs2_xattr_entry *here;
@@ -127,14 +161,20 @@ static int ocfs2_xattr_tree_list_index_block(struct inode *inode,
127 size_t buffer_size); 161 size_t buffer_size);
128 162
129static int ocfs2_xattr_create_index_block(struct inode *inode, 163static int ocfs2_xattr_create_index_block(struct inode *inode,
130 struct ocfs2_xattr_search *xs); 164 struct ocfs2_xattr_search *xs,
165 struct ocfs2_xattr_set_ctxt *ctxt);
131 166
132static int ocfs2_xattr_set_entry_index_block(struct inode *inode, 167static int ocfs2_xattr_set_entry_index_block(struct inode *inode,
133 struct ocfs2_xattr_info *xi, 168 struct ocfs2_xattr_info *xi,
134 struct ocfs2_xattr_search *xs); 169 struct ocfs2_xattr_search *xs,
170 struct ocfs2_xattr_set_ctxt *ctxt);
135 171
136static int ocfs2_delete_xattr_index_block(struct inode *inode, 172static int ocfs2_delete_xattr_index_block(struct inode *inode,
137 struct buffer_head *xb_bh); 173 struct buffer_head *xb_bh);
174static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle,
175 u64 src_blk, u64 last_blk, u64 to_blk,
176 unsigned int start_bucket,
177 u32 *first_hash);
138 178
139static inline u16 ocfs2_xattr_buckets_per_cluster(struct ocfs2_super *osb) 179static inline u16 ocfs2_xattr_buckets_per_cluster(struct ocfs2_super *osb)
140{ 180{
@@ -154,6 +194,216 @@ static inline u16 ocfs2_xattr_max_xe_in_bucket(struct super_block *sb)
154 return len / sizeof(struct ocfs2_xattr_entry); 194 return len / sizeof(struct ocfs2_xattr_entry);
155} 195}
156 196
197#define bucket_blkno(_b) ((_b)->bu_bhs[0]->b_blocknr)
198#define bucket_block(_b, _n) ((_b)->bu_bhs[(_n)]->b_data)
199#define bucket_xh(_b) ((struct ocfs2_xattr_header *)bucket_block((_b), 0))
200
201static struct ocfs2_xattr_bucket *ocfs2_xattr_bucket_new(struct inode *inode)
202{
203 struct ocfs2_xattr_bucket *bucket;
204 int blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
205
206 BUG_ON(blks > OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET);
207
208 bucket = kzalloc(sizeof(struct ocfs2_xattr_bucket), GFP_NOFS);
209 if (bucket) {
210 bucket->bu_inode = inode;
211 bucket->bu_blocks = blks;
212 }
213
214 return bucket;
215}
216
217static void ocfs2_xattr_bucket_relse(struct ocfs2_xattr_bucket *bucket)
218{
219 int i;
220
221 for (i = 0; i < bucket->bu_blocks; i++) {
222 brelse(bucket->bu_bhs[i]);
223 bucket->bu_bhs[i] = NULL;
224 }
225}
226
227static void ocfs2_xattr_bucket_free(struct ocfs2_xattr_bucket *bucket)
228{
229 if (bucket) {
230 ocfs2_xattr_bucket_relse(bucket);
231 bucket->bu_inode = NULL;
232 kfree(bucket);
233 }
234}
235
236/*
237 * A bucket that has never been written to disk doesn't need to be
238 * read. We just need the buffer_heads. Don't call this for
239 * buckets that are already on disk. ocfs2_read_xattr_bucket() initializes
240 * them fully.
241 */
242static int ocfs2_init_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
243 u64 xb_blkno)
244{
245 int i, rc = 0;
246
247 for (i = 0; i < bucket->bu_blocks; i++) {
248 bucket->bu_bhs[i] = sb_getblk(bucket->bu_inode->i_sb,
249 xb_blkno + i);
250 if (!bucket->bu_bhs[i]) {
251 rc = -EIO;
252 mlog_errno(rc);
253 break;
254 }
255
256 if (!ocfs2_buffer_uptodate(bucket->bu_inode,
257 bucket->bu_bhs[i]))
258 ocfs2_set_new_buffer_uptodate(bucket->bu_inode,
259 bucket->bu_bhs[i]);
260 }
261
262 if (rc)
263 ocfs2_xattr_bucket_relse(bucket);
264 return rc;
265}
266
267/* Read the xattr bucket at xb_blkno */
268static int ocfs2_read_xattr_bucket(struct ocfs2_xattr_bucket *bucket,
269 u64 xb_blkno)
270{
271 int rc;
272
273 rc = ocfs2_read_blocks(bucket->bu_inode, xb_blkno,
274 bucket->bu_blocks, bucket->bu_bhs, 0,
275 NULL);
276 if (!rc) {
277 rc = ocfs2_validate_meta_ecc_bhs(bucket->bu_inode->i_sb,
278 bucket->bu_bhs,
279 bucket->bu_blocks,
280 &bucket_xh(bucket)->xh_check);
281 if (rc)
282 mlog_errno(rc);
283 }
284
285 if (rc)
286 ocfs2_xattr_bucket_relse(bucket);
287 return rc;
288}
289
290static int ocfs2_xattr_bucket_journal_access(handle_t *handle,
291 struct ocfs2_xattr_bucket *bucket,
292 int type)
293{
294 int i, rc = 0;
295
296 for (i = 0; i < bucket->bu_blocks; i++) {
297 rc = ocfs2_journal_access(handle, bucket->bu_inode,
298 bucket->bu_bhs[i], type);
299 if (rc) {
300 mlog_errno(rc);
301 break;
302 }
303 }
304
305 return rc;
306}
307
308static void ocfs2_xattr_bucket_journal_dirty(handle_t *handle,
309 struct ocfs2_xattr_bucket *bucket)
310{
311 int i;
312
313 ocfs2_compute_meta_ecc_bhs(bucket->bu_inode->i_sb,
314 bucket->bu_bhs, bucket->bu_blocks,
315 &bucket_xh(bucket)->xh_check);
316
317 for (i = 0; i < bucket->bu_blocks; i++)
318 ocfs2_journal_dirty(handle, bucket->bu_bhs[i]);
319}
320
321static void ocfs2_xattr_bucket_copy_data(struct ocfs2_xattr_bucket *dest,
322 struct ocfs2_xattr_bucket *src)
323{
324 int i;
325 int blocksize = src->bu_inode->i_sb->s_blocksize;
326
327 BUG_ON(dest->bu_blocks != src->bu_blocks);
328 BUG_ON(dest->bu_inode != src->bu_inode);
329
330 for (i = 0; i < src->bu_blocks; i++) {
331 memcpy(bucket_block(dest, i), bucket_block(src, i),
332 blocksize);
333 }
334}
335
336static int ocfs2_validate_xattr_block(struct super_block *sb,
337 struct buffer_head *bh)
338{
339 int rc;
340 struct ocfs2_xattr_block *xb =
341 (struct ocfs2_xattr_block *)bh->b_data;
342
343 mlog(0, "Validating xattr block %llu\n",
344 (unsigned long long)bh->b_blocknr);
345
346 BUG_ON(!buffer_uptodate(bh));
347
348 /*
349 * If the ecc fails, we return the error but otherwise
350 * leave the filesystem running. We know any error is
351 * local to this block.
352 */
353 rc = ocfs2_validate_meta_ecc(sb, bh->b_data, &xb->xb_check);
354 if (rc)
355 return rc;
356
357 /*
358 * Errors after here are fatal
359 */
360
361 if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
362 ocfs2_error(sb,
363 "Extended attribute block #%llu has bad "
364 "signature %.*s",
365 (unsigned long long)bh->b_blocknr, 7,
366 xb->xb_signature);
367 return -EINVAL;
368 }
369
370 if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) {
371 ocfs2_error(sb,
372 "Extended attribute block #%llu has an "
373 "invalid xb_blkno of %llu",
374 (unsigned long long)bh->b_blocknr,
375 (unsigned long long)le64_to_cpu(xb->xb_blkno));
376 return -EINVAL;
377 }
378
379 if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) {
380 ocfs2_error(sb,
381 "Extended attribute block #%llu has an invalid "
382 "xb_fs_generation of #%u",
383 (unsigned long long)bh->b_blocknr,
384 le32_to_cpu(xb->xb_fs_generation));
385 return -EINVAL;
386 }
387
388 return 0;
389}
390
391static int ocfs2_read_xattr_block(struct inode *inode, u64 xb_blkno,
392 struct buffer_head **bh)
393{
394 int rc;
395 struct buffer_head *tmp = *bh;
396
397 rc = ocfs2_read_block(inode, xb_blkno, &tmp,
398 ocfs2_validate_xattr_block);
399
400 /* If ocfs2_read_block() got us a new bh, pass it up. */
401 if (!rc && !*bh)
402 *bh = tmp;
403
404 return rc;
405}
406
157static inline const char *ocfs2_xattr_prefix(int name_index) 407static inline const char *ocfs2_xattr_prefix(int name_index)
158{ 408{
159 struct xattr_handler *handler = NULL; 409 struct xattr_handler *handler = NULL;
@@ -200,54 +450,163 @@ static void ocfs2_xattr_hash_entry(struct inode *inode,
200 return; 450 return;
201} 451}
202 452
453static int ocfs2_xattr_entry_real_size(int name_len, size_t value_len)
454{
455 int size = 0;
456
457 if (value_len <= OCFS2_XATTR_INLINE_SIZE)
458 size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_SIZE(value_len);
459 else
460 size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
461 size += sizeof(struct ocfs2_xattr_entry);
462
463 return size;
464}
465
466int ocfs2_calc_security_init(struct inode *dir,
467 struct ocfs2_security_xattr_info *si,
468 int *want_clusters,
469 int *xattr_credits,
470 struct ocfs2_alloc_context **xattr_ac)
471{
472 int ret = 0;
473 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
474 int s_size = ocfs2_xattr_entry_real_size(strlen(si->name),
475 si->value_len);
476
477 /*
478 * The max space of security xattr taken inline is
479 * 256(name) + 80(value) + 16(entry) = 352 bytes,
480 * So reserve one metadata block for it is ok.
481 */
482 if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
483 s_size > OCFS2_XATTR_FREE_IN_IBODY) {
484 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, xattr_ac);
485 if (ret) {
486 mlog_errno(ret);
487 return ret;
488 }
489 *xattr_credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
490 }
491
492 /* reserve clusters for xattr value which will be set in B tree*/
493 if (si->value_len > OCFS2_XATTR_INLINE_SIZE) {
494 int new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
495 si->value_len);
496
497 *xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
498 new_clusters);
499 *want_clusters += new_clusters;
500 }
501 return ret;
502}
503
504int ocfs2_calc_xattr_init(struct inode *dir,
505 struct buffer_head *dir_bh,
506 int mode,
507 struct ocfs2_security_xattr_info *si,
508 int *want_clusters,
509 int *xattr_credits,
510 struct ocfs2_alloc_context **xattr_ac)
511{
512 int ret = 0;
513 struct ocfs2_super *osb = OCFS2_SB(dir->i_sb);
514 int s_size = 0, a_size = 0, acl_len = 0, new_clusters;
515
516 if (si->enable)
517 s_size = ocfs2_xattr_entry_real_size(strlen(si->name),
518 si->value_len);
519
520 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) {
521 acl_len = ocfs2_xattr_get_nolock(dir, dir_bh,
522 OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT,
523 "", NULL, 0);
524 if (acl_len > 0) {
525 a_size = ocfs2_xattr_entry_real_size(0, acl_len);
526 if (S_ISDIR(mode))
527 a_size <<= 1;
528 } else if (acl_len != 0 && acl_len != -ENODATA) {
529 mlog_errno(ret);
530 return ret;
531 }
532 }
533
534 if (!(s_size + a_size))
535 return ret;
536
537 /*
538 * The max space of security xattr taken inline is
539 * 256(name) + 80(value) + 16(entry) = 352 bytes,
540 * The max space of acl xattr taken inline is
541 * 80(value) + 16(entry) * 2(if directory) = 192 bytes,
542 * when blocksize = 512, may reserve one more cluser for
543 * xattr bucket, otherwise reserve one metadata block
544 * for them is ok.
545 */
546 if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE ||
547 (s_size + a_size) > OCFS2_XATTR_FREE_IN_IBODY) {
548 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, xattr_ac);
549 if (ret) {
550 mlog_errno(ret);
551 return ret;
552 }
553 *xattr_credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
554 }
555
556 if (dir->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE &&
557 (s_size + a_size) > OCFS2_XATTR_FREE_IN_BLOCK(dir)) {
558 *want_clusters += 1;
559 *xattr_credits += ocfs2_blocks_per_xattr_bucket(dir->i_sb);
560 }
561
562 /*
563 * reserve credits and clusters for xattrs which has large value
564 * and have to be set outside
565 */
566 if (si->enable && si->value_len > OCFS2_XATTR_INLINE_SIZE) {
567 new_clusters = ocfs2_clusters_for_bytes(dir->i_sb,
568 si->value_len);
569 *xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
570 new_clusters);
571 *want_clusters += new_clusters;
572 }
573 if (osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL &&
574 acl_len > OCFS2_XATTR_INLINE_SIZE) {
575 /* for directory, it has DEFAULT and ACCESS two types of acls */
576 new_clusters = (S_ISDIR(mode) ? 2 : 1) *
577 ocfs2_clusters_for_bytes(dir->i_sb, acl_len);
578 *xattr_credits += ocfs2_clusters_to_blocks(dir->i_sb,
579 new_clusters);
580 *want_clusters += new_clusters;
581 }
582
583 return ret;
584}
585
203static int ocfs2_xattr_extend_allocation(struct inode *inode, 586static int ocfs2_xattr_extend_allocation(struct inode *inode,
204 u32 clusters_to_add, 587 u32 clusters_to_add,
205 struct buffer_head *xattr_bh, 588 struct ocfs2_xattr_value_buf *vb,
206 struct ocfs2_xattr_value_root *xv) 589 struct ocfs2_xattr_set_ctxt *ctxt)
207{ 590{
208 int status = 0; 591 int status = 0;
209 int restart_func = 0; 592 handle_t *handle = ctxt->handle;
210 int credits = 0;
211 handle_t *handle = NULL;
212 struct ocfs2_alloc_context *data_ac = NULL;
213 struct ocfs2_alloc_context *meta_ac = NULL;
214 enum ocfs2_alloc_restarted why; 593 enum ocfs2_alloc_restarted why;
215 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 594 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
216 u32 prev_clusters, logical_start = le32_to_cpu(xv->xr_clusters); 595 u32 prev_clusters, logical_start = le32_to_cpu(vb->vb_xv->xr_clusters);
217 struct ocfs2_extent_tree et; 596 struct ocfs2_extent_tree et;
218 597
219 mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add); 598 mlog(0, "(clusters_to_add for xattr= %u)\n", clusters_to_add);
220 599
221 ocfs2_init_xattr_value_extent_tree(&et, inode, xattr_bh, xv); 600 ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
222
223restart_all:
224
225 status = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0,
226 &data_ac, &meta_ac);
227 if (status) {
228 mlog_errno(status);
229 goto leave;
230 }
231
232 credits = ocfs2_calc_extend_credits(osb->sb, et.et_root_el,
233 clusters_to_add);
234 handle = ocfs2_start_trans(osb, credits);
235 if (IS_ERR(handle)) {
236 status = PTR_ERR(handle);
237 handle = NULL;
238 mlog_errno(status);
239 goto leave;
240 }
241 601
242restarted_transaction: 602 status = vb->vb_access(handle, inode, vb->vb_bh,
243 status = ocfs2_journal_access(handle, inode, xattr_bh, 603 OCFS2_JOURNAL_ACCESS_WRITE);
244 OCFS2_JOURNAL_ACCESS_WRITE);
245 if (status < 0) { 604 if (status < 0) {
246 mlog_errno(status); 605 mlog_errno(status);
247 goto leave; 606 goto leave;
248 } 607 }
249 608
250 prev_clusters = le32_to_cpu(xv->xr_clusters); 609 prev_clusters = le32_to_cpu(vb->vb_xv->xr_clusters);
251 status = ocfs2_add_clusters_in_btree(osb, 610 status = ocfs2_add_clusters_in_btree(osb,
252 inode, 611 inode,
253 &logical_start, 612 &logical_start,
@@ -255,157 +614,84 @@ restarted_transaction:
255 0, 614 0,
256 &et, 615 &et,
257 handle, 616 handle,
258 data_ac, 617 ctxt->data_ac,
259 meta_ac, 618 ctxt->meta_ac,
260 &why); 619 &why);
261 if ((status < 0) && (status != -EAGAIN)) { 620 if (status < 0) {
262 if (status != -ENOSPC) 621 mlog_errno(status);
263 mlog_errno(status);
264 goto leave; 622 goto leave;
265 } 623 }
266 624
267 status = ocfs2_journal_dirty(handle, xattr_bh); 625 status = ocfs2_journal_dirty(handle, vb->vb_bh);
268 if (status < 0) { 626 if (status < 0) {
269 mlog_errno(status); 627 mlog_errno(status);
270 goto leave; 628 goto leave;
271 } 629 }
272 630
273 clusters_to_add -= le32_to_cpu(xv->xr_clusters) - prev_clusters; 631 clusters_to_add -= le32_to_cpu(vb->vb_xv->xr_clusters) - prev_clusters;
274 632
275 if (why != RESTART_NONE && clusters_to_add) { 633 /*
276 if (why == RESTART_META) { 634 * We should have already allocated enough space before the transaction,
277 mlog(0, "restarting function.\n"); 635 * so no need to restart.
278 restart_func = 1; 636 */
279 } else { 637 BUG_ON(why != RESTART_NONE || clusters_to_add);
280 BUG_ON(why != RESTART_TRANS);
281
282 mlog(0, "restarting transaction.\n");
283 /* TODO: This can be more intelligent. */
284 credits = ocfs2_calc_extend_credits(osb->sb,
285 et.et_root_el,
286 clusters_to_add);
287 status = ocfs2_extend_trans(handle, credits);
288 if (status < 0) {
289 /* handle still has to be committed at
290 * this point. */
291 status = -ENOMEM;
292 mlog_errno(status);
293 goto leave;
294 }
295 goto restarted_transaction;
296 }
297 }
298 638
299leave: 639leave:
300 if (handle) {
301 ocfs2_commit_trans(osb, handle);
302 handle = NULL;
303 }
304 if (data_ac) {
305 ocfs2_free_alloc_context(data_ac);
306 data_ac = NULL;
307 }
308 if (meta_ac) {
309 ocfs2_free_alloc_context(meta_ac);
310 meta_ac = NULL;
311 }
312 if ((!status) && restart_func) {
313 restart_func = 0;
314 goto restart_all;
315 }
316 640
317 return status; 641 return status;
318} 642}
319 643
320static int __ocfs2_remove_xattr_range(struct inode *inode, 644static int __ocfs2_remove_xattr_range(struct inode *inode,
321 struct buffer_head *root_bh, 645 struct ocfs2_xattr_value_buf *vb,
322 struct ocfs2_xattr_value_root *xv,
323 u32 cpos, u32 phys_cpos, u32 len, 646 u32 cpos, u32 phys_cpos, u32 len,
324 struct ocfs2_cached_dealloc_ctxt *dealloc) 647 struct ocfs2_xattr_set_ctxt *ctxt)
325{ 648{
326 int ret; 649 int ret;
327 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos); 650 u64 phys_blkno = ocfs2_clusters_to_blocks(inode->i_sb, phys_cpos);
328 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 651 handle_t *handle = ctxt->handle;
329 struct inode *tl_inode = osb->osb_tl_inode;
330 handle_t *handle;
331 struct ocfs2_alloc_context *meta_ac = NULL;
332 struct ocfs2_extent_tree et; 652 struct ocfs2_extent_tree et;
333 653
334 ocfs2_init_xattr_value_extent_tree(&et, inode, root_bh, xv); 654 ocfs2_init_xattr_value_extent_tree(&et, inode, vb);
335 655
336 ret = ocfs2_lock_allocators(inode, &et, 0, 1, NULL, &meta_ac); 656 ret = vb->vb_access(handle, inode, vb->vb_bh,
657 OCFS2_JOURNAL_ACCESS_WRITE);
337 if (ret) { 658 if (ret) {
338 mlog_errno(ret); 659 mlog_errno(ret);
339 return ret;
340 }
341
342 mutex_lock(&tl_inode->i_mutex);
343
344 if (ocfs2_truncate_log_needs_flush(osb)) {
345 ret = __ocfs2_flush_truncate_log(osb);
346 if (ret < 0) {
347 mlog_errno(ret);
348 goto out;
349 }
350 }
351
352 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS);
353 if (IS_ERR(handle)) {
354 ret = PTR_ERR(handle);
355 mlog_errno(ret);
356 goto out; 660 goto out;
357 } 661 }
358 662
359 ret = ocfs2_journal_access(handle, inode, root_bh, 663 ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, ctxt->meta_ac,
360 OCFS2_JOURNAL_ACCESS_WRITE); 664 &ctxt->dealloc);
361 if (ret) {
362 mlog_errno(ret);
363 goto out_commit;
364 }
365
366 ret = ocfs2_remove_extent(inode, &et, cpos, len, handle, meta_ac,
367 dealloc);
368 if (ret) { 665 if (ret) {
369 mlog_errno(ret); 666 mlog_errno(ret);
370 goto out_commit; 667 goto out;
371 } 668 }
372 669
373 le32_add_cpu(&xv->xr_clusters, -len); 670 le32_add_cpu(&vb->vb_xv->xr_clusters, -len);
374 671
375 ret = ocfs2_journal_dirty(handle, root_bh); 672 ret = ocfs2_journal_dirty(handle, vb->vb_bh);
376 if (ret) { 673 if (ret) {
377 mlog_errno(ret); 674 mlog_errno(ret);
378 goto out_commit; 675 goto out;
379 } 676 }
380 677
381 ret = ocfs2_truncate_log_append(osb, handle, phys_blkno, len); 678 ret = ocfs2_cache_cluster_dealloc(&ctxt->dealloc, phys_blkno, len);
382 if (ret) 679 if (ret)
383 mlog_errno(ret); 680 mlog_errno(ret);
384 681
385out_commit:
386 ocfs2_commit_trans(osb, handle);
387out: 682out:
388 mutex_unlock(&tl_inode->i_mutex);
389
390 if (meta_ac)
391 ocfs2_free_alloc_context(meta_ac);
392
393 return ret; 683 return ret;
394} 684}
395 685
396static int ocfs2_xattr_shrink_size(struct inode *inode, 686static int ocfs2_xattr_shrink_size(struct inode *inode,
397 u32 old_clusters, 687 u32 old_clusters,
398 u32 new_clusters, 688 u32 new_clusters,
399 struct buffer_head *root_bh, 689 struct ocfs2_xattr_value_buf *vb,
400 struct ocfs2_xattr_value_root *xv) 690 struct ocfs2_xattr_set_ctxt *ctxt)
401{ 691{
402 int ret = 0; 692 int ret = 0;
403 u32 trunc_len, cpos, phys_cpos, alloc_size; 693 u32 trunc_len, cpos, phys_cpos, alloc_size;
404 u64 block; 694 u64 block;
405 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
406 struct ocfs2_cached_dealloc_ctxt dealloc;
407
408 ocfs2_init_dealloc_ctxt(&dealloc);
409 695
410 if (old_clusters <= new_clusters) 696 if (old_clusters <= new_clusters)
411 return 0; 697 return 0;
@@ -414,7 +700,8 @@ static int ocfs2_xattr_shrink_size(struct inode *inode,
414 trunc_len = old_clusters - new_clusters; 700 trunc_len = old_clusters - new_clusters;
415 while (trunc_len) { 701 while (trunc_len) {
416 ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos, 702 ret = ocfs2_xattr_get_clusters(inode, cpos, &phys_cpos,
417 &alloc_size, &xv->xr_list); 703 &alloc_size,
704 &vb->vb_xv->xr_list);
418 if (ret) { 705 if (ret) {
419 mlog_errno(ret); 706 mlog_errno(ret);
420 goto out; 707 goto out;
@@ -423,9 +710,9 @@ static int ocfs2_xattr_shrink_size(struct inode *inode,
423 if (alloc_size > trunc_len) 710 if (alloc_size > trunc_len)
424 alloc_size = trunc_len; 711 alloc_size = trunc_len;
425 712
426 ret = __ocfs2_remove_xattr_range(inode, root_bh, xv, cpos, 713 ret = __ocfs2_remove_xattr_range(inode, vb, cpos,
427 phys_cpos, alloc_size, 714 phys_cpos, alloc_size,
428 &dealloc); 715 ctxt);
429 if (ret) { 716 if (ret) {
430 mlog_errno(ret); 717 mlog_errno(ret);
431 goto out; 718 goto out;
@@ -439,20 +726,17 @@ static int ocfs2_xattr_shrink_size(struct inode *inode,
439 } 726 }
440 727
441out: 728out:
442 ocfs2_schedule_truncate_log_flush(osb, 1);
443 ocfs2_run_deallocs(osb, &dealloc);
444
445 return ret; 729 return ret;
446} 730}
447 731
448static int ocfs2_xattr_value_truncate(struct inode *inode, 732static int ocfs2_xattr_value_truncate(struct inode *inode,
449 struct buffer_head *root_bh, 733 struct ocfs2_xattr_value_buf *vb,
450 struct ocfs2_xattr_value_root *xv, 734 int len,
451 int len) 735 struct ocfs2_xattr_set_ctxt *ctxt)
452{ 736{
453 int ret; 737 int ret;
454 u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb, len); 738 u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb, len);
455 u32 old_clusters = le32_to_cpu(xv->xr_clusters); 739 u32 old_clusters = le32_to_cpu(vb->vb_xv->xr_clusters);
456 740
457 if (new_clusters == old_clusters) 741 if (new_clusters == old_clusters)
458 return 0; 742 return 0;
@@ -460,11 +744,11 @@ static int ocfs2_xattr_value_truncate(struct inode *inode,
460 if (new_clusters > old_clusters) 744 if (new_clusters > old_clusters)
461 ret = ocfs2_xattr_extend_allocation(inode, 745 ret = ocfs2_xattr_extend_allocation(inode,
462 new_clusters - old_clusters, 746 new_clusters - old_clusters,
463 root_bh, xv); 747 vb, ctxt);
464 else 748 else
465 ret = ocfs2_xattr_shrink_size(inode, 749 ret = ocfs2_xattr_shrink_size(inode,
466 old_clusters, new_clusters, 750 old_clusters, new_clusters,
467 root_bh, xv); 751 vb, ctxt);
468 752
469 return ret; 753 return ret;
470} 754}
@@ -554,18 +838,14 @@ static int ocfs2_xattr_block_list(struct inode *inode,
554 if (!di->i_xattr_loc) 838 if (!di->i_xattr_loc)
555 return ret; 839 return ret;
556 840
557 ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh); 841 ret = ocfs2_read_xattr_block(inode, le64_to_cpu(di->i_xattr_loc),
842 &blk_bh);
558 if (ret < 0) { 843 if (ret < 0) {
559 mlog_errno(ret); 844 mlog_errno(ret);
560 return ret; 845 return ret;
561 } 846 }
562 847
563 xb = (struct ocfs2_xattr_block *)blk_bh->b_data; 848 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
564 if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
565 ret = -EIO;
566 goto cleanup;
567 }
568
569 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) { 849 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
570 struct ocfs2_xattr_header *header = &xb->xb_attrs.xb_header; 850 struct ocfs2_xattr_header *header = &xb->xb_attrs.xb_header;
571 ret = ocfs2_xattr_list_entries(inode, header, 851 ret = ocfs2_xattr_list_entries(inode, header,
@@ -575,7 +855,7 @@ static int ocfs2_xattr_block_list(struct inode *inode,
575 ret = ocfs2_xattr_tree_list_index_block(inode, xt, 855 ret = ocfs2_xattr_tree_list_index_block(inode, xt,
576 buffer, buffer_size); 856 buffer, buffer_size);
577 } 857 }
578cleanup: 858
579 brelse(blk_bh); 859 brelse(blk_bh);
580 860
581 return ret; 861 return ret;
@@ -685,7 +965,7 @@ static int ocfs2_xattr_get_value_outside(struct inode *inode,
685 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster); 965 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
686 /* Copy ocfs2_xattr_value */ 966 /* Copy ocfs2_xattr_value */
687 for (i = 0; i < num_clusters * bpc; i++, blkno++) { 967 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
688 ret = ocfs2_read_block(inode, blkno, &bh); 968 ret = ocfs2_read_block(inode, blkno, &bh, NULL);
689 if (ret) { 969 if (ret) {
690 mlog_errno(ret); 970 mlog_errno(ret);
691 goto out; 971 goto out;
@@ -769,7 +1049,12 @@ static int ocfs2_xattr_block_get(struct inode *inode,
769 size_t size; 1049 size_t size;
770 int ret = -ENODATA, name_offset, name_len, block_off, i; 1050 int ret = -ENODATA, name_offset, name_len, block_off, i;
771 1051
772 memset(&xs->bucket, 0, sizeof(xs->bucket)); 1052 xs->bucket = ocfs2_xattr_bucket_new(inode);
1053 if (!xs->bucket) {
1054 ret = -ENOMEM;
1055 mlog_errno(ret);
1056 goto cleanup;
1057 }
773 1058
774 ret = ocfs2_xattr_block_find(inode, name_index, name, xs); 1059 ret = ocfs2_xattr_block_find(inode, name_index, name, xs);
775 if (ret) { 1060 if (ret) {
@@ -795,11 +1080,11 @@ static int ocfs2_xattr_block_get(struct inode *inode,
795 1080
796 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) { 1081 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
797 ret = ocfs2_xattr_bucket_get_name_value(inode, 1082 ret = ocfs2_xattr_bucket_get_name_value(inode,
798 xs->bucket.xh, 1083 bucket_xh(xs->bucket),
799 i, 1084 i,
800 &block_off, 1085 &block_off,
801 &name_offset); 1086 &name_offset);
802 xs->base = xs->bucket.bhs[block_off]->b_data; 1087 xs->base = bucket_block(xs->bucket, block_off);
803 } 1088 }
804 if (ocfs2_xattr_is_local(xs->here)) { 1089 if (ocfs2_xattr_is_local(xs->here)) {
805 memcpy(buffer, (void *)xs->base + 1090 memcpy(buffer, (void *)xs->base +
@@ -817,21 +1102,15 @@ static int ocfs2_xattr_block_get(struct inode *inode,
817 } 1102 }
818 ret = size; 1103 ret = size;
819cleanup: 1104cleanup:
820 for (i = 0; i < OCFS2_XATTR_MAX_BLOCKS_PER_BUCKET; i++) 1105 ocfs2_xattr_bucket_free(xs->bucket);
821 brelse(xs->bucket.bhs[i]);
822 memset(&xs->bucket, 0, sizeof(xs->bucket));
823 1106
824 brelse(xs->xattr_bh); 1107 brelse(xs->xattr_bh);
825 xs->xattr_bh = NULL; 1108 xs->xattr_bh = NULL;
826 return ret; 1109 return ret;
827} 1110}
828 1111
829/* ocfs2_xattr_get() 1112int ocfs2_xattr_get_nolock(struct inode *inode,
830 * 1113 struct buffer_head *di_bh,
831 * Copy an extended attribute into the buffer provided.
832 * Buffer is NULL to compute the size of buffer required.
833 */
834static int ocfs2_xattr_get(struct inode *inode,
835 int name_index, 1114 int name_index,
836 const char *name, 1115 const char *name,
837 void *buffer, 1116 void *buffer,
@@ -839,7 +1118,6 @@ static int ocfs2_xattr_get(struct inode *inode,
839{ 1118{
840 int ret; 1119 int ret;
841 struct ocfs2_dinode *di = NULL; 1120 struct ocfs2_dinode *di = NULL;
842 struct buffer_head *di_bh = NULL;
843 struct ocfs2_inode_info *oi = OCFS2_I(inode); 1121 struct ocfs2_inode_info *oi = OCFS2_I(inode);
844 struct ocfs2_xattr_search xis = { 1122 struct ocfs2_xattr_search xis = {
845 .not_found = -ENODATA, 1123 .not_found = -ENODATA,
@@ -854,11 +1132,6 @@ static int ocfs2_xattr_get(struct inode *inode,
854 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL)) 1132 if (!(oi->ip_dyn_features & OCFS2_HAS_XATTR_FL))
855 ret = -ENODATA; 1133 ret = -ENODATA;
856 1134
857 ret = ocfs2_inode_lock(inode, &di_bh, 0);
858 if (ret < 0) {
859 mlog_errno(ret);
860 return ret;
861 }
862 xis.inode_bh = xbs.inode_bh = di_bh; 1135 xis.inode_bh = xbs.inode_bh = di_bh;
863 di = (struct ocfs2_dinode *)di_bh->b_data; 1136 di = (struct ocfs2_dinode *)di_bh->b_data;
864 1137
@@ -869,6 +1142,32 @@ static int ocfs2_xattr_get(struct inode *inode,
869 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer, 1142 ret = ocfs2_xattr_block_get(inode, name_index, name, buffer,
870 buffer_size, &xbs); 1143 buffer_size, &xbs);
871 up_read(&oi->ip_xattr_sem); 1144 up_read(&oi->ip_xattr_sem);
1145
1146 return ret;
1147}
1148
1149/* ocfs2_xattr_get()
1150 *
1151 * Copy an extended attribute into the buffer provided.
1152 * Buffer is NULL to compute the size of buffer required.
1153 */
1154static int ocfs2_xattr_get(struct inode *inode,
1155 int name_index,
1156 const char *name,
1157 void *buffer,
1158 size_t buffer_size)
1159{
1160 int ret;
1161 struct buffer_head *di_bh = NULL;
1162
1163 ret = ocfs2_inode_lock(inode, &di_bh, 0);
1164 if (ret < 0) {
1165 mlog_errno(ret);
1166 return ret;
1167 }
1168 ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index,
1169 name, buffer, buffer_size);
1170
872 ocfs2_inode_unlock(inode, 0); 1171 ocfs2_inode_unlock(inode, 0);
873 1172
874 brelse(di_bh); 1173 brelse(di_bh);
@@ -877,44 +1176,36 @@ static int ocfs2_xattr_get(struct inode *inode,
877} 1176}
878 1177
879static int __ocfs2_xattr_set_value_outside(struct inode *inode, 1178static int __ocfs2_xattr_set_value_outside(struct inode *inode,
1179 handle_t *handle,
880 struct ocfs2_xattr_value_root *xv, 1180 struct ocfs2_xattr_value_root *xv,
881 const void *value, 1181 const void *value,
882 int value_len) 1182 int value_len)
883{ 1183{
884 int ret = 0, i, cp_len, credits; 1184 int ret = 0, i, cp_len;
885 u16 blocksize = inode->i_sb->s_blocksize; 1185 u16 blocksize = inode->i_sb->s_blocksize;
886 u32 p_cluster, num_clusters; 1186 u32 p_cluster, num_clusters;
887 u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 1187 u32 cpos = 0, bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
888 u32 clusters = ocfs2_clusters_for_bytes(inode->i_sb, value_len); 1188 u32 clusters = ocfs2_clusters_for_bytes(inode->i_sb, value_len);
889 u64 blkno; 1189 u64 blkno;
890 struct buffer_head *bh = NULL; 1190 struct buffer_head *bh = NULL;
891 handle_t *handle;
892 1191
893 BUG_ON(clusters > le32_to_cpu(xv->xr_clusters)); 1192 BUG_ON(clusters > le32_to_cpu(xv->xr_clusters));
894 1193
895 credits = clusters * bpc;
896 handle = ocfs2_start_trans(OCFS2_SB(inode->i_sb), credits);
897 if (IS_ERR(handle)) {
898 ret = PTR_ERR(handle);
899 mlog_errno(ret);
900 goto out;
901 }
902
903 while (cpos < clusters) { 1194 while (cpos < clusters) {
904 ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster, 1195 ret = ocfs2_xattr_get_clusters(inode, cpos, &p_cluster,
905 &num_clusters, &xv->xr_list); 1196 &num_clusters, &xv->xr_list);
906 if (ret) { 1197 if (ret) {
907 mlog_errno(ret); 1198 mlog_errno(ret);
908 goto out_commit; 1199 goto out;
909 } 1200 }
910 1201
911 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster); 1202 blkno = ocfs2_clusters_to_blocks(inode->i_sb, p_cluster);
912 1203
913 for (i = 0; i < num_clusters * bpc; i++, blkno++) { 1204 for (i = 0; i < num_clusters * bpc; i++, blkno++) {
914 ret = ocfs2_read_block(inode, blkno, &bh); 1205 ret = ocfs2_read_block(inode, blkno, &bh, NULL);
915 if (ret) { 1206 if (ret) {
916 mlog_errno(ret); 1207 mlog_errno(ret);
917 goto out_commit; 1208 goto out;
918 } 1209 }
919 1210
920 ret = ocfs2_journal_access(handle, 1211 ret = ocfs2_journal_access(handle,
@@ -923,7 +1214,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
923 OCFS2_JOURNAL_ACCESS_WRITE); 1214 OCFS2_JOURNAL_ACCESS_WRITE);
924 if (ret < 0) { 1215 if (ret < 0) {
925 mlog_errno(ret); 1216 mlog_errno(ret);
926 goto out_commit; 1217 goto out;
927 } 1218 }
928 1219
929 cp_len = value_len > blocksize ? blocksize : value_len; 1220 cp_len = value_len > blocksize ? blocksize : value_len;
@@ -937,7 +1228,7 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
937 ret = ocfs2_journal_dirty(handle, bh); 1228 ret = ocfs2_journal_dirty(handle, bh);
938 if (ret < 0) { 1229 if (ret < 0) {
939 mlog_errno(ret); 1230 mlog_errno(ret);
940 goto out_commit; 1231 goto out;
941 } 1232 }
942 brelse(bh); 1233 brelse(bh);
943 bh = NULL; 1234 bh = NULL;
@@ -951,8 +1242,6 @@ static int __ocfs2_xattr_set_value_outside(struct inode *inode,
951 } 1242 }
952 cpos += num_clusters; 1243 cpos += num_clusters;
953 } 1244 }
954out_commit:
955 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
956out: 1245out:
957 brelse(bh); 1246 brelse(bh);
958 1247
@@ -960,28 +1249,22 @@ out:
960} 1249}
961 1250
962static int ocfs2_xattr_cleanup(struct inode *inode, 1251static int ocfs2_xattr_cleanup(struct inode *inode,
1252 handle_t *handle,
963 struct ocfs2_xattr_info *xi, 1253 struct ocfs2_xattr_info *xi,
964 struct ocfs2_xattr_search *xs, 1254 struct ocfs2_xattr_search *xs,
1255 struct ocfs2_xattr_value_buf *vb,
965 size_t offs) 1256 size_t offs)
966{ 1257{
967 handle_t *handle = NULL;
968 int ret = 0; 1258 int ret = 0;
969 size_t name_len = strlen(xi->name); 1259 size_t name_len = strlen(xi->name);
970 void *val = xs->base + offs; 1260 void *val = xs->base + offs;
971 size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE; 1261 size_t size = OCFS2_XATTR_SIZE(name_len) + OCFS2_XATTR_ROOT_SIZE;
972 1262
973 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), 1263 ret = vb->vb_access(handle, inode, vb->vb_bh,
974 OCFS2_XATTR_BLOCK_UPDATE_CREDITS); 1264 OCFS2_JOURNAL_ACCESS_WRITE);
975 if (IS_ERR(handle)) {
976 ret = PTR_ERR(handle);
977 mlog_errno(ret);
978 goto out;
979 }
980 ret = ocfs2_journal_access(handle, inode, xs->xattr_bh,
981 OCFS2_JOURNAL_ACCESS_WRITE);
982 if (ret) { 1265 if (ret) {
983 mlog_errno(ret); 1266 mlog_errno(ret);
984 goto out_commit; 1267 goto out;
985 } 1268 }
986 /* Decrease xattr count */ 1269 /* Decrease xattr count */
987 le16_add_cpu(&xs->header->xh_count, -1); 1270 le16_add_cpu(&xs->header->xh_count, -1);
@@ -989,35 +1272,27 @@ static int ocfs2_xattr_cleanup(struct inode *inode,
989 memset((void *)xs->here, 0, sizeof(struct ocfs2_xattr_entry)); 1272 memset((void *)xs->here, 0, sizeof(struct ocfs2_xattr_entry));
990 memset(val, 0, size); 1273 memset(val, 0, size);
991 1274
992 ret = ocfs2_journal_dirty(handle, xs->xattr_bh); 1275 ret = ocfs2_journal_dirty(handle, vb->vb_bh);
993 if (ret < 0) 1276 if (ret < 0)
994 mlog_errno(ret); 1277 mlog_errno(ret);
995out_commit:
996 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
997out: 1278out:
998 return ret; 1279 return ret;
999} 1280}
1000 1281
1001static int ocfs2_xattr_update_entry(struct inode *inode, 1282static int ocfs2_xattr_update_entry(struct inode *inode,
1283 handle_t *handle,
1002 struct ocfs2_xattr_info *xi, 1284 struct ocfs2_xattr_info *xi,
1003 struct ocfs2_xattr_search *xs, 1285 struct ocfs2_xattr_search *xs,
1286 struct ocfs2_xattr_value_buf *vb,
1004 size_t offs) 1287 size_t offs)
1005{ 1288{
1006 handle_t *handle = NULL; 1289 int ret;
1007 int ret = 0;
1008 1290
1009 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), 1291 ret = vb->vb_access(handle, inode, vb->vb_bh,
1010 OCFS2_XATTR_BLOCK_UPDATE_CREDITS); 1292 OCFS2_JOURNAL_ACCESS_WRITE);
1011 if (IS_ERR(handle)) {
1012 ret = PTR_ERR(handle);
1013 mlog_errno(ret);
1014 goto out;
1015 }
1016 ret = ocfs2_journal_access(handle, inode, xs->xattr_bh,
1017 OCFS2_JOURNAL_ACCESS_WRITE);
1018 if (ret) { 1293 if (ret) {
1019 mlog_errno(ret); 1294 mlog_errno(ret);
1020 goto out_commit; 1295 goto out;
1021 } 1296 }
1022 1297
1023 xs->here->xe_name_offset = cpu_to_le16(offs); 1298 xs->here->xe_name_offset = cpu_to_le16(offs);
@@ -1028,11 +1303,9 @@ static int ocfs2_xattr_update_entry(struct inode *inode,
1028 ocfs2_xattr_set_local(xs->here, 0); 1303 ocfs2_xattr_set_local(xs->here, 0);
1029 ocfs2_xattr_hash_entry(inode, xs->header, xs->here); 1304 ocfs2_xattr_hash_entry(inode, xs->header, xs->here);
1030 1305
1031 ret = ocfs2_journal_dirty(handle, xs->xattr_bh); 1306 ret = ocfs2_journal_dirty(handle, vb->vb_bh);
1032 if (ret < 0) 1307 if (ret < 0)
1033 mlog_errno(ret); 1308 mlog_errno(ret);
1034out_commit:
1035 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
1036out: 1309out:
1037 return ret; 1310 return ret;
1038} 1311}
@@ -1045,6 +1318,8 @@ out:
1045static int ocfs2_xattr_set_value_outside(struct inode *inode, 1318static int ocfs2_xattr_set_value_outside(struct inode *inode,
1046 struct ocfs2_xattr_info *xi, 1319 struct ocfs2_xattr_info *xi,
1047 struct ocfs2_xattr_search *xs, 1320 struct ocfs2_xattr_search *xs,
1321 struct ocfs2_xattr_set_ctxt *ctxt,
1322 struct ocfs2_xattr_value_buf *vb,
1048 size_t offs) 1323 size_t offs)
1049{ 1324{
1050 size_t name_len = strlen(xi->name); 1325 size_t name_len = strlen(xi->name);
@@ -1062,20 +1337,20 @@ static int ocfs2_xattr_set_value_outside(struct inode *inode,
1062 xv->xr_list.l_tree_depth = 0; 1337 xv->xr_list.l_tree_depth = 0;
1063 xv->xr_list.l_count = cpu_to_le16(1); 1338 xv->xr_list.l_count = cpu_to_le16(1);
1064 xv->xr_list.l_next_free_rec = 0; 1339 xv->xr_list.l_next_free_rec = 0;
1340 vb->vb_xv = xv;
1065 1341
1066 ret = ocfs2_xattr_value_truncate(inode, xs->xattr_bh, xv, 1342 ret = ocfs2_xattr_value_truncate(inode, vb, xi->value_len, ctxt);
1067 xi->value_len);
1068 if (ret < 0) { 1343 if (ret < 0) {
1069 mlog_errno(ret); 1344 mlog_errno(ret);
1070 return ret; 1345 return ret;
1071 } 1346 }
1072 ret = __ocfs2_xattr_set_value_outside(inode, xv, xi->value, 1347 ret = ocfs2_xattr_update_entry(inode, ctxt->handle, xi, xs, vb, offs);
1073 xi->value_len);
1074 if (ret < 0) { 1348 if (ret < 0) {
1075 mlog_errno(ret); 1349 mlog_errno(ret);
1076 return ret; 1350 return ret;
1077 } 1351 }
1078 ret = ocfs2_xattr_update_entry(inode, xi, xs, offs); 1352 ret = __ocfs2_xattr_set_value_outside(inode, ctxt->handle, vb->vb_xv,
1353 xi->value, xi->value_len);
1079 if (ret < 0) 1354 if (ret < 0)
1080 mlog_errno(ret); 1355 mlog_errno(ret);
1081 1356
@@ -1195,6 +1470,7 @@ static void ocfs2_xattr_set_entry_local(struct inode *inode,
1195static int ocfs2_xattr_set_entry(struct inode *inode, 1470static int ocfs2_xattr_set_entry(struct inode *inode,
1196 struct ocfs2_xattr_info *xi, 1471 struct ocfs2_xattr_info *xi,
1197 struct ocfs2_xattr_search *xs, 1472 struct ocfs2_xattr_search *xs,
1473 struct ocfs2_xattr_set_ctxt *ctxt,
1198 int flag) 1474 int flag)
1199{ 1475{
1200 struct ocfs2_xattr_entry *last; 1476 struct ocfs2_xattr_entry *last;
@@ -1202,7 +1478,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1202 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; 1478 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data;
1203 size_t min_offs = xs->end - xs->base, name_len = strlen(xi->name); 1479 size_t min_offs = xs->end - xs->base, name_len = strlen(xi->name);
1204 size_t size_l = 0; 1480 size_t size_l = 0;
1205 handle_t *handle = NULL; 1481 handle_t *handle = ctxt->handle;
1206 int free, i, ret; 1482 int free, i, ret;
1207 struct ocfs2_xattr_info xi_l = { 1483 struct ocfs2_xattr_info xi_l = {
1208 .name_index = xi->name_index, 1484 .name_index = xi->name_index,
@@ -1210,6 +1486,16 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1210 .value = xi->value, 1486 .value = xi->value,
1211 .value_len = xi->value_len, 1487 .value_len = xi->value_len,
1212 }; 1488 };
1489 struct ocfs2_xattr_value_buf vb = {
1490 .vb_bh = xs->xattr_bh,
1491 .vb_access = ocfs2_journal_access_di,
1492 };
1493
1494 if (!(flag & OCFS2_INLINE_XATTR_FL)) {
1495 BUG_ON(xs->xattr_bh == xs->inode_bh);
1496 vb.vb_access = ocfs2_journal_access_xb;
1497 } else
1498 BUG_ON(xs->xattr_bh != xs->inode_bh);
1213 1499
1214 /* Compute min_offs, last and free space. */ 1500 /* Compute min_offs, last and free space. */
1215 last = xs->header->xh_entries; 1501 last = xs->header->xh_entries;
@@ -1265,15 +1551,14 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1265 if (ocfs2_xattr_is_local(xs->here) && size == size_l) { 1551 if (ocfs2_xattr_is_local(xs->here) && size == size_l) {
1266 /* Replace existing local xattr with tree root */ 1552 /* Replace existing local xattr with tree root */
1267 ret = ocfs2_xattr_set_value_outside(inode, xi, xs, 1553 ret = ocfs2_xattr_set_value_outside(inode, xi, xs,
1268 offs); 1554 ctxt, &vb, offs);
1269 if (ret < 0) 1555 if (ret < 0)
1270 mlog_errno(ret); 1556 mlog_errno(ret);
1271 goto out; 1557 goto out;
1272 } else if (!ocfs2_xattr_is_local(xs->here)) { 1558 } else if (!ocfs2_xattr_is_local(xs->here)) {
1273 /* For existing xattr which has value outside */ 1559 /* For existing xattr which has value outside */
1274 struct ocfs2_xattr_value_root *xv = NULL; 1560 vb.vb_xv = (struct ocfs2_xattr_value_root *)
1275 xv = (struct ocfs2_xattr_value_root *)(val + 1561 (val + OCFS2_XATTR_SIZE(name_len));
1276 OCFS2_XATTR_SIZE(name_len));
1277 1562
1278 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) { 1563 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
1279 /* 1564 /*
@@ -1282,27 +1567,30 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1282 * then set new value with set_value_outside(). 1567 * then set new value with set_value_outside().
1283 */ 1568 */
1284 ret = ocfs2_xattr_value_truncate(inode, 1569 ret = ocfs2_xattr_value_truncate(inode,
1285 xs->xattr_bh, 1570 &vb,
1286 xv, 1571 xi->value_len,
1287 xi->value_len); 1572 ctxt);
1288 if (ret < 0) { 1573 if (ret < 0) {
1289 mlog_errno(ret); 1574 mlog_errno(ret);
1290 goto out; 1575 goto out;
1291 } 1576 }
1292 1577
1293 ret = __ocfs2_xattr_set_value_outside(inode, 1578 ret = ocfs2_xattr_update_entry(inode,
1294 xv, 1579 handle,
1295 xi->value, 1580 xi,
1296 xi->value_len); 1581 xs,
1582 &vb,
1583 offs);
1297 if (ret < 0) { 1584 if (ret < 0) {
1298 mlog_errno(ret); 1585 mlog_errno(ret);
1299 goto out; 1586 goto out;
1300 } 1587 }
1301 1588
1302 ret = ocfs2_xattr_update_entry(inode, 1589 ret = __ocfs2_xattr_set_value_outside(inode,
1303 xi, 1590 handle,
1304 xs, 1591 vb.vb_xv,
1305 offs); 1592 xi->value,
1593 xi->value_len);
1306 if (ret < 0) 1594 if (ret < 0)
1307 mlog_errno(ret); 1595 mlog_errno(ret);
1308 goto out; 1596 goto out;
@@ -1312,44 +1600,28 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1312 * just trucate old value to zero. 1600 * just trucate old value to zero.
1313 */ 1601 */
1314 ret = ocfs2_xattr_value_truncate(inode, 1602 ret = ocfs2_xattr_value_truncate(inode,
1315 xs->xattr_bh, 1603 &vb,
1316 xv, 1604 0,
1317 0); 1605 ctxt);
1318 if (ret < 0) 1606 if (ret < 0)
1319 mlog_errno(ret); 1607 mlog_errno(ret);
1320 } 1608 }
1321 } 1609 }
1322 } 1610 }
1323 1611
1324 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), 1612 ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh,
1325 OCFS2_INODE_UPDATE_CREDITS); 1613 OCFS2_JOURNAL_ACCESS_WRITE);
1326 if (IS_ERR(handle)) {
1327 ret = PTR_ERR(handle);
1328 mlog_errno(ret);
1329 goto out;
1330 }
1331
1332 ret = ocfs2_journal_access(handle, inode, xs->inode_bh,
1333 OCFS2_JOURNAL_ACCESS_WRITE);
1334 if (ret) { 1614 if (ret) {
1335 mlog_errno(ret); 1615 mlog_errno(ret);
1336 goto out_commit; 1616 goto out;
1337 } 1617 }
1338 1618
1339 if (!(flag & OCFS2_INLINE_XATTR_FL)) { 1619 if (!(flag & OCFS2_INLINE_XATTR_FL)) {
1340 /* set extended attribute in external block. */ 1620 ret = vb.vb_access(handle, inode, vb.vb_bh,
1341 ret = ocfs2_extend_trans(handle, 1621 OCFS2_JOURNAL_ACCESS_WRITE);
1342 OCFS2_INODE_UPDATE_CREDITS +
1343 OCFS2_XATTR_BLOCK_UPDATE_CREDITS);
1344 if (ret) {
1345 mlog_errno(ret);
1346 goto out_commit;
1347 }
1348 ret = ocfs2_journal_access(handle, inode, xs->xattr_bh,
1349 OCFS2_JOURNAL_ACCESS_WRITE);
1350 if (ret) { 1622 if (ret) {
1351 mlog_errno(ret); 1623 mlog_errno(ret);
1352 goto out_commit; 1624 goto out;
1353 } 1625 }
1354 } 1626 }
1355 1627
@@ -1363,7 +1635,7 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1363 ret = ocfs2_journal_dirty(handle, xs->xattr_bh); 1635 ret = ocfs2_journal_dirty(handle, xs->xattr_bh);
1364 if (ret < 0) { 1636 if (ret < 0) {
1365 mlog_errno(ret); 1637 mlog_errno(ret);
1366 goto out_commit; 1638 goto out;
1367 } 1639 }
1368 } 1640 }
1369 1641
@@ -1391,25 +1663,19 @@ static int ocfs2_xattr_set_entry(struct inode *inode,
1391 oi->ip_dyn_features |= flag; 1663 oi->ip_dyn_features |= flag;
1392 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features); 1664 di->i_dyn_features = cpu_to_le16(oi->ip_dyn_features);
1393 spin_unlock(&oi->ip_lock); 1665 spin_unlock(&oi->ip_lock);
1394 /* Update inode ctime */
1395 inode->i_ctime = CURRENT_TIME;
1396 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
1397 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
1398 1666
1399 ret = ocfs2_journal_dirty(handle, xs->inode_bh); 1667 ret = ocfs2_journal_dirty(handle, xs->inode_bh);
1400 if (ret < 0) 1668 if (ret < 0)
1401 mlog_errno(ret); 1669 mlog_errno(ret);
1402 1670
1403out_commit:
1404 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
1405
1406 if (!ret && xi->value_len > OCFS2_XATTR_INLINE_SIZE) { 1671 if (!ret && xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
1407 /* 1672 /*
1408 * Set value outside in B tree. 1673 * Set value outside in B tree.
1409 * This is the second step for value size > INLINE_SIZE. 1674 * This is the second step for value size > INLINE_SIZE.
1410 */ 1675 */
1411 size_t offs = le16_to_cpu(xs->here->xe_name_offset); 1676 size_t offs = le16_to_cpu(xs->here->xe_name_offset);
1412 ret = ocfs2_xattr_set_value_outside(inode, xi, xs, offs); 1677 ret = ocfs2_xattr_set_value_outside(inode, xi, xs, ctxt,
1678 &vb, offs);
1413 if (ret < 0) { 1679 if (ret < 0) {
1414 int ret2; 1680 int ret2;
1415 1681
@@ -1418,41 +1684,56 @@ out_commit:
1418 * If set value outside failed, we have to clean 1684 * If set value outside failed, we have to clean
1419 * the junk tree root we have already set in local. 1685 * the junk tree root we have already set in local.
1420 */ 1686 */
1421 ret2 = ocfs2_xattr_cleanup(inode, xi, xs, offs); 1687 ret2 = ocfs2_xattr_cleanup(inode, ctxt->handle,
1688 xi, xs, &vb, offs);
1422 if (ret2 < 0) 1689 if (ret2 < 0)
1423 mlog_errno(ret2); 1690 mlog_errno(ret2);
1424 } 1691 }
1425 } 1692 }
1426out: 1693out:
1427 return ret; 1694 return ret;
1428
1429} 1695}
1430 1696
1431static int ocfs2_remove_value_outside(struct inode*inode, 1697static int ocfs2_remove_value_outside(struct inode*inode,
1432 struct buffer_head *bh, 1698 struct ocfs2_xattr_value_buf *vb,
1433 struct ocfs2_xattr_header *header) 1699 struct ocfs2_xattr_header *header)
1434{ 1700{
1435 int ret = 0, i; 1701 int ret = 0, i;
1702 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1703 struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, };
1704
1705 ocfs2_init_dealloc_ctxt(&ctxt.dealloc);
1706
1707 ctxt.handle = ocfs2_start_trans(osb,
1708 ocfs2_remove_extent_credits(osb->sb));
1709 if (IS_ERR(ctxt.handle)) {
1710 ret = PTR_ERR(ctxt.handle);
1711 mlog_errno(ret);
1712 goto out;
1713 }
1436 1714
1437 for (i = 0; i < le16_to_cpu(header->xh_count); i++) { 1715 for (i = 0; i < le16_to_cpu(header->xh_count); i++) {
1438 struct ocfs2_xattr_entry *entry = &header->xh_entries[i]; 1716 struct ocfs2_xattr_entry *entry = &header->xh_entries[i];
1439 1717
1440 if (!ocfs2_xattr_is_local(entry)) { 1718 if (!ocfs2_xattr_is_local(entry)) {
1441 struct ocfs2_xattr_value_root *xv;
1442 void *val; 1719 void *val;
1443 1720
1444 val = (void *)header + 1721 val = (void *)header +
1445 le16_to_cpu(entry->xe_name_offset); 1722 le16_to_cpu(entry->xe_name_offset);
1446 xv = (struct ocfs2_xattr_value_root *) 1723 vb->vb_xv = (struct ocfs2_xattr_value_root *)
1447 (val + OCFS2_XATTR_SIZE(entry->xe_name_len)); 1724 (val + OCFS2_XATTR_SIZE(entry->xe_name_len));
1448 ret = ocfs2_xattr_value_truncate(inode, bh, xv, 0); 1725 ret = ocfs2_xattr_value_truncate(inode, vb, 0, &ctxt);
1449 if (ret < 0) { 1726 if (ret < 0) {
1450 mlog_errno(ret); 1727 mlog_errno(ret);
1451 return ret; 1728 break;
1452 } 1729 }
1453 } 1730 }
1454 } 1731 }
1455 1732
1733 ocfs2_commit_trans(osb, ctxt.handle);
1734 ocfs2_schedule_truncate_log_flush(osb, 1);
1735 ocfs2_run_deallocs(osb, &ctxt.dealloc);
1736out:
1456 return ret; 1737 return ret;
1457} 1738}
1458 1739
@@ -1463,12 +1744,16 @@ static int ocfs2_xattr_ibody_remove(struct inode *inode,
1463 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data; 1744 struct ocfs2_dinode *di = (struct ocfs2_dinode *)di_bh->b_data;
1464 struct ocfs2_xattr_header *header; 1745 struct ocfs2_xattr_header *header;
1465 int ret; 1746 int ret;
1747 struct ocfs2_xattr_value_buf vb = {
1748 .vb_bh = di_bh,
1749 .vb_access = ocfs2_journal_access_di,
1750 };
1466 1751
1467 header = (struct ocfs2_xattr_header *) 1752 header = (struct ocfs2_xattr_header *)
1468 ((void *)di + inode->i_sb->s_blocksize - 1753 ((void *)di + inode->i_sb->s_blocksize -
1469 le16_to_cpu(di->i_xattr_inline_size)); 1754 le16_to_cpu(di->i_xattr_inline_size));
1470 1755
1471 ret = ocfs2_remove_value_outside(inode, di_bh, header); 1756 ret = ocfs2_remove_value_outside(inode, &vb, header);
1472 1757
1473 return ret; 1758 return ret;
1474} 1759}
@@ -1478,11 +1763,15 @@ static int ocfs2_xattr_block_remove(struct inode *inode,
1478{ 1763{
1479 struct ocfs2_xattr_block *xb; 1764 struct ocfs2_xattr_block *xb;
1480 int ret = 0; 1765 int ret = 0;
1766 struct ocfs2_xattr_value_buf vb = {
1767 .vb_bh = blk_bh,
1768 .vb_access = ocfs2_journal_access_xb,
1769 };
1481 1770
1482 xb = (struct ocfs2_xattr_block *)blk_bh->b_data; 1771 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
1483 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) { 1772 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
1484 struct ocfs2_xattr_header *header = &(xb->xb_attrs.xb_header); 1773 struct ocfs2_xattr_header *header = &(xb->xb_attrs.xb_header);
1485 ret = ocfs2_remove_value_outside(inode, blk_bh, header); 1774 ret = ocfs2_remove_value_outside(inode, &vb, header);
1486 } else 1775 } else
1487 ret = ocfs2_delete_xattr_index_block(inode, blk_bh); 1776 ret = ocfs2_delete_xattr_index_block(inode, blk_bh);
1488 1777
@@ -1502,24 +1791,19 @@ static int ocfs2_xattr_free_block(struct inode *inode,
1502 u64 blk, bg_blkno; 1791 u64 blk, bg_blkno;
1503 u16 bit; 1792 u16 bit;
1504 1793
1505 ret = ocfs2_read_block(inode, block, &blk_bh); 1794 ret = ocfs2_read_xattr_block(inode, block, &blk_bh);
1506 if (ret < 0) { 1795 if (ret < 0) {
1507 mlog_errno(ret); 1796 mlog_errno(ret);
1508 goto out; 1797 goto out;
1509 } 1798 }
1510 1799
1511 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
1512 if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
1513 ret = -EIO;
1514 goto out;
1515 }
1516
1517 ret = ocfs2_xattr_block_remove(inode, blk_bh); 1800 ret = ocfs2_xattr_block_remove(inode, blk_bh);
1518 if (ret < 0) { 1801 if (ret < 0) {
1519 mlog_errno(ret); 1802 mlog_errno(ret);
1520 goto out; 1803 goto out;
1521 } 1804 }
1522 1805
1806 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
1523 blk = le64_to_cpu(xb->xb_blkno); 1807 blk = le64_to_cpu(xb->xb_blkno);
1524 bit = le16_to_cpu(xb->xb_suballoc_bit); 1808 bit = le16_to_cpu(xb->xb_suballoc_bit);
1525 bg_blkno = ocfs2_which_suballoc_group(blk, bit); 1809 bg_blkno = ocfs2_which_suballoc_group(blk, bit);
@@ -1606,8 +1890,8 @@ int ocfs2_xattr_remove(struct inode *inode, struct buffer_head *di_bh)
1606 mlog_errno(ret); 1890 mlog_errno(ret);
1607 goto out; 1891 goto out;
1608 } 1892 }
1609 ret = ocfs2_journal_access(handle, inode, di_bh, 1893 ret = ocfs2_journal_access_di(handle, inode, di_bh,
1610 OCFS2_JOURNAL_ACCESS_WRITE); 1894 OCFS2_JOURNAL_ACCESS_WRITE);
1611 if (ret) { 1895 if (ret) {
1612 mlog_errno(ret); 1896 mlog_errno(ret);
1613 goto out_commit; 1897 goto out_commit;
@@ -1714,7 +1998,8 @@ static int ocfs2_xattr_ibody_find(struct inode *inode,
1714 */ 1998 */
1715static int ocfs2_xattr_ibody_set(struct inode *inode, 1999static int ocfs2_xattr_ibody_set(struct inode *inode,
1716 struct ocfs2_xattr_info *xi, 2000 struct ocfs2_xattr_info *xi,
1717 struct ocfs2_xattr_search *xs) 2001 struct ocfs2_xattr_search *xs,
2002 struct ocfs2_xattr_set_ctxt *ctxt)
1718{ 2003{
1719 struct ocfs2_inode_info *oi = OCFS2_I(inode); 2004 struct ocfs2_inode_info *oi = OCFS2_I(inode);
1720 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; 2005 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data;
@@ -1731,7 +2016,7 @@ static int ocfs2_xattr_ibody_set(struct inode *inode,
1731 } 2016 }
1732 } 2017 }
1733 2018
1734 ret = ocfs2_xattr_set_entry(inode, xi, xs, 2019 ret = ocfs2_xattr_set_entry(inode, xi, xs, ctxt,
1735 (OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL)); 2020 (OCFS2_INLINE_XATTR_FL | OCFS2_HAS_XATTR_FL));
1736out: 2021out:
1737 up_write(&oi->ip_alloc_sem); 2022 up_write(&oi->ip_alloc_sem);
@@ -1758,19 +2043,15 @@ static int ocfs2_xattr_block_find(struct inode *inode,
1758 if (!di->i_xattr_loc) 2043 if (!di->i_xattr_loc)
1759 return ret; 2044 return ret;
1760 2045
1761 ret = ocfs2_read_block(inode, le64_to_cpu(di->i_xattr_loc), &blk_bh); 2046 ret = ocfs2_read_xattr_block(inode, le64_to_cpu(di->i_xattr_loc),
2047 &blk_bh);
1762 if (ret < 0) { 2048 if (ret < 0) {
1763 mlog_errno(ret); 2049 mlog_errno(ret);
1764 return ret; 2050 return ret;
1765 } 2051 }
1766 2052
1767 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
1768 if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) {
1769 ret = -EIO;
1770 goto cleanup;
1771 }
1772
1773 xs->xattr_bh = blk_bh; 2053 xs->xattr_bh = blk_bh;
2054 xb = (struct ocfs2_xattr_block *)blk_bh->b_data;
1774 2055
1775 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) { 2056 if (!(le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED)) {
1776 xs->header = &xb->xb_attrs.xb_header; 2057 xs->header = &xb->xb_attrs.xb_header;
@@ -1804,13 +2085,13 @@ cleanup:
1804 */ 2085 */
1805static int ocfs2_xattr_block_set(struct inode *inode, 2086static int ocfs2_xattr_block_set(struct inode *inode,
1806 struct ocfs2_xattr_info *xi, 2087 struct ocfs2_xattr_info *xi,
1807 struct ocfs2_xattr_search *xs) 2088 struct ocfs2_xattr_search *xs,
2089 struct ocfs2_xattr_set_ctxt *ctxt)
1808{ 2090{
1809 struct buffer_head *new_bh = NULL; 2091 struct buffer_head *new_bh = NULL;
1810 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 2092 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
1811 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data; 2093 struct ocfs2_dinode *di = (struct ocfs2_dinode *)xs->inode_bh->b_data;
1812 struct ocfs2_alloc_context *meta_ac = NULL; 2094 handle_t *handle = ctxt->handle;
1813 handle_t *handle = NULL;
1814 struct ocfs2_xattr_block *xblk = NULL; 2095 struct ocfs2_xattr_block *xblk = NULL;
1815 u16 suballoc_bit_start; 2096 u16 suballoc_bit_start;
1816 u32 num_got; 2097 u32 num_got;
@@ -1818,45 +2099,29 @@ static int ocfs2_xattr_block_set(struct inode *inode,
1818 int ret; 2099 int ret;
1819 2100
1820 if (!xs->xattr_bh) { 2101 if (!xs->xattr_bh) {
1821 /* 2102 ret = ocfs2_journal_access_di(handle, inode, xs->inode_bh,
1822 * Alloc one external block for extended attribute 2103 OCFS2_JOURNAL_ACCESS_CREATE);
1823 * outside of inode.
1824 */
1825 ret = ocfs2_reserve_new_metadata_blocks(osb, 1, &meta_ac);
1826 if (ret < 0) { 2104 if (ret < 0) {
1827 mlog_errno(ret); 2105 mlog_errno(ret);
1828 goto out; 2106 goto end;
1829 }
1830 handle = ocfs2_start_trans(osb,
1831 OCFS2_XATTR_BLOCK_CREATE_CREDITS);
1832 if (IS_ERR(handle)) {
1833 ret = PTR_ERR(handle);
1834 mlog_errno(ret);
1835 goto out;
1836 }
1837 ret = ocfs2_journal_access(handle, inode, xs->inode_bh,
1838 OCFS2_JOURNAL_ACCESS_CREATE);
1839 if (ret < 0) {
1840 mlog_errno(ret);
1841 goto out_commit;
1842 } 2107 }
1843 2108
1844 ret = ocfs2_claim_metadata(osb, handle, meta_ac, 1, 2109 ret = ocfs2_claim_metadata(osb, handle, ctxt->meta_ac, 1,
1845 &suballoc_bit_start, &num_got, 2110 &suballoc_bit_start, &num_got,
1846 &first_blkno); 2111 &first_blkno);
1847 if (ret < 0) { 2112 if (ret < 0) {
1848 mlog_errno(ret); 2113 mlog_errno(ret);
1849 goto out_commit; 2114 goto end;
1850 } 2115 }
1851 2116
1852 new_bh = sb_getblk(inode->i_sb, first_blkno); 2117 new_bh = sb_getblk(inode->i_sb, first_blkno);
1853 ocfs2_set_new_buffer_uptodate(inode, new_bh); 2118 ocfs2_set_new_buffer_uptodate(inode, new_bh);
1854 2119
1855 ret = ocfs2_journal_access(handle, inode, new_bh, 2120 ret = ocfs2_journal_access_xb(handle, inode, new_bh,
1856 OCFS2_JOURNAL_ACCESS_CREATE); 2121 OCFS2_JOURNAL_ACCESS_CREATE);
1857 if (ret < 0) { 2122 if (ret < 0) {
1858 mlog_errno(ret); 2123 mlog_errno(ret);
1859 goto out_commit; 2124 goto end;
1860 } 2125 }
1861 2126
1862 /* Initialize ocfs2_xattr_block */ 2127 /* Initialize ocfs2_xattr_block */
@@ -1874,44 +2139,555 @@ static int ocfs2_xattr_block_set(struct inode *inode,
1874 xs->end = (void *)xblk + inode->i_sb->s_blocksize; 2139 xs->end = (void *)xblk + inode->i_sb->s_blocksize;
1875 xs->here = xs->header->xh_entries; 2140 xs->here = xs->header->xh_entries;
1876 2141
1877
1878 ret = ocfs2_journal_dirty(handle, new_bh); 2142 ret = ocfs2_journal_dirty(handle, new_bh);
1879 if (ret < 0) { 2143 if (ret < 0) {
1880 mlog_errno(ret); 2144 mlog_errno(ret);
1881 goto out_commit; 2145 goto end;
1882 } 2146 }
1883 di->i_xattr_loc = cpu_to_le64(first_blkno); 2147 di->i_xattr_loc = cpu_to_le64(first_blkno);
1884 ret = ocfs2_journal_dirty(handle, xs->inode_bh); 2148 ocfs2_journal_dirty(handle, xs->inode_bh);
1885 if (ret < 0)
1886 mlog_errno(ret);
1887out_commit:
1888 ocfs2_commit_trans(osb, handle);
1889out:
1890 if (meta_ac)
1891 ocfs2_free_alloc_context(meta_ac);
1892 if (ret < 0)
1893 return ret;
1894 } else 2149 } else
1895 xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data; 2150 xblk = (struct ocfs2_xattr_block *)xs->xattr_bh->b_data;
1896 2151
1897 if (!(le16_to_cpu(xblk->xb_flags) & OCFS2_XATTR_INDEXED)) { 2152 if (!(le16_to_cpu(xblk->xb_flags) & OCFS2_XATTR_INDEXED)) {
1898 /* Set extended attribute into external block */ 2153 /* Set extended attribute into external block */
1899 ret = ocfs2_xattr_set_entry(inode, xi, xs, OCFS2_HAS_XATTR_FL); 2154 ret = ocfs2_xattr_set_entry(inode, xi, xs, ctxt,
2155 OCFS2_HAS_XATTR_FL);
1900 if (!ret || ret != -ENOSPC) 2156 if (!ret || ret != -ENOSPC)
1901 goto end; 2157 goto end;
1902 2158
1903 ret = ocfs2_xattr_create_index_block(inode, xs); 2159 ret = ocfs2_xattr_create_index_block(inode, xs, ctxt);
1904 if (ret) 2160 if (ret)
1905 goto end; 2161 goto end;
1906 } 2162 }
1907 2163
1908 ret = ocfs2_xattr_set_entry_index_block(inode, xi, xs); 2164 ret = ocfs2_xattr_set_entry_index_block(inode, xi, xs, ctxt);
1909 2165
1910end: 2166end:
1911 2167
1912 return ret; 2168 return ret;
1913} 2169}
1914 2170
2171/* Check whether the new xattr can be inserted into the inode. */
2172static int ocfs2_xattr_can_be_in_inode(struct inode *inode,
2173 struct ocfs2_xattr_info *xi,
2174 struct ocfs2_xattr_search *xs)
2175{
2176 u64 value_size;
2177 struct ocfs2_xattr_entry *last;
2178 int free, i;
2179 size_t min_offs = xs->end - xs->base;
2180
2181 if (!xs->header)
2182 return 0;
2183
2184 last = xs->header->xh_entries;
2185
2186 for (i = 0; i < le16_to_cpu(xs->header->xh_count); i++) {
2187 size_t offs = le16_to_cpu(last->xe_name_offset);
2188 if (offs < min_offs)
2189 min_offs = offs;
2190 last += 1;
2191 }
2192
2193 free = min_offs - ((void *)last - xs->base) - sizeof(__u32);
2194 if (free < 0)
2195 return 0;
2196
2197 BUG_ON(!xs->not_found);
2198
2199 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
2200 value_size = OCFS2_XATTR_ROOT_SIZE;
2201 else
2202 value_size = OCFS2_XATTR_SIZE(xi->value_len);
2203
2204 if (free >= sizeof(struct ocfs2_xattr_entry) +
2205 OCFS2_XATTR_SIZE(strlen(xi->name)) + value_size)
2206 return 1;
2207
2208 return 0;
2209}
2210
2211static int ocfs2_calc_xattr_set_need(struct inode *inode,
2212 struct ocfs2_dinode *di,
2213 struct ocfs2_xattr_info *xi,
2214 struct ocfs2_xattr_search *xis,
2215 struct ocfs2_xattr_search *xbs,
2216 int *clusters_need,
2217 int *meta_need,
2218 int *credits_need)
2219{
2220 int ret = 0, old_in_xb = 0;
2221 int clusters_add = 0, meta_add = 0, credits = 0;
2222 struct buffer_head *bh = NULL;
2223 struct ocfs2_xattr_block *xb = NULL;
2224 struct ocfs2_xattr_entry *xe = NULL;
2225 struct ocfs2_xattr_value_root *xv = NULL;
2226 char *base = NULL;
2227 int name_offset, name_len = 0;
2228 u32 new_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
2229 xi->value_len);
2230 u64 value_size;
2231
2232 /*
2233 * Calculate the clusters we need to write.
2234 * No matter whether we replace an old one or add a new one,
2235 * we need this for writing.
2236 */
2237 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE)
2238 credits += new_clusters *
2239 ocfs2_clusters_to_blocks(inode->i_sb, 1);
2240
2241 if (xis->not_found && xbs->not_found) {
2242 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2243
2244 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
2245 clusters_add += new_clusters;
2246 credits += ocfs2_calc_extend_credits(inode->i_sb,
2247 &def_xv.xv.xr_list,
2248 new_clusters);
2249 }
2250
2251 goto meta_guess;
2252 }
2253
2254 if (!xis->not_found) {
2255 xe = xis->here;
2256 name_offset = le16_to_cpu(xe->xe_name_offset);
2257 name_len = OCFS2_XATTR_SIZE(xe->xe_name_len);
2258 base = xis->base;
2259 credits += OCFS2_INODE_UPDATE_CREDITS;
2260 } else {
2261 int i, block_off = 0;
2262 xb = (struct ocfs2_xattr_block *)xbs->xattr_bh->b_data;
2263 xe = xbs->here;
2264 name_offset = le16_to_cpu(xe->xe_name_offset);
2265 name_len = OCFS2_XATTR_SIZE(xe->xe_name_len);
2266 i = xbs->here - xbs->header->xh_entries;
2267 old_in_xb = 1;
2268
2269 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
2270 ret = ocfs2_xattr_bucket_get_name_value(inode,
2271 bucket_xh(xbs->bucket),
2272 i, &block_off,
2273 &name_offset);
2274 base = bucket_block(xbs->bucket, block_off);
2275 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2276 } else {
2277 base = xbs->base;
2278 credits += OCFS2_XATTR_BLOCK_UPDATE_CREDITS;
2279 }
2280 }
2281
2282 /*
2283 * delete a xattr doesn't need metadata and cluster allocation.
2284 * so just calculate the credits and return.
2285 *
2286 * The credits for removing the value tree will be extended
2287 * by ocfs2_remove_extent itself.
2288 */
2289 if (!xi->value) {
2290 if (!ocfs2_xattr_is_local(xe))
2291 credits += ocfs2_remove_extent_credits(inode->i_sb);
2292
2293 goto out;
2294 }
2295
2296 /* do cluster allocation guess first. */
2297 value_size = le64_to_cpu(xe->xe_value_size);
2298
2299 if (old_in_xb) {
2300 /*
2301 * In xattr set, we always try to set the xe in inode first,
2302 * so if it can be inserted into inode successfully, the old
2303 * one will be removed from the xattr block, and this xattr
2304 * will be inserted into inode as a new xattr in inode.
2305 */
2306 if (ocfs2_xattr_can_be_in_inode(inode, xi, xis)) {
2307 clusters_add += new_clusters;
2308 credits += ocfs2_remove_extent_credits(inode->i_sb) +
2309 OCFS2_INODE_UPDATE_CREDITS;
2310 if (!ocfs2_xattr_is_local(xe))
2311 credits += ocfs2_calc_extend_credits(
2312 inode->i_sb,
2313 &def_xv.xv.xr_list,
2314 new_clusters);
2315 goto out;
2316 }
2317 }
2318
2319 if (xi->value_len > OCFS2_XATTR_INLINE_SIZE) {
2320 /* the new values will be stored outside. */
2321 u32 old_clusters = 0;
2322
2323 if (!ocfs2_xattr_is_local(xe)) {
2324 old_clusters = ocfs2_clusters_for_bytes(inode->i_sb,
2325 value_size);
2326 xv = (struct ocfs2_xattr_value_root *)
2327 (base + name_offset + name_len);
2328 value_size = OCFS2_XATTR_ROOT_SIZE;
2329 } else
2330 xv = &def_xv.xv;
2331
2332 if (old_clusters >= new_clusters) {
2333 credits += ocfs2_remove_extent_credits(inode->i_sb);
2334 goto out;
2335 } else {
2336 meta_add += ocfs2_extend_meta_needed(&xv->xr_list);
2337 clusters_add += new_clusters - old_clusters;
2338 credits += ocfs2_calc_extend_credits(inode->i_sb,
2339 &xv->xr_list,
2340 new_clusters -
2341 old_clusters);
2342 if (value_size >= OCFS2_XATTR_ROOT_SIZE)
2343 goto out;
2344 }
2345 } else {
2346 /*
2347 * Now the new value will be stored inside. So if the new
2348 * value is smaller than the size of value root or the old
2349 * value, we don't need any allocation, otherwise we have
2350 * to guess metadata allocation.
2351 */
2352 if ((ocfs2_xattr_is_local(xe) && value_size >= xi->value_len) ||
2353 (!ocfs2_xattr_is_local(xe) &&
2354 OCFS2_XATTR_ROOT_SIZE >= xi->value_len))
2355 goto out;
2356 }
2357
2358meta_guess:
2359 /* calculate metadata allocation. */
2360 if (di->i_xattr_loc) {
2361 if (!xbs->xattr_bh) {
2362 ret = ocfs2_read_xattr_block(inode,
2363 le64_to_cpu(di->i_xattr_loc),
2364 &bh);
2365 if (ret) {
2366 mlog_errno(ret);
2367 goto out;
2368 }
2369
2370 xb = (struct ocfs2_xattr_block *)bh->b_data;
2371 } else
2372 xb = (struct ocfs2_xattr_block *)xbs->xattr_bh->b_data;
2373
2374 /*
2375 * If there is already an xattr tree, good, we can calculate
2376 * like other b-trees. Otherwise we may have the chance of
2377 * create a tree, the credit calculation is borrowed from
2378 * ocfs2_calc_extend_credits with root_el = NULL. And the
2379 * new tree will be cluster based, so no meta is needed.
2380 */
2381 if (le16_to_cpu(xb->xb_flags) & OCFS2_XATTR_INDEXED) {
2382 struct ocfs2_extent_list *el =
2383 &xb->xb_attrs.xb_root.xt_list;
2384 meta_add += ocfs2_extend_meta_needed(el);
2385 credits += ocfs2_calc_extend_credits(inode->i_sb,
2386 el, 1);
2387 } else
2388 credits += OCFS2_SUBALLOC_ALLOC + 1;
2389
2390 /*
2391 * This cluster will be used either for new bucket or for
2392 * new xattr block.
2393 * If the cluster size is the same as the bucket size, one
2394 * more is needed since we may need to extend the bucket
2395 * also.
2396 */
2397 clusters_add += 1;
2398 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2399 if (OCFS2_XATTR_BUCKET_SIZE ==
2400 OCFS2_SB(inode->i_sb)->s_clustersize) {
2401 credits += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2402 clusters_add += 1;
2403 }
2404 } else {
2405 meta_add += 1;
2406 credits += OCFS2_XATTR_BLOCK_CREATE_CREDITS;
2407 }
2408out:
2409 if (clusters_need)
2410 *clusters_need = clusters_add;
2411 if (meta_need)
2412 *meta_need = meta_add;
2413 if (credits_need)
2414 *credits_need = credits;
2415 brelse(bh);
2416 return ret;
2417}
2418
2419static int ocfs2_init_xattr_set_ctxt(struct inode *inode,
2420 struct ocfs2_dinode *di,
2421 struct ocfs2_xattr_info *xi,
2422 struct ocfs2_xattr_search *xis,
2423 struct ocfs2_xattr_search *xbs,
2424 struct ocfs2_xattr_set_ctxt *ctxt,
2425 int *credits)
2426{
2427 int clusters_add, meta_add, ret;
2428 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2429
2430 memset(ctxt, 0, sizeof(struct ocfs2_xattr_set_ctxt));
2431
2432 ocfs2_init_dealloc_ctxt(&ctxt->dealloc);
2433
2434 ret = ocfs2_calc_xattr_set_need(inode, di, xi, xis, xbs,
2435 &clusters_add, &meta_add, credits);
2436 if (ret) {
2437 mlog_errno(ret);
2438 return ret;
2439 }
2440
2441 mlog(0, "Set xattr %s, reserve meta blocks = %d, clusters = %d, "
2442 "credits = %d\n", xi->name, meta_add, clusters_add, *credits);
2443
2444 if (meta_add) {
2445 ret = ocfs2_reserve_new_metadata_blocks(osb, meta_add,
2446 &ctxt->meta_ac);
2447 if (ret) {
2448 mlog_errno(ret);
2449 goto out;
2450 }
2451 }
2452
2453 if (clusters_add) {
2454 ret = ocfs2_reserve_clusters(osb, clusters_add, &ctxt->data_ac);
2455 if (ret)
2456 mlog_errno(ret);
2457 }
2458out:
2459 if (ret) {
2460 if (ctxt->meta_ac) {
2461 ocfs2_free_alloc_context(ctxt->meta_ac);
2462 ctxt->meta_ac = NULL;
2463 }
2464
2465 /*
2466 * We cannot have an error and a non null ctxt->data_ac.
2467 */
2468 }
2469
2470 return ret;
2471}
2472
2473static int __ocfs2_xattr_set_handle(struct inode *inode,
2474 struct ocfs2_dinode *di,
2475 struct ocfs2_xattr_info *xi,
2476 struct ocfs2_xattr_search *xis,
2477 struct ocfs2_xattr_search *xbs,
2478 struct ocfs2_xattr_set_ctxt *ctxt)
2479{
2480 int ret = 0, credits, old_found;
2481
2482 if (!xi->value) {
2483 /* Remove existing extended attribute */
2484 if (!xis->not_found)
2485 ret = ocfs2_xattr_ibody_set(inode, xi, xis, ctxt);
2486 else if (!xbs->not_found)
2487 ret = ocfs2_xattr_block_set(inode, xi, xbs, ctxt);
2488 } else {
2489 /* We always try to set extended attribute into inode first*/
2490 ret = ocfs2_xattr_ibody_set(inode, xi, xis, ctxt);
2491 if (!ret && !xbs->not_found) {
2492 /*
2493 * If succeed and that extended attribute existing in
2494 * external block, then we will remove it.
2495 */
2496 xi->value = NULL;
2497 xi->value_len = 0;
2498
2499 old_found = xis->not_found;
2500 xis->not_found = -ENODATA;
2501 ret = ocfs2_calc_xattr_set_need(inode,
2502 di,
2503 xi,
2504 xis,
2505 xbs,
2506 NULL,
2507 NULL,
2508 &credits);
2509 xis->not_found = old_found;
2510 if (ret) {
2511 mlog_errno(ret);
2512 goto out;
2513 }
2514
2515 ret = ocfs2_extend_trans(ctxt->handle, credits +
2516 ctxt->handle->h_buffer_credits);
2517 if (ret) {
2518 mlog_errno(ret);
2519 goto out;
2520 }
2521 ret = ocfs2_xattr_block_set(inode, xi, xbs, ctxt);
2522 } else if (ret == -ENOSPC) {
2523 if (di->i_xattr_loc && !xbs->xattr_bh) {
2524 ret = ocfs2_xattr_block_find(inode,
2525 xi->name_index,
2526 xi->name, xbs);
2527 if (ret)
2528 goto out;
2529
2530 old_found = xis->not_found;
2531 xis->not_found = -ENODATA;
2532 ret = ocfs2_calc_xattr_set_need(inode,
2533 di,
2534 xi,
2535 xis,
2536 xbs,
2537 NULL,
2538 NULL,
2539 &credits);
2540 xis->not_found = old_found;
2541 if (ret) {
2542 mlog_errno(ret);
2543 goto out;
2544 }
2545
2546 ret = ocfs2_extend_trans(ctxt->handle, credits +
2547 ctxt->handle->h_buffer_credits);
2548 if (ret) {
2549 mlog_errno(ret);
2550 goto out;
2551 }
2552 }
2553 /*
2554 * If no space in inode, we will set extended attribute
2555 * into external block.
2556 */
2557 ret = ocfs2_xattr_block_set(inode, xi, xbs, ctxt);
2558 if (ret)
2559 goto out;
2560 if (!xis->not_found) {
2561 /*
2562 * If succeed and that extended attribute
2563 * existing in inode, we will remove it.
2564 */
2565 xi->value = NULL;
2566 xi->value_len = 0;
2567 xbs->not_found = -ENODATA;
2568 ret = ocfs2_calc_xattr_set_need(inode,
2569 di,
2570 xi,
2571 xis,
2572 xbs,
2573 NULL,
2574 NULL,
2575 &credits);
2576 if (ret) {
2577 mlog_errno(ret);
2578 goto out;
2579 }
2580
2581 ret = ocfs2_extend_trans(ctxt->handle, credits +
2582 ctxt->handle->h_buffer_credits);
2583 if (ret) {
2584 mlog_errno(ret);
2585 goto out;
2586 }
2587 ret = ocfs2_xattr_ibody_set(inode, xi,
2588 xis, ctxt);
2589 }
2590 }
2591 }
2592
2593 if (!ret) {
2594 /* Update inode ctime. */
2595 ret = ocfs2_journal_access(ctxt->handle, inode, xis->inode_bh,
2596 OCFS2_JOURNAL_ACCESS_WRITE);
2597 if (ret) {
2598 mlog_errno(ret);
2599 goto out;
2600 }
2601
2602 inode->i_ctime = CURRENT_TIME;
2603 di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec);
2604 di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec);
2605 ocfs2_journal_dirty(ctxt->handle, xis->inode_bh);
2606 }
2607out:
2608 return ret;
2609}
2610
2611/*
2612 * This function only called duing creating inode
2613 * for init security/acl xattrs of the new inode.
2614 * All transanction credits have been reserved in mknod.
2615 */
2616int ocfs2_xattr_set_handle(handle_t *handle,
2617 struct inode *inode,
2618 struct buffer_head *di_bh,
2619 int name_index,
2620 const char *name,
2621 const void *value,
2622 size_t value_len,
2623 int flags,
2624 struct ocfs2_alloc_context *meta_ac,
2625 struct ocfs2_alloc_context *data_ac)
2626{
2627 struct ocfs2_dinode *di;
2628 int ret;
2629
2630 struct ocfs2_xattr_info xi = {
2631 .name_index = name_index,
2632 .name = name,
2633 .value = value,
2634 .value_len = value_len,
2635 };
2636
2637 struct ocfs2_xattr_search xis = {
2638 .not_found = -ENODATA,
2639 };
2640
2641 struct ocfs2_xattr_search xbs = {
2642 .not_found = -ENODATA,
2643 };
2644
2645 struct ocfs2_xattr_set_ctxt ctxt = {
2646 .handle = handle,
2647 .meta_ac = meta_ac,
2648 .data_ac = data_ac,
2649 };
2650
2651 if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
2652 return -EOPNOTSUPP;
2653
2654 /*
2655 * In extreme situation, may need xattr bucket when
2656 * block size is too small. And we have already reserved
2657 * the credits for bucket in mknod.
2658 */
2659 if (inode->i_sb->s_blocksize == OCFS2_MIN_BLOCKSIZE) {
2660 xbs.bucket = ocfs2_xattr_bucket_new(inode);
2661 if (!xbs.bucket) {
2662 mlog_errno(-ENOMEM);
2663 return -ENOMEM;
2664 }
2665 }
2666
2667 xis.inode_bh = xbs.inode_bh = di_bh;
2668 di = (struct ocfs2_dinode *)di_bh->b_data;
2669
2670 down_write(&OCFS2_I(inode)->ip_xattr_sem);
2671
2672 ret = ocfs2_xattr_ibody_find(inode, name_index, name, &xis);
2673 if (ret)
2674 goto cleanup;
2675 if (xis.not_found) {
2676 ret = ocfs2_xattr_block_find(inode, name_index, name, &xbs);
2677 if (ret)
2678 goto cleanup;
2679 }
2680
2681 ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt);
2682
2683cleanup:
2684 up_write(&OCFS2_I(inode)->ip_xattr_sem);
2685 brelse(xbs.xattr_bh);
2686 ocfs2_xattr_bucket_free(xbs.bucket);
2687
2688 return ret;
2689}
2690
1915/* 2691/*
1916 * ocfs2_xattr_set() 2692 * ocfs2_xattr_set()
1917 * 2693 *
@@ -1928,8 +2704,10 @@ int ocfs2_xattr_set(struct inode *inode,
1928{ 2704{
1929 struct buffer_head *di_bh = NULL; 2705 struct buffer_head *di_bh = NULL;
1930 struct ocfs2_dinode *di; 2706 struct ocfs2_dinode *di;
1931 int ret; 2707 int ret, credits;
1932 u16 i, blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 2708 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2709 struct inode *tl_inode = osb->osb_tl_inode;
2710 struct ocfs2_xattr_set_ctxt ctxt = { NULL, NULL, };
1933 2711
1934 struct ocfs2_xattr_info xi = { 2712 struct ocfs2_xattr_info xi = {
1935 .name_index = name_index, 2713 .name_index = name_index,
@@ -1949,10 +2727,20 @@ int ocfs2_xattr_set(struct inode *inode,
1949 if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb))) 2727 if (!ocfs2_supports_xattr(OCFS2_SB(inode->i_sb)))
1950 return -EOPNOTSUPP; 2728 return -EOPNOTSUPP;
1951 2729
2730 /*
2731 * Only xbs will be used on indexed trees. xis doesn't need a
2732 * bucket.
2733 */
2734 xbs.bucket = ocfs2_xattr_bucket_new(inode);
2735 if (!xbs.bucket) {
2736 mlog_errno(-ENOMEM);
2737 return -ENOMEM;
2738 }
2739
1952 ret = ocfs2_inode_lock(inode, &di_bh, 1); 2740 ret = ocfs2_inode_lock(inode, &di_bh, 1);
1953 if (ret < 0) { 2741 if (ret < 0) {
1954 mlog_errno(ret); 2742 mlog_errno(ret);
1955 return ret; 2743 goto cleanup_nolock;
1956 } 2744 }
1957 xis.inode_bh = xbs.inode_bh = di_bh; 2745 xis.inode_bh = xbs.inode_bh = di_bh;
1958 di = (struct ocfs2_dinode *)di_bh->b_data; 2746 di = (struct ocfs2_dinode *)di_bh->b_data;
@@ -1984,55 +2772,53 @@ int ocfs2_xattr_set(struct inode *inode,
1984 goto cleanup; 2772 goto cleanup;
1985 } 2773 }
1986 2774
1987 if (!value) { 2775
1988 /* Remove existing extended attribute */ 2776 mutex_lock(&tl_inode->i_mutex);
1989 if (!xis.not_found) 2777
1990 ret = ocfs2_xattr_ibody_set(inode, &xi, &xis); 2778 if (ocfs2_truncate_log_needs_flush(osb)) {
1991 else if (!xbs.not_found) 2779 ret = __ocfs2_flush_truncate_log(osb);
1992 ret = ocfs2_xattr_block_set(inode, &xi, &xbs); 2780 if (ret < 0) {
1993 } else { 2781 mutex_unlock(&tl_inode->i_mutex);
1994 /* We always try to set extended attribute into inode first*/ 2782 mlog_errno(ret);
1995 ret = ocfs2_xattr_ibody_set(inode, &xi, &xis); 2783 goto cleanup;
1996 if (!ret && !xbs.not_found) {
1997 /*
1998 * If succeed and that extended attribute existing in
1999 * external block, then we will remove it.
2000 */
2001 xi.value = NULL;
2002 xi.value_len = 0;
2003 ret = ocfs2_xattr_block_set(inode, &xi, &xbs);
2004 } else if (ret == -ENOSPC) {
2005 if (di->i_xattr_loc && !xbs.xattr_bh) {
2006 ret = ocfs2_xattr_block_find(inode, name_index,
2007 name, &xbs);
2008 if (ret)
2009 goto cleanup;
2010 }
2011 /*
2012 * If no space in inode, we will set extended attribute
2013 * into external block.
2014 */
2015 ret = ocfs2_xattr_block_set(inode, &xi, &xbs);
2016 if (ret)
2017 goto cleanup;
2018 if (!xis.not_found) {
2019 /*
2020 * If succeed and that extended attribute
2021 * existing in inode, we will remove it.
2022 */
2023 xi.value = NULL;
2024 xi.value_len = 0;
2025 ret = ocfs2_xattr_ibody_set(inode, &xi, &xis);
2026 }
2027 } 2784 }
2028 } 2785 }
2786 mutex_unlock(&tl_inode->i_mutex);
2787
2788 ret = ocfs2_init_xattr_set_ctxt(inode, di, &xi, &xis,
2789 &xbs, &ctxt, &credits);
2790 if (ret) {
2791 mlog_errno(ret);
2792 goto cleanup;
2793 }
2794
2795 /* we need to update inode's ctime field, so add credit for it. */
2796 credits += OCFS2_INODE_UPDATE_CREDITS;
2797 ctxt.handle = ocfs2_start_trans(osb, credits);
2798 if (IS_ERR(ctxt.handle)) {
2799 ret = PTR_ERR(ctxt.handle);
2800 mlog_errno(ret);
2801 goto cleanup;
2802 }
2803
2804 ret = __ocfs2_xattr_set_handle(inode, di, &xi, &xis, &xbs, &ctxt);
2805
2806 ocfs2_commit_trans(osb, ctxt.handle);
2807
2808 if (ctxt.data_ac)
2809 ocfs2_free_alloc_context(ctxt.data_ac);
2810 if (ctxt.meta_ac)
2811 ocfs2_free_alloc_context(ctxt.meta_ac);
2812 if (ocfs2_dealloc_has_cluster(&ctxt.dealloc))
2813 ocfs2_schedule_truncate_log_flush(osb, 1);
2814 ocfs2_run_deallocs(osb, &ctxt.dealloc);
2029cleanup: 2815cleanup:
2030 up_write(&OCFS2_I(inode)->ip_xattr_sem); 2816 up_write(&OCFS2_I(inode)->ip_xattr_sem);
2031 ocfs2_inode_unlock(inode, 1); 2817 ocfs2_inode_unlock(inode, 1);
2818cleanup_nolock:
2032 brelse(di_bh); 2819 brelse(di_bh);
2033 brelse(xbs.xattr_bh); 2820 brelse(xbs.xattr_bh);
2034 for (i = 0; i < blk_per_bucket; i++) 2821 ocfs2_xattr_bucket_free(xbs.bucket);
2035 brelse(xbs.bucket.bhs[i]);
2036 2822
2037 return ret; 2823 return ret;
2038} 2824}
@@ -2107,7 +2893,7 @@ typedef int (xattr_bucket_func)(struct inode *inode,
2107 void *para); 2893 void *para);
2108 2894
2109static int ocfs2_find_xe_in_bucket(struct inode *inode, 2895static int ocfs2_find_xe_in_bucket(struct inode *inode,
2110 struct buffer_head *header_bh, 2896 struct ocfs2_xattr_bucket *bucket,
2111 int name_index, 2897 int name_index,
2112 const char *name, 2898 const char *name,
2113 u32 name_hash, 2899 u32 name_hash,
@@ -2115,11 +2901,9 @@ static int ocfs2_find_xe_in_bucket(struct inode *inode,
2115 int *found) 2901 int *found)
2116{ 2902{
2117 int i, ret = 0, cmp = 1, block_off, new_offset; 2903 int i, ret = 0, cmp = 1, block_off, new_offset;
2118 struct ocfs2_xattr_header *xh = 2904 struct ocfs2_xattr_header *xh = bucket_xh(bucket);
2119 (struct ocfs2_xattr_header *)header_bh->b_data;
2120 size_t name_len = strlen(name); 2905 size_t name_len = strlen(name);
2121 struct ocfs2_xattr_entry *xe = NULL; 2906 struct ocfs2_xattr_entry *xe = NULL;
2122 struct buffer_head *name_bh = NULL;
2123 char *xe_name; 2907 char *xe_name;
2124 2908
2125 /* 2909 /*
@@ -2150,19 +2934,9 @@ static int ocfs2_find_xe_in_bucket(struct inode *inode,
2150 break; 2934 break;
2151 } 2935 }
2152 2936
2153 ret = ocfs2_read_block(inode, header_bh->b_blocknr + block_off,
2154 &name_bh);
2155 if (ret) {
2156 mlog_errno(ret);
2157 break;
2158 }
2159 xe_name = name_bh->b_data + new_offset;
2160 2937
2161 cmp = memcmp(name, xe_name, name_len); 2938 xe_name = bucket_block(bucket, block_off) + new_offset;
2162 brelse(name_bh); 2939 if (!memcmp(name, xe_name, name_len)) {
2163 name_bh = NULL;
2164
2165 if (cmp == 0) {
2166 *xe_index = i; 2940 *xe_index = i;
2167 *found = 1; 2941 *found = 1;
2168 ret = 0; 2942 ret = 0;
@@ -2192,39 +2966,42 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2192 struct ocfs2_xattr_search *xs) 2966 struct ocfs2_xattr_search *xs)
2193{ 2967{
2194 int ret, found = 0; 2968 int ret, found = 0;
2195 struct buffer_head *bh = NULL;
2196 struct buffer_head *lower_bh = NULL;
2197 struct ocfs2_xattr_header *xh = NULL; 2969 struct ocfs2_xattr_header *xh = NULL;
2198 struct ocfs2_xattr_entry *xe = NULL; 2970 struct ocfs2_xattr_entry *xe = NULL;
2199 u16 index = 0; 2971 u16 index = 0;
2200 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 2972 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2201 int low_bucket = 0, bucket, high_bucket; 2973 int low_bucket = 0, bucket, high_bucket;
2974 struct ocfs2_xattr_bucket *search;
2202 u32 last_hash; 2975 u32 last_hash;
2203 u64 blkno; 2976 u64 blkno, lower_blkno = 0;
2204 2977
2205 ret = ocfs2_read_block(inode, p_blkno, &bh); 2978 search = ocfs2_xattr_bucket_new(inode);
2979 if (!search) {
2980 ret = -ENOMEM;
2981 mlog_errno(ret);
2982 goto out;
2983 }
2984
2985 ret = ocfs2_read_xattr_bucket(search, p_blkno);
2206 if (ret) { 2986 if (ret) {
2207 mlog_errno(ret); 2987 mlog_errno(ret);
2208 goto out; 2988 goto out;
2209 } 2989 }
2210 2990
2211 xh = (struct ocfs2_xattr_header *)bh->b_data; 2991 xh = bucket_xh(search);
2212 high_bucket = le16_to_cpu(xh->xh_num_buckets) - 1; 2992 high_bucket = le16_to_cpu(xh->xh_num_buckets) - 1;
2213
2214 while (low_bucket <= high_bucket) { 2993 while (low_bucket <= high_bucket) {
2215 brelse(bh); 2994 ocfs2_xattr_bucket_relse(search);
2216 bh = NULL;
2217 bucket = (low_bucket + high_bucket) / 2;
2218 2995
2996 bucket = (low_bucket + high_bucket) / 2;
2219 blkno = p_blkno + bucket * blk_per_bucket; 2997 blkno = p_blkno + bucket * blk_per_bucket;
2220 2998 ret = ocfs2_read_xattr_bucket(search, blkno);
2221 ret = ocfs2_read_block(inode, blkno, &bh);
2222 if (ret) { 2999 if (ret) {
2223 mlog_errno(ret); 3000 mlog_errno(ret);
2224 goto out; 3001 goto out;
2225 } 3002 }
2226 3003
2227 xh = (struct ocfs2_xattr_header *)bh->b_data; 3004 xh = bucket_xh(search);
2228 xe = &xh->xh_entries[0]; 3005 xe = &xh->xh_entries[0];
2229 if (name_hash < le32_to_cpu(xe->xe_name_hash)) { 3006 if (name_hash < le32_to_cpu(xe->xe_name_hash)) {
2230 high_bucket = bucket - 1; 3007 high_bucket = bucket - 1;
@@ -2241,10 +3018,8 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2241 3018
2242 last_hash = le32_to_cpu(xe->xe_name_hash); 3019 last_hash = le32_to_cpu(xe->xe_name_hash);
2243 3020
2244 /* record lower_bh which may be the insert place. */ 3021 /* record lower_blkno which may be the insert place. */
2245 brelse(lower_bh); 3022 lower_blkno = blkno;
2246 lower_bh = bh;
2247 bh = NULL;
2248 3023
2249 if (name_hash > le32_to_cpu(xe->xe_name_hash)) { 3024 if (name_hash > le32_to_cpu(xe->xe_name_hash)) {
2250 low_bucket = bucket + 1; 3025 low_bucket = bucket + 1;
@@ -2252,7 +3027,7 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2252 } 3027 }
2253 3028
2254 /* the searched xattr should reside in this bucket if exists. */ 3029 /* the searched xattr should reside in this bucket if exists. */
2255 ret = ocfs2_find_xe_in_bucket(inode, lower_bh, 3030 ret = ocfs2_find_xe_in_bucket(inode, search,
2256 name_index, name, name_hash, 3031 name_index, name, name_hash,
2257 &index, &found); 3032 &index, &found);
2258 if (ret) { 3033 if (ret) {
@@ -2267,46 +3042,29 @@ static int ocfs2_xattr_bucket_find(struct inode *inode,
2267 * When the xattr's hash value is in the gap of 2 buckets, we will 3042 * When the xattr's hash value is in the gap of 2 buckets, we will
2268 * always set it to the previous bucket. 3043 * always set it to the previous bucket.
2269 */ 3044 */
2270 if (!lower_bh) { 3045 if (!lower_blkno)
2271 /* 3046 lower_blkno = p_blkno;
2272 * We can't find any bucket whose first name_hash is less 3047
2273 * than the find name_hash. 3048 /* This should be in cache - we just read it during the search */
2274 */ 3049 ret = ocfs2_read_xattr_bucket(xs->bucket, lower_blkno);
2275 BUG_ON(bh->b_blocknr != p_blkno); 3050 if (ret) {
2276 lower_bh = bh; 3051 mlog_errno(ret);
2277 bh = NULL; 3052 goto out;
2278 } 3053 }
2279 xs->bucket.bhs[0] = lower_bh;
2280 xs->bucket.xh = (struct ocfs2_xattr_header *)
2281 xs->bucket.bhs[0]->b_data;
2282 lower_bh = NULL;
2283 3054
2284 xs->header = xs->bucket.xh; 3055 xs->header = bucket_xh(xs->bucket);
2285 xs->base = xs->bucket.bhs[0]->b_data; 3056 xs->base = bucket_block(xs->bucket, 0);
2286 xs->end = xs->base + inode->i_sb->s_blocksize; 3057 xs->end = xs->base + inode->i_sb->s_blocksize;
2287 3058
2288 if (found) { 3059 if (found) {
2289 /*
2290 * If we have found the xattr enty, read all the blocks in
2291 * this bucket.
2292 */
2293 ret = ocfs2_read_blocks(inode, xs->bucket.bhs[0]->b_blocknr + 1,
2294 blk_per_bucket - 1, &xs->bucket.bhs[1],
2295 0);
2296 if (ret) {
2297 mlog_errno(ret);
2298 goto out;
2299 }
2300
2301 xs->here = &xs->header->xh_entries[index]; 3060 xs->here = &xs->header->xh_entries[index];
2302 mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name, 3061 mlog(0, "find xattr %s in bucket %llu, entry = %u\n", name,
2303 (unsigned long long)xs->bucket.bhs[0]->b_blocknr, index); 3062 (unsigned long long)bucket_blkno(xs->bucket), index);
2304 } else 3063 } else
2305 ret = -ENODATA; 3064 ret = -ENODATA;
2306 3065
2307out: 3066out:
2308 brelse(bh); 3067 ocfs2_xattr_bucket_free(search);
2309 brelse(lower_bh);
2310 return ret; 3068 return ret;
2311} 3069}
2312 3070
@@ -2357,53 +3115,50 @@ static int ocfs2_iterate_xattr_buckets(struct inode *inode,
2357 xattr_bucket_func *func, 3115 xattr_bucket_func *func,
2358 void *para) 3116 void *para)
2359{ 3117{
2360 int i, j, ret = 0; 3118 int i, ret = 0;
2361 int blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2362 u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)); 3119 u32 bpc = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb));
2363 u32 num_buckets = clusters * bpc; 3120 u32 num_buckets = clusters * bpc;
2364 struct ocfs2_xattr_bucket bucket; 3121 struct ocfs2_xattr_bucket *bucket;
2365 3122
2366 memset(&bucket, 0, sizeof(bucket)); 3123 bucket = ocfs2_xattr_bucket_new(inode);
3124 if (!bucket) {
3125 mlog_errno(-ENOMEM);
3126 return -ENOMEM;
3127 }
2367 3128
2368 mlog(0, "iterating xattr buckets in %u clusters starting from %llu\n", 3129 mlog(0, "iterating xattr buckets in %u clusters starting from %llu\n",
2369 clusters, (unsigned long long)blkno); 3130 clusters, (unsigned long long)blkno);
2370 3131
2371 for (i = 0; i < num_buckets; i++, blkno += blk_per_bucket) { 3132 for (i = 0; i < num_buckets; i++, blkno += bucket->bu_blocks) {
2372 ret = ocfs2_read_blocks(inode, blkno, blk_per_bucket, 3133 ret = ocfs2_read_xattr_bucket(bucket, blkno);
2373 bucket.bhs, 0);
2374 if (ret) { 3134 if (ret) {
2375 mlog_errno(ret); 3135 mlog_errno(ret);
2376 goto out; 3136 break;
2377 } 3137 }
2378 3138
2379 bucket.xh = (struct ocfs2_xattr_header *)bucket.bhs[0]->b_data;
2380 /* 3139 /*
2381 * The real bucket num in this series of blocks is stored 3140 * The real bucket num in this series of blocks is stored
2382 * in the 1st bucket. 3141 * in the 1st bucket.
2383 */ 3142 */
2384 if (i == 0) 3143 if (i == 0)
2385 num_buckets = le16_to_cpu(bucket.xh->xh_num_buckets); 3144 num_buckets = le16_to_cpu(bucket_xh(bucket)->xh_num_buckets);
2386 3145
2387 mlog(0, "iterating xattr bucket %llu, first hash %u\n", 3146 mlog(0, "iterating xattr bucket %llu, first hash %u\n",
2388 (unsigned long long)blkno, 3147 (unsigned long long)blkno,
2389 le32_to_cpu(bucket.xh->xh_entries[0].xe_name_hash)); 3148 le32_to_cpu(bucket_xh(bucket)->xh_entries[0].xe_name_hash));
2390 if (func) { 3149 if (func) {
2391 ret = func(inode, &bucket, para); 3150 ret = func(inode, bucket, para);
2392 if (ret) { 3151 if (ret)
2393 mlog_errno(ret); 3152 mlog_errno(ret);
2394 break; 3153 /* Fall through to bucket_relse() */
2395 }
2396 } 3154 }
2397 3155
2398 for (j = 0; j < blk_per_bucket; j++) 3156 ocfs2_xattr_bucket_relse(bucket);
2399 brelse(bucket.bhs[j]); 3157 if (ret)
2400 memset(&bucket, 0, sizeof(bucket)); 3158 break;
2401 } 3159 }
2402 3160
2403out: 3161 ocfs2_xattr_bucket_free(bucket);
2404 for (j = 0; j < blk_per_bucket; j++)
2405 brelse(bucket.bhs[j]);
2406
2407 return ret; 3162 return ret;
2408} 3163}
2409 3164
@@ -2441,21 +3196,21 @@ static int ocfs2_list_xattr_bucket(struct inode *inode,
2441 int i, block_off, new_offset; 3196 int i, block_off, new_offset;
2442 const char *prefix, *name; 3197 const char *prefix, *name;
2443 3198
2444 for (i = 0 ; i < le16_to_cpu(bucket->xh->xh_count); i++) { 3199 for (i = 0 ; i < le16_to_cpu(bucket_xh(bucket)->xh_count); i++) {
2445 struct ocfs2_xattr_entry *entry = &bucket->xh->xh_entries[i]; 3200 struct ocfs2_xattr_entry *entry = &bucket_xh(bucket)->xh_entries[i];
2446 type = ocfs2_xattr_get_type(entry); 3201 type = ocfs2_xattr_get_type(entry);
2447 prefix = ocfs2_xattr_prefix(type); 3202 prefix = ocfs2_xattr_prefix(type);
2448 3203
2449 if (prefix) { 3204 if (prefix) {
2450 ret = ocfs2_xattr_bucket_get_name_value(inode, 3205 ret = ocfs2_xattr_bucket_get_name_value(inode,
2451 bucket->xh, 3206 bucket_xh(bucket),
2452 i, 3207 i,
2453 &block_off, 3208 &block_off,
2454 &new_offset); 3209 &new_offset);
2455 if (ret) 3210 if (ret)
2456 break; 3211 break;
2457 3212
2458 name = (const char *)bucket->bhs[block_off]->b_data + 3213 name = (const char *)bucket_block(bucket, block_off) +
2459 new_offset; 3214 new_offset;
2460 ret = ocfs2_xattr_list_entry(xl->buffer, 3215 ret = ocfs2_xattr_list_entry(xl->buffer,
2461 xl->buffer_size, 3216 xl->buffer_size,
@@ -2540,32 +3295,34 @@ static void swap_xe(void *a, void *b, int size)
2540/* 3295/*
2541 * When the ocfs2_xattr_block is filled up, new bucket will be created 3296 * When the ocfs2_xattr_block is filled up, new bucket will be created
2542 * and all the xattr entries will be moved to the new bucket. 3297 * and all the xattr entries will be moved to the new bucket.
3298 * The header goes at the start of the bucket, and the names+values are
3299 * filled from the end. This is why *target starts as the last buffer.
2543 * Note: we need to sort the entries since they are not saved in order 3300 * Note: we need to sort the entries since they are not saved in order
2544 * in the ocfs2_xattr_block. 3301 * in the ocfs2_xattr_block.
2545 */ 3302 */
2546static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode, 3303static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode,
2547 struct buffer_head *xb_bh, 3304 struct buffer_head *xb_bh,
2548 struct buffer_head *xh_bh, 3305 struct ocfs2_xattr_bucket *bucket)
2549 struct buffer_head *data_bh)
2550{ 3306{
2551 int i, blocksize = inode->i_sb->s_blocksize; 3307 int i, blocksize = inode->i_sb->s_blocksize;
3308 int blks = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2552 u16 offset, size, off_change; 3309 u16 offset, size, off_change;
2553 struct ocfs2_xattr_entry *xe; 3310 struct ocfs2_xattr_entry *xe;
2554 struct ocfs2_xattr_block *xb = 3311 struct ocfs2_xattr_block *xb =
2555 (struct ocfs2_xattr_block *)xb_bh->b_data; 3312 (struct ocfs2_xattr_block *)xb_bh->b_data;
2556 struct ocfs2_xattr_header *xb_xh = &xb->xb_attrs.xb_header; 3313 struct ocfs2_xattr_header *xb_xh = &xb->xb_attrs.xb_header;
2557 struct ocfs2_xattr_header *xh = 3314 struct ocfs2_xattr_header *xh = bucket_xh(bucket);
2558 (struct ocfs2_xattr_header *)xh_bh->b_data;
2559 u16 count = le16_to_cpu(xb_xh->xh_count); 3315 u16 count = le16_to_cpu(xb_xh->xh_count);
2560 char *target = xh_bh->b_data, *src = xb_bh->b_data; 3316 char *src = xb_bh->b_data;
3317 char *target = bucket_block(bucket, blks - 1);
2561 3318
2562 mlog(0, "cp xattr from block %llu to bucket %llu\n", 3319 mlog(0, "cp xattr from block %llu to bucket %llu\n",
2563 (unsigned long long)xb_bh->b_blocknr, 3320 (unsigned long long)xb_bh->b_blocknr,
2564 (unsigned long long)xh_bh->b_blocknr); 3321 (unsigned long long)bucket_blkno(bucket));
3322
3323 for (i = 0; i < blks; i++)
3324 memset(bucket_block(bucket, i), 0, blocksize);
2565 3325
2566 memset(xh_bh->b_data, 0, blocksize);
2567 if (data_bh)
2568 memset(data_bh->b_data, 0, blocksize);
2569 /* 3326 /*
2570 * Since the xe_name_offset is based on ocfs2_xattr_header, 3327 * Since the xe_name_offset is based on ocfs2_xattr_header,
2571 * there is a offset change corresponding to the change of 3328 * there is a offset change corresponding to the change of
@@ -2577,8 +3334,6 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode,
2577 size = blocksize - offset; 3334 size = blocksize - offset;
2578 3335
2579 /* copy all the names and values. */ 3336 /* copy all the names and values. */
2580 if (data_bh)
2581 target = data_bh->b_data;
2582 memcpy(target + offset, src + offset, size); 3337 memcpy(target + offset, src + offset, size);
2583 3338
2584 /* Init new header now. */ 3339 /* Init new header now. */
@@ -2588,7 +3343,7 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode,
2588 xh->xh_free_start = cpu_to_le16(OCFS2_XATTR_BUCKET_SIZE - size); 3343 xh->xh_free_start = cpu_to_le16(OCFS2_XATTR_BUCKET_SIZE - size);
2589 3344
2590 /* copy all the entries. */ 3345 /* copy all the entries. */
2591 target = xh_bh->b_data; 3346 target = bucket_block(bucket, 0);
2592 offset = offsetof(struct ocfs2_xattr_header, xh_entries); 3347 offset = offsetof(struct ocfs2_xattr_header, xh_entries);
2593 size = count * sizeof(struct ocfs2_xattr_entry); 3348 size = count * sizeof(struct ocfs2_xattr_entry);
2594 memcpy(target + offset, (char *)xb_xh + offset, size); 3349 memcpy(target + offset, (char *)xb_xh + offset, size);
@@ -2614,73 +3369,47 @@ static void ocfs2_cp_xattr_block_to_bucket(struct inode *inode,
2614 * While if the entry is in index b-tree, "bucket" indicates the 3369 * While if the entry is in index b-tree, "bucket" indicates the
2615 * real place of the xattr. 3370 * real place of the xattr.
2616 */ 3371 */
2617static int ocfs2_xattr_update_xattr_search(struct inode *inode, 3372static void ocfs2_xattr_update_xattr_search(struct inode *inode,
2618 struct ocfs2_xattr_search *xs, 3373 struct ocfs2_xattr_search *xs,
2619 struct buffer_head *old_bh, 3374 struct buffer_head *old_bh)
2620 struct buffer_head *new_bh)
2621{ 3375{
2622 int ret = 0;
2623 char *buf = old_bh->b_data; 3376 char *buf = old_bh->b_data;
2624 struct ocfs2_xattr_block *old_xb = (struct ocfs2_xattr_block *)buf; 3377 struct ocfs2_xattr_block *old_xb = (struct ocfs2_xattr_block *)buf;
2625 struct ocfs2_xattr_header *old_xh = &old_xb->xb_attrs.xb_header; 3378 struct ocfs2_xattr_header *old_xh = &old_xb->xb_attrs.xb_header;
2626 int i, blocksize = inode->i_sb->s_blocksize; 3379 int i;
2627 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2628
2629 xs->bucket.bhs[0] = new_bh;
2630 get_bh(new_bh);
2631 xs->bucket.xh = (struct ocfs2_xattr_header *)xs->bucket.bhs[0]->b_data;
2632 xs->header = xs->bucket.xh;
2633 3380
2634 xs->base = new_bh->b_data; 3381 xs->header = bucket_xh(xs->bucket);
3382 xs->base = bucket_block(xs->bucket, 0);
2635 xs->end = xs->base + inode->i_sb->s_blocksize; 3383 xs->end = xs->base + inode->i_sb->s_blocksize;
2636 3384
2637 if (!xs->not_found) { 3385 if (xs->not_found)
2638 if (OCFS2_XATTR_BUCKET_SIZE != blocksize) { 3386 return;
2639 ret = ocfs2_read_blocks(inode,
2640 xs->bucket.bhs[0]->b_blocknr + 1,
2641 blk_per_bucket - 1, &xs->bucket.bhs[1],
2642 0);
2643 if (ret) {
2644 mlog_errno(ret);
2645 return ret;
2646 }
2647
2648 }
2649 i = xs->here - old_xh->xh_entries;
2650 xs->here = &xs->header->xh_entries[i];
2651 }
2652 3387
2653 return ret; 3388 i = xs->here - old_xh->xh_entries;
3389 xs->here = &xs->header->xh_entries[i];
2654} 3390}
2655 3391
2656static int ocfs2_xattr_create_index_block(struct inode *inode, 3392static int ocfs2_xattr_create_index_block(struct inode *inode,
2657 struct ocfs2_xattr_search *xs) 3393 struct ocfs2_xattr_search *xs,
3394 struct ocfs2_xattr_set_ctxt *ctxt)
2658{ 3395{
2659 int ret, credits = OCFS2_SUBALLOC_ALLOC; 3396 int ret;
2660 u32 bit_off, len; 3397 u32 bit_off, len;
2661 u64 blkno; 3398 u64 blkno;
2662 handle_t *handle; 3399 handle_t *handle = ctxt->handle;
2663 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 3400 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
2664 struct ocfs2_inode_info *oi = OCFS2_I(inode); 3401 struct ocfs2_inode_info *oi = OCFS2_I(inode);
2665 struct ocfs2_alloc_context *data_ac;
2666 struct buffer_head *xh_bh = NULL, *data_bh = NULL;
2667 struct buffer_head *xb_bh = xs->xattr_bh; 3402 struct buffer_head *xb_bh = xs->xattr_bh;
2668 struct ocfs2_xattr_block *xb = 3403 struct ocfs2_xattr_block *xb =
2669 (struct ocfs2_xattr_block *)xb_bh->b_data; 3404 (struct ocfs2_xattr_block *)xb_bh->b_data;
2670 struct ocfs2_xattr_tree_root *xr; 3405 struct ocfs2_xattr_tree_root *xr;
2671 u16 xb_flags = le16_to_cpu(xb->xb_flags); 3406 u16 xb_flags = le16_to_cpu(xb->xb_flags);
2672 u16 bpb = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2673 3407
2674 mlog(0, "create xattr index block for %llu\n", 3408 mlog(0, "create xattr index block for %llu\n",
2675 (unsigned long long)xb_bh->b_blocknr); 3409 (unsigned long long)xb_bh->b_blocknr);
2676 3410
2677 BUG_ON(xb_flags & OCFS2_XATTR_INDEXED); 3411 BUG_ON(xb_flags & OCFS2_XATTR_INDEXED);
2678 3412 BUG_ON(!xs->bucket);
2679 ret = ocfs2_reserve_clusters(osb, 1, &data_ac);
2680 if (ret) {
2681 mlog_errno(ret);
2682 goto out;
2683 }
2684 3413
2685 /* 3414 /*
2686 * XXX: 3415 * XXX:
@@ -2689,29 +3418,18 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
2689 */ 3418 */
2690 down_write(&oi->ip_alloc_sem); 3419 down_write(&oi->ip_alloc_sem);
2691 3420
2692 /* 3421 ret = ocfs2_journal_access_xb(handle, inode, xb_bh,
2693 * 3 more credits, one for xattr block update, one for the 1st block 3422 OCFS2_JOURNAL_ACCESS_WRITE);
2694 * of the new xattr bucket and one for the value/data.
2695 */
2696 credits += 3;
2697 handle = ocfs2_start_trans(osb, credits);
2698 if (IS_ERR(handle)) {
2699 ret = PTR_ERR(handle);
2700 mlog_errno(ret);
2701 goto out_sem;
2702 }
2703
2704 ret = ocfs2_journal_access(handle, inode, xb_bh,
2705 OCFS2_JOURNAL_ACCESS_WRITE);
2706 if (ret) { 3423 if (ret) {
2707 mlog_errno(ret); 3424 mlog_errno(ret);
2708 goto out_commit; 3425 goto out;
2709 } 3426 }
2710 3427
2711 ret = ocfs2_claim_clusters(osb, handle, data_ac, 1, &bit_off, &len); 3428 ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac,
3429 1, 1, &bit_off, &len);
2712 if (ret) { 3430 if (ret) {
2713 mlog_errno(ret); 3431 mlog_errno(ret);
2714 goto out_commit; 3432 goto out;
2715 } 3433 }
2716 3434
2717 /* 3435 /*
@@ -2724,51 +3442,23 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
2724 mlog(0, "allocate 1 cluster from %llu to xattr block\n", 3442 mlog(0, "allocate 1 cluster from %llu to xattr block\n",
2725 (unsigned long long)blkno); 3443 (unsigned long long)blkno);
2726 3444
2727 xh_bh = sb_getblk(inode->i_sb, blkno); 3445 ret = ocfs2_init_xattr_bucket(xs->bucket, blkno);
2728 if (!xh_bh) { 3446 if (ret) {
2729 ret = -EIO;
2730 mlog_errno(ret); 3447 mlog_errno(ret);
2731 goto out_commit; 3448 goto out;
2732 } 3449 }
2733 3450
2734 ocfs2_set_new_buffer_uptodate(inode, xh_bh); 3451 ret = ocfs2_xattr_bucket_journal_access(handle, xs->bucket,
2735 3452 OCFS2_JOURNAL_ACCESS_CREATE);
2736 ret = ocfs2_journal_access(handle, inode, xh_bh,
2737 OCFS2_JOURNAL_ACCESS_CREATE);
2738 if (ret) { 3453 if (ret) {
2739 mlog_errno(ret); 3454 mlog_errno(ret);
2740 goto out_commit; 3455 goto out;
2741 }
2742
2743 if (bpb > 1) {
2744 data_bh = sb_getblk(inode->i_sb, blkno + bpb - 1);
2745 if (!data_bh) {
2746 ret = -EIO;
2747 mlog_errno(ret);
2748 goto out_commit;
2749 }
2750
2751 ocfs2_set_new_buffer_uptodate(inode, data_bh);
2752
2753 ret = ocfs2_journal_access(handle, inode, data_bh,
2754 OCFS2_JOURNAL_ACCESS_CREATE);
2755 if (ret) {
2756 mlog_errno(ret);
2757 goto out_commit;
2758 }
2759 } 3456 }
2760 3457
2761 ocfs2_cp_xattr_block_to_bucket(inode, xb_bh, xh_bh, data_bh); 3458 ocfs2_cp_xattr_block_to_bucket(inode, xb_bh, xs->bucket);
3459 ocfs2_xattr_bucket_journal_dirty(handle, xs->bucket);
2762 3460
2763 ocfs2_journal_dirty(handle, xh_bh); 3461 ocfs2_xattr_update_xattr_search(inode, xs, xb_bh);
2764 if (data_bh)
2765 ocfs2_journal_dirty(handle, data_bh);
2766
2767 ret = ocfs2_xattr_update_xattr_search(inode, xs, xb_bh, xh_bh);
2768 if (ret) {
2769 mlog_errno(ret);
2770 goto out_commit;
2771 }
2772 3462
2773 /* Change from ocfs2_xattr_header to ocfs2_xattr_tree_root */ 3463 /* Change from ocfs2_xattr_header to ocfs2_xattr_tree_root */
2774 memset(&xb->xb_attrs, 0, inode->i_sb->s_blocksize - 3464 memset(&xb->xb_attrs, 0, inode->i_sb->s_blocksize -
@@ -2787,24 +3477,10 @@ static int ocfs2_xattr_create_index_block(struct inode *inode,
2787 3477
2788 xb->xb_flags = cpu_to_le16(xb_flags | OCFS2_XATTR_INDEXED); 3478 xb->xb_flags = cpu_to_le16(xb_flags | OCFS2_XATTR_INDEXED);
2789 3479
2790 ret = ocfs2_journal_dirty(handle, xb_bh); 3480 ocfs2_journal_dirty(handle, xb_bh);
2791 if (ret) {
2792 mlog_errno(ret);
2793 goto out_commit;
2794 }
2795
2796out_commit:
2797 ocfs2_commit_trans(osb, handle);
2798
2799out_sem:
2800 up_write(&oi->ip_alloc_sem);
2801 3481
2802out: 3482out:
2803 if (data_ac) 3483 up_write(&oi->ip_alloc_sem);
2804 ocfs2_free_alloc_context(data_ac);
2805
2806 brelse(xh_bh);
2807 brelse(data_bh);
2808 3484
2809 return ret; 3485 return ret;
2810} 3486}
@@ -2829,29 +3505,18 @@ static int cmp_xe_offset(const void *a, const void *b)
2829 * so that we can spare some space for insertion. 3505 * so that we can spare some space for insertion.
2830 */ 3506 */
2831static int ocfs2_defrag_xattr_bucket(struct inode *inode, 3507static int ocfs2_defrag_xattr_bucket(struct inode *inode,
3508 handle_t *handle,
2832 struct ocfs2_xattr_bucket *bucket) 3509 struct ocfs2_xattr_bucket *bucket)
2833{ 3510{
2834 int ret, i; 3511 int ret, i;
2835 size_t end, offset, len, value_len; 3512 size_t end, offset, len, value_len;
2836 struct ocfs2_xattr_header *xh; 3513 struct ocfs2_xattr_header *xh;
2837 char *entries, *buf, *bucket_buf = NULL; 3514 char *entries, *buf, *bucket_buf = NULL;
2838 u64 blkno = bucket->bhs[0]->b_blocknr; 3515 u64 blkno = bucket_blkno(bucket);
2839 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
2840 u16 xh_free_start; 3516 u16 xh_free_start;
2841 size_t blocksize = inode->i_sb->s_blocksize; 3517 size_t blocksize = inode->i_sb->s_blocksize;
2842 handle_t *handle;
2843 struct buffer_head **bhs;
2844 struct ocfs2_xattr_entry *xe; 3518 struct ocfs2_xattr_entry *xe;
2845 3519
2846 bhs = kzalloc(sizeof(struct buffer_head *) * blk_per_bucket,
2847 GFP_NOFS);
2848 if (!bhs)
2849 return -ENOMEM;
2850
2851 ret = ocfs2_read_blocks(inode, blkno, blk_per_bucket, bhs, 0);
2852 if (ret)
2853 goto out;
2854
2855 /* 3520 /*
2856 * In order to make the operation more efficient and generic, 3521 * In order to make the operation more efficient and generic,
2857 * we copy all the blocks into a contiguous memory and do the 3522 * we copy all the blocks into a contiguous memory and do the
@@ -2865,26 +3530,16 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2865 } 3530 }
2866 3531
2867 buf = bucket_buf; 3532 buf = bucket_buf;
2868 for (i = 0; i < blk_per_bucket; i++, buf += blocksize) 3533 for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
2869 memcpy(buf, bhs[i]->b_data, blocksize); 3534 memcpy(buf, bucket_block(bucket, i), blocksize);
2870 3535
2871 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), blk_per_bucket); 3536 ret = ocfs2_xattr_bucket_journal_access(handle, bucket,
2872 if (IS_ERR(handle)) { 3537 OCFS2_JOURNAL_ACCESS_WRITE);
2873 ret = PTR_ERR(handle); 3538 if (ret < 0) {
2874 handle = NULL;
2875 mlog_errno(ret); 3539 mlog_errno(ret);
2876 goto out; 3540 goto out;
2877 } 3541 }
2878 3542
2879 for (i = 0; i < blk_per_bucket; i++) {
2880 ret = ocfs2_journal_access(handle, inode, bhs[i],
2881 OCFS2_JOURNAL_ACCESS_WRITE);
2882 if (ret < 0) {
2883 mlog_errno(ret);
2884 goto commit;
2885 }
2886 }
2887
2888 xh = (struct ocfs2_xattr_header *)bucket_buf; 3543 xh = (struct ocfs2_xattr_header *)bucket_buf;
2889 entries = (char *)xh->xh_entries; 3544 entries = (char *)xh->xh_entries;
2890 xh_free_start = le16_to_cpu(xh->xh_free_start); 3545 xh_free_start = le16_to_cpu(xh->xh_free_start);
@@ -2940,7 +3595,7 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2940 "bucket %llu\n", (unsigned long long)blkno); 3595 "bucket %llu\n", (unsigned long long)blkno);
2941 3596
2942 if (xh_free_start == end) 3597 if (xh_free_start == end)
2943 goto commit; 3598 goto out;
2944 3599
2945 memset(bucket_buf + xh_free_start, 0, end - xh_free_start); 3600 memset(bucket_buf + xh_free_start, 0, end - xh_free_start);
2946 xh->xh_free_start = cpu_to_le16(end); 3601 xh->xh_free_start = cpu_to_le16(end);
@@ -2951,169 +3606,94 @@ static int ocfs2_defrag_xattr_bucket(struct inode *inode,
2951 cmp_xe, swap_xe); 3606 cmp_xe, swap_xe);
2952 3607
2953 buf = bucket_buf; 3608 buf = bucket_buf;
2954 for (i = 0; i < blk_per_bucket; i++, buf += blocksize) { 3609 for (i = 0; i < bucket->bu_blocks; i++, buf += blocksize)
2955 memcpy(bhs[i]->b_data, buf, blocksize); 3610 memcpy(bucket_block(bucket, i), buf, blocksize);
2956 ocfs2_journal_dirty(handle, bhs[i]); 3611 ocfs2_xattr_bucket_journal_dirty(handle, bucket);
2957 }
2958 3612
2959commit:
2960 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
2961out: 3613out:
2962
2963 if (bhs) {
2964 for (i = 0; i < blk_per_bucket; i++)
2965 brelse(bhs[i]);
2966 }
2967 kfree(bhs);
2968
2969 kfree(bucket_buf); 3614 kfree(bucket_buf);
2970 return ret; 3615 return ret;
2971} 3616}
2972 3617
2973/* 3618/*
2974 * Move half nums of the xattr bucket in the previous cluster to this new 3619 * prev_blkno points to the start of an existing extent. new_blkno
2975 * cluster. We only touch the last cluster of the previous extend record. 3620 * points to a newly allocated extent. Because we know each of our
3621 * clusters contains more than bucket, we can easily split one cluster
3622 * at a bucket boundary. So we take the last cluster of the existing
3623 * extent and split it down the middle. We move the last half of the
3624 * buckets in the last cluster of the existing extent over to the new
3625 * extent.
3626 *
3627 * first_bh is the buffer at prev_blkno so we can update the existing
3628 * extent's bucket count. header_bh is the bucket were we were hoping
3629 * to insert our xattr. If the bucket move places the target in the new
3630 * extent, we'll update first_bh and header_bh after modifying the old
3631 * extent.
2976 * 3632 *
2977 * first_bh is the first buffer_head of a series of bucket in the same 3633 * first_hash will be set as the 1st xe's name_hash in the new extent.
2978 * extent rec and header_bh is the header of one bucket in this cluster.
2979 * They will be updated if we move the data header_bh contains to the new
2980 * cluster. first_hash will be set as the 1st xe's name_hash of the new cluster.
2981 */ 3634 */
2982static int ocfs2_mv_xattr_bucket_cross_cluster(struct inode *inode, 3635static int ocfs2_mv_xattr_bucket_cross_cluster(struct inode *inode,
2983 handle_t *handle, 3636 handle_t *handle,
2984 struct buffer_head **first_bh, 3637 struct ocfs2_xattr_bucket *first,
2985 struct buffer_head **header_bh, 3638 struct ocfs2_xattr_bucket *target,
2986 u64 new_blkno, 3639 u64 new_blkno,
2987 u64 prev_blkno,
2988 u32 num_clusters, 3640 u32 num_clusters,
2989 u32 *first_hash) 3641 u32 *first_hash)
2990{ 3642{
2991 int i, ret, credits; 3643 int ret;
2992 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 3644 struct super_block *sb = inode->i_sb;
2993 int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 3645 int blks_per_bucket = ocfs2_blocks_per_xattr_bucket(sb);
2994 int num_buckets = ocfs2_xattr_buckets_per_cluster(osb); 3646 int num_buckets = ocfs2_xattr_buckets_per_cluster(OCFS2_SB(sb));
2995 int blocksize = inode->i_sb->s_blocksize; 3647 int to_move = num_buckets / 2;
2996 struct buffer_head *old_bh, *new_bh, *prev_bh, *new_first_bh = NULL; 3648 u64 src_blkno;
2997 struct ocfs2_xattr_header *new_xh; 3649 u64 last_cluster_blkno = bucket_blkno(first) +
2998 struct ocfs2_xattr_header *xh = 3650 ((num_clusters - 1) * ocfs2_clusters_to_blocks(sb, 1));
2999 (struct ocfs2_xattr_header *)((*first_bh)->b_data);
3000
3001 BUG_ON(le16_to_cpu(xh->xh_num_buckets) < num_buckets);
3002 BUG_ON(OCFS2_XATTR_BUCKET_SIZE == osb->s_clustersize);
3003
3004 prev_bh = *first_bh;
3005 get_bh(prev_bh);
3006 xh = (struct ocfs2_xattr_header *)prev_bh->b_data;
3007 3651
3008 prev_blkno += (num_clusters - 1) * bpc + bpc / 2; 3652 BUG_ON(le16_to_cpu(bucket_xh(first)->xh_num_buckets) < num_buckets);
3653 BUG_ON(OCFS2_XATTR_BUCKET_SIZE == OCFS2_SB(sb)->s_clustersize);
3009 3654
3010 mlog(0, "move half of xattrs in cluster %llu to %llu\n", 3655 mlog(0, "move half of xattrs in cluster %llu to %llu\n",
3011 (unsigned long long)prev_blkno, (unsigned long long)new_blkno); 3656 (unsigned long long)last_cluster_blkno, (unsigned long long)new_blkno);
3012 3657
3013 /* 3658 ret = ocfs2_mv_xattr_buckets(inode, handle, bucket_blkno(first),
3014 * We need to update the 1st half of the new cluster and 3659 last_cluster_blkno, new_blkno,
3015 * 1 more for the update of the 1st bucket of the previous 3660 to_move, first_hash);
3016 * extent record.
3017 */
3018 credits = bpc / 2 + 1;
3019 ret = ocfs2_extend_trans(handle, credits);
3020 if (ret) { 3661 if (ret) {
3021 mlog_errno(ret); 3662 mlog_errno(ret);
3022 goto out; 3663 goto out;
3023 } 3664 }
3024 3665
3025 ret = ocfs2_journal_access(handle, inode, prev_bh, 3666 /* This is the first bucket that got moved */
3026 OCFS2_JOURNAL_ACCESS_WRITE); 3667 src_blkno = last_cluster_blkno + (to_move * blks_per_bucket);
3027 if (ret) {
3028 mlog_errno(ret);
3029 goto out;
3030 }
3031 3668
3032 for (i = 0; i < bpc / 2; i++, prev_blkno++, new_blkno++) { 3669 /*
3033 old_bh = new_bh = NULL; 3670 * If the target bucket was part of the moved buckets, we need to
3034 new_bh = sb_getblk(inode->i_sb, new_blkno); 3671 * update first and target.
3035 if (!new_bh) { 3672 */
3036 ret = -EIO; 3673 if (bucket_blkno(target) >= src_blkno) {
3037 mlog_errno(ret); 3674 /* Find the block for the new target bucket */
3038 goto out; 3675 src_blkno = new_blkno +
3039 } 3676 (bucket_blkno(target) - src_blkno);
3040 3677
3041 ocfs2_set_new_buffer_uptodate(inode, new_bh); 3678 ocfs2_xattr_bucket_relse(first);
3679 ocfs2_xattr_bucket_relse(target);
3042 3680
3043 ret = ocfs2_journal_access(handle, inode, new_bh, 3681 /*
3044 OCFS2_JOURNAL_ACCESS_CREATE); 3682 * These shouldn't fail - the buffers are in the
3045 if (ret < 0) { 3683 * journal from ocfs2_cp_xattr_bucket().
3684 */
3685 ret = ocfs2_read_xattr_bucket(first, new_blkno);
3686 if (ret) {
3046 mlog_errno(ret); 3687 mlog_errno(ret);
3047 brelse(new_bh);
3048 goto out; 3688 goto out;
3049 } 3689 }
3050 3690 ret = ocfs2_read_xattr_bucket(target, src_blkno);
3051 ret = ocfs2_read_block(inode, prev_blkno, &old_bh); 3691 if (ret)
3052 if (ret < 0) {
3053 mlog_errno(ret); 3692 mlog_errno(ret);
3054 brelse(new_bh);
3055 goto out;
3056 }
3057 3693
3058 memcpy(new_bh->b_data, old_bh->b_data, blocksize);
3059
3060 if (i == 0) {
3061 new_xh = (struct ocfs2_xattr_header *)new_bh->b_data;
3062 new_xh->xh_num_buckets = cpu_to_le16(num_buckets / 2);
3063
3064 if (first_hash)
3065 *first_hash = le32_to_cpu(
3066 new_xh->xh_entries[0].xe_name_hash);
3067 new_first_bh = new_bh;
3068 get_bh(new_first_bh);
3069 }
3070
3071 ocfs2_journal_dirty(handle, new_bh);
3072
3073 if (*header_bh == old_bh) {
3074 brelse(*header_bh);
3075 *header_bh = new_bh;
3076 get_bh(*header_bh);
3077
3078 brelse(*first_bh);
3079 *first_bh = new_first_bh;
3080 get_bh(*first_bh);
3081 }
3082 brelse(new_bh);
3083 brelse(old_bh);
3084 } 3694 }
3085 3695
3086 le16_add_cpu(&xh->xh_num_buckets, -(num_buckets / 2));
3087
3088 ocfs2_journal_dirty(handle, prev_bh);
3089out: 3696out:
3090 brelse(prev_bh);
3091 brelse(new_first_bh);
3092 return ret;
3093}
3094
3095static int ocfs2_read_xattr_bucket(struct inode *inode,
3096 u64 blkno,
3097 struct buffer_head **bhs,
3098 int new)
3099{
3100 int ret = 0;
3101 u16 i, blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3102
3103 if (!new)
3104 return ocfs2_read_blocks(inode, blkno,
3105 blk_per_bucket, bhs, 0);
3106
3107 for (i = 0; i < blk_per_bucket; i++) {
3108 bhs[i] = sb_getblk(inode->i_sb, blkno + i);
3109 if (bhs[i] == NULL) {
3110 ret = -EIO;
3111 mlog_errno(ret);
3112 break;
3113 }
3114 ocfs2_set_new_buffer_uptodate(inode, bhs[i]);
3115 }
3116
3117 return ret; 3697 return ret;
3118} 3698}
3119 3699
@@ -3178,8 +3758,7 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
3178{ 3758{
3179 int ret, i; 3759 int ret, i;
3180 int count, start, len, name_value_len = 0, xe_len, name_offset = 0; 3760 int count, start, len, name_value_len = 0, xe_len, name_offset = 0;
3181 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 3761 struct ocfs2_xattr_bucket *s_bucket = NULL, *t_bucket = NULL;
3182 struct buffer_head **s_bhs, **t_bhs = NULL;
3183 struct ocfs2_xattr_header *xh; 3762 struct ocfs2_xattr_header *xh;
3184 struct ocfs2_xattr_entry *xe; 3763 struct ocfs2_xattr_entry *xe;
3185 int blocksize = inode->i_sb->s_blocksize; 3764 int blocksize = inode->i_sb->s_blocksize;
@@ -3187,47 +3766,52 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
3187 mlog(0, "move some of xattrs from bucket %llu to %llu\n", 3766 mlog(0, "move some of xattrs from bucket %llu to %llu\n",
3188 (unsigned long long)blk, (unsigned long long)new_blk); 3767 (unsigned long long)blk, (unsigned long long)new_blk);
3189 3768
3190 s_bhs = kcalloc(blk_per_bucket, sizeof(struct buffer_head *), GFP_NOFS); 3769 s_bucket = ocfs2_xattr_bucket_new(inode);
3191 if (!s_bhs) 3770 t_bucket = ocfs2_xattr_bucket_new(inode);
3192 return -ENOMEM; 3771 if (!s_bucket || !t_bucket) {
3193 3772 ret = -ENOMEM;
3194 ret = ocfs2_read_xattr_bucket(inode, blk, s_bhs, 0);
3195 if (ret) {
3196 mlog_errno(ret); 3773 mlog_errno(ret);
3197 goto out; 3774 goto out;
3198 } 3775 }
3199 3776
3200 ret = ocfs2_journal_access(handle, inode, s_bhs[0], 3777 ret = ocfs2_read_xattr_bucket(s_bucket, blk);
3201 OCFS2_JOURNAL_ACCESS_WRITE);
3202 if (ret) { 3778 if (ret) {
3203 mlog_errno(ret); 3779 mlog_errno(ret);
3204 goto out; 3780 goto out;
3205 } 3781 }
3206 3782
3207 t_bhs = kcalloc(blk_per_bucket, sizeof(struct buffer_head *), GFP_NOFS); 3783 ret = ocfs2_xattr_bucket_journal_access(handle, s_bucket,
3208 if (!t_bhs) { 3784 OCFS2_JOURNAL_ACCESS_WRITE);
3209 ret = -ENOMEM; 3785 if (ret) {
3786 mlog_errno(ret);
3210 goto out; 3787 goto out;
3211 } 3788 }
3212 3789
3213 ret = ocfs2_read_xattr_bucket(inode, new_blk, t_bhs, new_bucket_head); 3790 /*
3791 * Even if !new_bucket_head, we're overwriting t_bucket. Thus,
3792 * there's no need to read it.
3793 */
3794 ret = ocfs2_init_xattr_bucket(t_bucket, new_blk);
3214 if (ret) { 3795 if (ret) {
3215 mlog_errno(ret); 3796 mlog_errno(ret);
3216 goto out; 3797 goto out;
3217 } 3798 }
3218 3799
3219 for (i = 0; i < blk_per_bucket; i++) { 3800 /*
3220 ret = ocfs2_journal_access(handle, inode, t_bhs[i], 3801 * Hey, if we're overwriting t_bucket, what difference does
3221 new_bucket_head ? 3802 * ACCESS_CREATE vs ACCESS_WRITE make? See the comment in the
3222 OCFS2_JOURNAL_ACCESS_CREATE : 3803 * same part of ocfs2_cp_xattr_bucket().
3223 OCFS2_JOURNAL_ACCESS_WRITE); 3804 */
3224 if (ret) { 3805 ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket,
3225 mlog_errno(ret); 3806 new_bucket_head ?
3226 goto out; 3807 OCFS2_JOURNAL_ACCESS_CREATE :
3227 } 3808 OCFS2_JOURNAL_ACCESS_WRITE);
3809 if (ret) {
3810 mlog_errno(ret);
3811 goto out;
3228 } 3812 }
3229 3813
3230 xh = (struct ocfs2_xattr_header *)s_bhs[0]->b_data; 3814 xh = bucket_xh(s_bucket);
3231 count = le16_to_cpu(xh->xh_count); 3815 count = le16_to_cpu(xh->xh_count);
3232 start = ocfs2_xattr_find_divide_pos(xh); 3816 start = ocfs2_xattr_find_divide_pos(xh);
3233 3817
@@ -3239,10 +3823,10 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
3239 * The hash value is set as one larger than 3823 * The hash value is set as one larger than
3240 * that of the last entry in the previous bucket. 3824 * that of the last entry in the previous bucket.
3241 */ 3825 */
3242 for (i = 0; i < blk_per_bucket; i++) 3826 for (i = 0; i < t_bucket->bu_blocks; i++)
3243 memset(t_bhs[i]->b_data, 0, blocksize); 3827 memset(bucket_block(t_bucket, i), 0, blocksize);
3244 3828
3245 xh = (struct ocfs2_xattr_header *)t_bhs[0]->b_data; 3829 xh = bucket_xh(t_bucket);
3246 xh->xh_free_start = cpu_to_le16(blocksize); 3830 xh->xh_free_start = cpu_to_le16(blocksize);
3247 xh->xh_entries[0].xe_name_hash = xe->xe_name_hash; 3831 xh->xh_entries[0].xe_name_hash = xe->xe_name_hash;
3248 le32_add_cpu(&xh->xh_entries[0].xe_name_hash, 1); 3832 le32_add_cpu(&xh->xh_entries[0].xe_name_hash, 1);
@@ -3251,11 +3835,10 @@ static int ocfs2_divide_xattr_bucket(struct inode *inode,
3251 } 3835 }
3252 3836
3253 /* copy the whole bucket to the new first. */ 3837 /* copy the whole bucket to the new first. */
3254 for (i = 0; i < blk_per_bucket; i++) 3838 ocfs2_xattr_bucket_copy_data(t_bucket, s_bucket);
3255 memcpy(t_bhs[i]->b_data, s_bhs[i]->b_data, blocksize);
3256 3839
3257 /* update the new bucket. */ 3840 /* update the new bucket. */
3258 xh = (struct ocfs2_xattr_header *)t_bhs[0]->b_data; 3841 xh = bucket_xh(t_bucket);
3259 3842
3260 /* 3843 /*
3261 * Calculate the total name/value len and xh_free_start for 3844 * Calculate the total name/value len and xh_free_start for
@@ -3319,11 +3902,7 @@ set_num_buckets:
3319 else 3902 else
3320 xh->xh_num_buckets = 0; 3903 xh->xh_num_buckets = 0;
3321 3904
3322 for (i = 0; i < blk_per_bucket; i++) { 3905 ocfs2_xattr_bucket_journal_dirty(handle, t_bucket);
3323 ocfs2_journal_dirty(handle, t_bhs[i]);
3324 if (ret)
3325 mlog_errno(ret);
3326 }
3327 3906
3328 /* store the first_hash of the new bucket. */ 3907 /* store the first_hash of the new bucket. */
3329 if (first_hash) 3908 if (first_hash)
@@ -3337,29 +3916,18 @@ set_num_buckets:
3337 if (start == count) 3916 if (start == count)
3338 goto out; 3917 goto out;
3339 3918
3340 xh = (struct ocfs2_xattr_header *)s_bhs[0]->b_data; 3919 xh = bucket_xh(s_bucket);
3341 memset(&xh->xh_entries[start], 0, 3920 memset(&xh->xh_entries[start], 0,
3342 sizeof(struct ocfs2_xattr_entry) * (count - start)); 3921 sizeof(struct ocfs2_xattr_entry) * (count - start));
3343 xh->xh_count = cpu_to_le16(start); 3922 xh->xh_count = cpu_to_le16(start);
3344 xh->xh_free_start = cpu_to_le16(name_offset); 3923 xh->xh_free_start = cpu_to_le16(name_offset);
3345 xh->xh_name_value_len = cpu_to_le16(name_value_len); 3924 xh->xh_name_value_len = cpu_to_le16(name_value_len);
3346 3925
3347 ocfs2_journal_dirty(handle, s_bhs[0]); 3926 ocfs2_xattr_bucket_journal_dirty(handle, s_bucket);
3348 if (ret)
3349 mlog_errno(ret);
3350 3927
3351out: 3928out:
3352 if (s_bhs) { 3929 ocfs2_xattr_bucket_free(s_bucket);
3353 for (i = 0; i < blk_per_bucket; i++) 3930 ocfs2_xattr_bucket_free(t_bucket);
3354 brelse(s_bhs[i]);
3355 }
3356 kfree(s_bhs);
3357
3358 if (t_bhs) {
3359 for (i = 0; i < blk_per_bucket; i++)
3360 brelse(t_bhs[i]);
3361 }
3362 kfree(t_bhs);
3363 3931
3364 return ret; 3932 return ret;
3365} 3933}
@@ -3376,10 +3944,8 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
3376 u64 t_blkno, 3944 u64 t_blkno,
3377 int t_is_new) 3945 int t_is_new)
3378{ 3946{
3379 int ret, i; 3947 int ret;
3380 int blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 3948 struct ocfs2_xattr_bucket *s_bucket = NULL, *t_bucket = NULL;
3381 int blocksize = inode->i_sb->s_blocksize;
3382 struct buffer_head **s_bhs, **t_bhs = NULL;
3383 3949
3384 BUG_ON(s_blkno == t_blkno); 3950 BUG_ON(s_blkno == t_blkno);
3385 3951
@@ -3387,92 +3953,115 @@ static int ocfs2_cp_xattr_bucket(struct inode *inode,
3387 (unsigned long long)s_blkno, (unsigned long long)t_blkno, 3953 (unsigned long long)s_blkno, (unsigned long long)t_blkno,
3388 t_is_new); 3954 t_is_new);
3389 3955
3390 s_bhs = kzalloc(sizeof(struct buffer_head *) * blk_per_bucket, 3956 s_bucket = ocfs2_xattr_bucket_new(inode);
3391 GFP_NOFS); 3957 t_bucket = ocfs2_xattr_bucket_new(inode);
3392 if (!s_bhs) 3958 if (!s_bucket || !t_bucket) {
3393 return -ENOMEM; 3959 ret = -ENOMEM;
3960 mlog_errno(ret);
3961 goto out;
3962 }
3394 3963
3395 ret = ocfs2_read_xattr_bucket(inode, s_blkno, s_bhs, 0); 3964 ret = ocfs2_read_xattr_bucket(s_bucket, s_blkno);
3396 if (ret) 3965 if (ret)
3397 goto out; 3966 goto out;
3398 3967
3399 t_bhs = kzalloc(sizeof(struct buffer_head *) * blk_per_bucket, 3968 /*
3400 GFP_NOFS); 3969 * Even if !t_is_new, we're overwriting t_bucket. Thus,
3401 if (!t_bhs) { 3970 * there's no need to read it.
3402 ret = -ENOMEM; 3971 */
3972 ret = ocfs2_init_xattr_bucket(t_bucket, t_blkno);
3973 if (ret)
3403 goto out; 3974 goto out;
3404 }
3405 3975
3406 ret = ocfs2_read_xattr_bucket(inode, t_blkno, t_bhs, t_is_new); 3976 /*
3977 * Hey, if we're overwriting t_bucket, what difference does
3978 * ACCESS_CREATE vs ACCESS_WRITE make? Well, if we allocated a new
3979 * cluster to fill, we came here from
3980 * ocfs2_mv_xattr_buckets(), and it is really new -
3981 * ACCESS_CREATE is required. But we also might have moved data
3982 * out of t_bucket before extending back into it.
3983 * ocfs2_add_new_xattr_bucket() can do this - its call to
3984 * ocfs2_add_new_xattr_cluster() may have created a new extent
3985 * and copied out the end of the old extent. Then it re-extends
3986 * the old extent back to create space for new xattrs. That's
3987 * how we get here, and the bucket isn't really new.
3988 */
3989 ret = ocfs2_xattr_bucket_journal_access(handle, t_bucket,
3990 t_is_new ?
3991 OCFS2_JOURNAL_ACCESS_CREATE :
3992 OCFS2_JOURNAL_ACCESS_WRITE);
3407 if (ret) 3993 if (ret)
3408 goto out; 3994 goto out;
3409 3995
3410 for (i = 0; i < blk_per_bucket; i++) { 3996 ocfs2_xattr_bucket_copy_data(t_bucket, s_bucket);
3411 ret = ocfs2_journal_access(handle, inode, t_bhs[i], 3997 ocfs2_xattr_bucket_journal_dirty(handle, t_bucket);
3412 t_is_new ?
3413 OCFS2_JOURNAL_ACCESS_CREATE :
3414 OCFS2_JOURNAL_ACCESS_WRITE);
3415 if (ret)
3416 goto out;
3417 }
3418
3419 for (i = 0; i < blk_per_bucket; i++) {
3420 memcpy(t_bhs[i]->b_data, s_bhs[i]->b_data, blocksize);
3421 ocfs2_journal_dirty(handle, t_bhs[i]);
3422 }
3423 3998
3424out: 3999out:
3425 if (s_bhs) { 4000 ocfs2_xattr_bucket_free(t_bucket);
3426 for (i = 0; i < blk_per_bucket; i++) 4001 ocfs2_xattr_bucket_free(s_bucket);
3427 brelse(s_bhs[i]);
3428 }
3429 kfree(s_bhs);
3430
3431 if (t_bhs) {
3432 for (i = 0; i < blk_per_bucket; i++)
3433 brelse(t_bhs[i]);
3434 }
3435 kfree(t_bhs);
3436 4002
3437 return ret; 4003 return ret;
3438} 4004}
3439 4005
3440/* 4006/*
3441 * Copy one xattr cluster from src_blk to to_blk. 4007 * src_blk points to the start of an existing extent. last_blk points to
3442 * The to_blk will become the first bucket header of the cluster, so its 4008 * last cluster in that extent. to_blk points to a newly allocated
3443 * xh_num_buckets will be initialized as the bucket num in the cluster. 4009 * extent. We copy the buckets from the cluster at last_blk to the new
4010 * extent. If start_bucket is non-zero, we skip that many buckets before
4011 * we start copying. The new extent's xh_num_buckets gets set to the
4012 * number of buckets we copied. The old extent's xh_num_buckets shrinks
4013 * by the same amount.
3444 */ 4014 */
3445static int ocfs2_cp_xattr_cluster(struct inode *inode, 4015static int ocfs2_mv_xattr_buckets(struct inode *inode, handle_t *handle,
3446 handle_t *handle, 4016 u64 src_blk, u64 last_blk, u64 to_blk,
3447 struct buffer_head *first_bh, 4017 unsigned int start_bucket,
3448 u64 src_blk,
3449 u64 to_blk,
3450 u32 *first_hash) 4018 u32 *first_hash)
3451{ 4019{
3452 int i, ret, credits; 4020 int i, ret, credits;
3453 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 4021 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3454 int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 4022 int blks_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3455 int num_buckets = ocfs2_xattr_buckets_per_cluster(osb); 4023 int num_buckets = ocfs2_xattr_buckets_per_cluster(osb);
3456 struct buffer_head *bh = NULL; 4024 struct ocfs2_xattr_bucket *old_first, *new_first;
3457 struct ocfs2_xattr_header *xh; 4025
3458 u64 to_blk_start = to_blk; 4026 mlog(0, "mv xattrs from cluster %llu to %llu\n",
4027 (unsigned long long)last_blk, (unsigned long long)to_blk);
4028
4029 BUG_ON(start_bucket >= num_buckets);
4030 if (start_bucket) {
4031 num_buckets -= start_bucket;
4032 last_blk += (start_bucket * blks_per_bucket);
4033 }
4034
4035 /* The first bucket of the original extent */
4036 old_first = ocfs2_xattr_bucket_new(inode);
4037 /* The first bucket of the new extent */
4038 new_first = ocfs2_xattr_bucket_new(inode);
4039 if (!old_first || !new_first) {
4040 ret = -ENOMEM;
4041 mlog_errno(ret);
4042 goto out;
4043 }
3459 4044
3460 mlog(0, "cp xattrs from cluster %llu to %llu\n", 4045 ret = ocfs2_read_xattr_bucket(old_first, src_blk);
3461 (unsigned long long)src_blk, (unsigned long long)to_blk); 4046 if (ret) {
4047 mlog_errno(ret);
4048 goto out;
4049 }
3462 4050
3463 /* 4051 /*
3464 * We need to update the new cluster and 1 more for the update of 4052 * We need to update the first bucket of the old extent and all
3465 * the 1st bucket of the previous extent rec. 4053 * the buckets going to the new extent.
3466 */ 4054 */
3467 credits = bpc + 1; 4055 credits = ((num_buckets + 1) * blks_per_bucket) +
4056 handle->h_buffer_credits;
3468 ret = ocfs2_extend_trans(handle, credits); 4057 ret = ocfs2_extend_trans(handle, credits);
3469 if (ret) { 4058 if (ret) {
3470 mlog_errno(ret); 4059 mlog_errno(ret);
3471 goto out; 4060 goto out;
3472 } 4061 }
3473 4062
3474 ret = ocfs2_journal_access(handle, inode, first_bh, 4063 ret = ocfs2_xattr_bucket_journal_access(handle, old_first,
3475 OCFS2_JOURNAL_ACCESS_WRITE); 4064 OCFS2_JOURNAL_ACCESS_WRITE);
3476 if (ret) { 4065 if (ret) {
3477 mlog_errno(ret); 4066 mlog_errno(ret);
3478 goto out; 4067 goto out;
@@ -3480,45 +4069,45 @@ static int ocfs2_cp_xattr_cluster(struct inode *inode,
3480 4069
3481 for (i = 0; i < num_buckets; i++) { 4070 for (i = 0; i < num_buckets; i++) {
3482 ret = ocfs2_cp_xattr_bucket(inode, handle, 4071 ret = ocfs2_cp_xattr_bucket(inode, handle,
3483 src_blk, to_blk, 1); 4072 last_blk + (i * blks_per_bucket),
4073 to_blk + (i * blks_per_bucket),
4074 1);
3484 if (ret) { 4075 if (ret) {
3485 mlog_errno(ret); 4076 mlog_errno(ret);
3486 goto out; 4077 goto out;
3487 } 4078 }
3488
3489 src_blk += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3490 to_blk += ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3491 } 4079 }
3492 4080
3493 /* update the old bucket header. */ 4081 /*
3494 xh = (struct ocfs2_xattr_header *)first_bh->b_data; 4082 * Get the new bucket ready before we dirty anything
3495 le16_add_cpu(&xh->xh_num_buckets, -num_buckets); 4083 * (This actually shouldn't fail, because we already dirtied
3496 4084 * it once in ocfs2_cp_xattr_bucket()).
3497 ocfs2_journal_dirty(handle, first_bh); 4085 */
3498 4086 ret = ocfs2_read_xattr_bucket(new_first, to_blk);
3499 /* update the new bucket header. */ 4087 if (ret) {
3500 ret = ocfs2_read_block(inode, to_blk_start, &bh);
3501 if (ret < 0) {
3502 mlog_errno(ret); 4088 mlog_errno(ret);
3503 goto out; 4089 goto out;
3504 } 4090 }
3505 4091 ret = ocfs2_xattr_bucket_journal_access(handle, new_first,
3506 ret = ocfs2_journal_access(handle, inode, bh, 4092 OCFS2_JOURNAL_ACCESS_WRITE);
3507 OCFS2_JOURNAL_ACCESS_WRITE);
3508 if (ret) { 4093 if (ret) {
3509 mlog_errno(ret); 4094 mlog_errno(ret);
3510 goto out; 4095 goto out;
3511 } 4096 }
3512 4097
3513 xh = (struct ocfs2_xattr_header *)bh->b_data; 4098 /* Now update the headers */
3514 xh->xh_num_buckets = cpu_to_le16(num_buckets); 4099 le16_add_cpu(&bucket_xh(old_first)->xh_num_buckets, -num_buckets);
4100 ocfs2_xattr_bucket_journal_dirty(handle, old_first);
3515 4101
3516 ocfs2_journal_dirty(handle, bh); 4102 bucket_xh(new_first)->xh_num_buckets = cpu_to_le16(num_buckets);
4103 ocfs2_xattr_bucket_journal_dirty(handle, new_first);
3517 4104
3518 if (first_hash) 4105 if (first_hash)
3519 *first_hash = le32_to_cpu(xh->xh_entries[0].xe_name_hash); 4106 *first_hash = le32_to_cpu(bucket_xh(new_first)->xh_entries[0].xe_name_hash);
4107
3520out: 4108out:
3521 brelse(bh); 4109 ocfs2_xattr_bucket_free(new_first);
4110 ocfs2_xattr_bucket_free(old_first);
3522 return ret; 4111 return ret;
3523} 4112}
3524 4113
@@ -3534,7 +4123,7 @@ static int ocfs2_divide_xattr_cluster(struct inode *inode,
3534 u32 *first_hash) 4123 u32 *first_hash)
3535{ 4124{
3536 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 4125 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3537 int ret, credits = 2 * blk_per_bucket; 4126 int ret, credits = 2 * blk_per_bucket + handle->h_buffer_credits;
3538 4127
3539 BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize); 4128 BUG_ON(OCFS2_XATTR_BUCKET_SIZE < OCFS2_SB(inode->i_sb)->s_clustersize);
3540 4129
@@ -3577,43 +4166,49 @@ static int ocfs2_divide_xattr_cluster(struct inode *inode,
3577 */ 4166 */
3578static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode, 4167static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
3579 handle_t *handle, 4168 handle_t *handle,
3580 struct buffer_head **first_bh, 4169 struct ocfs2_xattr_bucket *first,
3581 struct buffer_head **header_bh, 4170 struct ocfs2_xattr_bucket *target,
3582 u64 new_blk, 4171 u64 new_blk,
3583 u64 prev_blk,
3584 u32 prev_clusters, 4172 u32 prev_clusters,
3585 u32 *v_start, 4173 u32 *v_start,
3586 int *extend) 4174 int *extend)
3587{ 4175{
3588 int ret = 0; 4176 int ret;
3589 int bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
3590 4177
3591 mlog(0, "adjust xattrs from cluster %llu len %u to %llu\n", 4178 mlog(0, "adjust xattrs from cluster %llu len %u to %llu\n",
3592 (unsigned long long)prev_blk, prev_clusters, 4179 (unsigned long long)bucket_blkno(first), prev_clusters,
3593 (unsigned long long)new_blk); 4180 (unsigned long long)new_blk);
3594 4181
3595 if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) 4182 if (ocfs2_xattr_buckets_per_cluster(OCFS2_SB(inode->i_sb)) > 1) {
3596 ret = ocfs2_mv_xattr_bucket_cross_cluster(inode, 4183 ret = ocfs2_mv_xattr_bucket_cross_cluster(inode,
3597 handle, 4184 handle,
3598 first_bh, 4185 first, target,
3599 header_bh,
3600 new_blk, 4186 new_blk,
3601 prev_blk,
3602 prev_clusters, 4187 prev_clusters,
3603 v_start); 4188 v_start);
3604 else { 4189 if (ret)
3605 u64 last_blk = prev_blk + bpc * (prev_clusters - 1); 4190 mlog_errno(ret);
3606 4191 } else {
3607 if (prev_clusters > 1 && (*header_bh)->b_blocknr != last_blk) 4192 /* The start of the last cluster in the first extent */
3608 ret = ocfs2_cp_xattr_cluster(inode, handle, *first_bh, 4193 u64 last_blk = bucket_blkno(first) +
3609 last_blk, new_blk, 4194 ((prev_clusters - 1) *
4195 ocfs2_clusters_to_blocks(inode->i_sb, 1));
4196
4197 if (prev_clusters > 1 && bucket_blkno(target) != last_blk) {
4198 ret = ocfs2_mv_xattr_buckets(inode, handle,
4199 bucket_blkno(first),
4200 last_blk, new_blk, 0,
3610 v_start); 4201 v_start);
3611 else { 4202 if (ret)
4203 mlog_errno(ret);
4204 } else {
3612 ret = ocfs2_divide_xattr_cluster(inode, handle, 4205 ret = ocfs2_divide_xattr_cluster(inode, handle,
3613 last_blk, new_blk, 4206 last_blk, new_blk,
3614 v_start); 4207 v_start);
4208 if (ret)
4209 mlog_errno(ret);
3615 4210
3616 if ((*header_bh)->b_blocknr == last_blk && extend) 4211 if ((bucket_blkno(target) == last_blk) && extend)
3617 *extend = 0; 4212 *extend = 0;
3618 } 4213 }
3619 } 4214 }
@@ -3639,56 +4234,37 @@ static int ocfs2_adjust_xattr_cross_cluster(struct inode *inode,
3639 */ 4234 */
3640static int ocfs2_add_new_xattr_cluster(struct inode *inode, 4235static int ocfs2_add_new_xattr_cluster(struct inode *inode,
3641 struct buffer_head *root_bh, 4236 struct buffer_head *root_bh,
3642 struct buffer_head **first_bh, 4237 struct ocfs2_xattr_bucket *first,
3643 struct buffer_head **header_bh, 4238 struct ocfs2_xattr_bucket *target,
3644 u32 *num_clusters, 4239 u32 *num_clusters,
3645 u32 prev_cpos, 4240 u32 prev_cpos,
3646 u64 prev_blkno, 4241 int *extend,
3647 int *extend) 4242 struct ocfs2_xattr_set_ctxt *ctxt)
3648{ 4243{
3649 int ret, credits; 4244 int ret;
3650 u16 bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1); 4245 u16 bpc = ocfs2_clusters_to_blocks(inode->i_sb, 1);
3651 u32 prev_clusters = *num_clusters; 4246 u32 prev_clusters = *num_clusters;
3652 u32 clusters_to_add = 1, bit_off, num_bits, v_start = 0; 4247 u32 clusters_to_add = 1, bit_off, num_bits, v_start = 0;
3653 u64 block; 4248 u64 block;
3654 handle_t *handle = NULL; 4249 handle_t *handle = ctxt->handle;
3655 struct ocfs2_alloc_context *data_ac = NULL;
3656 struct ocfs2_alloc_context *meta_ac = NULL;
3657 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 4250 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3658 struct ocfs2_extent_tree et; 4251 struct ocfs2_extent_tree et;
3659 4252
3660 mlog(0, "Add new xattr cluster for %llu, previous xattr hash = %u, " 4253 mlog(0, "Add new xattr cluster for %llu, previous xattr hash = %u, "
3661 "previous xattr blkno = %llu\n", 4254 "previous xattr blkno = %llu\n",
3662 (unsigned long long)OCFS2_I(inode)->ip_blkno, 4255 (unsigned long long)OCFS2_I(inode)->ip_blkno,
3663 prev_cpos, (unsigned long long)prev_blkno); 4256 prev_cpos, (unsigned long long)bucket_blkno(first));
3664 4257
3665 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh); 4258 ocfs2_init_xattr_tree_extent_tree(&et, inode, root_bh);
3666 4259
3667 ret = ocfs2_lock_allocators(inode, &et, clusters_to_add, 0, 4260 ret = ocfs2_journal_access_xb(handle, inode, root_bh,
3668 &data_ac, &meta_ac); 4261 OCFS2_JOURNAL_ACCESS_WRITE);
3669 if (ret) {
3670 mlog_errno(ret);
3671 goto leave;
3672 }
3673
3674 credits = ocfs2_calc_extend_credits(osb->sb, et.et_root_el,
3675 clusters_to_add);
3676 handle = ocfs2_start_trans(osb, credits);
3677 if (IS_ERR(handle)) {
3678 ret = PTR_ERR(handle);
3679 handle = NULL;
3680 mlog_errno(ret);
3681 goto leave;
3682 }
3683
3684 ret = ocfs2_journal_access(handle, inode, root_bh,
3685 OCFS2_JOURNAL_ACCESS_WRITE);
3686 if (ret < 0) { 4262 if (ret < 0) {
3687 mlog_errno(ret); 4263 mlog_errno(ret);
3688 goto leave; 4264 goto leave;
3689 } 4265 }
3690 4266
3691 ret = __ocfs2_claim_clusters(osb, handle, data_ac, 1, 4267 ret = __ocfs2_claim_clusters(osb, handle, ctxt->data_ac, 1,
3692 clusters_to_add, &bit_off, &num_bits); 4268 clusters_to_add, &bit_off, &num_bits);
3693 if (ret < 0) { 4269 if (ret < 0) {
3694 if (ret != -ENOSPC) 4270 if (ret != -ENOSPC)
@@ -3702,7 +4278,7 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
3702 mlog(0, "Allocating %u clusters at block %u for xattr in inode %llu\n", 4278 mlog(0, "Allocating %u clusters at block %u for xattr in inode %llu\n",
3703 num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno); 4279 num_bits, bit_off, (unsigned long long)OCFS2_I(inode)->ip_blkno);
3704 4280
3705 if (prev_blkno + prev_clusters * bpc == block && 4281 if (bucket_blkno(first) + (prev_clusters * bpc) == block &&
3706 (prev_clusters + num_bits) << osb->s_clustersize_bits <= 4282 (prev_clusters + num_bits) << osb->s_clustersize_bits <=
3707 OCFS2_MAX_XATTR_TREE_LEAF_SIZE) { 4283 OCFS2_MAX_XATTR_TREE_LEAF_SIZE) {
3708 /* 4284 /*
@@ -3721,10 +4297,9 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
3721 } else { 4297 } else {
3722 ret = ocfs2_adjust_xattr_cross_cluster(inode, 4298 ret = ocfs2_adjust_xattr_cross_cluster(inode,
3723 handle, 4299 handle,
3724 first_bh, 4300 first,
3725 header_bh, 4301 target,
3726 block, 4302 block,
3727 prev_blkno,
3728 prev_clusters, 4303 prev_clusters,
3729 &v_start, 4304 &v_start,
3730 extend); 4305 extend);
@@ -3734,149 +4309,137 @@ static int ocfs2_add_new_xattr_cluster(struct inode *inode,
3734 } 4309 }
3735 } 4310 }
3736 4311
3737 if (handle->h_buffer_credits < credits) {
3738 /*
3739 * The journal has been restarted before, and don't
3740 * have enough space for the insertion, so extend it
3741 * here.
3742 */
3743 ret = ocfs2_extend_trans(handle, credits);
3744 if (ret) {
3745 mlog_errno(ret);
3746 goto leave;
3747 }
3748 }
3749 mlog(0, "Insert %u clusters at block %llu for xattr at %u\n", 4312 mlog(0, "Insert %u clusters at block %llu for xattr at %u\n",
3750 num_bits, (unsigned long long)block, v_start); 4313 num_bits, (unsigned long long)block, v_start);
3751 ret = ocfs2_insert_extent(osb, handle, inode, &et, v_start, block, 4314 ret = ocfs2_insert_extent(osb, handle, inode, &et, v_start, block,
3752 num_bits, 0, meta_ac); 4315 num_bits, 0, ctxt->meta_ac);
3753 if (ret < 0) { 4316 if (ret < 0) {
3754 mlog_errno(ret); 4317 mlog_errno(ret);
3755 goto leave; 4318 goto leave;
3756 } 4319 }
3757 4320
3758 ret = ocfs2_journal_dirty(handle, root_bh); 4321 ret = ocfs2_journal_dirty(handle, root_bh);
3759 if (ret < 0) { 4322 if (ret < 0)
3760 mlog_errno(ret); 4323 mlog_errno(ret);
3761 goto leave;
3762 }
3763 4324
3764leave: 4325leave:
3765 if (handle)
3766 ocfs2_commit_trans(osb, handle);
3767 if (data_ac)
3768 ocfs2_free_alloc_context(data_ac);
3769 if (meta_ac)
3770 ocfs2_free_alloc_context(meta_ac);
3771
3772 return ret; 4326 return ret;
3773} 4327}
3774 4328
3775/* 4329/*
3776 * Extend a new xattr bucket and move xattrs to the end one by one until 4330 * We are given an extent. 'first' is the bucket at the very front of
3777 * We meet with start_bh. Only move half of the xattrs to the bucket after it. 4331 * the extent. The extent has space for an additional bucket past
4332 * bucket_xh(first)->xh_num_buckets. 'target_blkno' is the block number
4333 * of the target bucket. We wish to shift every bucket past the target
4334 * down one, filling in that additional space. When we get back to the
4335 * target, we split the target between itself and the now-empty bucket
4336 * at target+1 (aka, target_blkno + blks_per_bucket).
3778 */ 4337 */
3779static int ocfs2_extend_xattr_bucket(struct inode *inode, 4338static int ocfs2_extend_xattr_bucket(struct inode *inode,
3780 struct buffer_head *first_bh, 4339 handle_t *handle,
3781 struct buffer_head *start_bh, 4340 struct ocfs2_xattr_bucket *first,
4341 u64 target_blk,
3782 u32 num_clusters) 4342 u32 num_clusters)
3783{ 4343{
3784 int ret, credits; 4344 int ret, credits;
3785 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); 4345 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3786 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb); 4346 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
3787 u64 start_blk = start_bh->b_blocknr, end_blk; 4347 u64 end_blk;
3788 u32 num_buckets = num_clusters * ocfs2_xattr_buckets_per_cluster(osb); 4348 u16 new_bucket = le16_to_cpu(bucket_xh(first)->xh_num_buckets);
3789 handle_t *handle;
3790 struct ocfs2_xattr_header *first_xh =
3791 (struct ocfs2_xattr_header *)first_bh->b_data;
3792 u16 bucket = le16_to_cpu(first_xh->xh_num_buckets);
3793 4349
3794 mlog(0, "extend xattr bucket in %llu, xattr extend rec starting " 4350 mlog(0, "extend xattr bucket in %llu, xattr extend rec starting "
3795 "from %llu, len = %u\n", (unsigned long long)start_blk, 4351 "from %llu, len = %u\n", (unsigned long long)target_blk,
3796 (unsigned long long)first_bh->b_blocknr, num_clusters); 4352 (unsigned long long)bucket_blkno(first), num_clusters);
3797 4353
3798 BUG_ON(bucket >= num_buckets); 4354 /* The extent must have room for an additional bucket */
4355 BUG_ON(new_bucket >=
4356 (num_clusters * ocfs2_xattr_buckets_per_cluster(osb)));
3799 4357
3800 end_blk = first_bh->b_blocknr + (bucket - 1) * blk_per_bucket; 4358 /* end_blk points to the last existing bucket */
4359 end_blk = bucket_blkno(first) + ((new_bucket - 1) * blk_per_bucket);
3801 4360
3802 /* 4361 /*
3803 * We will touch all the buckets after the start_bh(include it). 4362 * end_blk is the start of the last existing bucket.
3804 * Add one more bucket and modify the first_bh. 4363 * Thus, (end_blk - target_blk) covers the target bucket and
4364 * every bucket after it up to, but not including, the last
4365 * existing bucket. Then we add the last existing bucket, the
4366 * new bucket, and the first bucket (3 * blk_per_bucket).
3805 */ 4367 */
3806 credits = end_blk - start_blk + 2 * blk_per_bucket + 1; 4368 credits = (end_blk - target_blk) + (3 * blk_per_bucket) +
3807 handle = ocfs2_start_trans(osb, credits); 4369 handle->h_buffer_credits;
3808 if (IS_ERR(handle)) { 4370 ret = ocfs2_extend_trans(handle, credits);
3809 ret = PTR_ERR(handle); 4371 if (ret) {
3810 handle = NULL;
3811 mlog_errno(ret); 4372 mlog_errno(ret);
3812 goto out; 4373 goto out;
3813 } 4374 }
3814 4375
3815 ret = ocfs2_journal_access(handle, inode, first_bh, 4376 ret = ocfs2_xattr_bucket_journal_access(handle, first,
3816 OCFS2_JOURNAL_ACCESS_WRITE); 4377 OCFS2_JOURNAL_ACCESS_WRITE);
3817 if (ret) { 4378 if (ret) {
3818 mlog_errno(ret); 4379 mlog_errno(ret);
3819 goto commit; 4380 goto out;
3820 } 4381 }
3821 4382
3822 while (end_blk != start_blk) { 4383 while (end_blk != target_blk) {
3823 ret = ocfs2_cp_xattr_bucket(inode, handle, end_blk, 4384 ret = ocfs2_cp_xattr_bucket(inode, handle, end_blk,
3824 end_blk + blk_per_bucket, 0); 4385 end_blk + blk_per_bucket, 0);
3825 if (ret) 4386 if (ret)
3826 goto commit; 4387 goto out;
3827 end_blk -= blk_per_bucket; 4388 end_blk -= blk_per_bucket;
3828 } 4389 }
3829 4390
3830 /* Move half of the xattr in start_blk to the next bucket. */ 4391 /* Move half of the xattr in target_blkno to the next bucket. */
3831 ret = ocfs2_divide_xattr_bucket(inode, handle, start_blk, 4392 ret = ocfs2_divide_xattr_bucket(inode, handle, target_blk,
3832 start_blk + blk_per_bucket, NULL, 0); 4393 target_blk + blk_per_bucket, NULL, 0);
3833 4394
3834 le16_add_cpu(&first_xh->xh_num_buckets, 1); 4395 le16_add_cpu(&bucket_xh(first)->xh_num_buckets, 1);
3835 ocfs2_journal_dirty(handle, first_bh); 4396 ocfs2_xattr_bucket_journal_dirty(handle, first);
3836 4397
3837commit:
3838 ocfs2_commit_trans(osb, handle);
3839out: 4398out:
3840 return ret; 4399 return ret;
3841} 4400}
3842 4401
3843/* 4402/*
3844 * Add new xattr bucket in an extent record and adjust the buckets accordingly. 4403 * Add new xattr bucket in an extent record and adjust the buckets
3845 * xb_bh is the ocfs2_xattr_block. 4404 * accordingly. xb_bh is the ocfs2_xattr_block, and target is the
3846 * We will move all the buckets starting from header_bh to the next place. As 4405 * bucket we want to insert into.
3847 * for this one, half num of its xattrs will be moved to the next one. 4406 *
4407 * In the easy case, we will move all the buckets after target down by
4408 * one. Half of target's xattrs will be moved to the next bucket.
3848 * 4409 *
3849 * We will allocate a new cluster if current cluster is full and adjust 4410 * If current cluster is full, we'll allocate a new one. This may not
3850 * header_bh and first_bh if the insert place is moved to the new cluster. 4411 * be contiguous. The underlying calls will make sure that there is
4412 * space for the insert, shifting buckets around if necessary.
4413 * 'target' may be moved by those calls.
3851 */ 4414 */
3852static int ocfs2_add_new_xattr_bucket(struct inode *inode, 4415static int ocfs2_add_new_xattr_bucket(struct inode *inode,
3853 struct buffer_head *xb_bh, 4416 struct buffer_head *xb_bh,
3854 struct buffer_head *header_bh) 4417 struct ocfs2_xattr_bucket *target,
4418 struct ocfs2_xattr_set_ctxt *ctxt)
3855{ 4419{
3856 struct ocfs2_xattr_header *first_xh = NULL;
3857 struct buffer_head *first_bh = NULL;
3858 struct ocfs2_xattr_block *xb = 4420 struct ocfs2_xattr_block *xb =
3859 (struct ocfs2_xattr_block *)xb_bh->b_data; 4421 (struct ocfs2_xattr_block *)xb_bh->b_data;
3860 struct ocfs2_xattr_tree_root *xb_root = &xb->xb_attrs.xb_root; 4422 struct ocfs2_xattr_tree_root *xb_root = &xb->xb_attrs.xb_root;
3861 struct ocfs2_extent_list *el = &xb_root->xt_list; 4423 struct ocfs2_extent_list *el = &xb_root->xt_list;
3862 struct ocfs2_xattr_header *xh = 4424 u32 name_hash =
3863 (struct ocfs2_xattr_header *)header_bh->b_data; 4425 le32_to_cpu(bucket_xh(target)->xh_entries[0].xe_name_hash);
3864 u32 name_hash = le32_to_cpu(xh->xh_entries[0].xe_name_hash); 4426 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
3865 struct super_block *sb = inode->i_sb;
3866 struct ocfs2_super *osb = OCFS2_SB(sb);
3867 int ret, num_buckets, extend = 1; 4427 int ret, num_buckets, extend = 1;
3868 u64 p_blkno; 4428 u64 p_blkno;
3869 u32 e_cpos, num_clusters; 4429 u32 e_cpos, num_clusters;
4430 /* The bucket at the front of the extent */
4431 struct ocfs2_xattr_bucket *first;
3870 4432
3871 mlog(0, "Add new xattr bucket starting form %llu\n", 4433 mlog(0, "Add new xattr bucket starting from %llu\n",
3872 (unsigned long long)header_bh->b_blocknr); 4434 (unsigned long long)bucket_blkno(target));
3873 4435
3874 /* 4436 /* The first bucket of the original extent */
3875 * Add refrence for header_bh here because it may be 4437 first = ocfs2_xattr_bucket_new(inode);
3876 * changed in ocfs2_add_new_xattr_cluster and we need 4438 if (!first) {
3877 * to free it in the end. 4439 ret = -ENOMEM;
3878 */ 4440 mlog_errno(ret);
3879 get_bh(header_bh); 4441 goto out;
4442 }
3880 4443
3881 ret = ocfs2_xattr_get_rec(inode, name_hash, &p_blkno, &e_cpos, 4444 ret = ocfs2_xattr_get_rec(inode, name_hash, &p_blkno, &e_cpos,
3882 &num_clusters, el); 4445 &num_clusters, el);
@@ -3885,40 +4448,45 @@ static int ocfs2_add_new_xattr_bucket(struct inode *inode,
3885 goto out; 4448 goto out;
3886 } 4449 }
3887 4450
3888 ret = ocfs2_read_block(inode, p_blkno, &first_bh); 4451 ret = ocfs2_read_xattr_bucket(first, p_blkno);
3889 if (ret) { 4452 if (ret) {
3890 mlog_errno(ret); 4453 mlog_errno(ret);
3891 goto out; 4454 goto out;
3892 } 4455 }
3893 4456
3894 num_buckets = ocfs2_xattr_buckets_per_cluster(osb) * num_clusters; 4457 num_buckets = ocfs2_xattr_buckets_per_cluster(osb) * num_clusters;
3895 first_xh = (struct ocfs2_xattr_header *)first_bh->b_data; 4458 if (num_buckets == le16_to_cpu(bucket_xh(first)->xh_num_buckets)) {
3896 4459 /*
3897 if (num_buckets == le16_to_cpu(first_xh->xh_num_buckets)) { 4460 * This can move first+target if the target bucket moves
4461 * to the new extent.
4462 */
3898 ret = ocfs2_add_new_xattr_cluster(inode, 4463 ret = ocfs2_add_new_xattr_cluster(inode,
3899 xb_bh, 4464 xb_bh,
3900 &first_bh, 4465 first,
3901 &header_bh, 4466 target,
3902 &num_clusters, 4467 &num_clusters,
3903 e_cpos, 4468 e_cpos,
3904 p_blkno, 4469 &extend,
3905 &extend); 4470 ctxt);
3906 if (ret) { 4471 if (ret) {
3907 mlog_errno(ret); 4472 mlog_errno(ret);
3908 goto out; 4473 goto out;
3909 } 4474 }
3910 } 4475 }
3911 4476
3912 if (extend) 4477 if (extend) {
3913 ret = ocfs2_extend_xattr_bucket(inode, 4478 ret = ocfs2_extend_xattr_bucket(inode,
3914 first_bh, 4479 ctxt->handle,
3915 header_bh, 4480 first,
4481 bucket_blkno(target),
3916 num_clusters); 4482 num_clusters);
3917 if (ret) 4483 if (ret)
3918 mlog_errno(ret); 4484 mlog_errno(ret);
4485 }
4486
3919out: 4487out:
3920 brelse(first_bh); 4488 ocfs2_xattr_bucket_free(first);
3921 brelse(header_bh); 4489
3922 return ret; 4490 return ret;
3923} 4491}
3924 4492
@@ -3929,7 +4497,7 @@ static inline char *ocfs2_xattr_bucket_get_val(struct inode *inode,
3929 int block_off = offs >> inode->i_sb->s_blocksize_bits; 4497 int block_off = offs >> inode->i_sb->s_blocksize_bits;
3930 4498
3931 offs = offs % inode->i_sb->s_blocksize; 4499 offs = offs % inode->i_sb->s_blocksize;
3932 return bucket->bhs[block_off]->b_data + offs; 4500 return bucket_block(bucket, block_off) + offs;
3933} 4501}
3934 4502
3935/* 4503/*
@@ -3984,7 +4552,7 @@ static void ocfs2_xattr_set_entry_normal(struct inode *inode,
3984 xe->xe_value_size = 0; 4552 xe->xe_value_size = 0;
3985 4553
3986 val = ocfs2_xattr_bucket_get_val(inode, 4554 val = ocfs2_xattr_bucket_get_val(inode,
3987 &xs->bucket, offs); 4555 xs->bucket, offs);
3988 memset(val + OCFS2_XATTR_SIZE(name_len), 0, 4556 memset(val + OCFS2_XATTR_SIZE(name_len), 0,
3989 size - OCFS2_XATTR_SIZE(name_len)); 4557 size - OCFS2_XATTR_SIZE(name_len));
3990 if (OCFS2_XATTR_SIZE(xi->value_len) > 0) 4558 if (OCFS2_XATTR_SIZE(xi->value_len) > 0)
@@ -4062,8 +4630,7 @@ set_new_name_value:
4062 xh->xh_free_start = cpu_to_le16(offs); 4630 xh->xh_free_start = cpu_to_le16(offs);
4063 } 4631 }
4064 4632
4065 val = ocfs2_xattr_bucket_get_val(inode, 4633 val = ocfs2_xattr_bucket_get_val(inode, xs->bucket, offs - size);
4066 &xs->bucket, offs - size);
4067 xe->xe_name_offset = cpu_to_le16(offs - size); 4634 xe->xe_name_offset = cpu_to_le16(offs - size);
4068 4635
4069 memset(val, 0, size); 4636 memset(val, 0, size);
@@ -4079,125 +4646,45 @@ set_new_name_value:
4079 return; 4646 return;
4080} 4647}
4081 4648
4082static int ocfs2_xattr_bucket_handle_journal(struct inode *inode,
4083 handle_t *handle,
4084 struct ocfs2_xattr_search *xs,
4085 struct buffer_head **bhs,
4086 u16 bh_num)
4087{
4088 int ret = 0, off, block_off;
4089 struct ocfs2_xattr_entry *xe = xs->here;
4090
4091 /*
4092 * First calculate all the blocks we should journal_access
4093 * and journal_dirty. The first block should always be touched.
4094 */
4095 ret = ocfs2_journal_dirty(handle, bhs[0]);
4096 if (ret)
4097 mlog_errno(ret);
4098
4099 /* calc the data. */
4100 off = le16_to_cpu(xe->xe_name_offset);
4101 block_off = off >> inode->i_sb->s_blocksize_bits;
4102 ret = ocfs2_journal_dirty(handle, bhs[block_off]);
4103 if (ret)
4104 mlog_errno(ret);
4105
4106 return ret;
4107}
4108
4109/* 4649/*
4110 * Set the xattr entry in the specified bucket. 4650 * Set the xattr entry in the specified bucket.
4111 * The bucket is indicated by xs->bucket and it should have the enough 4651 * The bucket is indicated by xs->bucket and it should have the enough
4112 * space for the xattr insertion. 4652 * space for the xattr insertion.
4113 */ 4653 */
4114static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode, 4654static int ocfs2_xattr_set_entry_in_bucket(struct inode *inode,
4655 handle_t *handle,
4115 struct ocfs2_xattr_info *xi, 4656 struct ocfs2_xattr_info *xi,
4116 struct ocfs2_xattr_search *xs, 4657 struct ocfs2_xattr_search *xs,
4117 u32 name_hash, 4658 u32 name_hash,
4118 int local) 4659 int local)
4119{ 4660{
4120 int i, ret; 4661 int ret;
4121 handle_t *handle = NULL; 4662 u64 blkno;
4122 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
4123 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
4124 4663
4125 mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n", 4664 mlog(0, "Set xattr entry len = %lu index = %d in bucket %llu\n",
4126 (unsigned long)xi->value_len, xi->name_index, 4665 (unsigned long)xi->value_len, xi->name_index,
4127 (unsigned long long)xs->bucket.bhs[0]->b_blocknr); 4666 (unsigned long long)bucket_blkno(xs->bucket));
4128 4667
4129 if (!xs->bucket.bhs[1]) { 4668 if (!xs->bucket->bu_bhs[1]) {
4130 ret = ocfs2_read_blocks(inode, 4669 blkno = bucket_blkno(xs->bucket);
4131 xs->bucket.bhs[0]->b_blocknr + 1, 4670 ocfs2_xattr_bucket_relse(xs->bucket);
4132 blk_per_bucket - 1, &xs->bucket.bhs[1], 4671 ret = ocfs2_read_xattr_bucket(xs->bucket, blkno);
4133 0);
4134 if (ret) { 4672 if (ret) {
4135 mlog_errno(ret); 4673 mlog_errno(ret);
4136 goto out; 4674 goto out;
4137 } 4675 }
4138 } 4676 }
4139 4677
4140 handle = ocfs2_start_trans(osb, blk_per_bucket); 4678 ret = ocfs2_xattr_bucket_journal_access(handle, xs->bucket,
4141 if (IS_ERR(handle)) { 4679 OCFS2_JOURNAL_ACCESS_WRITE);
4142 ret = PTR_ERR(handle); 4680 if (ret < 0) {
4143 handle = NULL;
4144 mlog_errno(ret); 4681 mlog_errno(ret);
4145 goto out; 4682 goto out;
4146 } 4683 }
4147 4684
4148 for (i = 0; i < blk_per_bucket; i++) {
4149 ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[i],
4150 OCFS2_JOURNAL_ACCESS_WRITE);
4151 if (ret < 0) {
4152 mlog_errno(ret);
4153 goto out;
4154 }
4155 }
4156
4157 ocfs2_xattr_set_entry_normal(inode, xi, xs, name_hash, local); 4685 ocfs2_xattr_set_entry_normal(inode, xi, xs, name_hash, local);
4686 ocfs2_xattr_bucket_journal_dirty(handle, xs->bucket);
4158 4687
4159 /*Only dirty the blocks we have touched in set xattr. */
4160 ret = ocfs2_xattr_bucket_handle_journal(inode, handle, xs,
4161 xs->bucket.bhs, blk_per_bucket);
4162 if (ret)
4163 mlog_errno(ret);
4164out:
4165 ocfs2_commit_trans(osb, handle);
4166
4167 return ret;
4168}
4169
4170static int ocfs2_xattr_value_update_size(struct inode *inode,
4171 struct buffer_head *xe_bh,
4172 struct ocfs2_xattr_entry *xe,
4173 u64 new_size)
4174{
4175 int ret;
4176 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
4177 handle_t *handle = NULL;
4178
4179 handle = ocfs2_start_trans(osb, 1);
4180 if (IS_ERR(handle)) {
4181 ret = -ENOMEM;
4182 mlog_errno(ret);
4183 goto out;
4184 }
4185
4186 ret = ocfs2_journal_access(handle, inode, xe_bh,
4187 OCFS2_JOURNAL_ACCESS_WRITE);
4188 if (ret < 0) {
4189 mlog_errno(ret);
4190 goto out_commit;
4191 }
4192
4193 xe->xe_value_size = cpu_to_le64(new_size);
4194
4195 ret = ocfs2_journal_dirty(handle, xe_bh);
4196 if (ret < 0)
4197 mlog_errno(ret);
4198
4199out_commit:
4200 ocfs2_commit_trans(osb, handle);
4201out: 4688out:
4202 return ret; 4689 return ret;
4203} 4690}
@@ -4210,18 +4697,19 @@ out:
4210 * Copy the new updated xe and xe_value_root to new_xe and new_xv if needed. 4697 * Copy the new updated xe and xe_value_root to new_xe and new_xv if needed.
4211 */ 4698 */
4212static int ocfs2_xattr_bucket_value_truncate(struct inode *inode, 4699static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
4213 struct buffer_head *header_bh, 4700 struct ocfs2_xattr_bucket *bucket,
4214 int xe_off, 4701 int xe_off,
4215 int len) 4702 int len,
4703 struct ocfs2_xattr_set_ctxt *ctxt)
4216{ 4704{
4217 int ret, offset; 4705 int ret, offset;
4218 u64 value_blk; 4706 u64 value_blk;
4219 struct buffer_head *value_bh = NULL;
4220 struct ocfs2_xattr_value_root *xv;
4221 struct ocfs2_xattr_entry *xe; 4707 struct ocfs2_xattr_entry *xe;
4222 struct ocfs2_xattr_header *xh = 4708 struct ocfs2_xattr_header *xh = bucket_xh(bucket);
4223 (struct ocfs2_xattr_header *)header_bh->b_data;
4224 size_t blocksize = inode->i_sb->s_blocksize; 4709 size_t blocksize = inode->i_sb->s_blocksize;
4710 struct ocfs2_xattr_value_buf vb = {
4711 .vb_access = ocfs2_journal_access,
4712 };
4225 4713
4226 xe = &xh->xh_entries[xe_off]; 4714 xe = &xh->xh_entries[xe_off];
4227 4715
@@ -4234,49 +4722,58 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
4234 4722
4235 /* We don't allow ocfs2_xattr_value to be stored in different block. */ 4723 /* We don't allow ocfs2_xattr_value to be stored in different block. */
4236 BUG_ON(value_blk != (offset + OCFS2_XATTR_ROOT_SIZE - 1) / blocksize); 4724 BUG_ON(value_blk != (offset + OCFS2_XATTR_ROOT_SIZE - 1) / blocksize);
4237 value_blk += header_bh->b_blocknr;
4238 4725
4239 ret = ocfs2_read_block(inode, value_blk, &value_bh); 4726 vb.vb_bh = bucket->bu_bhs[value_blk];
4240 if (ret) { 4727 BUG_ON(!vb.vb_bh);
4241 mlog_errno(ret);
4242 goto out;
4243 }
4244 4728
4245 xv = (struct ocfs2_xattr_value_root *) 4729 vb.vb_xv = (struct ocfs2_xattr_value_root *)
4246 (value_bh->b_data + offset % blocksize); 4730 (vb.vb_bh->b_data + offset % blocksize);
4247 4731
4248 mlog(0, "truncate %u in xattr bucket %llu to %d bytes.\n", 4732 ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
4249 xe_off, (unsigned long long)header_bh->b_blocknr, len); 4733 OCFS2_JOURNAL_ACCESS_WRITE);
4250 ret = ocfs2_xattr_value_truncate(inode, value_bh, xv, len);
4251 if (ret) { 4734 if (ret) {
4252 mlog_errno(ret); 4735 mlog_errno(ret);
4253 goto out; 4736 goto out;
4254 } 4737 }
4255 4738
4256 ret = ocfs2_xattr_value_update_size(inode, header_bh, xe, len); 4739 /*
4740 * From here on out we have to dirty the bucket. The generic
4741 * value calls only modify one of the bucket's bhs, but we need
4742 * to send the bucket at once. So if they error, they *could* have
4743 * modified something. We have to assume they did, and dirty
4744 * the whole bucket. This leaves us in a consistent state.
4745 */
4746 mlog(0, "truncate %u in xattr bucket %llu to %d bytes.\n",
4747 xe_off, (unsigned long long)bucket_blkno(bucket), len);
4748 ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt);
4257 if (ret) { 4749 if (ret) {
4258 mlog_errno(ret); 4750 mlog_errno(ret);
4259 goto out; 4751 goto out_dirty;
4260 } 4752 }
4261 4753
4754 xe->xe_value_size = cpu_to_le64(len);
4755
4756out_dirty:
4757 ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket);
4758
4262out: 4759out:
4263 brelse(value_bh);
4264 return ret; 4760 return ret;
4265} 4761}
4266 4762
4267static int ocfs2_xattr_bucket_value_truncate_xs(struct inode *inode, 4763static int ocfs2_xattr_bucket_value_truncate_xs(struct inode *inode,
4268 struct ocfs2_xattr_search *xs, 4764 struct ocfs2_xattr_search *xs,
4269 int len) 4765 int len,
4766 struct ocfs2_xattr_set_ctxt *ctxt)
4270{ 4767{
4271 int ret, offset; 4768 int ret, offset;
4272 struct ocfs2_xattr_entry *xe = xs->here; 4769 struct ocfs2_xattr_entry *xe = xs->here;
4273 struct ocfs2_xattr_header *xh = (struct ocfs2_xattr_header *)xs->base; 4770 struct ocfs2_xattr_header *xh = (struct ocfs2_xattr_header *)xs->base;
4274 4771
4275 BUG_ON(!xs->bucket.bhs[0] || !xe || ocfs2_xattr_is_local(xe)); 4772 BUG_ON(!xs->bucket->bu_bhs[0] || !xe || ocfs2_xattr_is_local(xe));
4276 4773
4277 offset = xe - xh->xh_entries; 4774 offset = xe - xh->xh_entries;
4278 ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket.bhs[0], 4775 ret = ocfs2_xattr_bucket_value_truncate(inode, xs->bucket,
4279 offset, len); 4776 offset, len, ctxt);
4280 if (ret) 4777 if (ret)
4281 mlog_errno(ret); 4778 mlog_errno(ret);
4282 4779
@@ -4284,6 +4781,7 @@ static int ocfs2_xattr_bucket_value_truncate_xs(struct inode *inode,
4284} 4781}
4285 4782
4286static int ocfs2_xattr_bucket_set_value_outside(struct inode *inode, 4783static int ocfs2_xattr_bucket_set_value_outside(struct inode *inode,
4784 handle_t *handle,
4287 struct ocfs2_xattr_search *xs, 4785 struct ocfs2_xattr_search *xs,
4288 char *val, 4786 char *val,
4289 int value_len) 4787 int value_len)
@@ -4299,7 +4797,8 @@ static int ocfs2_xattr_bucket_set_value_outside(struct inode *inode,
4299 4797
4300 xv = (struct ocfs2_xattr_value_root *)(xs->base + offset); 4798 xv = (struct ocfs2_xattr_value_root *)(xs->base + offset);
4301 4799
4302 return __ocfs2_xattr_set_value_outside(inode, xv, val, value_len); 4800 return __ocfs2_xattr_set_value_outside(inode, handle,
4801 xv, val, value_len);
4303} 4802}
4304 4803
4305static int ocfs2_rm_xattr_cluster(struct inode *inode, 4804static int ocfs2_rm_xattr_cluster(struct inode *inode,
@@ -4343,15 +4842,15 @@ static int ocfs2_rm_xattr_cluster(struct inode *inode,
4343 } 4842 }
4344 } 4843 }
4345 4844
4346 handle = ocfs2_start_trans(osb, OCFS2_REMOVE_EXTENT_CREDITS); 4845 handle = ocfs2_start_trans(osb, ocfs2_remove_extent_credits(osb->sb));
4347 if (IS_ERR(handle)) { 4846 if (IS_ERR(handle)) {
4348 ret = -ENOMEM; 4847 ret = -ENOMEM;
4349 mlog_errno(ret); 4848 mlog_errno(ret);
4350 goto out; 4849 goto out;
4351 } 4850 }
4352 4851
4353 ret = ocfs2_journal_access(handle, inode, root_bh, 4852 ret = ocfs2_journal_access_xb(handle, inode, root_bh,
4354 OCFS2_JOURNAL_ACCESS_WRITE); 4853 OCFS2_JOURNAL_ACCESS_WRITE);
4355 if (ret) { 4854 if (ret) {
4356 mlog_errno(ret); 4855 mlog_errno(ret);
4357 goto out_commit; 4856 goto out_commit;
@@ -4392,26 +4891,19 @@ out:
4392} 4891}
4393 4892
4394static void ocfs2_xattr_bucket_remove_xs(struct inode *inode, 4893static void ocfs2_xattr_bucket_remove_xs(struct inode *inode,
4894 handle_t *handle,
4395 struct ocfs2_xattr_search *xs) 4895 struct ocfs2_xattr_search *xs)
4396{ 4896{
4397 handle_t *handle = NULL; 4897 struct ocfs2_xattr_header *xh = bucket_xh(xs->bucket);
4398 struct ocfs2_xattr_header *xh = xs->bucket.xh;
4399 struct ocfs2_xattr_entry *last = &xh->xh_entries[ 4898 struct ocfs2_xattr_entry *last = &xh->xh_entries[
4400 le16_to_cpu(xh->xh_count) - 1]; 4899 le16_to_cpu(xh->xh_count) - 1];
4401 int ret = 0; 4900 int ret = 0;
4402 4901
4403 handle = ocfs2_start_trans((OCFS2_SB(inode->i_sb)), 1); 4902 ret = ocfs2_xattr_bucket_journal_access(handle, xs->bucket,
4404 if (IS_ERR(handle)) { 4903 OCFS2_JOURNAL_ACCESS_WRITE);
4405 ret = PTR_ERR(handle);
4406 mlog_errno(ret);
4407 return;
4408 }
4409
4410 ret = ocfs2_journal_access(handle, inode, xs->bucket.bhs[0],
4411 OCFS2_JOURNAL_ACCESS_WRITE);
4412 if (ret) { 4904 if (ret) {
4413 mlog_errno(ret); 4905 mlog_errno(ret);
4414 goto out_commit; 4906 return;
4415 } 4907 }
4416 4908
4417 /* Remove the old entry. */ 4909 /* Remove the old entry. */
@@ -4420,11 +4912,7 @@ static void ocfs2_xattr_bucket_remove_xs(struct inode *inode,
4420 memset(last, 0, sizeof(struct ocfs2_xattr_entry)); 4912 memset(last, 0, sizeof(struct ocfs2_xattr_entry));
4421 le16_add_cpu(&xh->xh_count, -1); 4913 le16_add_cpu(&xh->xh_count, -1);
4422 4914
4423 ret = ocfs2_journal_dirty(handle, xs->bucket.bhs[0]); 4915 ocfs2_xattr_bucket_journal_dirty(handle, xs->bucket);
4424 if (ret < 0)
4425 mlog_errno(ret);
4426out_commit:
4427 ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
4428} 4916}
4429 4917
4430/* 4918/*
@@ -4440,7 +4928,8 @@ out_commit:
4440 */ 4928 */
4441static int ocfs2_xattr_set_in_bucket(struct inode *inode, 4929static int ocfs2_xattr_set_in_bucket(struct inode *inode,
4442 struct ocfs2_xattr_info *xi, 4930 struct ocfs2_xattr_info *xi,
4443 struct ocfs2_xattr_search *xs) 4931 struct ocfs2_xattr_search *xs,
4932 struct ocfs2_xattr_set_ctxt *ctxt)
4444{ 4933{
4445 int ret, local = 1; 4934 int ret, local = 1;
4446 size_t value_len; 4935 size_t value_len;
@@ -4468,7 +4957,8 @@ static int ocfs2_xattr_set_in_bucket(struct inode *inode,
4468 value_len = 0; 4957 value_len = 0;
4469 4958
4470 ret = ocfs2_xattr_bucket_value_truncate_xs(inode, xs, 4959 ret = ocfs2_xattr_bucket_value_truncate_xs(inode, xs,
4471 value_len); 4960 value_len,
4961 ctxt);
4472 if (ret) 4962 if (ret)
4473 goto out; 4963 goto out;
4474 4964
@@ -4488,7 +4978,8 @@ static int ocfs2_xattr_set_in_bucket(struct inode *inode,
4488 xi->value_len = OCFS2_XATTR_ROOT_SIZE; 4978 xi->value_len = OCFS2_XATTR_ROOT_SIZE;
4489 } 4979 }
4490 4980
4491 ret = ocfs2_xattr_set_entry_in_bucket(inode, xi, xs, name_hash, local); 4981 ret = ocfs2_xattr_set_entry_in_bucket(inode, ctxt->handle, xi, xs,
4982 name_hash, local);
4492 if (ret) { 4983 if (ret) {
4493 mlog_errno(ret); 4984 mlog_errno(ret);
4494 goto out; 4985 goto out;
@@ -4499,7 +4990,7 @@ static int ocfs2_xattr_set_in_bucket(struct inode *inode,
4499 4990
4500 /* allocate the space now for the outside block storage. */ 4991 /* allocate the space now for the outside block storage. */
4501 ret = ocfs2_xattr_bucket_value_truncate_xs(inode, xs, 4992 ret = ocfs2_xattr_bucket_value_truncate_xs(inode, xs,
4502 value_len); 4993 value_len, ctxt);
4503 if (ret) { 4994 if (ret) {
4504 mlog_errno(ret); 4995 mlog_errno(ret);
4505 4996
@@ -4509,13 +5000,14 @@ static int ocfs2_xattr_set_in_bucket(struct inode *inode,
4509 * storage and we have allocated xattr already, 5000 * storage and we have allocated xattr already,
4510 * so need to remove it. 5001 * so need to remove it.
4511 */ 5002 */
4512 ocfs2_xattr_bucket_remove_xs(inode, xs); 5003 ocfs2_xattr_bucket_remove_xs(inode, ctxt->handle, xs);
4513 } 5004 }
4514 goto out; 5005 goto out;
4515 } 5006 }
4516 5007
4517set_value_outside: 5008set_value_outside:
4518 ret = ocfs2_xattr_bucket_set_value_outside(inode, xs, val, value_len); 5009 ret = ocfs2_xattr_bucket_set_value_outside(inode, ctxt->handle,
5010 xs, val, value_len);
4519out: 5011out:
4520 return ret; 5012 return ret;
4521} 5013}
@@ -4530,7 +5022,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode,
4530 struct ocfs2_xattr_bucket *bucket, 5022 struct ocfs2_xattr_bucket *bucket,
4531 const char *name) 5023 const char *name)
4532{ 5024{
4533 struct ocfs2_xattr_header *xh = bucket->xh; 5025 struct ocfs2_xattr_header *xh = bucket_xh(bucket);
4534 u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name)); 5026 u32 name_hash = ocfs2_xattr_name_hash(inode, name, strlen(name));
4535 5027
4536 if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash)) 5028 if (name_hash != le32_to_cpu(xh->xh_entries[0].xe_name_hash))
@@ -4540,7 +5032,7 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode,
4540 xh->xh_entries[0].xe_name_hash) { 5032 xh->xh_entries[0].xe_name_hash) {
4541 mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, " 5033 mlog(ML_ERROR, "Too much hash collision in xattr bucket %llu, "
4542 "hash = %u\n", 5034 "hash = %u\n",
4543 (unsigned long long)bucket->bhs[0]->b_blocknr, 5035 (unsigned long long)bucket_blkno(bucket),
4544 le32_to_cpu(xh->xh_entries[0].xe_name_hash)); 5036 le32_to_cpu(xh->xh_entries[0].xe_name_hash));
4545 return -ENOSPC; 5037 return -ENOSPC;
4546 } 5038 }
@@ -4550,16 +5042,16 @@ static int ocfs2_check_xattr_bucket_collision(struct inode *inode,
4550 5042
4551static int ocfs2_xattr_set_entry_index_block(struct inode *inode, 5043static int ocfs2_xattr_set_entry_index_block(struct inode *inode,
4552 struct ocfs2_xattr_info *xi, 5044 struct ocfs2_xattr_info *xi,
4553 struct ocfs2_xattr_search *xs) 5045 struct ocfs2_xattr_search *xs,
5046 struct ocfs2_xattr_set_ctxt *ctxt)
4554{ 5047{
4555 struct ocfs2_xattr_header *xh; 5048 struct ocfs2_xattr_header *xh;
4556 struct ocfs2_xattr_entry *xe; 5049 struct ocfs2_xattr_entry *xe;
4557 u16 count, header_size, xh_free_start; 5050 u16 count, header_size, xh_free_start;
4558 int i, free, max_free, need, old; 5051 int free, max_free, need, old;
4559 size_t value_size = 0, name_len = strlen(xi->name); 5052 size_t value_size = 0, name_len = strlen(xi->name);
4560 size_t blocksize = inode->i_sb->s_blocksize; 5053 size_t blocksize = inode->i_sb->s_blocksize;
4561 int ret, allocation = 0; 5054 int ret, allocation = 0;
4562 u16 blk_per_bucket = ocfs2_blocks_per_xattr_bucket(inode->i_sb);
4563 5055
4564 mlog_entry("Set xattr %s in xattr index block\n", xi->name); 5056 mlog_entry("Set xattr %s in xattr index block\n", xi->name);
4565 5057
@@ -4574,7 +5066,7 @@ try_again:
4574 5066
4575 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size " 5067 mlog_bug_on_msg(header_size > blocksize, "bucket %llu has header size "
4576 "of %u which exceed block size\n", 5068 "of %u which exceed block size\n",
4577 (unsigned long long)xs->bucket.bhs[0]->b_blocknr, 5069 (unsigned long long)bucket_blkno(xs->bucket),
4578 header_size); 5070 header_size);
4579 5071
4580 if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE) 5072 if (xi->value && xi->value_len > OCFS2_XATTR_INLINE_SIZE)
@@ -4614,11 +5106,13 @@ try_again:
4614 mlog(0, "xs->not_found = %d, in xattr bucket %llu: free = %d, " 5106 mlog(0, "xs->not_found = %d, in xattr bucket %llu: free = %d, "
4615 "need = %d, max_free = %d, xh_free_start = %u, xh_name_value_len =" 5107 "need = %d, max_free = %d, xh_free_start = %u, xh_name_value_len ="
4616 " %u\n", xs->not_found, 5108 " %u\n", xs->not_found,
4617 (unsigned long long)xs->bucket.bhs[0]->b_blocknr, 5109 (unsigned long long)bucket_blkno(xs->bucket),
4618 free, need, max_free, le16_to_cpu(xh->xh_free_start), 5110 free, need, max_free, le16_to_cpu(xh->xh_free_start),
4619 le16_to_cpu(xh->xh_name_value_len)); 5111 le16_to_cpu(xh->xh_name_value_len));
4620 5112
4621 if (free < need || count == ocfs2_xattr_max_xe_in_bucket(inode->i_sb)) { 5113 if (free < need ||
5114 (xs->not_found &&
5115 count == ocfs2_xattr_max_xe_in_bucket(inode->i_sb))) {
4622 if (need <= max_free && 5116 if (need <= max_free &&
4623 count < ocfs2_xattr_max_xe_in_bucket(inode->i_sb)) { 5117 count < ocfs2_xattr_max_xe_in_bucket(inode->i_sb)) {
4624 /* 5118 /*
@@ -4626,7 +5120,8 @@ try_again:
4626 * name/value will be moved, the xe shouldn't be changed 5120 * name/value will be moved, the xe shouldn't be changed
4627 * in xs. 5121 * in xs.
4628 */ 5122 */
4629 ret = ocfs2_defrag_xattr_bucket(inode, &xs->bucket); 5123 ret = ocfs2_defrag_xattr_bucket(inode, ctxt->handle,
5124 xs->bucket);
4630 if (ret) { 5125 if (ret) {
4631 mlog_errno(ret); 5126 mlog_errno(ret);
4632 goto out; 5127 goto out;
@@ -4658,7 +5153,7 @@ try_again:
4658 * add a new bucket for the insert. 5153 * add a new bucket for the insert.
4659 */ 5154 */
4660 ret = ocfs2_check_xattr_bucket_collision(inode, 5155 ret = ocfs2_check_xattr_bucket_collision(inode,
4661 &xs->bucket, 5156 xs->bucket,
4662 xi->name); 5157 xi->name);
4663 if (ret) { 5158 if (ret) {
4664 mlog_errno(ret); 5159 mlog_errno(ret);
@@ -4667,17 +5162,21 @@ try_again:
4667 5162
4668 ret = ocfs2_add_new_xattr_bucket(inode, 5163 ret = ocfs2_add_new_xattr_bucket(inode,
4669 xs->xattr_bh, 5164 xs->xattr_bh,
4670 xs->bucket.bhs[0]); 5165 xs->bucket,
5166 ctxt);
4671 if (ret) { 5167 if (ret) {
4672 mlog_errno(ret); 5168 mlog_errno(ret);
4673 goto out; 5169 goto out;
4674 } 5170 }
4675 5171
4676 for (i = 0; i < blk_per_bucket; i++) 5172 /*
4677 brelse(xs->bucket.bhs[i]); 5173 * ocfs2_add_new_xattr_bucket() will have updated
4678 5174 * xs->bucket if it moved, but it will not have updated
4679 memset(&xs->bucket, 0, sizeof(xs->bucket)); 5175 * any of the other search fields. Thus, we drop it and
4680 5176 * re-search. Everything should be cached, so it'll be
5177 * quick.
5178 */
5179 ocfs2_xattr_bucket_relse(xs->bucket);
4681 ret = ocfs2_xattr_index_block_find(inode, xs->xattr_bh, 5180 ret = ocfs2_xattr_index_block_find(inode, xs->xattr_bh,
4682 xi->name_index, 5181 xi->name_index,
4683 xi->name, xs); 5182 xi->name, xs);
@@ -4689,7 +5188,7 @@ try_again:
4689 } 5188 }
4690 5189
4691xattr_set: 5190xattr_set:
4692 ret = ocfs2_xattr_set_in_bucket(inode, xi, xs); 5191 ret = ocfs2_xattr_set_in_bucket(inode, xi, xs, ctxt);
4693out: 5192out:
4694 mlog_exit(ret); 5193 mlog_exit(ret);
4695 return ret; 5194 return ret;
@@ -4700,24 +5199,41 @@ static int ocfs2_delete_xattr_in_bucket(struct inode *inode,
4700 void *para) 5199 void *para)
4701{ 5200{
4702 int ret = 0; 5201 int ret = 0;
4703 struct ocfs2_xattr_header *xh = bucket->xh; 5202 struct ocfs2_xattr_header *xh = bucket_xh(bucket);
4704 u16 i; 5203 u16 i;
4705 struct ocfs2_xattr_entry *xe; 5204 struct ocfs2_xattr_entry *xe;
5205 struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
5206 struct ocfs2_xattr_set_ctxt ctxt = {NULL, NULL,};
5207 int credits = ocfs2_remove_extent_credits(osb->sb) +
5208 ocfs2_blocks_per_xattr_bucket(inode->i_sb);
5209
5210
5211 ocfs2_init_dealloc_ctxt(&ctxt.dealloc);
4706 5212
4707 for (i = 0; i < le16_to_cpu(xh->xh_count); i++) { 5213 for (i = 0; i < le16_to_cpu(xh->xh_count); i++) {
4708 xe = &xh->xh_entries[i]; 5214 xe = &xh->xh_entries[i];
4709 if (ocfs2_xattr_is_local(xe)) 5215 if (ocfs2_xattr_is_local(xe))
4710 continue; 5216 continue;
4711 5217
4712 ret = ocfs2_xattr_bucket_value_truncate(inode, 5218 ctxt.handle = ocfs2_start_trans(osb, credits);
4713 bucket->bhs[0], 5219 if (IS_ERR(ctxt.handle)) {
4714 i, 0); 5220 ret = PTR_ERR(ctxt.handle);
5221 mlog_errno(ret);
5222 break;
5223 }
5224
5225 ret = ocfs2_xattr_bucket_value_truncate(inode, bucket,
5226 i, 0, &ctxt);
5227
5228 ocfs2_commit_trans(osb, ctxt.handle);
4715 if (ret) { 5229 if (ret) {
4716 mlog_errno(ret); 5230 mlog_errno(ret);
4717 break; 5231 break;
4718 } 5232 }
4719 } 5233 }
4720 5234
5235 ocfs2_schedule_truncate_log_flush(osb, 1);
5236 ocfs2_run_deallocs(osb, &ctxt.dealloc);
4721 return ret; 5237 return ret;
4722} 5238}
4723 5239
@@ -4768,6 +5284,74 @@ out:
4768} 5284}
4769 5285
4770/* 5286/*
5287 * 'security' attributes support
5288 */
5289static size_t ocfs2_xattr_security_list(struct inode *inode, char *list,
5290 size_t list_size, const char *name,
5291 size_t name_len)
5292{
5293 const size_t prefix_len = XATTR_SECURITY_PREFIX_LEN;
5294 const size_t total_len = prefix_len + name_len + 1;
5295
5296 if (list && total_len <= list_size) {
5297 memcpy(list, XATTR_SECURITY_PREFIX, prefix_len);
5298 memcpy(list + prefix_len, name, name_len);
5299 list[prefix_len + name_len] = '\0';
5300 }
5301 return total_len;
5302}
5303
5304static int ocfs2_xattr_security_get(struct inode *inode, const char *name,
5305 void *buffer, size_t size)
5306{
5307 if (strcmp(name, "") == 0)
5308 return -EINVAL;
5309 return ocfs2_xattr_get(inode, OCFS2_XATTR_INDEX_SECURITY, name,
5310 buffer, size);
5311}
5312
5313static int ocfs2_xattr_security_set(struct inode *inode, const char *name,
5314 const void *value, size_t size, int flags)
5315{
5316 if (strcmp(name, "") == 0)
5317 return -EINVAL;
5318
5319 return ocfs2_xattr_set(inode, OCFS2_XATTR_INDEX_SECURITY, name, value,
5320 size, flags);
5321}
5322
5323int ocfs2_init_security_get(struct inode *inode,
5324 struct inode *dir,
5325 struct ocfs2_security_xattr_info *si)
5326{
5327 /* check whether ocfs2 support feature xattr */
5328 if (!ocfs2_supports_xattr(OCFS2_SB(dir->i_sb)))
5329 return -EOPNOTSUPP;
5330 return security_inode_init_security(inode, dir, &si->name, &si->value,
5331 &si->value_len);
5332}
5333
5334int ocfs2_init_security_set(handle_t *handle,
5335 struct inode *inode,
5336 struct buffer_head *di_bh,
5337 struct ocfs2_security_xattr_info *si,
5338 struct ocfs2_alloc_context *xattr_ac,
5339 struct ocfs2_alloc_context *data_ac)
5340{
5341 return ocfs2_xattr_set_handle(handle, inode, di_bh,
5342 OCFS2_XATTR_INDEX_SECURITY,
5343 si->name, si->value, si->value_len, 0,
5344 xattr_ac, data_ac);
5345}
5346
5347struct xattr_handler ocfs2_xattr_security_handler = {
5348 .prefix = XATTR_SECURITY_PREFIX,
5349 .list = ocfs2_xattr_security_list,
5350 .get = ocfs2_xattr_security_get,
5351 .set = ocfs2_xattr_security_set,
5352};
5353
5354/*
4771 * 'trusted' attributes support 5355 * 'trusted' attributes support
4772 */ 5356 */
4773static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list, 5357static size_t ocfs2_xattr_trusted_list(struct inode *inode, char *list,
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h
index 1d8314c7656d..5a1ebc789f7e 100644
--- a/fs/ocfs2/xattr.h
+++ b/fs/ocfs2/xattr.h
@@ -30,13 +30,58 @@ enum ocfs2_xattr_type {
30 OCFS2_XATTR_MAX 30 OCFS2_XATTR_MAX
31}; 31};
32 32
33struct ocfs2_security_xattr_info {
34 int enable;
35 char *name;
36 void *value;
37 size_t value_len;
38};
39
33extern struct xattr_handler ocfs2_xattr_user_handler; 40extern struct xattr_handler ocfs2_xattr_user_handler;
34extern struct xattr_handler ocfs2_xattr_trusted_handler; 41extern struct xattr_handler ocfs2_xattr_trusted_handler;
42extern struct xattr_handler ocfs2_xattr_security_handler;
43#ifdef CONFIG_OCFS2_FS_POSIX_ACL
44extern struct xattr_handler ocfs2_xattr_acl_access_handler;
45extern struct xattr_handler ocfs2_xattr_acl_default_handler;
46#endif
35extern struct xattr_handler *ocfs2_xattr_handlers[]; 47extern struct xattr_handler *ocfs2_xattr_handlers[];
36 48
37ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); 49ssize_t ocfs2_listxattr(struct dentry *, char *, size_t);
50int ocfs2_xattr_get_nolock(struct inode *, struct buffer_head *, int,
51 const char *, void *, size_t);
38int ocfs2_xattr_set(struct inode *, int, const char *, const void *, 52int ocfs2_xattr_set(struct inode *, int, const char *, const void *,
39 size_t, int); 53 size_t, int);
54int ocfs2_xattr_set_handle(handle_t *, struct inode *, struct buffer_head *,
55 int, const char *, const void *, size_t, int,
56 struct ocfs2_alloc_context *,
57 struct ocfs2_alloc_context *);
40int ocfs2_xattr_remove(struct inode *, struct buffer_head *); 58int ocfs2_xattr_remove(struct inode *, struct buffer_head *);
59int ocfs2_init_security_get(struct inode *, struct inode *,
60 struct ocfs2_security_xattr_info *);
61int ocfs2_init_security_set(handle_t *, struct inode *,
62 struct buffer_head *,
63 struct ocfs2_security_xattr_info *,
64 struct ocfs2_alloc_context *,
65 struct ocfs2_alloc_context *);
66int ocfs2_calc_security_init(struct inode *,
67 struct ocfs2_security_xattr_info *,
68 int *, int *, struct ocfs2_alloc_context **);
69int ocfs2_calc_xattr_init(struct inode *, struct buffer_head *,
70 int, struct ocfs2_security_xattr_info *,
71 int *, int *, struct ocfs2_alloc_context **);
72
73/*
74 * xattrs can live inside an inode, as part of an external xattr block,
75 * or inside an xattr bucket, which is the leaf of a tree rooted in an
76 * xattr block. Some of the xattr calls, especially the value setting
77 * functions, want to treat each of these locations as equal. Let's wrap
78 * them in a structure that we can pass around instead of raw buffer_heads.
79 */
80struct ocfs2_xattr_value_buf {
81 struct buffer_head *vb_bh;
82 ocfs2_journal_access_func vb_access;
83 struct ocfs2_xattr_value_root *vb_xv;
84};
85
41 86
42#endif /* OCFS2_XATTR_H */ 87#endif /* OCFS2_XATTR_H */
diff --git a/fs/omfs/inode.c b/fs/omfs/inode.c
index 6afe57c84f84..633e9dc972bb 100644
--- a/fs/omfs/inode.c
+++ b/fs/omfs/inode.c
@@ -39,7 +39,6 @@ struct inode *omfs_new_inode(struct inode *dir, int mode)
39 inode->i_mode = mode; 39 inode->i_mode = mode;
40 inode->i_uid = current_fsuid(); 40 inode->i_uid = current_fsuid();
41 inode->i_gid = current_fsgid(); 41 inode->i_gid = current_fsgid();
42 inode->i_blocks = 0;
43 inode->i_mapping->a_ops = &omfs_aops; 42 inode->i_mapping->a_ops = &omfs_aops;
44 43
45 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 44 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
diff --git a/fs/open.c b/fs/open.c
index 1cd7d40e9991..d882fd2351d6 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -412,7 +412,7 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
412 if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0)) 412 if (((offset + len) > inode->i_sb->s_maxbytes) || ((offset + len) < 0))
413 goto out_fput; 413 goto out_fput;
414 414
415 if (inode->i_op && inode->i_op->fallocate) 415 if (inode->i_op->fallocate)
416 ret = inode->i_op->fallocate(inode, mode, offset, len); 416 ret = inode->i_op->fallocate(inode, mode, offset, len);
417 else 417 else
418 ret = -EOPNOTSUPP; 418 ret = -EOPNOTSUPP;
diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
index d41bdc784de4..ffcd04f0012c 100644
--- a/fs/openpromfs/inode.c
+++ b/fs/openpromfs/inode.c
@@ -256,9 +256,6 @@ found:
256 break; 256 break;
257 } 257 }
258 258
259 inode->i_gid = 0;
260 inode->i_uid = 0;
261
262 d_add(dentry, inode); 259 d_add(dentry, inode);
263 return NULL; 260 return NULL;
264} 261}
diff --git a/fs/proc/base.c b/fs/proc/base.c
index cad92c1ac2b3..10fd5223d600 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -1426,8 +1426,6 @@ static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_st
1426 if (!ei->pid) 1426 if (!ei->pid)
1427 goto out_unlock; 1427 goto out_unlock;
1428 1428
1429 inode->i_uid = 0;
1430 inode->i_gid = 0;
1431 if (task_dumpable(task)) { 1429 if (task_dumpable(task)) {
1432 rcu_read_lock(); 1430 rcu_read_lock();
1433 cred = __task_cred(task); 1431 cred = __task_cred(task);
@@ -2349,8 +2347,6 @@ static struct dentry *proc_base_instantiate(struct inode *dir,
2349 if (!ei->pid) 2347 if (!ei->pid)
2350 goto out_iput; 2348 goto out_iput;
2351 2349
2352 inode->i_uid = 0;
2353 inode->i_gid = 0;
2354 inode->i_mode = p->mode; 2350 inode->i_mode = p->mode;
2355 if (S_ISDIR(inode->i_mode)) 2351 if (S_ISDIR(inode->i_mode))
2356 inode->i_nlink = 2; 2352 inode->i_nlink = 2;
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 06ed10b7da9e..94fcfff6863a 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -31,7 +31,6 @@ static struct inode *proc_sys_make_inode(struct super_block *sb,
31 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; 31 inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
32 inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */ 32 inode->i_flags |= S_PRIVATE; /* tell selinux to ignore this inode */
33 inode->i_mode = table->mode; 33 inode->i_mode = table->mode;
34 inode->i_uid = inode->i_gid = 0;
35 if (!table->child) { 34 if (!table->child) {
36 inode->i_mode |= S_IFREG; 35 inode->i_mode |= S_IFREG;
37 inode->i_op = &proc_sys_inode_operations; 36 inode->i_op = &proc_sys_inode_operations;
diff --git a/fs/quota.c b/fs/quota.c
index b7fe44e01618..4a8c94f05f76 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -73,7 +73,7 @@ static int generic_quotactl_valid(struct super_block *sb, int type, int cmd, qid
73 case Q_SETQUOTA: 73 case Q_SETQUOTA:
74 case Q_GETQUOTA: 74 case Q_GETQUOTA:
75 /* This is just informative test so we are satisfied without a lock */ 75 /* This is just informative test so we are satisfied without a lock */
76 if (!sb_has_quota_enabled(sb, type)) 76 if (!sb_has_quota_active(sb, type))
77 return -ESRCH; 77 return -ESRCH;
78 } 78 }
79 79
@@ -160,6 +160,9 @@ static void quota_sync_sb(struct super_block *sb, int type)
160 int cnt; 160 int cnt;
161 161
162 sb->s_qcop->quota_sync(sb, type); 162 sb->s_qcop->quota_sync(sb, type);
163
164 if (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE)
165 return;
163 /* This is not very clever (and fast) but currently I don't know about 166 /* This is not very clever (and fast) but currently I don't know about
164 * any other simple way of getting quota data to disk and we must get 167 * any other simple way of getting quota data to disk and we must get
165 * them there for userspace to be visible... */ 168 * them there for userspace to be visible... */
@@ -175,7 +178,7 @@ static void quota_sync_sb(struct super_block *sb, int type)
175 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 178 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
176 if (type != -1 && cnt != type) 179 if (type != -1 && cnt != type)
177 continue; 180 continue;
178 if (!sb_has_quota_enabled(sb, cnt)) 181 if (!sb_has_quota_active(sb, cnt))
179 continue; 182 continue;
180 mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex, I_MUTEX_QUOTA); 183 mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex, I_MUTEX_QUOTA);
181 truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0); 184 truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0);
@@ -201,7 +204,7 @@ restart:
201 for (cnt = 0; cnt < MAXQUOTAS; cnt++) { 204 for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
202 if (type != -1 && type != cnt) 205 if (type != -1 && type != cnt)
203 continue; 206 continue;
204 if (!sb_has_quota_enabled(sb, cnt)) 207 if (!sb_has_quota_active(sb, cnt))
205 continue; 208 continue;
206 if (!info_dirty(&sb_dqopt(sb)->info[cnt]) && 209 if (!info_dirty(&sb_dqopt(sb)->info[cnt]) &&
207 list_empty(&sb_dqopt(sb)->info[cnt].dqi_dirty_list)) 210 list_empty(&sb_dqopt(sb)->info[cnt].dqi_dirty_list))
@@ -245,7 +248,7 @@ static int do_quotactl(struct super_block *sb, int type, int cmd, qid_t id, void
245 __u32 fmt; 248 __u32 fmt;
246 249
247 down_read(&sb_dqopt(sb)->dqptr_sem); 250 down_read(&sb_dqopt(sb)->dqptr_sem);
248 if (!sb_has_quota_enabled(sb, type)) { 251 if (!sb_has_quota_active(sb, type)) {
249 up_read(&sb_dqopt(sb)->dqptr_sem); 252 up_read(&sb_dqopt(sb)->dqptr_sem);
250 return -ESRCH; 253 return -ESRCH;
251 } 254 }
diff --git a/fs/quota_tree.c b/fs/quota_tree.c
new file mode 100644
index 000000000000..953404c95b17
--- /dev/null
+++ b/fs/quota_tree.c
@@ -0,0 +1,645 @@
1/*
2 * vfsv0 quota IO operations on file
3 */
4
5#include <linux/errno.h>
6#include <linux/fs.h>
7#include <linux/mount.h>
8#include <linux/dqblk_v2.h>
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/slab.h>
13#include <linux/quotaops.h>
14
15#include <asm/byteorder.h>
16
17#include "quota_tree.h"
18
19MODULE_AUTHOR("Jan Kara");
20MODULE_DESCRIPTION("Quota trie support");
21MODULE_LICENSE("GPL");
22
23#define __QUOTA_QT_PARANOIA
24
25typedef char *dqbuf_t;
26
27static int get_index(struct qtree_mem_dqinfo *info, qid_t id, int depth)
28{
29 unsigned int epb = info->dqi_usable_bs >> 2;
30
31 depth = info->dqi_qtree_depth - depth - 1;
32 while (depth--)
33 id /= epb;
34 return id % epb;
35}
36
37/* Number of entries in one blocks */
38static inline int qtree_dqstr_in_blk(struct qtree_mem_dqinfo *info)
39{
40 return (info->dqi_usable_bs - sizeof(struct qt_disk_dqdbheader))
41 / info->dqi_entry_size;
42}
43
44static dqbuf_t getdqbuf(size_t size)
45{
46 dqbuf_t buf = kmalloc(size, GFP_NOFS);
47 if (!buf)
48 printk(KERN_WARNING "VFS: Not enough memory for quota buffers.\n");
49 return buf;
50}
51
52static inline void freedqbuf(dqbuf_t buf)
53{
54 kfree(buf);
55}
56
57static inline ssize_t read_blk(struct qtree_mem_dqinfo *info, uint blk, dqbuf_t buf)
58{
59 struct super_block *sb = info->dqi_sb;
60
61 memset(buf, 0, info->dqi_usable_bs);
62 return sb->s_op->quota_read(sb, info->dqi_type, (char *)buf,
63 info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
64}
65
66static inline ssize_t write_blk(struct qtree_mem_dqinfo *info, uint blk, dqbuf_t buf)
67{
68 struct super_block *sb = info->dqi_sb;
69
70 return sb->s_op->quota_write(sb, info->dqi_type, (char *)buf,
71 info->dqi_usable_bs, blk << info->dqi_blocksize_bits);
72}
73
74/* Remove empty block from list and return it */
75static int get_free_dqblk(struct qtree_mem_dqinfo *info)
76{
77 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
78 struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
79 int ret, blk;
80
81 if (!buf)
82 return -ENOMEM;
83 if (info->dqi_free_blk) {
84 blk = info->dqi_free_blk;
85 ret = read_blk(info, blk, buf);
86 if (ret < 0)
87 goto out_buf;
88 info->dqi_free_blk = le32_to_cpu(dh->dqdh_next_free);
89 }
90 else {
91 memset(buf, 0, info->dqi_usable_bs);
92 /* Assure block allocation... */
93 ret = write_blk(info, info->dqi_blocks, buf);
94 if (ret < 0)
95 goto out_buf;
96 blk = info->dqi_blocks++;
97 }
98 mark_info_dirty(info->dqi_sb, info->dqi_type);
99 ret = blk;
100out_buf:
101 freedqbuf(buf);
102 return ret;
103}
104
105/* Insert empty block to the list */
106static int put_free_dqblk(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
107{
108 struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
109 int err;
110
111 dh->dqdh_next_free = cpu_to_le32(info->dqi_free_blk);
112 dh->dqdh_prev_free = cpu_to_le32(0);
113 dh->dqdh_entries = cpu_to_le16(0);
114 err = write_blk(info, blk, buf);
115 if (err < 0)
116 return err;
117 info->dqi_free_blk = blk;
118 mark_info_dirty(info->dqi_sb, info->dqi_type);
119 return 0;
120}
121
122/* Remove given block from the list of blocks with free entries */
123static int remove_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
124{
125 dqbuf_t tmpbuf = getdqbuf(info->dqi_usable_bs);
126 struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
127 uint nextblk = le32_to_cpu(dh->dqdh_next_free);
128 uint prevblk = le32_to_cpu(dh->dqdh_prev_free);
129 int err;
130
131 if (!tmpbuf)
132 return -ENOMEM;
133 if (nextblk) {
134 err = read_blk(info, nextblk, tmpbuf);
135 if (err < 0)
136 goto out_buf;
137 ((struct qt_disk_dqdbheader *)tmpbuf)->dqdh_prev_free =
138 dh->dqdh_prev_free;
139 err = write_blk(info, nextblk, tmpbuf);
140 if (err < 0)
141 goto out_buf;
142 }
143 if (prevblk) {
144 err = read_blk(info, prevblk, tmpbuf);
145 if (err < 0)
146 goto out_buf;
147 ((struct qt_disk_dqdbheader *)tmpbuf)->dqdh_next_free =
148 dh->dqdh_next_free;
149 err = write_blk(info, prevblk, tmpbuf);
150 if (err < 0)
151 goto out_buf;
152 } else {
153 info->dqi_free_entry = nextblk;
154 mark_info_dirty(info->dqi_sb, info->dqi_type);
155 }
156 freedqbuf(tmpbuf);
157 dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0);
158 /* No matter whether write succeeds block is out of list */
159 if (write_blk(info, blk, buf) < 0)
160 printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
161 return 0;
162out_buf:
163 freedqbuf(tmpbuf);
164 return err;
165}
166
167/* Insert given block to the beginning of list with free entries */
168static int insert_free_dqentry(struct qtree_mem_dqinfo *info, dqbuf_t buf, uint blk)
169{
170 dqbuf_t tmpbuf = getdqbuf(info->dqi_usable_bs);
171 struct qt_disk_dqdbheader *dh = (struct qt_disk_dqdbheader *)buf;
172 int err;
173
174 if (!tmpbuf)
175 return -ENOMEM;
176 dh->dqdh_next_free = cpu_to_le32(info->dqi_free_entry);
177 dh->dqdh_prev_free = cpu_to_le32(0);
178 err = write_blk(info, blk, buf);
179 if (err < 0)
180 goto out_buf;
181 if (info->dqi_free_entry) {
182 err = read_blk(info, info->dqi_free_entry, tmpbuf);
183 if (err < 0)
184 goto out_buf;
185 ((struct qt_disk_dqdbheader *)tmpbuf)->dqdh_prev_free =
186 cpu_to_le32(blk);
187 err = write_blk(info, info->dqi_free_entry, tmpbuf);
188 if (err < 0)
189 goto out_buf;
190 }
191 freedqbuf(tmpbuf);
192 info->dqi_free_entry = blk;
193 mark_info_dirty(info->dqi_sb, info->dqi_type);
194 return 0;
195out_buf:
196 freedqbuf(tmpbuf);
197 return err;
198}
199
200/* Is the entry in the block free? */
201int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk)
202{
203 int i;
204
205 for (i = 0; i < info->dqi_entry_size; i++)
206 if (disk[i])
207 return 0;
208 return 1;
209}
210EXPORT_SYMBOL(qtree_entry_unused);
211
212/* Find space for dquot */
213static uint find_free_dqentry(struct qtree_mem_dqinfo *info,
214 struct dquot *dquot, int *err)
215{
216 uint blk, i;
217 struct qt_disk_dqdbheader *dh;
218 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
219 char *ddquot;
220
221 *err = 0;
222 if (!buf) {
223 *err = -ENOMEM;
224 return 0;
225 }
226 dh = (struct qt_disk_dqdbheader *)buf;
227 if (info->dqi_free_entry) {
228 blk = info->dqi_free_entry;
229 *err = read_blk(info, blk, buf);
230 if (*err < 0)
231 goto out_buf;
232 } else {
233 blk = get_free_dqblk(info);
234 if ((int)blk < 0) {
235 *err = blk;
236 freedqbuf(buf);
237 return 0;
238 }
239 memset(buf, 0, info->dqi_usable_bs);
240 /* This is enough as block is already zeroed and entry list is empty... */
241 info->dqi_free_entry = blk;
242 mark_info_dirty(dquot->dq_sb, dquot->dq_type);
243 }
244 /* Block will be full? */
245 if (le16_to_cpu(dh->dqdh_entries) + 1 >= qtree_dqstr_in_blk(info)) {
246 *err = remove_free_dqentry(info, buf, blk);
247 if (*err < 0) {
248 printk(KERN_ERR "VFS: find_free_dqentry(): Can't "
249 "remove block (%u) from entry free list.\n",
250 blk);
251 goto out_buf;
252 }
253 }
254 le16_add_cpu(&dh->dqdh_entries, 1);
255 /* Find free structure in block */
256 for (i = 0, ddquot = ((char *)buf) + sizeof(struct qt_disk_dqdbheader);
257 i < qtree_dqstr_in_blk(info) && !qtree_entry_unused(info, ddquot);
258 i++, ddquot += info->dqi_entry_size);
259#ifdef __QUOTA_QT_PARANOIA
260 if (i == qtree_dqstr_in_blk(info)) {
261 printk(KERN_ERR "VFS: find_free_dqentry(): Data block full "
262 "but it shouldn't.\n");
263 *err = -EIO;
264 goto out_buf;
265 }
266#endif
267 *err = write_blk(info, blk, buf);
268 if (*err < 0) {
269 printk(KERN_ERR "VFS: find_free_dqentry(): Can't write quota "
270 "data block %u.\n", blk);
271 goto out_buf;
272 }
273 dquot->dq_off = (blk << info->dqi_blocksize_bits) +
274 sizeof(struct qt_disk_dqdbheader) +
275 i * info->dqi_entry_size;
276 freedqbuf(buf);
277 return blk;
278out_buf:
279 freedqbuf(buf);
280 return 0;
281}
282
283/* Insert reference to structure into the trie */
284static int do_insert_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
285 uint *treeblk, int depth)
286{
287 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
288 int ret = 0, newson = 0, newact = 0;
289 __le32 *ref;
290 uint newblk;
291
292 if (!buf)
293 return -ENOMEM;
294 if (!*treeblk) {
295 ret = get_free_dqblk(info);
296 if (ret < 0)
297 goto out_buf;
298 *treeblk = ret;
299 memset(buf, 0, info->dqi_usable_bs);
300 newact = 1;
301 } else {
302 ret = read_blk(info, *treeblk, buf);
303 if (ret < 0) {
304 printk(KERN_ERR "VFS: Can't read tree quota block "
305 "%u.\n", *treeblk);
306 goto out_buf;
307 }
308 }
309 ref = (__le32 *)buf;
310 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
311 if (!newblk)
312 newson = 1;
313 if (depth == info->dqi_qtree_depth - 1) {
314#ifdef __QUOTA_QT_PARANOIA
315 if (newblk) {
316 printk(KERN_ERR "VFS: Inserting already present quota "
317 "entry (block %u).\n",
318 le32_to_cpu(ref[get_index(info,
319 dquot->dq_id, depth)]));
320 ret = -EIO;
321 goto out_buf;
322 }
323#endif
324 newblk = find_free_dqentry(info, dquot, &ret);
325 } else {
326 ret = do_insert_tree(info, dquot, &newblk, depth+1);
327 }
328 if (newson && ret >= 0) {
329 ref[get_index(info, dquot->dq_id, depth)] =
330 cpu_to_le32(newblk);
331 ret = write_blk(info, *treeblk, buf);
332 } else if (newact && ret < 0) {
333 put_free_dqblk(info, buf, *treeblk);
334 }
335out_buf:
336 freedqbuf(buf);
337 return ret;
338}
339
340/* Wrapper for inserting quota structure into tree */
341static inline int dq_insert_tree(struct qtree_mem_dqinfo *info,
342 struct dquot *dquot)
343{
344 int tmp = QT_TREEOFF;
345 return do_insert_tree(info, dquot, &tmp, 0);
346}
347
348/*
349 * We don't have to be afraid of deadlocks as we never have quotas on quota files...
350 */
351int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
352{
353 int type = dquot->dq_type;
354 struct super_block *sb = dquot->dq_sb;
355 ssize_t ret;
356 dqbuf_t ddquot = getdqbuf(info->dqi_entry_size);
357
358 if (!ddquot)
359 return -ENOMEM;
360
361 /* dq_off is guarded by dqio_mutex */
362 if (!dquot->dq_off) {
363 ret = dq_insert_tree(info, dquot);
364 if (ret < 0) {
365 printk(KERN_ERR "VFS: Error %zd occurred while "
366 "creating quota.\n", ret);
367 freedqbuf(ddquot);
368 return ret;
369 }
370 }
371 spin_lock(&dq_data_lock);
372 info->dqi_ops->mem2disk_dqblk(ddquot, dquot);
373 spin_unlock(&dq_data_lock);
374 ret = sb->s_op->quota_write(sb, type, (char *)ddquot,
375 info->dqi_entry_size, dquot->dq_off);
376 if (ret != info->dqi_entry_size) {
377 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n",
378 sb->s_id);
379 if (ret >= 0)
380 ret = -ENOSPC;
381 } else {
382 ret = 0;
383 }
384 dqstats.writes++;
385 freedqbuf(ddquot);
386
387 return ret;
388}
389EXPORT_SYMBOL(qtree_write_dquot);
390
391/* Free dquot entry in data block */
392static int free_dqentry(struct qtree_mem_dqinfo *info, struct dquot *dquot,
393 uint blk)
394{
395 struct qt_disk_dqdbheader *dh;
396 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
397 int ret = 0;
398
399 if (!buf)
400 return -ENOMEM;
401 if (dquot->dq_off >> info->dqi_blocksize_bits != blk) {
402 printk(KERN_ERR "VFS: Quota structure has offset to other "
403 "block (%u) than it should (%u).\n", blk,
404 (uint)(dquot->dq_off >> info->dqi_blocksize_bits));
405 goto out_buf;
406 }
407 ret = read_blk(info, blk, buf);
408 if (ret < 0) {
409 printk(KERN_ERR "VFS: Can't read quota data block %u\n", blk);
410 goto out_buf;
411 }
412 dh = (struct qt_disk_dqdbheader *)buf;
413 le16_add_cpu(&dh->dqdh_entries, -1);
414 if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */
415 ret = remove_free_dqentry(info, buf, blk);
416 if (ret >= 0)
417 ret = put_free_dqblk(info, buf, blk);
418 if (ret < 0) {
419 printk(KERN_ERR "VFS: Can't move quota data block (%u) "
420 "to free list.\n", blk);
421 goto out_buf;
422 }
423 } else {
424 memset(buf +
425 (dquot->dq_off & ((1 << info->dqi_blocksize_bits) - 1)),
426 0, info->dqi_entry_size);
427 if (le16_to_cpu(dh->dqdh_entries) ==
428 qtree_dqstr_in_blk(info) - 1) {
429 /* Insert will write block itself */
430 ret = insert_free_dqentry(info, buf, blk);
431 if (ret < 0) {
432 printk(KERN_ERR "VFS: Can't insert quota data "
433 "block (%u) to free entry list.\n", blk);
434 goto out_buf;
435 }
436 } else {
437 ret = write_blk(info, blk, buf);
438 if (ret < 0) {
439 printk(KERN_ERR "VFS: Can't write quota data "
440 "block %u\n", blk);
441 goto out_buf;
442 }
443 }
444 }
445 dquot->dq_off = 0; /* Quota is now unattached */
446out_buf:
447 freedqbuf(buf);
448 return ret;
449}
450
451/* Remove reference to dquot from tree */
452static int remove_tree(struct qtree_mem_dqinfo *info, struct dquot *dquot,
453 uint *blk, int depth)
454{
455 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
456 int ret = 0;
457 uint newblk;
458 __le32 *ref = (__le32 *)buf;
459
460 if (!buf)
461 return -ENOMEM;
462 ret = read_blk(info, *blk, buf);
463 if (ret < 0) {
464 printk(KERN_ERR "VFS: Can't read quota data block %u\n", *blk);
465 goto out_buf;
466 }
467 newblk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
468 if (depth == info->dqi_qtree_depth - 1) {
469 ret = free_dqentry(info, dquot, newblk);
470 newblk = 0;
471 } else {
472 ret = remove_tree(info, dquot, &newblk, depth+1);
473 }
474 if (ret >= 0 && !newblk) {
475 int i;
476 ref[get_index(info, dquot->dq_id, depth)] = cpu_to_le32(0);
477 /* Block got empty? */
478 for (i = 0;
479 i < (info->dqi_usable_bs >> 2) && !ref[i];
480 i++);
481 /* Don't put the root block into the free block list */
482 if (i == (info->dqi_usable_bs >> 2)
483 && *blk != QT_TREEOFF) {
484 put_free_dqblk(info, buf, *blk);
485 *blk = 0;
486 } else {
487 ret = write_blk(info, *blk, buf);
488 if (ret < 0)
489 printk(KERN_ERR "VFS: Can't write quota tree "
490 "block %u.\n", *blk);
491 }
492 }
493out_buf:
494 freedqbuf(buf);
495 return ret;
496}
497
498/* Delete dquot from tree */
499int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
500{
501 uint tmp = QT_TREEOFF;
502
503 if (!dquot->dq_off) /* Even not allocated? */
504 return 0;
505 return remove_tree(info, dquot, &tmp, 0);
506}
507EXPORT_SYMBOL(qtree_delete_dquot);
508
509/* Find entry in block */
510static loff_t find_block_dqentry(struct qtree_mem_dqinfo *info,
511 struct dquot *dquot, uint blk)
512{
513 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
514 loff_t ret = 0;
515 int i;
516 char *ddquot;
517
518 if (!buf)
519 return -ENOMEM;
520 ret = read_blk(info, blk, buf);
521 if (ret < 0) {
522 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
523 goto out_buf;
524 }
525 for (i = 0, ddquot = ((char *)buf) + sizeof(struct qt_disk_dqdbheader);
526 i < qtree_dqstr_in_blk(info) && !info->dqi_ops->is_id(ddquot, dquot);
527 i++, ddquot += info->dqi_entry_size);
528 if (i == qtree_dqstr_in_blk(info)) {
529 printk(KERN_ERR "VFS: Quota for id %u referenced "
530 "but not present.\n", dquot->dq_id);
531 ret = -EIO;
532 goto out_buf;
533 } else {
534 ret = (blk << info->dqi_blocksize_bits) + sizeof(struct
535 qt_disk_dqdbheader) + i * info->dqi_entry_size;
536 }
537out_buf:
538 freedqbuf(buf);
539 return ret;
540}
541
542/* Find entry for given id in the tree */
543static loff_t find_tree_dqentry(struct qtree_mem_dqinfo *info,
544 struct dquot *dquot, uint blk, int depth)
545{
546 dqbuf_t buf = getdqbuf(info->dqi_usable_bs);
547 loff_t ret = 0;
548 __le32 *ref = (__le32 *)buf;
549
550 if (!buf)
551 return -ENOMEM;
552 ret = read_blk(info, blk, buf);
553 if (ret < 0) {
554 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
555 goto out_buf;
556 }
557 ret = 0;
558 blk = le32_to_cpu(ref[get_index(info, dquot->dq_id, depth)]);
559 if (!blk) /* No reference? */
560 goto out_buf;
561 if (depth < info->dqi_qtree_depth - 1)
562 ret = find_tree_dqentry(info, dquot, blk, depth+1);
563 else
564 ret = find_block_dqentry(info, dquot, blk);
565out_buf:
566 freedqbuf(buf);
567 return ret;
568}
569
570/* Find entry for given id in the tree - wrapper function */
571static inline loff_t find_dqentry(struct qtree_mem_dqinfo *info,
572 struct dquot *dquot)
573{
574 return find_tree_dqentry(info, dquot, QT_TREEOFF, 0);
575}
576
577int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
578{
579 int type = dquot->dq_type;
580 struct super_block *sb = dquot->dq_sb;
581 loff_t offset;
582 dqbuf_t ddquot;
583 int ret = 0;
584
585#ifdef __QUOTA_QT_PARANOIA
586 /* Invalidated quota? */
587 if (!sb_dqopt(dquot->dq_sb)->files[type]) {
588 printk(KERN_ERR "VFS: Quota invalidated while reading!\n");
589 return -EIO;
590 }
591#endif
592 /* Do we know offset of the dquot entry in the quota file? */
593 if (!dquot->dq_off) {
594 offset = find_dqentry(info, dquot);
595 if (offset <= 0) { /* Entry not present? */
596 if (offset < 0)
597 printk(KERN_ERR "VFS: Can't read quota "
598 "structure for id %u.\n", dquot->dq_id);
599 dquot->dq_off = 0;
600 set_bit(DQ_FAKE_B, &dquot->dq_flags);
601 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
602 ret = offset;
603 goto out;
604 }
605 dquot->dq_off = offset;
606 }
607 ddquot = getdqbuf(info->dqi_entry_size);
608 if (!ddquot)
609 return -ENOMEM;
610 ret = sb->s_op->quota_read(sb, type, (char *)ddquot,
611 info->dqi_entry_size, dquot->dq_off);
612 if (ret != info->dqi_entry_size) {
613 if (ret >= 0)
614 ret = -EIO;
615 printk(KERN_ERR "VFS: Error while reading quota "
616 "structure for id %u.\n", dquot->dq_id);
617 set_bit(DQ_FAKE_B, &dquot->dq_flags);
618 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
619 freedqbuf(ddquot);
620 goto out;
621 }
622 spin_lock(&dq_data_lock);
623 info->dqi_ops->disk2mem_dqblk(dquot, ddquot);
624 if (!dquot->dq_dqb.dqb_bhardlimit &&
625 !dquot->dq_dqb.dqb_bsoftlimit &&
626 !dquot->dq_dqb.dqb_ihardlimit &&
627 !dquot->dq_dqb.dqb_isoftlimit)
628 set_bit(DQ_FAKE_B, &dquot->dq_flags);
629 spin_unlock(&dq_data_lock);
630 freedqbuf(ddquot);
631out:
632 dqstats.reads++;
633 return ret;
634}
635EXPORT_SYMBOL(qtree_read_dquot);
636
637/* Check whether dquot should not be deleted. We know we are
638 * the only one operating on dquot (thanks to dq_lock) */
639int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot)
640{
641 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) && !(dquot->dq_dqb.dqb_curinodes | dquot->dq_dqb.dqb_curspace))
642 return qtree_delete_dquot(info, dquot);
643 return 0;
644}
645EXPORT_SYMBOL(qtree_release_dquot);
diff --git a/fs/quota_tree.h b/fs/quota_tree.h
new file mode 100644
index 000000000000..a1ab8db81a51
--- /dev/null
+++ b/fs/quota_tree.h
@@ -0,0 +1,25 @@
1/*
2 * Definitions of structures for vfsv0 quota format
3 */
4
5#ifndef _LINUX_QUOTA_TREE_H
6#define _LINUX_QUOTA_TREE_H
7
8#include <linux/types.h>
9#include <linux/quota.h>
10
11/*
12 * Structure of header of block with quota structures. It is padded to 16 bytes so
13 * there will be space for exactly 21 quota-entries in a block
14 */
15struct qt_disk_dqdbheader {
16 __le32 dqdh_next_free; /* Number of next block with free entry */
17 __le32 dqdh_prev_free; /* Number of previous block with free entry */
18 __le16 dqdh_entries; /* Number of valid entries in block */
19 __le16 dqdh_pad1;
20 __le32 dqdh_pad2;
21};
22
23#define QT_TREEOFF 1 /* Offset of tree in file in blocks */
24
25#endif /* _LINUX_QUOTAIO_TREE_H */
diff --git a/fs/quota_v1.c b/fs/quota_v1.c
index 5ae15b13eeb0..b4af1c69ad16 100644
--- a/fs/quota_v1.c
+++ b/fs/quota_v1.c
@@ -3,25 +3,39 @@
3#include <linux/quota.h> 3#include <linux/quota.h>
4#include <linux/quotaops.h> 4#include <linux/quotaops.h>
5#include <linux/dqblk_v1.h> 5#include <linux/dqblk_v1.h>
6#include <linux/quotaio_v1.h>
7#include <linux/kernel.h> 6#include <linux/kernel.h>
8#include <linux/init.h> 7#include <linux/init.h>
9#include <linux/module.h> 8#include <linux/module.h>
10 9
11#include <asm/byteorder.h> 10#include <asm/byteorder.h>
12 11
12#include "quotaio_v1.h"
13
13MODULE_AUTHOR("Jan Kara"); 14MODULE_AUTHOR("Jan Kara");
14MODULE_DESCRIPTION("Old quota format support"); 15MODULE_DESCRIPTION("Old quota format support");
15MODULE_LICENSE("GPL"); 16MODULE_LICENSE("GPL");
16 17
18#define QUOTABLOCK_BITS 10
19#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
20
21static inline qsize_t v1_stoqb(qsize_t space)
22{
23 return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS;
24}
25
26static inline qsize_t v1_qbtos(qsize_t blocks)
27{
28 return blocks << QUOTABLOCK_BITS;
29}
30
17static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d) 31static void v1_disk2mem_dqblk(struct mem_dqblk *m, struct v1_disk_dqblk *d)
18{ 32{
19 m->dqb_ihardlimit = d->dqb_ihardlimit; 33 m->dqb_ihardlimit = d->dqb_ihardlimit;
20 m->dqb_isoftlimit = d->dqb_isoftlimit; 34 m->dqb_isoftlimit = d->dqb_isoftlimit;
21 m->dqb_curinodes = d->dqb_curinodes; 35 m->dqb_curinodes = d->dqb_curinodes;
22 m->dqb_bhardlimit = d->dqb_bhardlimit; 36 m->dqb_bhardlimit = v1_qbtos(d->dqb_bhardlimit);
23 m->dqb_bsoftlimit = d->dqb_bsoftlimit; 37 m->dqb_bsoftlimit = v1_qbtos(d->dqb_bsoftlimit);
24 m->dqb_curspace = ((qsize_t)d->dqb_curblocks) << QUOTABLOCK_BITS; 38 m->dqb_curspace = v1_qbtos(d->dqb_curblocks);
25 m->dqb_itime = d->dqb_itime; 39 m->dqb_itime = d->dqb_itime;
26 m->dqb_btime = d->dqb_btime; 40 m->dqb_btime = d->dqb_btime;
27} 41}
@@ -31,9 +45,9 @@ static void v1_mem2disk_dqblk(struct v1_disk_dqblk *d, struct mem_dqblk *m)
31 d->dqb_ihardlimit = m->dqb_ihardlimit; 45 d->dqb_ihardlimit = m->dqb_ihardlimit;
32 d->dqb_isoftlimit = m->dqb_isoftlimit; 46 d->dqb_isoftlimit = m->dqb_isoftlimit;
33 d->dqb_curinodes = m->dqb_curinodes; 47 d->dqb_curinodes = m->dqb_curinodes;
34 d->dqb_bhardlimit = m->dqb_bhardlimit; 48 d->dqb_bhardlimit = v1_stoqb(m->dqb_bhardlimit);
35 d->dqb_bsoftlimit = m->dqb_bsoftlimit; 49 d->dqb_bsoftlimit = v1_stoqb(m->dqb_bsoftlimit);
36 d->dqb_curblocks = toqb(m->dqb_curspace); 50 d->dqb_curblocks = v1_stoqb(m->dqb_curspace);
37 d->dqb_itime = m->dqb_itime; 51 d->dqb_itime = m->dqb_itime;
38 d->dqb_btime = m->dqb_btime; 52 d->dqb_btime = m->dqb_btime;
39} 53}
diff --git a/fs/quota_v2.c b/fs/quota_v2.c
index b53827dc02d9..b618b563635c 100644
--- a/fs/quota_v2.c
+++ b/fs/quota_v2.c
@@ -6,7 +6,6 @@
6#include <linux/fs.h> 6#include <linux/fs.h>
7#include <linux/mount.h> 7#include <linux/mount.h>
8#include <linux/dqblk_v2.h> 8#include <linux/dqblk_v2.h>
9#include <linux/quotaio_v2.h>
10#include <linux/kernel.h> 9#include <linux/kernel.h>
11#include <linux/init.h> 10#include <linux/init.h>
12#include <linux/module.h> 11#include <linux/module.h>
@@ -15,16 +14,37 @@
15 14
16#include <asm/byteorder.h> 15#include <asm/byteorder.h>
17 16
17#include "quota_tree.h"
18#include "quotaio_v2.h"
19
18MODULE_AUTHOR("Jan Kara"); 20MODULE_AUTHOR("Jan Kara");
19MODULE_DESCRIPTION("Quota format v2 support"); 21MODULE_DESCRIPTION("Quota format v2 support");
20MODULE_LICENSE("GPL"); 22MODULE_LICENSE("GPL");
21 23
22#define __QUOTA_V2_PARANOIA 24#define __QUOTA_V2_PARANOIA
23 25
24typedef char *dqbuf_t; 26static void v2_mem2diskdqb(void *dp, struct dquot *dquot);
27static void v2_disk2memdqb(struct dquot *dquot, void *dp);
28static int v2_is_id(void *dp, struct dquot *dquot);
29
30static struct qtree_fmt_operations v2_qtree_ops = {
31 .mem2disk_dqblk = v2_mem2diskdqb,
32 .disk2mem_dqblk = v2_disk2memdqb,
33 .is_id = v2_is_id,
34};
35
36#define QUOTABLOCK_BITS 10
37#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
25 38
26#define GETIDINDEX(id, depth) (((id) >> ((V2_DQTREEDEPTH-(depth)-1)*8)) & 0xff) 39static inline qsize_t v2_stoqb(qsize_t space)
27#define GETENTRIES(buf) ((struct v2_disk_dqblk *)(((char *)buf)+sizeof(struct v2_disk_dqdbheader))) 40{
41 return (space + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS;
42}
43
44static inline qsize_t v2_qbtos(qsize_t blocks)
45{
46 return blocks << QUOTABLOCK_BITS;
47}
28 48
29/* Check whether given file is really vfsv0 quotafile */ 49/* Check whether given file is really vfsv0 quotafile */
30static int v2_check_quota_file(struct super_block *sb, int type) 50static int v2_check_quota_file(struct super_block *sb, int type)
@@ -50,7 +70,8 @@ static int v2_check_quota_file(struct super_block *sb, int type)
50static int v2_read_file_info(struct super_block *sb, int type) 70static int v2_read_file_info(struct super_block *sb, int type)
51{ 71{
52 struct v2_disk_dqinfo dinfo; 72 struct v2_disk_dqinfo dinfo;
53 struct mem_dqinfo *info = sb_dqopt(sb)->info+type; 73 struct mem_dqinfo *info = sb_dqinfo(sb, type);
74 struct qtree_mem_dqinfo *qinfo;
54 ssize_t size; 75 ssize_t size;
55 76
56 size = sb->s_op->quota_read(sb, type, (char *)&dinfo, 77 size = sb->s_op->quota_read(sb, type, (char *)&dinfo,
@@ -60,15 +81,29 @@ static int v2_read_file_info(struct super_block *sb, int type)
60 sb->s_id); 81 sb->s_id);
61 return -1; 82 return -1;
62 } 83 }
84 info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
85 if (!info->dqi_priv) {
86 printk(KERN_WARNING
87 "Not enough memory for quota information structure.\n");
88 return -1;
89 }
90 qinfo = info->dqi_priv;
63 /* limits are stored as unsigned 32-bit data */ 91 /* limits are stored as unsigned 32-bit data */
64 info->dqi_maxblimit = 0xffffffff; 92 info->dqi_maxblimit = 0xffffffff;
65 info->dqi_maxilimit = 0xffffffff; 93 info->dqi_maxilimit = 0xffffffff;
66 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace); 94 info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
67 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace); 95 info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
68 info->dqi_flags = le32_to_cpu(dinfo.dqi_flags); 96 info->dqi_flags = le32_to_cpu(dinfo.dqi_flags);
69 info->u.v2_i.dqi_blocks = le32_to_cpu(dinfo.dqi_blocks); 97 qinfo->dqi_sb = sb;
70 info->u.v2_i.dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk); 98 qinfo->dqi_type = type;
71 info->u.v2_i.dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry); 99 qinfo->dqi_blocks = le32_to_cpu(dinfo.dqi_blocks);
100 qinfo->dqi_free_blk = le32_to_cpu(dinfo.dqi_free_blk);
101 qinfo->dqi_free_entry = le32_to_cpu(dinfo.dqi_free_entry);
102 qinfo->dqi_blocksize_bits = V2_DQBLKSIZE_BITS;
103 qinfo->dqi_usable_bs = 1 << V2_DQBLKSIZE_BITS;
104 qinfo->dqi_qtree_depth = qtree_depth(qinfo);
105 qinfo->dqi_entry_size = sizeof(struct v2_disk_dqblk);
106 qinfo->dqi_ops = &v2_qtree_ops;
72 return 0; 107 return 0;
73} 108}
74 109
@@ -76,7 +111,8 @@ static int v2_read_file_info(struct super_block *sb, int type)
76static int v2_write_file_info(struct super_block *sb, int type) 111static int v2_write_file_info(struct super_block *sb, int type)
77{ 112{
78 struct v2_disk_dqinfo dinfo; 113 struct v2_disk_dqinfo dinfo;
79 struct mem_dqinfo *info = sb_dqopt(sb)->info+type; 114 struct mem_dqinfo *info = sb_dqinfo(sb, type);
115 struct qtree_mem_dqinfo *qinfo = info->dqi_priv;
80 ssize_t size; 116 ssize_t size;
81 117
82 spin_lock(&dq_data_lock); 118 spin_lock(&dq_data_lock);
@@ -85,9 +121,9 @@ static int v2_write_file_info(struct super_block *sb, int type)
85 dinfo.dqi_igrace = cpu_to_le32(info->dqi_igrace); 121 dinfo.dqi_igrace = cpu_to_le32(info->dqi_igrace);
86 dinfo.dqi_flags = cpu_to_le32(info->dqi_flags & DQF_MASK); 122 dinfo.dqi_flags = cpu_to_le32(info->dqi_flags & DQF_MASK);
87 spin_unlock(&dq_data_lock); 123 spin_unlock(&dq_data_lock);
88 dinfo.dqi_blocks = cpu_to_le32(info->u.v2_i.dqi_blocks); 124 dinfo.dqi_blocks = cpu_to_le32(qinfo->dqi_blocks);
89 dinfo.dqi_free_blk = cpu_to_le32(info->u.v2_i.dqi_free_blk); 125 dinfo.dqi_free_blk = cpu_to_le32(qinfo->dqi_free_blk);
90 dinfo.dqi_free_entry = cpu_to_le32(info->u.v2_i.dqi_free_entry); 126 dinfo.dqi_free_entry = cpu_to_le32(qinfo->dqi_free_entry);
91 size = sb->s_op->quota_write(sb, type, (char *)&dinfo, 127 size = sb->s_op->quota_write(sb, type, (char *)&dinfo,
92 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); 128 sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
93 if (size != sizeof(struct v2_disk_dqinfo)) { 129 if (size != sizeof(struct v2_disk_dqinfo)) {
@@ -98,574 +134,75 @@ static int v2_write_file_info(struct super_block *sb, int type)
98 return 0; 134 return 0;
99} 135}
100 136
101static void disk2memdqb(struct mem_dqblk *m, struct v2_disk_dqblk *d) 137static void v2_disk2memdqb(struct dquot *dquot, void *dp)
102{ 138{
139 struct v2_disk_dqblk *d = dp, empty;
140 struct mem_dqblk *m = &dquot->dq_dqb;
141
103 m->dqb_ihardlimit = le32_to_cpu(d->dqb_ihardlimit); 142 m->dqb_ihardlimit = le32_to_cpu(d->dqb_ihardlimit);
104 m->dqb_isoftlimit = le32_to_cpu(d->dqb_isoftlimit); 143 m->dqb_isoftlimit = le32_to_cpu(d->dqb_isoftlimit);
105 m->dqb_curinodes = le32_to_cpu(d->dqb_curinodes); 144 m->dqb_curinodes = le32_to_cpu(d->dqb_curinodes);
106 m->dqb_itime = le64_to_cpu(d->dqb_itime); 145 m->dqb_itime = le64_to_cpu(d->dqb_itime);
107 m->dqb_bhardlimit = le32_to_cpu(d->dqb_bhardlimit); 146 m->dqb_bhardlimit = v2_qbtos(le32_to_cpu(d->dqb_bhardlimit));
108 m->dqb_bsoftlimit = le32_to_cpu(d->dqb_bsoftlimit); 147 m->dqb_bsoftlimit = v2_qbtos(le32_to_cpu(d->dqb_bsoftlimit));
109 m->dqb_curspace = le64_to_cpu(d->dqb_curspace); 148 m->dqb_curspace = le64_to_cpu(d->dqb_curspace);
110 m->dqb_btime = le64_to_cpu(d->dqb_btime); 149 m->dqb_btime = le64_to_cpu(d->dqb_btime);
150 /* We need to escape back all-zero structure */
151 memset(&empty, 0, sizeof(struct v2_disk_dqblk));
152 empty.dqb_itime = cpu_to_le64(1);
153 if (!memcmp(&empty, dp, sizeof(struct v2_disk_dqblk)))
154 m->dqb_itime = 0;
111} 155}
112 156
113static void mem2diskdqb(struct v2_disk_dqblk *d, struct mem_dqblk *m, qid_t id) 157static void v2_mem2diskdqb(void *dp, struct dquot *dquot)
114{ 158{
159 struct v2_disk_dqblk *d = dp;
160 struct mem_dqblk *m = &dquot->dq_dqb;
161 struct qtree_mem_dqinfo *info =
162 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
163
115 d->dqb_ihardlimit = cpu_to_le32(m->dqb_ihardlimit); 164 d->dqb_ihardlimit = cpu_to_le32(m->dqb_ihardlimit);
116 d->dqb_isoftlimit = cpu_to_le32(m->dqb_isoftlimit); 165 d->dqb_isoftlimit = cpu_to_le32(m->dqb_isoftlimit);
117 d->dqb_curinodes = cpu_to_le32(m->dqb_curinodes); 166 d->dqb_curinodes = cpu_to_le32(m->dqb_curinodes);
118 d->dqb_itime = cpu_to_le64(m->dqb_itime); 167 d->dqb_itime = cpu_to_le64(m->dqb_itime);
119 d->dqb_bhardlimit = cpu_to_le32(m->dqb_bhardlimit); 168 d->dqb_bhardlimit = cpu_to_le32(v2_stoqb(m->dqb_bhardlimit));
120 d->dqb_bsoftlimit = cpu_to_le32(m->dqb_bsoftlimit); 169 d->dqb_bsoftlimit = cpu_to_le32(v2_stoqb(m->dqb_bsoftlimit));
121 d->dqb_curspace = cpu_to_le64(m->dqb_curspace); 170 d->dqb_curspace = cpu_to_le64(m->dqb_curspace);
122 d->dqb_btime = cpu_to_le64(m->dqb_btime); 171 d->dqb_btime = cpu_to_le64(m->dqb_btime);
123 d->dqb_id = cpu_to_le32(id); 172 d->dqb_id = cpu_to_le32(dquot->dq_id);
124} 173 if (qtree_entry_unused(info, dp))
125 174 d->dqb_itime = cpu_to_le64(1);
126static dqbuf_t getdqbuf(void)
127{
128 dqbuf_t buf = kmalloc(V2_DQBLKSIZE, GFP_NOFS);
129 if (!buf)
130 printk(KERN_WARNING "VFS: Not enough memory for quota buffers.\n");
131 return buf;
132}
133
134static inline void freedqbuf(dqbuf_t buf)
135{
136 kfree(buf);
137}
138
139static inline ssize_t read_blk(struct super_block *sb, int type, uint blk, dqbuf_t buf)
140{
141 memset(buf, 0, V2_DQBLKSIZE);
142 return sb->s_op->quota_read(sb, type, (char *)buf,
143 V2_DQBLKSIZE, blk << V2_DQBLKSIZE_BITS);
144}
145
146static inline ssize_t write_blk(struct super_block *sb, int type, uint blk, dqbuf_t buf)
147{
148 return sb->s_op->quota_write(sb, type, (char *)buf,
149 V2_DQBLKSIZE, blk << V2_DQBLKSIZE_BITS);
150}
151
152/* Remove empty block from list and return it */
153static int get_free_dqblk(struct super_block *sb, int type)
154{
155 dqbuf_t buf = getdqbuf();
156 struct mem_dqinfo *info = sb_dqinfo(sb, type);
157 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
158 int ret, blk;
159
160 if (!buf)
161 return -ENOMEM;
162 if (info->u.v2_i.dqi_free_blk) {
163 blk = info->u.v2_i.dqi_free_blk;
164 if ((ret = read_blk(sb, type, blk, buf)) < 0)
165 goto out_buf;
166 info->u.v2_i.dqi_free_blk = le32_to_cpu(dh->dqdh_next_free);
167 }
168 else {
169 memset(buf, 0, V2_DQBLKSIZE);
170 /* Assure block allocation... */
171 if ((ret = write_blk(sb, type, info->u.v2_i.dqi_blocks, buf)) < 0)
172 goto out_buf;
173 blk = info->u.v2_i.dqi_blocks++;
174 }
175 mark_info_dirty(sb, type);
176 ret = blk;
177out_buf:
178 freedqbuf(buf);
179 return ret;
180}
181
182/* Insert empty block to the list */
183static int put_free_dqblk(struct super_block *sb, int type, dqbuf_t buf, uint blk)
184{
185 struct mem_dqinfo *info = sb_dqinfo(sb, type);
186 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
187 int err;
188
189 dh->dqdh_next_free = cpu_to_le32(info->u.v2_i.dqi_free_blk);
190 dh->dqdh_prev_free = cpu_to_le32(0);
191 dh->dqdh_entries = cpu_to_le16(0);
192 info->u.v2_i.dqi_free_blk = blk;
193 mark_info_dirty(sb, type);
194 /* Some strange block. We had better leave it... */
195 if ((err = write_blk(sb, type, blk, buf)) < 0)
196 return err;
197 return 0;
198} 175}
199 176
200/* Remove given block from the list of blocks with free entries */ 177static int v2_is_id(void *dp, struct dquot *dquot)
201static int remove_free_dqentry(struct super_block *sb, int type, dqbuf_t buf, uint blk)
202{ 178{
203 dqbuf_t tmpbuf = getdqbuf(); 179 struct v2_disk_dqblk *d = dp;
204 struct mem_dqinfo *info = sb_dqinfo(sb, type); 180 struct qtree_mem_dqinfo *info =
205 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf; 181 sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv;
206 uint nextblk = le32_to_cpu(dh->dqdh_next_free), prevblk = le32_to_cpu(dh->dqdh_prev_free);
207 int err;
208 182
209 if (!tmpbuf) 183 if (qtree_entry_unused(info, dp))
210 return -ENOMEM;
211 if (nextblk) {
212 if ((err = read_blk(sb, type, nextblk, tmpbuf)) < 0)
213 goto out_buf;
214 ((struct v2_disk_dqdbheader *)tmpbuf)->dqdh_prev_free = dh->dqdh_prev_free;
215 if ((err = write_blk(sb, type, nextblk, tmpbuf)) < 0)
216 goto out_buf;
217 }
218 if (prevblk) {
219 if ((err = read_blk(sb, type, prevblk, tmpbuf)) < 0)
220 goto out_buf;
221 ((struct v2_disk_dqdbheader *)tmpbuf)->dqdh_next_free = dh->dqdh_next_free;
222 if ((err = write_blk(sb, type, prevblk, tmpbuf)) < 0)
223 goto out_buf;
224 }
225 else {
226 info->u.v2_i.dqi_free_entry = nextblk;
227 mark_info_dirty(sb, type);
228 }
229 freedqbuf(tmpbuf);
230 dh->dqdh_next_free = dh->dqdh_prev_free = cpu_to_le32(0);
231 /* No matter whether write succeeds block is out of list */
232 if (write_blk(sb, type, blk, buf) < 0)
233 printk(KERN_ERR "VFS: Can't write block (%u) with free entries.\n", blk);
234 return 0;
235out_buf:
236 freedqbuf(tmpbuf);
237 return err;
238}
239
240/* Insert given block to the beginning of list with free entries */
241static int insert_free_dqentry(struct super_block *sb, int type, dqbuf_t buf, uint blk)
242{
243 dqbuf_t tmpbuf = getdqbuf();
244 struct mem_dqinfo *info = sb_dqinfo(sb, type);
245 struct v2_disk_dqdbheader *dh = (struct v2_disk_dqdbheader *)buf;
246 int err;
247
248 if (!tmpbuf)
249 return -ENOMEM;
250 dh->dqdh_next_free = cpu_to_le32(info->u.v2_i.dqi_free_entry);
251 dh->dqdh_prev_free = cpu_to_le32(0);
252 if ((err = write_blk(sb, type, blk, buf)) < 0)
253 goto out_buf;
254 if (info->u.v2_i.dqi_free_entry) {
255 if ((err = read_blk(sb, type, info->u.v2_i.dqi_free_entry, tmpbuf)) < 0)
256 goto out_buf;
257 ((struct v2_disk_dqdbheader *)tmpbuf)->dqdh_prev_free = cpu_to_le32(blk);
258 if ((err = write_blk(sb, type, info->u.v2_i.dqi_free_entry, tmpbuf)) < 0)
259 goto out_buf;
260 }
261 freedqbuf(tmpbuf);
262 info->u.v2_i.dqi_free_entry = blk;
263 mark_info_dirty(sb, type);
264 return 0;
265out_buf:
266 freedqbuf(tmpbuf);
267 return err;
268}
269
270/* Find space for dquot */
271static uint find_free_dqentry(struct dquot *dquot, int *err)
272{
273 struct super_block *sb = dquot->dq_sb;
274 struct mem_dqinfo *info = sb_dqopt(sb)->info+dquot->dq_type;
275 uint blk, i;
276 struct v2_disk_dqdbheader *dh;
277 struct v2_disk_dqblk *ddquot;
278 struct v2_disk_dqblk fakedquot;
279 dqbuf_t buf;
280
281 *err = 0;
282 if (!(buf = getdqbuf())) {
283 *err = -ENOMEM;
284 return 0; 184 return 0;
285 } 185 return le32_to_cpu(d->dqb_id) == dquot->dq_id;
286 dh = (struct v2_disk_dqdbheader *)buf;
287 ddquot = GETENTRIES(buf);
288 if (info->u.v2_i.dqi_free_entry) {
289 blk = info->u.v2_i.dqi_free_entry;
290 if ((*err = read_blk(sb, dquot->dq_type, blk, buf)) < 0)
291 goto out_buf;
292 }
293 else {
294 blk = get_free_dqblk(sb, dquot->dq_type);
295 if ((int)blk < 0) {
296 *err = blk;
297 freedqbuf(buf);
298 return 0;
299 }
300 memset(buf, 0, V2_DQBLKSIZE);
301 /* This is enough as block is already zeroed and entry list is empty... */
302 info->u.v2_i.dqi_free_entry = blk;
303 mark_info_dirty(sb, dquot->dq_type);
304 }
305 if (le16_to_cpu(dh->dqdh_entries)+1 >= V2_DQSTRINBLK) /* Block will be full? */
306 if ((*err = remove_free_dqentry(sb, dquot->dq_type, buf, blk)) < 0) {
307 printk(KERN_ERR "VFS: find_free_dqentry(): Can't remove block (%u) from entry free list.\n", blk);
308 goto out_buf;
309 }
310 le16_add_cpu(&dh->dqdh_entries, 1);
311 memset(&fakedquot, 0, sizeof(struct v2_disk_dqblk));
312 /* Find free structure in block */
313 for (i = 0; i < V2_DQSTRINBLK && memcmp(&fakedquot, ddquot+i, sizeof(struct v2_disk_dqblk)); i++);
314#ifdef __QUOTA_V2_PARANOIA
315 if (i == V2_DQSTRINBLK) {
316 printk(KERN_ERR "VFS: find_free_dqentry(): Data block full but it shouldn't.\n");
317 *err = -EIO;
318 goto out_buf;
319 }
320#endif
321 if ((*err = write_blk(sb, dquot->dq_type, blk, buf)) < 0) {
322 printk(KERN_ERR "VFS: find_free_dqentry(): Can't write quota data block %u.\n", blk);
323 goto out_buf;
324 }
325 dquot->dq_off = (blk<<V2_DQBLKSIZE_BITS)+sizeof(struct v2_disk_dqdbheader)+i*sizeof(struct v2_disk_dqblk);
326 freedqbuf(buf);
327 return blk;
328out_buf:
329 freedqbuf(buf);
330 return 0;
331}
332
333/* Insert reference to structure into the trie */
334static int do_insert_tree(struct dquot *dquot, uint *treeblk, int depth)
335{
336 struct super_block *sb = dquot->dq_sb;
337 dqbuf_t buf;
338 int ret = 0, newson = 0, newact = 0;
339 __le32 *ref;
340 uint newblk;
341
342 if (!(buf = getdqbuf()))
343 return -ENOMEM;
344 if (!*treeblk) {
345 ret = get_free_dqblk(sb, dquot->dq_type);
346 if (ret < 0)
347 goto out_buf;
348 *treeblk = ret;
349 memset(buf, 0, V2_DQBLKSIZE);
350 newact = 1;
351 }
352 else {
353 if ((ret = read_blk(sb, dquot->dq_type, *treeblk, buf)) < 0) {
354 printk(KERN_ERR "VFS: Can't read tree quota block %u.\n", *treeblk);
355 goto out_buf;
356 }
357 }
358 ref = (__le32 *)buf;
359 newblk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
360 if (!newblk)
361 newson = 1;
362 if (depth == V2_DQTREEDEPTH-1) {
363#ifdef __QUOTA_V2_PARANOIA
364 if (newblk) {
365 printk(KERN_ERR "VFS: Inserting already present quota entry (block %u).\n", le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]));
366 ret = -EIO;
367 goto out_buf;
368 }
369#endif
370 newblk = find_free_dqentry(dquot, &ret);
371 }
372 else
373 ret = do_insert_tree(dquot, &newblk, depth+1);
374 if (newson && ret >= 0) {
375 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(newblk);
376 ret = write_blk(sb, dquot->dq_type, *treeblk, buf);
377 }
378 else if (newact && ret < 0)
379 put_free_dqblk(sb, dquot->dq_type, buf, *treeblk);
380out_buf:
381 freedqbuf(buf);
382 return ret;
383} 186}
384 187
385/* Wrapper for inserting quota structure into tree */ 188static int v2_read_dquot(struct dquot *dquot)
386static inline int dq_insert_tree(struct dquot *dquot)
387{ 189{
388 int tmp = V2_DQTREEOFF; 190 return qtree_read_dquot(sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv, dquot);
389 return do_insert_tree(dquot, &tmp, 0);
390} 191}
391 192
392/*
393 * We don't have to be afraid of deadlocks as we never have quotas on quota files...
394 */
395static int v2_write_dquot(struct dquot *dquot) 193static int v2_write_dquot(struct dquot *dquot)
396{ 194{
397 int type = dquot->dq_type; 195 return qtree_write_dquot(sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv, dquot);
398 ssize_t ret;
399 struct v2_disk_dqblk ddquot, empty;
400
401 /* dq_off is guarded by dqio_mutex */
402 if (!dquot->dq_off)
403 if ((ret = dq_insert_tree(dquot)) < 0) {
404 printk(KERN_ERR "VFS: Error %zd occurred while creating quota.\n", ret);
405 return ret;
406 }
407 spin_lock(&dq_data_lock);
408 mem2diskdqb(&ddquot, &dquot->dq_dqb, dquot->dq_id);
409 /* Argh... We may need to write structure full of zeroes but that would be
410 * treated as an empty place by the rest of the code. Format change would
411 * be definitely cleaner but the problems probably are not worth it */
412 memset(&empty, 0, sizeof(struct v2_disk_dqblk));
413 if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
414 ddquot.dqb_itime = cpu_to_le64(1);
415 spin_unlock(&dq_data_lock);
416 ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
417 (char *)&ddquot, sizeof(struct v2_disk_dqblk), dquot->dq_off);
418 if (ret != sizeof(struct v2_disk_dqblk)) {
419 printk(KERN_WARNING "VFS: dquota write failed on dev %s\n", dquot->dq_sb->s_id);
420 if (ret >= 0)
421 ret = -ENOSPC;
422 }
423 else
424 ret = 0;
425 dqstats.writes++;
426
427 return ret;
428} 196}
429 197
430/* Free dquot entry in data block */ 198static int v2_release_dquot(struct dquot *dquot)
431static int free_dqentry(struct dquot *dquot, uint blk)
432{
433 struct super_block *sb = dquot->dq_sb;
434 int type = dquot->dq_type;
435 struct v2_disk_dqdbheader *dh;
436 dqbuf_t buf = getdqbuf();
437 int ret = 0;
438
439 if (!buf)
440 return -ENOMEM;
441 if (dquot->dq_off >> V2_DQBLKSIZE_BITS != blk) {
442 printk(KERN_ERR "VFS: Quota structure has offset to other "
443 "block (%u) than it should (%u).\n", blk,
444 (uint)(dquot->dq_off >> V2_DQBLKSIZE_BITS));
445 goto out_buf;
446 }
447 if ((ret = read_blk(sb, type, blk, buf)) < 0) {
448 printk(KERN_ERR "VFS: Can't read quota data block %u\n", blk);
449 goto out_buf;
450 }
451 dh = (struct v2_disk_dqdbheader *)buf;
452 le16_add_cpu(&dh->dqdh_entries, -1);
453 if (!le16_to_cpu(dh->dqdh_entries)) { /* Block got free? */
454 if ((ret = remove_free_dqentry(sb, type, buf, blk)) < 0 ||
455 (ret = put_free_dqblk(sb, type, buf, blk)) < 0) {
456 printk(KERN_ERR "VFS: Can't move quota data block (%u) "
457 "to free list.\n", blk);
458 goto out_buf;
459 }
460 }
461 else {
462 memset(buf+(dquot->dq_off & ((1 << V2_DQBLKSIZE_BITS)-1)), 0,
463 sizeof(struct v2_disk_dqblk));
464 if (le16_to_cpu(dh->dqdh_entries) == V2_DQSTRINBLK-1) {
465 /* Insert will write block itself */
466 if ((ret = insert_free_dqentry(sb, type, buf, blk)) < 0) {
467 printk(KERN_ERR "VFS: Can't insert quota data block (%u) to free entry list.\n", blk);
468 goto out_buf;
469 }
470 }
471 else
472 if ((ret = write_blk(sb, type, blk, buf)) < 0) {
473 printk(KERN_ERR "VFS: Can't write quota data "
474 "block %u\n", blk);
475 goto out_buf;
476 }
477 }
478 dquot->dq_off = 0; /* Quota is now unattached */
479out_buf:
480 freedqbuf(buf);
481 return ret;
482}
483
484/* Remove reference to dquot from tree */
485static int remove_tree(struct dquot *dquot, uint *blk, int depth)
486{
487 struct super_block *sb = dquot->dq_sb;
488 int type = dquot->dq_type;
489 dqbuf_t buf = getdqbuf();
490 int ret = 0;
491 uint newblk;
492 __le32 *ref = (__le32 *)buf;
493
494 if (!buf)
495 return -ENOMEM;
496 if ((ret = read_blk(sb, type, *blk, buf)) < 0) {
497 printk(KERN_ERR "VFS: Can't read quota data block %u\n", *blk);
498 goto out_buf;
499 }
500 newblk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
501 if (depth == V2_DQTREEDEPTH-1) {
502 ret = free_dqentry(dquot, newblk);
503 newblk = 0;
504 }
505 else
506 ret = remove_tree(dquot, &newblk, depth+1);
507 if (ret >= 0 && !newblk) {
508 int i;
509 ref[GETIDINDEX(dquot->dq_id, depth)] = cpu_to_le32(0);
510 for (i = 0; i < V2_DQBLKSIZE && !buf[i]; i++); /* Block got empty? */
511 /* Don't put the root block into the free block list */
512 if (i == V2_DQBLKSIZE && *blk != V2_DQTREEOFF) {
513 put_free_dqblk(sb, type, buf, *blk);
514 *blk = 0;
515 }
516 else
517 if ((ret = write_blk(sb, type, *blk, buf)) < 0)
518 printk(KERN_ERR "VFS: Can't write quota tree "
519 "block %u.\n", *blk);
520 }
521out_buf:
522 freedqbuf(buf);
523 return ret;
524}
525
526/* Delete dquot from tree */
527static int v2_delete_dquot(struct dquot *dquot)
528{
529 uint tmp = V2_DQTREEOFF;
530
531 if (!dquot->dq_off) /* Even not allocated? */
532 return 0;
533 return remove_tree(dquot, &tmp, 0);
534}
535
536/* Find entry in block */
537static loff_t find_block_dqentry(struct dquot *dquot, uint blk)
538{
539 dqbuf_t buf = getdqbuf();
540 loff_t ret = 0;
541 int i;
542 struct v2_disk_dqblk *ddquot = GETENTRIES(buf);
543
544 if (!buf)
545 return -ENOMEM;
546 if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
547 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
548 goto out_buf;
549 }
550 if (dquot->dq_id)
551 for (i = 0; i < V2_DQSTRINBLK &&
552 le32_to_cpu(ddquot[i].dqb_id) != dquot->dq_id; i++);
553 else { /* ID 0 as a bit more complicated searching... */
554 struct v2_disk_dqblk fakedquot;
555
556 memset(&fakedquot, 0, sizeof(struct v2_disk_dqblk));
557 for (i = 0; i < V2_DQSTRINBLK; i++)
558 if (!le32_to_cpu(ddquot[i].dqb_id) &&
559 memcmp(&fakedquot, ddquot+i, sizeof(struct v2_disk_dqblk)))
560 break;
561 }
562 if (i == V2_DQSTRINBLK) {
563 printk(KERN_ERR "VFS: Quota for id %u referenced "
564 "but not present.\n", dquot->dq_id);
565 ret = -EIO;
566 goto out_buf;
567 }
568 else
569 ret = (blk << V2_DQBLKSIZE_BITS) + sizeof(struct
570 v2_disk_dqdbheader) + i * sizeof(struct v2_disk_dqblk);
571out_buf:
572 freedqbuf(buf);
573 return ret;
574}
575
576/* Find entry for given id in the tree */
577static loff_t find_tree_dqentry(struct dquot *dquot, uint blk, int depth)
578{
579 dqbuf_t buf = getdqbuf();
580 loff_t ret = 0;
581 __le32 *ref = (__le32 *)buf;
582
583 if (!buf)
584 return -ENOMEM;
585 if ((ret = read_blk(dquot->dq_sb, dquot->dq_type, blk, buf)) < 0) {
586 printk(KERN_ERR "VFS: Can't read quota tree block %u.\n", blk);
587 goto out_buf;
588 }
589 ret = 0;
590 blk = le32_to_cpu(ref[GETIDINDEX(dquot->dq_id, depth)]);
591 if (!blk) /* No reference? */
592 goto out_buf;
593 if (depth < V2_DQTREEDEPTH-1)
594 ret = find_tree_dqentry(dquot, blk, depth+1);
595 else
596 ret = find_block_dqentry(dquot, blk);
597out_buf:
598 freedqbuf(buf);
599 return ret;
600}
601
602/* Find entry for given id in the tree - wrapper function */
603static inline loff_t find_dqentry(struct dquot *dquot)
604{
605 return find_tree_dqentry(dquot, V2_DQTREEOFF, 0);
606}
607
608static int v2_read_dquot(struct dquot *dquot)
609{ 199{
610 int type = dquot->dq_type; 200 return qtree_release_dquot(sb_dqinfo(dquot->dq_sb, dquot->dq_type)->dqi_priv, dquot);
611 loff_t offset;
612 struct v2_disk_dqblk ddquot, empty;
613 int ret = 0;
614
615#ifdef __QUOTA_V2_PARANOIA
616 /* Invalidated quota? */
617 if (!dquot->dq_sb || !sb_dqopt(dquot->dq_sb)->files[type]) {
618 printk(KERN_ERR "VFS: Quota invalidated while reading!\n");
619 return -EIO;
620 }
621#endif
622 offset = find_dqentry(dquot);
623 if (offset <= 0) { /* Entry not present? */
624 if (offset < 0)
625 printk(KERN_ERR "VFS: Can't read quota "
626 "structure for id %u.\n", dquot->dq_id);
627 dquot->dq_off = 0;
628 set_bit(DQ_FAKE_B, &dquot->dq_flags);
629 memset(&dquot->dq_dqb, 0, sizeof(struct mem_dqblk));
630 ret = offset;
631 }
632 else {
633 dquot->dq_off = offset;
634 if ((ret = dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type,
635 (char *)&ddquot, sizeof(struct v2_disk_dqblk), offset))
636 != sizeof(struct v2_disk_dqblk)) {
637 if (ret >= 0)
638 ret = -EIO;
639 printk(KERN_ERR "VFS: Error while reading quota "
640 "structure for id %u.\n", dquot->dq_id);
641 memset(&ddquot, 0, sizeof(struct v2_disk_dqblk));
642 }
643 else {
644 ret = 0;
645 /* We need to escape back all-zero structure */
646 memset(&empty, 0, sizeof(struct v2_disk_dqblk));
647 empty.dqb_itime = cpu_to_le64(1);
648 if (!memcmp(&empty, &ddquot, sizeof(struct v2_disk_dqblk)))
649 ddquot.dqb_itime = 0;
650 }
651 disk2memdqb(&dquot->dq_dqb, &ddquot);
652 if (!dquot->dq_dqb.dqb_bhardlimit &&
653 !dquot->dq_dqb.dqb_bsoftlimit &&
654 !dquot->dq_dqb.dqb_ihardlimit &&
655 !dquot->dq_dqb.dqb_isoftlimit)
656 set_bit(DQ_FAKE_B, &dquot->dq_flags);
657 }
658 dqstats.reads++;
659
660 return ret;
661} 201}
662 202
663/* Check whether dquot should not be deleted. We know we are 203static int v2_free_file_info(struct super_block *sb, int type)
664 * the only one operating on dquot (thanks to dq_lock) */
665static int v2_release_dquot(struct dquot *dquot)
666{ 204{
667 if (test_bit(DQ_FAKE_B, &dquot->dq_flags) && !(dquot->dq_dqb.dqb_curinodes | dquot->dq_dqb.dqb_curspace)) 205 kfree(sb_dqinfo(sb, type)->dqi_priv);
668 return v2_delete_dquot(dquot);
669 return 0; 206 return 0;
670} 207}
671 208
@@ -673,7 +210,7 @@ static struct quota_format_ops v2_format_ops = {
673 .check_quota_file = v2_check_quota_file, 210 .check_quota_file = v2_check_quota_file,
674 .read_file_info = v2_read_file_info, 211 .read_file_info = v2_read_file_info,
675 .write_file_info = v2_write_file_info, 212 .write_file_info = v2_write_file_info,
676 .free_file_info = NULL, 213 .free_file_info = v2_free_file_info,
677 .read_dqblk = v2_read_dquot, 214 .read_dqblk = v2_read_dquot,
678 .commit_dqblk = v2_write_dquot, 215 .commit_dqblk = v2_write_dquot,
679 .release_dqblk = v2_release_dquot, 216 .release_dqblk = v2_release_dquot,
diff --git a/include/linux/quotaio_v1.h b/fs/quotaio_v1.h
index 746654b5de70..746654b5de70 100644
--- a/include/linux/quotaio_v1.h
+++ b/fs/quotaio_v1.h
diff --git a/include/linux/quotaio_v2.h b/fs/quotaio_v2.h
index 303d7cbe30d4..530fe580685c 100644
--- a/include/linux/quotaio_v2.h
+++ b/fs/quotaio_v2.h
@@ -21,6 +21,12 @@
21 0 /* GRPQUOTA */\ 21 0 /* GRPQUOTA */\
22} 22}
23 23
24/* First generic header */
25struct v2_disk_dqheader {
26 __le32 dqh_magic; /* Magic number identifying file */
27 __le32 dqh_version; /* File version */
28};
29
24/* 30/*
25 * The following structure defines the format of the disk quota file 31 * The following structure defines the format of the disk quota file
26 * (as it appears on disk) - the file is a radix tree whose leaves point 32 * (as it appears on disk) - the file is a radix tree whose leaves point
@@ -38,15 +44,6 @@ struct v2_disk_dqblk {
38 __le64 dqb_itime; /* time limit for excessive inode use */ 44 __le64 dqb_itime; /* time limit for excessive inode use */
39}; 45};
40 46
41/*
42 * Here are header structures as written on disk and their in-memory copies
43 */
44/* First generic header */
45struct v2_disk_dqheader {
46 __le32 dqh_magic; /* Magic number identifying file */
47 __le32 dqh_version; /* File version */
48};
49
50/* Header with type and version specific information */ 47/* Header with type and version specific information */
51struct v2_disk_dqinfo { 48struct v2_disk_dqinfo {
52 __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */ 49 __le32 dqi_bgrace; /* Time before block soft limit becomes hard limit */
@@ -57,23 +54,7 @@ struct v2_disk_dqinfo {
57 __le32 dqi_free_entry; /* Number of block with at least one free entry */ 54 __le32 dqi_free_entry; /* Number of block with at least one free entry */
58}; 55};
59 56
60/*
61 * Structure of header of block with quota structures. It is padded to 16 bytes so
62 * there will be space for exactly 21 quota-entries in a block
63 */
64struct v2_disk_dqdbheader {
65 __le32 dqdh_next_free; /* Number of next block with free entry */
66 __le32 dqdh_prev_free; /* Number of previous block with free entry */
67 __le16 dqdh_entries; /* Number of valid entries in block */
68 __le16 dqdh_pad1;
69 __le32 dqdh_pad2;
70};
71
72#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */ 57#define V2_DQINFOOFF sizeof(struct v2_disk_dqheader) /* Offset of info header in file */
73#define V2_DQBLKSIZE_BITS 10 58#define V2_DQBLKSIZE_BITS 10 /* Size of leaf block in tree */
74#define V2_DQBLKSIZE (1 << V2_DQBLKSIZE_BITS) /* Size of block with quota structures */
75#define V2_DQTREEOFF 1 /* Offset of tree in file in blocks */
76#define V2_DQTREEDEPTH 4 /* Depth of quota tree */
77#define V2_DQSTRINBLK ((V2_DQBLKSIZE - sizeof(struct v2_disk_dqdbheader)) / sizeof(struct v2_disk_dqblk)) /* Number of entries in one blocks */
78 59
79#endif /* _LINUX_QUOTAIO_V2_H */ 60#endif /* _LINUX_QUOTAIO_V2_H */
diff --git a/fs/ramfs/inode.c b/fs/ramfs/inode.c
index a83a3518ae33..b7e6ac706b87 100644
--- a/fs/ramfs/inode.c
+++ b/fs/ramfs/inode.c
@@ -57,7 +57,6 @@ struct inode *ramfs_get_inode(struct super_block *sb, int mode, dev_t dev)
57 inode->i_mode = mode; 57 inode->i_mode = mode;
58 inode->i_uid = current_fsuid(); 58 inode->i_uid = current_fsuid();
59 inode->i_gid = current_fsgid(); 59 inode->i_gid = current_fsgid();
60 inode->i_blocks = 0;
61 inode->i_mapping->a_ops = &ramfs_aops; 60 inode->i_mapping->a_ops = &ramfs_aops;
62 inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info; 61 inode->i_mapping->backing_dev_info = &ramfs_backing_dev_info;
63 mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER); 62 mapping_set_gfp_mask(inode->i_mapping, GFP_HIGHUSER);
diff --git a/fs/read_write.c b/fs/read_write.c
index 969a6d9c020b..5cc6924eb158 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -50,6 +50,14 @@ generic_file_llseek_unlocked(struct file *file, loff_t offset, int origin)
50 offset += inode->i_size; 50 offset += inode->i_size;
51 break; 51 break;
52 case SEEK_CUR: 52 case SEEK_CUR:
53 /*
54 * Here we special-case the lseek(fd, 0, SEEK_CUR)
55 * position-querying operation. Avoid rewriting the "same"
56 * f_pos value back to the file because a concurrent read(),
57 * write() or lseek() might have altered it
58 */
59 if (offset == 0)
60 return file->f_pos;
53 offset += file->f_pos; 61 offset += file->f_pos;
54 break; 62 break;
55 } 63 }
@@ -105,6 +113,10 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
105 offset += i_size_read(file->f_path.dentry->d_inode); 113 offset += i_size_read(file->f_path.dentry->d_inode);
106 break; 114 break;
107 case SEEK_CUR: 115 case SEEK_CUR:
116 if (offset == 0) {
117 retval = file->f_pos;
118 goto out;
119 }
108 offset += file->f_pos; 120 offset += file->f_pos;
109 } 121 }
110 retval = -EINVAL; 122 retval = -EINVAL;
@@ -115,6 +127,7 @@ loff_t default_llseek(struct file *file, loff_t offset, int origin)
115 } 127 }
116 retval = offset; 128 retval = offset;
117 } 129 }
130out:
118 unlock_kernel(); 131 unlock_kernel();
119 return retval; 132 return retval;
120} 133}
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index ed04f47007f8..55fce92cdf18 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1782,6 +1782,12 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1782 goto out_bad_inode; 1782 goto out_bad_inode;
1783 } 1783 }
1784 args.objectid = inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid); 1784 args.objectid = inode->i_ino = le32_to_cpu(ih.ih_key.k_objectid);
1785 if (old_format_only(sb))
1786 make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,
1787 TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
1788 else
1789 make_le_item_head(&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET,
1790 TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
1785 memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE); 1791 memcpy(INODE_PKEY(inode), &(ih.ih_key), KEY_SIZE);
1786 args.dirid = le32_to_cpu(ih.ih_key.k_dir_id); 1792 args.dirid = le32_to_cpu(ih.ih_key.k_dir_id);
1787 if (insert_inode_locked4(inode, args.objectid, 1793 if (insert_inode_locked4(inode, args.objectid,
@@ -1834,13 +1840,6 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1834 reiserfs_init_acl_default(inode); 1840 reiserfs_init_acl_default(inode);
1835 reiserfs_init_xattr_rwsem(inode); 1841 reiserfs_init_xattr_rwsem(inode);
1836 1842
1837 if (old_format_only(sb))
1838 make_le_item_head(&ih, NULL, KEY_FORMAT_3_5, SD_OFFSET,
1839 TYPE_STAT_DATA, SD_V1_SIZE, MAX_US_INT);
1840 else
1841 make_le_item_head(&ih, NULL, KEY_FORMAT_3_6, SD_OFFSET,
1842 TYPE_STAT_DATA, SD_SIZE, MAX_US_INT);
1843
1844 /* key to search for correct place for new stat data */ 1843 /* key to search for correct place for new stat data */
1845 _make_cpu_key(&key, KEY_FORMAT_3_6, le32_to_cpu(ih.ih_key.k_dir_id), 1844 _make_cpu_key(&key, KEY_FORMAT_3_6, le32_to_cpu(ih.ih_key.k_dir_id),
1846 le32_to_cpu(ih.ih_key.k_objectid), SD_OFFSET, 1845 le32_to_cpu(ih.ih_key.k_objectid), SD_OFFSET,
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 663a91f5dce8..c55651f1407c 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -649,6 +649,8 @@ static struct dquot_operations reiserfs_quota_operations = {
649 .release_dquot = reiserfs_release_dquot, 649 .release_dquot = reiserfs_release_dquot,
650 .mark_dirty = reiserfs_mark_dquot_dirty, 650 .mark_dirty = reiserfs_mark_dquot_dirty,
651 .write_info = reiserfs_write_info, 651 .write_info = reiserfs_write_info,
652 .alloc_dquot = dquot_alloc,
653 .destroy_dquot = dquot_destroy,
652}; 654};
653 655
654static struct quotactl_ops reiserfs_qctl_operations = { 656static struct quotactl_ops reiserfs_qctl_operations = {
@@ -994,8 +996,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
994 if (c == 'u' || c == 'g') { 996 if (c == 'u' || c == 'g') {
995 int qtype = c == 'u' ? USRQUOTA : GRPQUOTA; 997 int qtype = c == 'u' ? USRQUOTA : GRPQUOTA;
996 998
997 if ((sb_any_quota_enabled(s) || 999 if (sb_any_quota_loaded(s) &&
998 sb_any_quota_suspended(s)) &&
999 (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) { 1000 (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) {
1000 reiserfs_warning(s, 1001 reiserfs_warning(s,
1001 "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); 1002 "reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
@@ -1041,8 +1042,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1041 "reiserfs_parse_options: unknown quota format specified."); 1042 "reiserfs_parse_options: unknown quota format specified.");
1042 return 0; 1043 return 0;
1043 } 1044 }
1044 if ((sb_any_quota_enabled(s) || 1045 if (sb_any_quota_loaded(s) &&
1045 sb_any_quota_suspended(s)) &&
1046 *qfmt != REISERFS_SB(s)->s_jquota_fmt) { 1046 *qfmt != REISERFS_SB(s)->s_jquota_fmt) {
1047 reiserfs_warning(s, 1047 reiserfs_warning(s,
1048 "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); 1048 "reiserfs_parse_options: cannot change journaled quota options when quota turned on.");
@@ -1067,7 +1067,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin
1067 } 1067 }
1068 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ 1068 /* This checking is not precise wrt the quota type but for our purposes it is sufficient */
1069 if (!(*mount_options & (1 << REISERFS_QUOTA)) 1069 if (!(*mount_options & (1 << REISERFS_QUOTA))
1070 && sb_any_quota_enabled(s)) { 1070 && sb_any_quota_loaded(s)) {
1071 reiserfs_warning(s, 1071 reiserfs_warning(s,
1072 "reiserfs_parse_options: quota options must be present when quota is turned on."); 1072 "reiserfs_parse_options: quota options must be present when quota is turned on.");
1073 return 0; 1073 return 0;
diff --git a/fs/romfs/inode.c b/fs/romfs/inode.c
index 60d2f822e87b..c97d4c931715 100644
--- a/fs/romfs/inode.c
+++ b/fs/romfs/inode.c
@@ -524,7 +524,6 @@ romfs_iget(struct super_block *sb, unsigned long ino)
524 i->i_size = be32_to_cpu(ri.size); 524 i->i_size = be32_to_cpu(ri.size);
525 i->i_mtime.tv_sec = i->i_atime.tv_sec = i->i_ctime.tv_sec = 0; 525 i->i_mtime.tv_sec = i->i_atime.tv_sec = i->i_ctime.tv_sec = 0;
526 i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0; 526 i->i_mtime.tv_nsec = i->i_atime.tv_nsec = i->i_ctime.tv_nsec = 0;
527 i->i_uid = i->i_gid = 0;
528 527
529 /* Precalculate the data offset */ 528 /* Precalculate the data offset */
530 ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN); 529 ino = romfs_strnlen(i, ino+ROMFH_SIZE, ROMFS_MAXFN);
diff --git a/fs/stat.c b/fs/stat.c
index 7c46fbeb8b76..7e12a6f82795 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -305,7 +305,7 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
305 struct inode *inode = path.dentry->d_inode; 305 struct inode *inode = path.dentry->d_inode;
306 306
307 error = -EINVAL; 307 error = -EINVAL;
308 if (inode->i_op && inode->i_op->readlink) { 308 if (inode->i_op->readlink) {
309 error = security_inode_readlink(path.dentry); 309 error = security_inode_readlink(path.dentry);
310 if (!error) { 310 if (!error) {
311 touch_atime(path.mnt, path.dentry); 311 touch_atime(path.mnt, path.dentry);
diff --git a/fs/sync.c b/fs/sync.c
index 2967562d416f..0921d6d4b5e6 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -75,14 +75,39 @@ int file_fsync(struct file *filp, struct dentry *dentry, int datasync)
75 return ret; 75 return ret;
76} 76}
77 77
78long do_fsync(struct file *file, int datasync) 78/**
79 * vfs_fsync - perform a fsync or fdatasync on a file
80 * @file: file to sync
81 * @dentry: dentry of @file
82 * @data: only perform a fdatasync operation
83 *
84 * Write back data and metadata for @file to disk. If @datasync is
85 * set only metadata needed to access modified file data is written.
86 *
87 * In case this function is called from nfsd @file may be %NULL and
88 * only @dentry is set. This can only happen when the filesystem
89 * implements the export_operations API.
90 */
91int vfs_fsync(struct file *file, struct dentry *dentry, int datasync)
79{ 92{
80 int ret; 93 const struct file_operations *fop;
81 int err; 94 struct address_space *mapping;
82 struct address_space *mapping = file->f_mapping; 95 int err, ret;
96
97 /*
98 * Get mapping and operations from the file in case we have
99 * as file, or get the default values for them in case we
100 * don't have a struct file available. Damn nfsd..
101 */
102 if (file) {
103 mapping = file->f_mapping;
104 fop = file->f_op;
105 } else {
106 mapping = dentry->d_inode->i_mapping;
107 fop = dentry->d_inode->i_fop;
108 }
83 109
84 if (!file->f_op || !file->f_op->fsync) { 110 if (!fop || !fop->fsync) {
85 /* Why? We can still call filemap_fdatawrite */
86 ret = -EINVAL; 111 ret = -EINVAL;
87 goto out; 112 goto out;
88 } 113 }
@@ -94,7 +119,7 @@ long do_fsync(struct file *file, int datasync)
94 * livelocks in fsync_buffers_list(). 119 * livelocks in fsync_buffers_list().
95 */ 120 */
96 mutex_lock(&mapping->host->i_mutex); 121 mutex_lock(&mapping->host->i_mutex);
97 err = file->f_op->fsync(file, file->f_path.dentry, datasync); 122 err = fop->fsync(file, dentry, datasync);
98 if (!ret) 123 if (!ret)
99 ret = err; 124 ret = err;
100 mutex_unlock(&mapping->host->i_mutex); 125 mutex_unlock(&mapping->host->i_mutex);
@@ -104,15 +129,16 @@ long do_fsync(struct file *file, int datasync)
104out: 129out:
105 return ret; 130 return ret;
106} 131}
132EXPORT_SYMBOL(vfs_fsync);
107 133
108static long __do_fsync(unsigned int fd, int datasync) 134static int do_fsync(unsigned int fd, int datasync)
109{ 135{
110 struct file *file; 136 struct file *file;
111 int ret = -EBADF; 137 int ret = -EBADF;
112 138
113 file = fget(fd); 139 file = fget(fd);
114 if (file) { 140 if (file) {
115 ret = do_fsync(file, datasync); 141 ret = vfs_fsync(file, file->f_path.dentry, datasync);
116 fput(file); 142 fput(file);
117 } 143 }
118 return ret; 144 return ret;
@@ -120,12 +146,12 @@ static long __do_fsync(unsigned int fd, int datasync)
120 146
121asmlinkage long sys_fsync(unsigned int fd) 147asmlinkage long sys_fsync(unsigned int fd)
122{ 148{
123 return __do_fsync(fd, 0); 149 return do_fsync(fd, 0);
124} 150}
125 151
126asmlinkage long sys_fdatasync(unsigned int fd) 152asmlinkage long sys_fdatasync(unsigned int fd)
127{ 153{
128 return __do_fsync(fd, 1); 154 return do_fsync(fd, 1);
129} 155}
130 156
131/* 157/*
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index eb53c632f856..dfa3d94cfc74 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -107,8 +107,6 @@ int sysfs_setattr(struct dentry * dentry, struct iattr * iattr)
107static inline void set_default_inode_attr(struct inode * inode, mode_t mode) 107static inline void set_default_inode_attr(struct inode * inode, mode_t mode)
108{ 108{
109 inode->i_mode = mode; 109 inode->i_mode = mode;
110 inode->i_uid = 0;
111 inode->i_gid = 0;
112 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 110 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
113} 111}
114 112
@@ -149,7 +147,6 @@ static void sysfs_init_inode(struct sysfs_dirent *sd, struct inode *inode)
149{ 147{
150 struct bin_attribute *bin_attr; 148 struct bin_attribute *bin_attr;
151 149
152 inode->i_blocks = 0;
153 inode->i_mapping->a_ops = &sysfs_aops; 150 inode->i_mapping->a_ops = &sysfs_aops;
154 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info; 151 inode->i_mapping->backing_dev_info = &sysfs_backing_dev_info;
155 inode->i_op = &sysfs_inode_operations; 152 inode->i_op = &sysfs_inode_operations;
diff --git a/fs/xattr.c b/fs/xattr.c
index 468377e66531..237804cd6b56 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -175,7 +175,7 @@ vfs_listxattr(struct dentry *d, char *list, size_t size)
175 if (error) 175 if (error)
176 return error; 176 return error;
177 error = -EOPNOTSUPP; 177 error = -EOPNOTSUPP;
178 if (d->d_inode->i_op && d->d_inode->i_op->listxattr) { 178 if (d->d_inode->i_op->listxattr) {
179 error = d->d_inode->i_op->listxattr(d, list, size); 179 error = d->d_inode->i_op->listxattr(d, list, size);
180 } else { 180 } else {
181 error = security_inode_listsecurity(d->d_inode, list, size); 181 error = security_inode_listsecurity(d->d_inode, list, size);
diff --git a/include/linux/Kbuild b/include/linux/Kbuild
index 95ac82340c3b..39da666067b9 100644
--- a/include/linux/Kbuild
+++ b/include/linux/Kbuild
@@ -56,8 +56,6 @@ header-y += dlm_device.h
56header-y += dlm_netlink.h 56header-y += dlm_netlink.h
57header-y += dm-ioctl.h 57header-y += dm-ioctl.h
58header-y += dn.h 58header-y += dn.h
59header-y += dqblk_v1.h
60header-y += dqblk_v2.h
61header-y += dqblk_xfs.h 59header-y += dqblk_xfs.h
62header-y += efs_fs_sb.h 60header-y += efs_fs_sb.h
63header-y += elf-fdpic.h 61header-y += elf-fdpic.h
@@ -134,8 +132,6 @@ header-y += posix_types.h
134header-y += ppdev.h 132header-y += ppdev.h
135header-y += prctl.h 133header-y += prctl.h
136header-y += qnxtypes.h 134header-y += qnxtypes.h
137header-y += quotaio_v1.h
138header-y += quotaio_v2.h
139header-y += radeonfb.h 135header-y += radeonfb.h
140header-y += raw.h 136header-y += raw.h
141header-y += resource.h 137header-y += resource.h
diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h
index 1ee608fd7b77..484b3abf61bb 100644
--- a/include/linux/cpufreq.h
+++ b/include/linux/cpufreq.h
@@ -234,6 +234,7 @@ struct cpufreq_driver {
234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg); 234 int (*suspend) (struct cpufreq_policy *policy, pm_message_t pmsg);
235 int (*resume) (struct cpufreq_policy *policy); 235 int (*resume) (struct cpufreq_policy *policy);
236 struct freq_attr **attr; 236 struct freq_attr **attr;
237 bool hide_interface;
237}; 238};
238 239
239/* flags */ 240/* flags */
diff --git a/include/linux/dma_remapping.h b/include/linux/dma_remapping.h
index 136f170cecc2..af1dab41674b 100644
--- a/include/linux/dma_remapping.h
+++ b/include/linux/dma_remapping.h
@@ -17,7 +17,15 @@ struct dmar_domain;
17struct root_entry; 17struct root_entry;
18 18
19extern void free_dmar_iommu(struct intel_iommu *iommu); 19extern void free_dmar_iommu(struct intel_iommu *iommu);
20
21#ifdef CONFIG_DMAR
20extern int iommu_calculate_agaw(struct intel_iommu *iommu); 22extern int iommu_calculate_agaw(struct intel_iommu *iommu);
23#else
24static inline int iommu_calculate_agaw(struct intel_iommu *iommu)
25{
26 return 0;
27}
28#endif
21 29
22extern int dmar_disabled; 30extern int dmar_disabled;
23 31
diff --git a/include/linux/dqblk_qtree.h b/include/linux/dqblk_qtree.h
new file mode 100644
index 000000000000..82a16527b367
--- /dev/null
+++ b/include/linux/dqblk_qtree.h
@@ -0,0 +1,56 @@
1/*
2 * Definitions of structures and functions for quota formats using trie
3 */
4
5#ifndef _LINUX_DQBLK_QTREE_H
6#define _LINUX_DQBLK_QTREE_H
7
8#include <linux/types.h>
9
10/* Numbers of blocks needed for updates - we count with the smallest
11 * possible block size (1024) */
12#define QTREE_INIT_ALLOC 4
13#define QTREE_INIT_REWRITE 2
14#define QTREE_DEL_ALLOC 0
15#define QTREE_DEL_REWRITE 6
16
17struct dquot;
18
19/* Operations */
20struct qtree_fmt_operations {
21 void (*mem2disk_dqblk)(void *disk, struct dquot *dquot); /* Convert given entry from in memory format to disk one */
22 void (*disk2mem_dqblk)(struct dquot *dquot, void *disk); /* Convert given entry from disk format to in memory one */
23 int (*is_id)(void *disk, struct dquot *dquot); /* Is this structure for given id? */
24};
25
26/* Inmemory copy of version specific information */
27struct qtree_mem_dqinfo {
28 struct super_block *dqi_sb; /* Sb quota is on */
29 int dqi_type; /* Quota type */
30 unsigned int dqi_blocks; /* # of blocks in quota file */
31 unsigned int dqi_free_blk; /* First block in list of free blocks */
32 unsigned int dqi_free_entry; /* First block with free entry */
33 unsigned int dqi_blocksize_bits; /* Block size of quota file */
34 unsigned int dqi_entry_size; /* Size of quota entry in quota file */
35 unsigned int dqi_usable_bs; /* Space usable in block for quota data */
36 unsigned int dqi_qtree_depth; /* Precomputed depth of quota tree */
37 struct qtree_fmt_operations *dqi_ops; /* Operations for entry manipulation */
38};
39
40int qtree_write_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
41int qtree_read_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
42int qtree_delete_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
43int qtree_release_dquot(struct qtree_mem_dqinfo *info, struct dquot *dquot);
44int qtree_entry_unused(struct qtree_mem_dqinfo *info, char *disk);
45static inline int qtree_depth(struct qtree_mem_dqinfo *info)
46{
47 unsigned int epb = info->dqi_usable_bs >> 2;
48 unsigned long long entries = epb;
49 int i;
50
51 for (i = 1; entries < (1ULL << 32); i++)
52 entries *= epb;
53 return i;
54}
55
56#endif /* _LINUX_DQBLK_QTREE_H */
diff --git a/include/linux/dqblk_v1.h b/include/linux/dqblk_v1.h
index 57f1250d5a52..3713a7232dd8 100644
--- a/include/linux/dqblk_v1.h
+++ b/include/linux/dqblk_v1.h
@@ -5,9 +5,6 @@
5#ifndef _LINUX_DQBLK_V1_H 5#ifndef _LINUX_DQBLK_V1_H
6#define _LINUX_DQBLK_V1_H 6#define _LINUX_DQBLK_V1_H
7 7
8/* Id of quota format */
9#define QFMT_VFS_OLD 1
10
11/* Root squash turned on */ 8/* Root squash turned on */
12#define V1_DQF_RSQUASH 1 9#define V1_DQF_RSQUASH 1
13 10
@@ -17,8 +14,4 @@
17#define V1_DEL_ALLOC 0 14#define V1_DEL_ALLOC 0
18#define V1_DEL_REWRITE 2 15#define V1_DEL_REWRITE 2
19 16
20/* Special information about quotafile */
21struct v1_mem_dqinfo {
22};
23
24#endif /* _LINUX_DQBLK_V1_H */ 17#endif /* _LINUX_DQBLK_V1_H */
diff --git a/include/linux/dqblk_v2.h b/include/linux/dqblk_v2.h
index 4f853322cb7f..18000a542677 100644
--- a/include/linux/dqblk_v2.h
+++ b/include/linux/dqblk_v2.h
@@ -1,26 +1,16 @@
1/* 1/*
2 * Definitions of structures for vfsv0 quota format 2 * Definitions for vfsv0 quota format
3 */ 3 */
4 4
5#ifndef _LINUX_DQBLK_V2_H 5#ifndef _LINUX_DQBLK_V2_H
6#define _LINUX_DQBLK_V2_H 6#define _LINUX_DQBLK_V2_H
7 7
8#include <linux/types.h> 8#include <linux/dqblk_qtree.h>
9
10/* id numbers of quota format */
11#define QFMT_VFS_V0 2
12 9
13/* Numbers of blocks needed for updates */ 10/* Numbers of blocks needed for updates */
14#define V2_INIT_ALLOC 4 11#define V2_INIT_ALLOC QTREE_INIT_ALLOC
15#define V2_INIT_REWRITE 2 12#define V2_INIT_REWRITE QTREE_INIT_REWRITE
16#define V2_DEL_ALLOC 0 13#define V2_DEL_ALLOC QTREE_DEL_ALLOC
17#define V2_DEL_REWRITE 6 14#define V2_DEL_REWRITE QTREE_DEL_REWRITE
18
19/* Inmemory copy of version specific information */
20struct v2_mem_dqinfo {
21 unsigned int dqi_blocks;
22 unsigned int dqi_free_blk;
23 unsigned int dqi_free_entry;
24};
25 15
26#endif /* _LINUX_DQBLK_V2_H */ 16#endif /* _LINUX_DQBLK_V2_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index f2a3010140e3..fb59673c60b1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1830,7 +1830,7 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
1830extern int filemap_fdatawrite_range(struct address_space *mapping, 1830extern int filemap_fdatawrite_range(struct address_space *mapping,
1831 loff_t start, loff_t end); 1831 loff_t start, loff_t end);
1832 1832
1833extern long do_fsync(struct file *file, int datasync); 1833extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync);
1834extern void sync_supers(void); 1834extern void sync_supers(void);
1835extern void sync_filesystems(int wait); 1835extern void sync_filesystems(int wait);
1836extern void __fsync_super(struct super_block *sb); 1836extern void __fsync_super(struct super_block *sb);
@@ -2059,6 +2059,9 @@ extern int vfs_fstat(unsigned int, struct kstat *);
2059 2059
2060extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2060extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2061 unsigned long arg); 2061 unsigned long arg);
2062extern int __generic_block_fiemap(struct inode *inode,
2063 struct fiemap_extent_info *fieinfo, u64 start,
2064 u64 len, get_block_t *get_block);
2062extern int generic_block_fiemap(struct inode *inode, 2065extern int generic_block_fiemap(struct inode *inode,
2063 struct fiemap_extent_info *fieinfo, u64 start, 2066 struct fiemap_extent_info *fieinfo, u64 start,
2064 u64 len, get_block_t *get_block); 2067 u64 len, get_block_t *get_block);
diff --git a/include/linux/hid.h b/include/linux/hid.h
index e5780f8c934a..81aa84d60c6b 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -403,15 +403,6 @@ struct hid_output_fifo {
403#define HID_STAT_ADDED 1 403#define HID_STAT_ADDED 1
404#define HID_STAT_PARSED 2 404#define HID_STAT_PARSED 2
405 405
406#define HID_CTRL_RUNNING 1
407#define HID_OUT_RUNNING 2
408#define HID_IN_RUNNING 3
409#define HID_RESET_PENDING 4
410#define HID_SUSPENDED 5
411#define HID_CLEAR_HALT 6
412#define HID_DISCONNECTED 7
413#define HID_STARTED 8
414
415struct hid_input { 406struct hid_input {
416 struct list_head list; 407 struct list_head list;
417 struct hid_report *report; 408 struct hid_report *report;
@@ -540,6 +531,8 @@ struct hid_usage_id {
540 * @name: driver name (e.g. "Footech_bar-wheel") 531 * @name: driver name (e.g. "Footech_bar-wheel")
541 * @id_table: which devices is this driver for (must be non-NULL for probe 532 * @id_table: which devices is this driver for (must be non-NULL for probe
542 * to be called) 533 * to be called)
534 * @dyn_list: list of dynamically added device ids
535 * @dyn_lock: lock protecting @dyn_list
543 * @probe: new device inserted 536 * @probe: new device inserted
544 * @remove: device removed (NULL if not a hot-plug capable driver) 537 * @remove: device removed (NULL if not a hot-plug capable driver)
545 * @report_table: on which reports to call raw_event (NULL means all) 538 * @report_table: on which reports to call raw_event (NULL means all)
@@ -567,6 +560,9 @@ struct hid_driver {
567 char *name; 560 char *name;
568 const struct hid_device_id *id_table; 561 const struct hid_device_id *id_table;
569 562
563 struct list_head dyn_list;
564 spinlock_t dyn_lock;
565
570 int (*probe)(struct hid_device *dev, const struct hid_device_id *id); 566 int (*probe)(struct hid_device *dev, const struct hid_device_id *id);
571 void (*remove)(struct hid_device *dev); 567 void (*remove)(struct hid_device *dev);
572 568
@@ -797,6 +793,8 @@ dbg_hid(const char *fmt, ...)
797 793
798#ifdef CONFIG_HID_COMPAT 794#ifdef CONFIG_HID_COMPAT
799#define HID_COMPAT_LOAD_DRIVER(name) \ 795#define HID_COMPAT_LOAD_DRIVER(name) \
796/* prototype to avoid sparse warning */ \
797extern void hid_compat_##name(void); \
800void hid_compat_##name(void) { } \ 798void hid_compat_##name(void) { } \
801EXPORT_SYMBOL(hid_compat_##name) 799EXPORT_SYMBOL(hid_compat_##name)
802#else 800#else
diff --git a/include/linux/hidraw.h b/include/linux/hidraw.h
index dbb5c8c374f0..dd8d69269176 100644
--- a/include/linux/hidraw.h
+++ b/include/linux/hidraw.h
@@ -33,6 +33,8 @@ struct hidraw_devinfo {
33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int) 33#define HIDIOCGRDESCSIZE _IOR('H', 0x01, int)
34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor) 34#define HIDIOCGRDESC _IOR('H', 0x02, struct hidraw_report_descriptor)
35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo) 35#define HIDIOCGRAWINFO _IOR('H', 0x03, struct hidraw_devinfo)
36#define HIDIOCGRAWNAME(len) _IOC(_IOC_READ, 'H', 0x04, len)
37#define HIDIOCGRAWPHYS(len) _IOC(_IOC_READ, 'H', 0x05, len)
36 38
37#define HIDRAW_FIRST_MINOR 0 39#define HIDRAW_FIRST_MINOR 0
38#define HIDRAW_MAX_DEVICES 64 40#define HIDRAW_MAX_DEVICES 64
diff --git a/include/linux/i2c/dm355evm_msp.h b/include/linux/i2c/dm355evm_msp.h
new file mode 100644
index 000000000000..372470350fab
--- /dev/null
+++ b/include/linux/i2c/dm355evm_msp.h
@@ -0,0 +1,79 @@
1/*
2 * dm355evm_msp.h - support MSP430 microcontroller on DM355EVM board
3 */
4#ifndef __LINUX_I2C_DM355EVM_MSP
5#define __LINUX_I2C_DM355EVM_MSP
6
7/*
8 * Written against Spectrum's writeup for the A4 firmware revision,
9 * and tweaked to match source and rev D2 schematics by removing CPLD
10 * and NOR flash hooks (which were last appropriate in rev B boards).
11 *
12 * Note that the firmware supports a flavor of write posting ... to be
13 * sure a write completes, issue another read or write.
14 */
15
16/* utilities to access "registers" emulated by msp430 firmware */
17extern int dm355evm_msp_write(u8 value, u8 reg);
18extern int dm355evm_msp_read(u8 reg);
19
20
21/* command/control registers */
22#define DM355EVM_MSP_COMMAND 0x00
23# define MSP_COMMAND_NULL 0
24# define MSP_COMMAND_RESET_COLD 1
25# define MSP_COMMAND_RESET_WARM 2
26# define MSP_COMMAND_RESET_WARM_I 3
27# define MSP_COMMAND_POWEROFF 4
28# define MSP_COMMAND_IR_REINIT 5
29#define DM355EVM_MSP_STATUS 0x01
30# define MSP_STATUS_BAD_OFFSET BIT(0)
31# define MSP_STATUS_BAD_COMMAND BIT(1)
32# define MSP_STATUS_POWER_ERROR BIT(2)
33# define MSP_STATUS_RXBUF_OVERRUN BIT(3)
34#define DM355EVM_MSP_RESET 0x02 /* 0 bits == in reset */
35# define MSP_RESET_DC5 BIT(0)
36# define MSP_RESET_TVP5154 BIT(2)
37# define MSP_RESET_IMAGER BIT(3)
38# define MSP_RESET_ETHERNET BIT(4)
39# define MSP_RESET_SYS BIT(5)
40# define MSP_RESET_AIC33 BIT(7)
41
42/* GPIO registers ... bit patterns mostly match the source MSP ports */
43#define DM355EVM_MSP_LED 0x03 /* active low (MSP P4) */
44#define DM355EVM_MSP_SWITCH1 0x04 /* (MSP P5, masked) */
45# define MSP_SWITCH1_SW6_1 BIT(0)
46# define MSP_SWITCH1_SW6_2 BIT(1)
47# define MSP_SWITCH1_SW6_3 BIT(2)
48# define MSP_SWITCH1_SW6_4 BIT(3)
49# define MSP_SWITCH1_J1 BIT(4) /* NTSC/PAL */
50# define MSP_SWITCH1_MSP_INT BIT(5) /* active low */
51#define DM355EVM_MSP_SWITCH2 0x05 /* (MSP P6, masked) */
52# define MSP_SWITCH2_SW10 BIT(3)
53# define MSP_SWITCH2_SW11 BIT(4)
54# define MSP_SWITCH2_SW12 BIT(5)
55# define MSP_SWITCH2_SW13 BIT(6)
56# define MSP_SWITCH2_SW14 BIT(7)
57#define DM355EVM_MSP_SDMMC 0x06 /* (MSP P2, masked) */
58# define MSP_SDMMC_0_WP BIT(1)
59# define MSP_SDMMC_0_CD BIT(2) /* active low */
60# define MSP_SDMMC_1_WP BIT(3)
61# define MSP_SDMMC_1_CD BIT(4) /* active low */
62#define DM355EVM_MSP_FIRMREV 0x07 /* not a GPIO (out of order) */
63#define DM355EVM_MSP_VIDEO_IN 0x08 /* (MSP P3, masked) */
64# define MSP_VIDEO_IMAGER BIT(7) /* low == tvp5146 */
65
66/* power supply registers are currently omitted */
67
68/* RTC registers */
69#define DM355EVM_MSP_RTC_0 0x12 /* LSB */
70#define DM355EVM_MSP_RTC_1 0x13
71#define DM355EVM_MSP_RTC_2 0x14
72#define DM355EVM_MSP_RTC_3 0x15 /* MSB */
73
74/* input event queue registers; code == ((HIGH << 8) | LOW) */
75#define DM355EVM_MSP_INPUT_COUNT 0x16 /* decrement by reading LOW */
76#define DM355EVM_MSP_INPUT_HIGH 0x17
77#define DM355EVM_MSP_INPUT_LOW 0x18
78
79#endif /* __LINUX_I2C_DM355EVM_MSP */
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h
index fb604dcd38f1..a8f84c01f82e 100644
--- a/include/linux/i2c/twl4030.h
+++ b/include/linux/i2c/twl4030.h
@@ -78,8 +78,8 @@ int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg);
78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1
79 * for the value, and populate your data starting at offset 1. 79 * for the value, and populate your data starting at offset 1.
80 */ 80 */
81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 81int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); 82int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes);
83 83
84/*----------------------------------------------------------------------*/ 84/*----------------------------------------------------------------------*/
85 85
@@ -278,6 +278,18 @@ struct twl4030_platform_data {
278 struct twl4030_keypad_data *keypad; 278 struct twl4030_keypad_data *keypad;
279 struct twl4030_usb_data *usb; 279 struct twl4030_usb_data *usb;
280 280
281 /* LDO regulators */
282 struct regulator_init_data *vdac;
283 struct regulator_init_data *vpll1;
284 struct regulator_init_data *vpll2;
285 struct regulator_init_data *vmmc1;
286 struct regulator_init_data *vmmc2;
287 struct regulator_init_data *vsim;
288 struct regulator_init_data *vaux1;
289 struct regulator_init_data *vaux2;
290 struct regulator_init_data *vaux3;
291 struct regulator_init_data *vaux4;
292
281 /* REVISIT more to come ... _nothing_ should be hard-wired */ 293 /* REVISIT more to come ... _nothing_ should be hard-wired */
282}; 294};
283 295
@@ -285,33 +297,6 @@ struct twl4030_platform_data {
285 297
286int twl4030_sih_setup(int module); 298int twl4030_sih_setup(int module);
287 299
288/*
289 * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the
290 * IRQ data to subsidiary devices using platform device resources.
291 */
292
293/* IRQ information-need base */
294#include <mach/irqs.h>
295/* TWL4030 interrupts */
296
297/* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */
298#define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1)
299#define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2)
300#define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3)
301/* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */
302/* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */
303
304#define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0)
305/* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */
306/* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */
307/* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */
308/* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */
309/* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */
310/* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */
311/* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */
312
313/* Rest are unsued currently*/
314
315/* Offsets to Power Registers */ 300/* Offsets to Power Registers */
316#define TWL4030_VDAC_DEV_GRP 0x3B 301#define TWL4030_VDAC_DEV_GRP 0x3B
317#define TWL4030_VDAC_DEDICATED 0x3E 302#define TWL4030_VDAC_DEDICATED 0x3E
@@ -322,10 +307,6 @@ int twl4030_sih_setup(int module);
322#define TWL4030_VAUX3_DEV_GRP 0x1F 307#define TWL4030_VAUX3_DEV_GRP 0x1F
323#define TWL4030_VAUX3_DEDICATED 0x22 308#define TWL4030_VAUX3_DEDICATED 0x22
324 309
325/* TWL4030 GPIO interrupt definitions */
326
327#define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n))
328
329/* 310/*
330 * Exported TWL4030 GPIO APIs 311 * Exported TWL4030 GPIO APIs
331 * 312 *
@@ -340,4 +321,38 @@ int twl4030_set_gpio_debounce(int gpio, int enable);
340 static inline int twl4030charger_usb_en(int enable) { return 0; } 321 static inline int twl4030charger_usb_en(int enable) { return 0; }
341#endif 322#endif
342 323
324/*----------------------------------------------------------------------*/
325
326/* Linux-specific regulator identifiers ... for now, we only support
327 * the LDOs, and leave the three buck converters alone. VDD1 and VDD2
328 * need to tie into hardware based voltage scaling (cpufreq etc), while
329 * VIO is generally fixed.
330 */
331
332/* EXTERNAL dc-to-dc buck converters */
333#define TWL4030_REG_VDD1 0
334#define TWL4030_REG_VDD2 1
335#define TWL4030_REG_VIO 2
336
337/* EXTERNAL LDOs */
338#define TWL4030_REG_VDAC 3
339#define TWL4030_REG_VPLL1 4
340#define TWL4030_REG_VPLL2 5 /* not on all chips */
341#define TWL4030_REG_VMMC1 6
342#define TWL4030_REG_VMMC2 7 /* not on all chips */
343#define TWL4030_REG_VSIM 8 /* not on all chips */
344#define TWL4030_REG_VAUX1 9 /* not on all chips */
345#define TWL4030_REG_VAUX2_4030 10 /* (twl4030-specific) */
346#define TWL4030_REG_VAUX2 11 /* (twl5030 and newer) */
347#define TWL4030_REG_VAUX3 12 /* not on all chips */
348#define TWL4030_REG_VAUX4 13 /* not on all chips */
349
350/* INTERNAL LDOs */
351#define TWL4030_REG_VINTANA1 14
352#define TWL4030_REG_VINTANA2 15
353#define TWL4030_REG_VINTDIG 16
354#define TWL4030_REG_VUSB1V5 17
355#define TWL4030_REG_VUSB1V8 18
356#define TWL4030_REG_VUSB3V1 19
357
343#endif /* End of __TWL4030_H */ 358#endif /* End of __TWL4030_H */
diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h
index c7d106ef22e2..34456476e761 100644
--- a/include/linux/jbd2.h
+++ b/include/linux/jbd2.h
@@ -329,6 +329,7 @@ enum jbd_state_bits {
329 BH_State, /* Pins most journal_head state */ 329 BH_State, /* Pins most journal_head state */
330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */ 330 BH_JournalHead, /* Pins bh->b_private and jh->b_bh */
331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */ 331 BH_Unshadow, /* Dummy bit, for BJ_Shadow wakeup filtering */
332 BH_JBDPrivateStart, /* First bit available for private use by FS */
332}; 333};
333 334
334BUFFER_FNS(JBD, jbd) 335BUFFER_FNS(JBD, jbd)
@@ -1007,6 +1008,35 @@ int __jbd2_journal_clean_checkpoint_list(journal_t *journal);
1007int __jbd2_journal_remove_checkpoint(struct journal_head *); 1008int __jbd2_journal_remove_checkpoint(struct journal_head *);
1008void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *); 1009void __jbd2_journal_insert_checkpoint(struct journal_head *, transaction_t *);
1009 1010
1011
1012/*
1013 * Triggers
1014 */
1015
1016struct jbd2_buffer_trigger_type {
1017 /*
1018 * Fired just before a buffer is written to the journal.
1019 * mapped_data is a mapped buffer that is the frozen data for
1020 * commit.
1021 */
1022 void (*t_commit)(struct jbd2_buffer_trigger_type *type,
1023 struct buffer_head *bh, void *mapped_data,
1024 size_t size);
1025
1026 /*
1027 * Fired during journal abort for dirty buffers that will not be
1028 * committed.
1029 */
1030 void (*t_abort)(struct jbd2_buffer_trigger_type *type,
1031 struct buffer_head *bh);
1032};
1033
1034extern void jbd2_buffer_commit_trigger(struct journal_head *jh,
1035 void *mapped_data,
1036 struct jbd2_buffer_trigger_type *triggers);
1037extern void jbd2_buffer_abort_trigger(struct journal_head *jh,
1038 struct jbd2_buffer_trigger_type *triggers);
1039
1010/* Buffer IO */ 1040/* Buffer IO */
1011extern int 1041extern int
1012jbd2_journal_write_metadata_buffer(transaction_t *transaction, 1042jbd2_journal_write_metadata_buffer(transaction_t *transaction,
@@ -1045,6 +1075,8 @@ extern int jbd2_journal_extend (handle_t *, int nblocks);
1045extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *); 1075extern int jbd2_journal_get_write_access(handle_t *, struct buffer_head *);
1046extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *); 1076extern int jbd2_journal_get_create_access (handle_t *, struct buffer_head *);
1047extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *); 1077extern int jbd2_journal_get_undo_access(handle_t *, struct buffer_head *);
1078void jbd2_journal_set_triggers(struct buffer_head *,
1079 struct jbd2_buffer_trigger_type *type);
1048extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *); 1080extern int jbd2_journal_dirty_metadata (handle_t *, struct buffer_head *);
1049extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *); 1081extern void jbd2_journal_release_buffer (handle_t *, struct buffer_head *);
1050extern int jbd2_journal_forget (handle_t *, struct buffer_head *); 1082extern int jbd2_journal_forget (handle_t *, struct buffer_head *);
diff --git a/include/linux/journal-head.h b/include/linux/journal-head.h
index bb70ebb6a2d5..525aac3c97df 100644
--- a/include/linux/journal-head.h
+++ b/include/linux/journal-head.h
@@ -12,6 +12,8 @@
12 12
13typedef unsigned int tid_t; /* Unique transaction ID */ 13typedef unsigned int tid_t; /* Unique transaction ID */
14typedef struct transaction_s transaction_t; /* Compound transaction type */ 14typedef struct transaction_s transaction_t; /* Compound transaction type */
15
16
15struct buffer_head; 17struct buffer_head;
16 18
17struct journal_head { 19struct journal_head {
@@ -87,6 +89,12 @@ struct journal_head {
87 * [j_list_lock] 89 * [j_list_lock]
88 */ 90 */
89 struct journal_head *b_cpnext, *b_cpprev; 91 struct journal_head *b_cpnext, *b_cpprev;
92
93 /* Trigger type */
94 struct jbd2_buffer_trigger_type *b_triggers;
95
96 /* Trigger type for the committing transaction's frozen data */
97 struct jbd2_buffer_trigger_type *b_frozen_triggers;
90}; 98};
91 99
92#endif /* JOURNAL_HEAD_H_INCLUDED */ 100#endif /* JOURNAL_HEAD_H_INCLUDED */
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h
index cad314c12439..115dbe965082 100644
--- a/include/linux/mfd/da903x.h
+++ b/include/linux/mfd/da903x.h
@@ -32,6 +32,7 @@ enum {
32 DA9030_ID_LDO18, 32 DA9030_ID_LDO18,
33 DA9030_ID_LDO19, 33 DA9030_ID_LDO19,
34 DA9030_ID_LDO_INT, /* LDO Internal */ 34 DA9030_ID_LDO_INT, /* LDO Internal */
35 DA9030_ID_BAT, /* battery charger */
35 36
36 DA9034_ID_LED_1, 37 DA9034_ID_LED_1,
37 DA9034_ID_LED_2, 38 DA9034_ID_LED_2,
@@ -93,6 +94,43 @@ struct da9034_touch_pdata {
93 int y_inverted; 94 int y_inverted;
94}; 95};
95 96
97/* DA9030 battery charger data */
98struct power_supply_info;
99
100struct da9030_battery_info {
101 /* battery parameters */
102 struct power_supply_info *battery_info;
103
104 /* current and voltage to use for battery charging */
105 unsigned int charge_milliamp;
106 unsigned int charge_millivolt;
107
108 /* voltage thresholds (in millivolts) */
109 int vbat_low;
110 int vbat_crit;
111 int vbat_charge_start;
112 int vbat_charge_stop;
113 int vbat_charge_restart;
114
115 /* battery nominal minimal and maximal voltages in millivolts */
116 int vcharge_min;
117 int vcharge_max;
118
119 /* Temperature thresholds. These are DA9030 register values
120 "as is" and should be measured for each battery type */
121 int tbat_low;
122 int tbat_high;
123 int tbat_restart;
124
125
126 /* battery monitor interval (seconds) */
127 unsigned int batmon_interval;
128
129 /* platform callbacks for battery low and critical events */
130 void (*battery_low)(void);
131 void (*battery_critical)(void);
132};
133
96struct da903x_subdev_info { 134struct da903x_subdev_info {
97 int id; 135 int id;
98 const char *name; 136 const char *name;
@@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev,
190extern int da903x_query_status(struct device *dev, unsigned int status); 228extern int da903x_query_status(struct device *dev, unsigned int status);
191 229
192 230
193/* NOTE: the two functions below are not intended for use outside 231/* NOTE: the functions below are not intended for use outside
194 * of the DA9034 sub-device drivers 232 * of the DA903x sub-device drivers
195 */ 233 */
196extern int da903x_write(struct device *dev, int reg, uint8_t val); 234extern int da903x_write(struct device *dev, int reg, uint8_t val);
235extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val);
197extern int da903x_read(struct device *dev, int reg, uint8_t *val); 236extern int da903x_read(struct device *dev, int reg, uint8_t *val);
237extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val);
198extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); 238extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask);
199extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); 239extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask);
200extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); 240extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h
index 053788649452..54bc5d0fd502 100644
--- a/include/linux/mfd/wm8350/comparator.h
+++ b/include/linux/mfd/wm8350/comparator.h
@@ -164,4 +164,12 @@
164#define WM8350_AUXADC_BATT 6 164#define WM8350_AUXADC_BATT 6
165#define WM8350_AUXADC_TEMP 7 165#define WM8350_AUXADC_TEMP 7
166 166
167struct wm8350;
168
169/*
170 * AUX ADC Readback
171 */
172int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale,
173 int vref);
174
167#endif 175#endif
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 6ebf97f2a475..980669d50dca 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -29,6 +29,7 @@
29 */ 29 */
30#define WM8350_RESET_ID 0x00 30#define WM8350_RESET_ID 0x00
31#define WM8350_ID 0x01 31#define WM8350_ID 0x01
32#define WM8350_REVISION 0x02
32#define WM8350_SYSTEM_CONTROL_1 0x03 33#define WM8350_SYSTEM_CONTROL_1 0x03
33#define WM8350_SYSTEM_CONTROL_2 0x04 34#define WM8350_SYSTEM_CONTROL_2 0x04
34#define WM8350_SYSTEM_HIBERNATE 0x05 35#define WM8350_SYSTEM_HIBERNATE 0x05
@@ -57,6 +58,10 @@
57#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 58#define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25
58#define WM8350_GPIO_INT_STATUS_MASK 0x26 59#define WM8350_GPIO_INT_STATUS_MASK 0x26
59#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 60#define WM8350_COMPARATOR_INT_STATUS_MASK 0x27
61#define WM8350_CHARGER_OVERRIDES 0xE2
62#define WM8350_MISC_OVERRIDES 0xE3
63#define WM8350_COMPARATOR_OVERRIDES 0xE7
64#define WM8350_STATE_MACHINE_STATUS 0xE9
60 65
61#define WM8350_MAX_REGISTER 0xFF 66#define WM8350_MAX_REGISTER 0xFF
62 67
@@ -77,6 +82,11 @@
77#define WM8350_CUST_ID_MASK 0x00FF 82#define WM8350_CUST_ID_MASK 0x00FF
78 83
79/* 84/*
85 * R2 (0x02) - Revision
86 */
87#define WM8350_MASK_REV_MASK 0x00FF
88
89/*
80 * R3 (0x03) - System Control 1 90 * R3 (0x03) - System Control 1
81 */ 91 */
82#define WM8350_CHIP_ON 0x8000 92#define WM8350_CHIP_ON 0x8000
@@ -523,6 +533,35 @@
523#define WM8350_DC2_STS 0x0002 533#define WM8350_DC2_STS 0x0002
524#define WM8350_DC1_STS 0x0001 534#define WM8350_DC1_STS 0x0001
525 535
536/*
537 * R226 (0xE2) - Charger status
538 */
539#define WM8350_CHG_BATT_HOT_OVRDE 0x8000
540#define WM8350_CHG_BATT_COLD_OVRDE 0x4000
541
542/*
543 * R227 (0xE3) - Misc Overrides
544 */
545#define WM8350_USB_LIMIT_OVRDE 0x0400
546
547/*
548 * R227 (0xE7) - Comparator Overrides
549 */
550#define WM8350_USB_FB_OVRDE 0x8000
551#define WM8350_WALL_FB_OVRDE 0x4000
552#define WM8350_BATT_FB_OVRDE 0x2000
553
554
555/*
556 * R233 (0xE9) - State Machinine Status
557 */
558#define WM8350_USB_SM_MASK 0x0700
559#define WM8350_USB_SM_SHIFT 8
560
561#define WM8350_USB_SM_100_SLV 1
562#define WM8350_USB_SM_500_SLV 5
563#define WM8350_USB_SM_STDBY_SLV 7
564
526/* WM8350 wake up conditions */ 565/* WM8350 wake up conditions */
527#define WM8350_IRQ_WKUP_OFF_STATE 43 566#define WM8350_IRQ_WKUP_OFF_STATE 43
528#define WM8350_IRQ_WKUP_HIB_STATE 44 567#define WM8350_IRQ_WKUP_HIB_STATE 44
@@ -536,6 +575,7 @@
536#define WM8350_REV_E 0x4 575#define WM8350_REV_E 0x4
537#define WM8350_REV_F 0x5 576#define WM8350_REV_F 0x5
538#define WM8350_REV_G 0x6 577#define WM8350_REV_G 0x6
578#define WM8350_REV_H 0x7
539 579
540#define WM8350_NUM_IRQ 63 580#define WM8350_NUM_IRQ 63
541 581
@@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[];
549extern const u16 wm8350_mode1_defaults[]; 589extern const u16 wm8350_mode1_defaults[];
550extern const u16 wm8350_mode2_defaults[]; 590extern const u16 wm8350_mode2_defaults[];
551extern const u16 wm8350_mode3_defaults[]; 591extern const u16 wm8350_mode3_defaults[];
592extern const u16 wm8351_mode0_defaults[];
593extern const u16 wm8351_mode1_defaults[];
594extern const u16 wm8351_mode2_defaults[];
595extern const u16 wm8351_mode3_defaults[];
596extern const u16 wm8352_mode0_defaults[];
597extern const u16 wm8352_mode1_defaults[];
598extern const u16 wm8352_mode2_defaults[];
599extern const u16 wm8352_mode3_defaults[];
552 600
553struct wm8350; 601struct wm8350;
554 602
@@ -558,8 +606,6 @@ struct wm8350_irq {
558}; 606};
559 607
560struct wm8350 { 608struct wm8350 {
561 int rev; /* chip revision */
562
563 struct device *dev; 609 struct device *dev;
564 610
565 /* device IO */ 611 /* device IO */
@@ -572,6 +618,8 @@ struct wm8350 {
572 void *src); 618 void *src);
573 u16 *reg_cache; 619 u16 *reg_cache;
574 620
621 struct mutex auxadc_mutex;
622
575 /* Interrupt handling */ 623 /* Interrupt handling */
576 struct work_struct irq_work; 624 struct work_struct irq_work;
577 struct mutex irq_mutex; /* IRQ table mutex */ 625 struct mutex irq_mutex; /* IRQ table mutex */
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
index 69b69e07f62f..96acbfc8aa12 100644
--- a/include/linux/mfd/wm8350/pmic.h
+++ b/include/linux/mfd/wm8350/pmic.h
@@ -701,6 +701,10 @@ struct platform_device;
701struct regulator_init_data; 701struct regulator_init_data;
702 702
703struct wm8350_pmic { 703struct wm8350_pmic {
704 /* Number of regulators of each type on this device */
705 int max_dcdc;
706 int max_isink;
707
704 /* ISINK to DCDC mapping */ 708 /* ISINK to DCDC mapping */
705 int isink_A_dcdc; 709 int isink_A_dcdc;
706 int isink_B_dcdc; 710 int isink_B_dcdc;
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h
index 1c8f3cde79b0..2b9479310bbd 100644
--- a/include/linux/mfd/wm8350/supply.h
+++ b/include/linux/mfd/wm8350/supply.h
@@ -13,7 +13,8 @@
13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_ 13#ifndef __LINUX_MFD_WM8350_SUPPLY_H_
14#define __LINUX_MFD_WM8350_SUPPLY_H_ 14#define __LINUX_MFD_WM8350_SUPPLY_H_
15 15
16#include <linux/platform_device.h> 16#include <linux/mutex.h>
17#include <linux/power_supply.h>
17 18
18/* 19/*
19 * Charger registers 20 * Charger registers
@@ -104,8 +105,30 @@
104#define WM8350_IRQ_EXT_WALL_FB 37 105#define WM8350_IRQ_EXT_WALL_FB 37
105#define WM8350_IRQ_EXT_BAT_FB 38 106#define WM8350_IRQ_EXT_BAT_FB 38
106 107
108/*
109 * Policy to control charger state machine.
110 */
111struct wm8350_charger_policy {
112
113 /* charger state machine policy - set in machine driver */
114 int eoc_mA; /* end of charge current (mA) */
115 int charge_mV; /* charge voltage */
116 int fast_limit_mA; /* fast charge current limit */
117 int fast_limit_USB_mA; /* USB fast charge current limit */
118 int charge_timeout; /* charge timeout (mins) */
119 int trickle_start_mV; /* trickle charge starts at mV */
120 int trickle_charge_mA; /* trickle charge current */
121 int trickle_charge_USB_mA; /* USB trickle charge current */
122};
123
107struct wm8350_power { 124struct wm8350_power {
108 struct platform_device *pdev; 125 struct platform_device *pdev;
126 struct power_supply battery;
127 struct power_supply usb;
128 struct power_supply ac;
129 struct wm8350_charger_policy *policy;
130
131 int rev_g_coeff;
109}; 132};
110 133
111#endif 134#endif
diff --git a/include/linux/moduleloader.h b/include/linux/moduleloader.h
index eb1033957486..c1f40c2f7ffb 100644
--- a/include/linux/moduleloader.h
+++ b/include/linux/moduleloader.h
@@ -13,6 +13,9 @@ int module_frob_arch_sections(Elf_Ehdr *hdr,
13 char *secstrings, 13 char *secstrings,
14 struct module *mod); 14 struct module *mod);
15 15
16/* Additional bytes needed by arch in front of individual sections */
17unsigned int arch_mod_section_prepend(struct module *mod, unsigned int section);
18
16/* Allocator used for allocating struct module, core sections and init 19/* Allocator used for allocating struct module, core sections and init
17 sections. Returns NULL on failure. */ 20 sections. Returns NULL on failure. */
18void *module_alloc(unsigned long size); 21void *module_alloc(unsigned long size);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 41e1224651cf..c28bbba3c23d 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -313,10 +313,11 @@ struct napi_struct {
313#ifdef CONFIG_NETPOLL 313#ifdef CONFIG_NETPOLL
314 spinlock_t poll_lock; 314 spinlock_t poll_lock;
315 int poll_owner; 315 int poll_owner;
316 struct net_device *dev;
317#endif 316#endif
317 struct net_device *dev;
318 struct list_head dev_list; 318 struct list_head dev_list;
319 struct sk_buff *gro_list; 319 struct sk_buff *gro_list;
320 struct sk_buff *skb;
320}; 321};
321 322
322enum 323enum
@@ -990,6 +991,9 @@ struct napi_gro_cb {
990 991
991 /* Number of segments aggregated. */ 992 /* Number of segments aggregated. */
992 int count; 993 int count;
994
995 /* Free the skb? */
996 int free;
993}; 997};
994 998
995#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb) 999#define NAPI_GRO_CB(skb) ((struct napi_gro_cb *)(skb)->cb)
@@ -1011,6 +1015,14 @@ struct packet_type {
1011 struct list_head list; 1015 struct list_head list;
1012}; 1016};
1013 1017
1018struct napi_gro_fraginfo {
1019 skb_frag_t frags[MAX_SKB_FRAGS];
1020 unsigned int nr_frags;
1021 unsigned int ip_summed;
1022 unsigned int len;
1023 __wsum csum;
1024};
1025
1014#include <linux/interrupt.h> 1026#include <linux/interrupt.h>
1015#include <linux/notifier.h> 1027#include <linux/notifier.h>
1016 1028
@@ -1363,6 +1375,8 @@ extern int netif_receive_skb(struct sk_buff *skb);
1363extern void napi_gro_flush(struct napi_struct *napi); 1375extern void napi_gro_flush(struct napi_struct *napi);
1364extern int napi_gro_receive(struct napi_struct *napi, 1376extern int napi_gro_receive(struct napi_struct *napi,
1365 struct sk_buff *skb); 1377 struct sk_buff *skb);
1378extern int napi_gro_frags(struct napi_struct *napi,
1379 struct napi_gro_fraginfo *info);
1366extern void netif_nit_deliver(struct sk_buff *skb); 1380extern void netif_nit_deliver(struct sk_buff *skb);
1367extern int dev_valid_name(const char *name); 1381extern int dev_valid_name(const char *name);
1368extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *); 1382extern int dev_ioctl(struct net *net, unsigned int cmd, void __user *);
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f9348cba6dc1..8ff25e0e7f7a 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -45,6 +45,7 @@ enum {
45 POWER_SUPPLY_HEALTH_DEAD, 45 POWER_SUPPLY_HEALTH_DEAD,
46 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 46 POWER_SUPPLY_HEALTH_OVERVOLTAGE,
47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE,
48 POWER_SUPPLY_HEALTH_COLD,
48}; 49};
49 50
50enum { 51enum {
diff --git a/include/linux/quota.h b/include/linux/quota.h
index 40401b554484..d72d5d84fde5 100644
--- a/include/linux/quota.h
+++ b/include/linux/quota.h
@@ -36,17 +36,7 @@
36#include <linux/errno.h> 36#include <linux/errno.h>
37#include <linux/types.h> 37#include <linux/types.h>
38 38
39#define __DQUOT_VERSION__ "dquot_6.5.1" 39#define __DQUOT_VERSION__ "dquot_6.5.2"
40#define __DQUOT_NUM_VERSION__ 6*10000+5*100+1
41
42/* Size of blocks in which are counted size limits */
43#define QUOTABLOCK_BITS 10
44#define QUOTABLOCK_SIZE (1 << QUOTABLOCK_BITS)
45
46/* Conversion routines from and to quota blocks */
47#define qb2kb(x) ((x) << (QUOTABLOCK_BITS-10))
48#define kb2qb(x) ((x) >> (QUOTABLOCK_BITS-10))
49#define toqb(x) (((x) + QUOTABLOCK_SIZE - 1) >> QUOTABLOCK_BITS)
50 40
51#define MAXQUOTAS 2 41#define MAXQUOTAS 2
52#define USRQUOTA 0 /* element used for user quotas */ 42#define USRQUOTA 0 /* element used for user quotas */
@@ -80,16 +70,34 @@
80#define Q_GETQUOTA 0x800007 /* get user quota structure */ 70#define Q_GETQUOTA 0x800007 /* get user quota structure */
81#define Q_SETQUOTA 0x800008 /* set user quota structure */ 71#define Q_SETQUOTA 0x800008 /* set user quota structure */
82 72
73/* Quota format type IDs */
74#define QFMT_VFS_OLD 1
75#define QFMT_VFS_V0 2
76
77/* Size of block in which space limits are passed through the quota
78 * interface */
79#define QIF_DQBLKSIZE_BITS 10
80#define QIF_DQBLKSIZE (1 << QIF_DQBLKSIZE_BITS)
81
83/* 82/*
84 * Quota structure used for communication with userspace via quotactl 83 * Quota structure used for communication with userspace via quotactl
85 * Following flags are used to specify which fields are valid 84 * Following flags are used to specify which fields are valid
86 */ 85 */
87#define QIF_BLIMITS 1 86enum {
88#define QIF_SPACE 2 87 QIF_BLIMITS_B = 0,
89#define QIF_ILIMITS 4 88 QIF_SPACE_B,
90#define QIF_INODES 8 89 QIF_ILIMITS_B,
91#define QIF_BTIME 16 90 QIF_INODES_B,
92#define QIF_ITIME 32 91 QIF_BTIME_B,
92 QIF_ITIME_B,
93};
94
95#define QIF_BLIMITS (1 << QIF_BLIMITS_B)
96#define QIF_SPACE (1 << QIF_SPACE_B)
97#define QIF_ILIMITS (1 << QIF_ILIMITS_B)
98#define QIF_INODES (1 << QIF_INODES_B)
99#define QIF_BTIME (1 << QIF_BTIME_B)
100#define QIF_ITIME (1 << QIF_ITIME_B)
93#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS) 101#define QIF_LIMITS (QIF_BLIMITS | QIF_ILIMITS)
94#define QIF_USAGE (QIF_SPACE | QIF_INODES) 102#define QIF_USAGE (QIF_SPACE | QIF_INODES)
95#define QIF_TIMES (QIF_BTIME | QIF_ITIME) 103#define QIF_TIMES (QIF_BTIME | QIF_ITIME)
@@ -172,7 +180,7 @@ enum {
172#include <asm/atomic.h> 180#include <asm/atomic.h>
173 181
174typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */ 182typedef __kernel_uid32_t qid_t; /* Type in which we store ids in memory */
175typedef __u64 qsize_t; /* Type in which we store sizes */ 183typedef long long qsize_t; /* Type in which we store sizes */
176 184
177extern spinlock_t dq_data_lock; 185extern spinlock_t dq_data_lock;
178 186
@@ -187,12 +195,12 @@ extern spinlock_t dq_data_lock;
187 * Data for one user/group kept in memory 195 * Data for one user/group kept in memory
188 */ 196 */
189struct mem_dqblk { 197struct mem_dqblk {
190 __u32 dqb_bhardlimit; /* absolute limit on disk blks alloc */ 198 qsize_t dqb_bhardlimit; /* absolute limit on disk blks alloc */
191 __u32 dqb_bsoftlimit; /* preferred limit on disk blks */ 199 qsize_t dqb_bsoftlimit; /* preferred limit on disk blks */
192 qsize_t dqb_curspace; /* current used space */ 200 qsize_t dqb_curspace; /* current used space */
193 __u32 dqb_ihardlimit; /* absolute limit on allocated inodes */ 201 qsize_t dqb_ihardlimit; /* absolute limit on allocated inodes */
194 __u32 dqb_isoftlimit; /* preferred inode limit */ 202 qsize_t dqb_isoftlimit; /* preferred inode limit */
195 __u32 dqb_curinodes; /* current # allocated inodes */ 203 qsize_t dqb_curinodes; /* current # allocated inodes */
196 time_t dqb_btime; /* time limit for excessive disk use */ 204 time_t dqb_btime; /* time limit for excessive disk use */
197 time_t dqb_itime; /* time limit for excessive inode use */ 205 time_t dqb_itime; /* time limit for excessive inode use */
198}; 206};
@@ -212,10 +220,7 @@ struct mem_dqinfo {
212 unsigned int dqi_igrace; 220 unsigned int dqi_igrace;
213 qsize_t dqi_maxblimit; 221 qsize_t dqi_maxblimit;
214 qsize_t dqi_maxilimit; 222 qsize_t dqi_maxilimit;
215 union { 223 void *dqi_priv;
216 struct v1_mem_dqinfo v1_i;
217 struct v2_mem_dqinfo v2_i;
218 } u;
219}; 224};
220 225
221struct super_block; 226struct super_block;
@@ -249,6 +254,11 @@ extern struct dqstats dqstats;
249#define DQ_FAKE_B 3 /* no limits only usage */ 254#define DQ_FAKE_B 3 /* no limits only usage */
250#define DQ_READ_B 4 /* dquot was read into memory */ 255#define DQ_READ_B 4 /* dquot was read into memory */
251#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ 256#define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */
257#define DQ_LASTSET_B 6 /* Following 6 bits (see QIF_) are reserved\
258 * for the mask of entries set via SETQUOTA\
259 * quotactl. They are set under dq_data_lock\
260 * and the quota format handling dquot can\
261 * clear them when it sees fit. */
252 262
253struct dquot { 263struct dquot {
254 struct hlist_node dq_hash; /* Hash list in memory */ 264 struct hlist_node dq_hash; /* Hash list in memory */
@@ -287,11 +297,13 @@ struct dquot_operations {
287 int (*initialize) (struct inode *, int); 297 int (*initialize) (struct inode *, int);
288 int (*drop) (struct inode *); 298 int (*drop) (struct inode *);
289 int (*alloc_space) (struct inode *, qsize_t, int); 299 int (*alloc_space) (struct inode *, qsize_t, int);
290 int (*alloc_inode) (const struct inode *, unsigned long); 300 int (*alloc_inode) (const struct inode *, qsize_t);
291 int (*free_space) (struct inode *, qsize_t); 301 int (*free_space) (struct inode *, qsize_t);
292 int (*free_inode) (const struct inode *, unsigned long); 302 int (*free_inode) (const struct inode *, qsize_t);
293 int (*transfer) (struct inode *, struct iattr *); 303 int (*transfer) (struct inode *, struct iattr *);
294 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */ 304 int (*write_dquot) (struct dquot *); /* Ordinary dquot write */
305 struct dquot *(*alloc_dquot)(struct super_block *, int); /* Allocate memory for new dquot */
306 void (*destroy_dquot)(struct dquot *); /* Free memory for dquot */
295 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */ 307 int (*acquire_dquot) (struct dquot *); /* Quota is going to be created on disk */
296 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */ 308 int (*release_dquot) (struct dquot *); /* Quota is going to be deleted from disk */
297 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */ 309 int (*mark_dirty) (struct dquot *); /* Dquot is marked dirty */
@@ -320,12 +332,42 @@ struct quota_format_type {
320 struct quota_format_type *qf_next; 332 struct quota_format_type *qf_next;
321}; 333};
322 334
323#define DQUOT_USR_ENABLED 0x01 /* User diskquotas enabled */ 335/* Quota state flags - they actually come in two flavors - for users and groups */
324#define DQUOT_GRP_ENABLED 0x02 /* Group diskquotas enabled */ 336enum {
325#define DQUOT_USR_SUSPENDED 0x04 /* User diskquotas are off, but 337 _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
338 _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
339 _DQUOT_SUSPENDED, /* User diskquotas are off, but
326 * we have necessary info in 340 * we have necessary info in
327 * memory to turn them on */ 341 * memory to turn them on */
328#define DQUOT_GRP_SUSPENDED 0x08 /* The same for group quotas */ 342 _DQUOT_STATE_FLAGS
343};
344#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED)
345#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED)
346#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED)
347#define DQUOT_STATE_FLAGS (DQUOT_USAGE_ENABLED | DQUOT_LIMITS_ENABLED | \
348 DQUOT_SUSPENDED)
349/* Other quota flags */
350#define DQUOT_QUOTA_SYS_FILE (1 << 6) /* Quota file is a special
351 * system file and user cannot
352 * touch it. Filesystem is
353 * responsible for setting
354 * S_NOQUOTA, S_NOATIME flags
355 */
356#define DQUOT_NEGATIVE_USAGE (1 << 7) /* Allow negative quota usage */
357
358static inline unsigned int dquot_state_flag(unsigned int flags, int type)
359{
360 if (type == USRQUOTA)
361 return flags;
362 return flags << _DQUOT_STATE_FLAGS;
363}
364
365static inline unsigned int dquot_generic_flag(unsigned int flags, int type)
366{
367 if (type == USRQUOTA)
368 return flags;
369 return flags >> _DQUOT_STATE_FLAGS;
370}
329 371
330struct quota_info { 372struct quota_info {
331 unsigned int flags; /* Flags for diskquotas on this device */ 373 unsigned int flags; /* Flags for diskquotas on this device */
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h
index a558a4c1d35a..21b781a3350f 100644
--- a/include/linux/quotaops.h
+++ b/include/linux/quotaops.h
@@ -24,12 +24,21 @@ void sync_dquots(struct super_block *sb, int type);
24 24
25int dquot_initialize(struct inode *inode, int type); 25int dquot_initialize(struct inode *inode, int type);
26int dquot_drop(struct inode *inode); 26int dquot_drop(struct inode *inode);
27int dquot_drop_locked(struct inode *inode);
28struct dquot *dqget(struct super_block *sb, unsigned int id, int type);
29void dqput(struct dquot *dquot);
30int dquot_is_cached(struct super_block *sb, unsigned int id, int type);
31int dquot_scan_active(struct super_block *sb,
32 int (*fn)(struct dquot *dquot, unsigned long priv),
33 unsigned long priv);
34struct dquot *dquot_alloc(struct super_block *sb, int type);
35void dquot_destroy(struct dquot *dquot);
27 36
28int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc); 37int dquot_alloc_space(struct inode *inode, qsize_t number, int prealloc);
29int dquot_alloc_inode(const struct inode *inode, unsigned long number); 38int dquot_alloc_inode(const struct inode *inode, qsize_t number);
30 39
31int dquot_free_space(struct inode *inode, qsize_t number); 40int dquot_free_space(struct inode *inode, qsize_t number);
32int dquot_free_inode(const struct inode *inode, unsigned long number); 41int dquot_free_inode(const struct inode *inode, qsize_t number);
33 42
34int dquot_transfer(struct inode *inode, struct iattr *iattr); 43int dquot_transfer(struct inode *inode, struct iattr *iattr);
35int dquot_commit(struct dquot *dquot); 44int dquot_commit(struct dquot *dquot);
@@ -40,11 +49,14 @@ int dquot_mark_dquot_dirty(struct dquot *dquot);
40 49
41int vfs_quota_on(struct super_block *sb, int type, int format_id, 50int vfs_quota_on(struct super_block *sb, int type, int format_id,
42 char *path, int remount); 51 char *path, int remount);
52int vfs_quota_enable(struct inode *inode, int type, int format_id,
53 unsigned int flags);
43int vfs_quota_on_path(struct super_block *sb, int type, int format_id, 54int vfs_quota_on_path(struct super_block *sb, int type, int format_id,
44 struct path *path); 55 struct path *path);
45int vfs_quota_on_mount(struct super_block *sb, char *qf_name, 56int vfs_quota_on_mount(struct super_block *sb, char *qf_name,
46 int format_id, int type); 57 int format_id, int type);
47int vfs_quota_off(struct super_block *sb, int type, int remount); 58int vfs_quota_off(struct super_block *sb, int type, int remount);
59int vfs_quota_disable(struct super_block *sb, int type, unsigned int flags);
48int vfs_quota_sync(struct super_block *sb, int type); 60int vfs_quota_sync(struct super_block *sb, int type);
49int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 61int vfs_get_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
50int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii); 62int vfs_set_dqinfo(struct super_block *sb, int type, struct if_dqinfo *ii);
@@ -64,24 +76,22 @@ static inline struct mem_dqinfo *sb_dqinfo(struct super_block *sb, int type)
64 * Functions for checking status of quota 76 * Functions for checking status of quota
65 */ 77 */
66 78
67static inline int sb_has_quota_enabled(struct super_block *sb, int type) 79static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
68{ 80{
69 if (type == USRQUOTA) 81 return sb_dqopt(sb)->flags &
70 return sb_dqopt(sb)->flags & DQUOT_USR_ENABLED; 82 dquot_state_flag(DQUOT_USAGE_ENABLED, type);
71 return sb_dqopt(sb)->flags & DQUOT_GRP_ENABLED;
72} 83}
73 84
74static inline int sb_any_quota_enabled(struct super_block *sb) 85static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
75{ 86{
76 return sb_has_quota_enabled(sb, USRQUOTA) || 87 return sb_dqopt(sb)->flags &
77 sb_has_quota_enabled(sb, GRPQUOTA); 88 dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
78} 89}
79 90
80static inline int sb_has_quota_suspended(struct super_block *sb, int type) 91static inline int sb_has_quota_suspended(struct super_block *sb, int type)
81{ 92{
82 if (type == USRQUOTA) 93 return sb_dqopt(sb)->flags &
83 return sb_dqopt(sb)->flags & DQUOT_USR_SUSPENDED; 94 dquot_state_flag(DQUOT_SUSPENDED, type);
84 return sb_dqopt(sb)->flags & DQUOT_GRP_SUSPENDED;
85} 95}
86 96
87static inline int sb_any_quota_suspended(struct super_block *sb) 97static inline int sb_any_quota_suspended(struct super_block *sb)
@@ -90,6 +100,31 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
90 sb_has_quota_suspended(sb, GRPQUOTA); 100 sb_has_quota_suspended(sb, GRPQUOTA);
91} 101}
92 102
103/* Does kernel know about any quota information for given sb + type? */
104static inline int sb_has_quota_loaded(struct super_block *sb, int type)
105{
106 /* Currently if anything is on, then quota usage is on as well */
107 return sb_has_quota_usage_enabled(sb, type);
108}
109
110static inline int sb_any_quota_loaded(struct super_block *sb)
111{
112 return sb_has_quota_loaded(sb, USRQUOTA) ||
113 sb_has_quota_loaded(sb, GRPQUOTA);
114}
115
116static inline int sb_has_quota_active(struct super_block *sb, int type)
117{
118 return sb_has_quota_loaded(sb, type) &&
119 !sb_has_quota_suspended(sb, type);
120}
121
122static inline int sb_any_quota_active(struct super_block *sb)
123{
124 return sb_has_quota_active(sb, USRQUOTA) ||
125 sb_has_quota_active(sb, GRPQUOTA);
126}
127
93/* 128/*
94 * Operations supported for diskquotas. 129 * Operations supported for diskquotas.
95 */ 130 */
@@ -104,7 +139,7 @@ extern struct quotactl_ops vfs_quotactl_ops;
104static inline void vfs_dq_init(struct inode *inode) 139static inline void vfs_dq_init(struct inode *inode)
105{ 140{
106 BUG_ON(!inode->i_sb); 141 BUG_ON(!inode->i_sb);
107 if (sb_any_quota_enabled(inode->i_sb) && !IS_NOQUOTA(inode)) 142 if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
108 inode->i_sb->dq_op->initialize(inode, -1); 143 inode->i_sb->dq_op->initialize(inode, -1);
109} 144}
110 145
@@ -112,7 +147,7 @@ static inline void vfs_dq_init(struct inode *inode)
112 * a transaction (deadlocks possible otherwise) */ 147 * a transaction (deadlocks possible otherwise) */
113static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr) 148static inline int vfs_dq_prealloc_space_nodirty(struct inode *inode, qsize_t nr)
114{ 149{
115 if (sb_any_quota_enabled(inode->i_sb)) { 150 if (sb_any_quota_active(inode->i_sb)) {
116 /* Used space is updated in alloc_space() */ 151 /* Used space is updated in alloc_space() */
117 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA) 152 if (inode->i_sb->dq_op->alloc_space(inode, nr, 1) == NO_QUOTA)
118 return 1; 153 return 1;
@@ -132,7 +167,7 @@ static inline int vfs_dq_prealloc_space(struct inode *inode, qsize_t nr)
132 167
133static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr) 168static inline int vfs_dq_alloc_space_nodirty(struct inode *inode, qsize_t nr)
134{ 169{
135 if (sb_any_quota_enabled(inode->i_sb)) { 170 if (sb_any_quota_active(inode->i_sb)) {
136 /* Used space is updated in alloc_space() */ 171 /* Used space is updated in alloc_space() */
137 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA) 172 if (inode->i_sb->dq_op->alloc_space(inode, nr, 0) == NO_QUOTA)
138 return 1; 173 return 1;
@@ -152,7 +187,7 @@ static inline int vfs_dq_alloc_space(struct inode *inode, qsize_t nr)
152 187
153static inline int vfs_dq_alloc_inode(struct inode *inode) 188static inline int vfs_dq_alloc_inode(struct inode *inode)
154{ 189{
155 if (sb_any_quota_enabled(inode->i_sb)) { 190 if (sb_any_quota_active(inode->i_sb)) {
156 vfs_dq_init(inode); 191 vfs_dq_init(inode);
157 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA) 192 if (inode->i_sb->dq_op->alloc_inode(inode, 1) == NO_QUOTA)
158 return 1; 193 return 1;
@@ -162,7 +197,7 @@ static inline int vfs_dq_alloc_inode(struct inode *inode)
162 197
163static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr) 198static inline void vfs_dq_free_space_nodirty(struct inode *inode, qsize_t nr)
164{ 199{
165 if (sb_any_quota_enabled(inode->i_sb)) 200 if (sb_any_quota_active(inode->i_sb))
166 inode->i_sb->dq_op->free_space(inode, nr); 201 inode->i_sb->dq_op->free_space(inode, nr);
167 else 202 else
168 inode_sub_bytes(inode, nr); 203 inode_sub_bytes(inode, nr);
@@ -176,7 +211,7 @@ static inline void vfs_dq_free_space(struct inode *inode, qsize_t nr)
176 211
177static inline void vfs_dq_free_inode(struct inode *inode) 212static inline void vfs_dq_free_inode(struct inode *inode)
178{ 213{
179 if (sb_any_quota_enabled(inode->i_sb)) 214 if (sb_any_quota_active(inode->i_sb))
180 inode->i_sb->dq_op->free_inode(inode, 1); 215 inode->i_sb->dq_op->free_inode(inode, 1);
181} 216}
182 217
@@ -197,12 +232,12 @@ static inline int vfs_dq_off(struct super_block *sb, int remount)
197 232
198#else 233#else
199 234
200static inline int sb_has_quota_enabled(struct super_block *sb, int type) 235static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
201{ 236{
202 return 0; 237 return 0;
203} 238}
204 239
205static inline int sb_any_quota_enabled(struct super_block *sb) 240static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
206{ 241{
207 return 0; 242 return 0;
208} 243}
@@ -217,6 +252,27 @@ static inline int sb_any_quota_suspended(struct super_block *sb)
217 return 0; 252 return 0;
218} 253}
219 254
255/* Does kernel know about any quota information for given sb + type? */
256static inline int sb_has_quota_loaded(struct super_block *sb, int type)
257{
258 return 0;
259}
260
261static inline int sb_any_quota_loaded(struct super_block *sb)
262{
263 return 0;
264}
265
266static inline int sb_has_quota_active(struct super_block *sb, int type)
267{
268 return 0;
269}
270
271static inline int sb_any_quota_active(struct super_block *sb)
272{
273 return 0;
274}
275
220/* 276/*
221 * NO-OP when quota not configured. 277 * NO-OP when quota not configured.
222 */ 278 */
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h
index a916c6660dfa..355f6e80db0d 100644
--- a/include/linux/radix-tree.h
+++ b/include/linux/radix-tree.h
@@ -136,7 +136,7 @@ do { \
136 */ 136 */
137static inline void *radix_tree_deref_slot(void **pslot) 137static inline void *radix_tree_deref_slot(void **pslot)
138{ 138{
139 void *ret = *pslot; 139 void *ret = rcu_dereference(*pslot);
140 if (unlikely(radix_tree_is_indirect_ptr(ret))) 140 if (unlikely(radix_tree_is_indirect_ptr(ret)))
141 ret = RADIX_TREE_RETRY; 141 ret = RADIX_TREE_RETRY;
142 return ret; 142 return ret;
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 74d59a641362..baba3a23a814 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -35,6 +35,24 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
35 * won't come or go while it's being called. Used by hotplug cpu. 35 * won't come or go while it's being called. Used by hotplug cpu.
36 */ 36 */
37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); 37int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus);
38
39/**
40 * stop_machine_create: create all stop_machine threads
41 *
42 * Description: This causes all stop_machine threads to be created before
43 * stop_machine actually gets called. This can be used by subsystems that
44 * need a non failing stop_machine infrastructure.
45 */
46int stop_machine_create(void);
47
48/**
49 * stop_machine_destroy: destroy all stop_machine threads
50 *
51 * Description: This causes all stop_machine threads which were created with
52 * stop_machine_create to be destroyed again.
53 */
54void stop_machine_destroy(void);
55
38#else 56#else
39 57
40static inline int stop_machine(int (*fn)(void *), void *data, 58static inline int stop_machine(int (*fn)(void *), void *data,
@@ -46,5 +64,9 @@ static inline int stop_machine(int (*fn)(void *), void *data,
46 local_irq_enable(); 64 local_irq_enable();
47 return ret; 65 return ret;
48} 66}
67
68static inline int stop_machine_create(void) { return 0; }
69static inline void stop_machine_destroy(void) { }
70
49#endif /* CONFIG_SMP */ 71#endif /* CONFIG_SMP */
50#endif /* _LINUX_STOP_MACHINE */ 72#endif /* _LINUX_STOP_MACHINE */
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 04fb47bfb920..18d0a243a7b3 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -549,7 +549,7 @@ asmlinkage long sys_inotify_init(void);
549asmlinkage long sys_inotify_init1(int flags); 549asmlinkage long sys_inotify_init1(int flags);
550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, 550asmlinkage long sys_inotify_add_watch(int fd, const char __user *path,
551 u32 mask); 551 u32 mask);
552asmlinkage long sys_inotify_rm_watch(int fd, u32 wd); 552asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd);
553 553
554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, 554asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
555 __u32 __user *ustatus); 555 __u32 __user *ustatus);
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index ce532f2222ce..1459ed3e2697 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -155,9 +155,9 @@ static inline struct neighbour * ndisc_get_neigh(struct net_device *dev, const s
155{ 155{
156 156
157 if (dev) 157 if (dev)
158 return __neigh_lookup(&nd_tbl, addr, dev, 1); 158 return __neigh_lookup_errno(&nd_tbl, addr, dev);
159 159
160 return NULL; 160 return ERR_PTR(-ENODEV);
161} 161}
162 162
163 163
diff --git a/init/Kconfig b/init/Kconfig
index f6281711166d..52847eec7398 100644
--- a/init/Kconfig
+++ b/init/Kconfig
@@ -916,12 +916,6 @@ config MODULE_SRCVERSION_ALL
916 the version). With this option, such a "srcversion" field 916 the version). With this option, such a "srcversion" field
917 will be created for all modules. If unsure, say N. 917 will be created for all modules. If unsure, say N.
918 918
919config KMOD
920 def_bool y
921 help
922 This is being removed soon. These days, CONFIG_MODULES
923 implies CONFIG_KMOD, so use that instead.
924
925endif # MODULES 919endif # MODULES
926 920
927config INIT_ALL_POSSIBLE 921config INIT_ALL_POSSIBLE
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index d448b69672b5..eddb6247a553 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -120,7 +120,6 @@ static struct inode *mqueue_get_inode(struct super_block *sb, int mode,
120 inode->i_mode = mode; 120 inode->i_mode = mode;
121 inode->i_uid = current_fsuid(); 121 inode->i_uid = current_fsuid();
122 inode->i_gid = current_fsgid(); 122 inode->i_gid = current_fsgid();
123 inode->i_blocks = 0;
124 inode->i_mtime = inode->i_ctime = inode->i_atime = 123 inode->i_mtime = inode->i_ctime = inode->i_atime =
125 CURRENT_TIME; 124 CURRENT_TIME;
126 125
diff --git a/ipc/sem.c b/ipc/sem.c
index 082122469b17..fea0ad3aed7b 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -58,7 +58,7 @@
58 * SMP-threaded, sysctl's added 58 * SMP-threaded, sysctl's added
59 * (c) 1999 Manfred Spraul <manfred@colorfullife.com> 59 * (c) 1999 Manfred Spraul <manfred@colorfullife.com>
60 * Enforced range limit on SEM_UNDO 60 * Enforced range limit on SEM_UNDO
61 * (c) 2001 Red Hat Inc <alan@redhat.com> 61 * (c) 2001 Red Hat Inc
62 * Lockless wakeup 62 * Lockless wakeup
63 * (c) 2003 Manfred Spraul <manfred@colorfullife.com> 63 * (c) 2003 Manfred Spraul <manfred@colorfullife.com>
64 * 64 *
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 891a84eb9d30..87bb0258fd27 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -573,7 +573,6 @@ static struct inode *cgroup_new_inode(mode_t mode, struct super_block *sb)
573 inode->i_mode = mode; 573 inode->i_mode = mode;
574 inode->i_uid = current_fsuid(); 574 inode->i_uid = current_fsuid();
575 inode->i_gid = current_fsgid(); 575 inode->i_gid = current_fsgid();
576 inode->i_blocks = 0;
577 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 576 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
578 inode->i_mapping->backing_dev_info = &cgroup_backing_dev_info; 577 inode->i_mapping->backing_dev_info = &cgroup_backing_dev_info;
579 } 578 }
diff --git a/kernel/cpu.c b/kernel/cpu.c
index 47fff3b63cbf..30e74dd6d01b 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -269,8 +269,11 @@ out_release:
269 269
270int __ref cpu_down(unsigned int cpu) 270int __ref cpu_down(unsigned int cpu)
271{ 271{
272 int err = 0; 272 int err;
273 273
274 err = stop_machine_create();
275 if (err)
276 return err;
274 cpu_maps_update_begin(); 277 cpu_maps_update_begin();
275 278
276 if (cpu_hotplug_disabled) { 279 if (cpu_hotplug_disabled) {
@@ -297,6 +300,7 @@ int __ref cpu_down(unsigned int cpu)
297 300
298out: 301out:
299 cpu_maps_update_done(); 302 cpu_maps_update_done();
303 stop_machine_destroy();
300 return err; 304 return err;
301} 305}
302EXPORT_SYMBOL(cpu_down); 306EXPORT_SYMBOL(cpu_down);
diff --git a/kernel/module.c b/kernel/module.c
index dd2a54155b54..f47cce910f25 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -757,8 +757,16 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
757 return -EFAULT; 757 return -EFAULT;
758 name[MODULE_NAME_LEN-1] = '\0'; 758 name[MODULE_NAME_LEN-1] = '\0';
759 759
760 if (mutex_lock_interruptible(&module_mutex) != 0) 760 /* Create stop_machine threads since free_module relies on
761 return -EINTR; 761 * a non-failing stop_machine call. */
762 ret = stop_machine_create();
763 if (ret)
764 return ret;
765
766 if (mutex_lock_interruptible(&module_mutex) != 0) {
767 ret = -EINTR;
768 goto out_stop;
769 }
762 770
763 mod = find_module(name); 771 mod = find_module(name);
764 if (!mod) { 772 if (!mod) {
@@ -817,10 +825,12 @@ sys_delete_module(const char __user *name_user, unsigned int flags)
817 825
818 out: 826 out:
819 mutex_unlock(&module_mutex); 827 mutex_unlock(&module_mutex);
828out_stop:
829 stop_machine_destroy();
820 return ret; 830 return ret;
821} 831}
822 832
823static void print_unload_info(struct seq_file *m, struct module *mod) 833static inline void print_unload_info(struct seq_file *m, struct module *mod)
824{ 834{
825 struct module_use *use; 835 struct module_use *use;
826 int printed_something = 0; 836 int printed_something = 0;
@@ -893,7 +903,7 @@ void module_put(struct module *module)
893EXPORT_SYMBOL(module_put); 903EXPORT_SYMBOL(module_put);
894 904
895#else /* !CONFIG_MODULE_UNLOAD */ 905#else /* !CONFIG_MODULE_UNLOAD */
896static void print_unload_info(struct seq_file *m, struct module *mod) 906static inline void print_unload_info(struct seq_file *m, struct module *mod)
897{ 907{
898 /* We don't know the usage count, or what modules are using. */ 908 /* We don't know the usage count, or what modules are using. */
899 seq_printf(m, " - -"); 909 seq_printf(m, " - -");
@@ -1578,11 +1588,21 @@ static int simplify_symbols(Elf_Shdr *sechdrs,
1578 return ret; 1588 return ret;
1579} 1589}
1580 1590
1591/* Additional bytes needed by arch in front of individual sections */
1592unsigned int __weak arch_mod_section_prepend(struct module *mod,
1593 unsigned int section)
1594{
1595 /* default implementation just returns zero */
1596 return 0;
1597}
1598
1581/* Update size with this section: return offset. */ 1599/* Update size with this section: return offset. */
1582static long get_offset(unsigned int *size, Elf_Shdr *sechdr) 1600static long get_offset(struct module *mod, unsigned int *size,
1601 Elf_Shdr *sechdr, unsigned int section)
1583{ 1602{
1584 long ret; 1603 long ret;
1585 1604
1605 *size += arch_mod_section_prepend(mod, section);
1586 ret = ALIGN(*size, sechdr->sh_addralign ?: 1); 1606 ret = ALIGN(*size, sechdr->sh_addralign ?: 1);
1587 *size = ret + sechdr->sh_size; 1607 *size = ret + sechdr->sh_size;
1588 return ret; 1608 return ret;
@@ -1622,7 +1642,7 @@ static void layout_sections(struct module *mod,
1622 || strncmp(secstrings + s->sh_name, 1642 || strncmp(secstrings + s->sh_name,
1623 ".init", 5) == 0) 1643 ".init", 5) == 0)
1624 continue; 1644 continue;
1625 s->sh_entsize = get_offset(&mod->core_size, s); 1645 s->sh_entsize = get_offset(mod, &mod->core_size, s, i);
1626 DEBUGP("\t%s\n", secstrings + s->sh_name); 1646 DEBUGP("\t%s\n", secstrings + s->sh_name);
1627 } 1647 }
1628 if (m == 0) 1648 if (m == 0)
@@ -1640,7 +1660,7 @@ static void layout_sections(struct module *mod,
1640 || strncmp(secstrings + s->sh_name, 1660 || strncmp(secstrings + s->sh_name,
1641 ".init", 5) != 0) 1661 ".init", 5) != 0)
1642 continue; 1662 continue;
1643 s->sh_entsize = (get_offset(&mod->init_size, s) 1663 s->sh_entsize = (get_offset(mod, &mod->init_size, s, i)
1644 | INIT_OFFSET_MASK); 1664 | INIT_OFFSET_MASK);
1645 DEBUGP("\t%s\n", secstrings + s->sh_name); 1665 DEBUGP("\t%s\n", secstrings + s->sh_name);
1646 } 1666 }
@@ -1725,15 +1745,15 @@ static const struct kernel_symbol *lookup_symbol(const char *name,
1725 return NULL; 1745 return NULL;
1726} 1746}
1727 1747
1728static int is_exported(const char *name, const struct module *mod) 1748static int is_exported(const char *name, unsigned long value,
1749 const struct module *mod)
1729{ 1750{
1730 if (!mod && lookup_symbol(name, __start___ksymtab, __stop___ksymtab)) 1751 const struct kernel_symbol *ks;
1731 return 1; 1752 if (!mod)
1753 ks = lookup_symbol(name, __start___ksymtab, __stop___ksymtab);
1732 else 1754 else
1733 if (mod && lookup_symbol(name, mod->syms, mod->syms + mod->num_syms)) 1755 ks = lookup_symbol(name, mod->syms, mod->syms + mod->num_syms);
1734 return 1; 1756 return ks != NULL && ks->value == value;
1735 else
1736 return 0;
1737} 1757}
1738 1758
1739/* As per nm */ 1759/* As per nm */
@@ -1865,6 +1885,13 @@ static noinline struct module *load_module(void __user *umod,
1865 /* vmalloc barfs on "unusual" numbers. Check here */ 1885 /* vmalloc barfs on "unusual" numbers. Check here */
1866 if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL) 1886 if (len > 64 * 1024 * 1024 || (hdr = vmalloc(len)) == NULL)
1867 return ERR_PTR(-ENOMEM); 1887 return ERR_PTR(-ENOMEM);
1888
1889 /* Create stop_machine threads since the error path relies on
1890 * a non-failing stop_machine call. */
1891 err = stop_machine_create();
1892 if (err)
1893 goto free_hdr;
1894
1868 if (copy_from_user(hdr, umod, len) != 0) { 1895 if (copy_from_user(hdr, umod, len) != 0) {
1869 err = -EFAULT; 1896 err = -EFAULT;
1870 goto free_hdr; 1897 goto free_hdr;
@@ -2248,6 +2275,7 @@ static noinline struct module *load_module(void __user *umod,
2248 /* Get rid of temporary copy */ 2275 /* Get rid of temporary copy */
2249 vfree(hdr); 2276 vfree(hdr);
2250 2277
2278 stop_machine_destroy();
2251 /* Done! */ 2279 /* Done! */
2252 return mod; 2280 return mod;
2253 2281
@@ -2270,6 +2298,7 @@ static noinline struct module *load_module(void __user *umod,
2270 kfree(args); 2298 kfree(args);
2271 free_hdr: 2299 free_hdr:
2272 vfree(hdr); 2300 vfree(hdr);
2301 stop_machine_destroy();
2273 return ERR_PTR(err); 2302 return ERR_PTR(err);
2274 2303
2275 truncated: 2304 truncated:
@@ -2504,7 +2533,7 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
2504 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name, 2533 strlcpy(name, mod->strtab + mod->symtab[symnum].st_name,
2505 KSYM_NAME_LEN); 2534 KSYM_NAME_LEN);
2506 strlcpy(module_name, mod->name, MODULE_NAME_LEN); 2535 strlcpy(module_name, mod->name, MODULE_NAME_LEN);
2507 *exported = is_exported(name, mod); 2536 *exported = is_exported(name, *value, mod);
2508 preempt_enable(); 2537 preempt_enable();
2509 return 0; 2538 return 0;
2510 } 2539 }
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 286c41722e8c..0cd415ee62a2 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -38,7 +38,10 @@ struct stop_machine_data {
38static unsigned int num_threads; 38static unsigned int num_threads;
39static atomic_t thread_ack; 39static atomic_t thread_ack;
40static DEFINE_MUTEX(lock); 40static DEFINE_MUTEX(lock);
41 41/* setup_lock protects refcount, stop_machine_wq and stop_machine_work. */
42static DEFINE_MUTEX(setup_lock);
43/* Users of stop_machine. */
44static int refcount;
42static struct workqueue_struct *stop_machine_wq; 45static struct workqueue_struct *stop_machine_wq;
43static struct stop_machine_data active, idle; 46static struct stop_machine_data active, idle;
44static const cpumask_t *active_cpus; 47static const cpumask_t *active_cpus;
@@ -109,6 +112,43 @@ static int chill(void *unused)
109 return 0; 112 return 0;
110} 113}
111 114
115int stop_machine_create(void)
116{
117 mutex_lock(&setup_lock);
118 if (refcount)
119 goto done;
120 stop_machine_wq = create_rt_workqueue("kstop");
121 if (!stop_machine_wq)
122 goto err_out;
123 stop_machine_work = alloc_percpu(struct work_struct);
124 if (!stop_machine_work)
125 goto err_out;
126done:
127 refcount++;
128 mutex_unlock(&setup_lock);
129 return 0;
130
131err_out:
132 if (stop_machine_wq)
133 destroy_workqueue(stop_machine_wq);
134 mutex_unlock(&setup_lock);
135 return -ENOMEM;
136}
137EXPORT_SYMBOL_GPL(stop_machine_create);
138
139void stop_machine_destroy(void)
140{
141 mutex_lock(&setup_lock);
142 refcount--;
143 if (refcount)
144 goto done;
145 destroy_workqueue(stop_machine_wq);
146 free_percpu(stop_machine_work);
147done:
148 mutex_unlock(&setup_lock);
149}
150EXPORT_SYMBOL_GPL(stop_machine_destroy);
151
112int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus) 152int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
113{ 153{
114 struct work_struct *sm_work; 154 struct work_struct *sm_work;
@@ -146,19 +186,14 @@ int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
146{ 186{
147 int ret; 187 int ret;
148 188
189 ret = stop_machine_create();
190 if (ret)
191 return ret;
149 /* No CPUs can come up or down during this. */ 192 /* No CPUs can come up or down during this. */
150 get_online_cpus(); 193 get_online_cpus();
151 ret = __stop_machine(fn, data, cpus); 194 ret = __stop_machine(fn, data, cpus);
152 put_online_cpus(); 195 put_online_cpus();
153 196 stop_machine_destroy();
154 return ret; 197 return ret;
155} 198}
156EXPORT_SYMBOL_GPL(stop_machine); 199EXPORT_SYMBOL_GPL(stop_machine);
157
158static int __init stop_machine_init(void)
159{
160 stop_machine_wq = create_rt_workqueue("kstop");
161 stop_machine_work = alloc_percpu(struct work_struct);
162 return 0;
163}
164core_initcall(stop_machine_init);
diff --git a/lib/swiotlb.c b/lib/swiotlb.c
index fa2dc4e5f9ba..7f5e21b9c16b 100644
--- a/lib/swiotlb.c
+++ b/lib/swiotlb.c
@@ -23,7 +23,6 @@
23#include <linux/spinlock.h> 23#include <linux/spinlock.h>
24#include <linux/swiotlb.h> 24#include <linux/swiotlb.h>
25#include <linux/string.h> 25#include <linux/string.h>
26#include <linux/swiotlb.h>
27#include <linux/types.h> 26#include <linux/types.h>
28#include <linux/ctype.h> 27#include <linux/ctype.h>
29#include <linux/highmem.h> 28#include <linux/highmem.h>
@@ -116,7 +115,7 @@ setup_io_tlb_npages(char *str)
116__setup("swiotlb=", setup_io_tlb_npages); 115__setup("swiotlb=", setup_io_tlb_npages);
117/* make io_tlb_overflow tunable too? */ 116/* make io_tlb_overflow tunable too? */
118 117
119void * __weak swiotlb_alloc_boot(size_t size, unsigned long nslabs) 118void * __weak __init swiotlb_alloc_boot(size_t size, unsigned long nslabs)
120{ 119{
121 return alloc_bootmem_low_pages(size); 120 return alloc_bootmem_low_pages(size);
122} 121}
diff --git a/mm/filemap.c b/mm/filemap.c
index f8c69273c37f..f5769b4dc075 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1766,7 +1766,7 @@ int should_remove_suid(struct dentry *dentry)
1766 if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) 1766 if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
1767 kill |= ATTR_KILL_SGID; 1767 kill |= ATTR_KILL_SGID;
1768 1768
1769 if (unlikely(kill && !capable(CAP_FSETID))) 1769 if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode)))
1770 return kill; 1770 return kill;
1771 1771
1772 return 0; 1772 return 0;
diff --git a/mm/memory.c b/mm/memory.c
index 0a2010a9518c..7b9db658aca2 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -2266,7 +2266,7 @@ int vmtruncate(struct inode * inode, loff_t offset)
2266 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1); 2266 unmap_mapping_range(mapping, offset + PAGE_SIZE - 1, 0, 1);
2267 } 2267 }
2268 2268
2269 if (inode->i_op && inode->i_op->truncate) 2269 if (inode->i_op->truncate)
2270 inode->i_op->truncate(inode); 2270 inode->i_op->truncate(inode);
2271 return 0; 2271 return 0;
2272 2272
@@ -2286,7 +2286,7 @@ int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end)
2286 * a way to truncate a range of blocks (punch a hole) - 2286 * a way to truncate a range of blocks (punch a hole) -
2287 * we should return failure right now. 2287 * we should return failure right now.
2288 */ 2288 */
2289 if (!inode->i_op || !inode->i_op->truncate_range) 2289 if (!inode->i_op->truncate_range)
2290 return -ENOSYS; 2290 return -ENOSYS;
2291 2291
2292 mutex_lock(&inode->i_mutex); 2292 mutex_lock(&inode->i_mutex);
diff --git a/mm/mmap.c b/mm/mmap.c
index d4855a682ab6..2c778fcfd9bd 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Written by obz. 4 * Written by obz.
5 * 5 *
6 * Address space accounting code <alan@redhat.com> 6 * Address space accounting code <alan@lxorguk.ukuu.org.uk>
7 */ 7 */
8 8
9#include <linux/slab.h> 9#include <linux/slab.h>
diff --git a/mm/mprotect.c b/mm/mprotect.c
index fded06f923f4..cfb4c4852062 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -4,7 +4,7 @@
4 * (C) Copyright 1994 Linus Torvalds 4 * (C) Copyright 1994 Linus Torvalds
5 * (C) Copyright 2002 Christoph Hellwig 5 * (C) Copyright 2002 Christoph Hellwig
6 * 6 *
7 * Address space accounting code <alan@redhat.com> 7 * Address space accounting code <alan@lxorguk.ukuu.org.uk>
8 * (C) Copyright 2002 Red Hat Inc, All Rights Reserved 8 * (C) Copyright 2002 Red Hat Inc, All Rights Reserved
9 */ 9 */
10 10
diff --git a/mm/mremap.c b/mm/mremap.c
index 58a2908f42f5..646de959aa58 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * (C) Copyright 1996 Linus Torvalds 4 * (C) Copyright 1996 Linus Torvalds
5 * 5 *
6 * Address space accounting code <alan@redhat.com> 6 * Address space accounting code <alan@lxorguk.ukuu.org.uk>
7 * (C) Copyright 2002 Red Hat Inc, All Rights Reserved 7 * (C) Copyright 2002 Red Hat Inc, All Rights Reserved
8 */ 8 */
9 9
diff --git a/mm/msync.c b/mm/msync.c
index 144a7570535d..07dae08cf31c 100644
--- a/mm/msync.c
+++ b/mm/msync.c
@@ -82,7 +82,7 @@ asmlinkage long sys_msync(unsigned long start, size_t len, int flags)
82 (vma->vm_flags & VM_SHARED)) { 82 (vma->vm_flags & VM_SHARED)) {
83 get_file(file); 83 get_file(file);
84 up_read(&mm->mmap_sem); 84 up_read(&mm->mmap_sem);
85 error = do_fsync(file, 0); 85 error = vfs_fsync(file, file->f_path.dentry, 0);
86 fput(file); 86 fput(file);
87 if (error || start >= end) 87 if (error || start >= end)
88 goto out; 88 goto out;
diff --git a/mm/nommu.c b/mm/nommu.c
index 7695dc850785..1c28ea3a4e9c 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -86,7 +86,7 @@ do_expand:
86 i_size_write(inode, offset); 86 i_size_write(inode, offset);
87 87
88out_truncate: 88out_truncate:
89 if (inode->i_op && inode->i_op->truncate) 89 if (inode->i_op->truncate)
90 inode->i_op->truncate(inode); 90 inode->i_op->truncate(inode);
91 return 0; 91 return 0;
92out_sig: 92out_sig:
diff --git a/net/can/bcm.c b/net/can/bcm.c
index da0d426c0ce4..6248ae2502c7 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -70,7 +70,7 @@
70 70
71#define CAN_BCM_VERSION CAN_VERSION 71#define CAN_BCM_VERSION CAN_VERSION
72static __initdata const char banner[] = KERN_INFO 72static __initdata const char banner[] = KERN_INFO
73 "can: broadcast manager protocol (rev " CAN_BCM_VERSION ")\n"; 73 "can: broadcast manager protocol (rev " CAN_BCM_VERSION " t)\n";
74 74
75MODULE_DESCRIPTION("PF_CAN broadcast manager protocol"); 75MODULE_DESCRIPTION("PF_CAN broadcast manager protocol");
76MODULE_LICENSE("Dual BSD/GPL"); 76MODULE_LICENSE("Dual BSD/GPL");
@@ -90,6 +90,7 @@ struct bcm_op {
90 unsigned long frames_abs, frames_filtered; 90 unsigned long frames_abs, frames_filtered;
91 struct timeval ival1, ival2; 91 struct timeval ival1, ival2;
92 struct hrtimer timer, thrtimer; 92 struct hrtimer timer, thrtimer;
93 struct tasklet_struct tsklet, thrtsklet;
93 ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg; 94 ktime_t rx_stamp, kt_ival1, kt_ival2, kt_lastmsg;
94 int rx_ifindex; 95 int rx_ifindex;
95 int count; 96 int count;
@@ -341,6 +342,23 @@ static void bcm_send_to_user(struct bcm_op *op, struct bcm_msg_head *head,
341 } 342 }
342} 343}
343 344
345static void bcm_tx_timeout_tsklet(unsigned long data)
346{
347 struct bcm_op *op = (struct bcm_op *)data;
348 struct bcm_msg_head msg_head;
349
350 /* create notification to user */
351 msg_head.opcode = TX_EXPIRED;
352 msg_head.flags = op->flags;
353 msg_head.count = op->count;
354 msg_head.ival1 = op->ival1;
355 msg_head.ival2 = op->ival2;
356 msg_head.can_id = op->can_id;
357 msg_head.nframes = 0;
358
359 bcm_send_to_user(op, &msg_head, NULL, 0);
360}
361
344/* 362/*
345 * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions 363 * bcm_tx_timeout_handler - performes cyclic CAN frame transmissions
346 */ 364 */
@@ -352,20 +370,8 @@ static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer)
352 if (op->kt_ival1.tv64 && (op->count > 0)) { 370 if (op->kt_ival1.tv64 && (op->count > 0)) {
353 371
354 op->count--; 372 op->count--;
355 if (!op->count && (op->flags & TX_COUNTEVT)) { 373 if (!op->count && (op->flags & TX_COUNTEVT))
356 struct bcm_msg_head msg_head; 374 tasklet_schedule(&op->tsklet);
357
358 /* create notification to user */
359 msg_head.opcode = TX_EXPIRED;
360 msg_head.flags = op->flags;
361 msg_head.count = op->count;
362 msg_head.ival1 = op->ival1;
363 msg_head.ival2 = op->ival2;
364 msg_head.can_id = op->can_id;
365 msg_head.nframes = 0;
366
367 bcm_send_to_user(op, &msg_head, NULL, 0);
368 }
369 } 375 }
370 376
371 if (op->kt_ival1.tv64 && (op->count > 0)) { 377 if (op->kt_ival1.tv64 && (op->count > 0)) {
@@ -402,6 +408,9 @@ static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data)
402 if (op->frames_filtered > ULONG_MAX/100) 408 if (op->frames_filtered > ULONG_MAX/100)
403 op->frames_filtered = op->frames_abs = 0; 409 op->frames_filtered = op->frames_abs = 0;
404 410
411 /* this element is not throttled anymore */
412 data->can_dlc &= (BCM_CAN_DLC_MASK|RX_RECV);
413
405 head.opcode = RX_CHANGED; 414 head.opcode = RX_CHANGED;
406 head.flags = op->flags; 415 head.flags = op->flags;
407 head.count = op->count; 416 head.count = op->count;
@@ -420,37 +429,32 @@ static void bcm_rx_changed(struct bcm_op *op, struct can_frame *data)
420 */ 429 */
421static void bcm_rx_update_and_send(struct bcm_op *op, 430static void bcm_rx_update_and_send(struct bcm_op *op,
422 struct can_frame *lastdata, 431 struct can_frame *lastdata,
423 struct can_frame *rxdata) 432 const struct can_frame *rxdata)
424{ 433{
425 memcpy(lastdata, rxdata, CFSIZ); 434 memcpy(lastdata, rxdata, CFSIZ);
426 435
427 /* mark as used */ 436 /* mark as used and throttled by default */
428 lastdata->can_dlc |= RX_RECV; 437 lastdata->can_dlc |= (RX_RECV|RX_THR);
429 438
430 /* throtteling mode inactive OR data update already on the run ? */ 439 /* throtteling mode inactive ? */
431 if (!op->kt_ival2.tv64 || hrtimer_callback_running(&op->thrtimer)) { 440 if (!op->kt_ival2.tv64) {
432 /* send RX_CHANGED to the user immediately */ 441 /* send RX_CHANGED to the user immediately */
433 bcm_rx_changed(op, rxdata); 442 bcm_rx_changed(op, lastdata);
434 return; 443 return;
435 } 444 }
436 445
437 if (hrtimer_active(&op->thrtimer)) { 446 /* with active throttling timer we are just done here */
438 /* mark as 'throttled' */ 447 if (hrtimer_active(&op->thrtimer))
439 lastdata->can_dlc |= RX_THR;
440 return; 448 return;
441 }
442 449
443 if (!op->kt_lastmsg.tv64) { 450 /* first receiption with enabled throttling mode */
444 /* send first RX_CHANGED to the user immediately */ 451 if (!op->kt_lastmsg.tv64)
445 bcm_rx_changed(op, rxdata); 452 goto rx_changed_settime;
446 op->kt_lastmsg = ktime_get();
447 return;
448 }
449 453
454 /* got a second frame inside a potential throttle period? */
450 if (ktime_us_delta(ktime_get(), op->kt_lastmsg) < 455 if (ktime_us_delta(ktime_get(), op->kt_lastmsg) <
451 ktime_to_us(op->kt_ival2)) { 456 ktime_to_us(op->kt_ival2)) {
452 /* mark as 'throttled' and start timer */ 457 /* do not send the saved data - only start throttle timer */
453 lastdata->can_dlc |= RX_THR;
454 hrtimer_start(&op->thrtimer, 458 hrtimer_start(&op->thrtimer,
455 ktime_add(op->kt_lastmsg, op->kt_ival2), 459 ktime_add(op->kt_lastmsg, op->kt_ival2),
456 HRTIMER_MODE_ABS); 460 HRTIMER_MODE_ABS);
@@ -458,7 +462,8 @@ static void bcm_rx_update_and_send(struct bcm_op *op,
458 } 462 }
459 463
460 /* the gap was that big, that throttling was not needed here */ 464 /* the gap was that big, that throttling was not needed here */
461 bcm_rx_changed(op, rxdata); 465rx_changed_settime:
466 bcm_rx_changed(op, lastdata);
462 op->kt_lastmsg = ktime_get(); 467 op->kt_lastmsg = ktime_get();
463} 468}
464 469
@@ -467,7 +472,7 @@ static void bcm_rx_update_and_send(struct bcm_op *op,
467 * received data stored in op->last_frames[] 472 * received data stored in op->last_frames[]
468 */ 473 */
469static void bcm_rx_cmp_to_index(struct bcm_op *op, int index, 474static void bcm_rx_cmp_to_index(struct bcm_op *op, int index,
470 struct can_frame *rxdata) 475 const struct can_frame *rxdata)
471{ 476{
472 /* 477 /*
473 * no one uses the MSBs of can_dlc for comparation, 478 * no one uses the MSBs of can_dlc for comparation,
@@ -511,14 +516,12 @@ static void bcm_rx_starttimer(struct bcm_op *op)
511 hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL); 516 hrtimer_start(&op->timer, op->kt_ival1, HRTIMER_MODE_REL);
512} 517}
513 518
514/* 519static void bcm_rx_timeout_tsklet(unsigned long data)
515 * bcm_rx_timeout_handler - when the (cyclic) CAN frame receiption timed out
516 */
517static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
518{ 520{
519 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer); 521 struct bcm_op *op = (struct bcm_op *)data;
520 struct bcm_msg_head msg_head; 522 struct bcm_msg_head msg_head;
521 523
524 /* create notification to user */
522 msg_head.opcode = RX_TIMEOUT; 525 msg_head.opcode = RX_TIMEOUT;
523 msg_head.flags = op->flags; 526 msg_head.flags = op->flags;
524 msg_head.count = op->count; 527 msg_head.count = op->count;
@@ -528,6 +531,17 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
528 msg_head.nframes = 0; 531 msg_head.nframes = 0;
529 532
530 bcm_send_to_user(op, &msg_head, NULL, 0); 533 bcm_send_to_user(op, &msg_head, NULL, 0);
534}
535
536/*
537 * bcm_rx_timeout_handler - when the (cyclic) CAN frame receiption timed out
538 */
539static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
540{
541 struct bcm_op *op = container_of(hrtimer, struct bcm_op, timer);
542
543 /* schedule before NET_RX_SOFTIRQ */
544 tasklet_hi_schedule(&op->tsklet);
531 545
532 /* no restart of the timer is done here! */ 546 /* no restart of the timer is done here! */
533 547
@@ -541,9 +555,25 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
541} 555}
542 556
543/* 557/*
558 * bcm_rx_do_flush - helper for bcm_rx_thr_flush
559 */
560static inline int bcm_rx_do_flush(struct bcm_op *op, int update, int index)
561{
562 if ((op->last_frames) && (op->last_frames[index].can_dlc & RX_THR)) {
563 if (update)
564 bcm_rx_changed(op, &op->last_frames[index]);
565 return 1;
566 }
567 return 0;
568}
569
570/*
544 * bcm_rx_thr_flush - Check for throttled data and send it to the userspace 571 * bcm_rx_thr_flush - Check for throttled data and send it to the userspace
572 *
573 * update == 0 : just check if throttled data is available (any irq context)
574 * update == 1 : check and send throttled data to userspace (soft_irq context)
545 */ 575 */
546static int bcm_rx_thr_flush(struct bcm_op *op) 576static int bcm_rx_thr_flush(struct bcm_op *op, int update)
547{ 577{
548 int updated = 0; 578 int updated = 0;
549 579
@@ -551,27 +581,25 @@ static int bcm_rx_thr_flush(struct bcm_op *op)
551 int i; 581 int i;
552 582
553 /* for MUX filter we start at index 1 */ 583 /* for MUX filter we start at index 1 */
554 for (i = 1; i < op->nframes; i++) { 584 for (i = 1; i < op->nframes; i++)
555 if ((op->last_frames) && 585 updated += bcm_rx_do_flush(op, update, i);
556 (op->last_frames[i].can_dlc & RX_THR)) {
557 op->last_frames[i].can_dlc &= ~RX_THR;
558 bcm_rx_changed(op, &op->last_frames[i]);
559 updated++;
560 }
561 }
562 586
563 } else { 587 } else {
564 /* for RX_FILTER_ID and simple filter */ 588 /* for RX_FILTER_ID and simple filter */
565 if (op->last_frames && (op->last_frames[0].can_dlc & RX_THR)) { 589 updated += bcm_rx_do_flush(op, update, 0);
566 op->last_frames[0].can_dlc &= ~RX_THR;
567 bcm_rx_changed(op, &op->last_frames[0]);
568 updated++;
569 }
570 } 590 }
571 591
572 return updated; 592 return updated;
573} 593}
574 594
595static void bcm_rx_thr_tsklet(unsigned long data)
596{
597 struct bcm_op *op = (struct bcm_op *)data;
598
599 /* push the changed data to the userspace */
600 bcm_rx_thr_flush(op, 1);
601}
602
575/* 603/*
576 * bcm_rx_thr_handler - the time for blocked content updates is over now: 604 * bcm_rx_thr_handler - the time for blocked content updates is over now:
577 * Check for throttled data and send it to the userspace 605 * Check for throttled data and send it to the userspace
@@ -580,7 +608,9 @@ static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer)
580{ 608{
581 struct bcm_op *op = container_of(hrtimer, struct bcm_op, thrtimer); 609 struct bcm_op *op = container_of(hrtimer, struct bcm_op, thrtimer);
582 610
583 if (bcm_rx_thr_flush(op)) { 611 tasklet_schedule(&op->thrtsklet);
612
613 if (bcm_rx_thr_flush(op, 0)) {
584 hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2); 614 hrtimer_forward(hrtimer, ktime_get(), op->kt_ival2);
585 return HRTIMER_RESTART; 615 return HRTIMER_RESTART;
586 } else { 616 } else {
@@ -596,48 +626,38 @@ static enum hrtimer_restart bcm_rx_thr_handler(struct hrtimer *hrtimer)
596static void bcm_rx_handler(struct sk_buff *skb, void *data) 626static void bcm_rx_handler(struct sk_buff *skb, void *data)
597{ 627{
598 struct bcm_op *op = (struct bcm_op *)data; 628 struct bcm_op *op = (struct bcm_op *)data;
599 struct can_frame rxframe; 629 const struct can_frame *rxframe = (struct can_frame *)skb->data;
600 int i; 630 int i;
601 631
602 /* disable timeout */ 632 /* disable timeout */
603 hrtimer_cancel(&op->timer); 633 hrtimer_cancel(&op->timer);
604 634
605 if (skb->len == sizeof(rxframe)) { 635 if (op->can_id != rxframe->can_id)
606 memcpy(&rxframe, skb->data, sizeof(rxframe)); 636 goto rx_freeskb;
607 /* save rx timestamp */
608 op->rx_stamp = skb->tstamp;
609 /* save originator for recvfrom() */
610 op->rx_ifindex = skb->dev->ifindex;
611 /* update statistics */
612 op->frames_abs++;
613 kfree_skb(skb);
614 637
615 } else { 638 /* save rx timestamp */
616 kfree_skb(skb); 639 op->rx_stamp = skb->tstamp;
617 return; 640 /* save originator for recvfrom() */
618 } 641 op->rx_ifindex = skb->dev->ifindex;
619 642 /* update statistics */
620 if (op->can_id != rxframe.can_id) 643 op->frames_abs++;
621 return;
622 644
623 if (op->flags & RX_RTR_FRAME) { 645 if (op->flags & RX_RTR_FRAME) {
624 /* send reply for RTR-request (placed in op->frames[0]) */ 646 /* send reply for RTR-request (placed in op->frames[0]) */
625 bcm_can_tx(op); 647 bcm_can_tx(op);
626 return; 648 goto rx_freeskb;
627 } 649 }
628 650
629 if (op->flags & RX_FILTER_ID) { 651 if (op->flags & RX_FILTER_ID) {
630 /* the easiest case */ 652 /* the easiest case */
631 bcm_rx_update_and_send(op, &op->last_frames[0], &rxframe); 653 bcm_rx_update_and_send(op, &op->last_frames[0], rxframe);
632 bcm_rx_starttimer(op); 654 goto rx_freeskb_starttimer;
633 return;
634 } 655 }
635 656
636 if (op->nframes == 1) { 657 if (op->nframes == 1) {
637 /* simple compare with index 0 */ 658 /* simple compare with index 0 */
638 bcm_rx_cmp_to_index(op, 0, &rxframe); 659 bcm_rx_cmp_to_index(op, 0, rxframe);
639 bcm_rx_starttimer(op); 660 goto rx_freeskb_starttimer;
640 return;
641 } 661 }
642 662
643 if (op->nframes > 1) { 663 if (op->nframes > 1) {
@@ -649,15 +669,19 @@ static void bcm_rx_handler(struct sk_buff *skb, void *data)
649 */ 669 */
650 670
651 for (i = 1; i < op->nframes; i++) { 671 for (i = 1; i < op->nframes; i++) {
652 if ((GET_U64(&op->frames[0]) & GET_U64(&rxframe)) == 672 if ((GET_U64(&op->frames[0]) & GET_U64(rxframe)) ==
653 (GET_U64(&op->frames[0]) & 673 (GET_U64(&op->frames[0]) &
654 GET_U64(&op->frames[i]))) { 674 GET_U64(&op->frames[i]))) {
655 bcm_rx_cmp_to_index(op, i, &rxframe); 675 bcm_rx_cmp_to_index(op, i, rxframe);
656 break; 676 break;
657 } 677 }
658 } 678 }
659 bcm_rx_starttimer(op);
660 } 679 }
680
681rx_freeskb_starttimer:
682 bcm_rx_starttimer(op);
683rx_freeskb:
684 kfree_skb(skb);
661} 685}
662 686
663/* 687/*
@@ -681,6 +705,12 @@ static void bcm_remove_op(struct bcm_op *op)
681 hrtimer_cancel(&op->timer); 705 hrtimer_cancel(&op->timer);
682 hrtimer_cancel(&op->thrtimer); 706 hrtimer_cancel(&op->thrtimer);
683 707
708 if (op->tsklet.func)
709 tasklet_kill(&op->tsklet);
710
711 if (op->thrtsklet.func)
712 tasklet_kill(&op->thrtsklet);
713
684 if ((op->frames) && (op->frames != &op->sframe)) 714 if ((op->frames) && (op->frames != &op->sframe))
685 kfree(op->frames); 715 kfree(op->frames);
686 716
@@ -891,6 +921,10 @@ static int bcm_tx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
891 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 921 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
892 op->timer.function = bcm_tx_timeout_handler; 922 op->timer.function = bcm_tx_timeout_handler;
893 923
924 /* initialize tasklet for tx countevent notification */
925 tasklet_init(&op->tsklet, bcm_tx_timeout_tsklet,
926 (unsigned long) op);
927
894 /* currently unused in tx_ops */ 928 /* currently unused in tx_ops */
895 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 929 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
896 930
@@ -1054,9 +1088,17 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1054 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1088 hrtimer_init(&op->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1055 op->timer.function = bcm_rx_timeout_handler; 1089 op->timer.function = bcm_rx_timeout_handler;
1056 1090
1091 /* initialize tasklet for rx timeout notification */
1092 tasklet_init(&op->tsklet, bcm_rx_timeout_tsklet,
1093 (unsigned long) op);
1094
1057 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); 1095 hrtimer_init(&op->thrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
1058 op->thrtimer.function = bcm_rx_thr_handler; 1096 op->thrtimer.function = bcm_rx_thr_handler;
1059 1097
1098 /* initialize tasklet for rx throttle handling */
1099 tasklet_init(&op->thrtsklet, bcm_rx_thr_tsklet,
1100 (unsigned long) op);
1101
1060 /* add this bcm_op to the list of the rx_ops */ 1102 /* add this bcm_op to the list of the rx_ops */
1061 list_add(&op->list, &bo->rx_ops); 1103 list_add(&op->list, &bo->rx_ops);
1062 1104
@@ -1102,7 +1144,7 @@ static int bcm_rx_setup(struct bcm_msg_head *msg_head, struct msghdr *msg,
1102 */ 1144 */
1103 op->kt_lastmsg = ktime_set(0, 0); 1145 op->kt_lastmsg = ktime_set(0, 0);
1104 hrtimer_cancel(&op->thrtimer); 1146 hrtimer_cancel(&op->thrtimer);
1105 bcm_rx_thr_flush(op); 1147 bcm_rx_thr_flush(op, 1);
1106 } 1148 }
1107 1149
1108 if ((op->flags & STARTTIMER) && op->kt_ival1.tv64) 1150 if ((op->flags & STARTTIMER) && op->kt_ival1.tv64)
diff --git a/net/core/dev.c b/net/core/dev.c
index 09c66a449da6..382df6c09eec 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -132,6 +132,9 @@
132/* Instead of increasing this, you should create a hash table. */ 132/* Instead of increasing this, you should create a hash table. */
133#define MAX_GRO_SKBS 8 133#define MAX_GRO_SKBS 8
134 134
135/* This should be increased if a protocol with a bigger head is added. */
136#define GRO_MAX_HEAD (MAX_HEADER + 128)
137
135/* 138/*
136 * The list of packet types we will receive (as opposed to discard) 139 * The list of packet types we will receive (as opposed to discard)
137 * and the routines to invoke. 140 * and the routines to invoke.
@@ -2345,7 +2348,7 @@ static int napi_gro_complete(struct sk_buff *skb)
2345 struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK]; 2348 struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
2346 int err = -ENOENT; 2349 int err = -ENOENT;
2347 2350
2348 if (!skb_shinfo(skb)->frag_list) 2351 if (NAPI_GRO_CB(skb)->count == 1)
2349 goto out; 2352 goto out;
2350 2353
2351 rcu_read_lock(); 2354 rcu_read_lock();
@@ -2365,6 +2368,7 @@ static int napi_gro_complete(struct sk_buff *skb)
2365 } 2368 }
2366 2369
2367out: 2370out:
2371 skb_shinfo(skb)->gso_size = 0;
2368 __skb_push(skb, -skb_network_offset(skb)); 2372 __skb_push(skb, -skb_network_offset(skb));
2369 return netif_receive_skb(skb); 2373 return netif_receive_skb(skb);
2370} 2374}
@@ -2383,7 +2387,7 @@ void napi_gro_flush(struct napi_struct *napi)
2383} 2387}
2384EXPORT_SYMBOL(napi_gro_flush); 2388EXPORT_SYMBOL(napi_gro_flush);
2385 2389
2386int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb) 2390static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2387{ 2391{
2388 struct sk_buff **pp = NULL; 2392 struct sk_buff **pp = NULL;
2389 struct packet_type *ptype; 2393 struct packet_type *ptype;
@@ -2392,6 +2396,7 @@ int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2392 int count = 0; 2396 int count = 0;
2393 int same_flow; 2397 int same_flow;
2394 int mac_len; 2398 int mac_len;
2399 int free;
2395 2400
2396 if (!(skb->dev->features & NETIF_F_GRO)) 2401 if (!(skb->dev->features & NETIF_F_GRO))
2397 goto normal; 2402 goto normal;
@@ -2408,6 +2413,7 @@ int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2408 skb->mac_len = mac_len; 2413 skb->mac_len = mac_len;
2409 NAPI_GRO_CB(skb)->same_flow = 0; 2414 NAPI_GRO_CB(skb)->same_flow = 0;
2410 NAPI_GRO_CB(skb)->flush = 0; 2415 NAPI_GRO_CB(skb)->flush = 0;
2416 NAPI_GRO_CB(skb)->free = 0;
2411 2417
2412 for (p = napi->gro_list; p; p = p->next) { 2418 for (p = napi->gro_list; p; p = p->next) {
2413 count++; 2419 count++;
@@ -2427,6 +2433,7 @@ int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2427 goto normal; 2433 goto normal;
2428 2434
2429 same_flow = NAPI_GRO_CB(skb)->same_flow; 2435 same_flow = NAPI_GRO_CB(skb)->same_flow;
2436 free = NAPI_GRO_CB(skb)->free;
2430 2437
2431 if (pp) { 2438 if (pp) {
2432 struct sk_buff *nskb = *pp; 2439 struct sk_buff *nskb = *pp;
@@ -2446,17 +2453,91 @@ int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2446 } 2453 }
2447 2454
2448 NAPI_GRO_CB(skb)->count = 1; 2455 NAPI_GRO_CB(skb)->count = 1;
2456 skb_shinfo(skb)->gso_size = skb->len;
2449 skb->next = napi->gro_list; 2457 skb->next = napi->gro_list;
2450 napi->gro_list = skb; 2458 napi->gro_list = skb;
2451 2459
2452ok: 2460ok:
2453 return NET_RX_SUCCESS; 2461 return free;
2454 2462
2455normal: 2463normal:
2456 return netif_receive_skb(skb); 2464 return -1;
2465}
2466
2467int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
2468{
2469 switch (__napi_gro_receive(napi, skb)) {
2470 case -1:
2471 return netif_receive_skb(skb);
2472
2473 case 1:
2474 kfree_skb(skb);
2475 break;
2476 }
2477
2478 return NET_RX_SUCCESS;
2457} 2479}
2458EXPORT_SYMBOL(napi_gro_receive); 2480EXPORT_SYMBOL(napi_gro_receive);
2459 2481
2482int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
2483{
2484 struct net_device *dev = napi->dev;
2485 struct sk_buff *skb = napi->skb;
2486 int err = NET_RX_DROP;
2487
2488 napi->skb = NULL;
2489
2490 if (!skb) {
2491 skb = netdev_alloc_skb(dev, GRO_MAX_HEAD + NET_IP_ALIGN);
2492 if (!skb)
2493 goto out;
2494
2495 skb_reserve(skb, NET_IP_ALIGN);
2496 }
2497
2498 BUG_ON(info->nr_frags > MAX_SKB_FRAGS);
2499 skb_shinfo(skb)->nr_frags = info->nr_frags;
2500 memcpy(skb_shinfo(skb)->frags, info->frags, sizeof(info->frags));
2501
2502 skb->data_len = info->len;
2503 skb->len += info->len;
2504 skb->truesize += info->len;
2505
2506 if (!pskb_may_pull(skb, ETH_HLEN))
2507 goto reuse;
2508
2509 err = NET_RX_SUCCESS;
2510
2511 skb->protocol = eth_type_trans(skb, dev);
2512
2513 skb->ip_summed = info->ip_summed;
2514 skb->csum = info->csum;
2515
2516 switch (__napi_gro_receive(napi, skb)) {
2517 case -1:
2518 return netif_receive_skb(skb);
2519
2520 case 0:
2521 goto out;
2522 }
2523
2524reuse:
2525 skb_shinfo(skb)->nr_frags = 0;
2526
2527 skb->len -= skb->data_len;
2528 skb->truesize -= skb->data_len;
2529 skb->data_len = 0;
2530
2531 __skb_pull(skb, skb_headlen(skb));
2532 skb_reserve(skb, NET_IP_ALIGN - skb_headroom(skb));
2533
2534 napi->skb = skb;
2535
2536out:
2537 return err;
2538}
2539EXPORT_SYMBOL(napi_gro_frags);
2540
2460static int process_backlog(struct napi_struct *napi, int quota) 2541static int process_backlog(struct napi_struct *napi, int quota)
2461{ 2542{
2462 int work = 0; 2543 int work = 0;
@@ -2535,11 +2616,12 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
2535{ 2616{
2536 INIT_LIST_HEAD(&napi->poll_list); 2617 INIT_LIST_HEAD(&napi->poll_list);
2537 napi->gro_list = NULL; 2618 napi->gro_list = NULL;
2619 napi->skb = NULL;
2538 napi->poll = poll; 2620 napi->poll = poll;
2539 napi->weight = weight; 2621 napi->weight = weight;
2540 list_add(&napi->dev_list, &dev->napi_list); 2622 list_add(&napi->dev_list, &dev->napi_list);
2541#ifdef CONFIG_NETPOLL
2542 napi->dev = dev; 2623 napi->dev = dev;
2624#ifdef CONFIG_NETPOLL
2543 spin_lock_init(&napi->poll_lock); 2625 spin_lock_init(&napi->poll_lock);
2544 napi->poll_owner = -1; 2626 napi->poll_owner = -1;
2545#endif 2627#endif
@@ -2552,6 +2634,7 @@ void netif_napi_del(struct napi_struct *napi)
2552 struct sk_buff *skb, *next; 2634 struct sk_buff *skb, *next;
2553 2635
2554 list_del_init(&napi->dev_list); 2636 list_del_init(&napi->dev_list);
2637 kfree(napi->skb);
2555 2638
2556 for (skb = napi->gro_list; skb; skb = next) { 2639 for (skb = napi->gro_list; skb; skb = next) {
2557 next = skb->next; 2640 next = skb->next;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b8d0abb26433..5110b359c758 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2594,6 +2594,17 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2594 2594
2595 if (skb_shinfo(p)->frag_list) 2595 if (skb_shinfo(p)->frag_list)
2596 goto merge; 2596 goto merge;
2597 else if (!skb_headlen(p) && !skb_headlen(skb) &&
2598 skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags <
2599 MAX_SKB_FRAGS) {
2600 memcpy(skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags,
2601 skb_shinfo(skb)->frags,
2602 skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
2603
2604 skb_shinfo(p)->nr_frags += skb_shinfo(skb)->nr_frags;
2605 NAPI_GRO_CB(skb)->free = 1;
2606 goto done;
2607 }
2597 2608
2598 headroom = skb_headroom(p); 2609 headroom = skb_headroom(p);
2599 nskb = netdev_alloc_skb(p->dev, headroom); 2610 nskb = netdev_alloc_skb(p->dev, headroom);
@@ -2613,6 +2624,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2613 2624
2614 *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p); 2625 *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p);
2615 skb_shinfo(nskb)->frag_list = p; 2626 skb_shinfo(nskb)->frag_list = p;
2627 skb_shinfo(nskb)->gso_size = skb_shinfo(p)->gso_size;
2616 skb_header_release(p); 2628 skb_header_release(p);
2617 nskb->prev = p; 2629 nskb->prev = p;
2618 2630
@@ -2627,11 +2639,12 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
2627 p = nskb; 2639 p = nskb;
2628 2640
2629merge: 2641merge:
2630 NAPI_GRO_CB(p)->count++;
2631 p->prev->next = skb; 2642 p->prev->next = skb;
2632 p->prev = skb; 2643 p->prev = skb;
2633 skb_header_release(skb); 2644 skb_header_release(skb);
2634 2645
2646done:
2647 NAPI_GRO_CB(p)->count++;
2635 p->data_len += skb->len; 2648 p->data_len += skb->len;
2636 p->truesize += skb->len; 2649 p->truesize += skb->len;
2637 p->len += skb->len; 2650 p->len += skb->len;
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 5dbfe5fdc0d6..8379496de82b 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -191,7 +191,7 @@ static int dcbnl_reply(u8 value, u8 event, u8 cmd, u8 attr, u32 pid,
191 return 0; 191 return 0;
192nlmsg_failure: 192nlmsg_failure:
193err: 193err:
194 kfree(dcbnl_skb); 194 kfree_skb(dcbnl_skb);
195 return ret; 195 return ret;
196} 196}
197 197
@@ -272,7 +272,7 @@ static int dcbnl_getpfccfg(struct net_device *netdev, struct nlattr **tb,
272 return 0; 272 return 0;
273nlmsg_failure: 273nlmsg_failure:
274err: 274err:
275 kfree(dcbnl_skb); 275 kfree_skb(dcbnl_skb);
276err_out: 276err_out:
277 return -EINVAL; 277 return -EINVAL;
278} 278}
@@ -314,7 +314,7 @@ static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlattr **tb,
314 314
315nlmsg_failure: 315nlmsg_failure:
316err: 316err:
317 kfree(dcbnl_skb); 317 kfree_skb(dcbnl_skb);
318err_out: 318err_out:
319 return -EINVAL; 319 return -EINVAL;
320} 320}
@@ -380,7 +380,7 @@ static int dcbnl_getcap(struct net_device *netdev, struct nlattr **tb,
380 return 0; 380 return 0;
381nlmsg_failure: 381nlmsg_failure:
382err: 382err:
383 kfree(dcbnl_skb); 383 kfree_skb(dcbnl_skb);
384err_out: 384err_out:
385 return -EINVAL; 385 return -EINVAL;
386} 386}
@@ -458,7 +458,7 @@ static int dcbnl_getnumtcs(struct net_device *netdev, struct nlattr **tb,
458 return 0; 458 return 0;
459nlmsg_failure: 459nlmsg_failure:
460err: 460err:
461 kfree(dcbnl_skb); 461 kfree_skb(dcbnl_skb);
462err_out: 462err_out:
463 return ret; 463 return ret;
464} 464}
@@ -687,7 +687,7 @@ err_pg:
687 nla_nest_cancel(dcbnl_skb, pg_nest); 687 nla_nest_cancel(dcbnl_skb, pg_nest);
688nlmsg_failure: 688nlmsg_failure:
689err: 689err:
690 kfree(dcbnl_skb); 690 kfree_skb(dcbnl_skb);
691err_out: 691err_out:
692 ret = -EINVAL; 692 ret = -EINVAL;
693 return ret; 693 return ret;
@@ -949,7 +949,7 @@ err_bcn:
949 nla_nest_cancel(dcbnl_skb, bcn_nest); 949 nla_nest_cancel(dcbnl_skb, bcn_nest);
950nlmsg_failure: 950nlmsg_failure:
951err: 951err:
952 kfree(dcbnl_skb); 952 kfree_skb(dcbnl_skb);
953err_out: 953err_out:
954 ret = -EINVAL; 954 ret = -EINVAL;
955 return ret; 955 return ret;
diff --git a/net/dccp/Kconfig b/net/dccp/Kconfig
index 7aa2a7acc7ec..ad6dffd9070e 100644
--- a/net/dccp/Kconfig
+++ b/net/dccp/Kconfig
@@ -1,7 +1,6 @@
1menuconfig IP_DCCP 1menuconfig IP_DCCP
2 tristate "The DCCP Protocol (EXPERIMENTAL)" 2 tristate "The DCCP Protocol (EXPERIMENTAL)"
3 depends on INET && EXPERIMENTAL 3 depends on INET && EXPERIMENTAL
4 select IP_DCCP_CCID2
5 ---help--- 4 ---help---
6 Datagram Congestion Control Protocol (RFC 4340) 5 Datagram Congestion Control Protocol (RFC 4340)
7 6
@@ -25,9 +24,6 @@ config INET_DCCP_DIAG
25 def_tristate y if (IP_DCCP = y && INET_DIAG = y) 24 def_tristate y if (IP_DCCP = y && INET_DIAG = y)
26 def_tristate m 25 def_tristate m
27 26
28config IP_DCCP_ACKVEC
29 bool
30
31source "net/dccp/ccids/Kconfig" 27source "net/dccp/ccids/Kconfig"
32 28
33menu "DCCP Kernel Hacking" 29menu "DCCP Kernel Hacking"
diff --git a/net/dccp/Makefile b/net/dccp/Makefile
index f4f8793aafff..2991efcc8dea 100644
--- a/net/dccp/Makefile
+++ b/net/dccp/Makefile
@@ -2,14 +2,23 @@ obj-$(CONFIG_IP_DCCP) += dccp.o dccp_ipv4.o
2 2
3dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o 3dccp-y := ccid.o feat.o input.o minisocks.o options.o output.o proto.o timer.o
4 4
5#
6# CCID algorithms to be used by dccp.ko
7#
8# CCID-2 is default (RFC 4340, p. 77) and has Ack Vectors as dependency
9dccp-y += ccids/ccid2.o ackvec.o
10dccp-$(CONFIG_IP_DCCP_CCID3) += ccids/ccid3.o
11dccp-$(CONFIG_IP_DCCP_TFRC_LIB) += ccids/lib/tfrc.o \
12 ccids/lib/tfrc_equation.o \
13 ccids/lib/packet_history.o \
14 ccids/lib/loss_interval.o
15
5dccp_ipv4-y := ipv4.o 16dccp_ipv4-y := ipv4.o
6 17
7# build dccp_ipv6 as module whenever either IPv6 or DCCP is a module 18# build dccp_ipv6 as module whenever either IPv6 or DCCP is a module
8obj-$(subst y,$(CONFIG_IP_DCCP),$(CONFIG_IPV6)) += dccp_ipv6.o 19obj-$(subst y,$(CONFIG_IP_DCCP),$(CONFIG_IPV6)) += dccp_ipv6.o
9dccp_ipv6-y := ipv6.o 20dccp_ipv6-y := ipv6.o
10 21
11dccp-$(CONFIG_IP_DCCP_ACKVEC) += ackvec.o
12
13obj-$(CONFIG_INET_DCCP_DIAG) += dccp_diag.o 22obj-$(CONFIG_INET_DCCP_DIAG) += dccp_diag.o
14obj-$(CONFIG_NET_DCCPPROBE) += dccp_probe.o 23obj-$(CONFIG_NET_DCCPPROBE) += dccp_probe.o
15 24
@@ -17,5 +26,3 @@ dccp-$(CONFIG_SYSCTL) += sysctl.o
17 26
18dccp_diag-y := diag.o 27dccp_diag-y := diag.o
19dccp_probe-y := probe.o 28dccp_probe-y := probe.o
20
21obj-y += ccids/
diff --git a/net/dccp/ackvec.h b/net/dccp/ackvec.h
index 4ccee030524e..45f95e55f873 100644
--- a/net/dccp/ackvec.h
+++ b/net/dccp/ackvec.h
@@ -84,7 +84,6 @@ struct dccp_ackvec_record {
84struct sock; 84struct sock;
85struct sk_buff; 85struct sk_buff;
86 86
87#ifdef CONFIG_IP_DCCP_ACKVEC
88extern int dccp_ackvec_init(void); 87extern int dccp_ackvec_init(void);
89extern void dccp_ackvec_exit(void); 88extern void dccp_ackvec_exit(void);
90 89
@@ -106,52 +105,4 @@ static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
106{ 105{
107 return av->av_vec_len; 106 return av->av_vec_len;
108} 107}
109#else /* CONFIG_IP_DCCP_ACKVEC */
110static inline int dccp_ackvec_init(void)
111{
112 return 0;
113}
114
115static inline void dccp_ackvec_exit(void)
116{
117}
118
119static inline struct dccp_ackvec *dccp_ackvec_alloc(const gfp_t priority)
120{
121 return NULL;
122}
123
124static inline void dccp_ackvec_free(struct dccp_ackvec *av)
125{
126}
127
128static inline int dccp_ackvec_add(struct dccp_ackvec *av, const struct sock *sk,
129 const u64 ackno, const u8 state)
130{
131 return -1;
132}
133
134static inline void dccp_ackvec_check_rcv_ackno(struct dccp_ackvec *av,
135 struct sock *sk, const u64 ackno)
136{
137}
138
139static inline int dccp_ackvec_parse(struct sock *sk, const struct sk_buff *skb,
140 const u64 *ackno, const u8 opt,
141 const u8 *value, const u8 len)
142{
143 return -1;
144}
145
146static inline int dccp_insert_option_ackvec(const struct sock *sk,
147 const struct sk_buff *skb)
148{
149 return -1;
150}
151
152static inline int dccp_ackvec_pending(const struct dccp_ackvec *av)
153{
154 return 0;
155}
156#endif /* CONFIG_IP_DCCP_ACKVEC */
157#endif /* _ACKVEC_H */ 108#endif /* _ACKVEC_H */
diff --git a/net/dccp/ccid.c b/net/dccp/ccid.c
index bcc643f992ae..f3e9ba1cfd01 100644
--- a/net/dccp/ccid.c
+++ b/net/dccp/ccid.c
@@ -12,56 +12,70 @@
12 */ 12 */
13 13
14#include "ccid.h" 14#include "ccid.h"
15#include "ccids/lib/tfrc.h"
15 16
16static u8 builtin_ccids[] = { 17static struct ccid_operations *ccids[] = {
17 DCCPC_CCID2, /* CCID2 is supported by default */ 18 &ccid2_ops,
18#if defined(CONFIG_IP_DCCP_CCID3) || defined(CONFIG_IP_DCCP_CCID3_MODULE) 19#ifdef CONFIG_IP_DCCP_CCID3
19 DCCPC_CCID3, 20 &ccid3_ops,
20#endif 21#endif
21}; 22};
22 23
23static struct ccid_operations *ccids[CCID_MAX]; 24static struct ccid_operations *ccid_by_number(const u8 id)
24#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT)
25static atomic_t ccids_lockct = ATOMIC_INIT(0);
26static DEFINE_SPINLOCK(ccids_lock);
27
28/*
29 * The strategy is: modifications ccids vector are short, do not sleep and
30 * veeery rare, but read access should be free of any exclusive locks.
31 */
32static void ccids_write_lock(void)
33{ 25{
34 spin_lock(&ccids_lock); 26 int i;
35 while (atomic_read(&ccids_lockct) != 0) { 27
36 spin_unlock(&ccids_lock); 28 for (i = 0; i < ARRAY_SIZE(ccids); i++)
37 yield(); 29 if (ccids[i]->ccid_id == id)
38 spin_lock(&ccids_lock); 30 return ccids[i];
39 } 31 return NULL;
40} 32}
41 33
42static inline void ccids_write_unlock(void) 34/* check that up to @array_len members in @ccid_array are supported */
35bool ccid_support_check(u8 const *ccid_array, u8 array_len)
43{ 36{
44 spin_unlock(&ccids_lock); 37 while (array_len > 0)
38 if (ccid_by_number(ccid_array[--array_len]) == NULL)
39 return false;
40 return true;
45} 41}
46 42
47static inline void ccids_read_lock(void) 43/**
44 * ccid_get_builtin_ccids - Populate a list of built-in CCIDs
45 * @ccid_array: pointer to copy into
46 * @array_len: value to return length into
47 * This function allocates memory - caller must see that it is freed after use.
48 */
49int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len)
48{ 50{
49 atomic_inc(&ccids_lockct); 51 *ccid_array = kmalloc(ARRAY_SIZE(ccids), gfp_any());
50 smp_mb__after_atomic_inc(); 52 if (*ccid_array == NULL)
51 spin_unlock_wait(&ccids_lock); 53 return -ENOBUFS;
54
55 for (*array_len = 0; *array_len < ARRAY_SIZE(ccids); *array_len += 1)
56 (*ccid_array)[*array_len] = ccids[*array_len]->ccid_id;
57 return 0;
52} 58}
53 59
54static inline void ccids_read_unlock(void) 60int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
61 char __user *optval, int __user *optlen)
55{ 62{
56 atomic_dec(&ccids_lockct); 63 u8 *ccid_array, array_len;
57} 64 int err = 0;
58 65
59#else 66 if (len < ARRAY_SIZE(ccids))
60#define ccids_write_lock() do { } while(0) 67 return -EINVAL;
61#define ccids_write_unlock() do { } while(0) 68
62#define ccids_read_lock() do { } while(0) 69 if (ccid_get_builtin_ccids(&ccid_array, &array_len))
63#define ccids_read_unlock() do { } while(0) 70 return -ENOBUFS;
64#endif 71
72 if (put_user(array_len, optlen) ||
73 copy_to_user(optval, ccid_array, array_len))
74 err = -EFAULT;
75
76 kfree(ccid_array);
77 return err;
78}
65 79
66static struct kmem_cache *ccid_kmem_cache_create(int obj_size, const char *fmt,...) 80static struct kmem_cache *ccid_kmem_cache_create(int obj_size, const char *fmt,...)
67{ 81{
@@ -93,48 +107,7 @@ static void ccid_kmem_cache_destroy(struct kmem_cache *slab)
93 } 107 }
94} 108}
95 109
96/* check that up to @array_len members in @ccid_array are supported */ 110static int ccid_activate(struct ccid_operations *ccid_ops)
97bool ccid_support_check(u8 const *ccid_array, u8 array_len)
98{
99 u8 i, j, found;
100
101 for (i = 0, found = 0; i < array_len; i++, found = 0) {
102 for (j = 0; !found && j < ARRAY_SIZE(builtin_ccids); j++)
103 found = (ccid_array[i] == builtin_ccids[j]);
104 if (!found)
105 return false;
106 }
107 return true;
108}
109
110/**
111 * ccid_get_builtin_ccids - Provide copy of `builtin' CCID array
112 * @ccid_array: pointer to copy into
113 * @array_len: value to return length into
114 * This function allocates memory - caller must see that it is freed after use.
115 */
116int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len)
117{
118 *ccid_array = kmemdup(builtin_ccids, sizeof(builtin_ccids), gfp_any());
119 if (*ccid_array == NULL)
120 return -ENOBUFS;
121 *array_len = ARRAY_SIZE(builtin_ccids);
122 return 0;
123}
124
125int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
126 char __user *optval, int __user *optlen)
127{
128 if (len < sizeof(builtin_ccids))
129 return -EINVAL;
130
131 if (put_user(sizeof(builtin_ccids), optlen) ||
132 copy_to_user(optval, builtin_ccids, sizeof(builtin_ccids)))
133 return -EFAULT;
134 return 0;
135}
136
137int ccid_register(struct ccid_operations *ccid_ops)
138{ 111{
139 int err = -ENOBUFS; 112 int err = -ENOBUFS;
140 113
@@ -152,79 +125,40 @@ int ccid_register(struct ccid_operations *ccid_ops)
152 if (ccid_ops->ccid_hc_tx_slab == NULL) 125 if (ccid_ops->ccid_hc_tx_slab == NULL)
153 goto out_free_rx_slab; 126 goto out_free_rx_slab;
154 127
155 ccids_write_lock(); 128 pr_info("CCID: Activated CCID %d (%s)\n",
156 err = -EEXIST;
157 if (ccids[ccid_ops->ccid_id] == NULL) {
158 ccids[ccid_ops->ccid_id] = ccid_ops;
159 err = 0;
160 }
161 ccids_write_unlock();
162 if (err != 0)
163 goto out_free_tx_slab;
164
165 pr_info("CCID: Registered CCID %d (%s)\n",
166 ccid_ops->ccid_id, ccid_ops->ccid_name); 129 ccid_ops->ccid_id, ccid_ops->ccid_name);
130 err = 0;
167out: 131out:
168 return err; 132 return err;
169out_free_tx_slab:
170 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_tx_slab);
171 ccid_ops->ccid_hc_tx_slab = NULL;
172 goto out;
173out_free_rx_slab: 133out_free_rx_slab:
174 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab); 134 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab);
175 ccid_ops->ccid_hc_rx_slab = NULL; 135 ccid_ops->ccid_hc_rx_slab = NULL;
176 goto out; 136 goto out;
177} 137}
178 138
179EXPORT_SYMBOL_GPL(ccid_register); 139static void ccid_deactivate(struct ccid_operations *ccid_ops)
180
181int ccid_unregister(struct ccid_operations *ccid_ops)
182{ 140{
183 ccids_write_lock();
184 ccids[ccid_ops->ccid_id] = NULL;
185 ccids_write_unlock();
186
187 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_tx_slab); 141 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_tx_slab);
188 ccid_ops->ccid_hc_tx_slab = NULL; 142 ccid_ops->ccid_hc_tx_slab = NULL;
189 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab); 143 ccid_kmem_cache_destroy(ccid_ops->ccid_hc_rx_slab);
190 ccid_ops->ccid_hc_rx_slab = NULL; 144 ccid_ops->ccid_hc_rx_slab = NULL;
191 145
192 pr_info("CCID: Unregistered CCID %d (%s)\n", 146 pr_info("CCID: Deactivated CCID %d (%s)\n",
193 ccid_ops->ccid_id, ccid_ops->ccid_name); 147 ccid_ops->ccid_id, ccid_ops->ccid_name);
194 return 0;
195} 148}
196 149
197EXPORT_SYMBOL_GPL(ccid_unregister); 150struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx)
198
199struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, gfp_t gfp)
200{ 151{
201 struct ccid_operations *ccid_ops; 152 struct ccid_operations *ccid_ops = ccid_by_number(id);
202 struct ccid *ccid = NULL; 153 struct ccid *ccid = NULL;
203 154
204 ccids_read_lock();
205#ifdef CONFIG_MODULES
206 if (ccids[id] == NULL) {
207 /* We only try to load if in process context */
208 ccids_read_unlock();
209 if (gfp & GFP_ATOMIC)
210 goto out;
211 request_module("net-dccp-ccid-%d", id);
212 ccids_read_lock();
213 }
214#endif
215 ccid_ops = ccids[id];
216 if (ccid_ops == NULL) 155 if (ccid_ops == NULL)
217 goto out_unlock; 156 goto out;
218
219 if (!try_module_get(ccid_ops->ccid_owner))
220 goto out_unlock;
221
222 ccids_read_unlock();
223 157
224 ccid = kmem_cache_alloc(rx ? ccid_ops->ccid_hc_rx_slab : 158 ccid = kmem_cache_alloc(rx ? ccid_ops->ccid_hc_rx_slab :
225 ccid_ops->ccid_hc_tx_slab, gfp); 159 ccid_ops->ccid_hc_tx_slab, gfp_any());
226 if (ccid == NULL) 160 if (ccid == NULL)
227 goto out_module_put; 161 goto out;
228 ccid->ccid_ops = ccid_ops; 162 ccid->ccid_ops = ccid_ops;
229 if (rx) { 163 if (rx) {
230 memset(ccid + 1, 0, ccid_ops->ccid_hc_rx_obj_size); 164 memset(ccid + 1, 0, ccid_ops->ccid_hc_rx_obj_size);
@@ -239,53 +173,57 @@ struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, gfp_t gfp)
239 } 173 }
240out: 174out:
241 return ccid; 175 return ccid;
242out_unlock:
243 ccids_read_unlock();
244 goto out;
245out_free_ccid: 176out_free_ccid:
246 kmem_cache_free(rx ? ccid_ops->ccid_hc_rx_slab : 177 kmem_cache_free(rx ? ccid_ops->ccid_hc_rx_slab :
247 ccid_ops->ccid_hc_tx_slab, ccid); 178 ccid_ops->ccid_hc_tx_slab, ccid);
248 ccid = NULL; 179 ccid = NULL;
249out_module_put:
250 module_put(ccid_ops->ccid_owner);
251 goto out; 180 goto out;
252} 181}
253 182
254EXPORT_SYMBOL_GPL(ccid_new); 183void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk)
255
256static void ccid_delete(struct ccid *ccid, struct sock *sk, int rx)
257{ 184{
258 struct ccid_operations *ccid_ops; 185 if (ccid != NULL) {
259 186 if (ccid->ccid_ops->ccid_hc_rx_exit != NULL)
260 if (ccid == NULL) 187 ccid->ccid_ops->ccid_hc_rx_exit(sk);
261 return; 188 kmem_cache_free(ccid->ccid_ops->ccid_hc_rx_slab, ccid);
262
263 ccid_ops = ccid->ccid_ops;
264 if (rx) {
265 if (ccid_ops->ccid_hc_rx_exit != NULL)
266 ccid_ops->ccid_hc_rx_exit(sk);
267 kmem_cache_free(ccid_ops->ccid_hc_rx_slab, ccid);
268 } else {
269 if (ccid_ops->ccid_hc_tx_exit != NULL)
270 ccid_ops->ccid_hc_tx_exit(sk);
271 kmem_cache_free(ccid_ops->ccid_hc_tx_slab, ccid);
272 } 189 }
273 ccids_read_lock();
274 if (ccids[ccid_ops->ccid_id] != NULL)
275 module_put(ccid_ops->ccid_owner);
276 ccids_read_unlock();
277} 190}
278 191
279void ccid_hc_rx_delete(struct ccid *ccid, struct sock *sk) 192void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk)
280{ 193{
281 ccid_delete(ccid, sk, 1); 194 if (ccid != NULL) {
195 if (ccid->ccid_ops->ccid_hc_tx_exit != NULL)
196 ccid->ccid_ops->ccid_hc_tx_exit(sk);
197 kmem_cache_free(ccid->ccid_ops->ccid_hc_tx_slab, ccid);
198 }
282} 199}
283 200
284EXPORT_SYMBOL_GPL(ccid_hc_rx_delete); 201int __init ccid_initialize_builtins(void)
285
286void ccid_hc_tx_delete(struct ccid *ccid, struct sock *sk)
287{ 202{
288 ccid_delete(ccid, sk, 0); 203 int i, err = tfrc_lib_init();
204
205 if (err)
206 return err;
207
208 for (i = 0; i < ARRAY_SIZE(ccids); i++) {
209 err = ccid_activate(ccids[i]);
210 if (err)
211 goto unwind_registrations;
212 }
213 return 0;
214
215unwind_registrations:
216 while(--i >= 0)
217 ccid_deactivate(ccids[i]);
218 tfrc_lib_exit();
219 return err;
289} 220}
290 221
291EXPORT_SYMBOL_GPL(ccid_hc_tx_delete); 222void ccid_cleanup_builtins(void)
223{
224 int i;
225
226 for (i = 0; i < ARRAY_SIZE(ccids); i++)
227 ccid_deactivate(ccids[i]);
228 tfrc_lib_exit();
229}
diff --git a/net/dccp/ccid.h b/net/dccp/ccid.h
index 18f69423a708..facedd20b531 100644
--- a/net/dccp/ccid.h
+++ b/net/dccp/ccid.h
@@ -29,7 +29,6 @@ struct tcp_info;
29 * @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.) 29 * @ccid_id: numerical CCID ID (up to %CCID_MAX, cf. table 5 in RFC 4340, 10.)
30 * @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled) 30 * @ccid_ccmps: the CCMPS including network/transport headers (0 when disabled)
31 * @ccid_name: alphabetical identifier string for @ccid_id 31 * @ccid_name: alphabetical identifier string for @ccid_id
32 * @ccid_owner: module which implements/owns this CCID
33 * @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection 32 * @ccid_hc_{r,t}x_slab: memory pool for the receiver/sender half-connection
34 * @ccid_hc_{r,t}x_obj_size: size of the receiver/sender half-connection socket 33 * @ccid_hc_{r,t}x_obj_size: size of the receiver/sender half-connection socket
35 * 34 *
@@ -48,7 +47,6 @@ struct ccid_operations {
48 unsigned char ccid_id; 47 unsigned char ccid_id;
49 __u32 ccid_ccmps; 48 __u32 ccid_ccmps;
50 const char *ccid_name; 49 const char *ccid_name;
51 struct module *ccid_owner;
52 struct kmem_cache *ccid_hc_rx_slab, 50 struct kmem_cache *ccid_hc_rx_slab,
53 *ccid_hc_tx_slab; 51 *ccid_hc_tx_slab;
54 __u32 ccid_hc_rx_obj_size, 52 __u32 ccid_hc_rx_obj_size,
@@ -90,8 +88,13 @@ struct ccid_operations {
90 int __user *optlen); 88 int __user *optlen);
91}; 89};
92 90
93extern int ccid_register(struct ccid_operations *ccid_ops); 91extern struct ccid_operations ccid2_ops;
94extern int ccid_unregister(struct ccid_operations *ccid_ops); 92#ifdef CONFIG_IP_DCCP_CCID3
93extern struct ccid_operations ccid3_ops;
94#endif
95
96extern int ccid_initialize_builtins(void);
97extern void ccid_cleanup_builtins(void);
95 98
96struct ccid { 99struct ccid {
97 struct ccid_operations *ccid_ops; 100 struct ccid_operations *ccid_ops;
@@ -108,8 +111,7 @@ extern int ccid_get_builtin_ccids(u8 **ccid_array, u8 *array_len);
108extern int ccid_getsockopt_builtin_ccids(struct sock *sk, int len, 111extern int ccid_getsockopt_builtin_ccids(struct sock *sk, int len,
109 char __user *, int __user *); 112 char __user *, int __user *);
110 113
111extern struct ccid *ccid_new(unsigned char id, struct sock *sk, int rx, 114extern struct ccid *ccid_new(const u8 id, struct sock *sk, bool rx);
112 gfp_t gfp);
113 115
114static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp) 116static inline int ccid_get_current_rx_ccid(struct dccp_sock *dp)
115{ 117{
diff --git a/net/dccp/ccids/Kconfig b/net/dccp/ccids/Kconfig
index 12275943eab8..b28bf962edc3 100644
--- a/net/dccp/ccids/Kconfig
+++ b/net/dccp/ccids/Kconfig
@@ -1,80 +1,51 @@
1menu "DCCP CCIDs Configuration (EXPERIMENTAL)" 1menu "DCCP CCIDs Configuration (EXPERIMENTAL)"
2 depends on EXPERIMENTAL 2 depends on EXPERIMENTAL
3 3
4config IP_DCCP_CCID2
5 tristate "CCID2 (TCP-Like) (EXPERIMENTAL)"
6 def_tristate IP_DCCP
7 select IP_DCCP_ACKVEC
8 ---help---
9 CCID 2, TCP-like Congestion Control, denotes Additive Increase,
10 Multiplicative Decrease (AIMD) congestion control with behavior
11 modelled directly on TCP, including congestion window, slow start,
12 timeouts, and so forth [RFC 2581]. CCID 2 achieves maximum
13 bandwidth over the long term, consistent with the use of end-to-end
14 congestion control, but halves its congestion window in response to
15 each congestion event. This leads to the abrupt rate changes
16 typical of TCP. Applications should use CCID 2 if they prefer
17 maximum bandwidth utilization to steadiness of rate. This is often
18 the case for applications that are not playing their data directly
19 to the user. For example, a hypothetical application that
20 transferred files over DCCP, using application-level retransmissions
21 for lost packets, would prefer CCID 2 to CCID 3. On-line games may
22 also prefer CCID 2. See RFC 4341 for further details.
23
24 CCID2 is the default CCID used by DCCP.
25
26config IP_DCCP_CCID2_DEBUG 4config IP_DCCP_CCID2_DEBUG
27 bool "CCID2 debugging messages" 5 bool "CCID-2 debugging messages"
28 depends on IP_DCCP_CCID2 6 ---help---
29 ---help--- 7 Enable CCID-2 specific debugging messages.
30 Enable CCID2-specific debugging messages.
31 8
32 When compiling CCID2 as a module, this debugging output can 9 The debugging output can additionally be toggled by setting the
33 additionally be toggled by setting the ccid2_debug module 10 ccid2_debug parameter to 0 or 1.
34 parameter to 0 or 1.
35 11
36 If in doubt, say N. 12 If in doubt, say N.
37 13
38config IP_DCCP_CCID3 14config IP_DCCP_CCID3
39 tristate "CCID3 (TCP-Friendly) (EXPERIMENTAL)" 15 bool "CCID-3 (TCP-Friendly) (EXPERIMENTAL)"
40 def_tristate IP_DCCP 16 def_bool y if (IP_DCCP = y || IP_DCCP = m)
41 select IP_DCCP_TFRC_LIB
42 ---help--- 17 ---help---
43 CCID 3 denotes TCP-Friendly Rate Control (TFRC), an equation-based 18 CCID-3 denotes TCP-Friendly Rate Control (TFRC), an equation-based
44 rate-controlled congestion control mechanism. TFRC is designed to 19 rate-controlled congestion control mechanism. TFRC is designed to
45 be reasonably fair when competing for bandwidth with TCP-like flows, 20 be reasonably fair when competing for bandwidth with TCP-like flows,
46 where a flow is "reasonably fair" if its sending rate is generally 21 where a flow is "reasonably fair" if its sending rate is generally
47 within a factor of two of the sending rate of a TCP flow under the 22 within a factor of two of the sending rate of a TCP flow under the
48 same conditions. However, TFRC has a much lower variation of 23 same conditions. However, TFRC has a much lower variation of
49 throughput over time compared with TCP, which makes CCID 3 more 24 throughput over time compared with TCP, which makes CCID-3 more
50 suitable than CCID 2 for applications such streaming media where a 25 suitable than CCID-2 for applications such streaming media where a
51 relatively smooth sending rate is of importance. 26 relatively smooth sending rate is of importance.
52 27
53 CCID 3 is further described in RFC 4342, 28 CCID-3 is further described in RFC 4342,
54 http://www.ietf.org/rfc/rfc4342.txt 29 http://www.ietf.org/rfc/rfc4342.txt
55 30
56 The TFRC congestion control algorithms were initially described in 31 The TFRC congestion control algorithms were initially described in
57 RFC 3448. 32 RFC 5448.
58 33
59 This text was extracted from RFC 4340 (sec. 10.2), 34 This text was extracted from RFC 4340 (sec. 10.2),
60 http://www.ietf.org/rfc/rfc4340.txt 35 http://www.ietf.org/rfc/rfc4340.txt
61
62 To compile this CCID as a module, choose M here: the module will be
63 called dccp_ccid3.
64 36
65 If in doubt, say M. 37 If in doubt, say N.
66 38
67config IP_DCCP_CCID3_DEBUG 39config IP_DCCP_CCID3_DEBUG
68 bool "CCID3 debugging messages" 40 bool "CCID-3 debugging messages"
69 depends on IP_DCCP_CCID3 41 depends on IP_DCCP_CCID3
70 ---help--- 42 ---help---
71 Enable CCID3-specific debugging messages. 43 Enable CCID-3 specific debugging messages.
72 44
73 When compiling CCID3 as a module, this debugging output can 45 The debugging output can additionally be toggled by setting the
74 additionally be toggled by setting the ccid3_debug module 46 ccid3_debug parameter to 0 or 1.
75 parameter to 0 or 1.
76 47
77 If in doubt, say N. 48 If in doubt, say N.
78 49
79config IP_DCCP_CCID3_RTO 50config IP_DCCP_CCID3_RTO
80 int "Use higher bound for nofeedback timer" 51 int "Use higher bound for nofeedback timer"
@@ -108,12 +79,8 @@ config IP_DCCP_CCID3_RTO
108 therefore not be performed on WANs. 79 therefore not be performed on WANs.
109 80
110config IP_DCCP_TFRC_LIB 81config IP_DCCP_TFRC_LIB
111 tristate 82 def_bool y if IP_DCCP_CCID3
112 default n
113 83
114config IP_DCCP_TFRC_DEBUG 84config IP_DCCP_TFRC_DEBUG
115 bool 85 def_bool y if IP_DCCP_CCID3_DEBUG
116 depends on IP_DCCP_TFRC_LIB
117 default y if IP_DCCP_CCID3_DEBUG
118
119endmenu 86endmenu
diff --git a/net/dccp/ccids/Makefile b/net/dccp/ccids/Makefile
deleted file mode 100644
index 438f20bccff7..000000000000
--- a/net/dccp/ccids/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1obj-$(CONFIG_IP_DCCP_CCID3) += dccp_ccid3.o
2
3dccp_ccid3-y := ccid3.o
4
5obj-$(CONFIG_IP_DCCP_CCID2) += dccp_ccid2.o
6
7dccp_ccid2-y := ccid2.o
8
9obj-y += lib/
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c
index c9ea19a4d85e..d235294ace23 100644
--- a/net/dccp/ccids/ccid2.c
+++ b/net/dccp/ccids/ccid2.c
@@ -768,10 +768,9 @@ static void ccid2_hc_rx_packet_recv(struct sock *sk, struct sk_buff *skb)
768 } 768 }
769} 769}
770 770
771static struct ccid_operations ccid2 = { 771struct ccid_operations ccid2_ops = {
772 .ccid_id = DCCPC_CCID2, 772 .ccid_id = DCCPC_CCID2,
773 .ccid_name = "TCP-like", 773 .ccid_name = "TCP-like",
774 .ccid_owner = THIS_MODULE,
775 .ccid_hc_tx_obj_size = sizeof(struct ccid2_hc_tx_sock), 774 .ccid_hc_tx_obj_size = sizeof(struct ccid2_hc_tx_sock),
776 .ccid_hc_tx_init = ccid2_hc_tx_init, 775 .ccid_hc_tx_init = ccid2_hc_tx_init,
777 .ccid_hc_tx_exit = ccid2_hc_tx_exit, 776 .ccid_hc_tx_exit = ccid2_hc_tx_exit,
@@ -784,22 +783,5 @@ static struct ccid_operations ccid2 = {
784 783
785#ifdef CONFIG_IP_DCCP_CCID2_DEBUG 784#ifdef CONFIG_IP_DCCP_CCID2_DEBUG
786module_param(ccid2_debug, bool, 0644); 785module_param(ccid2_debug, bool, 0644);
787MODULE_PARM_DESC(ccid2_debug, "Enable debug messages"); 786MODULE_PARM_DESC(ccid2_debug, "Enable CCID-2 debug messages");
788#endif 787#endif
789
790static __init int ccid2_module_init(void)
791{
792 return ccid_register(&ccid2);
793}
794module_init(ccid2_module_init);
795
796static __exit void ccid2_module_exit(void)
797{
798 ccid_unregister(&ccid2);
799}
800module_exit(ccid2_module_exit);
801
802MODULE_AUTHOR("Andrea Bittau <a.bittau@cs.ucl.ac.uk>");
803MODULE_DESCRIPTION("DCCP TCP-Like (CCID2) CCID");
804MODULE_LICENSE("GPL");
805MODULE_ALIAS("net-dccp-ccid-2");
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c
index 3b8bd7ca6761..a27b7f4c19c5 100644
--- a/net/dccp/ccids/ccid3.c
+++ b/net/dccp/ccids/ccid3.c
@@ -940,10 +940,9 @@ static int ccid3_hc_rx_getsockopt(struct sock *sk, const int optname, int len,
940 return 0; 940 return 0;
941} 941}
942 942
943static struct ccid_operations ccid3 = { 943struct ccid_operations ccid3_ops = {
944 .ccid_id = DCCPC_CCID3, 944 .ccid_id = DCCPC_CCID3,
945 .ccid_name = "TCP-Friendly Rate Control", 945 .ccid_name = "TCP-Friendly Rate Control",
946 .ccid_owner = THIS_MODULE,
947 .ccid_hc_tx_obj_size = sizeof(struct ccid3_hc_tx_sock), 946 .ccid_hc_tx_obj_size = sizeof(struct ccid3_hc_tx_sock),
948 .ccid_hc_tx_init = ccid3_hc_tx_init, 947 .ccid_hc_tx_init = ccid3_hc_tx_init,
949 .ccid_hc_tx_exit = ccid3_hc_tx_exit, 948 .ccid_hc_tx_exit = ccid3_hc_tx_exit,
@@ -964,23 +963,5 @@ static struct ccid_operations ccid3 = {
964 963
965#ifdef CONFIG_IP_DCCP_CCID3_DEBUG 964#ifdef CONFIG_IP_DCCP_CCID3_DEBUG
966module_param(ccid3_debug, bool, 0644); 965module_param(ccid3_debug, bool, 0644);
967MODULE_PARM_DESC(ccid3_debug, "Enable debug messages"); 966MODULE_PARM_DESC(ccid3_debug, "Enable CCID-3 debug messages");
968#endif 967#endif
969
970static __init int ccid3_module_init(void)
971{
972 return ccid_register(&ccid3);
973}
974module_init(ccid3_module_init);
975
976static __exit void ccid3_module_exit(void)
977{
978 ccid_unregister(&ccid3);
979}
980module_exit(ccid3_module_exit);
981
982MODULE_AUTHOR("Ian McDonald <ian.mcdonald@jandi.co.nz>, "
983 "Arnaldo Carvalho de Melo <acme@ghostprotocols.net>");
984MODULE_DESCRIPTION("DCCP TFRC CCID3 CCID");
985MODULE_LICENSE("GPL");
986MODULE_ALIAS("net-dccp-ccid-3");
diff --git a/net/dccp/ccids/lib/Makefile b/net/dccp/ccids/lib/Makefile
deleted file mode 100644
index 68c93e3d89dc..000000000000
--- a/net/dccp/ccids/lib/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1obj-$(CONFIG_IP_DCCP_TFRC_LIB) += dccp_tfrc_lib.o
2
3dccp_tfrc_lib-y := tfrc.o tfrc_equation.o packet_history.o loss_interval.o
diff --git a/net/dccp/ccids/lib/loss_interval.c b/net/dccp/ccids/lib/loss_interval.c
index 5b3ce0688c5c..4d1e40127264 100644
--- a/net/dccp/ccids/lib/loss_interval.c
+++ b/net/dccp/ccids/lib/loss_interval.c
@@ -60,7 +60,6 @@ void tfrc_lh_cleanup(struct tfrc_loss_hist *lh)
60 lh->ring[LIH_INDEX(lh->counter)] = NULL; 60 lh->ring[LIH_INDEX(lh->counter)] = NULL;
61 } 61 }
62} 62}
63EXPORT_SYMBOL_GPL(tfrc_lh_cleanup);
64 63
65static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh) 64static void tfrc_lh_calc_i_mean(struct tfrc_loss_hist *lh)
66{ 65{
@@ -121,7 +120,6 @@ u8 tfrc_lh_update_i_mean(struct tfrc_loss_hist *lh, struct sk_buff *skb)
121 120
122 return (lh->i_mean < old_i_mean); 121 return (lh->i_mean < old_i_mean);
123} 122}
124EXPORT_SYMBOL_GPL(tfrc_lh_update_i_mean);
125 123
126/* Determine if `new_loss' does begin a new loss interval [RFC 4342, 10.2] */ 124/* Determine if `new_loss' does begin a new loss interval [RFC 4342, 10.2] */
127static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur, 125static inline u8 tfrc_lh_is_new_loss(struct tfrc_loss_interval *cur,
@@ -169,7 +167,6 @@ int tfrc_lh_interval_add(struct tfrc_loss_hist *lh, struct tfrc_rx_hist *rh,
169 } 167 }
170 return 1; 168 return 1;
171} 169}
172EXPORT_SYMBOL_GPL(tfrc_lh_interval_add);
173 170
174int __init tfrc_li_init(void) 171int __init tfrc_li_init(void)
175{ 172{
diff --git a/net/dccp/ccids/lib/packet_history.c b/net/dccp/ccids/lib/packet_history.c
index 6cc108afdc3b..b7785b3581ec 100644
--- a/net/dccp/ccids/lib/packet_history.c
+++ b/net/dccp/ccids/lib/packet_history.c
@@ -94,7 +94,6 @@ int tfrc_tx_hist_add(struct tfrc_tx_hist_entry **headp, u64 seqno)
94 *headp = entry; 94 *headp = entry;
95 return 0; 95 return 0;
96} 96}
97EXPORT_SYMBOL_GPL(tfrc_tx_hist_add);
98 97
99void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp) 98void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp)
100{ 99{
@@ -109,7 +108,6 @@ void tfrc_tx_hist_purge(struct tfrc_tx_hist_entry **headp)
109 108
110 *headp = NULL; 109 *headp = NULL;
111} 110}
112EXPORT_SYMBOL_GPL(tfrc_tx_hist_purge);
113 111
114u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, const u64 seqno, 112u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, const u64 seqno,
115 const ktime_t now) 113 const ktime_t now)
@@ -127,7 +125,6 @@ u32 tfrc_tx_hist_rtt(struct tfrc_tx_hist_entry *head, const u64 seqno,
127 125
128 return rtt; 126 return rtt;
129} 127}
130EXPORT_SYMBOL_GPL(tfrc_tx_hist_rtt);
131 128
132 129
133/* 130/*
@@ -172,7 +169,6 @@ void tfrc_rx_hist_add_packet(struct tfrc_rx_hist *h,
172 169
173 tfrc_rx_hist_entry_from_skb(entry, skb, ndp); 170 tfrc_rx_hist_entry_from_skb(entry, skb, ndp);
174} 171}
175EXPORT_SYMBOL_GPL(tfrc_rx_hist_add_packet);
176 172
177/* has the packet contained in skb been seen before? */ 173/* has the packet contained in skb been seen before? */
178int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb) 174int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb)
@@ -189,7 +185,6 @@ int tfrc_rx_hist_duplicate(struct tfrc_rx_hist *h, struct sk_buff *skb)
189 185
190 return 0; 186 return 0;
191} 187}
192EXPORT_SYMBOL_GPL(tfrc_rx_hist_duplicate);
193 188
194static void tfrc_rx_hist_swap(struct tfrc_rx_hist *h, const u8 a, const u8 b) 189static void tfrc_rx_hist_swap(struct tfrc_rx_hist *h, const u8 a, const u8 b)
195{ 190{
@@ -390,7 +385,6 @@ int tfrc_rx_handle_loss(struct tfrc_rx_hist *h,
390 } 385 }
391 return is_new_loss; 386 return is_new_loss;
392} 387}
393EXPORT_SYMBOL_GPL(tfrc_rx_handle_loss);
394 388
395int tfrc_rx_hist_alloc(struct tfrc_rx_hist *h) 389int tfrc_rx_hist_alloc(struct tfrc_rx_hist *h)
396{ 390{
@@ -412,7 +406,6 @@ out_free:
412 } 406 }
413 return -ENOBUFS; 407 return -ENOBUFS;
414} 408}
415EXPORT_SYMBOL_GPL(tfrc_rx_hist_alloc);
416 409
417void tfrc_rx_hist_purge(struct tfrc_rx_hist *h) 410void tfrc_rx_hist_purge(struct tfrc_rx_hist *h)
418{ 411{
@@ -424,7 +417,6 @@ void tfrc_rx_hist_purge(struct tfrc_rx_hist *h)
424 h->ring[i] = NULL; 417 h->ring[i] = NULL;
425 } 418 }
426} 419}
427EXPORT_SYMBOL_GPL(tfrc_rx_hist_purge);
428 420
429/** 421/**
430 * tfrc_rx_hist_rtt_last_s - reference entry to compute RTT samples against 422 * tfrc_rx_hist_rtt_last_s - reference entry to compute RTT samples against
@@ -495,4 +487,3 @@ keep_ref_for_next_time:
495 487
496 return sample; 488 return sample;
497} 489}
498EXPORT_SYMBOL_GPL(tfrc_rx_hist_sample_rtt);
diff --git a/net/dccp/ccids/lib/tfrc.c b/net/dccp/ccids/lib/tfrc.c
index 185916218e07..60c412ccfeef 100644
--- a/net/dccp/ccids/lib/tfrc.c
+++ b/net/dccp/ccids/lib/tfrc.c
@@ -1,20 +1,18 @@
1/* 1/*
2 * TFRC: main module holding the pieces of the TFRC library together 2 * TFRC library initialisation
3 * 3 *
4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK 4 * Copyright (c) 2007 The University of Aberdeen, Scotland, UK
5 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com> 5 * Copyright (c) 2007 Arnaldo Carvalho de Melo <acme@redhat.com>
6 */ 6 */
7#include <linux/module.h>
8#include <linux/moduleparam.h>
9#include "tfrc.h" 7#include "tfrc.h"
10 8
11#ifdef CONFIG_IP_DCCP_TFRC_DEBUG 9#ifdef CONFIG_IP_DCCP_TFRC_DEBUG
12int tfrc_debug; 10int tfrc_debug;
13module_param(tfrc_debug, bool, 0644); 11module_param(tfrc_debug, bool, 0644);
14MODULE_PARM_DESC(tfrc_debug, "Enable debug messages"); 12MODULE_PARM_DESC(tfrc_debug, "Enable TFRC debug messages");
15#endif 13#endif
16 14
17static int __init tfrc_module_init(void) 15int __init tfrc_lib_init(void)
18{ 16{
19 int rc = tfrc_li_init(); 17 int rc = tfrc_li_init();
20 18
@@ -38,18 +36,9 @@ out:
38 return rc; 36 return rc;
39} 37}
40 38
41static void __exit tfrc_module_exit(void) 39void __exit tfrc_lib_exit(void)
42{ 40{
43 tfrc_rx_packet_history_exit(); 41 tfrc_rx_packet_history_exit();
44 tfrc_tx_packet_history_exit(); 42 tfrc_tx_packet_history_exit();
45 tfrc_li_exit(); 43 tfrc_li_exit();
46} 44}
47
48module_init(tfrc_module_init);
49module_exit(tfrc_module_exit);
50
51MODULE_AUTHOR("Gerrit Renker <gerrit@erg.abdn.ac.uk>, "
52 "Ian McDonald <ian.mcdonald@jandi.co.nz>, "
53 "Arnaldo Carvalho de Melo <acme@redhat.com>");
54MODULE_DESCRIPTION("DCCP TFRC library");
55MODULE_LICENSE("GPL");
diff --git a/net/dccp/ccids/lib/tfrc.h b/net/dccp/ccids/lib/tfrc.h
index ed9857527acf..e9720b143275 100644
--- a/net/dccp/ccids/lib/tfrc.h
+++ b/net/dccp/ccids/lib/tfrc.h
@@ -17,7 +17,8 @@
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/math64.h> 18#include <linux/math64.h>
19#include "../../dccp.h" 19#include "../../dccp.h"
20/* internal includes that this module exports: */ 20
21/* internal includes that this library exports: */
21#include "loss_interval.h" 22#include "loss_interval.h"
22#include "packet_history.h" 23#include "packet_history.h"
23 24
@@ -66,4 +67,12 @@ extern void tfrc_rx_packet_history_exit(void);
66 67
67extern int tfrc_li_init(void); 68extern int tfrc_li_init(void);
68extern void tfrc_li_exit(void); 69extern void tfrc_li_exit(void);
70
71#ifdef CONFIG_IP_DCCP_TFRC_LIB
72extern int tfrc_lib_init(void);
73extern void tfrc_lib_exit(void);
74#else
75#define tfrc_lib_init() (0)
76#define tfrc_lib_exit()
77#endif
69#endif /* _TFRC_H_ */ 78#endif /* _TFRC_H_ */
diff --git a/net/dccp/ccids/lib/tfrc_equation.c b/net/dccp/ccids/lib/tfrc_equation.c
index 2f20a29cffe4..c5d3a9e5a5a4 100644
--- a/net/dccp/ccids/lib/tfrc_equation.c
+++ b/net/dccp/ccids/lib/tfrc_equation.c
@@ -659,8 +659,6 @@ u32 tfrc_calc_x(u16 s, u32 R, u32 p)
659 return scaled_div32(result, f); 659 return scaled_div32(result, f);
660} 660}
661 661
662EXPORT_SYMBOL_GPL(tfrc_calc_x);
663
664/** 662/**
665 * tfrc_calc_x_reverse_lookup - try to find p given f(p) 663 * tfrc_calc_x_reverse_lookup - try to find p given f(p)
666 * 664 *
@@ -693,5 +691,3 @@ u32 tfrc_calc_x_reverse_lookup(u32 fvalue)
693 index = tfrc_binsearch(fvalue, 0); 691 index = tfrc_binsearch(fvalue, 0);
694 return (index + 1) * 1000000 / TFRC_CALC_X_ARRSIZE; 692 return (index + 1) * 1000000 / TFRC_CALC_X_ARRSIZE;
695} 693}
696
697EXPORT_SYMBOL_GPL(tfrc_calc_x_reverse_lookup);
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index 0bc4c9a02e19..f2230fc168e1 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -432,10 +432,8 @@ static inline int dccp_ack_pending(const struct sock *sk)
432{ 432{
433 const struct dccp_sock *dp = dccp_sk(sk); 433 const struct dccp_sock *dp = dccp_sk(sk);
434 return dp->dccps_timestamp_echo != 0 || 434 return dp->dccps_timestamp_echo != 0 ||
435#ifdef CONFIG_IP_DCCP_ACKVEC
436 (dp->dccps_hc_rx_ackvec != NULL && 435 (dp->dccps_hc_rx_ackvec != NULL &&
437 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) || 436 dccp_ackvec_pending(dp->dccps_hc_rx_ackvec)) ||
438#endif
439 inet_csk_ack_scheduled(sk); 437 inet_csk_ack_scheduled(sk);
440} 438}
441 439
diff --git a/net/dccp/feat.c b/net/dccp/feat.c
index 30f9fb76b921..4152308958ab 100644
--- a/net/dccp/feat.c
+++ b/net/dccp/feat.c
@@ -34,7 +34,7 @@
34static int dccp_hdlr_ccid(struct sock *sk, u64 ccid, bool rx) 34static int dccp_hdlr_ccid(struct sock *sk, u64 ccid, bool rx)
35{ 35{
36 struct dccp_sock *dp = dccp_sk(sk); 36 struct dccp_sock *dp = dccp_sk(sk);
37 struct ccid *new_ccid = ccid_new(ccid, sk, rx, gfp_any()); 37 struct ccid *new_ccid = ccid_new(ccid, sk, rx);
38 38
39 if (new_ccid == NULL) 39 if (new_ccid == NULL)
40 return -ENOMEM; 40 return -ENOMEM;
@@ -1214,8 +1214,6 @@ const char *dccp_feat_typename(const u8 type)
1214 return NULL; 1214 return NULL;
1215} 1215}
1216 1216
1217EXPORT_SYMBOL_GPL(dccp_feat_typename);
1218
1219const char *dccp_feat_name(const u8 feat) 1217const char *dccp_feat_name(const u8 feat)
1220{ 1218{
1221 static const char *feature_names[] = { 1219 static const char *feature_names[] = {
@@ -1240,6 +1238,4 @@ const char *dccp_feat_name(const u8 feat)
1240 1238
1241 return feature_names[feat]; 1239 return feature_names[feat];
1242} 1240}
1243
1244EXPORT_SYMBOL_GPL(dccp_feat_name);
1245#endif /* CONFIG_IP_DCCP_DEBUG */ 1241#endif /* CONFIG_IP_DCCP_DEBUG */
diff --git a/net/dccp/input.c b/net/dccp/input.c
index 5eb443f656c1..7648f316310f 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -741,5 +741,3 @@ u32 dccp_sample_rtt(struct sock *sk, long delta)
741 741
742 return delta; 742 return delta;
743} 743}
744
745EXPORT_SYMBOL_GPL(dccp_sample_rtt);
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 1747ccae8e8d..945b4d5d23b3 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -1118,9 +1118,15 @@ static int __init dccp_init(void)
1118 if (rc) 1118 if (rc)
1119 goto out_ackvec_exit; 1119 goto out_ackvec_exit;
1120 1120
1121 rc = ccid_initialize_builtins();
1122 if (rc)
1123 goto out_sysctl_exit;
1124
1121 dccp_timestamping_init(); 1125 dccp_timestamping_init();
1122out: 1126out:
1123 return rc; 1127 return rc;
1128out_sysctl_exit:
1129 dccp_sysctl_exit();
1124out_ackvec_exit: 1130out_ackvec_exit:
1125 dccp_ackvec_exit(); 1131 dccp_ackvec_exit();
1126out_free_dccp_mib: 1132out_free_dccp_mib:
@@ -1143,6 +1149,7 @@ out_free_percpu:
1143 1149
1144static void __exit dccp_fini(void) 1150static void __exit dccp_fini(void)
1145{ 1151{
1152 ccid_cleanup_builtins();
1146 dccp_mib_exit(); 1153 dccp_mib_exit();
1147 free_pages((unsigned long)dccp_hashinfo.bhash, 1154 free_pages((unsigned long)dccp_hashinfo.bhash,
1148 get_order(dccp_hashinfo.bhash_size * 1155 get_order(dccp_hashinfo.bhash_size *
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f28acf11fc67..35bcddf8a932 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -580,10 +580,6 @@ ssize_t tcp_splice_read(struct socket *sock, loff_t *ppos,
580 else if (!ret) { 580 else if (!ret) {
581 if (spliced) 581 if (spliced)
582 break; 582 break;
583 if (flags & SPLICE_F_NONBLOCK) {
584 ret = -EAGAIN;
585 break;
586 }
587 if (sock_flag(sk, SOCK_DONE)) 583 if (sock_flag(sk, SOCK_DONE))
588 break; 584 break;
589 if (sk->sk_err) { 585 if (sk->sk_err) {
@@ -2519,9 +2515,7 @@ found:
2519 flush |= memcmp(th + 1, th2 + 1, thlen - sizeof(*th)); 2515 flush |= memcmp(th + 1, th2 + 1, thlen - sizeof(*th));
2520 2516
2521 total = p->len; 2517 total = p->len;
2522 mss = total; 2518 mss = skb_shinfo(p)->gso_size;
2523 if (skb_shinfo(p)->frag_list)
2524 mss = skb_shinfo(p)->frag_list->len;
2525 2519
2526 flush |= skb->len > mss || skb->len <= 0; 2520 flush |= skb->len > mss || skb->len <= 0;
2527 flush |= ntohl(th2->seq) + total != ntohl(th->seq); 2521 flush |= ntohl(th2->seq) + total != ntohl(th->seq);
@@ -2557,7 +2551,6 @@ int tcp_gro_complete(struct sk_buff *skb)
2557 skb->csum_offset = offsetof(struct tcphdr, check); 2551 skb->csum_offset = offsetof(struct tcphdr, check);
2558 skb->ip_summed = CHECKSUM_PARTIAL; 2552 skb->ip_summed = CHECKSUM_PARTIAL;
2559 2553
2560 skb_shinfo(skb)->gso_size = skb_shinfo(skb)->frag_list->len;
2561 skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; 2554 skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count;
2562 2555
2563 if (th->cwr) 2556 if (th->cwr)
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index eeeaad2e8b5c..40f324655e24 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -404,7 +404,7 @@ sticky_done:
404 else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL) 404 else if (optlen < sizeof(struct in6_pktinfo) || optval == NULL)
405 goto e_inval; 405 goto e_inval;
406 406
407 if (copy_from_user(&pkt, optval, optlen)) { 407 if (copy_from_user(&pkt, optval, sizeof(struct in6_pktinfo))) {
408 retv = -EFAULT; 408 retv = -EFAULT;
409 break; 409 break;
410 } 410 }
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 18c486cf4987..76f06b94ab9f 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -627,6 +627,9 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad
627 rt = ip6_rt_copy(ort); 627 rt = ip6_rt_copy(ort);
628 628
629 if (rt) { 629 if (rt) {
630 struct neighbour *neigh;
631 int attempts = !in_softirq();
632
630 if (!(rt->rt6i_flags&RTF_GATEWAY)) { 633 if (!(rt->rt6i_flags&RTF_GATEWAY)) {
631 if (rt->rt6i_dst.plen != 128 && 634 if (rt->rt6i_dst.plen != 128 &&
632 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr)) 635 ipv6_addr_equal(&rt->rt6i_dst.addr, daddr))
@@ -646,7 +649,35 @@ static struct rt6_info *rt6_alloc_cow(struct rt6_info *ort, struct in6_addr *dad
646 } 649 }
647#endif 650#endif
648 651
649 rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway); 652 retry:
653 neigh = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway);
654 if (IS_ERR(neigh)) {
655 struct net *net = dev_net(rt->rt6i_dev);
656 int saved_rt_min_interval =
657 net->ipv6.sysctl.ip6_rt_gc_min_interval;
658 int saved_rt_elasticity =
659 net->ipv6.sysctl.ip6_rt_gc_elasticity;
660
661 if (attempts-- > 0) {
662 net->ipv6.sysctl.ip6_rt_gc_elasticity = 1;
663 net->ipv6.sysctl.ip6_rt_gc_min_interval = 0;
664
665 ip6_dst_gc(net->ipv6.ip6_dst_ops);
666
667 net->ipv6.sysctl.ip6_rt_gc_elasticity =
668 saved_rt_elasticity;
669 net->ipv6.sysctl.ip6_rt_gc_min_interval =
670 saved_rt_min_interval;
671 goto retry;
672 }
673
674 if (net_ratelimit())
675 printk(KERN_WARNING
676 "Neighbour table overflow.\n");
677 dst_free(&rt->u.dst);
678 return NULL;
679 }
680 rt->rt6i_nexthop = neigh;
650 681
651 } 682 }
652 683
@@ -945,8 +976,11 @@ struct dst_entry *icmp6_dst_alloc(struct net_device *dev,
945 dev_hold(dev); 976 dev_hold(dev);
946 if (neigh) 977 if (neigh)
947 neigh_hold(neigh); 978 neigh_hold(neigh);
948 else 979 else {
949 neigh = ndisc_get_neigh(dev, addr); 980 neigh = ndisc_get_neigh(dev, addr);
981 if (IS_ERR(neigh))
982 neigh = NULL;
983 }
950 984
951 rt->rt6i_dev = dev; 985 rt->rt6i_dev = dev;
952 rt->rt6i_idev = idev; 986 rt->rt6i_idev = idev;
@@ -1887,6 +1921,7 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
1887{ 1921{
1888 struct net *net = dev_net(idev->dev); 1922 struct net *net = dev_net(idev->dev);
1889 struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops); 1923 struct rt6_info *rt = ip6_dst_alloc(net->ipv6.ip6_dst_ops);
1924 struct neighbour *neigh;
1890 1925
1891 if (rt == NULL) 1926 if (rt == NULL)
1892 return ERR_PTR(-ENOMEM); 1927 return ERR_PTR(-ENOMEM);
@@ -1909,11 +1944,18 @@ struct rt6_info *addrconf_dst_alloc(struct inet6_dev *idev,
1909 rt->rt6i_flags |= RTF_ANYCAST; 1944 rt->rt6i_flags |= RTF_ANYCAST;
1910 else 1945 else
1911 rt->rt6i_flags |= RTF_LOCAL; 1946 rt->rt6i_flags |= RTF_LOCAL;
1912 rt->rt6i_nexthop = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway); 1947 neigh = ndisc_get_neigh(rt->rt6i_dev, &rt->rt6i_gateway);
1913 if (rt->rt6i_nexthop == NULL) { 1948 if (IS_ERR(neigh)) {
1914 dst_free(&rt->u.dst); 1949 dst_free(&rt->u.dst);
1915 return ERR_PTR(-ENOMEM); 1950
1951 /* We are casting this because that is the return
1952 * value type. But an errno encoded pointer is the
1953 * same regardless of the underlying pointer type,
1954 * and that's what we are returning. So this is OK.
1955 */
1956 return (struct rt6_info *) neigh;
1916 } 1957 }
1958 rt->rt6i_nexthop = neigh;
1917 1959
1918 ipv6_addr_copy(&rt->rt6i_dst.addr, addr); 1960 ipv6_addr_copy(&rt->rt6i_dst.addr, addr);
1919 rt->rt6i_dst.plen = 128; 1961 rt->rt6i_dst.plen = 128;
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c
index af3192d2a5a3..eb8a2a0b6eb7 100644
--- a/net/iucv/af_iucv.c
+++ b/net/iucv/af_iucv.c
@@ -494,7 +494,21 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
494 if (err) { 494 if (err) {
495 iucv_path_free(iucv->path); 495 iucv_path_free(iucv->path);
496 iucv->path = NULL; 496 iucv->path = NULL;
497 err = -ECONNREFUSED; 497 switch (err) {
498 case 0x0b: /* Target communicator is not logged on */
499 err = -ENETUNREACH;
500 break;
501 case 0x0d: /* Max connections for this guest exceeded */
502 case 0x0e: /* Max connections for target guest exceeded */
503 err = -EAGAIN;
504 break;
505 case 0x0f: /* Missing IUCV authorization */
506 err = -EACCES;
507 break;
508 default:
509 err = -ECONNREFUSED;
510 break;
511 }
498 goto done; 512 goto done;
499 } 513 }
500 514
@@ -507,6 +521,13 @@ static int iucv_sock_connect(struct socket *sock, struct sockaddr *addr,
507 release_sock(sk); 521 release_sock(sk);
508 return -ECONNREFUSED; 522 return -ECONNREFUSED;
509 } 523 }
524
525 if (err) {
526 iucv_path_sever(iucv->path, NULL);
527 iucv_path_free(iucv->path);
528 iucv->path = NULL;
529 }
530
510done: 531done:
511 release_sock(sk); 532 release_sock(sk);
512 return err; 533 return err;
@@ -1021,12 +1042,14 @@ static int iucv_callback_connreq(struct iucv_path *path,
1021 ASCEBC(user_data, sizeof(user_data)); 1042 ASCEBC(user_data, sizeof(user_data));
1022 if (sk->sk_state != IUCV_LISTEN) { 1043 if (sk->sk_state != IUCV_LISTEN) {
1023 err = iucv_path_sever(path, user_data); 1044 err = iucv_path_sever(path, user_data);
1045 iucv_path_free(path);
1024 goto fail; 1046 goto fail;
1025 } 1047 }
1026 1048
1027 /* Check for backlog size */ 1049 /* Check for backlog size */
1028 if (sk_acceptq_is_full(sk)) { 1050 if (sk_acceptq_is_full(sk)) {
1029 err = iucv_path_sever(path, user_data); 1051 err = iucv_path_sever(path, user_data);
1052 iucv_path_free(path);
1030 goto fail; 1053 goto fail;
1031 } 1054 }
1032 1055
@@ -1034,6 +1057,7 @@ static int iucv_callback_connreq(struct iucv_path *path,
1034 nsk = iucv_sock_alloc(NULL, SOCK_STREAM, GFP_ATOMIC); 1057 nsk = iucv_sock_alloc(NULL, SOCK_STREAM, GFP_ATOMIC);
1035 if (!nsk) { 1058 if (!nsk) {
1036 err = iucv_path_sever(path, user_data); 1059 err = iucv_path_sever(path, user_data);
1060 iucv_path_free(path);
1037 goto fail; 1061 goto fail;
1038 } 1062 }
1039 1063
@@ -1057,6 +1081,8 @@ static int iucv_callback_connreq(struct iucv_path *path,
1057 err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk); 1081 err = iucv_path_accept(path, &af_iucv_handler, nuser_data, nsk);
1058 if (err) { 1082 if (err) {
1059 err = iucv_path_sever(path, user_data); 1083 err = iucv_path_sever(path, user_data);
1084 iucv_path_free(path);
1085 iucv_sock_kill(nsk);
1060 goto fail; 1086 goto fail;
1061 } 1087 }
1062 1088
diff --git a/net/iucv/iucv.c b/net/iucv/iucv.c
index 8f57d4f4328a..032f61e98595 100644
--- a/net/iucv/iucv.c
+++ b/net/iucv/iucv.c
@@ -517,6 +517,7 @@ static int iucv_enable(void)
517 size_t alloc_size; 517 size_t alloc_size;
518 int cpu, rc; 518 int cpu, rc;
519 519
520 get_online_cpus();
520 rc = -ENOMEM; 521 rc = -ENOMEM;
521 alloc_size = iucv_max_pathid * sizeof(struct iucv_path); 522 alloc_size = iucv_max_pathid * sizeof(struct iucv_path);
522 iucv_path_table = kzalloc(alloc_size, GFP_KERNEL); 523 iucv_path_table = kzalloc(alloc_size, GFP_KERNEL);
@@ -524,19 +525,17 @@ static int iucv_enable(void)
524 goto out; 525 goto out;
525 /* Declare per cpu buffers. */ 526 /* Declare per cpu buffers. */
526 rc = -EIO; 527 rc = -EIO;
527 get_online_cpus();
528 for_each_online_cpu(cpu) 528 for_each_online_cpu(cpu)
529 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1); 529 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
530 if (cpus_empty(iucv_buffer_cpumask)) 530 if (cpus_empty(iucv_buffer_cpumask))
531 /* No cpu could declare an iucv buffer. */ 531 /* No cpu could declare an iucv buffer. */
532 goto out_path; 532 goto out;
533 put_online_cpus(); 533 put_online_cpus();
534 return 0; 534 return 0;
535
536out_path:
537 put_online_cpus();
538 kfree(iucv_path_table);
539out: 535out:
536 kfree(iucv_path_table);
537 iucv_path_table = NULL;
538 put_online_cpus();
540 return rc; 539 return rc;
541} 540}
542 541
@@ -551,8 +550,9 @@ static void iucv_disable(void)
551{ 550{
552 get_online_cpus(); 551 get_online_cpus();
553 on_each_cpu(iucv_retrieve_cpu, NULL, 1); 552 on_each_cpu(iucv_retrieve_cpu, NULL, 1);
554 put_online_cpus();
555 kfree(iucv_path_table); 553 kfree(iucv_path_table);
554 iucv_path_table = NULL;
555 put_online_cpus();
556} 556}
557 557
558static int __cpuinit iucv_cpu_notify(struct notifier_block *self, 558static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
@@ -589,10 +589,14 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
589 case CPU_ONLINE_FROZEN: 589 case CPU_ONLINE_FROZEN:
590 case CPU_DOWN_FAILED: 590 case CPU_DOWN_FAILED:
591 case CPU_DOWN_FAILED_FROZEN: 591 case CPU_DOWN_FAILED_FROZEN:
592 if (!iucv_path_table)
593 break;
592 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1); 594 smp_call_function_single(cpu, iucv_declare_cpu, NULL, 1);
593 break; 595 break;
594 case CPU_DOWN_PREPARE: 596 case CPU_DOWN_PREPARE:
595 case CPU_DOWN_PREPARE_FROZEN: 597 case CPU_DOWN_PREPARE_FROZEN:
598 if (!iucv_path_table)
599 break;
596 cpumask = iucv_buffer_cpumask; 600 cpumask = iucv_buffer_cpumask;
597 cpu_clear(cpu, cpumask); 601 cpu_clear(cpu, cpumask);
598 if (cpus_empty(cpumask)) 602 if (cpus_empty(cpumask))
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 3c94f76d5525..3eaa39403c13 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -54,10 +54,10 @@ static unsigned long rfkill_states_lockdflt[BITS_TO_LONGS(RFKILL_TYPE_MAX)];
54static bool rfkill_epo_lock_active; 54static bool rfkill_epo_lock_active;
55 55
56 56
57#ifdef CONFIG_RFKILL_LEDS
57static void rfkill_led_trigger(struct rfkill *rfkill, 58static void rfkill_led_trigger(struct rfkill *rfkill,
58 enum rfkill_state state) 59 enum rfkill_state state)
59{ 60{
60#ifdef CONFIG_RFKILL_LEDS
61 struct led_trigger *led = &rfkill->led_trigger; 61 struct led_trigger *led = &rfkill->led_trigger;
62 62
63 if (!led->name) 63 if (!led->name)
@@ -66,10 +66,8 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
66 led_trigger_event(led, LED_OFF); 66 led_trigger_event(led, LED_OFF);
67 else 67 else
68 led_trigger_event(led, LED_FULL); 68 led_trigger_event(led, LED_FULL);
69#endif /* CONFIG_RFKILL_LEDS */
70} 69}
71 70
72#ifdef CONFIG_RFKILL_LEDS
73static void rfkill_led_trigger_activate(struct led_classdev *led) 71static void rfkill_led_trigger_activate(struct led_classdev *led)
74{ 72{
75 struct rfkill *rfkill = container_of(led->trigger, 73 struct rfkill *rfkill = container_of(led->trigger,
diff --git a/net/sched/cls_u32.c b/net/sched/cls_u32.c
index 05d178008cbc..07372f60bee3 100644
--- a/net/sched/cls_u32.c
+++ b/net/sched/cls_u32.c
@@ -638,8 +638,9 @@ static int u32_change(struct tcf_proto *tp, unsigned long base, u32 handle,
638 break; 638 break;
639 639
640 n->next = *ins; 640 n->next = *ins;
641 wmb(); 641 tcf_tree_lock(tp);
642 *ins = n; 642 *ins = n;
643 tcf_tree_unlock(tp);
643 644
644 *arg = (unsigned long)n; 645 *arg = (unsigned long)n;
645 return 0; 646 return 0;
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
index 192453248870..577385a4a5dc 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
@@ -522,8 +522,6 @@ rpc_get_inode(struct super_block *sb, int mode)
522 if (!inode) 522 if (!inode)
523 return NULL; 523 return NULL;
524 inode->i_mode = mode; 524 inode->i_mode = mode;
525 inode->i_uid = inode->i_gid = 0;
526 inode->i_blocks = 0;
527 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 525 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
528 switch(mode & S_IFMT) { 526 switch(mode & S_IFMT) {
529 case S_IFDIR: 527 case S_IFDIR:
diff --git a/security/commoncap.c b/security/commoncap.c
index 79713545cd63..69fc9952650f 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -238,7 +238,7 @@ int cap_inode_need_killpriv(struct dentry *dentry)
238 struct inode *inode = dentry->d_inode; 238 struct inode *inode = dentry->d_inode;
239 int error; 239 int error;
240 240
241 if (!inode->i_op || !inode->i_op->getxattr) 241 if (!inode->i_op->getxattr)
242 return 0; 242 return 0;
243 243
244 error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0); 244 error = inode->i_op->getxattr(dentry, XATTR_NAME_CAPS, NULL, 0);
@@ -259,7 +259,7 @@ int cap_inode_killpriv(struct dentry *dentry)
259{ 259{
260 struct inode *inode = dentry->d_inode; 260 struct inode *inode = dentry->d_inode;
261 261
262 if (!inode->i_op || !inode->i_op->removexattr) 262 if (!inode->i_op->removexattr)
263 return 0; 263 return 0;
264 264
265 return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS); 265 return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS);
@@ -317,7 +317,7 @@ int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
317 317
318 memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data)); 318 memset(cpu_caps, 0, sizeof(struct cpu_vfs_cap_data));
319 319
320 if (!inode || !inode->i_op || !inode->i_op->getxattr) 320 if (!inode || !inode->i_op->getxattr)
321 return -ENODATA; 321 return -ENODATA;
322 322
323 size = inode->i_op->getxattr((struct dentry *)dentry, XATTR_NAME_CAPS, &caps, 323 size = inode->i_op->getxattr((struct dentry *)dentry, XATTR_NAME_CAPS, &caps,
diff --git a/security/inode.c b/security/inode.c
index efea5a605466..007ef252dde7 100644
--- a/security/inode.c
+++ b/security/inode.c
@@ -61,9 +61,6 @@ static struct inode *get_inode(struct super_block *sb, int mode, dev_t dev)
61 61
62 if (inode) { 62 if (inode) {
63 inode->i_mode = mode; 63 inode->i_mode = mode;
64 inode->i_uid = 0;
65 inode->i_gid = 0;
66 inode->i_blocks = 0;
67 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; 64 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
68 switch (mode & S_IFMT) { 65 switch (mode & S_IFMT) {
69 default: 66 default:
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index e5520996a75b..8f612c8becb5 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -847,8 +847,6 @@ static struct inode *sel_make_inode(struct super_block *sb, int mode)
847 847
848 if (ret) { 848 if (ret) {
849 ret->i_mode = mode; 849 ret->i_mode = mode;
850 ret->i_uid = ret->i_gid = 0;
851 ret->i_blocks = 0;
852 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME; 850 ret->i_atime = ret->i_mtime = ret->i_ctime = CURRENT_TIME;
853 } 851 }
854 return ret; 852 return ret;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index b20e1cede00b..75de40aaab0a 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <sound/core.h> 27#include <sound/core.h>
28#include <sound/jack.h>
29
28#include "hda_codec.h" 30#include "hda_codec.h"
29#include "hda_local.h" 31#include "hda_local.h"
30 32
@@ -37,8 +39,21 @@
37#define CONEXANT_HP_EVENT 0x37 39#define CONEXANT_HP_EVENT 0x37
38#define CONEXANT_MIC_EVENT 0x38 40#define CONEXANT_MIC_EVENT 0x38
39 41
42/* Conexant 5051 specific */
43
44#define CXT5051_SPDIF_OUT 0x1C
45#define CXT5051_PORTB_EVENT 0x38
46#define CXT5051_PORTC_EVENT 0x39
40 47
41 48
49struct conexant_jack {
50
51 hda_nid_t nid;
52 int type;
53 struct snd_jack *jack;
54
55};
56
42struct conexant_spec { 57struct conexant_spec {
43 58
44 struct snd_kcontrol_new *mixers[5]; 59 struct snd_kcontrol_new *mixers[5];
@@ -83,6 +98,9 @@ struct conexant_spec {
83 98
84 unsigned int spdif_route; 99 unsigned int spdif_route;
85 100
101 /* jack detection */
102 struct snd_array jacks;
103
86 /* dynamic controls, init_verbs and input_mux */ 104 /* dynamic controls, init_verbs and input_mux */
87 struct auto_pin_cfg autocfg; 105 struct auto_pin_cfg autocfg;
88 struct hda_input_mux private_imux; 106 struct hda_input_mux private_imux;
@@ -329,6 +347,86 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
329 &spec->cur_mux[adc_idx]); 347 &spec->cur_mux[adc_idx]);
330} 348}
331 349
350static int conexant_add_jack(struct hda_codec *codec,
351 hda_nid_t nid, int type)
352{
353 struct conexant_spec *spec;
354 struct conexant_jack *jack;
355 const char *name;
356
357 spec = codec->spec;
358 snd_array_init(&spec->jacks, sizeof(*jack), 32);
359 jack = snd_array_new(&spec->jacks);
360 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;
361
362 if (!jack)
363 return -ENOMEM;
364
365 jack->nid = nid;
366 jack->type = type;
367
368 return snd_jack_new(codec->bus->card, name, type, &jack->jack);
369}
370
371static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)
372{
373 struct conexant_spec *spec = codec->spec;
374 struct conexant_jack *jacks = spec->jacks.list;
375
376 if (jacks) {
377 int i;
378 for (i = 0; i < spec->jacks.used; i++) {
379 if (jacks->nid == nid) {
380 unsigned int present;
381 present = snd_hda_codec_read(codec, nid, 0,
382 AC_VERB_GET_PIN_SENSE, 0) &
383 AC_PINSENSE_PRESENCE;
384
385 present = (present) ? jacks->type : 0 ;
386
387 snd_jack_report(jacks->jack,
388 present);
389 }
390 jacks++;
391 }
392 }
393}
394
395static int conexant_init_jacks(struct hda_codec *codec)
396{
397#ifdef CONFIG_SND_JACK
398 struct conexant_spec *spec = codec->spec;
399 int i;
400
401 for (i = 0; i < spec->num_init_verbs; i++) {
402 const struct hda_verb *hv;
403
404 hv = spec->init_verbs[i];
405 while (hv->nid) {
406 int err = 0;
407 switch (hv->param ^ AC_USRSP_EN) {
408 case CONEXANT_HP_EVENT:
409 err = conexant_add_jack(codec, hv->nid,
410 SND_JACK_HEADPHONE);
411 conexant_report_jack(codec, hv->nid);
412 break;
413 case CXT5051_PORTC_EVENT:
414 case CONEXANT_MIC_EVENT:
415 err = conexant_add_jack(codec, hv->nid,
416 SND_JACK_MICROPHONE);
417 conexant_report_jack(codec, hv->nid);
418 break;
419 }
420 if (err < 0)
421 return err;
422 ++hv;
423 }
424 }
425#endif
426 return 0;
427
428}
429
332static int conexant_init(struct hda_codec *codec) 430static int conexant_init(struct hda_codec *codec)
333{ 431{
334 struct conexant_spec *spec = codec->spec; 432 struct conexant_spec *spec = codec->spec;
@@ -341,6 +439,16 @@ static int conexant_init(struct hda_codec *codec)
341 439
342static void conexant_free(struct hda_codec *codec) 440static void conexant_free(struct hda_codec *codec)
343{ 441{
442#ifdef CONFIG_SND_JACK
443 struct conexant_spec *spec = codec->spec;
444 if (spec->jacks.list) {
445 struct conexant_jack *jacks = spec->jacks.list;
446 int i;
447 for (i = 0; i < spec->jacks.used; i++)
448 snd_device_free(codec->bus->card, &jacks[i].jack);
449 snd_array_free(&spec->jacks);
450 }
451#endif
344 kfree(codec->spec); 452 kfree(codec->spec);
345} 453}
346 454
@@ -1526,9 +1634,6 @@ static int patch_cxt5047(struct hda_codec *codec)
1526/* Conexant 5051 specific */ 1634/* Conexant 5051 specific */
1527static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; 1635static hda_nid_t cxt5051_dac_nids[1] = { 0x10 };
1528static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; 1636static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 };
1529#define CXT5051_SPDIF_OUT 0x1C
1530#define CXT5051_PORTB_EVENT 0x38
1531#define CXT5051_PORTC_EVENT 0x39
1532 1637
1533static struct hda_channel_mode cxt5051_modes[1] = { 1638static struct hda_channel_mode cxt5051_modes[1] = {
1534 { 2, NULL }, 1639 { 2, NULL },
@@ -1608,6 +1713,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec)
1608static void cxt5051_hp_unsol_event(struct hda_codec *codec, 1713static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1609 unsigned int res) 1714 unsigned int res)
1610{ 1715{
1716 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20;
1611 switch (res >> 26) { 1717 switch (res >> 26) {
1612 case CONEXANT_HP_EVENT: 1718 case CONEXANT_HP_EVENT:
1613 cxt5051_hp_automute(codec); 1719 cxt5051_hp_automute(codec);
@@ -1619,6 +1725,7 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1619 cxt5051_portc_automic(codec); 1725 cxt5051_portc_automic(codec);
1620 break; 1726 break;
1621 } 1727 }
1728 conexant_report_jack(codec, nid);
1622} 1729}
1623 1730
1624static struct snd_kcontrol_new cxt5051_mixers[] = { 1731static struct snd_kcontrol_new cxt5051_mixers[] = {
@@ -1693,6 +1800,7 @@ static struct hda_verb cxt5051_init_verbs[] = {
1693static int cxt5051_init(struct hda_codec *codec) 1800static int cxt5051_init(struct hda_codec *codec)
1694{ 1801{
1695 conexant_init(codec); 1802 conexant_init(codec);
1803 conexant_init_jacks(codec);
1696 if (codec->patch_ops.unsol_event) { 1804 if (codec->patch_ops.unsol_event) {
1697 cxt5051_hp_automute(codec); 1805 cxt5051_hp_automute(codec);
1698 cxt5051_portb_automic(codec); 1806 cxt5051_portb_automic(codec);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 0bd4e6bf354d..9065ebf9c065 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8467,6 +8467,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
8467 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), 8467 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
8468 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8468 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
8469 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8469 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
8470 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
8470 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8471 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
8471 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8472 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
8472 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), 8473 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
@@ -16638,9 +16639,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {
16638 .patch = patch_alc882 }, /* should be patch_alc883() in future */ 16639 .patch = patch_alc882 }, /* should be patch_alc883() in future */
16639 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16640 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 },
16640 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, 16641 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 },
16641 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16642 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", 16642 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200",
16643 .patch = patch_alc883 }, 16643 .patch = patch_alc883 },
16644 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },
16644 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16645 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 },
16645 {} /* terminator */ 16646 {} /* terminator */
16646}; 16647};
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 0dfa0540ce2c..bb8d8c766b9d 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1239,7 +1239,7 @@ static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
1239 if (ice->force_pdma4 || ice->force_rdma1) 1239 if (ice->force_pdma4 || ice->force_rdma1)
1240 name = "ICE1724 Secondary"; 1240 name = "ICE1724 Secondary";
1241 else 1241 else
1242 name = "IEC1724 IEC958"; 1242 name = "ICE1724 IEC958";
1243 err = snd_pcm_new(ice->card, name, device, play, capt, &pcm); 1243 err = snd_pcm_new(ice->card, name, device, play, capt, &pcm);
1244 if (err < 0) 1244 if (err < 0)
1245 return err; 1245 return err;
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index 51848880504a..31e44e346dc8 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -298,30 +298,107 @@ static const struct soc_enum twl4030_handsfreer_enum =
298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control = 298static const struct snd_kcontrol_new twl4030_dapm_handsfreer_control =
299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum); 299SOC_DAPM_ENUM("Route", twl4030_handsfreer_enum);
300 300
301static int outmixer_event(struct snd_soc_dapm_widget *w, 301/* Left analog microphone selection */
302static const char *twl4030_analoglmic_texts[] =
303 {"Off", "Main mic", "Headset mic", "Invalid", "AUXL",
304 "Invalid", "Invalid", "Invalid", "Carkit mic"};
305
306static const struct soc_enum twl4030_analoglmic_enum =
307 SOC_ENUM_SINGLE(TWL4030_REG_ANAMICL, 0,
308 ARRAY_SIZE(twl4030_analoglmic_texts),
309 twl4030_analoglmic_texts);
310
311static const struct snd_kcontrol_new twl4030_dapm_analoglmic_control =
312SOC_DAPM_ENUM("Route", twl4030_analoglmic_enum);
313
314/* Right analog microphone selection */
315static const char *twl4030_analogrmic_texts[] =
316 {"Off", "Sub mic", "Invalid", "Invalid", "AUXR"};
317
318static const struct soc_enum twl4030_analogrmic_enum =
319 SOC_ENUM_SINGLE(TWL4030_REG_ANAMICR, 0,
320 ARRAY_SIZE(twl4030_analogrmic_texts),
321 twl4030_analogrmic_texts);
322
323static const struct snd_kcontrol_new twl4030_dapm_analogrmic_control =
324SOC_DAPM_ENUM("Route", twl4030_analogrmic_enum);
325
326/* TX1 L/R Analog/Digital microphone selection */
327static const char *twl4030_micpathtx1_texts[] =
328 {"Analog", "Digimic0"};
329
330static const struct soc_enum twl4030_micpathtx1_enum =
331 SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 0,
332 ARRAY_SIZE(twl4030_micpathtx1_texts),
333 twl4030_micpathtx1_texts);
334
335static const struct snd_kcontrol_new twl4030_dapm_micpathtx1_control =
336SOC_DAPM_ENUM("Route", twl4030_micpathtx1_enum);
337
338/* TX2 L/R Analog/Digital microphone selection */
339static const char *twl4030_micpathtx2_texts[] =
340 {"Analog", "Digimic1"};
341
342static const struct soc_enum twl4030_micpathtx2_enum =
343 SOC_ENUM_SINGLE(TWL4030_REG_ADCMICSEL, 2,
344 ARRAY_SIZE(twl4030_micpathtx2_texts),
345 twl4030_micpathtx2_texts);
346
347static const struct snd_kcontrol_new twl4030_dapm_micpathtx2_control =
348SOC_DAPM_ENUM("Route", twl4030_micpathtx2_enum);
349
350/*
351 * This function filters out the non valid mux settings, named as "Invalid"
352 * in the enum texts.
353 * Just refuse to set an invalid mux mode.
354 */
355static int twl4030_enum_event(struct snd_soc_dapm_widget *w,
302 struct snd_kcontrol *kcontrol, int event) 356 struct snd_kcontrol *kcontrol, int event)
303{ 357{
304 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 358 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
305 int ret = 0; 359 int ret = 0;
306 int val; 360 int val;
307 361
308 switch (e->reg) { 362 val = w->value >> e->shift_l;
309 case TWL4030_REG_PREDL_CTL: 363 if (!strcmp("Invalid", e->texts[val])) {
310 case TWL4030_REG_PREDR_CTL: 364 printk(KERN_WARNING "Invalid MUX setting on 0x%02x (%d)\n",
311 case TWL4030_REG_EAR_CTL: 365 e->reg, val);
312 val = w->value >> e->shift_l; 366 ret = -1;
313 if (val == 3) {
314 printk(KERN_WARNING
315 "Invalid MUX setting for register 0x%02x (%d)\n",
316 e->reg, val);
317 ret = -1;
318 }
319 break;
320 } 367 }
321 368
322 return ret; 369 return ret;
323} 370}
324 371
372static int micpath_event(struct snd_soc_dapm_widget *w,
373 struct snd_kcontrol *kcontrol, int event)
374{
375 struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value;
376 unsigned char adcmicsel, micbias_ctl;
377
378 adcmicsel = twl4030_read_reg_cache(w->codec, TWL4030_REG_ADCMICSEL);
379 micbias_ctl = twl4030_read_reg_cache(w->codec, TWL4030_REG_MICBIAS_CTL);
380 /* Prepare the bits for the given TX path:
381 * shift_l == 0: TX1 microphone path
382 * shift_l == 2: TX2 microphone path */
383 if (e->shift_l) {
384 /* TX2 microphone path */
385 if (adcmicsel & TWL4030_TX2IN_SEL)
386 micbias_ctl |= TWL4030_MICBIAS2_CTL; /* digimic */
387 else
388 micbias_ctl &= ~TWL4030_MICBIAS2_CTL;
389 } else {
390 /* TX1 microphone path */
391 if (adcmicsel & TWL4030_TX1IN_SEL)
392 micbias_ctl |= TWL4030_MICBIAS1_CTL; /* digimic */
393 else
394 micbias_ctl &= ~TWL4030_MICBIAS1_CTL;
395 }
396
397 twl4030_write(w->codec, TWL4030_REG_MICBIAS_CTL, micbias_ctl);
398
399 return 0;
400}
401
325static int handsfree_event(struct snd_soc_dapm_widget *w, 402static int handsfree_event(struct snd_soc_dapm_widget *w,
326 struct snd_kcontrol *kcontrol, int event) 403 struct snd_kcontrol *kcontrol, int event)
327{ 404{
@@ -503,162 +580,6 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
503 return err; 580 return err;
504} 581}
505 582
506static int twl4030_get_left_input(struct snd_kcontrol *kcontrol,
507 struct snd_ctl_elem_value *ucontrol)
508{
509 struct snd_soc_codec *codec = kcontrol->private_data;
510 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
511 int result = 0;
512
513 /* one bit must be set a time */
514 reg &= TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN
515 | TWL4030_MAINMIC_EN;
516 if (reg != 0) {
517 result++;
518 while ((reg & 1) == 0) {
519 result++;
520 reg >>= 1;
521 }
522 }
523
524 ucontrol->value.integer.value[0] = result;
525 return 0;
526}
527
528static int twl4030_put_left_input(struct snd_kcontrol *kcontrol,
529 struct snd_ctl_elem_value *ucontrol)
530{
531 struct snd_soc_codec *codec = kcontrol->private_data;
532 int value = ucontrol->value.integer.value[0];
533 u8 anamicl, micbias, avadc_ctl;
534
535 anamicl = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICL);
536 anamicl &= ~(TWL4030_CKMIC_EN | TWL4030_AUXL_EN | TWL4030_HSMIC_EN
537 | TWL4030_MAINMIC_EN);
538 micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL);
539 micbias &= ~(TWL4030_HSMICBIAS_EN | TWL4030_MICBIAS1_EN);
540 avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL);
541
542 switch (value) {
543 case 1:
544 anamicl |= TWL4030_MAINMIC_EN;
545 micbias |= TWL4030_MICBIAS1_EN;
546 break;
547 case 2:
548 anamicl |= TWL4030_HSMIC_EN;
549 micbias |= TWL4030_HSMICBIAS_EN;
550 break;
551 case 3:
552 anamicl |= TWL4030_AUXL_EN;
553 break;
554 case 4:
555 anamicl |= TWL4030_CKMIC_EN;
556 break;
557 default:
558 break;
559 }
560
561 /* If some input is selected, enable amp and ADC */
562 if (value != 0) {
563 anamicl |= TWL4030_MICAMPL_EN;
564 avadc_ctl |= TWL4030_ADCL_EN;
565 } else {
566 anamicl &= ~TWL4030_MICAMPL_EN;
567 avadc_ctl &= ~TWL4030_ADCL_EN;
568 }
569
570 twl4030_write(codec, TWL4030_REG_ANAMICL, anamicl);
571 twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias);
572 twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl);
573
574 return 1;
575}
576
577static int twl4030_get_right_input(struct snd_kcontrol *kcontrol,
578 struct snd_ctl_elem_value *ucontrol)
579{
580 struct snd_soc_codec *codec = kcontrol->private_data;
581 u8 reg = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR);
582 int value = 0;
583
584 reg &= TWL4030_SUBMIC_EN|TWL4030_AUXR_EN;
585 switch (reg) {
586 case TWL4030_SUBMIC_EN:
587 value = 1;
588 break;
589 case TWL4030_AUXR_EN:
590 value = 2;
591 break;
592 default:
593 break;
594 }
595
596 ucontrol->value.integer.value[0] = value;
597 return 0;
598}
599
600static int twl4030_put_right_input(struct snd_kcontrol *kcontrol,
601 struct snd_ctl_elem_value *ucontrol)
602{
603 struct snd_soc_codec *codec = kcontrol->private_data;
604 int value = ucontrol->value.integer.value[0];
605 u8 anamicr, micbias, avadc_ctl;
606
607 anamicr = twl4030_read_reg_cache(codec, TWL4030_REG_ANAMICR);
608 anamicr &= ~(TWL4030_SUBMIC_EN|TWL4030_AUXR_EN);
609 micbias = twl4030_read_reg_cache(codec, TWL4030_REG_MICBIAS_CTL);
610 micbias &= ~TWL4030_MICBIAS2_EN;
611 avadc_ctl = twl4030_read_reg_cache(codec, TWL4030_REG_AVADC_CTL);
612
613 switch (value) {
614 case 1:
615 anamicr |= TWL4030_SUBMIC_EN;
616 micbias |= TWL4030_MICBIAS2_EN;
617 break;
618 case 2:
619 anamicr |= TWL4030_AUXR_EN;
620 break;
621 default:
622 break;
623 }
624
625 if (value != 0) {
626 anamicr |= TWL4030_MICAMPR_EN;
627 avadc_ctl |= TWL4030_ADCR_EN;
628 } else {
629 anamicr &= ~TWL4030_MICAMPR_EN;
630 avadc_ctl &= ~TWL4030_ADCR_EN;
631 }
632
633 twl4030_write(codec, TWL4030_REG_ANAMICR, anamicr);
634 twl4030_write(codec, TWL4030_REG_MICBIAS_CTL, micbias);
635 twl4030_write(codec, TWL4030_REG_AVADC_CTL, avadc_ctl);
636
637 return 1;
638}
639
640static const char *twl4030_left_in_sel[] = {
641 "None",
642 "Main Mic",
643 "Headset Mic",
644 "Line In",
645 "Carkit Mic",
646};
647
648static const char *twl4030_right_in_sel[] = {
649 "None",
650 "Sub Mic",
651 "Line In",
652};
653
654static const struct soc_enum twl4030_left_input_mux =
655 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_left_in_sel),
656 twl4030_left_in_sel);
657
658static const struct soc_enum twl4030_right_input_mux =
659 SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(twl4030_right_in_sel),
660 twl4030_right_in_sel);
661
662/* 583/*
663 * FGAIN volume control: 584 * FGAIN volume control:
664 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB) 585 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
@@ -741,18 +662,15 @@ static const struct snd_kcontrol_new twl4030_snd_controls[] = {
741 TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl), 662 TWL4030_REG_EAR_CTL, 4, 3, 0, output_tvl),
742 663
743 /* Common capture gain controls */ 664 /* Common capture gain controls */
744 SOC_DOUBLE_R_TLV("Capture Volume", 665 SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume",
745 TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA, 666 TWL4030_REG_ATXL1PGA, TWL4030_REG_ATXR1PGA,
746 0, 0x1f, 0, digital_capture_tlv), 667 0, 0x1f, 0, digital_capture_tlv),
668 SOC_DOUBLE_R_TLV("TX2 Digital Capture Volume",
669 TWL4030_REG_AVTXL2PGA, TWL4030_REG_AVTXR2PGA,
670 0, 0x1f, 0, digital_capture_tlv),
747 671
748 SOC_DOUBLE_TLV("Input Boost Volume", TWL4030_REG_ANAMIC_GAIN, 672 SOC_DOUBLE_TLV("Analog Capture Volume", TWL4030_REG_ANAMIC_GAIN,
749 0, 3, 5, 0, input_gain_tlv), 673 0, 3, 5, 0, input_gain_tlv),
750
751 /* Input source controls */
752 SOC_ENUM_EXT("Left Input Source", twl4030_left_input_mux,
753 twl4030_get_left_input, twl4030_put_left_input),
754 SOC_ENUM_EXT("Right Input Source", twl4030_right_input_mux,
755 twl4030_get_right_input, twl4030_put_right_input),
756}; 674};
757 675
758/* add non dapm controls */ 676/* add non dapm controls */
@@ -772,9 +690,19 @@ static int twl4030_add_controls(struct snd_soc_codec *codec)
772} 690}
773 691
774static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { 692static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
775 SND_SOC_DAPM_INPUT("INL"), 693 /* Left channel inputs */
776 SND_SOC_DAPM_INPUT("INR"), 694 SND_SOC_DAPM_INPUT("MAINMIC"),
777 695 SND_SOC_DAPM_INPUT("HSMIC"),
696 SND_SOC_DAPM_INPUT("AUXL"),
697 SND_SOC_DAPM_INPUT("CARKITMIC"),
698 /* Right channel inputs */
699 SND_SOC_DAPM_INPUT("SUBMIC"),
700 SND_SOC_DAPM_INPUT("AUXR"),
701 /* Digital microphones (Stereo) */
702 SND_SOC_DAPM_INPUT("DIGIMIC0"),
703 SND_SOC_DAPM_INPUT("DIGIMIC1"),
704
705 /* Outputs */
778 SND_SOC_DAPM_OUTPUT("OUTL"), 706 SND_SOC_DAPM_OUTPUT("OUTL"),
779 SND_SOC_DAPM_OUTPUT("OUTR"), 707 SND_SOC_DAPM_OUTPUT("OUTR"),
780 SND_SOC_DAPM_OUTPUT("EARPIECE"), 708 SND_SOC_DAPM_OUTPUT("EARPIECE"),
@@ -810,14 +738,14 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
810 /* Output MUX controls */ 738 /* Output MUX controls */
811 /* Earpiece */ 739 /* Earpiece */
812 SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0, 740 SND_SOC_DAPM_MUX_E("Earpiece Mux", SND_SOC_NOPM, 0, 0,
813 &twl4030_dapm_earpiece_control, outmixer_event, 741 &twl4030_dapm_earpiece_control, twl4030_enum_event,
814 SND_SOC_DAPM_PRE_REG), 742 SND_SOC_DAPM_PRE_REG),
815 /* PreDrivL/R */ 743 /* PreDrivL/R */
816 SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0, 744 SND_SOC_DAPM_MUX_E("PredriveL Mux", SND_SOC_NOPM, 0, 0,
817 &twl4030_dapm_predrivel_control, outmixer_event, 745 &twl4030_dapm_predrivel_control, twl4030_enum_event,
818 SND_SOC_DAPM_PRE_REG), 746 SND_SOC_DAPM_PRE_REG),
819 SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0, 747 SND_SOC_DAPM_MUX_E("PredriveR Mux", SND_SOC_NOPM, 0, 0,
820 &twl4030_dapm_predriver_control, outmixer_event, 748 &twl4030_dapm_predriver_control, twl4030_enum_event,
821 SND_SOC_DAPM_PRE_REG), 749 SND_SOC_DAPM_PRE_REG),
822 /* HeadsetL/R */ 750 /* HeadsetL/R */
823 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0, 751 SND_SOC_DAPM_MUX("HeadsetL Mux", SND_SOC_NOPM, 0, 0,
@@ -837,8 +765,50 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
837 &twl4030_dapm_handsfreer_control, handsfree_event, 765 &twl4030_dapm_handsfreer_control, handsfree_event,
838 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), 766 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD),
839 767
840 SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), 768 /* Introducing four virtual ADC, since TWL4030 have four channel for
841 SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), 769 capture */
770 SND_SOC_DAPM_ADC("ADC Virtual Left1", "Left Front Capture",
771 SND_SOC_NOPM, 0, 0),
772 SND_SOC_DAPM_ADC("ADC Virtual Right1", "Right Front Capture",
773 SND_SOC_NOPM, 0, 0),
774 SND_SOC_DAPM_ADC("ADC Virtual Left2", "Left Rear Capture",
775 SND_SOC_NOPM, 0, 0),
776 SND_SOC_DAPM_ADC("ADC Virtual Right2", "Right Rear Capture",
777 SND_SOC_NOPM, 0, 0),
778
779 /* Analog/Digital mic path selection.
780 TX1 Left/Right: either analog Left/Right or Digimic0
781 TX2 Left/Right: either analog Left/Right or Digimic1 */
782 SND_SOC_DAPM_MUX_E("TX1 Capture Route", SND_SOC_NOPM, 0, 0,
783 &twl4030_dapm_micpathtx1_control, micpath_event,
784 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD|
785 SND_SOC_DAPM_POST_REG),
786 SND_SOC_DAPM_MUX_E("TX2 Capture Route", SND_SOC_NOPM, 0, 0,
787 &twl4030_dapm_micpathtx2_control, micpath_event,
788 SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD|
789 SND_SOC_DAPM_POST_REG),
790
791 /* Analog input muxes with power switch for the physical ADCL/R */
792 SND_SOC_DAPM_MUX_E("Analog Left Capture Route",
793 TWL4030_REG_AVADC_CTL, 3, 0, &twl4030_dapm_analoglmic_control,
794 twl4030_enum_event, SND_SOC_DAPM_PRE_REG),
795 SND_SOC_DAPM_MUX_E("Analog Right Capture Route",
796 TWL4030_REG_AVADC_CTL, 1, 0, &twl4030_dapm_analogrmic_control,
797 twl4030_enum_event, SND_SOC_DAPM_PRE_REG),
798
799 SND_SOC_DAPM_PGA("Analog Left Amplifier",
800 TWL4030_REG_ANAMICL, 4, 0, NULL, 0),
801 SND_SOC_DAPM_PGA("Analog Right Amplifier",
802 TWL4030_REG_ANAMICR, 4, 0, NULL, 0),
803
804 SND_SOC_DAPM_PGA("Digimic0 Enable",
805 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0),
806 SND_SOC_DAPM_PGA("Digimic1 Enable",
807 TWL4030_REG_ADCMICSEL, 3, 0, NULL, 0),
808
809 SND_SOC_DAPM_MICBIAS("Mic Bias 1", TWL4030_REG_MICBIAS_CTL, 0, 0),
810 SND_SOC_DAPM_MICBIAS("Mic Bias 2", TWL4030_REG_MICBIAS_CTL, 1, 0),
811 SND_SOC_DAPM_MICBIAS("Headset Mic Bias", TWL4030_REG_MICBIAS_CTL, 2, 0),
842}; 812};
843 813
844static const struct snd_soc_dapm_route intercon[] = { 814static const struct snd_soc_dapm_route intercon[] = {
@@ -894,9 +864,39 @@ static const struct snd_soc_dapm_route intercon[] = {
894 {"HFL", NULL, "HandsfreeL Mux"}, 864 {"HFL", NULL, "HandsfreeL Mux"},
895 {"HFR", NULL, "HandsfreeR Mux"}, 865 {"HFR", NULL, "HandsfreeR Mux"},
896 866
897 /* inputs */ 867 /* Capture path */
898 {"ADCL", NULL, "INL"}, 868 {"Analog Left Capture Route", "Main mic", "MAINMIC"},
899 {"ADCR", NULL, "INR"}, 869 {"Analog Left Capture Route", "Headset mic", "HSMIC"},
870 {"Analog Left Capture Route", "AUXL", "AUXL"},
871 {"Analog Left Capture Route", "Carkit mic", "CARKITMIC"},
872
873 {"Analog Right Capture Route", "Sub mic", "SUBMIC"},
874 {"Analog Right Capture Route", "AUXR", "AUXR"},
875
876 {"Analog Left Amplifier", NULL, "Analog Left Capture Route"},
877 {"Analog Right Amplifier", NULL, "Analog Right Capture Route"},
878
879 {"Digimic0 Enable", NULL, "DIGIMIC0"},
880 {"Digimic1 Enable", NULL, "DIGIMIC1"},
881
882 /* TX1 Left capture path */
883 {"TX1 Capture Route", "Analog", "Analog Left Amplifier"},
884 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
885 /* TX1 Right capture path */
886 {"TX1 Capture Route", "Analog", "Analog Right Amplifier"},
887 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
888 /* TX2 Left capture path */
889 {"TX2 Capture Route", "Analog", "Analog Left Amplifier"},
890 {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"},
891 /* TX2 Right capture path */
892 {"TX2 Capture Route", "Analog", "Analog Right Amplifier"},
893 {"TX2 Capture Route", "Digimic1", "Digimic1 Enable"},
894
895 {"ADC Virtual Left1", NULL, "TX1 Capture Route"},
896 {"ADC Virtual Right1", NULL, "TX1 Capture Route"},
897 {"ADC Virtual Left2", NULL, "TX2 Capture Route"},
898 {"ADC Virtual Right2", NULL, "TX2 Capture Route"},
899
900}; 900};
901 901
902static int twl4030_add_widgets(struct snd_soc_codec *codec) 902static int twl4030_add_widgets(struct snd_soc_codec *codec)
@@ -923,6 +923,7 @@ static void twl4030_power_up(struct snd_soc_codec *codec)
923 twl4030_write(codec, TWL4030_REG_ANAMICL, 923 twl4030_write(codec, TWL4030_REG_ANAMICL,
924 anamicl | TWL4030_CNCL_OFFSET_START); 924 anamicl | TWL4030_CNCL_OFFSET_START);
925 925
926
926 /* wait for offset cancellation to complete */ 927 /* wait for offset cancellation to complete */
927 do { 928 do {
928 /* this takes a little while, so don't slam i2c */ 929 /* this takes a little while, so don't slam i2c */
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h
index 54615c76802b..442e5a828617 100644
--- a/sound/soc/codecs/twl4030.h
+++ b/sound/soc/codecs/twl4030.h
@@ -147,6 +147,13 @@
147#define TWL4030_AVADC_CLK_PRIORITY 0x04 147#define TWL4030_AVADC_CLK_PRIORITY 0x04
148#define TWL4030_ADCR_EN 0x02 148#define TWL4030_ADCR_EN 0x02
149 149
150/* TWL4030_REG_ADCMICSEL (0x08) Fields */
151
152#define TWL4030_DIGMIC1_EN 0x08
153#define TWL4030_TX2IN_SEL 0x04
154#define TWL4030_DIGMIC0_EN 0x02
155#define TWL4030_TX1IN_SEL 0x01
156
150/* AUDIO_IF (0x0E) Fields */ 157/* AUDIO_IF (0x0E) Fields */
151 158
152#define TWL4030_AIF_SLAVE_EN 0x80 159#define TWL4030_AIF_SLAVE_EN 0x80
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c
index f67579d52765..4935d1bcbd8d 100644
--- a/sound/soc/davinci/davinci-sffsdr.c
+++ b/sound/soc/davinci/davinci-sffsdr.c
@@ -24,6 +24,7 @@
24#include <sound/soc-dapm.h> 24#include <sound/soc-dapm.h>
25 25
26#include <asm/dma.h> 26#include <asm/dma.h>
27#include <asm/mach-types.h>
27#include <asm/plat-sffsdr/sffsdr-fpga.h> 28#include <asm/plat-sffsdr/sffsdr-fpga.h>
28 29
29#include <mach/mcbsp.h> 30#include <mach/mcbsp.h>
@@ -115,6 +116,9 @@ static int __init sffsdr_init(void)
115{ 116{
116 int ret; 117 int ret;
117 118
119 if (!machine_is_sffsdr())
120 return -EINVAL;
121
118 sffsdr_snd_device = platform_device_alloc("soc-audio", 0); 122 sffsdr_snd_device = platform_device_alloc("soc-audio", 0);
119 if (!sffsdr_snd_device) { 123 if (!sffsdr_snd_device) {
120 printk(KERN_ERR "platform device allocation failed\n"); 124 printk(KERN_ERR "platform device allocation failed\n");
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index c670d08e7c9e..53b9fb127a6d 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -61,9 +61,9 @@ static int pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream)
61 61
62 __pxa2xx_pcm_hw_free(substream); 62 __pxa2xx_pcm_hw_free(substream);
63 63
64 if (prtd->dma_ch) { 64 if (prtd->dma_ch >= 0) {
65 pxa_free_dma(prtd->dma_ch); 65 pxa_free_dma(prtd->dma_ch);
66 prtd->dma_ch = 0; 66 prtd->dma_ch = -1;
67 } 67 }
68 68
69 return 0; 69 return 0;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b098c0b4c584..f73c1341437c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1300,6 +1300,8 @@ EXPORT_SYMBOL_GPL(snd_soc_test_bits);
1300/** 1300/**
1301 * snd_soc_new_pcms - create new sound card and pcms 1301 * snd_soc_new_pcms - create new sound card and pcms
1302 * @socdev: the SoC audio device 1302 * @socdev: the SoC audio device
1303 * @idx: ALSA card index
1304 * @xid: card identification
1303 * 1305 *
1304 * Create a new sound card based upon the codec and interface pcms. 1306 * Create a new sound card based upon the codec and interface pcms.
1305 * 1307 *
@@ -1472,7 +1474,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_runtime_hwparams);
1472 * snd_soc_cnew - create new control 1474 * snd_soc_cnew - create new control
1473 * @_template: control template 1475 * @_template: control template
1474 * @data: control private data 1476 * @data: control private data
1475 * @lnng_name: control long name 1477 * @long_name: control long name
1476 * 1478 *
1477 * Create a new mixer control from a template control. 1479 * Create a new mixer control from a template control.
1478 * 1480 *
@@ -1522,7 +1524,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_enum_double);
1522/** 1524/**
1523 * snd_soc_get_enum_double - enumerated double mixer get callback 1525 * snd_soc_get_enum_double - enumerated double mixer get callback
1524 * @kcontrol: mixer control 1526 * @kcontrol: mixer control
1525 * @uinfo: control element information 1527 * @ucontrol: control element information
1526 * 1528 *
1527 * Callback to get the value of a double enumerated mixer. 1529 * Callback to get the value of a double enumerated mixer.
1528 * 1530 *
@@ -1551,7 +1553,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_enum_double);
1551/** 1553/**
1552 * snd_soc_put_enum_double - enumerated double mixer put callback 1554 * snd_soc_put_enum_double - enumerated double mixer put callback
1553 * @kcontrol: mixer control 1555 * @kcontrol: mixer control
1554 * @uinfo: control element information 1556 * @ucontrol: control element information
1555 * 1557 *
1556 * Callback to set the value of a double enumerated mixer. 1558 * Callback to set the value of a double enumerated mixer.
1557 * 1559 *
@@ -1668,7 +1670,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw);
1668/** 1670/**
1669 * snd_soc_get_volsw - single mixer get callback 1671 * snd_soc_get_volsw - single mixer get callback
1670 * @kcontrol: mixer control 1672 * @kcontrol: mixer control
1671 * @uinfo: control element information 1673 * @ucontrol: control element information
1672 * 1674 *
1673 * Callback to get the value of a single mixer control. 1675 * Callback to get the value of a single mixer control.
1674 * 1676 *
@@ -1707,7 +1709,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw);
1707/** 1709/**
1708 * snd_soc_put_volsw - single mixer put callback 1710 * snd_soc_put_volsw - single mixer put callback
1709 * @kcontrol: mixer control 1711 * @kcontrol: mixer control
1710 * @uinfo: control element information 1712 * @ucontrol: control element information
1711 * 1713 *
1712 * Callback to set the value of a single mixer control. 1714 * Callback to set the value of a single mixer control.
1713 * 1715 *
@@ -1775,7 +1777,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_2r);
1775/** 1777/**
1776 * snd_soc_get_volsw_2r - double mixer get callback 1778 * snd_soc_get_volsw_2r - double mixer get callback
1777 * @kcontrol: mixer control 1779 * @kcontrol: mixer control
1778 * @uinfo: control element information 1780 * @ucontrol: control element information
1779 * 1781 *
1780 * Callback to get the value of a double mixer control that spans 2 registers. 1782 * Callback to get the value of a double mixer control that spans 2 registers.
1781 * 1783 *
@@ -1812,7 +1814,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_2r);
1812/** 1814/**
1813 * snd_soc_put_volsw_2r - double mixer set callback 1815 * snd_soc_put_volsw_2r - double mixer set callback
1814 * @kcontrol: mixer control 1816 * @kcontrol: mixer control
1815 * @uinfo: control element information 1817 * @ucontrol: control element information
1816 * 1818 *
1817 * Callback to set the value of a double mixer control that spans 2 registers. 1819 * Callback to set the value of a double mixer control that spans 2 registers.
1818 * 1820 *
@@ -1882,7 +1884,7 @@ EXPORT_SYMBOL_GPL(snd_soc_info_volsw_s8);
1882/** 1884/**
1883 * snd_soc_get_volsw_s8 - signed mixer get callback 1885 * snd_soc_get_volsw_s8 - signed mixer get callback
1884 * @kcontrol: mixer control 1886 * @kcontrol: mixer control
1885 * @uinfo: control element information 1887 * @ucontrol: control element information
1886 * 1888 *
1887 * Callback to get the value of a signed mixer control. 1889 * Callback to get the value of a signed mixer control.
1888 * 1890 *
@@ -1909,7 +1911,7 @@ EXPORT_SYMBOL_GPL(snd_soc_get_volsw_s8);
1909/** 1911/**
1910 * snd_soc_put_volsw_sgn - signed mixer put callback 1912 * snd_soc_put_volsw_sgn - signed mixer put callback
1911 * @kcontrol: mixer control 1913 * @kcontrol: mixer control
1912 * @uinfo: control element information 1914 * @ucontrol: control element information
1913 * 1915 *
1914 * Callback to set the value of a signed mixer control. 1916 * Callback to set the value of a signed mixer control.
1915 * 1917 *
@@ -1954,7 +1956,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk);
1954/** 1956/**
1955 * snd_soc_dai_set_clkdiv - configure DAI clock dividers. 1957 * snd_soc_dai_set_clkdiv - configure DAI clock dividers.
1956 * @dai: DAI 1958 * @dai: DAI
1957 * @clk_id: DAI specific clock divider ID 1959 * @div_id: DAI specific clock divider ID
1958 * @div: new clock divisor. 1960 * @div: new clock divisor.
1959 * 1961 *
1960 * Configures the clock dividers. This is used to derive the best DAI bit and 1962 * Configures the clock dividers. This is used to derive the best DAI bit and
@@ -2060,7 +2062,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute);
2060/** 2062/**
2061 * snd_soc_register_card - Register a card with the ASoC core 2063 * snd_soc_register_card - Register a card with the ASoC core
2062 * 2064 *
2063 * @param card Card to register 2065 * @card: Card to register
2064 * 2066 *
2065 * Note that currently this is an internal only function: it will be 2067 * Note that currently this is an internal only function: it will be
2066 * exposed to machine drivers after further backporting of ASoC v2 2068 * exposed to machine drivers after further backporting of ASoC v2
@@ -2087,7 +2089,7 @@ static int snd_soc_register_card(struct snd_soc_card *card)
2087/** 2089/**
2088 * snd_soc_unregister_card - Unregister a card with the ASoC core 2090 * snd_soc_unregister_card - Unregister a card with the ASoC core
2089 * 2091 *
2090 * @param card Card to unregister 2092 * @card: Card to unregister
2091 * 2093 *
2092 * Note that currently this is an internal only function: it will be 2094 * Note that currently this is an internal only function: it will be
2093 * exposed to machine drivers after further backporting of ASoC v2 2095 * exposed to machine drivers after further backporting of ASoC v2
@@ -2107,7 +2109,7 @@ static int snd_soc_unregister_card(struct snd_soc_card *card)
2107/** 2109/**
2108 * snd_soc_register_dai - Register a DAI with the ASoC core 2110 * snd_soc_register_dai - Register a DAI with the ASoC core
2109 * 2111 *
2110 * @param dai DAI to register 2112 * @dai: DAI to register
2111 */ 2113 */
2112int snd_soc_register_dai(struct snd_soc_dai *dai) 2114int snd_soc_register_dai(struct snd_soc_dai *dai)
2113{ 2115{
@@ -2134,7 +2136,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dai);
2134/** 2136/**
2135 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core 2137 * snd_soc_unregister_dai - Unregister a DAI from the ASoC core
2136 * 2138 *
2137 * @param dai DAI to unregister 2139 * @dai: DAI to unregister
2138 */ 2140 */
2139void snd_soc_unregister_dai(struct snd_soc_dai *dai) 2141void snd_soc_unregister_dai(struct snd_soc_dai *dai)
2140{ 2142{
@@ -2149,8 +2151,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dai);
2149/** 2151/**
2150 * snd_soc_register_dais - Register multiple DAIs with the ASoC core 2152 * snd_soc_register_dais - Register multiple DAIs with the ASoC core
2151 * 2153 *
2152 * @param dai Array of DAIs to register 2154 * @dai: Array of DAIs to register
2153 * @param count Number of DAIs 2155 * @count: Number of DAIs
2154 */ 2156 */
2155int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count) 2157int snd_soc_register_dais(struct snd_soc_dai *dai, size_t count)
2156{ 2158{
@@ -2175,8 +2177,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_dais);
2175/** 2177/**
2176 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core 2178 * snd_soc_unregister_dais - Unregister multiple DAIs from the ASoC core
2177 * 2179 *
2178 * @param dai Array of DAIs to unregister 2180 * @dai: Array of DAIs to unregister
2179 * @param count Number of DAIs 2181 * @count: Number of DAIs
2180 */ 2182 */
2181void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count) 2183void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count)
2182{ 2184{
@@ -2190,7 +2192,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);
2190/** 2192/**
2191 * snd_soc_register_platform - Register a platform with the ASoC core 2193 * snd_soc_register_platform - Register a platform with the ASoC core
2192 * 2194 *
2193 * @param platform platform to register 2195 * @platform: platform to register
2194 */ 2196 */
2195int snd_soc_register_platform(struct snd_soc_platform *platform) 2197int snd_soc_register_platform(struct snd_soc_platform *platform)
2196{ 2198{
@@ -2213,7 +2215,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform);
2213/** 2215/**
2214 * snd_soc_unregister_platform - Unregister a platform from the ASoC core 2216 * snd_soc_unregister_platform - Unregister a platform from the ASoC core
2215 * 2217 *
2216 * @param platform platform to unregister 2218 * @platform: platform to unregister
2217 */ 2219 */
2218void snd_soc_unregister_platform(struct snd_soc_platform *platform) 2220void snd_soc_unregister_platform(struct snd_soc_platform *platform)
2219{ 2221{
@@ -2228,7 +2230,7 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_platform);
2228/** 2230/**
2229 * snd_soc_register_codec - Register a codec with the ASoC core 2231 * snd_soc_register_codec - Register a codec with the ASoC core
2230 * 2232 *
2231 * @param codec codec to register 2233 * @codec: codec to register
2232 */ 2234 */
2233int snd_soc_register_codec(struct snd_soc_codec *codec) 2235int snd_soc_register_codec(struct snd_soc_codec *codec)
2234{ 2236{
@@ -2255,7 +2257,7 @@ EXPORT_SYMBOL_GPL(snd_soc_register_codec);
2255/** 2257/**
2256 * snd_soc_unregister_codec - Unregister a codec from the ASoC core 2258 * snd_soc_unregister_codec - Unregister a codec from the ASoC core
2257 * 2259 *
2258 * @param codec codec to unregister 2260 * @codec: codec to unregister
2259 */ 2261 */
2260void snd_soc_unregister_codec(struct snd_soc_codec *codec) 2262void snd_soc_unregister_codec(struct snd_soc_codec *codec)
2261{ 2263{
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8863eddbac02..6c79ca6df0bf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1077,7 +1077,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_new_widgets);
1077/** 1077/**
1078 * snd_soc_dapm_get_volsw - dapm mixer get callback 1078 * snd_soc_dapm_get_volsw - dapm mixer get callback
1079 * @kcontrol: mixer control 1079 * @kcontrol: mixer control
1080 * @uinfo: control element information 1080 * @ucontrol: control element information
1081 * 1081 *
1082 * Callback to get the value of a dapm mixer control. 1082 * Callback to get the value of a dapm mixer control.
1083 * 1083 *
@@ -1122,7 +1122,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_volsw);
1122/** 1122/**
1123 * snd_soc_dapm_put_volsw - dapm mixer set callback 1123 * snd_soc_dapm_put_volsw - dapm mixer set callback
1124 * @kcontrol: mixer control 1124 * @kcontrol: mixer control
1125 * @uinfo: control element information 1125 * @ucontrol: control element information
1126 * 1126 *
1127 * Callback to set the value of a dapm mixer control. 1127 * Callback to set the value of a dapm mixer control.
1128 * 1128 *
@@ -1193,7 +1193,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_put_volsw);
1193/** 1193/**
1194 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback 1194 * snd_soc_dapm_get_enum_double - dapm enumerated double mixer get callback
1195 * @kcontrol: mixer control 1195 * @kcontrol: mixer control
1196 * @uinfo: control element information 1196 * @ucontrol: control element information
1197 * 1197 *
1198 * Callback to get the value of a dapm enumerated double mixer control. 1198 * Callback to get the value of a dapm enumerated double mixer control.
1199 * 1199 *
@@ -1221,7 +1221,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
1221/** 1221/**
1222 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback 1222 * snd_soc_dapm_put_enum_double - dapm enumerated double mixer set callback
1223 * @kcontrol: mixer control 1223 * @kcontrol: mixer control
1224 * @uinfo: control element information 1224 * @ucontrol: control element information
1225 * 1225 *
1226 * Callback to set the value of a dapm enumerated double mixer control. 1226 * Callback to set the value of a dapm enumerated double mixer control.
1227 * 1227 *
@@ -1419,7 +1419,7 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
1419 1419
1420/** 1420/**
1421 * snd_soc_dapm_enable_pin - enable pin. 1421 * snd_soc_dapm_enable_pin - enable pin.
1422 * @snd_soc_codec: SoC codec 1422 * @codec: SoC codec
1423 * @pin: pin name 1423 * @pin: pin name
1424 * 1424 *
1425 * Enables input/output pin and it's parents or children widgets iff there is 1425 * Enables input/output pin and it's parents or children widgets iff there is
diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c
index b143ef7152f7..a62500e387a6 100644
--- a/sound/usb/caiaq/caiaq-device.c
+++ b/sound/usb/caiaq/caiaq-device.c
@@ -446,7 +446,7 @@ static int __devinit snd_probe(struct usb_interface *intf,
446 if (!card) 446 if (!card)
447 return -ENOMEM; 447 return -ENOMEM;
448 448
449 dev_set_drvdata(&intf->dev, card); 449 usb_set_intfdata(intf, card);
450 ret = init_card(caiaqdev(card)); 450 ret = init_card(caiaqdev(card));
451 if (ret < 0) { 451 if (ret < 0) {
452 log("unable to init card! (ret=%d)\n", ret); 452 log("unable to init card! (ret=%d)\n", ret);
@@ -460,7 +460,7 @@ static int __devinit snd_probe(struct usb_interface *intf,
460static void snd_disconnect(struct usb_interface *intf) 460static void snd_disconnect(struct usb_interface *intf)
461{ 461{
462 struct snd_usb_caiaqdev *dev; 462 struct snd_usb_caiaqdev *dev;
463 struct snd_card *card = dev_get_drvdata(&intf->dev); 463 struct snd_card *card = usb_get_intfdata(intf);
464 464
465 debug("%s(%p)\n", __func__, intf); 465 debug("%s(%p)\n", __func__, intf);
466 466
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index bbd70d5814a0..c709b9563226 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3709,7 +3709,7 @@ static int usb_audio_probe(struct usb_interface *intf,
3709 void *chip; 3709 void *chip;
3710 chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id); 3710 chip = snd_usb_audio_probe(interface_to_usbdev(intf), intf, id);
3711 if (chip) { 3711 if (chip) {
3712 dev_set_drvdata(&intf->dev, chip); 3712 usb_set_intfdata(intf, chip);
3713 return 0; 3713 return 0;
3714 } else 3714 } else
3715 return -EIO; 3715 return -EIO;
@@ -3718,13 +3718,13 @@ static int usb_audio_probe(struct usb_interface *intf,
3718static void usb_audio_disconnect(struct usb_interface *intf) 3718static void usb_audio_disconnect(struct usb_interface *intf)
3719{ 3719{
3720 snd_usb_audio_disconnect(interface_to_usbdev(intf), 3720 snd_usb_audio_disconnect(interface_to_usbdev(intf),
3721 dev_get_drvdata(&intf->dev)); 3721 usb_get_intfdata(intf));
3722} 3722}
3723 3723
3724#ifdef CONFIG_PM 3724#ifdef CONFIG_PM
3725static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message) 3725static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
3726{ 3726{
3727 struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); 3727 struct snd_usb_audio *chip = usb_get_intfdata(intf);
3728 struct list_head *p; 3728 struct list_head *p;
3729 struct snd_usb_stream *as; 3729 struct snd_usb_stream *as;
3730 3730
@@ -3744,7 +3744,7 @@ static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
3744 3744
3745static int usb_audio_resume(struct usb_interface *intf) 3745static int usb_audio_resume(struct usb_interface *intf)
3746{ 3746{
3747 struct snd_usb_audio *chip = dev_get_drvdata(&intf->dev); 3747 struct snd_usb_audio *chip = usb_get_intfdata(intf);
3748 3748
3749 if (chip == (void *)-1L) 3749 if (chip == (void *)-1L)
3750 return 0; 3750 return 0;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 6d9f9b135c62..320641ab5be7 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -1392,8 +1392,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1392 for (i = 0; i < intfd->bNumEndpoints; ++i) { 1392 for (i = 0; i < intfd->bNumEndpoints; ++i) {
1393 hostep = &hostif->endpoint[i]; 1393 hostep = &hostif->endpoint[i];
1394 ep = get_ep_desc(hostep); 1394 ep = get_ep_desc(hostep);
1395 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && 1395 if (!usb_endpoint_xfer_bulk(ep) && !usb_endpoint_xfer_int(ep))
1396 (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
1397 continue; 1396 continue;
1398 ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra; 1397 ms_ep = (struct usb_ms_endpoint_descriptor*)hostep->extra;
1399 if (hostep->extralen < 4 || 1398 if (hostep->extralen < 4 ||
@@ -1401,15 +1400,15 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1401 ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT || 1400 ms_ep->bDescriptorType != USB_DT_CS_ENDPOINT ||
1402 ms_ep->bDescriptorSubtype != MS_GENERAL) 1401 ms_ep->bDescriptorSubtype != MS_GENERAL)
1403 continue; 1402 continue;
1404 if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { 1403 if (usb_endpoint_dir_out(ep)) {
1405 if (endpoints[epidx].out_ep) { 1404 if (endpoints[epidx].out_ep) {
1406 if (++epidx >= MIDI_MAX_ENDPOINTS) { 1405 if (++epidx >= MIDI_MAX_ENDPOINTS) {
1407 snd_printk(KERN_WARNING "too many endpoints\n"); 1406 snd_printk(KERN_WARNING "too many endpoints\n");
1408 break; 1407 break;
1409 } 1408 }
1410 } 1409 }
1411 endpoints[epidx].out_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1410 endpoints[epidx].out_ep = usb_endpoint_num(ep);
1412 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1411 if (usb_endpoint_xfer_int(ep))
1413 endpoints[epidx].out_interval = ep->bInterval; 1412 endpoints[epidx].out_interval = ep->bInterval;
1414 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) 1413 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW)
1415 /* 1414 /*
@@ -1428,8 +1427,8 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,
1428 break; 1427 break;
1429 } 1428 }
1430 } 1429 }
1431 endpoints[epidx].in_ep = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1430 endpoints[epidx].in_ep = usb_endpoint_num(ep);
1432 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1431 if (usb_endpoint_xfer_int(ep))
1433 endpoints[epidx].in_interval = ep->bInterval; 1432 endpoints[epidx].in_interval = ep->bInterval;
1434 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW) 1433 else if (snd_usb_get_speed(umidi->chip->dev) == USB_SPEED_LOW)
1435 endpoints[epidx].in_interval = 1; 1434 endpoints[epidx].in_interval = 1;
@@ -1495,20 +1494,20 @@ static int snd_usbmidi_detect_endpoints(struct snd_usb_midi* umidi,
1495 1494
1496 for (i = 0; i < intfd->bNumEndpoints; ++i) { 1495 for (i = 0; i < intfd->bNumEndpoints; ++i) {
1497 epd = get_endpoint(hostif, i); 1496 epd = get_endpoint(hostif, i);
1498 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK && 1497 if (!usb_endpoint_xfer_bulk(epd) &&
1499 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) 1498 !usb_endpoint_xfer_int(epd))
1500 continue; 1499 continue;
1501 if (out_eps < max_endpoints && 1500 if (out_eps < max_endpoints &&
1502 (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) { 1501 usb_endpoint_dir_out(epd)) {
1503 endpoint[out_eps].out_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1502 endpoint[out_eps].out_ep = usb_endpoint_num(epd);
1504 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1503 if (usb_endpoint_xfer_int(epd))
1505 endpoint[out_eps].out_interval = epd->bInterval; 1504 endpoint[out_eps].out_interval = epd->bInterval;
1506 ++out_eps; 1505 ++out_eps;
1507 } 1506 }
1508 if (in_eps < max_endpoints && 1507 if (in_eps < max_endpoints &&
1509 (epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) { 1508 usb_endpoint_dir_in(epd)) {
1510 endpoint[in_eps].in_ep = epd->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1509 endpoint[in_eps].in_ep = usb_endpoint_num(epd);
1511 if ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_INT) 1510 if (usb_endpoint_xfer_int(epd))
1512 endpoint[in_eps].in_interval = epd->bInterval; 1511 endpoint[in_eps].in_interval = epd->bInterval;
1513 ++in_eps; 1512 ++in_eps;
1514 } 1513 }
@@ -1607,21 +1606,19 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
1607 } 1606 }
1608 1607
1609 epd = get_endpoint(hostif, 0); 1608 epd = get_endpoint(hostif, 0);
1610 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || 1609 if (!usb_endpoint_dir_in(epd) || !usb_endpoint_xfer_int(epd)) {
1611 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT) {
1612 snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n"); 1610 snd_printdd(KERN_ERR "endpoint[0] isn't interrupt\n");
1613 return -ENXIO; 1611 return -ENXIO;
1614 } 1612 }
1615 epd = get_endpoint(hostif, 2); 1613 epd = get_endpoint(hostif, 2);
1616 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || 1614 if (!usb_endpoint_dir_out(epd) || !usb_endpoint_xfer_bulk(epd)) {
1617 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) {
1618 snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n"); 1615 snd_printdd(KERN_ERR "endpoint[2] isn't bulk output\n");
1619 return -ENXIO; 1616 return -ENXIO;
1620 } 1617 }
1621 if (endpoint->out_cables > 0x0001) { 1618 if (endpoint->out_cables > 0x0001) {
1622 epd = get_endpoint(hostif, 4); 1619 epd = get_endpoint(hostif, 4);
1623 if ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_OUT || 1620 if (!usb_endpoint_dir_out(epd) ||
1624 (epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_BULK) { 1621 !usb_endpoint_xfer_bulk(epd)) {
1625 snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n"); 1622 snd_printdd(KERN_ERR "endpoint[4] isn't bulk output\n");
1626 return -ENXIO; 1623 return -ENXIO;
1627 } 1624 }
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index a49246113e75..00397c8a765b 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1755,11 +1755,10 @@ static int snd_usb_mixer_status_create(struct usb_mixer_interface *mixer)
1755 if (get_iface_desc(hostif)->bNumEndpoints < 1) 1755 if (get_iface_desc(hostif)->bNumEndpoints < 1)
1756 return 0; 1756 return 0;
1757 ep = get_endpoint(hostif, 0); 1757 ep = get_endpoint(hostif, 0);
1758 if ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) != USB_DIR_IN || 1758 if (!usb_endpoint_dir_in(ep) || !usb_endpoint_xfer_int(ep))
1759 (ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_INT)
1760 return 0; 1759 return 0;
1761 1760
1762 epnum = ep->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK; 1761 epnum = usb_endpoint_num(ep);
1763 buffer_length = le16_to_cpu(ep->wMaxPacketSize); 1762 buffer_length = le16_to_cpu(ep->wMaxPacketSize);
1764 transfer_buffer = kmalloc(buffer_length, GFP_KERNEL); 1763 transfer_buffer = kmalloc(buffer_length, GFP_KERNEL);
1765 if (!transfer_buffer) 1764 if (!transfer_buffer)
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index c2515b680f9f..73e59f4403a4 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -589,7 +589,7 @@ static int snd_us122l_suspend(struct usb_interface *intf, pm_message_t message)
589 struct us122l *us122l; 589 struct us122l *us122l;
590 struct list_head *p; 590 struct list_head *p;
591 591
592 card = dev_get_drvdata(&intf->dev); 592 card = usb_get_intfdata(intf);
593 if (!card) 593 if (!card)
594 return 0; 594 return 0;
595 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 595 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
@@ -615,7 +615,7 @@ static int snd_us122l_resume(struct usb_interface *intf)
615 struct list_head *p; 615 struct list_head *p;
616 int err; 616 int err;
617 617
618 card = dev_get_drvdata(&intf->dev); 618 card = usb_get_intfdata(intf);
619 if (!card) 619 if (!card)
620 return 0; 620 return 0;
621 621
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index e5981a630314..ca26c532e77e 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -392,7 +392,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i
392 void *chip; 392 void *chip;
393 chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id); 393 chip = usX2Y_usb_probe(interface_to_usbdev(intf), intf, id);
394 if (chip) { 394 if (chip) {
395 dev_set_drvdata(&intf->dev, chip); 395 usb_set_intfdata(intf, chip);
396 return 0; 396 return 0;
397 } else 397 } else
398 return -EIO; 398 return -EIO;
@@ -401,7 +401,7 @@ static int snd_usX2Y_probe(struct usb_interface *intf, const struct usb_device_i
401static void snd_usX2Y_disconnect(struct usb_interface *intf) 401static void snd_usX2Y_disconnect(struct usb_interface *intf)
402{ 402{
403 usX2Y_usb_disconnect(interface_to_usbdev(intf), 403 usX2Y_usb_disconnect(interface_to_usbdev(intf),
404 dev_get_drvdata(&intf->dev)); 404 usb_get_intfdata(intf));
405} 405}
406 406
407MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table); 407MODULE_DEVICE_TABLE(usb, snd_usX2Y_usb_id_table);