aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ntfs/inode.c')
-rw-r--r--fs/ntfs/inode.c68
1 files changed, 45 insertions, 23 deletions
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 55263b7de9c0..ae341922f423 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -1,7 +1,7 @@
1/** 1/**
2 * inode.c - NTFS kernel inode handling. Part of the Linux-NTFS project. 2 * inode.c - NTFS kernel inode handling. Part of the Linux-NTFS project.
3 * 3 *
4 * Copyright (c) 2001-2005 Anton Altaparmakov 4 * Copyright (c) 2001-2006 Anton Altaparmakov
5 * 5 *
6 * This program/include file is free software; you can redistribute it and/or 6 * This program/include file is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as published 7 * modify it under the terms of the GNU General Public License as published
@@ -24,8 +24,10 @@
24#include <linux/smp_lock.h> 24#include <linux/smp_lock.h>
25#include <linux/quotaops.h> 25#include <linux/quotaops.h>
26#include <linux/mount.h> 26#include <linux/mount.h>
27#include <linux/mutex.h>
27 28
28#include "aops.h" 29#include "aops.h"
30#include "attrib.h"
29#include "dir.h" 31#include "dir.h"
30#include "debug.h" 32#include "debug.h"
31#include "inode.h" 33#include "inode.h"
@@ -1064,10 +1066,10 @@ skip_large_dir_stuff:
1064 if (a->non_resident) { 1066 if (a->non_resident) {
1065 NInoSetNonResident(ni); 1067 NInoSetNonResident(ni);
1066 if (NInoCompressed(ni) || NInoSparse(ni)) { 1068 if (NInoCompressed(ni) || NInoSparse(ni)) {
1067 if (a->data.non_resident.compression_unit != 1069 if (NInoCompressed(ni) && a->data.non_resident.
1068 4) { 1070 compression_unit != 4) {
1069 ntfs_error(vi->i_sb, "Found " 1071 ntfs_error(vi->i_sb, "Found "
1070 "nonstandard " 1072 "non-standard "
1071 "compression unit (%u " 1073 "compression unit (%u "
1072 "instead of 4). " 1074 "instead of 4). "
1073 "Cannot handle this.", 1075 "Cannot handle this.",
@@ -1076,16 +1078,26 @@ skip_large_dir_stuff:
1076 err = -EOPNOTSUPP; 1078 err = -EOPNOTSUPP;
1077 goto unm_err_out; 1079 goto unm_err_out;
1078 } 1080 }
1079 ni->itype.compressed.block_clusters = 1U << 1081 if (a->data.non_resident.compression_unit) {
1080 a->data.non_resident. 1082 ni->itype.compressed.block_size = 1U <<
1081 compression_unit; 1083 (a->data.non_resident.
1082 ni->itype.compressed.block_size = 1U << ( 1084 compression_unit +
1083 a->data.non_resident. 1085 vol->cluster_size_bits);
1084 compression_unit + 1086 ni->itype.compressed.block_size_bits =
1085 vol->cluster_size_bits); 1087 ffs(ni->itype.
1086 ni->itype.compressed.block_size_bits = ffs( 1088 compressed.
1087 ni->itype.compressed. 1089 block_size) - 1;
1088 block_size) - 1; 1090 ni->itype.compressed.block_clusters =
1091 1U << a->data.
1092 non_resident.
1093 compression_unit;
1094 } else {
1095 ni->itype.compressed.block_size = 0;
1096 ni->itype.compressed.block_size_bits =
1097 0;
1098 ni->itype.compressed.block_clusters =
1099 0;
1100 }
1089 ni->itype.compressed.size = sle64_to_cpu( 1101 ni->itype.compressed.size = sle64_to_cpu(
1090 a->data.non_resident. 1102 a->data.non_resident.
1091 compressed_size); 1103 compressed_size);
@@ -1338,8 +1350,9 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1338 goto unm_err_out; 1350 goto unm_err_out;
1339 } 1351 }
1340 if (NInoCompressed(ni) || NInoSparse(ni)) { 1352 if (NInoCompressed(ni) || NInoSparse(ni)) {
1341 if (a->data.non_resident.compression_unit != 4) { 1353 if (NInoCompressed(ni) && a->data.non_resident.
1342 ntfs_error(vi->i_sb, "Found nonstandard " 1354 compression_unit != 4) {
1355 ntfs_error(vi->i_sb, "Found non-standard "
1343 "compression unit (%u instead " 1356 "compression unit (%u instead "
1344 "of 4). Cannot handle this.", 1357 "of 4). Cannot handle this.",
1345 a->data.non_resident. 1358 a->data.non_resident.
@@ -1347,13 +1360,22 @@ static int ntfs_read_locked_attr_inode(struct inode *base_vi, struct inode *vi)
1347 err = -EOPNOTSUPP; 1360 err = -EOPNOTSUPP;
1348 goto unm_err_out; 1361 goto unm_err_out;
1349 } 1362 }
1350 ni->itype.compressed.block_clusters = 1U << 1363 if (a->data.non_resident.compression_unit) {
1351 a->data.non_resident.compression_unit; 1364 ni->itype.compressed.block_size = 1U <<
1352 ni->itype.compressed.block_size = 1U << ( 1365 (a->data.non_resident.
1353 a->data.non_resident.compression_unit + 1366 compression_unit +
1354 vol->cluster_size_bits); 1367 vol->cluster_size_bits);
1355 ni->itype.compressed.block_size_bits = ffs( 1368 ni->itype.compressed.block_size_bits =
1356 ni->itype.compressed.block_size) - 1; 1369 ffs(ni->itype.compressed.
1370 block_size) - 1;
1371 ni->itype.compressed.block_clusters = 1U <<
1372 a->data.non_resident.
1373 compression_unit;
1374 } else {
1375 ni->itype.compressed.block_size = 0;
1376 ni->itype.compressed.block_size_bits = 0;
1377 ni->itype.compressed.block_clusters = 0;
1378 }
1357 ni->itype.compressed.size = sle64_to_cpu( 1379 ni->itype.compressed.size = sle64_to_cpu(
1358 a->data.non_resident.compressed_size); 1380 a->data.non_resident.compressed_size);
1359 } 1381 }