aboutsummaryrefslogtreecommitdiffstats
path: root/fs/udf/inode.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2008-02-08 07:20:50 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:36 -0500
commitaf793295bf9ee92660f5e77d337b0493cea3f9b9 (patch)
tree139f7dd09dbfcae1f98c3af52638e94a52ed5560 /fs/udf/inode.c
parent32a8f24dd75c2be34606e77414afba7bc6b5b366 (diff)
udf: cleanup directory offset handling
Position in directory returned by readdir is offset of directory entry divided by four (don't ask me why). Make this conversion only when reading f_pos from userspace / writing it there and internally work in bytes. It makes things more easily readable and also fixes a bug (we forgot to divide length of the entry by 4 when advancing f_pos in udf_add_entry()). Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/udf/inode.c')
-rw-r--r--fs/udf/inode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 3483274fb5ba..f792681f2f73 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -219,8 +219,8 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block,
219 struct extent_position epos; 219 struct extent_position epos;
220 220
221 struct udf_fileident_bh sfibh, dfibh; 221 struct udf_fileident_bh sfibh, dfibh;
222 loff_t f_pos = udf_ext0_offset(inode) >> 2; 222 loff_t f_pos = udf_ext0_offset(inode);
223 int size = (udf_ext0_offset(inode) + inode->i_size) >> 2; 223 int size = udf_ext0_offset(inode) + inode->i_size;
224 struct fileIdentDesc cfi, *sfi, *dfi; 224 struct fileIdentDesc cfi, *sfi, *dfi;
225 struct udf_inode_info *iinfo = UDF_I(inode); 225 struct udf_inode_info *iinfo = UDF_I(inode);
226 226
@@ -256,11 +256,11 @@ struct buffer_head *udf_expand_dir_adinicb(struct inode *inode, int *block,
256 mark_buffer_dirty_inode(dbh, inode); 256 mark_buffer_dirty_inode(dbh, inode);
257 257
258 sfibh.soffset = sfibh.eoffset = 258 sfibh.soffset = sfibh.eoffset =
259 (f_pos & ((inode->i_sb->s_blocksize - 1) >> 2)) << 2; 259 f_pos & (inode->i_sb->s_blocksize - 1);
260 sfibh.sbh = sfibh.ebh = NULL; 260 sfibh.sbh = sfibh.ebh = NULL;
261 dfibh.soffset = dfibh.eoffset = 0; 261 dfibh.soffset = dfibh.eoffset = 0;
262 dfibh.sbh = dfibh.ebh = dbh; 262 dfibh.sbh = dfibh.ebh = dbh;
263 while ((f_pos < size)) { 263 while (f_pos < size) {
264 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB; 264 iinfo->i_alloc_type = ICBTAG_FLAG_AD_IN_ICB;
265 sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL, 265 sfi = udf_fileident_read(inode, &f_pos, &sfibh, &cfi, NULL,
266 NULL, NULL, NULL); 266 NULL, NULL, NULL);