All of lore.kernel.org
 help / color / mirror / Atom feed
* [Drbd-dev] freeze under postmark io bench
@ 2006-02-10 18:17 Laurent Denel
  2006-03-11 16:35 ` Lars Ellenberg
  2006-03-30 17:52 ` Philipp Reisner
  0 siblings, 2 replies; 9+ messages in thread
From: Laurent Denel @ 2006-02-10 18:17 UTC (permalink / raw)
  To: drbd-dev

[-- Attachment #1: Type: text/plain, Size: 2610 bytes --]

Hi,

I'm currently experiencing freezes with drbd each time I run PostMark,
an io benchmark from NetApp. It was working all right on a 2.6.12
kernel and version 0.7.11 but I'm currently switching to 2.6.15 with
version 0.7.15.

Freezes occur on the primary node while creating thousands of files.
Secondary node is not impacted.

I've tried latest svn commit (2064) and kernel 2.6.15.4. Same problem.
My kernel is configured with high memory support (64GB), PREEMPT, ...
The filesystem drbd is on is xfs. Hardware is a pair of DL380 from HP.
Network for drbd is a private Gb link on bcm5700 interfaces.

You can find the postmark benchmark here :
http://www.eecs.harvard.edu/~syrah/filesystems/code/postmark-1_13.c
(The one we really use is 1_5 but I cannot find it anymore on the
Netapp website, I can post it if needed)

It's configured this way :
    set number 200000
    set transactions 1000000
    set size 500 10240
    set read 4096
    set write 4096

Here is my drbd.conf:
global {
        minor-count 5;
        dialog-refresh 5;
}

resource vol0 {
        protocol C;
        incon-degr-cmd "echo '!DRBD! pri on incon-degr' | wall ; sleep
60 ; halt -f";

        startup {
                wfc-timeout 60;
                degr-wfc-timeout 120;
        }

        disk {
                on-io-error detach;
        }

        net {
                on-disconnect reconnect;
        }

        syncer {
                rate 100M;
                group 1;
                al-extents 257;
        }

        on bwinf5401 {
                device /dev/drbd0;
                disk /dev/cciss/c0d0p10;
                meta-disk /dev/cciss/c0d0p7[0];
                address 10.0.0.1:7789;
        }

        on bwinf5402 {
                device /dev/drbd0;
                disk /dev/cciss/c0d0p10;
                meta-disk /dev/cciss/c0d0p7[0];
                address 10.0.0.2:7789;
        }
}

Here are my /proc/partitions :
major minor  #blocks  name

 104     0  142253280 cciss/c0d0
 104     1    1048559 cciss/c0d0p1
 104     2    1048560 cciss/c0d0p2
 104     3    2097120 cciss/c0d0p3
 104     4          1 cciss/c0d0p4
 104     5    1048559 cciss/c0d0p5
 104     6    1048559 cciss/c0d0p6
 104     7    1048544 cciss/c0d0p7
 104     8    2003264 cciss/c0d0p8
 104     9   58596944 cciss/c0d0p9
 104    10   74313104 cciss/c0d0p10
 147     0   74313104 drbd0


I've attached my .config.

Hope you will find this useful. I can test patched versions and would
be glad to do so.

Thanks in advance,
LD

[-- Attachment #2: config --]
[-- Type: application/octet-stream, Size: 27907 bytes --]

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.15.4
# Fri Feb 10 19:10:22 2006
#
CONFIG_X86_32=y
CONFIG_SEMAPHORE_SLEEPERS=y
CONFIG_X86=y
CONFIG_MMU=y
CONFIG_UID16=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_IOMAP=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y

#
# Code maturity level options
#
CONFIG_EXPERIMENTAL=y
CONFIG_CLEAN_COMPILE=y
CONFIG_LOCK_KERNEL=y
CONFIG_INIT_ENV_ARG_LIMIT=32

#
# General setup
#
CONFIG_LOCALVERSION="-AWL-messagerie"
CONFIG_LOCALVERSION_AUTO=y
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_POSIX_MQUEUE=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_SYSCTL=y
CONFIG_AUDIT=y
CONFIG_AUDITSYSCALL=y
CONFIG_HOTPLUG=y
CONFIG_KOBJECT_UEVENT=y
# CONFIG_IKCONFIG is not set
# CONFIG_CPUSETS is not set
CONFIG_INITRAMFS_SOURCE=""
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
# CONFIG_EMBEDDED is not set
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_ALL is not set
CONFIG_KALLSYMS_EXTRA_PASS=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SHMEM=y
CONFIG_CC_ALIGN_FUNCTIONS=0
CONFIG_CC_ALIGN_LABELS=0
CONFIG_CC_ALIGN_LOOPS=0
CONFIG_CC_ALIGN_JUMPS=0
# CONFIG_TINY_SHMEM is not set
CONFIG_BASE_SMALL=0

#
# Loadable module support
#
CONFIG_MODULES=y
CONFIG_MODULE_UNLOAD=y
CONFIG_MODULE_FORCE_UNLOAD=y
CONFIG_OBSOLETE_MODPARM=y
CONFIG_MODVERSIONS=y
CONFIG_MODULE_SRCVERSION_ALL=y
CONFIG_KMOD=y
CONFIG_STOP_MACHINE=y

#
# Block layer
#
CONFIG_LBD=y

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"

#
# Processor type and features
#
CONFIG_X86_PC=y
# CONFIG_X86_ELAN is not set
# CONFIG_X86_VOYAGER is not set
# CONFIG_X86_NUMAQ is not set
# CONFIG_X86_SUMMIT is not set
# CONFIG_X86_BIGSMP is not set
# CONFIG_X86_VISWS is not set
# CONFIG_X86_GENERICARCH is not set
# CONFIG_X86_ES7000 is not set
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
# CONFIG_MPENTIUMII is not set
# CONFIG_MPENTIUMIII is not set
# CONFIG_MPENTIUMM is not set
CONFIG_MPENTIUM4=y
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MEFFICEON is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MGEODEGX1 is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set
# CONFIG_X86_GENERIC is not set
CONFIG_X86_CMPXCHG=y
CONFIG_X86_XADD=y
CONFIG_X86_L1_CACHE_SHIFT=7
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_X86_WP_WORKS_OK=y
CONFIG_X86_INVLPG=y
CONFIG_X86_BSWAP=y
CONFIG_X86_POPAD_OK=y
CONFIG_X86_CMPXCHG64=y
CONFIG_X86_GOOD_APIC=y
CONFIG_X86_INTEL_USERCOPY=y
CONFIG_X86_USE_PPRO_CHECKSUM=y
CONFIG_X86_TSC=y
CONFIG_HPET_TIMER=y
CONFIG_HPET_EMULATE_RTC=y
CONFIG_SMP=y
CONFIG_NR_CPUS=4
CONFIG_SCHED_SMT=y
# CONFIG_PREEMPT_NONE is not set
# CONFIG_PREEMPT_VOLUNTARY is not set
CONFIG_PREEMPT=y
CONFIG_PREEMPT_BKL=y
CONFIG_X86_LOCAL_APIC=y
CONFIG_X86_IO_APIC=y
CONFIG_X86_MCE=y
CONFIG_X86_MCE_NONFATAL=y
CONFIG_X86_MCE_P4THERMAL=y
# CONFIG_TOSHIBA is not set
# CONFIG_I8K is not set
# CONFIG_X86_REBOOTFIXUPS is not set
# CONFIG_MICROCODE is not set
# CONFIG_X86_MSR is not set
# CONFIG_X86_CPUID is not set

#
# Firmware Drivers
#
# CONFIG_EDD is not set
# CONFIG_DELL_RBU is not set
CONFIG_DCDBAS=m
# CONFIG_NOHIGHMEM is not set
# CONFIG_HIGHMEM4G is not set
CONFIG_HIGHMEM64G=y
CONFIG_HIGHMEM=y
CONFIG_X86_PAE=y
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
# CONFIG_SPARSEMEM_STATIC is not set
CONFIG_SPLIT_PTLOCK_CPUS=4
CONFIG_HIGHPTE=y
# CONFIG_MATH_EMULATION is not set
CONFIG_MTRR=y
# CONFIG_EFI is not set
CONFIG_IRQBALANCE=y
# CONFIG_REGPARM is not set
CONFIG_SECCOMP=y
# CONFIG_HZ_100 is not set
CONFIG_HZ_250=y
# CONFIG_HZ_1000 is not set
CONFIG_HZ=250
CONFIG_PHYSICAL_START=0x100000
# CONFIG_KEXEC is not set

#
# Power management options (ACPI, APM)
#
CONFIG_PM=y
CONFIG_PM_LEGACY=y
# CONFIG_PM_DEBUG is not set

#
# ACPI (Advanced Configuration and Power Interface) Support
#
CONFIG_ACPI=y
# CONFIG_ACPI_AC is not set
# CONFIG_ACPI_BATTERY is not set
# CONFIG_ACPI_BUTTON is not set
# CONFIG_ACPI_VIDEO is not set
# CONFIG_ACPI_HOTKEY is not set
# CONFIG_ACPI_FAN is not set
# CONFIG_ACPI_PROCESSOR is not set
# CONFIG_ACPI_ASUS is not set
# CONFIG_ACPI_IBM is not set
# CONFIG_ACPI_TOSHIBA is not set
CONFIG_ACPI_BLACKLIST_YEAR=0
# CONFIG_ACPI_DEBUG is not set
CONFIG_ACPI_EC=y
CONFIG_ACPI_POWER=y
CONFIG_ACPI_SYSTEM=y
# CONFIG_X86_PM_TIMER is not set
# CONFIG_ACPI_CONTAINER is not set

#
# APM (Advanced Power Management) BIOS Support
#
# CONFIG_APM is not set

#
# CPU Frequency scaling
#
# CONFIG_CPU_FREQ is not set

#
# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
#
CONFIG_PCI=y
# CONFIG_PCI_GOBIOS is not set
# CONFIG_PCI_GOMMCONFIG is not set
# CONFIG_PCI_GODIRECT is not set
CONFIG_PCI_GOANY=y
CONFIG_PCI_BIOS=y
CONFIG_PCI_DIRECT=y
CONFIG_PCI_MMCONFIG=y
# CONFIG_PCIEPORTBUS is not set
# CONFIG_PCI_MSI is not set
# CONFIG_PCI_LEGACY_PROC is not set
# CONFIG_PCI_DEBUG is not set
CONFIG_ISA_DMA_API=y
CONFIG_ISA=y
# CONFIG_EISA is not set
# CONFIG_MCA is not set
# CONFIG_SCx200 is not set
# CONFIG_HOTPLUG_CPU is not set

#
# PCCARD (PCMCIA/CardBus) support
#
# CONFIG_PCCARD is not set

#
# PCI Hotplug Support
#
# CONFIG_HOTPLUG_PCI is not set

#
# Executable file formats
#
CONFIG_BINFMT_ELF=y
CONFIG_BINFMT_AOUT=y
CONFIG_BINFMT_MISC=y

#
# Networking
#
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
# CONFIG_NET_KEY is not set
CONFIG_INET=y
CONFIG_IP_MULTICAST=y
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
# CONFIG_IP_PNP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_IP_MROUTE is not set
# CONFIG_ARPD is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_TUNNEL is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_BIC=y

#
# IP: Virtual Server Configuration
#
# CONFIG_IP_VS is not set
# CONFIG_IPV6 is not set
CONFIG_NETFILTER=y
# CONFIG_NETFILTER_DEBUG is not set

#
# Core Netfilter Configuration
#
# CONFIG_NETFILTER_NETLINK is not set

#
# IP: Netfilter Configuration
#
CONFIG_IP_NF_CONNTRACK=m
# CONFIG_IP_NF_CT_ACCT is not set
# CONFIG_IP_NF_CONNTRACK_MARK is not set
# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
# CONFIG_IP_NF_CT_PROTO_SCTP is not set
# CONFIG_IP_NF_FTP is not set
# CONFIG_IP_NF_IRC is not set
# CONFIG_IP_NF_NETBIOS_NS is not set
# CONFIG_IP_NF_TFTP is not set
# CONFIG_IP_NF_AMANDA is not set
# CONFIG_IP_NF_PPTP is not set
# CONFIG_IP_NF_QUEUE is not set
CONFIG_IP_NF_IPTABLES=m
CONFIG_IP_NF_MATCH_LIMIT=m
CONFIG_IP_NF_MATCH_IPRANGE=m
CONFIG_IP_NF_MATCH_MAC=m
CONFIG_IP_NF_MATCH_PKTTYPE=m
CONFIG_IP_NF_MATCH_MARK=m
CONFIG_IP_NF_MATCH_MULTIPORT=m
CONFIG_IP_NF_MATCH_TOS=m
CONFIG_IP_NF_MATCH_RECENT=m
CONFIG_IP_NF_MATCH_ECN=m
CONFIG_IP_NF_MATCH_DSCP=m
CONFIG_IP_NF_MATCH_AH_ESP=m
CONFIG_IP_NF_MATCH_LENGTH=m
CONFIG_IP_NF_MATCH_TTL=m
CONFIG_IP_NF_MATCH_TCPMSS=m
CONFIG_IP_NF_MATCH_HELPER=m
CONFIG_IP_NF_MATCH_STATE=m
CONFIG_IP_NF_MATCH_CONNTRACK=m
CONFIG_IP_NF_MATCH_OWNER=m
# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
# CONFIG_IP_NF_MATCH_REALM is not set
# CONFIG_IP_NF_MATCH_SCTP is not set
# CONFIG_IP_NF_MATCH_DCCP is not set
# CONFIG_IP_NF_MATCH_COMMENT is not set
# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
# CONFIG_IP_NF_MATCH_STRING is not set
CONFIG_IP_NF_FILTER=m
CONFIG_IP_NF_TARGET_REJECT=m
CONFIG_IP_NF_TARGET_LOG=m
CONFIG_IP_NF_TARGET_ULOG=m
CONFIG_IP_NF_TARGET_TCPMSS=m
# CONFIG_IP_NF_TARGET_NFQUEUE is not set
CONFIG_IP_NF_NAT=m
CONFIG_IP_NF_NAT_NEEDED=y
CONFIG_IP_NF_TARGET_MASQUERADE=m
CONFIG_IP_NF_TARGET_REDIRECT=m
CONFIG_IP_NF_TARGET_NETMAP=m
CONFIG_IP_NF_TARGET_SAME=m
# CONFIG_IP_NF_NAT_SNMP_BASIC is not set
CONFIG_IP_NF_MANGLE=m
CONFIG_IP_NF_TARGET_TOS=m
CONFIG_IP_NF_TARGET_ECN=m
CONFIG_IP_NF_TARGET_DSCP=m
CONFIG_IP_NF_TARGET_MARK=m
CONFIG_IP_NF_TARGET_CLASSIFY=m
# CONFIG_IP_NF_TARGET_TTL is not set
CONFIG_IP_NF_RAW=m
CONFIG_IP_NF_TARGET_NOTRACK=m
CONFIG_IP_NF_ARPTABLES=m
CONFIG_IP_NF_ARPFILTER=m
CONFIG_IP_NF_ARP_MANGLE=m

#
# DCCP Configuration (EXPERIMENTAL)
#
# CONFIG_IP_DCCP is not set

#
# SCTP Configuration (EXPERIMENTAL)
#
# CONFIG_IP_SCTP is not set
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_NET_DIVERT is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set

#
# QoS and/or fair queueing
#
# CONFIG_NET_SCHED is not set

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_IEEE80211 is not set

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
# CONFIG_DEBUG_DRIVER is not set

#
# Connector - unified userspace <-> kernelspace linker
#
# CONFIG_CONNECTOR is not set

#
# Memory Technology Devices (MTD)
#
# CONFIG_MTD is not set

#
# Parallel port support
#
# CONFIG_PARPORT is not set

#
# Plug and Play support
#
# CONFIG_PNP is not set

#
# Block devices
#
CONFIG_BLK_DEV_FD=y
# CONFIG_BLK_DEV_XD is not set
# CONFIG_BLK_CPQ_DA is not set
CONFIG_BLK_CPQ_CISS_DA=y
# CONFIG_CISS_SCSI_TAPE is not set
# CONFIG_BLK_DEV_DAC960 is not set
# CONFIG_BLK_DEV_UMEM is not set
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
CONFIG_BLK_DEV_NBD=y
# CONFIG_BLK_DEV_SX8 is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=4096
# CONFIG_BLK_DEV_INITRD is not set
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set

#
# ATA/ATAPI/MFM/RLL support
#
CONFIG_IDE=y
CONFIG_BLK_DEV_IDE=y

#
# Please see Documentation/ide.txt for help/info on IDE drives
#
# CONFIG_BLK_DEV_IDE_SATA is not set
# CONFIG_BLK_DEV_HD_IDE is not set
CONFIG_BLK_DEV_IDEDISK=y
CONFIG_IDEDISK_MULTI_MODE=y
CONFIG_BLK_DEV_IDECD=y
# CONFIG_BLK_DEV_IDETAPE is not set
# CONFIG_BLK_DEV_IDEFLOPPY is not set
# CONFIG_BLK_DEV_IDESCSI is not set
# CONFIG_IDE_TASK_IOCTL is not set

#
# IDE chipset support/bugfixes
#
CONFIG_IDE_GENERIC=y
# CONFIG_BLK_DEV_CMD640 is not set
CONFIG_BLK_DEV_IDEPCI=y
CONFIG_IDEPCI_SHARE_IRQ=y
# CONFIG_BLK_DEV_OFFBOARD is not set
CONFIG_BLK_DEV_GENERIC=y
# CONFIG_BLK_DEV_OPTI621 is not set
CONFIG_BLK_DEV_RZ1000=y
CONFIG_BLK_DEV_IDEDMA_PCI=y
# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
CONFIG_IDEDMA_PCI_AUTO=y
# CONFIG_IDEDMA_ONLYDISK is not set
# CONFIG_BLK_DEV_AEC62XX is not set
# CONFIG_BLK_DEV_ALI15X3 is not set
# CONFIG_BLK_DEV_AMD74XX is not set
# CONFIG_BLK_DEV_ATIIXP is not set
# CONFIG_BLK_DEV_CMD64X is not set
# CONFIG_BLK_DEV_TRIFLEX is not set
# CONFIG_BLK_DEV_CY82C693 is not set
# CONFIG_BLK_DEV_CS5520 is not set
# CONFIG_BLK_DEV_CS5530 is not set
# CONFIG_BLK_DEV_CS5535 is not set
# CONFIG_BLK_DEV_HPT34X is not set
# CONFIG_BLK_DEV_HPT366 is not set
# CONFIG_BLK_DEV_SC1200 is not set
# CONFIG_BLK_DEV_PIIX is not set
# CONFIG_BLK_DEV_IT821X is not set
# CONFIG_BLK_DEV_NS87415 is not set
# CONFIG_BLK_DEV_PDC202XX_OLD is not set
# CONFIG_BLK_DEV_PDC202XX_NEW is not set
CONFIG_BLK_DEV_SVWKS=y
# CONFIG_BLK_DEV_SIIMAGE is not set
# CONFIG_BLK_DEV_SIS5513 is not set
# CONFIG_BLK_DEV_SLC90E66 is not set
# CONFIG_BLK_DEV_TRM290 is not set
# CONFIG_BLK_DEV_VIA82CXXX is not set
# CONFIG_IDE_ARM is not set
# CONFIG_IDE_CHIPSETS is not set
CONFIG_BLK_DEV_IDEDMA=y
# CONFIG_IDEDMA_IVB is not set
CONFIG_IDEDMA_AUTO=y
# CONFIG_BLK_DEV_HD is not set

#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
CONFIG_CHR_DEV_SG=y
# CONFIG_CHR_DEV_SCH is not set

#
# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
#
# CONFIG_SCSI_MULTI_LUN is not set
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set

#
# SCSI Transport Attributes
#
# CONFIG_SCSI_SPI_ATTRS is not set
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_ATTRS is not set

#
# SCSI low-level drivers
#
# CONFIG_ISCSI_TCP is not set
# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
# CONFIG_SCSI_3W_9XXX is not set
# CONFIG_SCSI_7000FASST is not set
# CONFIG_SCSI_ACARD is not set
# CONFIG_SCSI_AHA152X is not set
# CONFIG_SCSI_AHA1542 is not set
# CONFIG_SCSI_AACRAID is not set
# CONFIG_SCSI_AIC7XXX is not set
# CONFIG_SCSI_AIC7XXX_OLD is not set
# CONFIG_SCSI_AIC79XX is not set
# CONFIG_SCSI_DPT_I2O is not set
# CONFIG_SCSI_IN2000 is not set
# CONFIG_MEGARAID_NEWGEN is not set
# CONFIG_MEGARAID_LEGACY is not set
# CONFIG_MEGARAID_SAS is not set
# CONFIG_SCSI_SATA is not set
# CONFIG_SCSI_BUSLOGIC is not set
# CONFIG_SCSI_DMX3191D is not set
# CONFIG_SCSI_DTC3280 is not set
# CONFIG_SCSI_EATA is not set
# CONFIG_SCSI_FUTURE_DOMAIN is not set
# CONFIG_SCSI_GDTH is not set
# CONFIG_SCSI_GENERIC_NCR5380 is not set
# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
# CONFIG_SCSI_IPS is not set
# CONFIG_SCSI_INITIO is not set
# CONFIG_SCSI_INIA100 is not set
# CONFIG_SCSI_NCR53C406A is not set
# CONFIG_SCSI_SYM53C8XX_2 is not set
# CONFIG_SCSI_IPR is not set
# CONFIG_SCSI_PAS16 is not set
# CONFIG_SCSI_PSI240I is not set
# CONFIG_SCSI_QLOGIC_FAS is not set
# CONFIG_SCSI_QLOGIC_FC is not set
# CONFIG_SCSI_QLOGIC_1280 is not set
CONFIG_SCSI_QLA2XXX=y
# CONFIG_SCSI_QLA21XX is not set
# CONFIG_SCSI_QLA22XX is not set
# CONFIG_SCSI_QLA2300 is not set
# CONFIG_SCSI_QLA2322 is not set
# CONFIG_SCSI_QLA6312 is not set
# CONFIG_SCSI_QLA24XX is not set
# CONFIG_SCSI_LPFC is not set
# CONFIG_SCSI_SYM53C416 is not set
# CONFIG_SCSI_DC395x is not set
# CONFIG_SCSI_DC390T is not set
# CONFIG_SCSI_T128 is not set
# CONFIG_SCSI_U14_34F is not set
# CONFIG_SCSI_ULTRASTOR is not set
# CONFIG_SCSI_NSP32 is not set
# CONFIG_SCSI_DEBUG is not set

#
# Old CD-ROM drivers (not SCSI, not IDE)
#
# CONFIG_CD_NO_IDESCSI is not set

#
# Multi-device support (RAID and LVM)
#
# CONFIG_MD is not set

#
# Fusion MPT device support
#
# CONFIG_FUSION is not set
# CONFIG_FUSION_SPI is not set
# CONFIG_FUSION_FC is not set
# CONFIG_FUSION_SAS is not set

#
# IEEE 1394 (FireWire) support
#
# CONFIG_IEEE1394 is not set

#
# I2O device support
#
# CONFIG_I2O is not set

#
# Network device support
#
CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
CONFIG_BONDING=m
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set

#
# ARCnet devices
#
# CONFIG_ARCNET is not set

#
# PHY device support
#
# CONFIG_PHYLIB is not set

#
# Ethernet (10 or 100Mbit)
#
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
# CONFIG_HAPPYMEAL is not set
# CONFIG_SUNGEM is not set
# CONFIG_CASSINI is not set
# CONFIG_NET_VENDOR_3COM is not set
# CONFIG_LANCE is not set
# CONFIG_NET_VENDOR_SMC is not set
# CONFIG_NET_VENDOR_RACAL is not set

#
# Tulip family network device support
#
# CONFIG_NET_TULIP is not set
# CONFIG_AT1700 is not set
# CONFIG_DEPCA is not set
# CONFIG_HP100 is not set
# CONFIG_NET_ISA is not set
CONFIG_NET_PCI=y
# CONFIG_PCNET32 is not set
# CONFIG_AMD8111_ETH is not set
# CONFIG_ADAPTEC_STARFIRE is not set
# CONFIG_AC3200 is not set
# CONFIG_APRICOT is not set
# CONFIG_B44 is not set
# CONFIG_FORCEDETH is not set
# CONFIG_CS89x0 is not set
# CONFIG_DGRS is not set
# CONFIG_EEPRO100 is not set
CONFIG_E100=m
# CONFIG_FEALNX is not set
# CONFIG_NATSEMI is not set
# CONFIG_NE2K_PCI is not set
# CONFIG_8139CP is not set
# CONFIG_8139TOO is not set
# CONFIG_SIS900 is not set
# CONFIG_EPIC100 is not set
# CONFIG_SUNDANCE is not set
# CONFIG_TLAN is not set
# CONFIG_VIA_RHINE is not set

#
# Ethernet (1000 Mbit)
#
# CONFIG_ACENIC is not set
# CONFIG_DL2K is not set
CONFIG_E1000=m
CONFIG_E1000_NAPI=y
# CONFIG_NS83820 is not set
# CONFIG_HAMACHI is not set
# CONFIG_YELLOWFIN is not set
# CONFIG_R8169 is not set
# CONFIG_SIS190 is not set
# CONFIG_SKGE is not set
# CONFIG_SK98LIN is not set
# CONFIG_VIA_VELOCITY is not set
CONFIG_TIGON3=m
# CONFIG_BNX2 is not set

#
# Ethernet (10000 Mbit)
#
# CONFIG_CHELSIO_T1 is not set
# CONFIG_IXGB is not set
# CONFIG_S2IO is not set

#
# Token Ring devices
#
# CONFIG_TR is not set

#
# Wireless LAN (non-hamradio)
#
# CONFIG_NET_RADIO is not set

#
# Wan interfaces
#
# CONFIG_WAN is not set
# CONFIG_FDDI is not set
# CONFIG_HIPPI is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NET_FC is not set
# CONFIG_SHAPER is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set

#
# ISDN subsystem
#
# CONFIG_ISDN is not set

#
# Telephony Support
#
# CONFIG_PHONE is not set

#
# Input device support
#
CONFIG_INPUT=y

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
CONFIG_INPUT_MOUSEDEV_PSAUX=y
CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
# CONFIG_INPUT_JOYDEV is not set
# CONFIG_INPUT_TSDEV is not set
# CONFIG_INPUT_EVDEV is not set
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_KEYBOARD_NEWTON is not set
CONFIG_INPUT_MOUSE=y
CONFIG_MOUSE_PS2=y
# CONFIG_MOUSE_SERIAL is not set
# CONFIG_MOUSE_INPORT is not set
# CONFIG_MOUSE_LOGIBM is not set
# CONFIG_MOUSE_PC110PAD is not set
# CONFIG_MOUSE_VSXXXAA is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_I8042=y
# CONFIG_SERIO_SERPORT is not set
# CONFIG_SERIO_CT82C710 is not set
# CONFIG_SERIO_PCIPS2 is not set
CONFIG_SERIO_LIBPS2=y
# CONFIG_SERIO_RAW is not set
# CONFIG_GAMEPORT is not set

#
# Character devices
#
CONFIG_VT=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_SERIAL_NONSTANDARD is not set

#
# Serial drivers
#
CONFIG_SERIAL_8250=y
# CONFIG_SERIAL_8250_CONSOLE is not set
# CONFIG_SERIAL_8250_ACPI is not set
CONFIG_SERIAL_8250_NR_UARTS=4
# CONFIG_SERIAL_8250_EXTENDED is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_CORE=y
# CONFIG_SERIAL_JSM is not set
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=256

#
# IPMI
#
# CONFIG_IPMI_HANDLER is not set

#
# Watchdog Cards
#
# CONFIG_WATCHDOG is not set
# CONFIG_HW_RANDOM is not set
# CONFIG_NVRAM is not set
CONFIG_RTC=y
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
# CONFIG_SONYPI is not set

#
# Ftape, the floppy tape device driver
#
# CONFIG_AGP is not set
# CONFIG_DRM is not set
# CONFIG_MWAVE is not set
# CONFIG_RAW_DRIVER is not set
CONFIG_HPET=y
# CONFIG_HPET_RTC_IRQ is not set
CONFIG_HPET_MMAP=y
# CONFIG_HANGCHECK_TIMER is not set

#
# TPM devices
#
# CONFIG_TCG_TPM is not set
# CONFIG_TELCLOCK is not set

#
# I2C support
#
# CONFIG_I2C is not set

#
# Dallas's 1-wire bus
#
# CONFIG_W1 is not set

#
# Hardware Monitoring support
#
CONFIG_HWMON=y
# CONFIG_HWMON_VID is not set
# CONFIG_SENSORS_HDAPS is not set
# CONFIG_HWMON_DEBUG_CHIP is not set

#
# Misc devices
#
# CONFIG_IBM_ASM is not set

#
# Multimedia Capabilities Port drivers
#

#
# Multimedia devices
#
# CONFIG_VIDEO_DEV is not set

#
# Digital Video Broadcasting Devices
#
# CONFIG_DVB is not set

#
# Graphics support
#
# CONFIG_FB is not set
# CONFIG_VIDEO_SELECT is not set

#
# Console display driver support
#
CONFIG_VGA_CONSOLE=y
# CONFIG_MDA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y

#
# Sound
#
# CONFIG_SOUND is not set

#
# USB support
#
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
CONFIG_USB=m
# CONFIG_USB_DEBUG is not set

#
# Miscellaneous USB options
#
# CONFIG_USB_DEVICEFS is not set
# CONFIG_USB_BANDWIDTH is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_SUSPEND is not set
# CONFIG_USB_OTG is not set

#
# USB Host Controller Drivers
#
CONFIG_USB_EHCI_HCD=m
# CONFIG_USB_EHCI_SPLIT_ISO is not set
# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
# CONFIG_USB_ISP116X_HCD is not set
CONFIG_USB_OHCI_HCD=m
# CONFIG_USB_OHCI_BIG_ENDIAN is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
CONFIG_USB_UHCI_HCD=m
# CONFIG_USB_SL811_HCD is not set

#
# USB Device Class drivers
#
# CONFIG_USB_ACM is not set
# CONFIG_USB_PRINTER is not set

#
# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
#

#
# may also be needed; see USB_STORAGE Help for more information
#
CONFIG_USB_STORAGE=m
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_DPCM is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set

#
# USB Input Devices
#
# CONFIG_USB_HID is not set

#
# USB HID Boot Protocol drivers
#
# CONFIG_USB_KBD is not set
# CONFIG_USB_MOUSE is not set
# CONFIG_USB_AIPTEK is not set
# CONFIG_USB_WACOM is not set
# CONFIG_USB_ACECAD is not set
# CONFIG_USB_KBTAB is not set
# CONFIG_USB_POWERMATE is not set
# CONFIG_USB_MTOUCH is not set
# CONFIG_USB_ITMTOUCH is not set
# CONFIG_USB_EGALAX is not set
# CONFIG_USB_YEALINK is not set
# CONFIG_USB_XPAD is not set
# CONFIG_USB_ATI_REMOTE is not set
# CONFIG_USB_KEYSPAN_REMOTE is not set
# CONFIG_USB_APPLETOUCH is not set

#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set

#
# USB Multimedia devices
#
# CONFIG_USB_DABUSB is not set

#
# Video4Linux support is needed for USB Multimedia device support
#

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_USBNET is not set
# CONFIG_USB_MON is not set

#
# USB port drivers
#

#
# USB Serial Converter support
#
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_AUERSWALD is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_LEGOTOWER is not set
# CONFIG_USB_LCD is not set
# CONFIG_USB_LED is not set
# CONFIG_USB_CYTHERM is not set
# CONFIG_USB_PHIDGETKIT is not set
# CONFIG_USB_PHIDGETSERVO is not set
# CONFIG_USB_IDMOUSE is not set
# CONFIG_USB_SISUSBVGA is not set
# CONFIG_USB_LD is not set

#
# USB DSL modem support
#

#
# USB Gadget Support
#
# CONFIG_USB_GADGET is not set

#
# MMC/SD Card support
#
# CONFIG_MMC is not set

#
# InfiniBand support
#
# CONFIG_INFINIBAND is not set

#
# SN Devices
#

#
# File systems
#
CONFIG_EXT2_FS=y
# CONFIG_EXT2_FS_XATTR is not set
# CONFIG_EXT2_FS_XIP is not set
CONFIG_EXT3_FS=y
CONFIG_EXT3_FS_XATTR=y
# CONFIG_EXT3_FS_POSIX_ACL is not set
# CONFIG_EXT3_FS_SECURITY is not set
CONFIG_JBD=y
# CONFIG_JBD_DEBUG is not set
CONFIG_FS_MBCACHE=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_FS_POSIX_ACL is not set
CONFIG_XFS_FS=y
# CONFIG_XFS_QUOTA is not set
# CONFIG_XFS_SECURITY is not set
# CONFIG_XFS_POSIX_ACL is not set
# CONFIG_XFS_RT is not set
CONFIG_OCFS2_FS=m
# CONFIG_MINIX_FS is not set
# CONFIG_ROMFS_FS is not set
CONFIG_INOTIFY=y
# CONFIG_QUOTA is not set
CONFIG_DNOTIFY=y
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_FUSE_FS is not set

#
# CD-ROM/DVD Filesystems
#
CONFIG_ISO9660_FS=y
CONFIG_JOLIET=y
# CONFIG_ZISOFS is not set
CONFIG_UDF_FS=y
CONFIG_UDF_NLS=y

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
# CONFIG_NTFS_FS is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_KCORE=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
# CONFIG_HUGETLBFS is not set
# CONFIG_HUGETLB_PAGE is not set
CONFIG_RAMFS=y
# CONFIG_RELAYFS_FS is not set
CONFIG_CONFIGFS_FS=m

#
# Miscellaneous filesystems
#
# CONFIG_ADFS_FS is not set
# CONFIG_AFFS_FS is not set
# CONFIG_HFS_FS is not set
# CONFIG_HFSPLUS_FS is not set
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
# CONFIG_CRAMFS is not set
# CONFIG_VXFS_FS is not set
# CONFIG_HPFS_FS is not set
# CONFIG_QNX4FS_FS is not set
# CONFIG_SYSV_FS is not set
# CONFIG_UFS_FS is not set

#
# Network File Systems
#
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
# CONFIG_NFS_V3_ACL is not set
# CONFIG_NFS_V4 is not set
CONFIG_NFS_DIRECTIO=y
# CONFIG_NFSD is not set
CONFIG_LOCKD=y
CONFIG_LOCKD_V4=y
CONFIG_NFS_COMMON=y
CONFIG_SUNRPC=y
# CONFIG_RPCSEC_GSS_KRB5 is not set
# CONFIG_RPCSEC_GSS_SPKM3 is not set
# CONFIG_SMB_FS is not set
# CONFIG_CIFS is not set
# CONFIG_NCP_FS is not set
# CONFIG_CODA_FS is not set
# CONFIG_AFS_FS is not set
# CONFIG_9P_FS is not set

#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not set
CONFIG_MSDOS_PARTITION=y

#
# Native Language Support
#
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
CONFIG_NLS_ASCII=y
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
# CONFIG_NLS_ISO8859_15 is not set
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y

#
# Instrumentation Support
#
CONFIG_PROFILING=y
CONFIG_OPROFILE=y
# CONFIG_KPROBES is not set

#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
CONFIG_DEBUG_KERNEL=y
CONFIG_MAGIC_SYSRQ=y
CONFIG_LOG_BUF_SHIFT=15
CONFIG_DETECT_SOFTLOCKUP=y
# CONFIG_SCHEDSTATS is not set
# CONFIG_DEBUG_SLAB is not set
CONFIG_DEBUG_PREEMPT=y
# CONFIG_DEBUG_SPINLOCK is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_KOBJECT is not set
# CONFIG_DEBUG_HIGHMEM is not set
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_FS is not set
# CONFIG_DEBUG_VM is not set
# CONFIG_FRAME_POINTER is not set
# CONFIG_RCU_TORTURE_TEST is not set
CONFIG_EARLY_PRINTK=y
# CONFIG_DEBUG_STACKOVERFLOW is not set
# CONFIG_DEBUG_STACK_USAGE is not set
# CONFIG_DEBUG_PAGEALLOC is not set
CONFIG_4KSTACKS=y
CONFIG_X86_FIND_SMP_CONFIG=y
CONFIG_X86_MPPARSE=y

#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY is not set

#
# Cryptographic options
#
# CONFIG_CRYPTO is not set

#
# Hardware crypto devices
#

#
# Library routines
#
CONFIG_CRC_CCITT=y
# CONFIG_CRC16 is not set
CONFIG_CRC32=y
CONFIG_LIBCRC32C=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_PENDING_IRQ=y
CONFIG_X86_SMP=y
CONFIG_X86_HT=y
CONFIG_X86_BIOS_REBOOT=y
CONFIG_X86_TRAMPOLINE=y


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-02-10 18:17 [Drbd-dev] freeze under postmark io bench Laurent Denel
@ 2006-03-11 16:35 ` Lars Ellenberg
  2006-03-22 18:46   ` Laurent Denel
  2006-03-30 17:52 ` Philipp Reisner
  1 sibling, 1 reply; 9+ messages in thread
From: Lars Ellenberg @ 2006-03-11 16:35 UTC (permalink / raw)
  To: drbd-dev

/ 2006-02-10 19:17:17 +0100
\ Laurent Denel:


Sorry for answering so late, and for letting this post lingering on hold
for over a month now. Seemingly 'someone' [guess who that might have
been *gee*] did not take his duty being moderator for drbd-dev too
seriously...


> I'm currently experiencing freezes with drbd each time I run PostMark,
> an io benchmark from NetApp. It was working all right on a 2.6.12
> kernel and version 0.7.11 but I'm currently switching to 2.6.15 with
> version 0.7.15.
> 
> Freezes occur on the primary node while creating thousands of files.
> Secondary node is not impacted.
> 
> I've tried latest svn commit (2064) and kernel 2.6.15.4. Same problem.
> My kernel is configured with high memory support (64GB), PREEMPT, ...
> The filesystem drbd is on is xfs. Hardware is a pair of DL380 from HP.
> Network for drbd is a private Gb link on bcm5700 interfaces.
> 
> You can find the postmark benchmark here :
> http://www.eecs.harvard.edu/~syrah/filesystems/code/postmark-1_13.c
> (The one we really use is 1_5 but I cannot find it anymore on the
> Netapp website, I can post it if needed)

please try with latest svn
 svn co http://svn.drbd.org/drbd/branches/drbd-0.7

I just checked in a one line change where we used GFP_KERNEL where we
should have used GFP_NOIO...

cheers,

-- 
: Lars Ellenberg                                  Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH            Fax +43-1-8178292-82 :
: Schoenbrunner Str. 244, A-1120 Vienna/Europe   http://www.linbit.com :

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-11 16:35 ` Lars Ellenberg
@ 2006-03-22 18:46   ` Laurent Denel
  2006-03-22 22:35     ` Lars Ellenberg
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Denel @ 2006-03-22 18:46 UTC (permalink / raw)
  To: drbd-dev

> please try with latest svn
>  svn co http://svn.drbd.org/drbd/branches/drbd-0.7
>
> I just checked in a one line change where we used GFP_KERNEL where we
> should have used GFP_NOIO...

Thanks a lot for the answer, I wondered if my bug report wasn't too
stupid to reach the mass audiences ;).

I've just tried today with kernel 2.6.16 (sorry for that kernel are
evolving fast here ;), if needed I can test with the 2.6.15.4 we had)
and Monday's latest svn.

