Commit 8f299acd authored by Nathan Scott's avatar Nathan Scott Committed by Nathan Scott

[XFS] Remove the 128K limitation on pagebuf_get_no_daddr() and allow

the kmem_alloc() to fail.

SGI Modid: xfs-linux:xfs-kern:171201a
parent 94234dda
......@@ -52,6 +52,7 @@
#define KM_SLEEP 0x0001
#define KM_NOSLEEP 0x0002
#define KM_NOFS 0x0004
#define KM_MAYFAIL 0x0005
typedef unsigned long xfs_pflags_t;
......@@ -78,29 +79,32 @@ typedef unsigned long xfs_pflags_t;
*(NSTATEP) = *(OSTATEP); \
} while (0)
/*
* XXX get rid of the unconditional __GFP_NOFAIL by adding
* a KM_FAIL flag and using it where we're allowed to fail.
*/
static __inline unsigned int
kmem_flags_convert(int flags)
{
int lflags;
#if DEBUG
if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS))) {
if (unlikely(flags & ~(KM_SLEEP|KM_NOSLEEP|KM_NOFS|KM_MAYFAIL))) {
printk(KERN_WARNING
"XFS: memory allocation with wrong flags (%x)\n", flags);
BUG();
}
#endif
lflags = (flags & KM_NOSLEEP) ? GFP_ATOMIC : (GFP_KERNEL|__GFP_NOFAIL);
if (flags & KM_NOSLEEP) {
lflags = GFP_ATOMIC;
} else {
lflags = GFP_KERNEL;
/* avoid recusive callbacks to filesystem during transactions */
if (PFLAGS_TEST_FSTRANS() || (flags & KM_NOFS))
lflags &= ~__GFP_FS;
if (!(flags & KM_MAYFAIL))
lflags |= __GFP_NOFAIL;
}
return lflags;
}
......
......@@ -812,16 +812,13 @@ pagebuf_get_no_daddr(
void *data;
int error;
if (unlikely(len > 0x20000))
goto fail;
bp = pagebuf_allocate(0);
if (unlikely(bp == NULL))
goto fail;
_pagebuf_initialize(bp, target, 0, len, PBF_FORCEIO);
try_again:
data = kmem_alloc(malloc_len, KM_SLEEP);
data = kmem_alloc(malloc_len, KM_SLEEP | KM_MAYFAIL);
if (unlikely(data == NULL))
goto fail_free_buf;
......
......@@ -497,7 +497,7 @@ xfs_log_mount(xfs_mount_t *mp,
if (readonly)
vfsp->vfs_flag |= VFS_RDONLY;
if (error) {
cmn_err(CE_WARN, "XFS: log mount/recovery failed");
cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
xlog_unalloc_log(mp->m_log);
return error;
}
......
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