fs/ntfs3: Fix warning in ni_fiemap
Subsystems (3)
Sasha Levin
maintainerPATCH 1/3 fs/ntfs3: Fix warning in ni_fiemap
From: Konstantin Komarov <[email protected]>
[ Upstream commit e2705dd3d16d1000f1fd8193d82447065de8c899 ]
Use local runs_tree instead of cached. This way excludes rw_semaphore lock.
--- fs/ntfs3/attrib.c | 9 ++-- fs/ntfs3/frecord.c | 103 +++++++-------------------------------------- fs/ntfs3/ntfs_fs.h | 3 +- 3 files changed, 21 insertions(+), 94 deletions(-)
fs/ntfs3/attrib.c +4 -5
@@ -977,7 +977,7 @@ int attr_data_get_block(struct ntfs_inode *ni, CLST vcn, CLST clen, CLST *lcn,/* Check for compressed frame. */ err =attr_is_frame_compressed (ni, attr_b, vcn >>NTFS_LZNT_CUNIT , - &hint); + &hint, run);if (err) goto out;
@@ -1521,16 +1521,16 @@ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr,* attr_is_frame_compressed - Used to detect compressed frame. * * attr - base (primary) attribute segment. +* run - run to use, usually == &ni->file.run. * Only base segments contains valid 'attr->nres.c_unit' */ int attr_is_frame_compressed (struct ntfs_inode *ni,struct ATTRIB *attr, -CLST frame,CLST *clst_data) +CLST frame,CLST *clst_data,struct runs_tree *run) {int err;u32 clst_frame;CLST clen, lcn, vcn, alen, slen, vcn_next;size_t idx; -struct runs_tree *run; *clst_data =0 ;
@@ -1542,7 +1542,6 @@ int attr_is_frame_compressed(struct ntfs_inode *ni, struct ATTRIB *attr, clst_frame =1u << attr->nres.c_unit; vcn = frame * clst_frame; - run = &ni->file.run;if (!run_lookup_entry (run, vcn, &lcn, &clen, &idx)) { err = attr_load_runs_vcn(ni, attr->type, attr_name(attr),
@@ -1678,7 +1677,7 @@ int attr_allocate_frame(struct ntfs_inode *ni, CLST frame, size_t compr_size,if (err) goto out; - err =attr_is_frame_compressed (ni, attr_b, frame, &clst_data); + err =attr_is_frame_compressed (ni, attr_b, frame, &clst_data, run);if (err) goto out;
fs/ntfs3/frecord.c +15 -88
193 lines not on this page · raw message
fs/ntfs3/ntfs_fs.h +2 -1
@@ -446,7 +446,8 @@ int attr_wof_frame_info(struct ntfs_inode *ni, struct ATTRIB *attr, struct runs_tree *run, u64 frame, u64 frames, u8 frame_bits, u32 *ondisk_size, u64 *vbo_data);int attr_is_frame_compressed (struct ntfs_inode *ni,struct ATTRIB *attr, -CLST frame,CLST *clst_data); +CLST frame,CLST *clst_data, +struct runs_tree *run);int attr_allocate_frame (struct ntfs_inode *ni,CLST frame,size_t compr_size,u64 new_valid);int attr_collapse_range (struct ntfs_inode *ni,u64 vbo,u64 bytes);
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/3 fs/ntfs3: Fix case when unmarked clusters intersect with zone
From: Konstantin Komarov <[email protected]>
[ Upstream commit 5fc982fe7eca9d0cf7b25832450ebd4f7c8e1c36 ]
--- fs/ntfs3/run.c | 40 ++++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
fs/ntfs3/run.c +30 -10
@@ -1055,8 +1055,8 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino, {int ret, err;CLST next_vcn, lcn, len; -size_t index; -bool ok; +size_t index, done; +bool ok, zone;struct wnd_bitmap *wnd; ret =run_unpack (run, sbi, ino, svcn, evcn, vcn, run_buf, run_buf_size);
@@ -1087,8 +1087,9 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,continue ;down_read_nested (&wnd->rw_lock,BITMAP_MUTEX_CLUSTERS ); + zone =max (wnd->zone_bit, lcn) <min (wnd->zone_end, lcn + len);/* Check for free blocks. */ - ok =wnd_is_used (wnd, lcn, len); + ok = !zone &&wnd_is_used (wnd, lcn, len);up_read (&wnd->rw_lock);if (ok)continue ;
@@ -1096,14 +1097,33 @@ int run_unpack_ex(struct runs_tree *run, struct ntfs_sb_info *sbi, CLST ino,/* Looks like volume is corrupted. */ ntfs_set_state (sbi,NTFS_DIRTY_ERROR ); -if (down_write_trylock (&wnd->rw_lock)) { -/* Mark all zero bits as used in range [lcn, lcn+len). */ -size_t done; - err =wnd_set_used_safe (wnd, lcn, len, &done); -up_write (&wnd->rw_lock); -if (err) -return err; +if (!down_write_trylock (&wnd->rw_lock)) +continue ; + +if (zone) { +/* +* Range [lcn, lcn + len) intersects with zone. +* To avoid complex with zone just turn it off. +*/ +wnd_zone_set (wnd,0 ,0 ); + } + +/* Mark all zero bits as used in range [lcn, lcn+len). */ + err =wnd_set_used_safe (wnd, lcn, len, &done); +if (zone) { +/* Restore zone. Lock mft run. */ +struct rw_semaphore *lock; + lock =is_mounted (sbi) ? &sbi->mft.ni->file.run_lock : +NULL ; +if (lock) +down_read (lock); +ntfs_refresh_zone (sbi); +if (lock) +up_read (lock); } +up_write (&wnd->rw_lock); +if (err) +return err; }return ret;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/3 regulator: qcom-rpmh: Update ranges for FTSMPS525
In reply to Sasha LevinFrom: Melody Olvera <[email protected]>
[ Upstream commit eeecf953d697cb7f0d916f9908a2b9f451bb2667 ]
All FTSMPS525 regulators support LV and MV ranges; however, the boot loader firmware will determine which range to use as the device boots.
Nonetheless, the driver cannot determine which range was selected, so hardcoding the ranges as either LV or MV will not cover all cases as it's possible for the firmware to select a range not supported by the driver's current hardcoded values.
To this end, combine the ranges for the FTSMPS525s into one struct and point all regulators to the updated combined struct. This should work on all boards regardless of which range is selected by the firmware and more accurately caputres the capability of this regulator on a hardware level.
--- drivers/regulator/qcom-rpmh-regulator.c | 83 +++++++++++-------------- 1 file changed, 36 insertions(+), 47 deletions(-)
drivers/regulator/qcom-rpmh-regulator.c +36 -47
@@ -843,26 +843,15 @@ static const struct rpmh_vreg_hw_data pmic5_ftsmps520 = { .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, }; -static const struct rpmh_vreg_hw_data pmic5_ftsmps525_lv = { +static const struct rpmh_vreg_hw_data pmic5_ftsmps525 = { .regulator_type =VRM , .ops = &rpmh_regulator_vrm_ops, .voltage_ranges = (struct linear_range []) {REGULATOR_LINEAR_RANGE (300000 ,0 ,267 ,4000 ), +REGULATOR_LINEAR_RANGE (1376000 ,268 ,438 ,8000 ), }, - .n_linear_ranges =1 , - .n_voltages =268 , - .pmic_mode_map = pmic_mode_map_pmic5_smps, - .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, -}; - -static const struct rpmh_vreg_hw_data pmic5_ftsmps525_mv = { - .regulator_type =VRM , - .ops = &rpmh_regulator_vrm_ops, - .voltage_ranges = (struct linear_range []) { -REGULATOR_LINEAR_RANGE (600000 ,0 ,267 ,8000 ), - }, - .n_linear_ranges =1 , - .n_voltages =268 , + .n_linear_ranges =2 , + .n_voltages =439 , .pmic_mode_map = pmic_mode_map_pmic5_smps, .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, };
@@ -1190,12 +1179,12 @@ static const struct rpmh_vreg_init_data pm8550_vreg_data[] = { };static const struct rpmh_vreg_init_data pm8550vs_vreg_data[] = { -RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525_lv,"vdd-s1" ), -RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525_lv,"vdd-s2" ), -RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525_lv,"vdd-s3" ), -RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525_lv,"vdd-s4" ), -RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525_lv,"vdd-s5" ), -RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525_mv,"vdd-s6" ), +RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525,"vdd-s1" ), +RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525,"vdd-s2" ), +RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525,"vdd-s3" ), +RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525,"vdd-s4" ), +RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525,"vdd-s5" ), +RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525,"vdd-s6" ),RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo515,"vdd-l1" ),RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo515,"vdd-l2" ),RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo515,"vdd-l3" ),
@@ -1203,14 +1192,14 @@ static const struct rpmh_vreg_init_data pm8550vs_vreg_data[] = { };static const struct rpmh_vreg_init_data pm8550ve_vreg_data[] = { -RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525_lv,"vdd-s1" ), -RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525_lv,"vdd-s2" ), -RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525_lv,"vdd-s3" ), -RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525_mv,"vdd-s4" ), -RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525_lv,"vdd-s5" ), -RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525_lv,"vdd-s6" ), -RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525_lv,"vdd-s7" ), -RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525_lv,"vdd-s8" ), +RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525,"vdd-s1" ), +RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525,"vdd-s2" ), +RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525,"vdd-s3" ), +RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525,"vdd-s4" ), +RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525,"vdd-s5" ), +RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525,"vdd-s6" ), +RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525,"vdd-s7" ), +RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525,"vdd-s8" ),RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo515,"vdd-l1" ),RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo515,"vdd-l2" ),RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo515,"vdd-l3" ),
@@ -1218,14 +1207,14 @@ static const struct rpmh_vreg_init_data pm8550ve_vreg_data[] = { };static const struct rpmh_vreg_init_data pmc8380_vreg_data[] = { -RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525_lv,"vdd-s1" ), -RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525_lv,"vdd-s2" ), -RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525_lv,"vdd-s3" ), -RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525_mv,"vdd-s4" ), -RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525_lv,"vdd-s5" ), -RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525_lv,"vdd-s6" ), -RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525_lv,"vdd-s7" ), -RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525_lv,"vdd-s8" ), +RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525,"vdd-s1" ), +RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525,"vdd-s2" ), +RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525,"vdd-s3" ), +RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525,"vdd-s4" ), +RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525,"vdd-s5" ), +RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525,"vdd-s6" ), +RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525,"vdd-s7" ), +RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525,"vdd-s8" ),RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo515,"vdd-l1" ),RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo515,"vdd-l2" ),RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo515,"vdd-l3" ),
@@ -1409,16 +1398,16 @@ static const struct rpmh_vreg_init_data pmx65_vreg_data[] = { };static const struct rpmh_vreg_init_data pmx75_vreg_data[] = { -RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525_lv,"vdd-s1" ), -RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525_lv,"vdd-s2" ), -RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525_lv,"vdd-s3" ), -RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525_mv,"vdd-s4" ), -RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525_lv,"vdd-s5" ), -RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525_lv,"vdd-s6" ), -RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525_lv,"vdd-s7" ), -RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525_lv,"vdd-s8" ), -RPMH_VREG ("smps9" ,"smp%s9" , &pmic5_ftsmps525_lv,"vdd-s9" ), -RPMH_VREG ("smps10" ,"smp%s10" , &pmic5_ftsmps525_lv,"vdd-s10" ), +RPMH_VREG ("smps1" ,"smp%s1" , &pmic5_ftsmps525,"vdd-s1" ), +RPMH_VREG ("smps2" ,"smp%s2" , &pmic5_ftsmps525,"vdd-s2" ), +RPMH_VREG ("smps3" ,"smp%s3" , &pmic5_ftsmps525,"vdd-s3" ), +RPMH_VREG ("smps4" ,"smp%s4" , &pmic5_ftsmps525,"vdd-s4" ), +RPMH_VREG ("smps5" ,"smp%s5" , &pmic5_ftsmps525,"vdd-s5" ), +RPMH_VREG ("smps6" ,"smp%s6" , &pmic5_ftsmps525,"vdd-s6" ), +RPMH_VREG ("smps7" ,"smp%s7" , &pmic5_ftsmps525,"vdd-s7" ), +RPMH_VREG ("smps8" ,"smp%s8" , &pmic5_ftsmps525,"vdd-s8" ), +RPMH_VREG ("smps9" ,"smp%s9" , &pmic5_ftsmps525,"vdd-s9" ), +RPMH_VREG ("smps10" ,"smp%s10" , &pmic5_ftsmps525,"vdd-s10" ),RPMH_VREG ("ldo1" ,"ldo%s1" , &pmic5_nldo515,"vdd-l1" ),RPMH_VREG ("ldo2" ,"ldo%s2" , &pmic5_nldo515,"vdd-l2-18" ),RPMH_VREG ("ldo3" ,"ldo%s3" , &pmic5_nldo515,"vdd-l3" ),
Signature · 1 line
2.43.0