Postmark 200k files creation completed successfully but the
transaction part crashed again the host. Could there be the same bug
elsewhere in the code ?

Cheers,
LD

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-22 18:46   ` Laurent Denel
@ 2006-03-22 22:35     ` Lars Ellenberg
  2006-03-23  8:08       ` Laurent Denel
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Ellenberg @ 2006-03-22 22:35 UTC (permalink / raw)
  To: drbd-dev

/ 2006-03-22 19:46:13 +0100
\ Laurent Denel:
> > please try with latest svn
> >  svn co http://svn.drbd.org/drbd/branches/drbd-0.7
> >
> > I just checked in a one line change where we used GFP_KERNEL where we
> > should have used GFP_NOIO...
> 
> Thanks a lot for the answer, I wondered if my bug report wasn't too
> stupid to reach the mass audiences ;).
> 
> I've just tried today with kernel 2.6.16 (sorry for that kernel are
> evolving fast here ;), if needed I can test with the 2.6.15.4 we had)
> and Monday's latest svn.
> 
> Postmark 200k files creation completed successfully but the
> transaction part crashed again the host. Could there be the same bug
> elsewhere in the code ?

No.
I think.
I reviewed all places with GFP_somthing,
and I did not see any other memory allocation
without NOIO in the io path. But I may have overlooked something.

what do you mean by "crashed the host"?
any output anywhere?
any reaction to ping, keyboard, numlock-led-toggle, sysrq keys?
nmi-watchdog enabled? does it trigger?
are you comfortable to recompile the kernel with the kernel debugger enabled,
and go into the kernel debugger when it "crashes" again, and see what it
thinks it does, where it thinks it is stuck?

-- 
: Lars Ellenberg                                  Tel +43-1-8178292-55 :
: LINBIT Information Technologies GmbH            Fax +43-1-8178292-82 :
: Schoenbrunner Str. 244, A-1120 Vienna/Europe   http://www.linbit.com :

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-22 22:35     ` Lars Ellenberg
@ 2006-03-23  8:08       ` Laurent Denel
  2006-03-28 16:33         ` Laurent Denel
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Denel @ 2006-03-23  8:08 UTC (permalink / raw)
  To: drbd-dev

