<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/direct-io.c, branch linux-2.6.37.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-2.6.37.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2011-02-17T23:14:51Z</updated>
<entry>
<title>fs/direct-io.c: don't try to allocate more than BIO_MAX_PAGES in a bio</title>
<updated>2011-02-17T23:14:51Z</updated>
<author>
<name>David Dillow</name>
</author>
<published>2011-01-20T22:44:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=044b93a01aaf6450230cd5d006585eda1fe945a8'/>
<id>urn:sha1:044b93a01aaf6450230cd5d006585eda1fe945a8</id>
<content type='text'>
commit 20d9600cb407b0b55fef6ee814b60345c6f58264 upstream.

When using devices that support max_segments &gt; BIO_MAX_PAGES (256), direct
IO tries to allocate a bio with more pages than allowed, which leads to an
oops in dio_bio_alloc().  Clamp the request to the supported maximum, and
change dio_bio_alloc() to reflect that bio_alloc() will always return a
bio when called with __GFP_WAIT and a valid number of vectors.

[akpm@linux-foundation.org: remove redundant BUG_ON()]
Signed-off-by: David Dillow &lt;dillowda@ornl.gov&gt;
Reviewed-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
</entry>
<entry>
<title>fs/direct-io.c: fix truncation error in dio_complete() return</title>
<updated>2010-10-26T23:52:13Z</updated>
<author>
<name>Edward Shishkin</name>
</author>
<published>2010-10-26T21:22:28Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cd1c584f380183aca268d454c14b22d8454eac4f'/>
<id>urn:sha1:cd1c584f380183aca268d454c14b22d8454eac4f</id>
<content type='text'>
Fix up truncation (ssize_t-&gt;int).  This only matters with &gt;2G
reads/writes, which the kernel doesn't permit.

Signed-off-by: Edward Shishkin &lt;edward@redhat.com&gt;
Reviewed-by: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>O_DIRECT: fix the splitting up of contiguous I/O</title>
<updated>2010-09-10T01:57:22Z</updated>
<author>
<name>Jeff Moyer</name>
</author>
<published>2010-09-09T23:37:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7a801ac6f5067539ceb5fad0fe90ec49fc156e47'/>
<id>urn:sha1:7a801ac6f5067539ceb5fad0fe90ec49fc156e47</id>
<content type='text'>
commit c2c6ca4 (direct-io: do not merge logically non-contiguous requests)
introduced a bug whereby all O_DIRECT I/Os were submitted a page at a time
to the block layer.  The problem is that the code expected
dio-&gt;block_in_file to correspond to the current page in the dio.  In fact,
it corresponds to the previous page submitted via submit_page_section.
This was purely an oversight, as the dio-&gt;cur_page_fs_offset field was
introduced for just this purpose.  This patch simply uses the correct
variable when calculating whether there is a mismatch between contiguous
logical blocks and contiguous physical blocks (as described in the
comments).

I also switched the if conditional following this check to an else if, to
ensure that we never call dio_bio_submit twice for the same dio (in
theory, this should not happen, anyway).

I've tested this by running blktrace and verifying that a 64KB I/O was
submitted as a single I/O.  I also ran the patched kernel through
xfstests' aio tests using xfs, ext4 (with 1k and 4k block sizes) and btrfs
and verified that there were no regressions as compared to an unpatched
kernel.

