File tree Expand file tree Collapse file tree 2 files changed +25
-13
lines changed Expand file tree Collapse file tree 2 files changed +25
-13
lines changed 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)
1007
1007
return cpu_to_le32 (hash );
1008
1008
}
1009
1009
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
+
1010
1034
int ntfs_sb_read (struct super_block * sb , u64 lbo , size_t bytes , void * buffer )
1011
1035
{
1012
1036
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);
586
586
int log_replay (struct ntfs_inode * ni , bool * initialized );
587
587
588
588
/* Globals from fsntfs.c */
589
+ struct buffer_head * ntfs_bread (struct super_block * sb , sector_t block );
589
590
bool ntfs_fix_pre_write (struct NTFS_RECORD_HEADER * rhdr , size_t bytes );
590
591
int ntfs_fix_post_read (struct NTFS_RECORD_HEADER * rhdr , size_t bytes ,
591
592
bool simple );
@@ -1032,19 +1033,6 @@ static inline u64 bytes_to_block(const struct super_block *sb, u64 size)
1032
1033
return (size + sb -> s_blocksize - 1 ) >> sb -> s_blocksize_bits ;
1033
1034
}
1034
1035
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
-
1048
1036
static inline struct ntfs_inode * ntfs_i (struct inode * inode )
1049
1037
{
1050
1038
return container_of (inode , struct ntfs_inode , vfs_inode );
You can’t perform that action at this time.
0 commit comments