Hi,

Quick answer, I'll try to get some more time on that later today.

> what do you mean by "crashed the host"?

The host is inside a server room, I don't have any quick access to it
yet, I'll configure the iLO remote management stuff later today. So
far the crash is :
- ssh console frozen
- no more ssh access (timeout)
- ping still ok
- "Unknown" status for the host seen on the other node
- automated reboot by HP's bios after 15 min.

> any output anywhere?

nothing into the syslog files as usual when the kernel has hard time ;)
but here is the output of drdb before the crash (maybe to validate my conf) :

Mar 22 19:03:42 bwinf5401 kernel: drbd: initialised. Version: 0.7.17
(api:77/proto:74)
Mar 22 19:03:42 bwinf5401 kernel: drbd: SVN Revision: 2111 build by
root@wingate03, 2006-03-20 14:26:07
Mar 22 19:03:42 bwinf5401 kernel: drbd: registered as block device major 147
Mar 22 19:04:54 bwinf5401 kernel: drbd0: resync bitmap: bits=18578276
words=580572
Mar 22 19:04:54 bwinf5401 kernel: drbd0: size = 70 GB (74313104 KB)
Mar 22 19:04:55 bwinf5401 kernel: drbd0: 0 KB marked out-of-sync by on
disk bit-map.
Mar 22 19:04:55 bwinf5401 kernel: drbd0: Found 6 transactions (324
active extents) in activity log.
Mar 22 19:04:55 bwinf5401 kernel: drbd0: drbdsetup [1850]: cstate
Unconfigured --> StandAlone
Mar 22 19:04:55 bwinf5401 kernel: drbd0: drbdsetup [1853]: cstate
StandAlone --> Unconnected
Mar 22 19:04:55 bwinf5401 kernel: drbd0: drbd0_receiver [1854]: cstate
Unconnected --> WFConnection
Mar 22 19:06:29 bwinf5401 kernel: bcm5700: eth1 NIC Link is Down
Mar 22 19:06:40 bwinf5401 kernel: bcm5700: eth1 NIC Link is Up, 1000
Mbps full duplex
Mar 22 19:07:55 bwinf5401 kernel: bcm5700: eth1 NIC Link is Down
Mar 22 19:07:57 bwinf5401 kernel: bcm5700: eth1 NIC Link is Up, 1000
Mbps full duplex, receive & transmit flow control ON
Mar 22 19:09:23 bwinf5401 kernel: drbd0: drbd0_receiver [1854]: cstate
WFConnection --> WFReportParams
Mar 22 19:09:23 bwinf5401 kernel: drbd0: Handshake successful: DRBD
Network Protocol version 74
Mar 22 19:09:23 bwinf5401 kernel: drbd0: Connection established.
Mar 22 19:09:23 bwinf5401 kernel: drbd0: I am(S):
1:00000002:00000001:0000000e:00000005:00
Mar 22 19:09:23 bwinf5401 kernel: drbd0: Peer(S):
1:00000002:00000001:0000000e:00000005:00
Mar 22 19:09:23 bwinf5401 kernel: drbd0: drbd0_receiver [1854]: cstate
WFReportParams --> Connected
Mar 22 19:09:23 bwinf5401 kernel: drbd0: Secondary/Unknown -->
Secondary/Secondary
Mar 22 19:09:53 bwinf5401 kernel: drbd0: drbdsetup [2129]: cstate
Connected --> Unconnected
Mar 22 19:09:53 bwinf5401 kernel: drbd0: drbd0_receiver [1854]: cstate
Unconnected --> BrokenPipe
Mar 22 19:09:53 bwinf5401 kernel: drbd0: short read expecting header
on sock: r=-512
Mar 22 19:09:53 bwinf5401 kernel: drbd0: worker terminated
Mar 22 19:09:53 bwinf5401 kernel: drbd0: asender terminated
Mar 22 19:09:53 bwinf5401 kernel: drbd0: drbd0_receiver [1854]: cstate
BrokenPipe --> StandAlone
Mar 22 19:09:53 bwinf5401 kernel: drbd0: Connection lost.
Mar 22 19:09:53 bwinf5401 kernel: drbd0: receiver terminated
Mar 22 19:09:53 bwinf5401 kernel: drbd0: drbdsetup [2129]: cstate
StandAlone --> StandAlone
Mar 22 19:09:53 bwinf5401 kernel: drbd0: drbdsetup [2129]: cstate
StandAlone --> Unconfigured
Mar 22 19:09:53 bwinf5401 kernel: drbd0: worker terminated
Mar 22 19:10:05 bwinf5401 kernel: drbd0: resync bitmap: bits=18578276
words=580572
Mar 22 19:10:05 bwinf5401 kernel: drbd0: size = 70 GB (74313104 KB)
Mar 22 19:10:06 bwinf5401 kernel: drbd0: 0 KB marked out-of-sync by on
disk bit-map.
Mar 22 19:10:06 bwinf5401 kernel: drbd0: Found 6 transactions (324
active extents) in activity log.
Mar 22 19:10:06 bwinf5401 kernel: drbd0: drbdsetup [2194]: cstate
Unconfigured --> StandAlone
Mar 22 19:10:06 bwinf5401 kernel: drbd0: drbdsetup [2197]: cstate
StandAlone --> Unconnected
Mar 22 19:10:06 bwinf5401 kernel: drbd0: drbd0_receiver [2198]: cstate
Unconnected --> WFConnection
Mar 22 19:10:06 bwinf5401 kernel: drbd0: drbd0_receiver [2198]: cstate
WFConnection --> WFReportParams
Mar 22 19:10:06 bwinf5401 kernel: drbd0: Handshake successful: DRBD
Network Protocol version 74
Mar 22 19:10:06 bwinf5401 kernel: drbd0: Connection established.
Mar 22 19:10:06 bwinf5401 kernel: drbd0: I am(S):
1:00000002:00000001:0000000e:00000005:01
Mar 22 19:10:06 bwinf5401 kernel: drbd0: Peer(S):
1:00000002:00000001:0000000e:00000005:01
Mar 22 19:10:06 bwinf5401 kernel: drbd0: drbd0_receiver [2198]: cstate
WFReportParams --> Connected
Mar 22 19:10:06 bwinf5401 kernel: drbd0: Secondary/Unknown -->
Secondary/Secondary
Mar 22 19:10:31 bwinf5401 kernel: drbd0: Secondary/Secondary -->
Primary/Secondary


