]> git.baikalelectronics.ru Git - kernel.git/commit
sysfs: remove sysfs_buffer->needs_read_fill
authorTejun Heo <tj@kernel.org>
Tue, 1 Oct 2013 21:41:56 +0000 (17:41 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 5 Oct 2013 18:02:04 +0000 (11:02 -0700)
commit9b24fd4ad15b7a8a824dc2ec7d4c9fdb4ace0e8b
treebc048cbe87bf5ed3400bb62eccc28a76c8878914
parent0be90e0740e3a427effab942213e8dbb0cdef455
sysfs: remove sysfs_buffer->needs_read_fill

->needs_read_fill is used to implement the following behaviors.

1. Ensure buffer filling on the first read.
2. Force buffer filling after a write.
3. Force buffer filling after a successful poll.

However, #2 and #3 don't really work as sysfs doesn't reset file
position.  While the read buffer would be refilled, the next read
would continue from the position after the last read or write,
requiring an explicit seek to the start for it to be useful, which
makes ->needs_read_fill superflous as read buffer is always refilled
if f_pos == 0.

Update sysfs_read_file() to test buffer->page for #1 instead and
remove ->needs_read_fill.  While this changes behavior in extreme
corner cases - e.g. re-reading a sysfs file after seeking to non-zero
position after a write or poll, it's highly unlikely to lead to actual
breakage.  This change is to prepare for using seq_file in the read
path.

While at it, reformat a comment in fill_write_buffer().

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/sysfs/file.c