diff options
author | Alex Elder <elder@inktank.com> | 2012-08-09 10:33:26 -0700 |
---|---|---|
committer | Alex Elder <elder@inktank.com> | 2012-10-01 14:30:50 -0500 |
commit | 65ccfe21dd8fb402547bb1c50bbc2737c4ef37b8 (patch) | |
tree | dc2406bae46fd943deee2ca03e4edacaa0cd65bf /.gitignore | |
parent | df111be6310fc41d059a485368e3c51a684859c2 (diff) | |
download | lwn-65ccfe21dd8fb402547bb1c50bbc2737c4ef37b8.tar.gz lwn-65ccfe21dd8fb402547bb1c50bbc2737c4ef37b8.zip |
rbd: split up rbd_get_segment()
There are two places where rbd_get_segment() is called. One, in
rbd_rq_fn(), only needs to know the length within a segment that an
I/O request should be. The other, in rbd_do_op(), also needs the
name of the object and the offset within it for the I/O request.
Split out rbd_segment_name() into three dedicated functions:
- rbd_segment_name() allocates and formats the name of the
object for a segment containing a given rbd image offset
- rbd_segment_offset() computes the offset within a segment for
a given rbd image offset
- rbd_segment_length() computes the length to use for I/O within
a segment for a request, not to exceed the end of a segment
object.
In the new functions be a bit more careful, checking for possible
error conditions:
- watch for errors or overflows returned by snprintf()
- catch (using BUG_ON()) potential overflow conditions
when computing segment length
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Yehuda Sadeh <yehuda@inktank.com>
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions