Last active
June 22, 2019 18:11
-
-
Save maz-1/799710608243c5fa9b0c150f1071f3aa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -Naur old/ifslinux/config_check.c Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/config_check.c | |
--- old/ifslinux/config_check.c 2017-09-09 00:07:43.000000000 +0800 | |
+++ Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/config_check.c 2019-01-05 13:50:57.639006860 +0800 | |
@@ -160,7 +160,7 @@ | |
while (offset<fsize) { | |
oldfs = get_fs(); | |
set_fs(get_ds()); | |
- ret = vfs_read(filp, in, IN_SIZE, &offset); | |
+ ret = kernel_read(filp, in, IN_SIZE, &offset); | |
set_fs(oldfs); | |
if (ret < 1) { | |
diff -Naur old/ifslinux/ufsdjnl.c Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/ufsdjnl.c | |
--- old/ifslinux/ufsdjnl.c 2018-08-24 22:58:52.000000000 +0800 | |
+++ Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/ufsdjnl.c 2019-01-05 14:21:28.000000000 +0800 | |
@@ -280,7 +280,6 @@ | |
#define BJ_Reserved 6 // Buffer is reserved for access by journal | |
#define BJ_Types 7 | |
- | |
typedef struct jnl_head { | |
// Points back to our buffer_head. [jnl_lock_bh_hdr()] | |
@@ -1403,7 +1402,11 @@ | |
BUG_ON( size & ( size-1 ) ); // Must be a power of 2 | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ flags |= ___GFP_RETRY_MAYFAIL; | |
+#else | |
flags |= __GFP_REPEAT; | |
+#endif | |
if ( PAGE_SIZE == size ) | |
ptr = (void*)__get_free_pages( flags, 0 ); | |
else if ( size > PAGE_SIZE ) { | |
@@ -3202,12 +3205,20 @@ | |
jnl_unlock_bh_state( bh ); | |
// commit wakes up all shadow buffers after IO | |
for ( ; ; ) { | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ prepare_to_wait( wqh, &wait.wq_entry, TASK_UNINTERRUPTIBLE ); | |
+#else | |
prepare_to_wait( wqh, &wait.wait, TASK_UNINTERRUPTIBLE ); | |
+#endif | |
if ( BJ_Shadow != jh->jlist ) | |
break; | |
schedule(); | |
} | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ finish_wait( wqh, &wait.wq_entry ); | |
+#else | |
finish_wait( wqh, &wait.wait ); | |
+#endif | |
jnl_debug( JNL_TRACE_LEVEL_ACCESS|JNL_TRACE_LEVEL_COMMIT, "b=%"PSCT"x on shadow: wake\n", blocknr ); | |
goto repeat; | |
} | |
@@ -4865,7 +4876,12 @@ | |
// keep subsequent assertions sane | |
new_bh->b_state = 0; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0) | |
+ new_bh->b_end_io = NULL; | |
+ new_bh->b_private = NULL; | |
+#else | |
init_buffer( new_bh, NULL, NULL ); | |
+#endif | |
atomic_set( &new_bh->b_count, 1 ); | |
new_jh = jnl_add_hdr( new_bh ); // This sleeps | |
@@ -5717,12 +5733,20 @@ | |
// | |
// Helper function used to manage commit timeouts | |
/////////////////////////////////////////////////////////// | |
+ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
+static void commit_timeout( struct timer_list *t ) | |
+{ | |
+ jnl *j = from_timer(j, t, commit_timer); | |
+ wake_up_process(j->task); | |
+} | |
+#else | |
static void commit_timeout( unsigned long data ) | |
{ | |
struct task_struct *p = (struct task_struct*)data; | |
wake_up_process( p ); | |
} | |
- | |
+#endif | |
/////////////////////////////////////////////////////////// | |
// jnl_thread | |
@@ -5751,8 +5775,12 @@ | |
// | |
// Set up an interval timer which can be used to trigger a commit wakeup after the commit interval expires | |
// | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
+ timer_setup( &j->commit_timer, commit_timeout, 0 ); | |
+#else | |
setup_timer( &j->commit_timer, commit_timeout, (unsigned long)current ); | |
- | |
+#endif | |
+ | |
set_freezable(); | |
// Record that the journal thread is running | |
@@ -6270,9 +6298,13 @@ | |
) | |
{ | |
struct bio_batch *bb = bio->bi_private; | |
- | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ if ( bio->bi_status && (bio->bi_status != BLK_STS_TIMEOUT) ) | |
+ bb->error = bio->bi_status; | |
+#else | |
if ( bio->bi_error && (bio->bi_error != -EOPNOTSUPP) ) | |
bb->error = bio->bi_error; | |
+#endif | |
if ( atomic_dec_and_test( &bb->done ) ) | |
complete( bb->wait ); | |
bio_put( bio ); | |
@@ -6319,7 +6351,11 @@ | |
bio->bi_sector = sector; | |
#endif | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) | |
+ bio_set_dev(bio, bdev); | |
+#else | |
bio->bi_bdev = bdev; | |
+#endif | |
bio->bi_end_io = bio_batch_end_io; | |
bio->bi_private = &bb; | |
diff -Naur old/ifslinux/ufsdvfs.c Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/ufsdvfs.c | |
--- old/ifslinux/ufsdvfs.c 2018-08-24 22:58:52.000000000 +0800 | |
+++ Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/ufsdvfs.c 2019-01-05 14:21:28.000000000 +0800 | |
@@ -412,6 +412,18 @@ | |
// | |
#define UFSD_U(inode) (container_of((inode), struct unode, i)) | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,18,0) | |
+# define TIMESPEC timespec64 | |
+# if LINUX_VERSION_CODE < KERNEL_VERSION(4,20,0) | |
+# define CURRENT_KERNEL_TIME() timespec_to_timespec64(current_kernel_time()) | |
+# else | |
+# define CURRENT_KERNEL_TIME() current_kernel_time64() | |
+# endif | |
+#else | |
+# define TIMESPEC timespec | |
+# define CURRENT_KERNEL_TIME() current_kernel_time() | |
+#endif | |
+ | |
// | |
// Private superblock structure. | |
// Stored in super_block.s_fs_info | |
@@ -710,7 +722,7 @@ | |
static inline void | |
posix2kernel( | |
IN UINT64 tm, | |
- OUT struct timespec *ts | |
+ OUT struct TIMESPEC *ts | |
) | |
{ | |
union utimespec ut; | |
@@ -727,7 +739,7 @@ | |
/////////////////////////////////////////////////////////// | |
static inline UINT64 | |
kernel2posix( | |
- IN const struct timespec *ts | |
+ IN const struct TIMESPEC *ts | |
) | |
{ | |
union utimespec ut; | |
@@ -746,7 +758,7 @@ | |
UINT64 UFSDAPI_CALL | |
current_time_posix( void ) | |
{ | |
- struct timespec ts = current_kernel_time(); | |
+ struct TIMESPEC ts = CURRENT_KERNEL_TIME(); | |
return kernel2posix( &ts ); | |
} | |
#else | |
@@ -766,7 +778,7 @@ | |
/////////////////////////////////////////////////////////// | |
static inline UINT64 | |
kernel2nt( | |
- IN const struct timespec *ts | |
+ IN const struct TIMESPEC *ts | |
) | |
{ | |
// 10^7 units of 100 nanoseconds in one second | |
@@ -782,7 +794,7 @@ | |
static inline void | |
nt2kernel( | |
IN const UINT64 tm, | |
- OUT struct timespec *ts | |
+ OUT struct TIMESPEC *ts | |
) | |
{ | |
UINT64 t = tm - _100ns2seconds*SecondsToStartOf1970; | |
@@ -800,7 +812,7 @@ | |
UINT64 UFSDAPI_CALL | |
current_time_nt( void ) | |
{ | |
- struct timespec ts = current_kernel_time(); | |
+ struct TIMESPEC ts = CURRENT_KERNEL_TIME(); | |
return kernel2nt( &ts ); | |
} | |
@@ -815,12 +827,12 @@ | |
// | |
// Returns current time (to store in inode) | |
/////////////////////////////////////////////////////////// | |
-static inline struct timespec | |
+static inline struct TIMESPEC | |
ufsd_inode_current_time( | |
IN usuper *sbi | |
) | |
{ | |
- struct timespec ts = current_kernel_time(); | |
+ struct TIMESPEC ts = CURRENT_KERNEL_TIME(); | |
if ( is_hfs( &sbi->options ) ) | |
ts.tv_nsec = 0; | |
else if ( is_fat( &sbi->options ) ) { | |
@@ -848,11 +860,11 @@ | |
static inline int | |
ufsd_time_trunc( | |
IN usuper *sbi, | |
- IN const struct timespec *ts, | |
- IN OUT struct timespec *td | |
+ IN const struct TIMESPEC *ts, | |
+ IN OUT struct TIMESPEC *td | |
) | |
{ | |
- struct timespec t; | |
+ struct TIMESPEC t; | |
t.tv_sec = ts->tv_sec; | |
@@ -890,7 +902,7 @@ | |
static inline UINT64 | |
kernel2ufsd( | |
IN const usuper *sbi, | |
- IN const struct timespec *ts | |
+ IN const struct TIMESPEC *ts | |
) | |
{ | |
return is_posixtime( &sbi->options )? kernel2posix( ts ) : kernel2nt( ts ); | |
@@ -1704,7 +1716,12 @@ | |
} | |
bh->b_state = 0; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,16,0) | |
+ bh->b_end_io = end_buffer_read_sync; | |
+ bh->b_private = NULL; | |
+#else | |
init_buffer( bh, end_buffer_read_sync, NULL ); | |
+#endif | |
atomic_set( &bh->b_count, 2 ); | |
set_bh_page( bh, page, bytes2skip ); | |
bh->b_size = 512; | |
@@ -1776,8 +1793,13 @@ | |
unsigned long nr_pages, nr_anon, nr_free, max_ra; | |
struct blk_plug plug; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) | |
+ nr_anon = global_zone_page_state( NR_ACTIVE_ANON ); | |
+ nr_free = global_zone_page_state( NR_FREE_PAGES ); | |
+#else | |
nr_anon = global_page_state( NR_ACTIVE_ANON ); | |
nr_free = global_page_state( NR_FREE_PAGES ); | |
+#endif | |
max_ra = ( nr_anon + nr_free ) >> 1; | |
if ( 0 != sbi->options.raKb ) { | |
@@ -1808,11 +1830,17 @@ | |
INIT_LIST_HEAD( &page_pool ); | |
for ( nr_pages = 0; start < end; start++ ) { | |
struct page *page; | |
- | |
+ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0) | |
+ xa_lock_irq(&mapping->i_pages); | |
+ page = radix_tree_lookup( &mapping->i_pages, start ); | |
+ xa_unlock_irq(&mapping->i_pages); | |
+#else | |
spin_lock_irq( &mapping->tree_lock ); | |
page = radix_tree_lookup( &mapping->page_tree, start ); | |
spin_unlock_irq( &mapping->tree_lock ); | |
- | |
+#endif | |
+ | |
#if is_decl( RADIX_TREE_EXCEPTIONAL_ENTRY ) | |
if ( NULL != page && !radix_tree_exceptional_entry( page ) ) | |
continue; | |
@@ -1824,8 +1852,12 @@ | |
#if is_decl( PAGE_CACHE_ALLOC_READAHEAD ) | |
page = page_cache_alloc_readahead( mapping ); | |
#else | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
+ page = page_cache_alloc( mapping ); | |
+#else | |
page = page_cache_alloc_cold( mapping ); | |
#endif | |
+#endif | |
if ( NULL == page ) | |
break; | |
@@ -1885,7 +1917,11 @@ | |
sector_t devblock = offset >> sb->s_blocksize_bits; | |
unsigned long nBlocks = bytes >> sb->s_blocksize_bits; | |
unsigned long cnt = 0; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) | |
+ unsigned long limit = global_zone_page_state( NR_FREE_PAGES ) << (PAGE_SHIFT - sb->s_blocksize_bits); | |
+#else | |
unsigned long limit = global_page_state( NR_FREE_PAGES ) << (PAGE_SHIFT - sb->s_blocksize_bits); | |
+#endif | |
if ( limit >= 0x2000 ) | |
limit -= 0x1000; | |
@@ -2531,8 +2567,12 @@ | |
#ifdef BIO_UPTODATE | |
ub->error = error; | |
#else | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ ub->error = bio->bi_status; | |
+#else | |
ub->error = bio->bi_error; | |
#endif | |
+#endif | |
} | |
if ( !ub->error && ufsd_buf_is_vmapped( ub ) && FlagOn( ub->flags, UFSD_BUF_FLAG_READ ) ) { | |
@@ -2591,7 +2631,11 @@ | |
atomic_inc( &ub->io_remaining ); | |
BIO_BISECTOR( bio ) = sector; | |
- bio->bi_bdev = bdev; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) | |
+ bio_set_dev(bio, bdev); | |
+#else | |
+ bio->bi_bdev = bdev; | |
+#endif | |
bio->bi_end_io = ufsd_buf_bio_end_io; | |
bio->bi_private = ub; | |
@@ -5493,7 +5537,11 @@ | |
{ | |
if ( NULL == acl ) | |
return; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,17,0) | |
+ if ( refcount_dec_and_test( &acl->a_refcount ) ) | |
+#else | |
if ( atomic_dec_and_test( &acl->a_refcount ) ) | |
+#endif | |
kfree( acl ); | |
} | |
@@ -7045,7 +7093,7 @@ | |
{ | |
ssize_t ret; | |
loff_t end, i_size; | |
- struct timespec now; | |
+ struct TIMESPEC now; | |
int dirty = 0; | |
struct file *file = iocb->ki_filp; | |
struct address_space *mapping = file->f_mapping; | |
@@ -7394,7 +7442,7 @@ | |
{ | |
ssize_t ret; | |
loff_t i_size, end; | |
- struct timespec now; | |
+ struct TIMESPEC now; | |
struct file *file = iocb->ki_filp; | |
struct address_space *mapping = file->f_mapping; | |
struct inode *i = mapping->host; | |
@@ -8613,8 +8661,12 @@ | |
err = !test_bit( BIO_UPTODATE, &bio->bi_flags ); | |
#else | |
// 4.3+ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ int err = bio->bi_status; | |
+#else | |
int err = bio->bi_error; | |
#endif | |
+#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,8 +8716,12 @@ | |
err = !test_bit( BIO_UPTODATE, &bio->bi_flags ); | |
#else | |
// 4.3+ | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0) | |
+ int err = bio->bi_status; | |
+#else | |
int err = bio->bi_error; | |
#endif | |
+#endif | |
if ( err ) { | |
struct inode* i = bio->bi_io_vec[0].bv_page->mapping->host; | |
@@ -8704,7 +8760,11 @@ | |
struct bio *bio = bio_alloc( GFP_NOFS|__GFP_HIGH, nr_vecs ); // GFP_NOIO | |
if ( likely( NULL != bio ) ) { | |
BIO_BISECTOR( bio ) = first_sector; | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) | |
+ bio_set_dev(bio, bdev); | |
+#else | |
bio->bi_bdev = bdev; | |
+#endif | |
DebugTrace( 0, UFSD_LEVEL_BIO, ("bio+: o=%" PSCT "x", first_sector << 9 )); | |
return bio; | |
@@ -12374,11 +12434,17 @@ | |
/////////////////////////////////////////////////////////// | |
static void | |
flush_timer_fn( | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
+ IN struct timer_list *t | |
+ ) | |
+{ | |
+ usuper *sbi = from_timer(sbi, t, flush_timer); | |
+#else | |
IN unsigned long data | |
) | |
{ | |
usuper *sbi = (usuper*)data; | |
- | |
+#endif | |
if ( !sbi->bdirty ) { | |
// Do not wake up flush thread | |
} else { | |
@@ -12423,8 +12489,12 @@ | |
// | |
// Set up an interval timer which can be used to trigger a flush wakeup after the flush interval expires | |
// | |
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,15,0) | |
+ timer_setup( &sbi->flush_timer, flush_timer_fn, 0 ); | |
+#else | |
setup_timer( &sbi->flush_timer, flush_timer_fn, (unsigned long)sbi ); | |
- | |
+#endif | |
+ | |
wake_up( &sbi->wait_done_flush ); | |
set_freezable(); | |
@@ -14431,7 +14501,7 @@ | |
// | |
MODULE_DESCRIPTION("Paragon " QUOTED_UFSD_DEVICE " driver"); | |
MODULE_AUTHOR("Andrey Shedel & Alexander Mamaev"); | |
-MODULE_LICENSE("Commercial product"); | |
+MODULE_LICENSE("GPL"); | |
#ifdef UFSD_TRACE | |
module_param_string(trace, ufsd_trace_level_, sizeof(ufsd_trace_level_), S_IRUGO); | |
diff -Naur old/ifslinux/vfsdebug.c Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/vfsdebug.c | |
--- old/ifslinux/vfsdebug.c 2017-09-09 00:07:43.000000000 +0800 | |
+++ Paragon-715-PRE_NTFS_Linux_9.5_Pro/ifslinux/vfsdebug.c 2019-01-05 14:06:13.990438343 +0800 | |
@@ -907,7 +907,11 @@ | |
return snprintf( buffer, buffer_len, "%ld-%02d-%02d %02d:%02d:%02d UTC", 1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec ); | |
#else | |
// print local time | |
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(4,20,0) | |
+ time64_to_tm( get_seconds(), -sys_tz.tz_minuteswest * 60, &tm ); | |
+ #else | |
time_to_tm( get_seconds(), -sys_tz.tz_minuteswest * 60, &tm ); | |
+ #endif | |
return snprintf( buffer, buffer_len, "%ld-%02d-%02d %02d:%02d:%02d", 1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec ); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks.