summaryrefslogtreecommitdiffstats
path: root/fs/fat/buffer.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
committer <ralf@linux-mips.org>1997-04-29 21:13:14 +0000
commit19c9bba94152148523ba0f7ef7cffe3d45656b11 (patch)
tree40b1cb534496a7f1ca0f5c314a523c69f1fee464 /fs/fat/buffer.c
parent7206675c40394c78a90e74812bbdbf8cf3cca1be (diff)
Import of Linux/MIPS 2.1.36
Diffstat (limited to 'fs/fat/buffer.c')
-rw-r--r--fs/fat/buffer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/fat/buffer.c b/fs/fat/buffer.c
index eebbf29b5..2a6fc6b74 100644
--- a/fs/fat/buffer.c
+++ b/fs/fat/buffer.c
@@ -16,13 +16,18 @@ struct buffer_head *fat_bread (
{
struct buffer_head *ret = NULL;
- /* Note that the blocksize is 512 or 1024, but the first read
- is always of size 1024. Doing readahead may be counterproductive
+ /* Note that the blocksize is 512, 1024 or 2048, but the first read
+ is always of size 1024 (or 2048). Doing readahead may be counterproductive
or just plain wrong. */
if (sb->s_blocksize == 512) {
ret = bread (sb->s_dev,block,512);
} else {
- struct buffer_head *real = bread (sb->s_dev,block>>1,1024);
+ struct buffer_head *real;
+ if (sb->s_blocksize == 1024){
+ real = bread (sb->s_dev,block>>1,1024);
+ }else{
+ real = bread (sb->s_dev,block>>2,2048);
+ }
if (real != NULL){
ret = (struct buffer_head *)
@@ -59,7 +64,11 @@ struct buffer_head *fat_bread (
*/
memset (ret,0,sizeof(*ret));
ret->b_data = real->b_data;
- if (block & 1) ret->b_data += 512;
+ if (sb->s_blocksize == 2048) {
+ if (block & 3) ret->b_data += (block & 3) << 9;
+ }else{
+ if (block & 1) ret->b_data += 512;
+ }
ret->b_next = real;
}else{
brelse (real);