Provided are a method, system, and program for transferring data directed
to virtual memory addresses to a device memory. Indicator bits are set
for ranges of device memory addresses in a device accessible over an
Input/Output (I/O) bus indicating whether gathering is enabled for the
device memory address ranges. Transfer operations are processed to
transfer data to contiguous device memory addresses in the device. A
determination is made as to whether the indicator bits for the contiguous
device memory addresses indicate that gathering is enabled. A single bus
I/O transaction is generated to transfer data for the contiguous device
memory addresses over the I/O bus in response to determining that the
indicator bits for the contiguous device memory addresses indicate that
gathering is enabled.