All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/12 linux-next] udf: clean-up
@ 2017-01-06 20:53 Fabian Frederick
  2017-01-06 20:53 ` [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

This small patchset does some clean-up in UDF branch

Fabian Frederick (12):
  udf: use __packed instead of __attribute__ ((packed))
  udf: use pointer for kernel_long_ad argument
  udf: merge bh free
  udf: remove unneeded line break
  udf: remove empty condition
  udf: add udf_ajust_time
  udf: store allocation offset in udf_prealloc_extents()
  udf: remove next_epos from udf_update_extent_cache()
  udf: merge module informations in super.c
  udf: atomically read inode size
  udf: replace 0xFFFFFFFF by ~0
  udf: check partition reference in udf_read_inode()

 fs/udf/balloc.c    |   6 +--
 fs/udf/ecma_167.h  |  98 +++++++++++++++++++--------------------
 fs/udf/inode.c     | 133 +++++++++++++++++++++++------------------------------
 fs/udf/lowlevel.c  |   2 +-
 fs/udf/misc.c      |   8 ++--
 fs/udf/osta_udf.h  |  34 +++++++-------
 fs/udf/partition.c |  20 ++++----
 fs/udf/super.c     |  42 +++++++++--------
 8 files changed, 163 insertions(+), 180 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 25+ messages in thread

* [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed))
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:29   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument Fabian Frederick
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

defined in linux/compiler-gcc.h

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/ecma_167.h | 98 +++++++++++++++++++++++++++----------------------------
 fs/udf/osta_udf.h | 34 +++++++++----------
 2 files changed, 66 insertions(+), 66 deletions(-)

diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
index 4792b77..9f24bd1 100644
--- a/fs/udf/ecma_167.h
+++ b/fs/udf/ecma_167.h
@@ -41,7 +41,7 @@
 struct charspec {
 	uint8_t		charSetType;
 	uint8_t		charSetInfo[63];
-} __attribute__ ((packed));
+} __packed;
 
 /* Character Set Type (ECMA 167r3 1/7.2.1.1) */
 #define CHARSPEC_TYPE_CS0		0x00	/* (1/7.2.2) */
@@ -68,7 +68,7 @@ struct timestamp {
 	uint8_t		centiseconds;
 	uint8_t		hundredsOfMicroseconds;
 	uint8_t		microseconds;
-} __attribute__ ((packed));
+} __packed;
 
 /* Type and Time Zone (ECMA 167r3 1/7.3.1) */
 #define TIMESTAMP_TYPE_MASK		0xF000
@@ -82,7 +82,7 @@ struct regid {
 	uint8_t		flags;
 	uint8_t		ident[23];
 	uint8_t		identSuffix[8];
-} __attribute__ ((packed));
+} __packed;
 
 /* Flags (ECMA 167r3 1/7.4.1) */
 #define ENTITYID_FLAGS_DIRTY		0x00
@@ -95,7 +95,7 @@ struct volStructDesc {
 	uint8_t		stdIdent[VSD_STD_ID_LEN];
 	uint8_t		structVersion;
 	uint8_t		structData[2041];
-} __attribute__ ((packed));
+} __packed;
 
 /* Standard Identifier (EMCA 167r2 2/9.1.2) */
 #define VSD_STD_ID_NSR02		"NSR02"	/* (3/9.1) */
@@ -114,7 +114,7 @@ struct beginningExtendedAreaDesc {
 	uint8_t		stdIdent[VSD_STD_ID_LEN];
 	uint8_t		structVersion;
 	uint8_t		structData[2041];
-} __attribute__ ((packed));
+} __packed;
 
 /* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
 struct terminatingExtendedAreaDesc {
@@ -122,7 +122,7 @@ struct terminatingExtendedAreaDesc {
 	uint8_t		stdIdent[VSD_STD_ID_LEN];
 	uint8_t		structVersion;
 	uint8_t		structData[2041];
-} __attribute__ ((packed));
+} __packed;
 
 /* Boot Descriptor (ECMA 167r3 2/9.4) */
 struct bootDesc {
@@ -140,7 +140,7 @@ struct bootDesc {
 	__le16			flags;
 	uint8_t			reserved2[32];
 	uint8_t			bootUse[1906];
-} __attribute__ ((packed));
+} __packed;
 
 /* Flags (ECMA 167r3 2/9.4.12) */
 #define BOOT_FLAGS_ERASE		0x01
@@ -149,7 +149,7 @@ struct bootDesc {
 struct extent_ad {
 	__le32		extLength;
 	__le32		extLocation;
-} __attribute__ ((packed));
+} __packed;
 
 struct kernel_extent_ad {
 	uint32_t	extLength;
@@ -166,7 +166,7 @@ struct tag {
 	__le16		descCRC;
 	__le16		descCRCLength;
 	__le32		tagLocation;
-} __attribute__ ((packed));
+} __packed;
 
 /* Tag Identifier (ECMA 167r3 3/7.2.1) */
 #define TAG_IDENT_PVD			0x0001
@@ -186,7 +186,7 @@ struct NSRDesc {
 	uint8_t		structVersion;
 	uint8_t		reserved;
 	uint8_t		structData[2040];
-} __attribute__ ((packed));
+} __packed;
 
 /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
 struct primaryVolDesc {
@@ -212,7 +212,7 @@ struct primaryVolDesc {
 	__le32			predecessorVolDescSeqLocation;
 	__le16			flags;
 	uint8_t			reserved[22];
-} __attribute__ ((packed));
+} __packed;
 
 /* Flags (ECMA 167r3 3/10.1.21) */
 #define PVD_FLAGS_VSID_COMMON		0x0001
@@ -223,7 +223,7 @@ struct anchorVolDescPtr {
 	struct extent_ad	mainVolDescSeqExt;
 	struct extent_ad	reserveVolDescSeqExt;
 	uint8_t	 		reserved[480];
-} __attribute__ ((packed));
+} __packed;
 
 /* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
 struct volDescPtr {
@@ -231,7 +231,7 @@ struct volDescPtr {
 	__le32			volDescSeqNum;
 	struct extent_ad	nextVolDescSeqExt;
 	uint8_t			reserved[484];
-} __attribute__ ((packed));
+} __packed;
 
 /* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
 struct impUseVolDesc {
@@ -239,7 +239,7 @@ struct impUseVolDesc {
 	__le32		volDescSeqNum;
 	struct regid	impIdent;
 	uint8_t		impUse[460];
-} __attribute__ ((packed));
+} __packed;
 
 /* Partition Descriptor (ECMA 167r3 3/10.5) */
 struct partitionDesc {
@@ -255,7 +255,7 @@ struct partitionDesc {
 	struct regid impIdent;
 	uint8_t impUse[128];
 	uint8_t reserved[156];
-} __attribute__ ((packed));
+} __packed;
 
 /* Partition Flags (ECMA 167r3 3/10.5.3) */
 #define PD_PARTITION_FLAGS_ALLOC	0x0001
@@ -291,14 +291,14 @@ struct logicalVolDesc {
 	uint8_t			impUse[128];
 	struct extent_ad	integritySeqExt;
 	uint8_t			partitionMaps[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Generic Partition Map (ECMA 167r3 3/10.7.1) */
 struct genericPartitionMap {
 	uint8_t		partitionMapType;
 	uint8_t		partitionMapLength;
 	uint8_t		partitionMapping[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
 #define GP_PARTITION_MAP_TYPE_UNDEF	0x00
@@ -311,14 +311,14 @@ struct genericPartitionMap1 {
 	uint8_t		partitionMapLength;
 	__le16		volSeqNum;
 	__le16		partitionNum;
-} __attribute__ ((packed));
+} __packed;
 
 /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
 struct genericPartitionMap2 {
 	uint8_t		partitionMapType;
 	uint8_t		partitionMapLength;
 	uint8_t		partitionIdent[62];
-} __attribute__ ((packed));
+} __packed;
 
 /* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
 struct unallocSpaceDesc {
@@ -326,13 +326,13 @@ struct unallocSpaceDesc {
 	__le32			volDescSeqNum;
 	__le32			numAllocDescs;
 	struct extent_ad	allocDescs[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Terminating Descriptor (ECMA 167r3 3/10.9) */
 struct terminatingDesc {
 	struct tag	descTag;
 	uint8_t		reserved[496];
-} __attribute__ ((packed));
+} __packed;
 
 /* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
 struct logicalVolIntegrityDesc {
@@ -346,7 +346,7 @@ struct logicalVolIntegrityDesc {
 	__le32			freeSpaceTable[0];
 	__le32			sizeTable[0];
 	uint8_t			impUse[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Integrity Type (ECMA 167r3 3/10.10.3) */
 #define LVID_INTEGRITY_TYPE_OPEN	0x00000000
@@ -356,7 +356,7 @@ struct logicalVolIntegrityDesc {
 struct lb_addr {
 	__le32		logicalBlockNum;
 	__le16	 	partitionReferenceNum;
-} __attribute__ ((packed));
+} __packed;
 
 /* ... and its in-core analog */
 struct kernel_lb_addr {
@@ -368,14 +368,14 @@ struct kernel_lb_addr {
 struct short_ad {
         __le32		extLength;
         __le32		extPosition;
-} __attribute__ ((packed));
+} __packed;
 
 /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
 struct long_ad {
 	__le32		extLength;
 	struct lb_addr	extLocation;
 	uint8_t		impUse[6];
-} __attribute__ ((packed));
+} __packed;
 
 struct kernel_long_ad {
 	uint32_t		extLength;
@@ -389,7 +389,7 @@ struct ext_ad {
 	__le32		recordedLength;
 	__le32		informationLength;
 	struct lb_addr	extLocation;
-} __attribute__ ((packed));
+} __packed;
 
 struct kernel_ext_ad {
 	uint32_t		extLength;
@@ -434,7 +434,7 @@ struct fileSetDesc {
 	struct long_ad		nextExt;
 	struct long_ad		streamDirectoryICB;
 	uint8_t			reserved[32];
-} __attribute__ ((packed));
+} __packed;
 
 /* Partition Header Descriptor (ECMA 167r3 4/14.3) */
 struct partitionHeaderDesc {
@@ -444,7 +444,7 @@ struct partitionHeaderDesc {
 	struct short_ad	freedSpaceTable;
 	struct short_ad	freedSpaceBitmap;
 	uint8_t		reserved[88];
-} __attribute__ ((packed));
+} __packed;
 
 /* File Identifier Descriptor (ECMA 167r3 4/14.4) */
 struct fileIdentDesc {
@@ -457,7 +457,7 @@ struct fileIdentDesc {
 	uint8_t		impUse[0];
 	uint8_t		fileIdent[0];
 	uint8_t		padding[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* File Characteristics (ECMA 167r3 4/14.4.3) */
 #define FID_FILE_CHAR_HIDDEN		0x01
@@ -471,7 +471,7 @@ struct allocExtDesc {
 	struct tag	descTag;
 	__le32		previousAllocExtLocation;
 	__le32		lengthAllocDescs;
-} __attribute__ ((packed));
+} __packed;
 
 /* ICB Tag (ECMA 167r3 4/14.6) */
 struct icbtag {
@@ -483,7 +483,7 @@ struct icbtag {
 	uint8_t		fileType;
 	struct lb_addr	parentICBLocation;
 	__le16		flags;
-} __attribute__ ((packed));
+} __packed;
 
 /* Strategy Type (ECMA 167r3 4/14.6.2) */
 #define ICBTAG_STRATEGY_TYPE_UNDEF	0x0000
@@ -531,13 +531,13 @@ struct indirectEntry {
 	struct tag	descTag;
 	struct icbtag	icbTag;
 	struct long_ad	indirectICB;
-} __attribute__ ((packed));
+} __packed;
 
 /* Terminal Entry (ECMA 167r3 4/14.8) */
 struct terminalEntry {
 	struct tag	descTag;
 	struct icbtag	icbTag;
-} __attribute__ ((packed));
+} __packed;
 
 /* File Entry (ECMA 167r3 4/14.9) */
 struct fileEntry {
@@ -563,7 +563,7 @@ struct fileEntry {
 	__le32			lengthAllocDescs;
 	uint8_t			extendedAttr[0];
 	uint8_t			allocDescs[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Permissions (ECMA 167r3 4/14.9.5) */
 #define FE_PERM_O_EXEC			0x00000001U
@@ -607,7 +607,7 @@ struct extendedAttrHeaderDesc {
 	struct tag	descTag;
 	__le32		impAttrLocation;
 	__le32		appAttrLocation;
-} __attribute__ ((packed));
+} __packed;
 
 /* Generic Format (ECMA 167r3 4/14.10.2) */
 struct genericFormat {
@@ -616,7 +616,7 @@ struct genericFormat {
 	uint8_t		reserved[3];
 	__le32		attrLength;
 	uint8_t		attrData[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Character Set Information (ECMA 167r3 4/14.10.3) */
 struct charSetInfo {
@@ -627,7 +627,7 @@ struct charSetInfo {
 	__le32		escapeSeqLength;
 	uint8_t		charSetType;
 	uint8_t		escapeSeq[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Alternate Permissions (ECMA 167r3 4/14.10.4) */
 struct altPerms {
@@ -638,7 +638,7 @@ struct altPerms {
 	__le16		ownerIdent;
 	__le16		groupIdent;
 	__le16		permission;
-} __attribute__ ((packed));
+} __packed;
 
 /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
 struct fileTimesExtAttr {
@@ -649,7 +649,7 @@ struct fileTimesExtAttr {
 	__le32		dataLength;
 	__le32		fileTimeExistence;
 	uint8_t		fileTimes;
-} __attribute__ ((packed));
+} __packed;
 
 /* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
 #define FTE_CREATION			0x00000001
@@ -666,7 +666,7 @@ struct infoTimesExtAttr {
 	__le32		dataLength;
 	__le32		infoTimeExistence;
 	uint8_t		infoTimes[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Device Specification (ECMA 167r3 4/14.10.7) */
 struct deviceSpec {
@@ -678,7 +678,7 @@ struct deviceSpec {
 	__le32		majorDeviceIdent;
 	__le32		minorDeviceIdent;
 	uint8_t		impUse[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
 struct impUseExtAttr {
@@ -689,7 +689,7 @@ struct impUseExtAttr {
 	__le32		impUseLength;
 	struct regid	impIdent;
 	uint8_t		impUse[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
 struct appUseExtAttr {
@@ -700,7 +700,7 @@ struct appUseExtAttr {
 	__le32		appUseLength;
 	struct regid	appIdent;
 	uint8_t		appUse[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define EXTATTR_CHAR_SET		1
 #define EXTATTR_ALT_PERMS		3
@@ -716,7 +716,7 @@ struct unallocSpaceEntry {
 	struct icbtag	icbTag;
 	__le32		lengthAllocDescs;
 	uint8_t		allocDescs[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
 struct spaceBitmapDesc {
@@ -724,7 +724,7 @@ struct spaceBitmapDesc {
 	__le32		numOfBits;
 	__le32		numOfBytes;
 	uint8_t		bitmap[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Partition Integrity Entry (ECMA 167r3 4/14.13) */
 struct partitionIntegrityEntry {
@@ -735,7 +735,7 @@ struct partitionIntegrityEntry {
 	uint8_t			reserved[175];
 	struct regid		impIdent;
 	uint8_t			impUse[256];
-} __attribute__ ((packed));
+} __packed;
 
 /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
 
@@ -753,7 +753,7 @@ struct partitionIntegrityEntry {
 struct logicalVolHeaderDesc {
 	__le64		uniqueID;
 	uint8_t		reserved[24];
-} __attribute__ ((packed));
+} __packed;
 
 /* Path Component (ECMA 167r3 4/14.16.1) */
 struct pathComponent {
@@ -761,7 +761,7 @@ struct pathComponent {
 	uint8_t		lengthComponentIdent;
 	__le16		componentFileVersionNum;
 	dstring		componentIdent[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* File Entry (ECMA 167r3 4/14.17) */
 struct extendedFileEntry {
@@ -791,6 +791,6 @@ struct extendedFileEntry {
 	__le32			lengthAllocDescs;
 	uint8_t			extendedAttr[0];
 	uint8_t			allocDescs[0];
-} __attribute__ ((packed));
+} __packed;
 
 #endif /* _ECMA_167_H */
diff --git a/fs/udf/osta_udf.h b/fs/udf/osta_udf.h
index fbff746..a4da59e 100644
--- a/fs/udf/osta_udf.h
+++ b/fs/udf/osta_udf.h
@@ -70,17 +70,17 @@ struct UDFIdentSuffix {
 	uint8_t		OSClass;
 	uint8_t		OSIdentifier;
 	uint8_t		reserved[4];
-} __attribute__ ((packed));
+} __packed;
 
 struct impIdentSuffix {
 	uint8_t		OSClass;
 	uint8_t		OSIdentifier;
 	uint8_t		reserved[6];
-} __attribute__ ((packed));
+} __packed;
 
 struct appIdentSuffix {
 	uint8_t		impUse[8];
-} __attribute__ ((packed));
+} __packed;
 
 /* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */
 /* Implementation Use (UDF 2.50 2.2.6.4) */
@@ -92,7 +92,7 @@ struct logicalVolIntegrityDescImpUse {
 	__le16		minUDFWriteRev;
 	__le16		maxUDFWriteRev;
 	uint8_t		impUse[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */
 /* Implementation Use (UDF 2.50 2.2.7.2) */
@@ -104,7 +104,7 @@ struct impUseVolDescImpUse {
 	dstring		LVInfo3[36];
 	struct regid	impIdent;
 	uint8_t		impUse[128];
-} __attribute__ ((packed));
+} __packed;
 
 struct udfPartitionMap2 {
 	uint8_t		partitionMapType;
@@ -113,7 +113,7 @@ struct udfPartitionMap2 {
 	struct regid	partIdent;
 	__le16		volSeqNum;
 	__le16		partitionNum;
-} __attribute__ ((packed));
+} __packed;
 
 /* Virtual Partition Map (UDF 2.50 2.2.8) */
 struct virtualPartitionMap {
@@ -124,7 +124,7 @@ struct virtualPartitionMap {
 	__le16		volSeqNum;
 	__le16		partitionNum;
 	uint8_t		reserved2[24];
-} __attribute__ ((packed));
+} __packed;
 
 /* Sparable Partition Map (UDF 2.50 2.2.9) */
 struct sparablePartitionMap {
@@ -139,7 +139,7 @@ struct sparablePartitionMap {
 	uint8_t reserved2[1];
 	__le32 sizeSparingTable;
 	__le32 locSparingTable[4];
-} __attribute__ ((packed));
+} __packed;
 
 /* Metadata Partition Map (UDF 2.4.0 2.2.10) */
 struct metadataPartitionMap {
@@ -156,14 +156,14 @@ struct metadataPartitionMap {
 	__le16		alignUnitSize;
 	uint8_t		flags;
 	uint8_t		reserved2[5];
-} __attribute__ ((packed));
+} __packed;
 
 /* Virtual Allocation Table (UDF 1.5 2.2.10) */
 struct virtualAllocationTable15 {
 	__le32		VirtualSector[0];
 	struct regid	vatIdent;
 	__le32		previousVATICBLoc;
-} __attribute__ ((packed));
+} __packed;
 
 #define ICBTAG_FILE_TYPE_VAT15		0x00U
 
@@ -181,7 +181,7 @@ struct virtualAllocationTable20 {
 	__le16		reserved;
 	uint8_t		impUse[0];
 	__le32		vatEntry[0];
-} __attribute__ ((packed));
+} __packed;
 
 #define ICBTAG_FILE_TYPE_VAT20		0xF8U
 
@@ -189,7 +189,7 @@ struct virtualAllocationTable20 {
 struct sparingEntry {
 	__le32		origLocation;
 	__le32		mappedLocation;
-} __attribute__ ((packed));
+} __packed;
 
 struct sparingTable {
 	struct tag	descTag;
@@ -199,7 +199,7 @@ struct sparingTable {
 	__le32		sequenceNum;
 	struct sparingEntry
 			mapEntry[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */
 #define ICBTAG_FILE_TYPE_MAIN		0xFA
@@ -210,7 +210,7 @@ struct sparingTable {
 struct allocDescImpUse {
 	__le16		flags;
 	uint8_t		impUse[4];
-} __attribute__ ((packed));
+} __packed;
 
 #define AD_IU_EXT_ERASED		0x0001
 
@@ -222,7 +222,7 @@ struct allocDescImpUse {
 struct freeEaSpace {
 	__le16		headerChecksum;
 	uint8_t		freeEASpace[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */
 struct DVDCopyrightImpUse {
@@ -230,14 +230,14 @@ struct DVDCopyrightImpUse {
 	uint8_t		CGMSInfo;
 	uint8_t		dataType;
 	uint8_t		protectionSystemInfo[4];
-} __attribute__ ((packed));
+} __packed;
 
 /* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */
 /* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */
 struct freeAppEASpace {
 	__le16		headerChecksum;
 	uint8_t		freeEASpace[0];
-} __attribute__ ((packed));
+} __packed;
 
 /* UDF Defined System Stream (UDF 2.50 3.3.7) */
 #define UDF_ID_UNIQUE_ID		"*UDF Unique ID Mapping Data"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
  2017-01-06 20:53 ` [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:33   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 03/12 linux-next] udf: merge bh free Fabian Frederick
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Having struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]
in all function arguments could be understood as by-value parameter.
Use kernel_long_ad pointer for functions depending on
inode_getblk()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index bab40e7..4a7813b 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -57,14 +57,12 @@ static sector_t inode_getblk(struct inode *, sector_t, int *, int *);
 static int8_t udf_insert_aext(struct inode *, struct extent_position,
 			      struct kernel_lb_addr, uint32_t);
 static void udf_split_extents(struct inode *, int *, int, int,
-			      struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
+			      struct kernel_long_ad *, int *);
 static void udf_prealloc_extents(struct inode *, int, int,
-				 struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
-static void udf_merge_extents(struct inode *,
-			      struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
-static void udf_update_extents(struct inode *,
-			       struct kernel_long_ad[EXTENT_MERGE_SIZE], int, int,
-			       struct extent_position *);
+				 struct kernel_long_ad *, int *);
+static void udf_merge_extents(struct inode *, struct kernel_long_ad *, int *);
+static void udf_update_extents(struct inode *, struct kernel_long_ad *, int,
+			       int, struct extent_position *);
 static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
 
 static void __udf_clear_extent_cache(struct inode *inode)
@@ -896,8 +894,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 }
 
 static void udf_split_extents(struct inode *inode, int *c, int offset,
-			      int newblocknum,
-			      struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
+			      int newblocknum, struct kernel_long_ad *laarr,
 			      int *endnum)
 {
 	unsigned long blocksize = inode->i_sb->s_blocksize;
@@ -961,7 +958,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset,
 }
 
 static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
-				 struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
+				 struct kernel_long_ad *laarr,
 				 int *endnum)
 {
 	int start, length = 0, currlength = 0, i;
@@ -1056,8 +1053,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 	}
 }
 
-static void udf_merge_extents(struct inode *inode,
-			      struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
+static void udf_merge_extents(struct inode *inode, struct kernel_long_ad *laarr,
 			      int *endnum)
 {
 	int i;
@@ -1156,8 +1152,7 @@ static void udf_merge_extents(struct inode *inode,
 	}
 }
 
-static void udf_update_extents(struct inode *inode,
-			       struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
+static void udf_update_extents(struct inode *inode, struct kernel_long_ad *laarr,
 			       int startnum, int endnum,
 			       struct extent_position *epos)
 {
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 03/12 linux-next] udf: merge bh free
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
  2017-01-06 20:53 ` [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick
  2017-01-06 20:53 ` [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:36   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 04/12 linux-next] udf: remove unneeded line break Fabian Frederick
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Merge all bh free at one place.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 4a7813b..5cac1c3 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -745,11 +745,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 				 ~(inode->i_sb->s_blocksize - 1));
 			udf_write_aext(inode, &cur_epos, &eloc, elen, 1);
 		}
-		brelse(prev_epos.bh);
-		brelse(cur_epos.bh);
-		brelse(next_epos.bh);
 		newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
-		return newblock;
+		goto out_free;
 	}
 
 	/* Are we beyond EOF? */
@@ -772,11 +769,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 		/* Create extents for the hole between EOF and offset */
 		ret = udf_do_extend_file(inode, &prev_epos, laarr, offset);
 		if (ret < 0) {
-			brelse(prev_epos.bh);
-			brelse(cur_epos.bh);
-			brelse(next_epos.bh);
 			*err = ret;
-			return 0;
+			newblock = 0;
+			goto out_free;
 		}
 		c = 0;
 		offset = 0;
@@ -839,11 +834,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 				iinfo->i_location.partitionReferenceNum,
 				goal, err);
 		if (!newblocknum) {
-			brelse(prev_epos.bh);
-			brelse(cur_epos.bh);
-			brelse(next_epos.bh);
 			*err = -ENOSPC;
-			return 0;
+			newblock = 0;
+			goto out_free;
 		}
 		if (isBeyondEOF)
 			iinfo->i_lenExtents += inode->i_sb->s_blocksize;
@@ -870,15 +863,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 	 * the new number of extents is less than the old number */
 	udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);
 
-	brelse(prev_epos.bh);
-	brelse(cur_epos.bh);
-	brelse(next_epos.bh);
-
 	newblock = udf_get_pblock(inode->i_sb, newblocknum,
 				iinfo->i_location.partitionReferenceNum, 0);
 	if (!newblock) {
 		*err = -EIO;
-		return 0;
+		goto out_free;
 	}
 	*new = 1;
 	iinfo->i_next_alloc_block = block;
@@ -889,7 +878,10 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
 		udf_sync_inode(inode);
 	else
 		mark_inode_dirty(inode);
-
+out_free:
+	brelse(prev_epos.bh);
+	brelse(cur_epos.bh);
+	brelse(next_epos.bh);
 	return newblock;
 }
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 04/12 linux-next] udf: remove unneeded line break
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (2 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 03/12 linux-next] udf: merge bh free Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:37   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 05/12 linux-next] udf: remove empty condition Fabian Frederick
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 5cac1c3..b5893f4 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -2271,8 +2271,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
 		  uint32_t *elen, sector_t *offset)
 {
 	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
-	loff_t lbcount = 0, bcount =
-	    (loff_t) block << blocksize_bits;
+	loff_t lbcount = 0, bcount = (loff_t) block << blocksize_bits;
 	int8_t etype;
 	struct udf_inode_info *iinfo;
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 05/12 linux-next] udf: remove empty condition
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (3 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 04/12 linux-next] udf: remove unneeded line break Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:37   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 06/12 linux-next] udf: add udf_ajust_time Fabian Frederick
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

loc & 0x02 is empty since first git version in 2005 in
udf_add_extendedattr()

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/misc.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 71d1c25..3949c4b 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -141,8 +141,6 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
 		iinfo->i_lenEAttr += size;
 		return (struct genericFormat *)&ea[offset];
 	}
-	if (loc & 0x02)
-		;
 
 	return NULL;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 06/12 linux-next] udf: add udf_ajust_time
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (4 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 05/12 linux-next] udf: remove empty condition Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:44   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Fabian Frederick
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Merge timespec affectations

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index b5893f4..f563e97 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1612,6 +1612,14 @@ static int udf_sync_inode(struct inode *inode)
 	return udf_update_inode(inode, 1);
 }
 
+static void udf_adjust_time(struct udf_inode_info *iinfo, struct timespec time)
+{
+	if (iinfo->i_crtime.tv_sec > time.tv_sec ||
+	    (iinfo->i_crtime.tv_sec == time.tv_sec &&
+	     iinfo->i_crtime.tv_nsec > time.tv_nsec))
+		iinfo->i_crtime = time;
+}
+
 static int udf_update_inode(struct inode *inode, int do_sync)
 {
 	struct buffer_head *bh = NULL;
@@ -1738,20 +1746,9 @@ static int udf_update_inode(struct inode *inode, int do_sync)
 		efe->objectSize = cpu_to_le64(inode->i_size);
 		efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
 
-		if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec ||
-		    (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec &&
-		     iinfo->i_crtime.tv_nsec > inode->i_atime.tv_nsec))
-			iinfo->i_crtime = inode->i_atime;
-
-		if (iinfo->i_crtime.tv_sec > inode->i_mtime.tv_sec ||
-		    (iinfo->i_crtime.tv_sec == inode->i_mtime.tv_sec &&
-		     iinfo->i_crtime.tv_nsec > inode->i_mtime.tv_nsec))
-			iinfo->i_crtime = inode->i_mtime;
-
-		if (iinfo->i_crtime.tv_sec > inode->i_ctime.tv_sec ||
-		    (iinfo->i_crtime.tv_sec == inode->i_ctime.tv_sec &&
-		     iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec))
-			iinfo->i_crtime = inode->i_ctime;
+		udf_adjust_time(iinfo, inode->i_atime);
+		udf_adjust_time(iinfo, inode->i_mtime);
+		udf_adjust_time(iinfo, inode->i_ctime);
 
 		udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime);
 		udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents()
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (5 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 06/12 linux-next] udf: add udf_ajust_time Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:53   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache() Fabian Frederick
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

recalculate offset if needed.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index f563e97..66514ad 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -998,10 +998,10 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 				length : UDF_DEFAULT_PREALLOC_BLOCKS) -
 				currlength);
 		if (numalloc) 	{
+			loff_t pos = numalloc << inode->i_sb->s_blocksize_bits;
+
 			if (start == (c + 1))
-				laarr[start].extLength +=
-					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+				laarr[start].extLength += pos;
 			else {
 				memmove(&laarr[c + 2], &laarr[c + 1],
 					sizeof(struct long_ad) * (*endnum - (c + 1)));
@@ -1011,9 +1011,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					laarr[c].extLocation.
 							partitionReferenceNum;
 				laarr[c + 1].extLength =
-					EXT_NOT_RECORDED_ALLOCATED |
-					(numalloc <<
-					 inode->i_sb->s_blocksize_bits);
+					EXT_NOT_RECORDED_ALLOCATED | pos;
 				start = c + 1;
 			}
 
@@ -1024,12 +1022,12 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					    inode->i_sb->s_blocksize_bits;
 
 				if (elen > numalloc) {
-					laarr[i].extLength -=
-						(numalloc <<
-						 inode->i_sb->s_blocksize_bits);
-					numalloc = 0;
+					laarr[i].extLength -= pos;
+					numalloc = pos = 0;
 				} else {
 					numalloc -= elen;
+					pos = numalloc <<
+					      inode->i_sb->s_blocksize_bits;
 					if (*endnum > (i + 1))
 						memmove(&laarr[i],
 							&laarr[i + 1],
@@ -1039,8 +1037,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
 					(*endnum)--;
 				}
 			}
-			UDF_I(inode)->i_lenExtents +=
-				numalloc << inode->i_sb->s_blocksize_bits;
+			UDF_I(inode)->i_lenExtents += pos;
 		}
 	}
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache()
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (6 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:55   ` Jan Kara
  2017-01-06 20:53 ` [PATCH 09/12 linux-next] udf: merge module informations in super.c Fabian Frederick
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

udf_update_extent_cache() is only called from inode_bmap()
with 1 for next_epos

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 23 +++++++++++------------
 1 file changed, 11 insertions(+), 12 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 66514ad..2327f72 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -109,7 +109,7 @@ static int udf_read_extent_cache(struct inode *inode, loff_t bcount,
 
 /* Add extent to extent cache */
 static void udf_update_extent_cache(struct inode *inode, loff_t estart,
-				    struct extent_position *pos, int next_epos)
+				    struct extent_position *pos)
 {
 	struct udf_inode_info *iinfo = UDF_I(inode);
 
@@ -121,16 +121,15 @@ static void udf_update_extent_cache(struct inode *inode, loff_t estart,
 	memcpy(&iinfo->cached_extent.epos, pos,
 	       sizeof(struct extent_position));
 	iinfo->cached_extent.lstart = estart;
-	if (next_epos)
-		switch (iinfo->i_alloc_type) {
-		case ICBTAG_FLAG_AD_SHORT:
-			iinfo->cached_extent.epos.offset -=
-			sizeof(struct short_ad);
-			break;
-		case ICBTAG_FLAG_AD_LONG:
-			iinfo->cached_extent.epos.offset -=
-			sizeof(struct long_ad);
-		}
+	switch (iinfo->i_alloc_type) {
+	case ICBTAG_FLAG_AD_SHORT:
+		iinfo->cached_extent.epos.offset -=
+		sizeof(struct short_ad);
+		break;
+	case ICBTAG_FLAG_AD_LONG:
+		iinfo->cached_extent.epos.offset -=
+		sizeof(struct long_ad);
+	}
 	spin_unlock(&iinfo->i_extent_cache_lock);
 }
 
@@ -2286,7 +2285,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
 		lbcount += *elen;
 	} while (lbcount <= bcount);
 	/* update extent cache */
-	udf_update_extent_cache(inode, lbcount - *elen, pos, 1);
+	udf_update_extent_cache(inode, lbcount - *elen, pos);
 	*offset = (bcount + *elen - lbcount) >> blocksize_bits;
 
 	return etype;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 09/12 linux-next] udf: merge module informations in super.c
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (7 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache() Fabian Frederick
@ 2017-01-06 20:53 ` Fabian Frederick
  2017-01-10 10:55   ` Jan Kara
  2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
  2017-01-10 11:00 ` [PATCH 00/12 linux-next] udf: clean-up Jan Kara
  10 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:53 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Move all module attributes at the end of one file like other FS.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 4 ----
 fs/udf/super.c | 9 ++++++---
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 2327f72..47638eb 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -43,10 +43,6 @@
 #include "udf_i.h"
 #include "udf_sb.h"
 
-MODULE_AUTHOR("Ben Fennema");
-MODULE_DESCRIPTION("Universal Disk Format Filesystem");
-MODULE_LICENSE("GPL");
-
 #define EXTENT_MERGE_SIZE 5
 
 static umode_t udf_convert_permissions(struct fileEntry *);
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 967ad87..9256117 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -264,9 +264,6 @@ static void __exit exit_udf_fs(void)
 	destroy_inodecache();
 }
 
-module_init(init_udf_fs)
-module_exit(exit_udf_fs)
-
 static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count)
 {
 	struct udf_sb_info *sbi = UDF_SB(sb);
@@ -2500,3 +2497,9 @@ static unsigned int udf_count_free(struct super_block *sb)
 
 	return accum;
 }
+
+MODULE_AUTHOR("Ben Fennema");
+MODULE_DESCRIPTION("Universal Disk Format Filesystem");
+MODULE_LICENSE("GPL");
+module_init(init_udf_fs)
+module_exit(exit_udf_fs)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 10/12 linux-next] udf: atomically read inode size
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (8 preceding siblings ...)
  2017-01-06 20:53 ` [PATCH 09/12 linux-next] udf: merge module informations in super.c Fabian Frederick
@ 2017-01-06 20:54 ` Fabian Frederick
  2017-01-06 20:54   ` [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0 Fabian Frederick
                     ` (2 more replies)
  2017-01-10 11:00 ` [PATCH 00/12 linux-next] udf: clean-up Jan Kara
  10 siblings, 3 replies; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:54 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

See i_size_read() comments in include/linux/fs.h

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/lowlevel.c | 2 +-
 fs/udf/super.c    | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c
index 6ad5a45..5c7ec12 100644
--- a/fs/udf/lowlevel.c
+++ b/fs/udf/lowlevel.c
@@ -58,7 +58,7 @@ unsigned long udf_get_last_block(struct super_block *sb)
 	 */
 	if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) ||
 	    lblock == 0)
-		lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+		lblock = i_size_read(bdev->bd_inode) >> sb->s_blocksize_bits;
 
 	if (lblock)
 		return lblock - 1;
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 9256117..6b5a1a4 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -1213,7 +1213,8 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
 	struct udf_inode_info *vati;
 	uint32_t pos;
 	struct virtualAllocationTable20 *vat20;
-	sector_t blocks = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
+	sector_t blocks = i_size_read(sb->s_bdev->bd_inode) >>
+			  sb->s_blocksize_bits;
 
 	udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block);
 	if (!sbi->s_vat_inode &&
@@ -1803,7 +1804,7 @@ static int udf_check_anchor_block(struct super_block *sb, sector_t block,
 
 	if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV) &&
 	    udf_fixed_to_variable(block) >=
-	    sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits)
+	    i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits)
 		return -EAGAIN;
 
 	bh = udf_read_tagged(sb, block, block, &ident);
@@ -1865,7 +1866,7 @@ static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock,
 		last[last_count++] = *lastblock - 152;
 
 	for (i = 0; i < last_count; i++) {
-		if (last[i] >= sb->s_bdev->bd_inode->i_size >>
+		if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >>
 				sb->s_blocksize_bits)
 			continue;
 		ret = udf_check_anchor_block(sb, last[i], fileset);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0
  2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
@ 2017-01-06 20:54   ` Fabian Frederick
  2017-01-06 20:54   ` [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode() Fabian Frederick
  2017-01-10 10:57   ` [PATCH 10/12 linux-next] udf: atomically read inode size Jan Kara
  2 siblings, 0 replies; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:54 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

Use easier and more explicit value

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/balloc.c    |  6 +++---
 fs/udf/misc.c      |  6 +++---
 fs/udf/partition.c | 20 ++++++++++----------
 fs/udf/super.c     | 26 +++++++++++++-------------
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index e0fd65f..fd760e4 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -511,7 +511,7 @@ static int udf_table_prealloc_blocks(struct super_block *sb,
 	epos.offset = sizeof(struct unallocSpaceEntry);
 	epos.block = iinfo->i_location;
 	epos.bh = NULL;
-	eloc.logicalBlockNum = 0xFFFFFFFF;
+	eloc.logicalBlockNum = ~0;
 
 	while (first_block != eloc.logicalBlockNum &&
 	       (etype = udf_next_aext(table, &epos, &eloc, &elen, 1)) != -1) {
@@ -550,7 +550,7 @@ static int udf_table_new_block(struct super_block *sb,
 			       uint32_t goal, int *err)
 {
 	struct udf_sb_info *sbi = UDF_SB(sb);
-	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
+	uint32_t spread = ~0, nspread = ~0;
 	uint32_t newblock = 0, adsize;
 	uint32_t elen, goal_elen = 0;
 	struct kernel_lb_addr eloc, uninitialized_var(goal_eloc);
@@ -609,7 +609,7 @@ static int udf_table_new_block(struct super_block *sb,
 
 	brelse(epos.bh);
 
-	if (spread == 0xFFFFFFFF) {
+	if (spread == ~0) {
 		brelse(goal_epos.bh);
 		mutex_unlock(&sbi->s_alloc_mutex);
 		return 0;
diff --git a/fs/udf/misc.c b/fs/udf/misc.c
index 3949c4b..8c70f134 100644
--- a/fs/udf/misc.c
+++ b/fs/udf/misc.c
@@ -94,8 +94,8 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
 					cpu_to_le16(sbi->s_serial_number);
 			eahd->descTag.tagLocation = cpu_to_le32(
 					iinfo->i_location.logicalBlockNum);
-			eahd->impAttrLocation = cpu_to_le32(0xFFFFFFFF);
-			eahd->appAttrLocation = cpu_to_le32(0xFFFFFFFF);
+			eahd->impAttrLocation = cpu_to_le32(~0);
+			eahd->appAttrLocation = cpu_to_le32(~0);
 		}
 
 		offset = iinfo->i_lenEAttr;
@@ -204,7 +204,7 @@ struct buffer_head *udf_read_tagged(struct super_block *sb, uint32_t block,
 	u8 checksum;
 
 	/* Read the block */
-	if (block == 0xFFFFFFFF)
+	if (block == ~0)
 		return NULL;
 
 	bh = udf_tread(sb, block);
diff --git a/fs/udf/partition.c b/fs/udf/partition.c
index 888c364..f8658e9 100644
--- a/fs/udf/partition.c
+++ b/fs/udf/partition.c
@@ -34,7 +34,7 @@ uint32_t udf_get_pblock(struct super_block *sb, uint32_t block,
 	if (partition >= sbi->s_partitions) {
 		udf_debug("block=%d, partition=%d, offset=%d: invalid partition\n",
 			  block, partition, offset);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 	map = &sbi->s_partmaps[partition];
 	if (map->s_partition_func)
@@ -61,7 +61,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 	if (block > vdata->s_num_entries) {
 		udf_debug("Trying to access block beyond end of VAT (%d max %d)\n",
 			  block, vdata->s_num_entries);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_IN_ICB) {
@@ -85,7 +85,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 	if (!bh) {
 		udf_debug("get_pblock(UDF_VIRTUAL_MAP:%p,%d,%d) VAT: %d[%d]\n",
 			  sb, block, partition, loc, index);
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	loc = le32_to_cpu(((__le32 *)bh->b_data)[index]);
@@ -95,7 +95,7 @@ uint32_t udf_get_pblock_virt15(struct super_block *sb, uint32_t block,
 translate:
 	if (iinfo->i_location.partitionReferenceNum == partition) {
 		udf_debug("recursive call to udf_get_pblock!\n");
-		return 0xFFFFFFFF;
+		return ~0;
 	}
 
 	return udf_get_pblock(sb, loc,
@@ -188,7 +188,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 				struct sparingEntry *entry = &st->mapEntry[k];
 				u32 origLoc = le32_to_cpu(entry->origLocation);
 
-				if (origLoc == 0xFFFFFFFF) {
+				if (origLoc == ~0) {
 					for (; j < 4; j++) {
 						int len;
 						bh = sdata->s_spar_map[j];
@@ -229,7 +229,7 @@ int udf_relocate_blocks(struct super_block *sb, long old_block, long *new_block)
 				struct sparingEntry *entry = &st->mapEntry[l];
 				u32 origLoc = le32_to_cpu(entry->origLocation);
 
-				if (origLoc != 0xFFFFFFFF)
+				if (origLoc != ~0)
 					continue;
 
 				for (; j < 4; j++) {
@@ -290,7 +290,7 @@ static uint32_t udf_try_read_meta(struct inode *inode, uint32_t block,
 
 	if (inode_bmap(inode, block, &epos, &eloc, &elen, &ext_offset) !=
 						(EXT_RECORDED_ALLOCATED >> 30))
-		phyblock = 0xFFFFFFFF;
+		phyblock = ~0;
 	else {
 		map = &UDF_SB(sb)->s_partmaps[partition];
 		/* map to sparable/physical partition desc */
@@ -319,10 +319,10 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 	inode = mdata->s_metadata_fe ? : mdata->s_mirror_fe;
 
 	if (!inode)
-		return 0xFFFFFFFF;
+		return ~0;
 
 	retblk = udf_try_read_meta(inode, block, partition, offset);
-	if (retblk == 0xFFFFFFFF && mdata->s_metadata_fe) {
+	if (retblk == ~0 && mdata->s_metadata_fe) {
 		udf_warn(sb, "error reading from METADATA, trying to read from MIRROR\n");
 		if (!(mdata->s_flags & MF_MIRROR_FE_LOADED)) {
 			mdata->s_mirror_fe = udf_find_metadata_inode_efe(sb,
@@ -335,7 +335,7 @@ uint32_t udf_get_pblock_meta25(struct super_block *sb, uint32_t block,
 
 		inode = mdata->s_mirror_fe;
 		if (!inode)
-			return 0xFFFFFFFF;
+			return ~0;
 		retblk = udf_try_read_meta(inode, block, partition, offset);
 	}
 
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 6b5a1a4..3a3d307 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -492,12 +492,12 @@ static int udf_parse_options(char *options, struct udf_options *uopt,
 
 	uopt->novrs = 0;
 	uopt->partition = 0xFFFF;
-	uopt->session = 0xFFFFFFFF;
+	uopt->session = ~0;
 	uopt->lastblock = 0;
 	uopt->anchor = 0;
-	uopt->volume = 0xFFFFFFFF;
-	uopt->rootdir = 0xFFFFFFFF;
-	uopt->fileset = 0xFFFFFFFF;
+	uopt->volume = ~0;
+	uopt->rootdir = ~0;
+	uopt->fileset = ~0;
 	uopt->nls_map = NULL;
 
 	if (!options)
@@ -803,7 +803,7 @@ static int udf_find_fileset(struct super_block *sb,
 	uint16_t ident;
 	struct udf_sb_info *sbi;
 
-	if (fileset->logicalBlockNum != 0xFFFFFFFF ||
+	if (fileset->logicalBlockNum != ~0 ||
 	    fileset->partitionReferenceNum != 0xFFFF) {
 		bh = udf_read_ptagged(sb, fileset, 0, &ident);
 
@@ -826,7 +826,7 @@ static int udf_find_fileset(struct super_block *sb,
 
 		for (newfileset.partitionReferenceNum = sbi->s_partitions - 1;
 		     (newfileset.partitionReferenceNum != 0xFFFF &&
-		      fileset->logicalBlockNum == 0xFFFFFFFF &&
+		      fileset->logicalBlockNum == ~0 &&
 		      fileset->partitionReferenceNum == 0xFFFF);
 		     newfileset.partitionReferenceNum--) {
 			lastblock = sbi->s_partmaps
@@ -865,12 +865,12 @@ static int udf_find_fileset(struct super_block *sb,
 					break;
 				}
 			} while (newfileset.logicalBlockNum < lastblock &&
-				 fileset->logicalBlockNum == 0xFFFFFFFF &&
+				 fileset->logicalBlockNum == ~0 &&
 				 fileset->partitionReferenceNum == 0xFFFF);
 		}
 	}
 
-	if ((fileset->logicalBlockNum != 0xFFFFFFFF ||
+	if ((fileset->logicalBlockNum != ~0 ||
 	     fileset->partitionReferenceNum != 0xFFFF) && bh) {
 		udf_debug("Fileset at block=%d, partition=%d\n",
 			  fileset->logicalBlockNum,
@@ -1012,7 +1012,7 @@ static int udf_load_metadata_files(struct super_block *sb, int partition,
 	 * Note:
 	 * Load only if bitmap file location differs from 0xFFFFFFFF (DCN-5102)
 	*/
-	if (mdata->s_bitmap_file_loc != 0xFFFFFFFF) {
+	if (mdata->s_bitmap_file_loc != ~0) {
 		addr.logicalBlockNum = mdata->s_bitmap_file_loc;
 		addr.partitionReferenceNum = mdata->s_phys_partition_ref;
 
@@ -2076,7 +2076,7 @@ u64 lvid_get_unique_id(struct super_block *sb)
 
 	mutex_lock(&sbi->s_alloc_mutex);
 	ret = uniqueID = le64_to_cpu(lvhd->uniqueID);
-	if (!(++uniqueID & 0xFFFFFFFF))
+	if (!(++uniqueID & ~0))
 		uniqueID += 16;
 	lvhd->uniqueID = cpu_to_le64(uniqueID);
 	mutex_unlock(&sbi->s_alloc_mutex);
@@ -2129,7 +2129,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	if (!(uopt.flags & (1 << UDF_FLAG_NLS_MAP)))
 		uopt.flags |= (1 << UDF_FLAG_UTF8);
 
-	fileset.logicalBlockNum = 0xFFFFFFFF;
+	fileset.logicalBlockNum = ~0;
 	fileset.partitionReferenceNum = 0xFFFF;
 
 	sbi->s_flags = uopt.flags;
@@ -2141,7 +2141,7 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent)
 	sbi->s_nls_map = uopt.nls_map;
 	rwlock_init(&sbi->s_cred_lock);
 
-	if (uopt.session == 0xFFFFFFFF)
+	if (uopt.session == ~0)
 		sbi->s_session = udf_get_last_session(sb);
 	else
 		sbi->s_session = uopt.session;
@@ -2467,7 +2467,7 @@ static unsigned int udf_count_free(struct super_block *sb)
 		if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) {
 			accum = le32_to_cpu(
 					lvid->freeSpaceTable[sbi->s_partition]);
-			if (accum == 0xFFFFFFFF)
+			if (accum == ~0)
 				accum = 0;
 		}
 	}
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode()
  2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
  2017-01-06 20:54   ` [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0 Fabian Frederick
@ 2017-01-06 20:54   ` Fabian Frederick
  2017-01-10 10:59     ` Jan Kara
  2017-01-10 10:57   ` [PATCH 10/12 linux-next] udf: atomically read inode size Jan Kara
  2 siblings, 1 reply; 25+ messages in thread
From: Fabian Frederick @ 2017-01-06 20:54 UTC (permalink / raw)
  To: Jan Kara; +Cc: fabf, linux-kernel, linux-fsdevel

We were checking block number without checking partition.
sbi->s_partmaps[iloc->partitionReferenceNum] could lead to
bad memory access. See udf_nfs_get_inode() path for instance.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
 fs/udf/inode.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 47638eb..3926973 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1276,6 +1276,12 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
 	int ret = -EIO;
 
 reread:
+	if (iloc->partitionReferenceNum >= sbi->s_partitions) {
+		udf_debug("partition reference: %d > logical volume partitions: %d\n",
+			  iloc->partitionReferenceNum, sbi->s_partitions);
+		return -EIO;
+	}
+
 	if (iloc->logicalBlockNum >=
 	    sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) {
 		udf_debug("block=%d, partition=%d out of range\n",
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed))
  2017-01-06 20:53 ` [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick
@ 2017-01-10 10:29   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:29 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:49, Fabian Frederick wrote:
> defined in linux/compiler-gcc.h
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza
> ---
>  fs/udf/ecma_167.h | 98 +++++++++++++++++++++++++++----------------------------
>  fs/udf/osta_udf.h | 34 +++++++++----------
>  2 files changed, 66 insertions(+), 66 deletions(-)
> 
> diff --git a/fs/udf/ecma_167.h b/fs/udf/ecma_167.h
> index 4792b77..9f24bd1 100644
> --- a/fs/udf/ecma_167.h
> +++ b/fs/udf/ecma_167.h
> @@ -41,7 +41,7 @@
>  struct charspec {
>  	uint8_t		charSetType;
>  	uint8_t		charSetInfo[63];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Character Set Type (ECMA 167r3 1/7.2.1.1) */
>  #define CHARSPEC_TYPE_CS0		0x00	/* (1/7.2.2) */
> @@ -68,7 +68,7 @@ struct timestamp {
>  	uint8_t		centiseconds;
>  	uint8_t		hundredsOfMicroseconds;
>  	uint8_t		microseconds;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Type and Time Zone (ECMA 167r3 1/7.3.1) */
>  #define TIMESTAMP_TYPE_MASK		0xF000
> @@ -82,7 +82,7 @@ struct regid {
>  	uint8_t		flags;
>  	uint8_t		ident[23];
>  	uint8_t		identSuffix[8];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Flags (ECMA 167r3 1/7.4.1) */
>  #define ENTITYID_FLAGS_DIRTY		0x00
> @@ -95,7 +95,7 @@ struct volStructDesc {
>  	uint8_t		stdIdent[VSD_STD_ID_LEN];
>  	uint8_t		structVersion;
>  	uint8_t		structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Standard Identifier (EMCA 167r2 2/9.1.2) */
>  #define VSD_STD_ID_NSR02		"NSR02"	/* (3/9.1) */
> @@ -114,7 +114,7 @@ struct beginningExtendedAreaDesc {
>  	uint8_t		stdIdent[VSD_STD_ID_LEN];
>  	uint8_t		structVersion;
>  	uint8_t		structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
>  struct terminatingExtendedAreaDesc {
> @@ -122,7 +122,7 @@ struct terminatingExtendedAreaDesc {
>  	uint8_t		stdIdent[VSD_STD_ID_LEN];
>  	uint8_t		structVersion;
>  	uint8_t		structData[2041];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Boot Descriptor (ECMA 167r3 2/9.4) */
>  struct bootDesc {
> @@ -140,7 +140,7 @@ struct bootDesc {
>  	__le16			flags;
>  	uint8_t			reserved2[32];
>  	uint8_t			bootUse[1906];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Flags (ECMA 167r3 2/9.4.12) */
>  #define BOOT_FLAGS_ERASE		0x01
> @@ -149,7 +149,7 @@ struct bootDesc {
>  struct extent_ad {
>  	__le32		extLength;
>  	__le32		extLocation;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct kernel_extent_ad {
>  	uint32_t	extLength;
> @@ -166,7 +166,7 @@ struct tag {
>  	__le16		descCRC;
>  	__le16		descCRCLength;
>  	__le32		tagLocation;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Tag Identifier (ECMA 167r3 3/7.2.1) */
>  #define TAG_IDENT_PVD			0x0001
> @@ -186,7 +186,7 @@ struct NSRDesc {
>  	uint8_t		structVersion;
>  	uint8_t		reserved;
>  	uint8_t		structData[2040];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
>  struct primaryVolDesc {
> @@ -212,7 +212,7 @@ struct primaryVolDesc {
>  	__le32			predecessorVolDescSeqLocation;
>  	__le16			flags;
>  	uint8_t			reserved[22];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Flags (ECMA 167r3 3/10.1.21) */
>  #define PVD_FLAGS_VSID_COMMON		0x0001
> @@ -223,7 +223,7 @@ struct anchorVolDescPtr {
>  	struct extent_ad	mainVolDescSeqExt;
>  	struct extent_ad	reserveVolDescSeqExt;
>  	uint8_t	 		reserved[480];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
>  struct volDescPtr {
> @@ -231,7 +231,7 @@ struct volDescPtr {
>  	__le32			volDescSeqNum;
>  	struct extent_ad	nextVolDescSeqExt;
>  	uint8_t			reserved[484];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
>  struct impUseVolDesc {
> @@ -239,7 +239,7 @@ struct impUseVolDesc {
>  	__le32		volDescSeqNum;
>  	struct regid	impIdent;
>  	uint8_t		impUse[460];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Partition Descriptor (ECMA 167r3 3/10.5) */
>  struct partitionDesc {
> @@ -255,7 +255,7 @@ struct partitionDesc {
>  	struct regid impIdent;
>  	uint8_t impUse[128];
>  	uint8_t reserved[156];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Partition Flags (ECMA 167r3 3/10.5.3) */
>  #define PD_PARTITION_FLAGS_ALLOC	0x0001
> @@ -291,14 +291,14 @@ struct logicalVolDesc {
>  	uint8_t			impUse[128];
>  	struct extent_ad	integritySeqExt;
>  	uint8_t			partitionMaps[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Generic Partition Map (ECMA 167r3 3/10.7.1) */
>  struct genericPartitionMap {
>  	uint8_t		partitionMapType;
>  	uint8_t		partitionMapLength;
>  	uint8_t		partitionMapping[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
>  #define GP_PARTITION_MAP_TYPE_UNDEF	0x00
> @@ -311,14 +311,14 @@ struct genericPartitionMap1 {
>  	uint8_t		partitionMapLength;
>  	__le16		volSeqNum;
>  	__le16		partitionNum;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
>  struct genericPartitionMap2 {
>  	uint8_t		partitionMapType;
>  	uint8_t		partitionMapLength;
>  	uint8_t		partitionIdent[62];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
>  struct unallocSpaceDesc {
> @@ -326,13 +326,13 @@ struct unallocSpaceDesc {
>  	__le32			volDescSeqNum;
>  	__le32			numAllocDescs;
>  	struct extent_ad	allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Terminating Descriptor (ECMA 167r3 3/10.9) */
>  struct terminatingDesc {
>  	struct tag	descTag;
>  	uint8_t		reserved[496];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
>  struct logicalVolIntegrityDesc {
> @@ -346,7 +346,7 @@ struct logicalVolIntegrityDesc {
>  	__le32			freeSpaceTable[0];
>  	__le32			sizeTable[0];
>  	uint8_t			impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Integrity Type (ECMA 167r3 3/10.10.3) */
>  #define LVID_INTEGRITY_TYPE_OPEN	0x00000000
> @@ -356,7 +356,7 @@ struct logicalVolIntegrityDesc {
>  struct lb_addr {
>  	__le32		logicalBlockNum;
>  	__le16	 	partitionReferenceNum;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* ... and its in-core analog */
>  struct kernel_lb_addr {
> @@ -368,14 +368,14 @@ struct kernel_lb_addr {
>  struct short_ad {
>          __le32		extLength;
>          __le32		extPosition;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
>  struct long_ad {
>  	__le32		extLength;
>  	struct lb_addr	extLocation;
>  	uint8_t		impUse[6];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct kernel_long_ad {
>  	uint32_t		extLength;
> @@ -389,7 +389,7 @@ struct ext_ad {
>  	__le32		recordedLength;
>  	__le32		informationLength;
>  	struct lb_addr	extLocation;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct kernel_ext_ad {
>  	uint32_t		extLength;
> @@ -434,7 +434,7 @@ struct fileSetDesc {
>  	struct long_ad		nextExt;
>  	struct long_ad		streamDirectoryICB;
>  	uint8_t			reserved[32];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Partition Header Descriptor (ECMA 167r3 4/14.3) */
>  struct partitionHeaderDesc {
> @@ -444,7 +444,7 @@ struct partitionHeaderDesc {
>  	struct short_ad	freedSpaceTable;
>  	struct short_ad	freedSpaceBitmap;
>  	uint8_t		reserved[88];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* File Identifier Descriptor (ECMA 167r3 4/14.4) */
>  struct fileIdentDesc {
> @@ -457,7 +457,7 @@ struct fileIdentDesc {
>  	uint8_t		impUse[0];
>  	uint8_t		fileIdent[0];
>  	uint8_t		padding[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* File Characteristics (ECMA 167r3 4/14.4.3) */
>  #define FID_FILE_CHAR_HIDDEN		0x01
> @@ -471,7 +471,7 @@ struct allocExtDesc {
>  	struct tag	descTag;
>  	__le32		previousAllocExtLocation;
>  	__le32		lengthAllocDescs;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* ICB Tag (ECMA 167r3 4/14.6) */
>  struct icbtag {
> @@ -483,7 +483,7 @@ struct icbtag {
>  	uint8_t		fileType;
>  	struct lb_addr	parentICBLocation;
>  	__le16		flags;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Strategy Type (ECMA 167r3 4/14.6.2) */
>  #define ICBTAG_STRATEGY_TYPE_UNDEF	0x0000
> @@ -531,13 +531,13 @@ struct indirectEntry {
>  	struct tag	descTag;
>  	struct icbtag	icbTag;
>  	struct long_ad	indirectICB;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Terminal Entry (ECMA 167r3 4/14.8) */
>  struct terminalEntry {
>  	struct tag	descTag;
>  	struct icbtag	icbTag;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* File Entry (ECMA 167r3 4/14.9) */
>  struct fileEntry {
> @@ -563,7 +563,7 @@ struct fileEntry {
>  	__le32			lengthAllocDescs;
>  	uint8_t			extendedAttr[0];
>  	uint8_t			allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Permissions (ECMA 167r3 4/14.9.5) */
>  #define FE_PERM_O_EXEC			0x00000001U
> @@ -607,7 +607,7 @@ struct extendedAttrHeaderDesc {
>  	struct tag	descTag;
>  	__le32		impAttrLocation;
>  	__le32		appAttrLocation;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Generic Format (ECMA 167r3 4/14.10.2) */
>  struct genericFormat {
> @@ -616,7 +616,7 @@ struct genericFormat {
>  	uint8_t		reserved[3];
>  	__le32		attrLength;
>  	uint8_t		attrData[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Character Set Information (ECMA 167r3 4/14.10.3) */
>  struct charSetInfo {
> @@ -627,7 +627,7 @@ struct charSetInfo {
>  	__le32		escapeSeqLength;
>  	uint8_t		charSetType;
>  	uint8_t		escapeSeq[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Alternate Permissions (ECMA 167r3 4/14.10.4) */
>  struct altPerms {
> @@ -638,7 +638,7 @@ struct altPerms {
>  	__le16		ownerIdent;
>  	__le16		groupIdent;
>  	__le16		permission;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
>  struct fileTimesExtAttr {
> @@ -649,7 +649,7 @@ struct fileTimesExtAttr {
>  	__le32		dataLength;
>  	__le32		fileTimeExistence;
>  	uint8_t		fileTimes;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
>  #define FTE_CREATION			0x00000001
> @@ -666,7 +666,7 @@ struct infoTimesExtAttr {
>  	__le32		dataLength;
>  	__le32		infoTimeExistence;
>  	uint8_t		infoTimes[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Device Specification (ECMA 167r3 4/14.10.7) */
>  struct deviceSpec {
> @@ -678,7 +678,7 @@ struct deviceSpec {
>  	__le32		majorDeviceIdent;
>  	__le32		minorDeviceIdent;
>  	uint8_t		impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
>  struct impUseExtAttr {
> @@ -689,7 +689,7 @@ struct impUseExtAttr {
>  	__le32		impUseLength;
>  	struct regid	impIdent;
>  	uint8_t		impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
>  struct appUseExtAttr {
> @@ -700,7 +700,7 @@ struct appUseExtAttr {
>  	__le32		appUseLength;
>  	struct regid	appIdent;
>  	uint8_t		appUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  #define EXTATTR_CHAR_SET		1
>  #define EXTATTR_ALT_PERMS		3
> @@ -716,7 +716,7 @@ struct unallocSpaceEntry {
>  	struct icbtag	icbTag;
>  	__le32		lengthAllocDescs;
>  	uint8_t		allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
>  struct spaceBitmapDesc {
> @@ -724,7 +724,7 @@ struct spaceBitmapDesc {
>  	__le32		numOfBits;
>  	__le32		numOfBytes;
>  	uint8_t		bitmap[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Partition Integrity Entry (ECMA 167r3 4/14.13) */
>  struct partitionIntegrityEntry {
> @@ -735,7 +735,7 @@ struct partitionIntegrityEntry {
>  	uint8_t			reserved[175];
>  	struct regid		impIdent;
>  	uint8_t			impUse[256];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
>  
> @@ -753,7 +753,7 @@ struct partitionIntegrityEntry {
>  struct logicalVolHeaderDesc {
>  	__le64		uniqueID;
>  	uint8_t		reserved[24];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Path Component (ECMA 167r3 4/14.16.1) */
>  struct pathComponent {
> @@ -761,7 +761,7 @@ struct pathComponent {
>  	uint8_t		lengthComponentIdent;
>  	__le16		componentFileVersionNum;
>  	dstring		componentIdent[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* File Entry (ECMA 167r3 4/14.17) */
>  struct extendedFileEntry {
> @@ -791,6 +791,6 @@ struct extendedFileEntry {
>  	__le32			lengthAllocDescs;
>  	uint8_t			extendedAttr[0];
>  	uint8_t			allocDescs[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  #endif /* _ECMA_167_H */
> diff --git a/fs/udf/osta_udf.h b/fs/udf/osta_udf.h
> index fbff746..a4da59e 100644
> --- a/fs/udf/osta_udf.h
> +++ b/fs/udf/osta_udf.h
> @@ -70,17 +70,17 @@ struct UDFIdentSuffix {
>  	uint8_t		OSClass;
>  	uint8_t		OSIdentifier;
>  	uint8_t		reserved[4];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct impIdentSuffix {
>  	uint8_t		OSClass;
>  	uint8_t		OSIdentifier;
>  	uint8_t		reserved[6];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct appIdentSuffix {
>  	uint8_t		impUse[8];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */
>  /* Implementation Use (UDF 2.50 2.2.6.4) */
> @@ -92,7 +92,7 @@ struct logicalVolIntegrityDescImpUse {
>  	__le16		minUDFWriteRev;
>  	__le16		maxUDFWriteRev;
>  	uint8_t		impUse[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */
>  /* Implementation Use (UDF 2.50 2.2.7.2) */
> @@ -104,7 +104,7 @@ struct impUseVolDescImpUse {
>  	dstring		LVInfo3[36];
>  	struct regid	impIdent;
>  	uint8_t		impUse[128];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct udfPartitionMap2 {
>  	uint8_t		partitionMapType;
> @@ -113,7 +113,7 @@ struct udfPartitionMap2 {
>  	struct regid	partIdent;
>  	__le16		volSeqNum;
>  	__le16		partitionNum;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Virtual Partition Map (UDF 2.50 2.2.8) */
>  struct virtualPartitionMap {
> @@ -124,7 +124,7 @@ struct virtualPartitionMap {
>  	__le16		volSeqNum;
>  	__le16		partitionNum;
>  	uint8_t		reserved2[24];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Sparable Partition Map (UDF 2.50 2.2.9) */
>  struct sparablePartitionMap {
> @@ -139,7 +139,7 @@ struct sparablePartitionMap {
>  	uint8_t reserved2[1];
>  	__le32 sizeSparingTable;
>  	__le32 locSparingTable[4];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Metadata Partition Map (UDF 2.4.0 2.2.10) */
>  struct metadataPartitionMap {
> @@ -156,14 +156,14 @@ struct metadataPartitionMap {
>  	__le16		alignUnitSize;
>  	uint8_t		flags;
>  	uint8_t		reserved2[5];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Virtual Allocation Table (UDF 1.5 2.2.10) */
>  struct virtualAllocationTable15 {
>  	__le32		VirtualSector[0];
>  	struct regid	vatIdent;
>  	__le32		previousVATICBLoc;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  #define ICBTAG_FILE_TYPE_VAT15		0x00U
>  
> @@ -181,7 +181,7 @@ struct virtualAllocationTable20 {
>  	__le16		reserved;
>  	uint8_t		impUse[0];
>  	__le32		vatEntry[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  #define ICBTAG_FILE_TYPE_VAT20		0xF8U
>  
> @@ -189,7 +189,7 @@ struct virtualAllocationTable20 {
>  struct sparingEntry {
>  	__le32		origLocation;
>  	__le32		mappedLocation;
> -} __attribute__ ((packed));
> +} __packed;
>  
>  struct sparingTable {
>  	struct tag	descTag;
> @@ -199,7 +199,7 @@ struct sparingTable {
>  	__le32		sequenceNum;
>  	struct sparingEntry
>  			mapEntry[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */
>  #define ICBTAG_FILE_TYPE_MAIN		0xFA
> @@ -210,7 +210,7 @@ struct sparingTable {
>  struct allocDescImpUse {
>  	__le16		flags;
>  	uint8_t		impUse[4];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  #define AD_IU_EXT_ERASED		0x0001
>  
> @@ -222,7 +222,7 @@ struct allocDescImpUse {
>  struct freeEaSpace {
>  	__le16		headerChecksum;
>  	uint8_t		freeEASpace[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */
>  struct DVDCopyrightImpUse {
> @@ -230,14 +230,14 @@ struct DVDCopyrightImpUse {
>  	uint8_t		CGMSInfo;
>  	uint8_t		dataType;
>  	uint8_t		protectionSystemInfo[4];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */
>  /* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */
>  struct freeAppEASpace {
>  	__le16		headerChecksum;
>  	uint8_t		freeEASpace[0];
> -} __attribute__ ((packed));
> +} __packed;
>  
>  /* UDF Defined System Stream (UDF 2.50 3.3.7) */
>  #define UDF_ID_UNIQUE_ID		"*UDF Unique ID Mapping Data"
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument
  2017-01-06 20:53 ` [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument Fabian Frederick
@ 2017-01-10 10:33   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:33 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:50, Fabian Frederick wrote:
> Having struct kernel_long_ad laarr[EXTENT_MERGE_SIZE]
> in all function arguments could be understood as by-value parameter.
> Use kernel_long_ad pointer for functions depending on
> inode_getblk()
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Yeah, it is more obvious this way. OK. Applied.

								Honza

> ---
>  fs/udf/inode.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index bab40e7..4a7813b 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -57,14 +57,12 @@ static sector_t inode_getblk(struct inode *, sector_t, int *, int *);
>  static int8_t udf_insert_aext(struct inode *, struct extent_position,
>  			      struct kernel_lb_addr, uint32_t);
>  static void udf_split_extents(struct inode *, int *, int, int,
> -			      struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
> +			      struct kernel_long_ad *, int *);
>  static void udf_prealloc_extents(struct inode *, int, int,
> -				 struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
> -static void udf_merge_extents(struct inode *,
> -			      struct kernel_long_ad[EXTENT_MERGE_SIZE], int *);
> -static void udf_update_extents(struct inode *,
> -			       struct kernel_long_ad[EXTENT_MERGE_SIZE], int, int,
> -			       struct extent_position *);
> +				 struct kernel_long_ad *, int *);
> +static void udf_merge_extents(struct inode *, struct kernel_long_ad *, int *);
> +static void udf_update_extents(struct inode *, struct kernel_long_ad *, int,
> +			       int, struct extent_position *);
>  static int udf_get_block(struct inode *, sector_t, struct buffer_head *, int);
>  
>  static void __udf_clear_extent_cache(struct inode *inode)
> @@ -896,8 +894,7 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  }
>  
>  static void udf_split_extents(struct inode *inode, int *c, int offset,
> -			      int newblocknum,
> -			      struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
> +			      int newblocknum, struct kernel_long_ad *laarr,
>  			      int *endnum)
>  {
>  	unsigned long blocksize = inode->i_sb->s_blocksize;
> @@ -961,7 +958,7 @@ static void udf_split_extents(struct inode *inode, int *c, int offset,
>  }
>  
>  static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
> -				 struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
> +				 struct kernel_long_ad *laarr,
>  				 int *endnum)
>  {
>  	int start, length = 0, currlength = 0, i;
> @@ -1056,8 +1053,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  	}
>  }
>  
> -static void udf_merge_extents(struct inode *inode,
> -			      struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
> +static void udf_merge_extents(struct inode *inode, struct kernel_long_ad *laarr,
>  			      int *endnum)
>  {
>  	int i;
> @@ -1156,8 +1152,7 @@ static void udf_merge_extents(struct inode *inode,
>  	}
>  }
>  
> -static void udf_update_extents(struct inode *inode,
> -			       struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
> +static void udf_update_extents(struct inode *inode, struct kernel_long_ad *laarr,
>  			       int startnum, int endnum,
>  			       struct extent_position *epos)
>  {
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 03/12 linux-next] udf: merge bh free
  2017-01-06 20:53 ` [PATCH 03/12 linux-next] udf: merge bh free Fabian Frederick
@ 2017-01-10 10:36   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:36 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:51, Fabian Frederick wrote:
> Merge all bh free at one place.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/inode.c | 28 ++++++++++------------------
>  1 file changed, 10 insertions(+), 18 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 4a7813b..5cac1c3 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -745,11 +745,8 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  				 ~(inode->i_sb->s_blocksize - 1));
>  			udf_write_aext(inode, &cur_epos, &eloc, elen, 1);
>  		}
> -		brelse(prev_epos.bh);
> -		brelse(cur_epos.bh);
> -		brelse(next_epos.bh);
>  		newblock = udf_get_lb_pblock(inode->i_sb, &eloc, offset);
> -		return newblock;
> +		goto out_free;
>  	}
>  
>  	/* Are we beyond EOF? */
> @@ -772,11 +769,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  		/* Create extents for the hole between EOF and offset */
>  		ret = udf_do_extend_file(inode, &prev_epos, laarr, offset);
>  		if (ret < 0) {
> -			brelse(prev_epos.bh);
> -			brelse(cur_epos.bh);
> -			brelse(next_epos.bh);
>  			*err = ret;
> -			return 0;
> +			newblock = 0;
> +			goto out_free;
>  		}
>  		c = 0;
>  		offset = 0;
> @@ -839,11 +834,9 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  				iinfo->i_location.partitionReferenceNum,
>  				goal, err);
>  		if (!newblocknum) {
> -			brelse(prev_epos.bh);
> -			brelse(cur_epos.bh);
> -			brelse(next_epos.bh);
>  			*err = -ENOSPC;
> -			return 0;
> +			newblock = 0;
> +			goto out_free;
>  		}
>  		if (isBeyondEOF)
>  			iinfo->i_lenExtents += inode->i_sb->s_blocksize;
> @@ -870,15 +863,11 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  	 * the new number of extents is less than the old number */
>  	udf_update_extents(inode, laarr, startnum, endnum, &prev_epos);
>  
> -	brelse(prev_epos.bh);
> -	brelse(cur_epos.bh);
> -	brelse(next_epos.bh);
> -
>  	newblock = udf_get_pblock(inode->i_sb, newblocknum,
>  				iinfo->i_location.partitionReferenceNum, 0);
>  	if (!newblock) {
>  		*err = -EIO;
> -		return 0;
> +		goto out_free;
>  	}
>  	*new = 1;
>  	iinfo->i_next_alloc_block = block;
> @@ -889,7 +878,10 @@ static sector_t inode_getblk(struct inode *inode, sector_t block,
>  		udf_sync_inode(inode);
>  	else
>  		mark_inode_dirty(inode);
> -
> +out_free:
> +	brelse(prev_epos.bh);
> +	brelse(cur_epos.bh);
> +	brelse(next_epos.bh);
>  	return newblock;
>  }
>  
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 04/12 linux-next] udf: remove unneeded line break
  2017-01-06 20:53 ` [PATCH 04/12 linux-next] udf: remove unneeded line break Fabian Frederick
@ 2017-01-10 10:37   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:37 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:52, Fabian Frederick wrote:
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/inode.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 5cac1c3..b5893f4 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -2271,8 +2271,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
>  		  uint32_t *elen, sector_t *offset)
>  {
>  	unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
> -	loff_t lbcount = 0, bcount =
> -	    (loff_t) block << blocksize_bits;
> +	loff_t lbcount = 0, bcount = (loff_t) block << blocksize_bits;
>  	int8_t etype;
>  	struct udf_inode_info *iinfo;
>  
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 05/12 linux-next] udf: remove empty condition
  2017-01-06 20:53 ` [PATCH 05/12 linux-next] udf: remove empty condition Fabian Frederick
@ 2017-01-10 10:37   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:37 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:53, Fabian Frederick wrote:
> loc & 0x02 is empty since first git version in 2005 in
> udf_add_extendedattr()
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/misc.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/fs/udf/misc.c b/fs/udf/misc.c
> index 71d1c25..3949c4b 100644
> --- a/fs/udf/misc.c
> +++ b/fs/udf/misc.c
> @@ -141,8 +141,6 @@ struct genericFormat *udf_add_extendedattr(struct inode *inode, uint32_t size,
>  		iinfo->i_lenEAttr += size;
>  		return (struct genericFormat *)&ea[offset];
>  	}
> -	if (loc & 0x02)
> -		;
>  
>  	return NULL;
>  }
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 06/12 linux-next] udf: add udf_ajust_time
  2017-01-06 20:53 ` [PATCH 06/12 linux-next] udf: add udf_ajust_time Fabian Frederick
@ 2017-01-10 10:44   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:44 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:54, Fabian Frederick wrote:
> Merge timespec affectations
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. I've just renamed the function to udf_trim_crtime() which better
describes what it does.

								Honza

> ---
>  fs/udf/inode.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index b5893f4..f563e97 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -1612,6 +1612,14 @@ static int udf_sync_inode(struct inode *inode)
>  	return udf_update_inode(inode, 1);
>  }
>  
> +static void udf_adjust_time(struct udf_inode_info *iinfo, struct timespec time)
> +{
> +	if (iinfo->i_crtime.tv_sec > time.tv_sec ||
> +	    (iinfo->i_crtime.tv_sec == time.tv_sec &&
> +	     iinfo->i_crtime.tv_nsec > time.tv_nsec))
> +		iinfo->i_crtime = time;
> +}
> +
>  static int udf_update_inode(struct inode *inode, int do_sync)
>  {
>  	struct buffer_head *bh = NULL;
> @@ -1738,20 +1746,9 @@ static int udf_update_inode(struct inode *inode, int do_sync)
>  		efe->objectSize = cpu_to_le64(inode->i_size);
>  		efe->logicalBlocksRecorded = cpu_to_le64(lb_recorded);
>  
> -		if (iinfo->i_crtime.tv_sec > inode->i_atime.tv_sec ||
> -		    (iinfo->i_crtime.tv_sec == inode->i_atime.tv_sec &&
> -		     iinfo->i_crtime.tv_nsec > inode->i_atime.tv_nsec))
> -			iinfo->i_crtime = inode->i_atime;
> -
> -		if (iinfo->i_crtime.tv_sec > inode->i_mtime.tv_sec ||
> -		    (iinfo->i_crtime.tv_sec == inode->i_mtime.tv_sec &&
> -		     iinfo->i_crtime.tv_nsec > inode->i_mtime.tv_nsec))
> -			iinfo->i_crtime = inode->i_mtime;
> -
> -		if (iinfo->i_crtime.tv_sec > inode->i_ctime.tv_sec ||
> -		    (iinfo->i_crtime.tv_sec == inode->i_ctime.tv_sec &&
> -		     iinfo->i_crtime.tv_nsec > inode->i_ctime.tv_nsec))
> -			iinfo->i_crtime = inode->i_ctime;
> +		udf_adjust_time(iinfo, inode->i_atime);
> +		udf_adjust_time(iinfo, inode->i_mtime);
> +		udf_adjust_time(iinfo, inode->i_ctime);
>  
>  		udf_time_to_disk_stamp(&efe->accessTime, inode->i_atime);
>  		udf_time_to_disk_stamp(&efe->modificationTime, inode->i_mtime);
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents()
  2017-01-06 20:53 ` [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Fabian Frederick
@ 2017-01-10 10:53   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:53 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:55, Fabian Frederick wrote:
> recalculate offset if needed.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

IMHO not really worth it since numalloc gets updated and forgetting to
update the byte variant is just too easy. Skipped.

								Honza

> ---
>  fs/udf/inode.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index f563e97..66514ad 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -998,10 +998,10 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  				length : UDF_DEFAULT_PREALLOC_BLOCKS) -
>  				currlength);
>  		if (numalloc) 	{
> +			loff_t pos = numalloc << inode->i_sb->s_blocksize_bits;
> +
>  			if (start == (c + 1))
> -				laarr[start].extLength +=
> -					(numalloc <<
> -					 inode->i_sb->s_blocksize_bits);
> +				laarr[start].extLength += pos;
>  			else {
>  				memmove(&laarr[c + 2], &laarr[c + 1],
>  					sizeof(struct long_ad) * (*endnum - (c + 1)));
> @@ -1011,9 +1011,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					laarr[c].extLocation.
>  							partitionReferenceNum;
>  				laarr[c + 1].extLength =
> -					EXT_NOT_RECORDED_ALLOCATED |
> -					(numalloc <<
> -					 inode->i_sb->s_blocksize_bits);
> +					EXT_NOT_RECORDED_ALLOCATED | pos;
>  				start = c + 1;
>  			}
>  
> @@ -1024,12 +1022,12 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					    inode->i_sb->s_blocksize_bits;
>  
>  				if (elen > numalloc) {
> -					laarr[i].extLength -=
> -						(numalloc <<
> -						 inode->i_sb->s_blocksize_bits);
> -					numalloc = 0;
> +					laarr[i].extLength -= pos;
> +					numalloc = pos = 0;
>  				} else {
>  					numalloc -= elen;
> +					pos = numalloc <<
> +					      inode->i_sb->s_blocksize_bits;
>  					if (*endnum > (i + 1))
>  						memmove(&laarr[i],
>  							&laarr[i + 1],
> @@ -1039,8 +1037,7 @@ static void udf_prealloc_extents(struct inode *inode, int c, int lastblock,
>  					(*endnum)--;
>  				}
>  			}
> -			UDF_I(inode)->i_lenExtents +=
> -				numalloc << inode->i_sb->s_blocksize_bits;
> +			UDF_I(inode)->i_lenExtents += pos;
>  		}
>  	}
>  }
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache()
  2017-01-06 20:53 ` [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache() Fabian Frederick
@ 2017-01-10 10:55   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:55 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:56, Fabian Frederick wrote:
> udf_update_extent_cache() is only called from inode_bmap()
> with 1 for next_epos
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/inode.c | 23 +++++++++++------------
>  1 file changed, 11 insertions(+), 12 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 66514ad..2327f72 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -109,7 +109,7 @@ static int udf_read_extent_cache(struct inode *inode, loff_t bcount,
>  
>  /* Add extent to extent cache */
>  static void udf_update_extent_cache(struct inode *inode, loff_t estart,
> -				    struct extent_position *pos, int next_epos)
> +				    struct extent_position *pos)
>  {
>  	struct udf_inode_info *iinfo = UDF_I(inode);
>  
> @@ -121,16 +121,15 @@ static void udf_update_extent_cache(struct inode *inode, loff_t estart,
>  	memcpy(&iinfo->cached_extent.epos, pos,
>  	       sizeof(struct extent_position));
>  	iinfo->cached_extent.lstart = estart;
> -	if (next_epos)
> -		switch (iinfo->i_alloc_type) {
> -		case ICBTAG_FLAG_AD_SHORT:
> -			iinfo->cached_extent.epos.offset -=
> -			sizeof(struct short_ad);
> -			break;
> -		case ICBTAG_FLAG_AD_LONG:
> -			iinfo->cached_extent.epos.offset -=
> -			sizeof(struct long_ad);
> -		}
> +	switch (iinfo->i_alloc_type) {
> +	case ICBTAG_FLAG_AD_SHORT:
> +		iinfo->cached_extent.epos.offset -=
> +		sizeof(struct short_ad);
> +		break;
> +	case ICBTAG_FLAG_AD_LONG:
> +		iinfo->cached_extent.epos.offset -=
> +		sizeof(struct long_ad);
> +	}
>  	spin_unlock(&iinfo->i_extent_cache_lock);
>  }
>  
> @@ -2286,7 +2285,7 @@ int8_t inode_bmap(struct inode *inode, sector_t block,
>  		lbcount += *elen;
>  	} while (lbcount <= bcount);
>  	/* update extent cache */
> -	udf_update_extent_cache(inode, lbcount - *elen, pos, 1);
> +	udf_update_extent_cache(inode, lbcount - *elen, pos);
>  	*offset = (bcount + *elen - lbcount) >> blocksize_bits;
>  
>  	return etype;
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 09/12 linux-next] udf: merge module informations in super.c
  2017-01-06 20:53 ` [PATCH 09/12 linux-next] udf: merge module informations in super.c Fabian Frederick
@ 2017-01-10 10:55   ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:55 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:57, Fabian Frederick wrote:
> Move all module attributes at the end of one file like other FS.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/inode.c | 4 ----
>  fs/udf/super.c | 9 ++++++---
>  2 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 2327f72..47638eb 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -43,10 +43,6 @@
>  #include "udf_i.h"
>  #include "udf_sb.h"
>  
> -MODULE_AUTHOR("Ben Fennema");
> -MODULE_DESCRIPTION("Universal Disk Format Filesystem");
> -MODULE_LICENSE("GPL");
> -
>  #define EXTENT_MERGE_SIZE 5
>  
>  static umode_t udf_convert_permissions(struct fileEntry *);
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 967ad87..9256117 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -264,9 +264,6 @@ static void __exit exit_udf_fs(void)
>  	destroy_inodecache();
>  }
>  
> -module_init(init_udf_fs)
> -module_exit(exit_udf_fs)
> -
>  static int udf_sb_alloc_partition_maps(struct super_block *sb, u32 count)
>  {
>  	struct udf_sb_info *sbi = UDF_SB(sb);
> @@ -2500,3 +2497,9 @@ static unsigned int udf_count_free(struct super_block *sb)
>  
>  	return accum;
>  }
> +
> +MODULE_AUTHOR("Ben Fennema");
> +MODULE_DESCRIPTION("Universal Disk Format Filesystem");
> +MODULE_LICENSE("GPL");
> +module_init(init_udf_fs)
> +module_exit(exit_udf_fs)
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 10/12 linux-next] udf: atomically read inode size
  2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
  2017-01-06 20:54   ` [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0 Fabian Frederick
  2017-01-06 20:54   ` [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode() Fabian Frederick
@ 2017-01-10 10:57   ` Jan Kara
  2 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:57 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:54:41, Fabian Frederick wrote:
> See i_size_read() comments in include/linux/fs.h
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Applied. Thanks!

								Honza

> ---
>  fs/udf/lowlevel.c | 2 +-
>  fs/udf/super.c    | 7 ++++---
>  2 files changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/udf/lowlevel.c b/fs/udf/lowlevel.c
> index 6ad5a45..5c7ec12 100644
> --- a/fs/udf/lowlevel.c
> +++ b/fs/udf/lowlevel.c
> @@ -58,7 +58,7 @@ unsigned long udf_get_last_block(struct super_block *sb)
>  	 */
>  	if (ioctl_by_bdev(bdev, CDROM_LAST_WRITTEN, (unsigned long) &lblock) ||
>  	    lblock == 0)
> -		lblock = bdev->bd_inode->i_size >> sb->s_blocksize_bits;
> +		lblock = i_size_read(bdev->bd_inode) >> sb->s_blocksize_bits;
>  
>  	if (lblock)
>  		return lblock - 1;
> diff --git a/fs/udf/super.c b/fs/udf/super.c
> index 9256117..6b5a1a4 100644
> --- a/fs/udf/super.c
> +++ b/fs/udf/super.c
> @@ -1213,7 +1213,8 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
>  	struct udf_inode_info *vati;
>  	uint32_t pos;
>  	struct virtualAllocationTable20 *vat20;
> -	sector_t blocks = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
> +	sector_t blocks = i_size_read(sb->s_bdev->bd_inode) >>
> +			  sb->s_blocksize_bits;
>  
>  	udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block);
>  	if (!sbi->s_vat_inode &&
> @@ -1803,7 +1804,7 @@ static int udf_check_anchor_block(struct super_block *sb, sector_t block,
>  
>  	if (UDF_QUERY_FLAG(sb, UDF_FLAG_VARCONV) &&
>  	    udf_fixed_to_variable(block) >=
> -	    sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits)
> +	    i_size_read(sb->s_bdev->bd_inode) >> sb->s_blocksize_bits)
>  		return -EAGAIN;
>  
>  	bh = udf_read_tagged(sb, block, block, &ident);
> @@ -1865,7 +1866,7 @@ static int udf_scan_anchors(struct super_block *sb, sector_t *lastblock,
>  		last[last_count++] = *lastblock - 152;
>  
>  	for (i = 0; i < last_count; i++) {
> -		if (last[i] >= sb->s_bdev->bd_inode->i_size >>
> +		if (last[i] >= i_size_read(sb->s_bdev->bd_inode) >>
>  				sb->s_blocksize_bits)
>  			continue;
>  		ret = udf_check_anchor_block(sb, last[i], fileset);
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode()
  2017-01-06 20:54   ` [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode() Fabian Frederick
@ 2017-01-10 10:59     ` Jan Kara
  0 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 10:59 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:54:43, Fabian Frederick wrote:
> We were checking block number without checking partition.
> sbi->s_partmaps[iloc->partitionReferenceNum] could lead to
> bad memory access. See udf_nfs_get_inode() path for instance.
> 
> Signed-off-by: Fabian Frederick <fabf@skynet.be>

Thanks. Applied.

								Honza

> ---
>  fs/udf/inode.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/fs/udf/inode.c b/fs/udf/inode.c
> index 47638eb..3926973 100644
> --- a/fs/udf/inode.c
> +++ b/fs/udf/inode.c
> @@ -1276,6 +1276,12 @@ static int udf_read_inode(struct inode *inode, bool hidden_inode)
>  	int ret = -EIO;
>  
>  reread:
> +	if (iloc->partitionReferenceNum >= sbi->s_partitions) {
> +		udf_debug("partition reference: %d > logical volume partitions: %d\n",
> +			  iloc->partitionReferenceNum, sbi->s_partitions);
> +		return -EIO;
> +	}
> +
>  	if (iloc->logicalBlockNum >=
>  	    sbi->s_partmaps[iloc->partitionReferenceNum].s_partition_len) {
>  		udf_debug("block=%d, partition=%d out of range\n",
> -- 
> 2.7.4
> 
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH 00/12 linux-next] udf: clean-up
  2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
                   ` (9 preceding siblings ...)
  2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
@ 2017-01-10 11:00 ` Jan Kara
  10 siblings, 0 replies; 25+ messages in thread
From: Jan Kara @ 2017-01-10 11:00 UTC (permalink / raw)
  To: Fabian Frederick; +Cc: Jan Kara, linux-kernel, linux-fsdevel

On Fri 06-01-17 21:53:48, Fabian Frederick wrote:
> This small patchset does some clean-up in UDF branch
> 
> Fabian Frederick (12):
>   udf: use __packed instead of __attribute__ ((packed))
>   udf: use pointer for kernel_long_ad argument
>   udf: merge bh free
>   udf: remove unneeded line break
>   udf: remove empty condition
>   udf: add udf_ajust_time
>   udf: store allocation offset in udf_prealloc_extents()
>   udf: remove next_epos from udf_update_extent_cache()
>   udf: merge module informations in super.c
>   udf: atomically read inode size
>   udf: replace 0xFFFFFFFF by ~0
>   udf: check partition reference in udf_read_inode()

I did not get patch 11/12. Can you please resend that one? Thanks!

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2017-01-10 11:00 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-06 20:53 [PATCH 00/12 linux-next] udf: clean-up Fabian Frederick
2017-01-06 20:53 ` [PATCH 01/12 linux-next] udf: use __packed instead of __attribute__ ((packed)) Fabian Frederick
2017-01-10 10:29   ` Jan Kara
2017-01-06 20:53 ` [PATCH 02/12 linux-next] udf: use pointer for kernel_long_ad argument Fabian Frederick
2017-01-10 10:33   ` Jan Kara
2017-01-06 20:53 ` [PATCH 03/12 linux-next] udf: merge bh free Fabian Frederick
2017-01-10 10:36   ` Jan Kara
2017-01-06 20:53 ` [PATCH 04/12 linux-next] udf: remove unneeded line break Fabian Frederick
2017-01-10 10:37   ` Jan Kara
2017-01-06 20:53 ` [PATCH 05/12 linux-next] udf: remove empty condition Fabian Frederick
2017-01-10 10:37   ` Jan Kara
2017-01-06 20:53 ` [PATCH 06/12 linux-next] udf: add udf_ajust_time Fabian Frederick
2017-01-10 10:44   ` Jan Kara
2017-01-06 20:53 ` [PATCH 07/12 linux-next] udf: store allocation offset in udf_prealloc_extents() Fabian Frederick
2017-01-10 10:53   ` Jan Kara
2017-01-06 20:53 ` [PATCH 08/12 linux-next] udf: remove next_epos from udf_update_extent_cache() Fabian Frederick
2017-01-10 10:55   ` Jan Kara
2017-01-06 20:53 ` [PATCH 09/12 linux-next] udf: merge module informations in super.c Fabian Frederick
2017-01-10 10:55   ` Jan Kara
2017-01-06 20:54 ` [PATCH 10/12 linux-next] udf: atomically read inode size Fabian Frederick
2017-01-06 20:54   ` [PATCH 11/12 linux-next] udf: replace 0xFFFFFFFF by ~0 Fabian Frederick
2017-01-06 20:54   ` [PATCH 12/12 linux-next] udf: check partition reference in udf_read_inode() Fabian Frederick
2017-01-10 10:59     ` Jan Kara
2017-01-10 10:57   ` [PATCH 10/12 linux-next] udf: atomically read inode size Jan Kara
2017-01-10 11:00 ` [PATCH 00/12 linux-next] udf: clean-up Jan Kara

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.