aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/util.h
diff options
context:
space:
mode:
authorEvgeniy Dushistov <dushistov@mail.ru>2007-02-12 03:54:32 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:40 -0500
commit54fb996ac15c4014fa4d6b0ec8e42da134204897 (patch)
treeee7a98270cabefc996a13691a7c9d63141a8d3a9 /fs/ufs/util.h
parent3313e29267414e4e3bf0d3de1caf9cb439b64aaf (diff)
[PATCH] ufs2 write: block allocation update
Patch adds ability to work with 64bit metadata, this made by replacing work with 32bit pointers by inline functions. Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ufs/util.h')
-rw-r--r--fs/ufs/util.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/fs/ufs/util.h b/fs/ufs/util.h
index 7dd12bb1d62b..06d344839c42 100644
--- a/fs/ufs/util.h
+++ b/fs/ufs/util.h
@@ -305,8 +305,22 @@ static inline void *get_usb_offset(struct ufs_sb_private_info *uspi,
305 (((__fs32*)((ubh)->bh[(begin) >> (uspi->s_fshift-2)]->b_data)) + \ 305 (((__fs32*)((ubh)->bh[(begin) >> (uspi->s_fshift-2)]->b_data)) + \
306 ((begin) & ((uspi->s_fsize>>2) - 1))) 306 ((begin) & ((uspi->s_fsize>>2) - 1)))
307 307
308#define ubh_get_addr64(ubh,begin) \
309 (((__fs64*)((ubh)->bh[(begin) >> (uspi->s_fshift-3)]->b_data)) + \
310 ((begin) & ((uspi->s_fsize>>3) - 1)))
311
308#define ubh_get_addr ubh_get_addr8 312#define ubh_get_addr ubh_get_addr8
309 313
314static inline void *ubh_get_data_ptr(struct ufs_sb_private_info *uspi,
315 struct ufs_buffer_head *ubh,
316 u64 blk)
317{
318 if (uspi->fs_magic == UFS2_MAGIC)
319 return ubh_get_addr64(ubh, blk);
320 else
321 return ubh_get_addr32(ubh, blk);
322}
323
310#define ubh_blkmap(ubh,begin,bit) \ 324#define ubh_blkmap(ubh,begin,bit) \
311 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb))) 325 ((*ubh_get_addr(ubh, (begin) + ((bit) >> 3)) >> ((bit) & 7)) & (0xff >> (UFS_MAXFRAG - uspi->s_fpb)))
312 326
@@ -507,3 +521,46 @@ static inline void ufs_fragacct (struct super_block * sb, unsigned blockmap,
507 if (fragsize > 0 && fragsize < uspi->s_fpb) 521 if (fragsize > 0 && fragsize < uspi->s_fpb)
508 fs32_add(sb, &fraglist[fragsize], cnt); 522 fs32_add(sb, &fraglist[fragsize], cnt);
509} 523}
524
525static inline void *ufs_get_direct_data_ptr(struct ufs_sb_private_info *uspi,
526 struct ufs_inode_info *ufsi,
527 unsigned blk)
528{
529 BUG_ON(blk > UFS_TIND_BLOCK);
530 return uspi->fs_magic == UFS2_MAGIC ?
531 (void *)&ufsi->i_u1.u2_i_data[blk] :
532 (void *)&ufsi->i_u1.i_data[blk];
533}
534
535static inline u64 ufs_data_ptr_to_cpu(struct super_block *sb, void *p)
536{
537 return UFS_SB(sb)->s_uspi->fs_magic == UFS2_MAGIC ?
538 fs64_to_cpu(sb, *(__fs64 *)p) :
539 fs32_to_cpu(sb, *(__fs32 *)p);
540}
541
542static inline void ufs_cpu_to_data_ptr(struct super_block *sb, void *p, u64 val)
543{
544 if (UFS_SB(sb)->s_uspi->fs_magic == UFS2_MAGIC)
545 *(__fs64 *)p = cpu_to_fs64(sb, val);
546 else
547 *(__fs32 *)p = cpu_to_fs32(sb, val);
548}
549
550static inline void ufs_data_ptr_clear(struct ufs_sb_private_info *uspi,
551 void *p)
552{
553 if (uspi->fs_magic == UFS2_MAGIC)
554 *(__fs64 *)p = 0;
555 else
556 *(__fs32 *)p = 0;
557}
558
559static inline int ufs_is_data_ptr_zero(struct ufs_sb_private_info *uspi,
560 void *p)
561{
562 if (uspi->fs_magic == UFS2_MAGIC)
563 return *(__fs64 *)p == 0;
564 else
565 return *(__fs32 *)p == 0;
566}