File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1007,6 +1007,30 @@ static inline __le32 security_hash(const void *sd, size_t bytes)
10071007 return cpu_to_le32 (hash );
10081008}
10091009
1010+ /*
1011+ * simple wrapper for sb_bread_unmovable.
1012+ */
1013+ struct buffer_head * ntfs_bread (struct super_block * sb , sector_t block )
1014+ {
1015+ struct ntfs_sb_info * sbi = sb -> s_fs_info ;
1016+ struct buffer_head * bh ;
1017+
1018+ if (unlikely (block >= sbi -> volume .blocks )) {
1019+ /* prevent generic message "attempt to access beyond end of device" */
1020+ ntfs_err (sb , "try to read out of volume at offset 0x%llx" ,
1021+ (u64 )block << sb -> s_blocksize_bits );
1022+ return NULL ;
1023+ }
1024+
1025+ bh = sb_bread_unmovable (sb , block );
1026+ if (bh )
1027+ return bh ;
1028+
1029+ ntfs_err (sb , "failed to read volume at offset 0x%llx" ,
1030+ (u64 )block << sb -> s_blocksize_bits );
1031+ return NULL ;
1032+ }
1033+
10101034int ntfs_sb_read (struct super_block * sb , u64 lbo , size_t bytes , void * buffer )
10111035{
10121036 struct block_device * bdev = sb -> s_bdev ;
Original file line number Diff line number Diff line change @@ -586,6 +586,7 @@ bool check_index_header(const struct INDEX_HDR *hdr, size_t bytes);
586586int log_replay (struct ntfs_inode * ni , bool * initialized );
587587
588588/* Globals from fsntfs.c */
589+ struct buffer_head * ntfs_bread (struct super_block * sb , sector_t block );
589590bool ntfs_fix_pre_write (struct NTFS_RECORD_HEADER * rhdr , size_t bytes );
590591int ntfs_fix_post_read (struct NTFS_RECORD_HEADER * rhdr , size_t bytes ,
591592 bool simple );
@@ -1032,19 +1033,6 @@ static inline u64 bytes_to_block(const struct super_block *sb, u64 size)
10321033 return (size + sb -> s_blocksize - 1 ) >> sb -> s_blocksize_bits ;
10331034}
10341035
1035- static inline struct buffer_head * ntfs_bread (struct super_block * sb ,
1036- sector_t block )
1037- {
1038- struct buffer_head * bh = sb_bread_unmovable (sb , block );
1039-
1040- if (bh )
1041- return bh ;
1042-
1043- ntfs_err (sb , "failed to read volume at offset 0x%llx" ,
1044- (u64 )block << sb -> s_blocksize_bits );
1045- return NULL ;
1046- }
1047-
10481036static inline struct ntfs_inode * ntfs_i (struct inode * inode )
10491037{
10501038 return container_of (inode , struct ntfs_inode , vfs_inode );
You can’t perform that action at this time.
0 commit comments