Skip to content

Commit 87c9172

Browse files
committed
Merge tag 'jfs-3.20' of git://github.com/kleikamp/linux-shaggy
Pull jfs updates from David Kleikamp: "A couple cleanups for jfs" * tag 'jfs-3.20' of git://github.com/kleikamp/linux-shaggy: jfs: Deletion of an unnecessary check before the function call "unload_nls" jfs: get rid of homegrown endianness helpers
2 parents 6184514 + 648695c commit 87c9172

File tree

5 files changed

+45
-91
lines changed

5 files changed

+45
-91
lines changed

fs/jfs/endian24.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

fs/jfs/jfs_dtree.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,8 +1040,8 @@ static int dtSplitUp(tid_t tid,
10401040
pxdlist.maxnpxd = 1;
10411041
pxdlist.npxd = 0;
10421042
pxd = &pxdlist.pxd[0];
1043-
PXDaddress(pxd, nxaddr)
1044-
PXDlength(pxd, xlen + n);
1043+
PXDaddress(pxd, nxaddr);
1044+
PXDlength(pxd, xlen + n);
10451045
split->pxdlist = &pxdlist;
10461046
if ((rc = dtExtendPage(tid, ip, split, btstack))) {
10471047
nxaddr = addressPXD(pxd);

fs/jfs/jfs_types.h

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
#include <linux/types.h>
3131
#include <linux/nls.h>
3232

33-
#include "endian24.h"
34-
3533
/*
3634
* transaction and lock id's
3735
*
@@ -59,26 +57,42 @@ struct timestruc_t {
5957

6058
/*
6159
* physical xd (pxd)
60+
*
61+
* The leftmost 24 bits of len_addr are the extent length.
62+
* The rightmost 8 bits of len_addr are the most signficant bits of
63+
* the extent address
6264
*/
6365
typedef struct {
64-
unsigned len:24;
65-
unsigned addr1:8;
66+
__le32 len_addr;
6667
__le32 addr2;
6768
} pxd_t;
6869

6970
/* xd_t field construction */
7071

71-
#define PXDlength(pxd, length32) ((pxd)->len = __cpu_to_le24(length32))
72-
#define PXDaddress(pxd, address64)\
73-
{\
74-
(pxd)->addr1 = ((s64)address64) >> 32;\
75-
(pxd)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
72+
static inline void PXDlength(pxd_t *pxd, __u32 len)
73+
{
74+
pxd->len_addr = (pxd->len_addr & cpu_to_le32(~0xffffff)) |
75+
cpu_to_le32(len & 0xffffff);
76+
}
77+
78+
static inline void PXDaddress(pxd_t *pxd, __u64 addr)
79+
{
80+
pxd->len_addr = (pxd->len_addr & cpu_to_le32(0xffffff)) |
81+
cpu_to_le32((addr >> 32)<<24);
82+
pxd->addr2 = cpu_to_le32(addr & 0xffffffff);
7683
}
7784

7885
/* xd_t field extraction */
79-
#define lengthPXD(pxd) __le24_to_cpu((pxd)->len)
80-
#define addressPXD(pxd)\
81-
( ((s64)((pxd)->addr1)) << 32 | __le32_to_cpu((pxd)->addr2))
86+
static inline __u32 lengthPXD(pxd_t *pxd)
87+
{
88+
return le32_to_cpu((pxd)->len_addr) & 0xffffff;
89+
}
90+
91+
static inline __u64 addressPXD(pxd_t *pxd)
92+
{
93+
__u64 n = le32_to_cpu(pxd->len_addr) & ~0xffffff;
94+
return (n << 8) + le32_to_cpu(pxd->addr2);
95+
}
8296

8397
#define MAXTREEHEIGHT 8
8498
/* pxd list */
@@ -93,12 +107,10 @@ struct pxdlist {
93107
* data extent descriptor (dxd)
94108
*/
95109
typedef struct {
96-
unsigned flag:8; /* 1: flags */
97-
unsigned rsrvd:24;
110+
__u8 flag; /* 1: flags */
111+
__u8 rsrvd[3];
98112
__le32 size; /* 4: size in byte */
99-
unsigned len:24; /* 3: length in unit of fsblksize */
100-
unsigned addr1:8; /* 1: address in unit of fsblksize */
101-
__le32 addr2; /* 4: address in unit of fsblksize */
113+
pxd_t loc; /* 8: address and length in unit of fsblksize */
102114
} dxd_t; /* - 16 - */
103115

104116
/* dxd_t flags */
@@ -109,12 +121,11 @@ typedef struct {
109121
#define DXD_CORRUPT 0x08 /* Inconsistency detected */
110122

111123
/* dxd_t field construction
112-
* Conveniently, the PXD macros work for DXD
113124
*/
114-
#define DXDlength PXDlength
115-
#define DXDaddress PXDaddress
116-
#define lengthDXD lengthPXD
117-
#define addressDXD addressPXD
125+
#define DXDlength(dxd, len) PXDlength(&(dxd)->loc, len)
126+
#define DXDaddress(dxd, addr) PXDaddress(&(dxd)->loc, addr)
127+
#define lengthDXD(dxd) lengthPXD(&(dxd)->loc)
128+
#define addressDXD(dxd) addressPXD(&(dxd)->loc)
118129
#define DXDsize(dxd, size32) ((dxd)->size = cpu_to_le32(size32))
119130
#define sizeDXD(dxd) le32_to_cpu((dxd)->size)
120131

fs/jfs/jfs_xtree.h

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,11 @@
2929
* extent allocation descriptor (xad)
3030
*/
3131
typedef struct xad {
32-
unsigned flag:8; /* 1: flag */
33-
unsigned rsvrd:16; /* 2: reserved */
34-
unsigned off1:8; /* 1: offset in unit of fsblksize */
35-
__le32 off2; /* 4: offset in unit of fsblksize */
36-
unsigned len:24; /* 3: length in unit of fsblksize */
37-
unsigned addr1:8; /* 1: address in unit of fsblksize */
38-
__le32 addr2; /* 4: address in unit of fsblksize */
32+
__u8 flag; /* 1: flag */
33+
__u8 rsvrd[2]; /* 2: reserved */
34+
__u8 off1; /* 1: offset in unit of fsblksize */
35+
__le32 off2; /* 4: offset in unit of fsblksize */
36+
pxd_t loc; /* 8: length and address in unit of fsblksize */
3937
} xad_t; /* (16) */
4038

4139
#define MAXXLEN ((1 << 24) - 1)
@@ -49,19 +47,14 @@ typedef struct xad {
4947
(xad)->off1 = ((u64)offset64) >> 32;\
5048
(xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\
5149
}
52-
#define XADaddress(xad, address64)\
53-
{\
54-
(xad)->addr1 = ((u64)address64) >> 32;\
55-
(xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
56-
}
57-
#define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32)
50+
#define XADaddress(xad, address64) PXDaddress(&(xad)->loc, address64)
51+
#define XADlength(xad, length32) PXDlength(&(xad)->loc, length32)
5852

5953
/* xad_t field extraction */
6054
#define offsetXAD(xad)\
6155
( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2))
62-
#define addressXAD(xad)\
63-
( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2))
64-
#define lengthXAD(xad) __le24_to_cpu((xad)->len)
56+
#define addressXAD(xad) addressPXD(&(xad)->loc)
57+
#define lengthXAD(xad) lengthPXD(&(xad)->loc)
6558

6659
/* xad list */
6760
struct xadlist {

fs/jfs/super.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
619619
iput(sbi->direct_inode);
620620
sbi->direct_inode = NULL;
621621
out_unload:
622-
if (sbi->nls_tab)
623-
unload_nls(sbi->nls_tab);
622+
unload_nls(sbi->nls_tab);
624623
out_kfree:
625624
kfree(sbi);
626625
return ret;

0 commit comments

Comments
 (0)