> any reaction to ping, keyboard, numlock-led-toggle, sysrq keys?
> nmi-watchdog enabled? does it trigger?
> are you comfortable to recompile the kernel with the kernel debugger enabled,
> and go into the kernel debugger when it "crashes" again, and see what it
> thinks it does, where it thinks it is stuck?

no problem to recompile a kernel with the debugger
this will be my first time using it but I'm looking forward to learn...

LD

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-23  8:08       ` Laurent Denel
@ 2006-03-28 16:33         ` Laurent Denel
  2006-03-30  9:33           ` Philipp Reisner
  0 siblings, 1 reply; 9+ messages in thread
From: Laurent Denel @ 2006-03-28 16:33 UTC (permalink / raw)
  To: drbd-dev

Finally, I've been able to capture some traces when the host hangs,
iLO remote access has been set up today. Hope this helps.

Cheers
LD

Unable to handle kernel paging request at virtual address 98393c38
  printing eip:
c01124ae
*pde = 00000000
Oops: 0000 [#1]
PREEMPT SMP
Modules linked in: drbd bcm5700
CPU:    134217728
EIP:    0060:[<c01124ae>]    Not tainted VLI
EFLAGS: 00010206   (2.6.16-AWL-messagerie #1)
EIP is at do_page_fault+0x96/0x51f
eax: f7c21000   ebx: f7c22078   ecx: 0000007b   edx: 98393bc0
esi: 98393bc0   edi: c0112418   ebp: 98393c38   esp: f7c210a0
ds: 007b   es: 007b   ss: 0068
Unable to handle kernel NULL pointer dereference at virtual address 0000000c
  printing eip:
c01990db
*pde = 37ee3001
BUG: soft lockup detected on CPU#0!

Pid: 2565, comm:                  sar
EIP: 0060:[<c031c840>] CPU: 0
EIP is at _spin_lock+0x3f/0x59
  EFLAGS: 00000202    Not tainted  (2.6.16-AWL-messagerie #1)
EAX: 00000000 EBX: c0370a18 ECX: 00000001 EDX: 00000001
ESI: 00000001 EDI: 00000032 EBP: c2383740 DS: 007b ES: 007b
CR0: 8005003b CR2: bf8decec CR3: 37f81880 CR4: 000006f0
 [<c010d215>] smp_call_function+0x13/0x104
 [<c0141f47>] set_page_address+0x114/0x159
 [<c010d1ac>] flush_tlb_all+0x1a/0x43
 [<c010d13b>] do_flush_tlb_all+0x0/0x57
 [<c0141767>] kmap_high+0x51/0x19b
 [<c013c5b4>] get_page_from_freelist+0x70/0x88
 [<c013c612>] __alloc_pages+0x46/0x25f
 [<c015db5a>] pipe_writev+0x1ef/0x380
 [<c015dd10>] pipe_write+0x25/0x29
 [<c0152ed8>] vfs_write+0x87/0x11b
 [<c015300a>] sys_write+0x3b/0x63
 [<c01027ef>] sysenter_past_esp+0x54/0x75

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-28 16:33         ` Laurent Denel
@ 2006-03-30  9:33           ` Philipp Reisner
  0 siblings, 0 replies; 9+ messages in thread
From: Philipp Reisner @ 2006-03-30  9:33 UTC (permalink / raw)
  To: drbd-dev

Am Dienstag, 28. März 2006 18:33 schrieb Laurent Denel:
> Finally, I've been able to capture some traces when the host hangs,
> iLO remote access has been set up today. Hope this helps.
>

I do not think that this has anything to do with DRBD. In the call
graph is no single trace of DRBD, nor is it one of DRBD's kernel
threads.

I think that this report should go to the kernel-mailing list.

-Philipp
-- 
: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Schönbrunnerstr 244, 1120 Vienna, Austria    http://www.linbit.com :

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-02-10 18:17 [Drbd-dev] freeze under postmark io bench Laurent Denel
  2006-03-11 16:35 ` Lars Ellenberg
