Skip to content

Commit

Permalink
NTFS: Implement support for sector sizes above 512 bytes (up to the m…
Browse files Browse the repository at this point in the history
…aximum

      supported by NTFS which is 4096 bytes).
  • Loading branch information
Anton Altaparmakov committed Feb 24, 2006
1 parent 7b875af commit 78af34f
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 70 deletions.
6 changes: 6 additions & 0 deletions fs/ntfs/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,14 @@ ToDo/Notes:

2.1.26 - Minor bug fixes and updates.

- Fix a potential overflow in file.c where a cast to s64 was missing in
a left shift of a page index.
- The struct inode has had its i_sem semaphore changed to a mutex named
i_mutex.
- We have struct kmem_cache now so use it instead of the typedef
kmem_cache_t. (Pekka Enberg)
- Implement support for sector sizes above 512 bytes (up to the maximum
supported by NTFS which is 4096 bytes).
- Miscellaneous updates to layout.h.
- Cope with attribute list attribute having invalid flags. Windows
copes with this and even chkdsk does not detect or fix this so we
Expand Down
18 changes: 8 additions & 10 deletions fs/ntfs/aops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* aops.c - NTFS kernel address space operations and page cache handling.
* Part of the Linux-NTFS project.
*
* Copyright (c) 2001-2005 Anton Altaparmakov
* Copyright (c) 2001-2006 Anton Altaparmakov
* Copyright (c) 2002 Richard Russon
*
* This program/include file is free software; you can redistribute it and/or
Expand Down Expand Up @@ -200,8 +200,8 @@ static int ntfs_read_block(struct page *page)
/* $MFT/$DATA must have its complete runlist in memory at all times. */
BUG_ON(!ni->runlist.rl && !ni->mft_no && !NInoAttr(ni));

blocksize_bits = VFS_I(ni)->i_blkbits;
blocksize = 1 << blocksize_bits;
blocksize = vol->sb->s_blocksize;
blocksize_bits = vol->sb->s_blocksize_bits;

if (!page_has_buffers(page)) {
create_empty_buffers(page, blocksize, 0);
Expand Down Expand Up @@ -569,10 +569,8 @@ static int ntfs_write_block(struct page *page, struct writeback_control *wbc)

BUG_ON(!NInoNonResident(ni));
BUG_ON(NInoMstProtected(ni));

blocksize_bits = vi->i_blkbits;
blocksize = 1 << blocksize_bits;

blocksize = vol->sb->s_blocksize;
blocksize_bits = vol->sb->s_blocksize_bits;
if (!page_has_buffers(page)) {
BUG_ON(!PageUptodate(page));
create_empty_buffers(page, blocksize,
Expand Down Expand Up @@ -949,8 +947,8 @@ static int ntfs_write_mst_block(struct page *page,
*/
BUG_ON(!(is_mft || S_ISDIR(vi->i_mode) ||
(NInoAttr(ni) && ni->type == AT_INDEX_ALLOCATION)));
bh_size_bits = vi->i_blkbits;
bh_size = 1 << bh_size_bits;
bh_size = vol->sb->s_blocksize;
bh_size_bits = vol->sb->s_blocksize_bits;
max_bhs = PAGE_CACHE_SIZE / bh_size;
BUG_ON(!max_bhs);
BUG_ON(max_bhs > MAX_BUF_PER_PAGE);
Expand Down Expand Up @@ -1596,7 +1594,7 @@ void mark_ntfs_record_dirty(struct page *page, const unsigned int ofs) {

BUG_ON(!PageUptodate(page));
end = ofs + ni->itype.index.block_size;
bh_size = 1 << VFS_I(ni)->i_blkbits;
bh_size = VFS_I(ni)->i_sb->s_blocksize;
spin_lock(&mapping->private_lock);
if (unlikely(!page_has_buffers(page))) {
spin_unlock(&mapping->private_lock);
Expand Down
8 changes: 4 additions & 4 deletions fs/ntfs/file.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* file.c - NTFS kernel file operations. Part of the Linux-NTFS project.
*
* Copyright (c) 2001-2005 Anton Altaparmakov
* Copyright (c) 2001-2006 Anton Altaparmakov
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
Expand Down Expand Up @@ -529,8 +529,8 @@ static int ntfs_prepare_pages_for_non_resident_write(struct page **pages,
"index 0x%lx, nr_pages 0x%x, pos 0x%llx, bytes 0x%zx.",
vi->i_ino, ni->type, pages[0]->index, nr_pages,
(long long)pos, bytes);
blocksize_bits = vi->i_blkbits;
blocksize = 1 << blocksize_bits;
blocksize = vol->sb->s_blocksize;
blocksize_bits = vol->sb->s_blocksize_bits;
u = 0;
do {
struct page *page = pages[u];
Expand Down Expand Up @@ -1525,7 +1525,7 @@ static inline int ntfs_commit_pages_after_non_resident_write(

vi = pages[0]->mapping->host;
ni = NTFS_I(vi);
blocksize = 1 << vi->i_blkbits;
blocksize = vi->i_sb->s_blocksize;
end = pos + bytes;
u = 0;
do {
Expand Down
8 changes: 4 additions & 4 deletions fs/ntfs/mft.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project.
*
* Copyright (c) 2001-2005 Anton Altaparmakov
* Copyright (c) 2001-2006 Anton Altaparmakov
* Copyright (c) 2002 Richard Russon
*
* This program/include file is free software; you can redistribute it and/or
Expand Down Expand Up @@ -473,7 +473,7 @@ int ntfs_sync_mft_mirror(ntfs_volume *vol, const unsigned long mft_no,
runlist_element *rl;
unsigned int block_start, block_end, m_start, m_end, page_ofs;
int i_bhs, nr_bhs, err = 0;
unsigned char blocksize_bits = vol->mftmirr_ino->i_blkbits;
unsigned char blocksize_bits = vol->sb->s_blocksize_bits;

ntfs_debug("Entering for inode 0x%lx.", mft_no);
BUG_ON(!max_bhs);
Expand Down Expand Up @@ -672,8 +672,8 @@ int write_mft_record_nolock(ntfs_inode *ni, MFT_RECORD *m, int sync)
{
ntfs_volume *vol = ni->vol;
struct page *page = ni->page;
unsigned char blocksize_bits = vol->mft_ino->i_blkbits;
unsigned int blocksize = 1 << blocksize_bits;
unsigned int blocksize = vol->sb->s_blocksize;
unsigned char blocksize_bits = vol->sb->s_blocksize_bits;
int max_bhs = vol->mft_record_size / blocksize;
struct buffer_head *bhs[max_bhs];
struct buffer_head *bh, *head;
Expand Down
Loading

0 comments on commit 78af34f

Please sign in to comment.