diff options
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r-- | fs/ufs/inode.c | 193 |
1 files changed, 128 insertions, 65 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index 4295ca91cf85..fb34ad03e224 100644 --- a/fs/ufs/inode.c +++ b/fs/ufs/inode.c | |||
@@ -170,7 +170,7 @@ out: | |||
170 | * @locked_page - for ufs_new_fragments() | 170 | * @locked_page - for ufs_new_fragments() |
171 | */ | 171 | */ |
172 | static struct buffer_head * | 172 | static struct buffer_head * |
173 | ufs_inode_getfrag(struct inode *inode, unsigned int fragment, | 173 | ufs_inode_getfrag(struct inode *inode, u64 fragment, |
174 | sector_t new_fragment, unsigned int required, int *err, | 174 | sector_t new_fragment, unsigned int required, int *err, |
175 | long *phys, int *new, struct page *locked_page) | 175 | long *phys, int *new, struct page *locked_page) |
176 | { | 176 | { |
@@ -178,12 +178,12 @@ ufs_inode_getfrag(struct inode *inode, unsigned int fragment, | |||
178 | struct super_block *sb = inode->i_sb; | 178 | struct super_block *sb = inode->i_sb; |
179 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | 179 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
180 | struct buffer_head * result; | 180 | struct buffer_head * result; |
181 | unsigned block, blockoff, lastfrag, lastblock, lastblockoff; | 181 | unsigned blockoff, lastblockoff; |
182 | unsigned tmp, goal; | 182 | u64 tmp, goal, lastfrag, block, lastblock; |
183 | __fs32 * p, * p2; | 183 | void *p, *p2; |
184 | 184 | ||
185 | UFSD("ENTER, ino %lu, fragment %u, new_fragment %llu, required %u, " | 185 | UFSD("ENTER, ino %lu, fragment %llu, new_fragment %llu, required %u, " |
186 | "metadata %d\n", inode->i_ino, fragment, | 186 | "metadata %d\n", inode->i_ino, (unsigned long long)fragment, |
187 | (unsigned long long)new_fragment, required, !phys); | 187 | (unsigned long long)new_fragment, required, !phys); |
188 | 188 | ||
189 | /* TODO : to be done for write support | 189 | /* TODO : to be done for write support |
@@ -193,17 +193,20 @@ ufs_inode_getfrag(struct inode *inode, unsigned int fragment, | |||
193 | 193 | ||
194 | block = ufs_fragstoblks (fragment); | 194 | block = ufs_fragstoblks (fragment); |
195 | blockoff = ufs_fragnum (fragment); | 195 | blockoff = ufs_fragnum (fragment); |
196 | p = ufsi->i_u1.i_data + block; | 196 | p = ufs_get_direct_data_ptr(uspi, ufsi, block); |
197 | |||
197 | goal = 0; | 198 | goal = 0; |
198 | 199 | ||
199 | repeat: | 200 | repeat: |
200 | tmp = fs32_to_cpu(sb, *p); | 201 | tmp = ufs_data_ptr_to_cpu(sb, p); |
202 | |||
201 | lastfrag = ufsi->i_lastfrag; | 203 | lastfrag = ufsi->i_lastfrag; |
202 | if (tmp && fragment < lastfrag) { | 204 | if (tmp && fragment < lastfrag) { |
203 | if (!phys) { | 205 | if (!phys) { |
204 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); | 206 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
205 | if (tmp == fs32_to_cpu(sb, *p)) { | 207 | if (tmp == ufs_data_ptr_to_cpu(sb, p)) { |
206 | UFSD("EXIT, result %u\n", tmp + blockoff); | 208 | UFSD("EXIT, result %llu\n", |
209 | (unsigned long long)tmp + blockoff); | ||
207 | return result; | 210 | return result; |
208 | } | 211 | } |
209 | brelse (result); | 212 | brelse (result); |
@@ -224,10 +227,11 @@ repeat: | |||
224 | * We must reallocate last allocated block | 227 | * We must reallocate last allocated block |
225 | */ | 228 | */ |
226 | if (lastblockoff) { | 229 | if (lastblockoff) { |
227 | p2 = ufsi->i_u1.i_data + lastblock; | 230 | p2 = ufs_get_direct_data_ptr(uspi, ufsi, lastblock); |
228 | tmp = ufs_new_fragments (inode, p2, lastfrag, | 231 | tmp = ufs_new_fragments(inode, p2, lastfrag, |
229 | fs32_to_cpu(sb, *p2), uspi->s_fpb - lastblockoff, | 232 | ufs_data_ptr_to_cpu(sb, p2), |
230 | err, locked_page); | 233 | uspi->s_fpb - lastblockoff, |
234 | err, locked_page); | ||
231 | if (!tmp) { | 235 | if (!tmp) { |
232 | if (lastfrag != ufsi->i_lastfrag) | 236 | if (lastfrag != ufsi->i_lastfrag) |
233 | goto repeat; | 237 | goto repeat; |
@@ -237,27 +241,31 @@ repeat: | |||
237 | lastfrag = ufsi->i_lastfrag; | 241 | lastfrag = ufsi->i_lastfrag; |
238 | 242 | ||
239 | } | 243 | } |
240 | tmp = fs32_to_cpu(sb, ufsi->i_u1.i_data[lastblock]); | 244 | tmp = ufs_data_ptr_to_cpu(sb, |
245 | ufs_get_direct_data_ptr(uspi, ufsi, | ||
246 | lastblock)); | ||
241 | if (tmp) | 247 | if (tmp) |
242 | goal = tmp + uspi->s_fpb; | 248 | goal = tmp + uspi->s_fpb; |
243 | tmp = ufs_new_fragments (inode, p, fragment - blockoff, | 249 | tmp = ufs_new_fragments (inode, p, fragment - blockoff, |
244 | goal, required + blockoff, | 250 | goal, required + blockoff, |
245 | err, | 251 | err, |
246 | phys != NULL ? locked_page : NULL); | 252 | phys != NULL ? locked_page : NULL); |
247 | } | 253 | } else if (lastblock == block) { |
248 | /* | 254 | /* |
249 | * We will extend last allocated block | 255 | * We will extend last allocated block |
250 | */ | 256 | */ |
251 | else if (lastblock == block) { | 257 | tmp = ufs_new_fragments(inode, p, fragment - |
252 | tmp = ufs_new_fragments(inode, p, fragment - (blockoff - lastblockoff), | 258 | (blockoff - lastblockoff), |
253 | fs32_to_cpu(sb, *p), required + (blockoff - lastblockoff), | 259 | ufs_data_ptr_to_cpu(sb, p), |
260 | required + (blockoff - lastblockoff), | ||
254 | err, phys != NULL ? locked_page : NULL); | 261 | err, phys != NULL ? locked_page : NULL); |
255 | } else /* (lastblock > block) */ { | 262 | } else /* (lastblock > block) */ { |
256 | /* | 263 | /* |
257 | * We will allocate new block before last allocated block | 264 | * We will allocate new block before last allocated block |
258 | */ | 265 | */ |
259 | if (block) { | 266 | if (block) { |
260 | tmp = fs32_to_cpu(sb, ufsi->i_u1.i_data[block-1]); | 267 | tmp = ufs_data_ptr_to_cpu(sb, |
268 | ufs_get_direct_data_ptr(uspi, ufsi, block - 1)); | ||
261 | if (tmp) | 269 | if (tmp) |
262 | goal = tmp + uspi->s_fpb; | 270 | goal = tmp + uspi->s_fpb; |
263 | } | 271 | } |
@@ -266,7 +274,7 @@ repeat: | |||
266 | phys != NULL ? locked_page : NULL); | 274 | phys != NULL ? locked_page : NULL); |
267 | } | 275 | } |
268 | if (!tmp) { | 276 | if (!tmp) { |
269 | if ((!blockoff && *p) || | 277 | if ((!blockoff && ufs_data_ptr_to_cpu(sb, p)) || |
270 | (blockoff && lastfrag != ufsi->i_lastfrag)) | 278 | (blockoff && lastfrag != ufsi->i_lastfrag)) |
271 | goto repeat; | 279 | goto repeat; |
272 | *err = -ENOSPC; | 280 | *err = -ENOSPC; |
@@ -286,7 +294,7 @@ repeat: | |||
286 | if (IS_SYNC(inode)) | 294 | if (IS_SYNC(inode)) |
287 | ufs_sync_inode (inode); | 295 | ufs_sync_inode (inode); |
288 | mark_inode_dirty(inode); | 296 | mark_inode_dirty(inode); |
289 | UFSD("EXIT, result %u\n", tmp + blockoff); | 297 | UFSD("EXIT, result %llu\n", (unsigned long long)tmp + blockoff); |
290 | return result; | 298 | return result; |
291 | 299 | ||
292 | /* This part : To be implemented .... | 300 | /* This part : To be implemented .... |
@@ -320,20 +328,22 @@ repeat2: | |||
320 | */ | 328 | */ |
321 | static struct buffer_head * | 329 | static struct buffer_head * |
322 | ufs_inode_getblock(struct inode *inode, struct buffer_head *bh, | 330 | ufs_inode_getblock(struct inode *inode, struct buffer_head *bh, |
323 | unsigned int fragment, sector_t new_fragment, int *err, | 331 | u64 fragment, sector_t new_fragment, int *err, |
324 | long *phys, int *new, struct page *locked_page) | 332 | long *phys, int *new, struct page *locked_page) |
325 | { | 333 | { |
326 | struct super_block *sb = inode->i_sb; | 334 | struct super_block *sb = inode->i_sb; |
327 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | 335 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; |
328 | struct buffer_head * result; | 336 | struct buffer_head * result; |
329 | unsigned tmp, goal, block, blockoff; | 337 | unsigned blockoff; |
330 | __fs32 * p; | 338 | u64 tmp, goal, block; |
339 | void *p; | ||
331 | 340 | ||
332 | block = ufs_fragstoblks (fragment); | 341 | block = ufs_fragstoblks (fragment); |
333 | blockoff = ufs_fragnum (fragment); | 342 | blockoff = ufs_fragnum (fragment); |
334 | 343 | ||
335 | UFSD("ENTER, ino %lu, fragment %u, new_fragment %llu, metadata %d\n", | 344 | UFSD("ENTER, ino %lu, fragment %llu, new_fragment %llu, metadata %d\n", |
336 | inode->i_ino, fragment, (unsigned long long)new_fragment, !phys); | 345 | inode->i_ino, (unsigned long long)fragment, |
346 | (unsigned long long)new_fragment, !phys); | ||
337 | 347 | ||
338 | result = NULL; | 348 | result = NULL; |
339 | if (!bh) | 349 | if (!bh) |
@@ -344,14 +354,16 @@ ufs_inode_getblock(struct inode *inode, struct buffer_head *bh, | |||
344 | if (!buffer_uptodate(bh)) | 354 | if (!buffer_uptodate(bh)) |
345 | goto out; | 355 | goto out; |
346 | } | 356 | } |
347 | 357 | if (uspi->fs_magic == UFS2_MAGIC) | |
348 | p = (__fs32 *) bh->b_data + block; | 358 | p = (__fs64 *)bh->b_data + block; |
359 | else | ||
360 | p = (__fs32 *)bh->b_data + block; | ||
349 | repeat: | 361 | repeat: |
350 | tmp = fs32_to_cpu(sb, *p); | 362 | tmp = ufs_data_ptr_to_cpu(sb, p); |
351 | if (tmp) { | 363 | if (tmp) { |
352 | if (!phys) { | 364 | if (!phys) { |
353 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); | 365 | result = sb_getblk(sb, uspi->s_sbbase + tmp + blockoff); |
354 | if (tmp == fs32_to_cpu(sb, *p)) | 366 | if (tmp == ufs_data_ptr_to_cpu(sb, p)) |
355 | goto out; | 367 | goto out; |
356 | brelse (result); | 368 | brelse (result); |
357 | goto repeat; | 369 | goto repeat; |
@@ -361,14 +373,16 @@ repeat: | |||
361 | } | 373 | } |
362 | } | 374 | } |
363 | 375 | ||
364 | if (block && (tmp = fs32_to_cpu(sb, ((__fs32*)bh->b_data)[block-1]))) | 376 | if (block && (uspi->fs_magic == UFS2_MAGIC ? |
377 | (tmp = fs64_to_cpu(sb, ((__fs64 *)bh->b_data)[block-1])) : | ||
378 | (tmp = fs32_to_cpu(sb, ((__fs32 *)bh->b_data)[block-1])))) | ||
365 | goal = tmp + uspi->s_fpb; | 379 | goal = tmp + uspi->s_fpb; |
366 | else | 380 | else |
367 | goal = bh->b_blocknr + uspi->s_fpb; | 381 | goal = bh->b_blocknr + uspi->s_fpb; |
368 | tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal, | 382 | tmp = ufs_new_fragments(inode, p, ufs_blknum(new_fragment), goal, |
369 | uspi->s_fpb, err, locked_page); | 383 | uspi->s_fpb, err, locked_page); |
370 | if (!tmp) { | 384 | if (!tmp) { |
371 | if (fs32_to_cpu(sb, *p)) | 385 | if (ufs_data_ptr_to_cpu(sb, p)) |
372 | goto repeat; | 386 | goto repeat; |
373 | goto out; | 387 | goto out; |
374 | } | 388 | } |
@@ -386,7 +400,7 @@ repeat: | |||
386 | sync_dirty_buffer(bh); | 400 | sync_dirty_buffer(bh); |
387 | inode->i_ctime = CURRENT_TIME_SEC; | 401 | inode->i_ctime = CURRENT_TIME_SEC; |
388 | mark_inode_dirty(inode); | 402 | mark_inode_dirty(inode); |
389 | UFSD("result %u\n", tmp + blockoff); | 403 | UFSD("result %llu\n", (unsigned long long)tmp + blockoff); |
390 | out: | 404 | out: |
391 | brelse (bh); | 405 | brelse (bh); |
392 | UFSD("EXIT\n"); | 406 | UFSD("EXIT\n"); |
@@ -616,8 +630,8 @@ static void ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode) | |||
616 | inode->i_atime.tv_nsec = 0; | 630 | inode->i_atime.tv_nsec = 0; |
617 | inode->i_ctime.tv_nsec = 0; | 631 | inode->i_ctime.tv_nsec = 0; |
618 | inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks); | 632 | inode->i_blocks = fs32_to_cpu(sb, ufs_inode->ui_blocks); |
633 | inode->i_generation = fs32_to_cpu(sb, ufs_inode->ui_gen); | ||
619 | ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags); | 634 | ufsi->i_flags = fs32_to_cpu(sb, ufs_inode->ui_flags); |
620 | ufsi->i_gen = fs32_to_cpu(sb, ufs_inode->ui_gen); | ||
621 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); | 635 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); |
622 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); | 636 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); |
623 | 637 | ||
@@ -661,8 +675,8 @@ static void ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) | |||
661 | inode->i_atime.tv_nsec = 0; | 675 | inode->i_atime.tv_nsec = 0; |
662 | inode->i_ctime.tv_nsec = 0; | 676 | inode->i_ctime.tv_nsec = 0; |
663 | inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); | 677 | inode->i_blocks = fs64_to_cpu(sb, ufs2_inode->ui_blocks); |
678 | inode->i_generation = fs32_to_cpu(sb, ufs2_inode->ui_gen); | ||
664 | ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); | 679 | ufsi->i_flags = fs32_to_cpu(sb, ufs2_inode->ui_flags); |
665 | ufsi->i_gen = fs32_to_cpu(sb, ufs2_inode->ui_gen); | ||
666 | /* | 680 | /* |
667 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); | 681 | ufsi->i_shadow = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_shadow); |
668 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); | 682 | ufsi->i_oeftflag = fs32_to_cpu(sb, ufs_inode->ui_u3.ui_sun.ui_oeftflag); |
@@ -731,34 +745,11 @@ bad_inode: | |||
731 | make_bad_inode(inode); | 745 | make_bad_inode(inode); |
732 | } | 746 | } |
733 | 747 | ||
734 | static int ufs_update_inode(struct inode * inode, int do_sync) | 748 | static void ufs1_update_inode(struct inode *inode, struct ufs_inode *ufs_inode) |
735 | { | 749 | { |
736 | struct ufs_inode_info *ufsi = UFS_I(inode); | 750 | struct super_block *sb = inode->i_sb; |
737 | struct super_block * sb; | 751 | struct ufs_inode_info *ufsi = UFS_I(inode); |
738 | struct ufs_sb_private_info * uspi; | 752 | unsigned i; |
739 | struct buffer_head * bh; | ||
740 | struct ufs_inode * ufs_inode; | ||
741 | unsigned i; | ||
742 | unsigned flags; | ||
743 | |||
744 | UFSD("ENTER, ino %lu\n", inode->i_ino); | ||
745 | |||
746 | sb = inode->i_sb; | ||
747 | uspi = UFS_SB(sb)->s_uspi; | ||
748 | flags = UFS_SB(sb)->s_flags; | ||
749 | |||
750 | if (inode->i_ino < UFS_ROOTINO || | ||
751 | inode->i_ino > (uspi->s_ncg * uspi->s_ipg)) { | ||
752 | ufs_warning (sb, "ufs_read_inode", "bad inode number (%lu)\n", inode->i_ino); | ||
753 | return -1; | ||
754 | } | ||
755 | |||
756 | bh = sb_bread(sb, ufs_inotofsba(inode->i_ino)); | ||
757 | if (!bh) { | ||
758 | ufs_warning (sb, "ufs_read_inode", "unable to read inode %lu\n", inode->i_ino); | ||
759 | return -1; | ||
760 | } | ||
761 | ufs_inode = (struct ufs_inode *) (bh->b_data + ufs_inotofsbo(inode->i_ino) * sizeof(struct ufs_inode)); | ||
762 | 753 | ||
763 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | 754 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); |
764 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); | 755 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); |
@@ -775,9 +766,9 @@ static int ufs_update_inode(struct inode * inode, int do_sync) | |||
775 | ufs_inode->ui_mtime.tv_usec = 0; | 766 | ufs_inode->ui_mtime.tv_usec = 0; |
776 | ufs_inode->ui_blocks = cpu_to_fs32(sb, inode->i_blocks); | 767 | ufs_inode->ui_blocks = cpu_to_fs32(sb, inode->i_blocks); |
777 | ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); | 768 | ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); |
778 | ufs_inode->ui_gen = cpu_to_fs32(sb, ufsi->i_gen); | 769 | ufs_inode->ui_gen = cpu_to_fs32(sb, inode->i_generation); |
779 | 770 | ||
780 | if ((flags & UFS_UID_MASK) == UFS_UID_EFT) { | 771 | if ((UFS_SB(sb)->s_flags & UFS_UID_MASK) == UFS_UID_EFT) { |
781 | ufs_inode->ui_u3.ui_sun.ui_shadow = cpu_to_fs32(sb, ufsi->i_shadow); | 772 | ufs_inode->ui_u3.ui_sun.ui_shadow = cpu_to_fs32(sb, ufsi->i_shadow); |
782 | ufs_inode->ui_u3.ui_sun.ui_oeftflag = cpu_to_fs32(sb, ufsi->i_oeftflag); | 773 | ufs_inode->ui_u3.ui_sun.ui_oeftflag = cpu_to_fs32(sb, ufsi->i_oeftflag); |
783 | } | 774 | } |
@@ -796,6 +787,78 @@ static int ufs_update_inode(struct inode * inode, int do_sync) | |||
796 | 787 | ||
797 | if (!inode->i_nlink) | 788 | if (!inode->i_nlink) |
798 | memset (ufs_inode, 0, sizeof(struct ufs_inode)); | 789 | memset (ufs_inode, 0, sizeof(struct ufs_inode)); |
790 | } | ||
791 | |||
792 | static void ufs2_update_inode(struct inode *inode, struct ufs2_inode *ufs_inode) | ||
793 | { | ||
794 | struct super_block *sb = inode->i_sb; | ||
795 | struct ufs_inode_info *ufsi = UFS_I(inode); | ||
796 | unsigned i; | ||
797 | |||
798 | UFSD("ENTER\n"); | ||
799 | ufs_inode->ui_mode = cpu_to_fs16(sb, inode->i_mode); | ||
800 | ufs_inode->ui_nlink = cpu_to_fs16(sb, inode->i_nlink); | ||
801 | |||
802 | ufs_inode->ui_uid = cpu_to_fs32(sb, inode->i_uid); | ||
803 | ufs_inode->ui_gid = cpu_to_fs32(sb, inode->i_gid); | ||
804 | |||
805 | ufs_inode->ui_size = cpu_to_fs64(sb, inode->i_size); | ||
806 | ufs_inode->ui_atime.tv_sec = cpu_to_fs32(sb, inode->i_atime.tv_sec); | ||
807 | ufs_inode->ui_atime.tv_usec = 0; | ||
808 | ufs_inode->ui_ctime.tv_sec = cpu_to_fs32(sb, inode->i_ctime.tv_sec); | ||
809 | ufs_inode->ui_ctime.tv_usec = 0; | ||
810 | ufs_inode->ui_mtime.tv_sec = cpu_to_fs32(sb, inode->i_mtime.tv_sec); | ||
811 | ufs_inode->ui_mtime.tv_usec = 0; | ||
812 | |||
813 | ufs_inode->ui_blocks = cpu_to_fs64(sb, inode->i_blocks); | ||
814 | ufs_inode->ui_flags = cpu_to_fs32(sb, ufsi->i_flags); | ||
815 | ufs_inode->ui_gen = cpu_to_fs32(sb, inode->i_generation); | ||
816 | |||
817 | if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { | ||
818 | /* ufs_inode->ui_u2.ui_addr.ui_db[0] = cpu_to_fs32(sb, inode->i_rdev); */ | ||
819 | ufs_inode->ui_u2.ui_addr.ui_db[0] = ufsi->i_u1.u2_i_data[0]; | ||
820 | } else if (inode->i_blocks) { | ||
821 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR); i++) | ||
822 | ufs_inode->ui_u2.ui_addr.ui_db[i] = ufsi->i_u1.u2_i_data[i]; | ||
823 | } else { | ||
824 | for (i = 0; i < (UFS_NDADDR + UFS_NINDIR) * 4; i++) | ||
825 | ufs_inode->ui_u2.ui_symlink[i] = ufsi->i_u1.i_symlink[i]; | ||
826 | } | ||
827 | |||
828 | if (!inode->i_nlink) | ||
829 | memset (ufs_inode, 0, sizeof(struct ufs2_inode)); | ||
830 | UFSD("EXIT\n"); | ||
831 | } | ||
832 | |||
833 | static int ufs_update_inode(struct inode * inode, int do_sync) | ||
834 | { | ||
835 | struct super_block *sb = inode->i_sb; | ||
836 | struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi; | ||
837 | struct buffer_head * bh; | ||
838 | |||
839 | UFSD("ENTER, ino %lu\n", inode->i_ino); | ||
840 | |||
841 | if (inode->i_ino < UFS_ROOTINO || | ||
842 | inode->i_ino > (uspi->s_ncg * uspi->s_ipg)) { | ||
843 | ufs_warning (sb, "ufs_read_inode", "bad inode number (%lu)\n", inode->i_ino); | ||
844 | return -1; | ||
845 | } | ||
846 | |||
847 | bh = sb_bread(sb, ufs_inotofsba(inode->i_ino)); | ||
848 | if (!bh) { | ||
849 | ufs_warning (sb, "ufs_read_inode", "unable to read inode %lu\n", inode->i_ino); | ||
850 | return -1; | ||
851 | } | ||
852 | if (uspi->fs_magic == UFS2_MAGIC) { | ||
853 | struct ufs2_inode *ufs2_inode = (struct ufs2_inode *)bh->b_data; | ||
854 | |||
855 | ufs2_update_inode(inode, | ||
856 | ufs2_inode + ufs_inotofsbo(inode->i_ino)); | ||
857 | } else { | ||
858 | struct ufs_inode *ufs_inode = (struct ufs_inode *) bh->b_data; | ||
859 | |||
860 | ufs1_update_inode(inode, ufs_inode + ufs_inotofsbo(inode->i_ino)); | ||
861 | } | ||
799 | 862 | ||
800 | mark_buffer_dirty(bh); | 863 | mark_buffer_dirty(bh); |
801 | if (do_sync) | 864 | if (do_sync) |