@ 2006-03-30 17:52 ` Philipp Reisner
  2006-03-31  7:47   ` Laurent Denel
  1 sibling, 1 reply; 9+ messages in thread
From: Philipp Reisner @ 2006-03-30 17:52 UTC (permalink / raw)
  To: drbd-dev


> You can find the postmark benchmark here :
> http://www.eecs.harvard.edu/~syrah/filesystems/code/postmark-1_13.c
> (The one we really use is 1_5 but I cannot find it anymore on the
> Netapp website, I can post it if needed)

Hi Laurent,

Could you send me please that 1_5 release of that benchmark ?

Thanks! - We will try to reproduce this here.

-Philipp
-- 
: Dipl-Ing Philipp Reisner                      Tel +43-1-8178292-50 :
: LINBIT Information Technologies GmbH          Fax +43-1-8178292-82 :
: Schönbrunnerstr 244, 1120 Vienna, Austria    http://www.linbit.com :

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Drbd-dev] freeze under postmark io bench
  2006-03-30 17:52 ` Philipp Reisner
@ 2006-03-31  7:47   ` Laurent Denel
  0 siblings, 0 replies; 9+ messages in thread
From: Laurent Denel @ 2006-03-31  7:47 UTC (permalink / raw)
  To: Philipp Reisner; +Cc: drbd-dev

