Skip to content

Commit d7e0c9b

Browse files
authored
Merge pull request #75 from RoyWFHuang/master
Support Linux 6.12
2 parents a9477a6 + 79cb31b commit d7e0c9b

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

file.c

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,14 @@ static int simplefs_writepage(struct page *page, struct writeback_control *wbc)
113113
* the data into the page cache. This function checks if the write operation
114114
* can complete and allocates the necessary blocks through block_write_begin().
115115
*/
116-
#if SIMPLEFS_AT_LEAST(5, 19, 0)
116+
#if SIMPLEFS_AT_LEAST(6, 12, 0)
117+
static int simplefs_write_begin(struct file *file,
118+
struct address_space *mapping,
119+
loff_t pos,
120+
unsigned int len,
121+
struct folio **foliop,
122+
void **fsdata)
123+
#elif SIMPLEFS_AT_LEAST(5, 19, 0)
117124
static int simplefs_write_begin(struct file *file,
118125
struct address_space *mapping,
119126
loff_t pos,
@@ -147,7 +154,9 @@ static int simplefs_write_begin(struct file *file,
147154
return -ENOSPC;
148155

149156
/* prepare the write */
150-
#if SIMPLEFS_AT_LEAST(5, 19, 0)
157+
#if SIMPLEFS_AT_LEAST(6, 12, 0)
158+
err = block_write_begin(mapping, pos, len, foliop, simplefs_file_get_block);
159+
#elif SIMPLEFS_AT_LEAST(5, 19, 0)
151160
err = block_write_begin(mapping, pos, len, pagep, simplefs_file_get_block);
152161
#else
153162
err = block_write_begin(mapping, pos, len, flags, pagep,
@@ -163,13 +172,23 @@ static int simplefs_write_begin(struct file *file,
163172
* cache. This function updates inode metadata and truncates the file if
164173
* necessary.
165174
*/
175+
#if SIMPLEFS_AT_LEAST(6, 12, 0)
176+
static int simplefs_write_end(struct file *file,
177+
struct address_space *mapping,
178+
loff_t pos,
179+
unsigned int len,
180+
unsigned int copied,
181+
struct folio *foliop,
182+
void *fsdata)
183+
#else
166184
static int simplefs_write_end(struct file *file,
167185
struct address_space *mapping,
168186
loff_t pos,
169187
unsigned int len,
170188
unsigned int copied,
171189
struct page *page,
172190
void *fsdata)
191+
#endif
173192
{
174193
struct inode *inode = file->f_inode;
175194
struct simplefs_inode_info *ci = SIMPLEFS_INODE(inode);
@@ -180,7 +199,12 @@ static int simplefs_write_end(struct file *file,
180199
uint32_t nr_blocks_old;
181200

182201
/* Complete the write() */
202+
#if SIMPLEFS_AT_LEAST(6, 12, 0)
203+
int ret =
204+
generic_write_end(file, mapping, pos, len, copied, foliop, fsdata);
205+
#else
183206
int ret = generic_write_end(file, mapping, pos, len, copied, page, fsdata);
207+
#endif
184208
if (ret < len) {
185209
pr_err("wrote less than requested.");
186210
return ret;

0 commit comments

Comments
 (0)