Signed-off-by: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Acked-by: Josef Bacik &lt;jbacik@redhat.com&gt;
Cc: Christoph Hellwig &lt;hch@infradead.org&gt;
Cc: Chris Mason &lt;chris.mason@oracle.com&gt;
Cc: &lt;stable@kernel.org&gt;		[2.6.35.x]
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>sort out blockdev_direct_IO variants</title>
<updated>2010-08-09T20:47:29Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2010-06-04T09:29:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eafdc7d190a944c755a9fe68573c193e6e0217e7'/>
<id>urn:sha1:eafdc7d190a944c755a9fe68573c193e6e0217e7</id>
<content type='text'>
Move the call to vmtruncate to get rid of accessive blocks to the callers
in prepearation of the new truncate calling sequence.  This was only done
for DIO_LOCKING filesystems, so the __blockdev_direct_IO_newtrunc variant
was not needed anyway.  Get rid of blockdev_direct_IO_no_locking and
its _newtrunc variant while at it as just opencoding the two additional
paramters is shorted than the name suffix.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>direct-io: move aio_complete into -&gt;end_io</title>
<updated>2010-07-26T21:09:02Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2010-07-18T21:17:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=40e2e97316af6e62affab7a392e792494b8d9dde'/>
<id>urn:sha1:40e2e97316af6e62affab7a392e792494b8d9dde</id>
<content type='text'>
Filesystems with unwritten extent support must not complete an AIO request
until the transaction to convert the extent has been commited.  That means
the aio_complete calls needs to be moved into the -&gt;end_io callback so
that the filesystem can control when to call it exactly.

This makes a bit of a mess out of dio_complete and the -&gt;end_io callback
prototype even more complicated.

Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Alex Elder &lt;aelder@sgi.com&gt;
</content>
</entry>
<entry>
<title>fs: introduce new truncate sequence</title>
<updated>2010-05-28T02:15:33Z</updated>
<author>
<name>npiggin@suse.de</name>
</author>
<published>2010-05-26T15:05:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7bb46a6734a7e1ad4beaecc11cae7ed3ff81d30f'/>
<id>urn:sha1:7bb46a6734a7e1ad4beaecc11cae7ed3ff81d30f</id>
<content type='text'>
Introduce a new truncate calling sequence into fs/mm subsystems. Rather than
setattr &gt; vmtruncate &gt; truncate, have filesystems call their truncate sequence
from -&gt;setattr if filesystem specific operations are required. vmtruncate is
deprecated, and truncate_pagecache and inode_newsize_ok helpers introduced
previously should be used.

simple_setattr is introduced for simple in-ram filesystems to implement
the new truncate sequence. Eventually all filesystems should be converted
to implement a setattr, and the default code in notify_change should go
away.

simple_setsize is also introduced to perform just the ATTR_SIZE portion
of simple_setattr (ie. changing i_size and trimming pagecache).

To implement the new truncate sequence:
- filesystem specific manipulations (eg freeing blocks) must be done in
  the setattr method rather than -&gt;truncate.
- vmtruncate can not be used by core code to trim blocks past i_size in
  the event of write failure after allocation, so this must be performed
  in the fs code.
- convert usage of helpers block_write_begin, nobh_write_begin,
  cont_write_begin, and *blockdev_direct_IO* to use _newtrunc postfixed
  variants. These avoid calling vmtruncate to trim blocks (see previous).
- inode_setattr should not be used. generic_setattr is a new function
  to be used to copy simple attributes into the generic inode.
- make use of the better opportunity to handle errors with the new sequence.

Big problem with the previous calling sequence: the filesystem is not called
until i_size has already changed.  This means it is not allowed to fail the
call, and also it does not know what the previous i_size was. Also, generic
code calling vmtruncate to truncate allocated blocks in case of error had
no good way to return a meaningful error (or, for example, atomically handle
block deallocation).

Cc: Christoph Hellwig &lt;hch@lst.de&gt;
Acked-by: Jan Kara &lt;jack@suse.cz&gt;
Signed-off-by: Nick Piggin &lt;npiggin@suse.de&gt;
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>direct-io: do not merge logically non-contiguous requests</title>
<updated>2010-05-25T14:34:56Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2010-05-23T15:00:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c2c6ca417e2db7a519e6e92c82f4a933d940d076'/>
<id>urn:sha1:c2c6ca417e2db7a519e6e92c82f4a933d940d076</id>
<content type='text'>
Btrfs cannot handle having logically non-contiguous requests submitted.  For
example if you have

Logical:  [0-4095][HOLE][8192-12287]
Physical: [0-4095]      [4096-8191]

Normally the DIO code would put these into the same BIO's.  The problem is we
need to know exactly what offset is associated with what BIO so we can do our
checksumming and unlocking properly, so putting them in the same BIO doesn't
work.  So add another check where we submit the current BIO if the physical
blocks are not contigous OR the logical blocks are not contiguous.

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>direct-io: add a hook for the fs to provide its own submit_bio function</title>
<updated>2010-05-25T14:34:55Z</updated>
<author>
<name>Josef Bacik</name>
</author>
<published>2010-05-23T15:00:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=facd07b07d2a7988f5ce849558838cc953847637'/>
<id>urn:sha1:facd07b07d2a7988f5ce849558838cc953847637</id>
<content type='text'>
Because BTRFS can do RAID and such, we need our own submit hook so we can setup
the bio's in the correct fashion, and handle checksum errors properly.  So there
are a few changes here

1) The submit_io hook.  This is straightforward, just call this instead of
submit_bio.

2) Allow the fs to return -ENOTBLK for reads.  Usually this has only worked for
writes, since writes can fallback onto buffered IO.  But BTRFS needs the option
of falling back on buffered IO if it encounters a compressed extent, since we
need to read the entire extent in and decompress it.  So if we get -ENOTBLK back
from get_block we'll return back and fallback on buffered just like the write
case.

I've tested these changes with fsx and everything seems to work.  Thanks,

Signed-off-by: Josef Bacik &lt;josef@redhat.com&gt;
Signed-off-by: Chris Mason &lt;chris.mason@oracle.com&gt;
</content>
</entry>
<entry>
<title>dio: fix use-after-free</title>
<updated>2009-12-17T09:52:13Z</updated>
<author>
<name>Al Viro</name>
</author>
<published>2009-12-17T09:52:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=06777d308f8f9ddb67798d34bf193101a4bdf06c'/>
<id>urn:sha1:06777d308f8f9ddb67798d34bf193101a4bdf06c</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>direct-io: cleanup blockdev_direct_IO locking</title>
<updated>2009-12-16T15:20:13Z</updated>
<author>
<name>Christoph Hellwig</name>
</author>
<published>2009-12-16T00:47:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5fe878ae7f82fbf0830dbfaee4c5ca18f3aee442'/>
<id>urn:sha1:5fe878ae7f82fbf0830dbfaee4c5ca18f3aee442</id>
<content type='text'>
Currently the locking in blockdev_direct_IO is a mess, we have three
different locking types and very confusing checks for some of them.  The
most complicated one is DIO_OWN_LOCKING for reads, which happens to not
actually be used.

This patch gets rid of the DIO_OWN_LOCKING - as mentioned above the read
case is unused anyway, and the write side is almost identical to
DIO_NO_LOCKING.  The difference is that DIO_NO_LOCKING always sets the
create argument for the get_blocks callback to zero, but we can easily
move that to the actual get_blocks callbacks.  There are four users of the
DIO_NO_LOCKING mode: gfs already ignores the create argument and thus is
fine with the new version, ocfs2 only errors out if create were ever set,
and we can remove this dead code now, the block device code only ever uses
create for an error message if we are fully beyond the device which can
never happen, and last but not least XFS will need the new behavour for
writes.

Now we can replace the lock_type variable with a flags one, where no flag
means the DIO_NO_LOCKING behaviour and DIO_LOCKING is kept as the first
flag.  Separate out the check for not allowing to fill holes into a
separate flag, although for now both flags always get set at the same
time.

Also revamp the documentation of the locking scheme to actually make
sense.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Christoph Hellwig &lt;hch@lst.de&gt;
Cc: Dave Chinner &lt;david@fromorbit.com&gt;
Cc: Badari Pulavarty &lt;pbadari@us.ibm.com&gt;
Cc: Jeff Moyer &lt;jmoyer@redhat.com&gt;
Cc: Jens Axboe &lt;jens.axboe@oracle.com&gt;
Cc: Zach Brown &lt;zach.brown@oracle.com&gt;
Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Alex Elder &lt;aelder@sgi.com&gt;
Cc: Mark Fasheh &lt;mfasheh@suse.com&gt;
Cc: Joel Becker &lt;joel.becker@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
</feed>