[-- Attachment #1: Type: text/plain, Size: 1102 bytes --]

Hi,

>
> Could you send me please that 1_5 release of that benchmark ?
>
> Thanks! - We will try to reproduce this here.

Here it is. On my side, unfortunately, the cluster is going into
production soon though without drbd. I won't be able to make any
further test within the next few days, in fact, until I set up again a
pair of test servers.

Symptoms are fully reproductible. It happens each time the benchmark is ran.
Here is a sample session which we always use :

PostMark v1.5 : 3/27/01
pm>set number 200000
pm>set transactions 1000000
pm>set size 500 10240
pm>set read 4096
pm>set write 4096
pm>show
Current configuration is:
The base number of files is 200000
Transactions: 1000000
Files range between 500 bytes and 10.00 kilobytes in size
Working directory: /DRBD
Block sizes are: read=4.00 kilobytes, write=4.00 kilobytes
Biases are: read/append=5, create/delete=5
Using Unix buffered file I/O
Random number generator seed is 42
Report format is verbose.
pm>run

Without the settings above, postmark akways pass but it's a very short test.

Cheers,
LD

[-- Attachment #2: postmark-1_5.c --]
[-- Type: application/octet-stream, Size: 46672 bytes --]

/*
Written by Jeffrey Katcher under contract to Network Appliance.
Copyright (C) 1997-2001
Network Appliance, Inc.

This code has been successfully compiled and run by Network
Appliance on various platforms, including Solaris 2 on an Ultra-170,
and Windows NT on a Compaq ProLiant. However, this PostMark source
code is distributed under the Artistic License appended to the end
of this file. As such, no support is provided. However, please report
any errors to the author, Jeffrey Katcher <katcher@netcom.com>, or to
Andy Watson <watson@netapp.com>.

Versions:
1.00 - Original release - 8/17/97

1.01 - Fixed endless loop on EOF, 
       Divide by zero when file_size_high=file_size_low - 10/29/97
       (Thanks to Chuck Murnane)

1.1 - Added new commands to distribute work across multiple directories
      and/or file systems and multiple work subdirectories.

      Changed set location command (+,-) to allow file systems & weights
      Added set subdirectories command and code to distribute work across
         multiple subdirectories
      Added file redirect to show and run commands
      Improved help system - 4/8/98

1.11 - Fixed unfortunate problem where read_file opens in append mode thus
       avoiding actual reads.  (Thanks to Kent Peacock)

1.12 - Changed bytes read and written to float.  Hopefully this will avoid
       overflow when very large file sizes are used.

1.13 - Added terse report option allowing results to be easily included in
       other things.  (Thanks to Walter Wong) 
       Also tweaked help code to allow partial matches

1.14 - Automatically stop run if work files are depleted

1.5 - It was pointed out by many (most recently Michael Flaster) that the
      pseudo-random number generator was more pseudo than random.  After
      a review of the literature and extensive benchmarking, I've replaced
      the previous PRNG with the Mersenne Twister.  While an excellent PRNG,
      it retains much of the performance of the previous implementation. 
      URL: http://www.math.keio.ac.jp/~matumoto/emt.html
      Also changed MB definition to 1024KB, tweaked show command
*/

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <fcntl.h>

#ifdef _WIN32
#include <io.h>
#include <direct.h>

#define GETWD(x) getcwd(x,MAX_LINE)
#define MKDIR(x) mkdir(x)
#define SEPARATOR "\\"
#else
extern char *getwd();

#define GETWD(x) getwd(x)
#define MKDIR(x) mkdir(x,0700)
#define SEPARATOR "/"
#endif

#define MAX_LINE 255
#define MAX_FILENAME 80

#define KILOBYTE 1024
#define MEGABYTE (KILOBYTE*KILOBYTE)

#define PROMPT "pm>"

typedef struct { /* ADT for table of CLI commands */
   char *name;    /* name of command */
   int (*func)(); /* pointer to callback function */
   char *help;    /* descriptive help string */
} cmd;

extern int cli_set_size();
extern int cli_set_number();
extern int cli_set_seed();
extern int cli_set_transactions();
extern int cli_set_location();
extern int cli_set_subdirs();
extern int cli_set_read();
extern int cli_set_write();
extern int cli_set_buffering();
extern int cli_set_bias_read();
extern int cli_set_bias_create();
extern int cli_set_report();

extern int cli_run();
extern int cli_show();
extern int cli_help();
extern int cli_quit();

cmd command_list[]={ /* table of CLI commands */
   {"set size",cli_set_size,"Sets low and high bounds of files"},
   {"set number",cli_set_number,"Sets number of simultaneous files"},
   {"set seed",cli_set_seed,"Sets seed for random number generator"},
   {"set transactions",cli_set_transactions,"Sets number of transactions"},
   {"set location",cli_set_location,"Sets location of working files"},
   {"set subdirectories",cli_set_subdirs,"Sets number of subdirectories"},
   {"set read",cli_set_read,"Sets read block size"},
   {"set write",cli_set_write,"Sets write block size"},
   {"set buffering",cli_set_buffering,"Sets usage of buffered I/O"},
   {"set bias read",cli_set_bias_read,
      "Sets the chance of choosing read over append"},
   {"set bias create",cli_set_bias_create,
      "Sets the chance of choosing create over delete"},
   {"set report",cli_set_report,"Choose verbose or terse report format"},
   {"run",cli_run,"Runs one iteration of benchmark"},
   {"show",cli_show,"Displays current configuration"},
   {"help",cli_help,"Prints out available commands"},
   {"quit",cli_quit,"Exit program"},
   NULL
};

extern void verbose_report();
extern void terse_report();
void (*reports[])()={verbose_report,terse_report};

/* Counters */
int files_created;  /* number of files created */
int files_deleted;  /* number of files deleted */
int files_read;     /* number of files read */
int files_appended; /* number of files appended */
float bytes_written; /* number of bytes written to files */
float bytes_read;    /* number of bytes read from files */

/* Configurable Parameters */
int file_size_low=500;
int file_size_high=10000;       /* file size: fixed or random within range */
int simultaneous=500;           /* simultaneous files */
int seed=42;                    /* random number generator seed */
int transactions=500;           /* number of transactions */
int subdirectories=0;		/* Number of subdirectories */
int read_block_size=512;        /* I/O block sizes */
int write_block_size=512;
int bias_read=5;                /* chance of picking read over append */
int bias_create=5;              /* chance of picking create over delete */
int buffered_io=1;              /* use C library buffered I/O */
int report=0;                   /* 0=verbose, 1=terse report format */

/* Working Storage */
char *file_source; /* pointer to buffer of random text */

typedef struct {
   char name[MAX_FILENAME+1]; /* name of individual file */
   int size;                  /* current size of file, 0 = unused file slot */
} file_entry;

file_entry *file_table; /* table of files in use */
int file_allocated;     /* pointer to last allocated slot in file_table */

typedef struct file_system_struct {
   file_entry system;
   struct file_system_struct *next,*prev;
} file_system; 

file_system *file_systems; /* table of file systems/directories to use */
int file_system_weight;    /* sum of weights for all file systems */
int file_system_count;     /* number of configured file systems */
char **location_index;     /* weighted index of file systems */

char *read_buffer; /* temporary space for reading file data into */

#define RND(x) ((x>0)?(genrand() % (x)):0)
extern unsigned long genrand();
extern void sgenrand();

/* converts integer values to byte/kilobyte/megabyte strings */
char *scale(i)
int i;
{
   static char buffer[MAX_LINE]; /* storage for current conversion */

   if (i/MEGABYTE)
      sprintf(buffer,"%.2f megabytes",(float)i/MEGABYTE);
   else
      if (i/KILOBYTE)
         sprintf(buffer,"%.2f kilobytes",(float)i/KILOBYTE);
      else
         sprintf(buffer,"%d bytes",i);

   return(buffer);
}

/* converts float values to byte/kilobyte/megabyte strings */
char *scalef(i)
float i;
{
   static char buffer[MAX_LINE]; /* storage for current conversion */

   if (i/(float)MEGABYTE>1)
      sprintf(buffer,"%.2f megabytes",i/(float)MEGABYTE);
   else
      if (i/(float)KILOBYTE)
         sprintf(buffer,"%.2f kilobytes",i/(float)KILOBYTE);
      else
         sprintf(buffer,"%f bytes",i);

   return(buffer);
}

/* UI callback for 'set size' command - sets range of file sizes */
int cli_set_size(param)
char *param; /* remainder of command line */
{
   char *token;
   int size;

   if (param && (size=atoi(param))>0)
      {
      file_size_low=size;
      if ((token=strchr(param,' ')) && (size=atoi(token))>0 &&
         size>=file_size_low)
         file_size_high=size;
      else
         file_size_high=file_size_low;
      }
   else
      fprintf(stderr,"Error: no file size low or high bounds specified\n");

   return(1);
}

/* UI callback for 'set number' command - sets number of files to create */
int cli_set_number(param)
char *param; /* remainder of command line */
{
   int size;

   if (param && (size=atoi(param))>0)
      simultaneous=size;
   else
      fprintf(stderr,"Error: no file number specified\n");

   return(1);
}

/* UI callback for 'set seed' command - initial value for random number gen */
int cli_set_seed(param)
char *param; /* remainder of command line */
{
   int size;

   if (param && (size=atoi(param))>0)
      seed=size;
   else
      fprintf(stderr,"Error: no random number seed specified\n");

   return(1);
}

/* UI callback for 'set transactions' - configure number of transactions */
int cli_set_transactions(param)
char *param; /* remainder of command line */
{
   int size;

   if (param && (size=atoi(param))>0)
      transactions=size;
   else
      fprintf(stderr,"Error: no transactions specified\n");

   return(1);
}

int parse_weight(params)
char *params;
{
   int weight=1;
   char *split;

   if (split=strrchr(params,' '))
      {
      *split='\0';
      if ((weight=atoi(split+1))<=0)
         {
         fprintf(stderr,"Error: ignoring invalid weight '%s'\n",split+1); 
         weight=1;
         }
      }

   return(weight);
}

void add_location(params,weight)
char *params;
int weight;
{
   file_system *new_file_system;

   if (new_file_system=(file_system *)calloc(1,sizeof(file_system)))
      {
      strcpy(new_file_system->system.name,params);
      new_file_system->system.size=weight;

      if (file_systems)
         {
         new_file_system->prev=file_systems->prev;
         file_systems->prev->next=new_file_system;
         file_systems->prev=new_file_system;
         }
      else
         {
         new_file_system->prev=new_file_system; 
         file_systems=new_file_system;
         }

      file_system_weight+=weight;
      file_system_count++;
      }
}

void delete_location(loc_name)
char *loc_name;
{
   file_system *traverse;

   for (traverse=file_systems; traverse; traverse=traverse->next)
      if (!strcmp(traverse->system.name,loc_name))
         {
         file_system_weight-=traverse->system.size;
         file_system_count--;

         if (file_systems->prev==file_systems)
            {
            free(file_systems);
            file_systems=NULL;
            }
         else
            {
            if (file_systems->prev==traverse)
               file_systems->prev=traverse->prev;

            if (traverse==file_systems)
               file_systems=file_systems->next;
            else
               traverse->prev->next=traverse->next;

            if (traverse->next)
               traverse->next->prev=traverse->prev;

            free(traverse);
            }

         break;
         }

   if (!traverse)
      fprintf(stderr,"Error: cannot find location '%s'\n",loc_name);
}

void delete_locations()
{
   file_system *next;

   while (file_systems)
      {
      next=file_systems->next;
      free(file_systems);
      file_systems=next;
      }

   file_system_weight=0;
   file_system_count=0;
}

/* UI callback for 'set location' - configure current working directory */
int cli_set_location(param)
char *param; /* remainder of command line */
{
   if (param)
      {
      switch (*param)
         {
         case '+': /* add location to list */
            add_location(param+1,parse_weight(param+1));
            break;

         case '-': /* remove location from list */
            delete_location(param+1);
            break;

         default:
            delete_locations();
            add_location(param,parse_weight(param));
         }
      }
   else
      fprintf(stderr,"Error: no directory name specified\n");

   return(1);
}

/* UI callback for 'set subdirectories' - configure number of subdirectories */
int cli_set_subdirs(param)
char *param; /* remainder of command line */
{
   int subdirs;

   if (param && (subdirs=atoi(param))>=0)
      subdirectories=subdirs;
   else
      fprintf(stderr,"Error: invalid number of subdirectories specified\n");

   return(1);
}

/* UI callback for 'set read' - configure read block size (integer) */
int cli_set_read(param)
char *param; /* remainder of command line */
{
   int size;

   if (param && (size=atoi(param))>0)
      read_block_size=size;
   else
      fprintf(stderr,"Error: no block size specified\n");

   return(1);
}

/* UI callback for 'set write' - configure write block size (integer) */
int cli_set_write(param)
char *param; /* remainder of command line */
{
   int size;

   if (param && (size=atoi(param))>0)
      write_block_size=size;
   else
      fprintf(stderr,"Error: no block size specified\n");

   return(1);
}

/* UI callback for 'set buffering' - sets buffering mode on or off
   - true = buffered I/O (default), false = raw I/O */
int cli_set_buffering(param)
char *param; /* remainder of command line */
{
   if (param && (!strcmp(param,"true") || !strcmp(param,"false")))
      buffered_io=(!strcmp(param,"true"))?1:0;
   else
      fprintf(stderr,"Error: no buffering mode (true/false) specified\n");
      
   return(1);
}

/* UI callback for 'set bias read' - sets probability of read vs. append */
int cli_set_bias_read(param)
char *param; /* remainder of command line */
{
   int value;

   if (param && (value=atoi(param))>=-1  && value<=10)
      bias_read=value;
   else
      fprintf(stderr,
        "Error: no bias specified (0-10 for greater chance,-1 to disable)\n");

   return(1);
}

/* UI callback for 'set bias create' - sets probability of create vs. delete */
int cli_set_bias_create(param)
char *param; /* remainder of command line */
{
   int value;

   if (param && (value=atoi(param))>=-1  && value<=10)
      bias_create=value;
   else
      fprintf(stderr,
         "Error: no bias specified (0-10 for greater chance,-1 to disable)\n");

   return(1);
}

/* UI callback for 'set report' - chooses verbose or terse report formats */
int cli_set_report(param)
char *param; /* remainder of command line */
{
   int match=0;

   if (param)
      { 
      if (!strcmp(param,"verbose"))
         report=0;
      else
         if (!strcmp(param,"terse"))
            report=1;
         else
            match=-1;
      }

   if (!param || match==-1)
      fprintf(stderr,"Error: either 'verbose' or 'terse' required\n");

   return(1);
}

/* populate file source buffer with 'size' bytes of readable randomness */
char *initialize_file_source(size)
int size; /* number of bytes of junk to create */
{
   char *new_source;
   int i;

   if ((new_source=(char *)malloc(size))==NULL) /* allocate buffer */
      fprintf(stderr,"Error: failed to allocate source file of size %d\n",size);
   else
      for (i=0; i<size; i++) /* file buffer with junk */
         new_source[i]=32+RND(95);

   return(new_source);
}

/* returns differences in times -
   1 second is the minimum to avoid divide by zero errors */
time_t diff_time(t1,t0)
time_t t1;
time_t t0;
{
   return((t1-=t0)?t1:1);
}

/* prints out results from running transactions */
void verbose_report(fp,end_time,start_time,t_end_time,t_start_time,deleted)
FILE *fp;
time_t end_time,start_time,t_end_time,t_start_time; /* timers from run */
int deleted; /* files deleted back-to-back */
{
   time_t elapsed,t_elapsed;
   int interval;

   elapsed=diff_time(end_time,start_time);
   t_elapsed=diff_time(t_end_time,t_start_time);

   fprintf(fp,"Time:\n");
   fprintf(fp,"\t%d seconds total\n",elapsed);
   fprintf(fp,"\t%d seconds of transactions (%d per second)\n",t_elapsed,
      transactions/t_elapsed);

   fprintf(fp,"\nFiles:\n");
   fprintf(fp,"\t%d created (%d per second)\n",files_created,
      files_created/elapsed);

   interval=diff_time(t_start_time,start_time);
   fprintf(fp,"\t\tCreation alone: %d files (%d per second)\n",simultaneous,
      simultaneous/interval);
   fprintf(fp,"\t\tMixed with transactions: %d files (%d per second)\n",
      files_created-simultaneous,(files_created-simultaneous)/t_elapsed);
   fprintf(fp,"\t%d read (%d per second)\n",files_read,files_read/t_elapsed);
   fprintf(fp,"\t%d appended (%d per second)\n",files_appended,
      files_appended/t_elapsed);
   fprintf(fp,"\t%d deleted (%d per second)\n",files_created,
      files_created/elapsed);
   
   interval=diff_time(end_time,t_end_time);
   fprintf(fp,"\t\tDeletion alone: %d files (%d per second)\n",deleted,
      deleted/interval);
   fprintf(fp,"\t\tMixed with transactions: %d files (%d per second)\n",
      files_deleted-deleted,(files_deleted-deleted)/t_elapsed);

   fprintf(fp,"\nData:\n");
   fprintf(fp,"\t%s read ",scalef(bytes_read));
   fprintf(fp,"(%s per second)\n",scalef(bytes_read/(float)elapsed));
   fprintf(fp,"\t%s written ",scalef(bytes_written));
   fprintf(fp,"(%s per second)\n",scalef(bytes_written/(float)elapsed));
}

void terse_report(fp,end_time,start_time,t_end_time,t_start_time,deleted)
FILE *fp;
time_t end_time,start_time,t_end_time,t_start_time; /* timers from run */
int deleted; /* files deleted back-to-back */
{
   time_t elapsed,t_elapsed;
   int interval;

   elapsed=diff_time(end_time,start_time);
   t_elapsed=diff_time(t_end_time,t_start_time);
   interval=diff_time(t_start_time,start_time);

   fprintf(fp,"%d %d %.2f ", elapsed, t_elapsed, 
      (float)transactions/t_elapsed);
   fprintf(fp, "%.2f %.2f %.2f ", (float)files_created/elapsed, 
      (float)simultaneous/interval,
      (float)(files_created-simultaneous)/t_elapsed);
   fprintf(fp, "%.2f %.2f ", (float)files_read/t_elapsed,
      (float)files_appended/t_elapsed);
   fprintf(fp, "%.2f %.2f %.2f ", (float)files_created/elapsed,
      (float)deleted/interval,
      (float)(files_deleted-deleted)/t_elapsed);
   fprintf(fp, "%.2f %.2f\n", (float)bytes_read/elapsed,
      (float)bytes_written/elapsed);
}

/* returns file_table entry of unallocated file
   - if not at end of table, then return next entry
   - else search table for gaps */
int find_free_file()
{
   int i;

   if (file_allocated<simultaneous<<1 && file_table[file_allocated].size==0)
      return(file_allocated++);
   else /* search entire table for holes */
      for (i=0; i<simultaneous<<1; i++)
         if (file_table[i].size==0)
            {
            file_allocated=i;
            return(file_allocated++);
            }

   return(-1); /* return -1 only if no free files found */
}

/* write 'size' bytes to file 'fd' using unbuffered I/O */
void write_blocks(fd,size)
int fd;
int size;   /* bytes to write to file */
{
   int offset=0; /* offset into file */
   int i;

   /* write even blocks */
   for (i=size; i>=write_block_size;
      i-=write_block_size,offset+=write_block_size)
      write(fd,file_source+offset,write_block_size);

   write(fd,file_source+offset,i); /* write remainder */

   bytes_written+=size; /* update counter */
}

/* write 'size' bytes to file 'fp' using buffered I/O */
void fwrite_blocks(fp,size)
FILE *fp;
int size;   /* bytes to write to file */
{
   int offset=0; /* offset into file */
   int i;

   /* write even blocks */
   for (i=size; i>=write_block_size;
      i-=write_block_size,offset+=write_block_size)
      fwrite(file_source+offset,write_block_size,1,fp);

   fwrite(file_source+offset,i,1,fp); /* write remainder */
   
   bytes_written+=size; /* update counter */
}

void create_file_name(dest)
char *dest;
{
   char conversion[MAX_LINE+1];

   *dest='\0';
   if (file_system_count)
      {
      strcat(dest,
         location_index[(file_system_count==1)?0:RND(file_system_weight)]);
      strcat(dest,SEPARATOR);
      }

   if (subdirectories>1)
      {
      sprintf(conversion,"s%d%s",RND(subdirectories),SEPARATOR);
      strcat(dest,conversion);
      }

   sprintf(conversion,"%d",++files_created);
   strcat(dest,conversion);
}

/* creates new file of specified length and fills it with data */
void create_file(buffered)
int buffered; /* 1=buffered I/O (default), 0=unbuffered I/O */
{
   FILE *fp=NULL;
   int fd=-1;
   int free_file; /* file_table slot for new file */

   if ((free_file=find_free_file())!=-1) /* if file space is available */
      { /* decide on name and initial length */
      create_file_name(file_table[free_file].name);

      file_table[free_file].size=
         file_size_low+RND(file_size_high-file_size_low);

      if (buffered)
         fp=fopen(file_table[free_file].name,"w");
      else
         fd=open(file_table[free_file].name,O_RDWR|O_CREAT,0644);

      if (fp || fd!=-1)
         {
         if (buffered)
            {
            fwrite_blocks(fp,file_table[free_file].size);
            fclose(fp);
            }
         else
            {
            write_blocks(fd,file_table[free_file].size);
            close(fd);
            }
         }
      else
         fprintf(stderr,"Error: cannot open '%s' for writing\n",
            file_table[free_file].name);
      }
}

/* deletes specified file from disk and file_table */
void delete_file(number)
int number;
{
   if (file_table[number].size)
      {
      if (remove(file_table[number].name))
         fprintf(stderr,"Error: Cannot delete '%s'\n",file_table[number].name);
      else
         { /* reset entry in file_table and update counter */
         file_table[number].size=0;
         files_deleted++;
         }
      }
}

/* reads entire specified file into temporary buffer */
void read_file(number,buffered)
int number;   /* number of file to read (from file_table) */
int buffered; /* 1=buffered I/O (default), 0=unbuffered I/O */
{
   FILE *fp=NULL;
   int fd=-1;
   int i;

   if (buffered)
      fp=fopen(file_table[number].name,"r");
   else
      fd=open(file_table[number].name,O_RDONLY,0644);

   if (fp || fd!=-1)
      { /* read as many blocks as possible then read the remainder */
      if (buffered)
         {
         for (i=file_table[number].size; i>=read_block_size; i-=read_block_size)
            fread(read_buffer,read_block_size,1,fp);

         fread(read_buffer,i,1,fp);

         fclose(fp);
         }
      else
         {
         for (i=file_table[number].size; i>=read_block_size; i-=read_block_size)
            read(fd,read_buffer,read_block_size);

         read(fd,read_buffer,i);

         close(fd);
         }

      /* increment counters to record transaction */
      bytes_read+=file_table[number].size;
      files_read++;
      }
   else
      fprintf(stderr,"Error: cannot open '%s' for reading\n",
         file_table[number].name);
}

/* appends random data to a chosen file up to the maximum configured length */
void append_file(number,buffered)
int number;   /* number of file (from file_table) to append date to */
int buffered; /* 1=buffered I/O (default), 0=unbuffered I/O */
{
   FILE *fp=NULL;
   int fd=-1;
   int block; /* size of data to append */

   if (file_table[number].size<file_size_high)
      {
      if (buffered)
         fp=fopen(file_table[number].name,"a");
      else
         fd=open(file_table[number].name,O_RDWR|O_APPEND,0644);

      if ((fp || fd!=-1) && file_table[number].size<file_size_high)
         {
         block=RND(file_size_high-file_table[number].size)+1;

         if (buffered)
            {
            fwrite_blocks(fp,block);
            fclose(fp);
            }
         else
            {
            write_blocks(fd,block);
            close(fd);
            }

         file_table[number].size+=block;
         files_appended++;
         }
      else
         fprintf(stderr,"Error: cannot open '%s' for append\n",
            file_table[number].name);
      }
}

/* finds and returns the offset of a file that is in use from the file_table */
int find_used_file() /* only called after files are created */
{
   int used_file;

   while (file_table[used_file=RND(simultaneous<<1)].size==0)
      ;

   return(used_file);
}

/* reset global counters - done before each test run */
void reset_counters()
{
   files_created=0;
   files_deleted=0;
   files_read=0;
   files_appended=0;
   bytes_written=0;
   bytes_read=0;
}

/* perform the configured number of file transactions
   - a transaction consisted of either a read or append and either a
     create or delete all chosen at random */
int run_transactions(buffered)
int buffered; /* 1=buffered I/O (default), 0=unbuffered I/O */
{
   int percent; /* one tenth of the specified transactions */
   int i;

   percent=transactions/10;
   for (i=0; i<transactions; i++)
      {
      if (files_created==files_deleted)
         {
         printf("out of files!\n");
         printf("For this workload, either increase the number of files or\n");
         printf("decrease the number of transactions.\n");
         break;
         }

      if (bias_read!=-1) /* if read/append not locked out... */
         {
         if (RND(10)<bias_read) /* read file */
            read_file(find_used_file(),buffered);
         else /* append file */
            append_file(find_used_file(),buffered);
         }

      if (bias_create!=-1) /* if create/delete not locked out... */
         {
         if (RND(10)<bias_create) /* create file */
            create_file(buffered);
         else /* delete file */
            delete_file(find_used_file());
         }

      if ((i % percent)==0) /* if another tenth of the work is done...*/
         {
         putchar('.'); /* print progress indicator */
         fflush(stdout);
         }
      }

   return(transactions-i);
}

char **build_location_index(list,weight)
file_system *list;
int weight;
{
   char **index;
   int count;
   int i=0;

   if ((index=(char **)calloc(1,weight*sizeof(char *)))==NULL)
      fprintf(stderr,"Error: cannot build weighted index of locations\n");
   else
      for (; list; list=list->next)
         for (count=0; count<list->system.size; count++)
            index[i++]=list->system.name;

   return(index);
}

void create_subdirectories(dir_list,base_dir,subdirs)
file_system *dir_list;
char *base_dir;
int subdirs;
{
   char dir_name[MAX_LINE+1]; /* buffer holding subdirectory names */
   char save_dir[MAX_LINE+1];
   int i;

   if (dir_list)
      {
      for (; dir_list; dir_list=dir_list->next)
         create_subdirectories(NULL,dir_list->system.name,subdirs);
      }
   else
      { 
      if (base_dir)
         sprintf(save_dir,"%s%s",base_dir,SEPARATOR);
      else
         *save_dir='\0';

      for (i=0; i<subdirs; i++)
         {
         sprintf(dir_name,"%ss%d",save_dir,i);
         MKDIR(dir_name); 
         }
      }
}

void delete_subdirectories(dir_list,base_dir,subdirs)
file_system *dir_list;
char *base_dir;
int subdirs;
{
   char dir_name[MAX_LINE+1]; /* buffer holding subdirectory names */
   char save_dir[MAX_LINE+1];
   int i;

   if (dir_list)
      {
      for (; dir_list; dir_list=dir_list->next)
         delete_subdirectories(NULL,dir_list->system.name,subdirs);
      }
   else
      { 
      if (base_dir)
         sprintf(save_dir,"%s%s",base_dir,SEPARATOR);
      else
         *save_dir='\0';

      for (i=0; i<subdirs; i++)
         {
         sprintf(dir_name,"%ss%d",save_dir,i);
         rmdir(dir_name); 
         }
      }
}

/* CLI callback for 'run' - benchmark execution loop */
int cli_run(param) /* none */
char *param; /* unused */
{
   time_t start_time,t_start_time,t_end_time,end_time; /* elapsed timers */
   int delete_base; /* snapshot of deleted files counter */
   FILE *fp=NULL; /* file descriptor for directing output */
   int incomplete;
   int i; /* generic iterator */

   reset_counters(); /* reset counters before each run */

   sgenrand(seed); /* initialize random number generator */

   /* allocate file space and fill with junk */
   file_source=initialize_file_source(file_size_high<<1);

   /* allocate read buffer */
   read_buffer=(char *)malloc(read_block_size);

   /* allocate table of files at 2 x simultaneous files */
   file_allocated=0;
   if ((file_table=(file_entry *)calloc(simultaneous<<1,sizeof(file_entry)))==
      NULL)
      fprintf(stderr,"Error: Failed to allocate table for %d files\n",
         simultaneous<<1);

   if (file_system_count>0)
      location_index=build_location_index(file_systems,file_system_weight);

   /* create subdirectories if necessary */
   if (subdirectories>1)
      {
      printf("Creating subdirectories...");
      fflush(stdout);
      create_subdirectories(file_systems,NULL,subdirectories);
      printf("Done\n");
      }

   time(&start_time); /* store start time */

   /* create files in specified directory until simultaneous number */
   printf("Creating files...");
   fflush(stdout);
   for (i=0; i<simultaneous; i++)
      create_file(buffered_io);
   printf("Done\n");
  
   printf("Performing transactions");
   fflush(stdout);
   time(&t_start_time);
   incomplete=run_transactions(buffered_io);
   time(&t_end_time);
   if (!incomplete)
      printf("Done\n");

   /* delete remaining files */
   printf("Deleting files...");
   fflush(stdout);
   delete_base=files_deleted;
   for (i=0; i<simultaneous<<1; i++)
      delete_file(i);
   printf("Done\n");

   /* print end time and difference, transaction numbers */
   time(&end_time);

   /* delete previously created subdirectories */
   if (subdirectories>1)
      {
      printf("Deleting subdirectories...");
      fflush(stdout);
      delete_subdirectories(file_systems,NULL,subdirectories);
      printf("Done\n");
      }

   if (location_index)
      {
      free(location_index);
      location_index=NULL;
      }

   if (param)
      if ((fp=fopen(param,"a"))==NULL)
         fprintf(stderr,"Error: Cannot direct output to file '%s'\n",param);

   if (!fp)
      fp=stdout;

   if (!incomplete)
      reports[report](fp,end_time,start_time,t_end_time,t_start_time,
         files_deleted-delete_base);

   if (param && fp!=stdout)
      fclose(fp);

   /* free resources allocated for this run */
   free(file_table);
   free(read_buffer);
   free(file_source);

   return(1); /* return 1 unless exit requested, then return 0 */
}

/* CLI callback for 'show' - print values of configuration variables */
int cli_show(param) 
char *param; /* optional: name of output file */
{
   char current_dir[MAX_LINE+1]; /* buffer containing working directory */
   file_system *traverse;
   FILE *fp=NULL; /* file descriptor for directing output */

   if (param)
      if ((fp=fopen(param,"a"))==NULL)
         fprintf(stderr,"Error: Cannot direct output to file '%s'\n",param);

   if (!fp)
      fp=stdout;

   fprintf(fp,"Current configuration is:\n");
   fprintf(fp,"The base number of files is %d\n",simultaneous);
   fprintf(fp,"Transactions: %d\n",transactions);

   if (file_size_low!=file_size_high)
      {
      fprintf(fp,"Files range between %s ",scale(file_size_low));
      fprintf(fp,"and %s in size\n",scale(file_size_high));
      }
   else
      fprintf(fp,"Files are %s in size\n",scale(file_size_low));

   fprintf(fp,"Working director%s: %s\n",(file_system_count>1)?"ies":"y",
      (file_system_count==0)?GETWD(current_dir):"");

   for (traverse=file_systems; traverse; traverse=traverse->next)
      printf("\t%s (weight=%d)\n",traverse->system.name,traverse->system.size);

   if (subdirectories>0)
      fprintf(fp,"%d subdirector%s will be used\n",subdirectories,
         (subdirectories==1)?"y":"ies");

   fprintf(fp,"Block sizes are: read=%s, ",scale(read_block_size));
   fprintf(fp,"write=%s\n",scale(write_block_size));
   fprintf(fp,"Biases are: read/append=%d, create/delete=%d\n",bias_read,
      bias_create);
   fprintf(fp,"%ssing Unix buffered file I/O\n",buffered_io?"U":"Not u");
   fprintf(fp,"Random number generator seed is %d\n",seed);

   fprintf(fp,"Report format is %s.\n",report?"terse":"verbose");

   if (param && fp!=stdout)
      fclose(fp);

   return(1); /* return 1 unless exit requested, then return 0 */
}

/* CLI callback for 'quit' - returns 0 causing UI to exit */
int cli_quit(param) /* none */
char *param; /* unused */
{
   return(0); /* return 1 unless exit requested, then return 0 */
}

/* CLI callback for 'help' - prints help strings from command_list */
int cli_help(param) 
char *param; /* optional: specific command to get help for */
{
   int n=0; /* number of matching items */
   int i; /* traversal variable for command table */
   int len;

   if (param && (len=strlen(param))>0) /* if a command is specified... */
      for (i=0; command_list[i].name; i++) /* walk command table */
         if (!strncmp(command_list[i].name,param,len))
            {
            printf("%s - %s\n",command_list[i].name,command_list[i].help);
            n++;
            }

   if (!param || !n)
      for (i=0; command_list[i].name; i++) /* traverse command table */
         printf("%s - %s\n",command_list[i].name,command_list[i].help);

   return(1); /* return 1 unless exit requested, then return 0 */
}

/* read CLI line from user, translate aliases if any, return fgets status */
char *cli_read_line(buffer,size)
char *buffer; /* empty input line */
int size;
{
   char *result;

   printf("%s",PROMPT);                 /* print prompt */
   fflush(stdout);                      /* force prompt to print */
   if (result=fgets(buffer,size,stdin)) /* read line safely */
      {
      buffer[strlen(buffer)-1]='\0';    /* delete final CR */
      if (!strcmp(buffer,"?"))           /* translate aliases */
         strcpy(buffer,"help");
      if (!strcmp(buffer,"exit"))
         strcpy(buffer,"quit");
      }

   return(result);                      /* return success of fgets */
}

/* parse CLI input line */
int cli_parse_line(buffer)
char *buffer; /* line of user input */
{
   int result=1; /* default return status */
   int len; /* length of parsed command */
   int i; /* traversal variable for command table */

   if (*buffer=='!') /* check for shell escape */
      system((strlen(buffer)>1)?buffer+1:getenv("SHELL"));
   else
      {
      for (i=0; command_list[i].name; i++) /* walk command table */
         if (!strncmp(command_list[i].name,buffer,
            len=strlen(command_list[i].name)))
            { /* if command matches... */
            result=(command_list[i].func)
               (((int)strlen(buffer)>len)?buffer+len+1:NULL);
            break; /* call function and pass remainder of line as parameter */
            }

      if (!command_list[i].name) /* if no commands were called... */
         printf("Eh?\n"); /* tribute to Canadian diction */
      }

   return(result); /* return 1 unless exit requested, then return 0 */
}

/* read config file if present and process it line by line
   - if 'quit' is in file then function returns 0 */
int read_config_file(filename,buffer)
char *filename; /* file name of config file */
char *buffer;   /* temp storage for each line read from file */
{
   int result=1; /* default exit value - proceed with UI */
   FILE *fp;

   if (fp=fopen(filename,"r")) /* open config file */
      {
      printf("Reading configuration from file '%s'\n",filename);
      while (fgets(buffer,MAX_LINE,fp) && result) /* read lines until 'quit' */
         {
         buffer[strlen(buffer)-1]='\0'; /* delete final CR */
         result=cli_parse_line(buffer); /* process line as typed in */
         }

      fclose(fp);
      }

   return(result);
}

/* main function - reads config files then enters get line/parse line loop */
main(argc,argv)
int argc;
char *argv[];
{
   char buffer[MAX_LINE+1]; /* storage for input command line */

   printf("PostMark v1.5 : 3/27/01\n");
   if (read_config_file((argc==2)?argv[1]:".pmrc",buffer))
      while (cli_read_line(buffer,MAX_LINE) && cli_parse_line(buffer))
         ;
}

/*

                         The "Artistic License"

                                Preamble

The intent of this document is to state the conditions under which a
Package may be copied, such that the Copyright Holder maintains some
semblance of artistic control over the development of the package,
while giving the users of the package the right to use and distribute
the Package in a more-or-less customary fashion, plus the right to make
reasonable modifications.

Definitions:

        "Package" refers to the collection of files distributed by the
        Copyright Holder, and derivatives of that collection of files
        created through textual modification.

        "Standard Version" refers to such a Package if it has not been
        modified, or has been modified in accordance with the wishes
        of the Copyright Holder as specified below.

        "Copyright Holder" is whoever is named in the copyright or
        copyrights for the package.

        "You" is you, if you're thinking about copying or distributing
        this Package.

        "Reasonable copying fee" is whatever you can justify on the
        basis of media cost, duplication charges, time of people involved,
        and so on.  (You will not be required to justify it to the
        Copyright Holder, but only to the computing community at large
        as a market that must bear the fee.)

        "Freely Available" means that no fee is charged for the item
        itself, though there may be fees involved in handling the item.
        It also means that recipients of the item may redistribute it
        under the same conditions they received it.

1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.

2. You may apply bug fixes, portability fixes and other modifications
derived from the Public Domain or from the Copyright Holder.  A Package
modified in such a way shall still be considered the Standard Version.

3. You may otherwise modify your copy of this Package in any way, provided
that you insert a prominent notice in each changed file stating how and
when you changed that file, and provided that you do at least ONE of the
following:

    a) place your modifications in the Public Domain or otherwise make them
    Freely Available, such as by posting said modifications to Usenet or
    an equivalent medium, or placing the modifications on a major archive
    site such as uunet.uu.net, or by allowing the Copyright Holder to include
    your modifications in the Standard Version of the Package.

    b) use the modified Package only within your corporation or organization.

    c) rename any non-standard executables so the names do not conflict
    with standard executables, which must also be provided, and provide
    a separate manual page for each non-standard executable that clearly
    documents how it differs from the Standard Version.

    d) make other distribution arrangements with the Copyright Holder.

4. You may distribute the programs of this Package in object code or
executable form, provided that you do at least ONE of the following:

    a) distribute a Standard Version of the executables and library files,
    together with instructions (in the manual page or equivalent) on where
    to get the Standard Version.

    b) accompany the distribution with the machine-readable source of
    the Package with your modifications.

    c) give non-standard executables non-standard names, and clearly
    document the differences in manual pages (or equivalent), together
    with instructions on where to get the Standard Version.

    d) make other distribution arrangements with the Copyright Holder.

5. You may charge a reasonable copying fee for any distribution of this
Package.  You may charge any fee you choose for support of this
Package.  You may not charge a fee for this Package itself.  However,
you may distribute this Package in aggregate with other (possibly
commercial) programs as part of a larger (possibly commercial) software
distribution provided that you do not advertise this Package as a
product of your own.  You may embed this Package's interpreter within
an executable of yours (by linking); this shall be construed as a mere
form of aggregation, provided that the complete Standard Version of the
interpreter is so embedded.

6. The scripts and library files supplied as input to or produced as
output from the programs of this Package do not automatically fall
under the copyright of this Package, but belong to whomever generated
them, and may be sold commercially, and may be aggregated with this
Package.  If such scripts or library files are aggregated with this
Package via the so-called "undump" or "unexec" methods of producing a
binary executable image, then distribution of such an image shall
neither be construed as a distribution of this Package nor shall it
fall under the restrictions of Paragraphs 3 and 4, provided that you do
not represent such an executable image as a Standard Version of this
Package.

7. C subroutines (or comparably compiled subroutines in other
languages) supplied by you and linked into this Package in order to
emulate subroutines and variables of the language defined by this
Package shall not be considered part of this Package, but are the
equivalent of input as in Paragraph 6, provided these subroutines do
not change the language in any way that would cause it to fail the
regression tests for the language.

8. Aggregation of this Package with a commercial distribution is always
permitted provided that the use of this Package is embedded; that is,
when no overt attempt is made to make this Package's interfaces visible
to the end user of the commercial distribution.  Such use shall not be
construed as a distribution of this Package.

9. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.

10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

                                The End

*/


/* A C-program for MT19937: Integer version (1999/10/28)          */
/*  genrand() generates one pseudorandom unsigned integer (32bit) */
/* which is uniformly distributed among 0 to 2^32-1  for each     */
/* call. sgenrand(seed) sets initial values to the working area   */
/* of 624 words. Before genrand(), sgenrand(seed) must be         */
/* called once. (seed is any 32-bit integer.)                     */
/*   Coded by Takuji Nishimura, considering the suggestions by    */
/* Topher Cooper and Marc Rieffel in July-Aug. 1997.              */

/* This library is free software; you can redistribute it and/or   */
/* modify it under the terms of the GNU Library General Public     */
/* License as published by the Free Software Foundation; either    */
/* version 2 of the License, or (at your option) any later         */
/* version.                                                        */
/* This library is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of  */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.            */
/* See the GNU Library General Public License for more details.    */
/* You should have received a copy of the GNU Library General      */
/* Public License along with this library; if not, write to the    */
/* Free Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA   */ 
/* 02111-1307  USA                                                 */

/* Copyright (C) 1997, 1999 Makoto Matsumoto and Takuji Nishimura. */
/* Any feedback is very welcome. For any question, comments,       */
/* see http://www.math.keio.ac.jp/matumoto/emt.html or email       */
/* matumoto@math.keio.ac.jp                                        */

/* REFERENCE                                                       */
/* M. Matsumoto and T. Nishimura,                                  */
/* "Mersenne Twister: A 623-Dimensionally Equidistributed Uniform  */
/* Pseudo-Random Number Generator",                                */
/* ACM Transactions on Modeling and Computer Simulation,           */
/* Vol. 8, No. 1, January 1998, pp 3--30.                          */

/* Period parameters */  
#define N 624
#define M 397
#define MATRIX_A 0x9908b0df   /* constant vector a */
#define UPPER_MASK 0x80000000 /* most significant w-r bits */
#define LOWER_MASK 0x7fffffff /* least significant r bits */

/* Tempering parameters */   
#define TEMPERING_MASK_B 0x9d2c5680
#define TEMPERING_MASK_C 0xefc60000
#define TEMPERING_SHIFT_U(y)  (y >> 11)
#define TEMPERING_SHIFT_S(y)  (y << 7)
#define TEMPERING_SHIFT_T(y)  (y << 15)
#define TEMPERING_SHIFT_L(y)  (y >> 18)

static unsigned long mt[N]; /* the array for the state vector  */
static int mti=N+1; /* mti==N+1 means mt[N] is not initialized */

/* Initializing the array with a seed */
void
sgenrand(seed)
    unsigned long seed;	
{
    int i;

    for (i=0;i<N;i++) {
         mt[i] = seed & 0xffff0000;
         seed = 69069 * seed + 1;
         mt[i] |= (seed & 0xffff0000) >> 16;
         seed = 69069 * seed + 1;
    }
    mti = N;
}

/* Initialization by "sgenrand()" is an example. Theoretically,      */
/* there are 2^19937-1 possible states as an intial state.           */
/* This function allows to choose any of 2^19937-1 ones.             */
/* Essential bits in "seed_array[]" is following 19937 bits:         */
/*  (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1]. */
/* (seed_array[0]&LOWER_MASK) is discarded.                          */ 
/* Theoretically,                                                    */
/*  (seed_array[0]&UPPER_MASK), seed_array[1], ..., seed_array[N-1]  */
/* can take any values except all zeros.                             */
void
lsgenrand(seed_array)
    unsigned long seed_array[]; 
    /* the length of seed_array[] must be at least N */
{
    int i;

    for (i=0;i<N;i++) 
      mt[i] = seed_array[i];
    mti=N;
}

unsigned long 
genrand()
{
    unsigned long y;
    static unsigned long mag01[2]={0x0, MATRIX_A};
    /* mag01[x] = x * MATRIX_A  for x=0,1 */

    if (mti >= N) { /* generate N words at one time */
        int kk;

        if (mti == N+1)   /* if sgenrand() has not been called, */
            sgenrand(4357); /* a default initial seed is used   */

        for (kk=0;kk<N-M;kk++) {
            y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
            mt[kk] = mt[kk+M] ^ (y >> 1) ^ mag01[y & 0x1];
        }
        for (;kk<N-1;kk++) {
            y = (mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK);
            mt[kk] = mt[kk+(M-N)] ^ (y >> 1) ^ mag01[y & 0x1];
        }
        y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK);
        mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1];

        mti = 0;
    }
  
    y = mt[mti++];
    y ^= TEMPERING_SHIFT_U(y);
    y ^= TEMPERING_SHIFT_S(y) & TEMPERING_MASK_B;
    y ^= TEMPERING_SHIFT_T(y) & TEMPERING_MASK_C;
    y ^= TEMPERING_SHIFT_L(y);

    return y; 
}







^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2006-03-31  7:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-10 18:17 [Drbd-dev] freeze under postmark io bench Laurent Denel
2006-03-11 16:35 ` Lars Ellenberg
2006-03-22 18:46   ` Laurent Denel
2006-03-22 22:35     ` Lars Ellenberg
2006-03-23  8:08       ` Laurent Denel
2006-03-28 16:33         ` Laurent Denel
2006-03-30  9:33           ` Philipp Reisner
2006-03-30 17:52 ` Philipp Reisner
2006-03-31  7:47   ` Laurent Denel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.