Skip to content

Instantly share code, notes, and snippets.

@phstudy
Created October 6, 2018 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phstudy/8143451159a4ab3bf9183f8db0aeda14 to your computer and use it in GitHub Desktop.
Save phstudy/8143451159a4ab3bf9183f8db0aeda14 to your computer and use it in GitHub Desktop.
Patch for Paragon NTFS & HFS+ for Linux 9.5 to support Kernel 4.15.x
diff --git a/ifslinux/ufsdjnl.c b/ifslinux/ufsdjnl.c
index f3e55bc..bcbeef5 100644
--- a/ifslinux/ufsdjnl.c
+++ b/ifslinux/ufsdjnl.c
@@ -1403,7 +1403,7 @@ jnl_alloc(
BUG_ON( size & ( size-1 ) ); // Must be a power of 2
- flags |= __GFP_REPEAT;
+ flags |= __GFP_RETRY_MAYFAIL;
if ( PAGE_SIZE == size )
ptr = (void*)__get_free_pages( flags, 0 );
else if ( size > PAGE_SIZE ) {
@@ -3202,12 +3202,12 @@ repeat:
jnl_unlock_bh_state( bh );
// commit wakes up all shadow buffers after IO
for ( ; ; ) {
- prepare_to_wait( wqh, &wait.wait, TASK_UNINTERRUPTIBLE );
+ prepare_to_wait( wqh, &wait.wq_entry, TASK_UNINTERRUPTIBLE );
if ( BJ_Shadow != jh->jlist )
break;
schedule();
}
- finish_wait( wqh, &wait.wait );
+ finish_wait( wqh, &wait.wq_entry );
jnl_debug( JNL_TRACE_LEVEL_ACCESS|JNL_TRACE_LEVEL_COMMIT, "b=%"PSCT"x on shadow: wake\n", blocknr );
goto repeat;
}
@@ -5717,7 +5717,7 @@ restart_loop:
//
// Helper function used to manage commit timeouts
///////////////////////////////////////////////////////////
-static void commit_timeout( unsigned long data )
+static void commit_timeout( struct timer_list *data )
{
struct task_struct *p = (struct task_struct*)data;
wake_up_process( p );
@@ -5751,7 +5751,7 @@ jnl_thread(
//
// Set up an interval timer which can be used to trigger a commit wakeup after the commit interval expires
//
- setup_timer( &j->commit_timer, commit_timeout, (unsigned long)current );
+ timer_setup( &j->commit_timer, commit_timeout, 0 );
set_freezable();
@@ -6271,8 +6271,8 @@ bio_batch_end_io(
{
struct bio_batch *bb = bio->bi_private;
- if ( bio->bi_error && (bio->bi_error != -EOPNOTSUPP) )
- bb->error = bio->bi_error;
+ if ( bio->bi_status && (bio->bi_status != -EOPNOTSUPP) )
+ bb->error = bio->bi_status;
if ( atomic_dec_and_test( &bb->done ) )
complete( bb->wait );
bio_put( bio );
@@ -6318,8 +6318,7 @@ __blkdev_issue_fill_1(
#else
bio->bi_sector = sector;
#endif
-
- bio->bi_bdev = bdev;
+ bio_set_dev(bio, bdev);
bio->bi_end_io = bio_batch_end_io;
bio->bi_private = &bb;
diff --git a/ifslinux/ufsdvfs.c b/ifslinux/ufsdvfs.c
index a89d0e6..b47cb5c 100644
--- a/ifslinux/ufsdvfs.c
+++ b/ifslinux/ufsdvfs.c
@@ -1776,8 +1776,8 @@ ufsd_bd_read_ahead(
unsigned long nr_pages, nr_anon, nr_free, max_ra;
struct blk_plug plug;
- nr_anon = global_page_state( NR_ACTIVE_ANON );
- nr_free = global_page_state( NR_FREE_PAGES );
+ nr_anon = global_zone_page_state( NR_ACTIVE_ANON );
+ nr_free = global_zone_page_state( NR_FREE_PAGES );
max_ra = ( nr_anon + nr_free ) >> 1;
if ( 0 != sbi->options.raKb ) {
@@ -1824,7 +1824,7 @@ ufsd_bd_read_ahead(
#if is_decl( PAGE_CACHE_ALLOC_READAHEAD )
page = page_cache_alloc_readahead( mapping );
#else
- page = page_cache_alloc_cold( mapping );
+ page = page_cache_alloc( mapping );
#endif
if ( NULL == page )
break;
@@ -1885,7 +1885,7 @@ ufsd_bd_unmap_meta(
sector_t devblock = offset >> sb->s_blocksize_bits;
unsigned long nBlocks = bytes >> sb->s_blocksize_bits;
unsigned long cnt = 0;
- unsigned long limit = global_page_state( NR_FREE_PAGES ) << (PAGE_SHIFT - sb->s_blocksize_bits);
+ unsigned long limit = global_zone_page_state( NR_FREE_PAGES ) << (PAGE_SHIFT - sb->s_blocksize_bits);
if ( limit >= 0x2000 )
limit -= 0x1000;
@@ -2531,7 +2531,7 @@ ufsd_buf_bio_end_io(
#ifdef BIO_UPTODATE
ub->error = error;
#else
- ub->error = bio->bi_error;
+ ub->error = bio->bi_status;
#endif
}
@@ -2591,7 +2591,7 @@ ufsd_buf_submit(
atomic_inc( &ub->io_remaining );
BIO_BISECTOR( bio ) = sector;
- bio->bi_bdev = bdev;
+ bio_set_dev(bio, bdev);
bio->bi_end_io = ufsd_buf_bio_end_io;
bio->bi_private = ub;
@@ -8613,7 +8613,7 @@ ufsd_end_io_read(
err = !test_bit( BIO_UPTODATE, &bio->bi_flags );
#else
// 4.3+
- int err = bio->bi_error;
+ int err = bio->bi_status;
#endif
// printk( "end_io_read at %llx sz=%x, cnt=%x\n", (UINT64)BIO_BISECTOR( bio ) << 9, BIO_BISIZE( bio ), (unsigned)bio->bi_vcnt );
@@ -8664,7 +8664,7 @@ ufsd_end_io_write(
err = !test_bit( BIO_UPTODATE, &bio->bi_flags );
#else
// 4.3+
- int err = bio->bi_error;
+ int err = bio->bi_status;
#endif
if ( err ) {
@@ -8704,7 +8704,7 @@ mpage_alloc(
struct bio *bio = bio_alloc( GFP_NOFS|__GFP_HIGH, nr_vecs ); // GFP_NOIO
if ( likely( NULL != bio ) ) {
BIO_BISECTOR( bio ) = first_sector;
- bio->bi_bdev = bdev;
+ bio_set_dev(bio, bdev);
DebugTrace( 0, UFSD_LEVEL_BIO, ("bio+: o=%" PSCT "x", first_sector << 9 ));
return bio;
@@ -12374,7 +12374,7 @@ ufsd_add_timer(
///////////////////////////////////////////////////////////
static void
flush_timer_fn(
- IN unsigned long data
+ IN struct timer_list *data
)
{
usuper *sbi = (usuper*)data;
@@ -12423,7 +12423,7 @@ ufsd_flush_thread(
//
// Set up an interval timer which can be used to trigger a flush wakeup after the flush interval expires
//
- setup_timer( &sbi->flush_timer, flush_timer_fn, (unsigned long)sbi );
+ timer_setup( &sbi->flush_timer, flush_timer_fn, 0 );
wake_up( &sbi->wait_done_flush );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment