Commit 87c9172f authored by Linus Torvalds's avatar Linus Torvalds

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
parents 61845143 648695c7
/*
* Copyright (C) International Business Machines Corp., 2001
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _H_ENDIAN24
#define _H_ENDIAN24
/*
* endian24.h:
*
* Endian conversion for 24-byte data
*
*/
#define __swab24(x) \
({ \
__u32 __x = (x); \
((__u32)( \
((__x & (__u32)0x000000ffUL) << 16) | \
(__x & (__u32)0x0000ff00UL) | \
((__x & (__u32)0x00ff0000UL) >> 16) )); \
})
#if (defined(__KERNEL__) && defined(__LITTLE_ENDIAN)) || (defined(__BYTE_ORDER) && (__BYTE_ORDER == __LITTLE_ENDIAN))
#define __cpu_to_le24(x) ((__u32)(x))
#define __le24_to_cpu(x) ((__u32)(x))
#else
#define __cpu_to_le24(x) __swab24(x)
#define __le24_to_cpu(x) __swab24(x)
#endif
#ifdef __KERNEL__
#define cpu_to_le24 __cpu_to_le24
#define le24_to_cpu __le24_to_cpu
#endif
#endif /* !_H_ENDIAN24 */
...@@ -1040,8 +1040,8 @@ static int dtSplitUp(tid_t tid, ...@@ -1040,8 +1040,8 @@ static int dtSplitUp(tid_t tid,
pxdlist.maxnpxd = 1; pxdlist.maxnpxd = 1;
pxdlist.npxd = 0; pxdlist.npxd = 0;
pxd = &pxdlist.pxd[0]; pxd = &pxdlist.pxd[0];
PXDaddress(pxd, nxaddr) PXDaddress(pxd, nxaddr);
PXDlength(pxd, xlen + n); PXDlength(pxd, xlen + n);
split->pxdlist = &pxdlist; split->pxdlist = &pxdlist;
if ((rc = dtExtendPage(tid, ip, split, btstack))) { if ((rc = dtExtendPage(tid, ip, split, btstack))) {
nxaddr = addressPXD(pxd); nxaddr = addressPXD(pxd);
......
...@@ -30,8 +30,6 @@ ...@@ -30,8 +30,6 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/nls.h> #include <linux/nls.h>
#include "endian24.h"
/* /*
* transaction and lock id's * transaction and lock id's
* *
...@@ -59,26 +57,42 @@ struct timestruc_t { ...@@ -59,26 +57,42 @@ struct timestruc_t {
/* /*
* physical xd (pxd) * physical xd (pxd)
*
* The leftmost 24 bits of len_addr are the extent length.
* The rightmost 8 bits of len_addr are the most signficant bits of
* the extent address
*/ */
typedef struct { typedef struct {
unsigned len:24; __le32 len_addr;
unsigned addr1:8;
__le32 addr2; __le32 addr2;
} pxd_t; } pxd_t;
/* xd_t field construction */ /* xd_t field construction */
#define PXDlength(pxd, length32) ((pxd)->len = __cpu_to_le24(length32)) static inline void PXDlength(pxd_t *pxd, __u32 len)
#define PXDaddress(pxd, address64)\ {
{\ pxd->len_addr = (pxd->len_addr & cpu_to_le32(~0xffffff)) |
(pxd)->addr1 = ((s64)address64) >> 32;\ cpu_to_le32(len & 0xffffff);
(pxd)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\ }
static inline void PXDaddress(pxd_t *pxd, __u64 addr)
{
pxd->len_addr = (pxd->len_addr & cpu_to_le32(0xffffff)) |
cpu_to_le32((addr >> 32)<<24);
pxd->addr2 = cpu_to_le32(addr & 0xffffffff);
} }
/* xd_t field extraction */ /* xd_t field extraction */
#define lengthPXD(pxd) __le24_to_cpu((pxd)->len) static inline __u32 lengthPXD(pxd_t *pxd)
#define addressPXD(pxd)\ {
( ((s64)((pxd)->addr1)) << 32 | __le32_to_cpu((pxd)->addr2)) return le32_to_cpu((pxd)->len_addr) & 0xffffff;
}
static inline __u64 addressPXD(pxd_t *pxd)
{
__u64 n = le32_to_cpu(pxd->len_addr) & ~0xffffff;
return (n << 8) + le32_to_cpu(pxd->addr2);
}
#define MAXTREEHEIGHT 8 #define MAXTREEHEIGHT 8
/* pxd list */ /* pxd list */
...@@ -93,12 +107,10 @@ struct pxdlist { ...@@ -93,12 +107,10 @@ struct pxdlist {
* data extent descriptor (dxd) * data extent descriptor (dxd)
*/ */
typedef struct { typedef struct {
unsigned flag:8; /* 1: flags */ __u8 flag; /* 1: flags */
unsigned rsrvd:24; __u8 rsrvd[3];
__le32 size; /* 4: size in byte */ __le32 size; /* 4: size in byte */
unsigned len:24; /* 3: length in unit of fsblksize */ pxd_t loc; /* 8: address and length in unit of fsblksize */
unsigned addr1:8; /* 1: address in unit of fsblksize */
__le32 addr2; /* 4: address in unit of fsblksize */
} dxd_t; /* - 16 - */ } dxd_t; /* - 16 - */
/* dxd_t flags */ /* dxd_t flags */
...@@ -109,12 +121,11 @@ typedef struct { ...@@ -109,12 +121,11 @@ typedef struct {
#define DXD_CORRUPT 0x08 /* Inconsistency detected */ #define DXD_CORRUPT 0x08 /* Inconsistency detected */
/* dxd_t field construction /* dxd_t field construction
* Conveniently, the PXD macros work for DXD
*/ */
#define DXDlength PXDlength #define DXDlength(dxd, len) PXDlength(&(dxd)->loc, len)
#define DXDaddress PXDaddress #define DXDaddress(dxd, addr) PXDaddress(&(dxd)->loc, addr)
#define lengthDXD lengthPXD #define lengthDXD(dxd) lengthPXD(&(dxd)->loc)
#define addressDXD addressPXD #define addressDXD(dxd) addressPXD(&(dxd)->loc)
#define DXDsize(dxd, size32) ((dxd)->size = cpu_to_le32(size32)) #define DXDsize(dxd, size32) ((dxd)->size = cpu_to_le32(size32))
#define sizeDXD(dxd) le32_to_cpu((dxd)->size) #define sizeDXD(dxd) le32_to_cpu((dxd)->size)
......
...@@ -29,13 +29,11 @@ ...@@ -29,13 +29,11 @@
* extent allocation descriptor (xad) * extent allocation descriptor (xad)
*/ */
typedef struct xad { typedef struct xad {
unsigned flag:8; /* 1: flag */ __u8 flag; /* 1: flag */
unsigned rsvrd:16; /* 2: reserved */ __u8 rsvrd[2]; /* 2: reserved */
unsigned off1:8; /* 1: offset in unit of fsblksize */ __u8 off1; /* 1: offset in unit of fsblksize */
__le32 off2; /* 4: offset in unit of fsblksize */ __le32 off2; /* 4: offset in unit of fsblksize */
unsigned len:24; /* 3: length in unit of fsblksize */ pxd_t loc; /* 8: length and address in unit of fsblksize */
unsigned addr1:8; /* 1: address in unit of fsblksize */
__le32 addr2; /* 4: address in unit of fsblksize */
} xad_t; /* (16) */ } xad_t; /* (16) */
#define MAXXLEN ((1 << 24) - 1) #define MAXXLEN ((1 << 24) - 1)
...@@ -49,19 +47,14 @@ typedef struct xad { ...@@ -49,19 +47,14 @@ typedef struct xad {
(xad)->off1 = ((u64)offset64) >> 32;\ (xad)->off1 = ((u64)offset64) >> 32;\
(xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\ (xad)->off2 = __cpu_to_le32((offset64) & 0xffffffff);\
} }
#define XADaddress(xad, address64)\ #define XADaddress(xad, address64) PXDaddress(&(xad)->loc, address64)
{\ #define XADlength(xad, length32) PXDlength(&(xad)->loc, length32)
(xad)->addr1 = ((u64)address64) >> 32;\
(xad)->addr2 = __cpu_to_le32((address64) & 0xffffffff);\
}
#define XADlength(xad, length32) (xad)->len = __cpu_to_le24(length32)
/* xad_t field extraction */ /* xad_t field extraction */
#define offsetXAD(xad)\ #define offsetXAD(xad)\
( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2)) ( ((s64)((xad)->off1)) << 32 | __le32_to_cpu((xad)->off2))
#define addressXAD(xad)\ #define addressXAD(xad) addressPXD(&(xad)->loc)
( ((s64)((xad)->addr1)) << 32 | __le32_to_cpu((xad)->addr2)) #define lengthXAD(xad) lengthPXD(&(xad)->loc)
#define lengthXAD(xad) __le24_to_cpu((xad)->len)
/* xad list */ /* xad list */
struct xadlist { struct xadlist {
......
...@@ -619,8 +619,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent) ...@@ -619,8 +619,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
iput(sbi->direct_inode); iput(sbi->direct_inode);
sbi->direct_inode = NULL; sbi->direct_inode = NULL;
out_unload: out_unload:
if (sbi->nls_tab) unload_nls(sbi->nls_tab);
unload_nls(sbi->nls_tab);
out_kfree: out_kfree:
kfree(sbi); kfree(sbi);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment